@todoist/automations-cli 2.1.1 → 2.1.3
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/README.md +3 -0
- package/dist/{chunk-SCCCZHFH.js → chunk-4JG637ZB.js} +4 -2
- package/dist/chunk-4JG637ZB.js.map +7 -0
- package/dist/index.js +362 -298
- package/dist/index.js.map +4 -4
- package/dist/lib/skills/update-installed.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-SCCCZHFH.js.map +0 -7
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
collectSkillStatus,
|
|
8
8
|
getInstaller,
|
|
9
9
|
updateAllInstalledSkills
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4JG637ZB.js";
|
|
11
11
|
|
|
12
12
|
// ../../node_modules/jsonify/lib/parse.js
|
|
13
13
|
var require_parse = __commonJS({
|
|
@@ -8553,7 +8553,7 @@ import { fileURLToPath } from "node:url";
|
|
|
8553
8553
|
// package.json
|
|
8554
8554
|
var package_default = {
|
|
8555
8555
|
name: "@todoist/automations-cli",
|
|
8556
|
-
version: "2.1.
|
|
8556
|
+
version: "2.1.3",
|
|
8557
8557
|
description: "Command-line client for Todoist Automations",
|
|
8558
8558
|
type: "module",
|
|
8559
8559
|
bin: {
|
|
@@ -8613,7 +8613,7 @@ var package_default = {
|
|
|
8613
8613
|
esbuild: "0.28.2",
|
|
8614
8614
|
"semantic-release": "25.0.9",
|
|
8615
8615
|
typescript: "6.0.3",
|
|
8616
|
-
vitest: "5.0
|
|
8616
|
+
vitest: "5.1.0"
|
|
8617
8617
|
},
|
|
8618
8618
|
engines: {
|
|
8619
8619
|
node: ">=24"
|
|
@@ -28707,6 +28707,28 @@ function parseIfCondition(condition) {
|
|
|
28707
28707
|
};
|
|
28708
28708
|
}
|
|
28709
28709
|
|
|
28710
|
+
// ../../packages/sdk/dist/core/dist/esm/utils/template.js
|
|
28711
|
+
function* templatePlaceholders(template) {
|
|
28712
|
+
let cursor = 0;
|
|
28713
|
+
while (cursor < template.length) {
|
|
28714
|
+
const start = template.indexOf("{{", cursor);
|
|
28715
|
+
if (start === -1) return;
|
|
28716
|
+
const close = template.indexOf("}", start + 2);
|
|
28717
|
+
if (close === -1) return;
|
|
28718
|
+
cursor = close + 1;
|
|
28719
|
+
if (template[close + 1] !== "}") continue;
|
|
28720
|
+
cursor++;
|
|
28721
|
+
yield {
|
|
28722
|
+
start,
|
|
28723
|
+
end: cursor,
|
|
28724
|
+
reference: template.slice(start + 2, close).trim()
|
|
28725
|
+
};
|
|
28726
|
+
}
|
|
28727
|
+
}
|
|
28728
|
+
function extractTemplateVariables(template) {
|
|
28729
|
+
return Array.from(templatePlaceholders(template), ({ reference }) => reference);
|
|
28730
|
+
}
|
|
28731
|
+
|
|
28710
28732
|
// ../../packages/sdk/dist/core/dist/esm/schemas/manifest.helpers.js
|
|
28711
28733
|
function getManifestTriggers(manifest) {
|
|
28712
28734
|
return manifest.triggers ?? [];
|
|
@@ -29044,6 +29066,7 @@ var codeStepSchema = baseStepSchema.merge(external_exports.object({
|
|
|
29044
29066
|
version: "5.9"
|
|
29045
29067
|
}).meta({ description: "An object defining the execution environment. If omitted, it defaults to TypeScript 5.9." }),
|
|
29046
29068
|
code: external_exports.string().meta({ description: "The code to execute. It has access to trigger and steps objects." }),
|
|
29069
|
+
tools: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())).optional().meta({ description: 'A mapping from MCP server connector IDs to arrays of their tool names that the code may call through mcp (e.g., {"todoist-comms": ["create-thread"]}). Omit it when the code calls no tools.' }),
|
|
29047
29070
|
extractedUrls: external_exports.array(external_exports.url()).optional().meta({ description: "URLs that will be fetched during step execution (auto-extracted from code)" })
|
|
29048
29071
|
}));
|
|
29049
29072
|
var searchStepSchema = baseStepSchema.merge(external_exports.object({
|
|
@@ -29131,7 +29154,8 @@ var partialManifestSchema = manifestSchemaBase.partial().extend({
|
|
|
29131
29154
|
manifestVersion: true,
|
|
29132
29155
|
steps: true
|
|
29133
29156
|
});
|
|
29134
|
-
var
|
|
29157
|
+
var templateReferenceRegex = /^[\p{ID_Continue}$-]+(?:\.[\p{ID_Continue}$-]+)*$/u;
|
|
29158
|
+
var codegenTemplateReferenceRegex = /\{\{\s*([\w.]+)\s*\}\}/g;
|
|
29135
29159
|
var codeStepReferenceRegex = /\bsteps\.([a-zA-Z][a-zA-Z0-9]*)(?:\.([a-zA-Z_][\w.]*))?/g;
|
|
29136
29160
|
var backtickStepReferenceRegex = /`steps\.([a-zA-Z][a-zA-Z0-9]*)(?:\.([a-zA-Z_][\w.]*))?`/g;
|
|
29137
29161
|
function extractStepReferences(text2, regex) {
|
|
@@ -29170,7 +29194,8 @@ function validateStepReference({ stepId, referencedStepId, propertyPath, context
|
|
|
29170
29194
|
}
|
|
29171
29195
|
return null;
|
|
29172
29196
|
}
|
|
29173
|
-
function validateTemplateVariable({ variable, context, stepId, currentStepGuard, sourceType = "prompt" }) {
|
|
29197
|
+
function validateTemplateVariable({ variable, context, stepId, currentStepGuard, sourceType = "prompt", interpolated = true }) {
|
|
29198
|
+
if (interpolated && !templateReferenceRegex.test(variable)) return `Step "${stepId}" ${sourceType} contains an invalid placeholder "{{${variable}}}". Use only dot-separated field references such as {{trigger.field}} or {{steps.stepId.field}}. Calculate expressions in a preceding step and reference its output.`;
|
|
29174
29199
|
const parts = variable.split(".").filter(Boolean);
|
|
29175
29200
|
if (parts.length === 0) return null;
|
|
29176
29201
|
const [root16, ...rest] = parts;
|
|
@@ -29200,14 +29225,6 @@ function validateTemplateVariable({ variable, context, stepId, currentStepGuard,
|
|
|
29200
29225
|
}
|
|
29201
29226
|
return `Step "${stepId}" ${sourceType} references unsupported template variable "{{${variable}}}". Allowed roots are {{trigger...}} and {{steps.<stepId>...}}.`;
|
|
29202
29227
|
}
|
|
29203
|
-
function extractTemplateVariables(prompt) {
|
|
29204
|
-
const variables = [];
|
|
29205
|
-
for (const match of prompt.matchAll(templateVariableRegex)) {
|
|
29206
|
-
const variable = match[0]?.replace(/\{\{\s*|\s*\}\}/g, "").trim();
|
|
29207
|
-
if (variable) variables.push(variable);
|
|
29208
|
-
}
|
|
29209
|
-
return variables;
|
|
29210
|
-
}
|
|
29211
29228
|
function resolveTriggersFromData(data) {
|
|
29212
29229
|
if (data.triggers && Array.isArray(data.triggers) && data.triggers.length > 0) return data.triggers;
|
|
29213
29230
|
return [];
|
|
@@ -29462,13 +29479,14 @@ function validateManifestTemplateVariables(data, ctx) {
|
|
|
29462
29479
|
});
|
|
29463
29480
|
}
|
|
29464
29481
|
if ("prompt" in step && typeof step.prompt === "string") {
|
|
29465
|
-
const variables = extractTemplateVariables(step.prompt);
|
|
29482
|
+
const variables = step.type === "codegen" ? Array.from(step.prompt.matchAll(codegenTemplateReferenceRegex), (match) => (match[1] ?? "").trim()) : extractTemplateVariables(step.prompt);
|
|
29466
29483
|
for (const variable of variables) {
|
|
29467
29484
|
const error62 = validateTemplateVariable({
|
|
29468
29485
|
variable,
|
|
29469
29486
|
context,
|
|
29470
29487
|
stepId: step.id,
|
|
29471
|
-
currentStepGuard
|
|
29488
|
+
currentStepGuard,
|
|
29489
|
+
interpolated: step.type !== "codegen"
|
|
29472
29490
|
});
|
|
29473
29491
|
if (!error62) continue;
|
|
29474
29492
|
const parts = variable.split(".");
|
|
@@ -29982,254 +30000,6 @@ var FAILURE_CATEGORY_REGISTRY = {
|
|
|
29982
30000
|
var FAILURE_CATEGORIES = Object.keys(FAILURE_CATEGORY_REGISTRY);
|
|
29983
30001
|
var SKIP_CATEGORIES = USAGE_BILLING_AUTHORIZATION_DENIAL_REASONS;
|
|
29984
30002
|
|
|
29985
|
-
// ../../packages/sdk/dist/core/dist/esm/schemas/automation.schema.js
|
|
29986
|
-
var runStatusSchema = external_exports.discriminatedUnion("status", [
|
|
29987
|
-
external_exports.object({
|
|
29988
|
-
status: external_exports.literal("pending"),
|
|
29989
|
-
lastRun: external_exports.iso.datetime().optional()
|
|
29990
|
-
}),
|
|
29991
|
-
external_exports.object({
|
|
29992
|
-
status: external_exports.literal("running"),
|
|
29993
|
-
lastRun: external_exports.iso.datetime()
|
|
29994
|
-
}),
|
|
29995
|
-
external_exports.object({
|
|
29996
|
-
status: external_exports.literal("completed"),
|
|
29997
|
-
lastRun: external_exports.iso.datetime()
|
|
29998
|
-
}),
|
|
29999
|
-
external_exports.object({
|
|
30000
|
-
status: external_exports.literal("failed"),
|
|
30001
|
-
lastRun: external_exports.iso.datetime(),
|
|
30002
|
-
failureReason: external_exports.string().optional()
|
|
30003
|
-
}),
|
|
30004
|
-
external_exports.object({
|
|
30005
|
-
status: external_exports.literal("cancelled"),
|
|
30006
|
-
lastRun: external_exports.iso.datetime()
|
|
30007
|
-
}),
|
|
30008
|
-
external_exports.object({
|
|
30009
|
-
status: external_exports.literal("skipped"),
|
|
30010
|
-
lastRun: external_exports.iso.datetime(),
|
|
30011
|
-
skipReason: external_exports.string().optional(),
|
|
30012
|
-
skipCategory: external_exports.enum(SKIP_CATEGORIES).optional().catch(void 0)
|
|
30013
|
-
})
|
|
30014
|
-
]);
|
|
30015
|
-
var automationSchema = external_exports.object({
|
|
30016
|
-
id: external_exports.string(),
|
|
30017
|
-
connections: external_exports.array(ConnectionDetailsSchema),
|
|
30018
|
-
enabled: external_exports.boolean(),
|
|
30019
|
-
status: runStatusSchema,
|
|
30020
|
-
connectionStatus: external_exports.enum(AUTOMATION_CONNECTION_STATUSES),
|
|
30021
|
-
draftId: external_exports.string().nullable(),
|
|
30022
|
-
manifest: external_exports.union([manifestSchema, external_exports.record(external_exports.string(), external_exports.unknown())]).nullable(),
|
|
30023
|
-
updatedAt: external_exports.iso.datetime(),
|
|
30024
|
-
createdBy: RolloutCompatibleNullableStringSchema,
|
|
30025
|
-
updatedBy: RolloutCompatibleNullableStringSchema,
|
|
30026
|
-
workspaceId: external_exports.string().nullable(),
|
|
30027
|
-
visibility: external_exports.enum(AUTOMATION_VISIBILITIES),
|
|
30028
|
-
isOwner: external_exports.boolean(),
|
|
30029
|
-
disabledReason: external_exports.enum(AUTOMATION_DISABLED_REASONS).nullable()
|
|
30030
|
-
});
|
|
30031
|
-
var automationListResponseSchema = external_exports.object({
|
|
30032
|
-
data: external_exports.array(automationSchema),
|
|
30033
|
-
nextCursor: external_exports.string().nullable()
|
|
30034
|
-
});
|
|
30035
|
-
var triggerAutomationResponseSchema = external_exports.object({
|
|
30036
|
-
automationId: external_exports.string(),
|
|
30037
|
-
runId: external_exports.string(),
|
|
30038
|
-
status: external_exports.enum(AUTOMATION_RUN_STATUSES)
|
|
30039
|
-
});
|
|
30040
|
-
external_exports.object({
|
|
30041
|
-
enabled: external_exports.boolean().optional(),
|
|
30042
|
-
manifest: manifestSchema.optional()
|
|
30043
|
-
}).refine((data) => Object.keys(data).length > 0, { message: "At least one field must be provided" }).meta({ id: "UpdateAutomation" });
|
|
30044
|
-
external_exports.object({
|
|
30045
|
-
name: external_exports.string().min(1),
|
|
30046
|
-
description: external_exports.string()
|
|
30047
|
-
}).meta({ id: "UpdateAutomationMetadata" });
|
|
30048
|
-
external_exports.object({ value: scheduleValueSchema }).meta({ id: "UpdateAutomationSchedule" });
|
|
30049
|
-
external_exports.object({ visibility: external_exports.enum(AUTOMATION_VISIBILITIES) }).meta({ id: "UpdateAutomationVisibility" });
|
|
30050
|
-
external_exports.object({ visibility: external_exports.enum(AUTOMATION_VISIBILITIES).default("workspace") }).meta({ id: "MoveAutomation" });
|
|
30051
|
-
|
|
30052
|
-
// ../../packages/sdk/dist/core/dist/esm/schemas/connector.schema.js
|
|
30053
|
-
var TriggerSupportedEventSchema = external_exports.object({
|
|
30054
|
-
id: external_exports.string(),
|
|
30055
|
-
name: external_exports.string(),
|
|
30056
|
-
description: external_exports.string()
|
|
30057
|
-
});
|
|
30058
|
-
var ConnectorCapabilitiesSchema = external_exports.object({
|
|
30059
|
-
mcp: external_exports.object({
|
|
30060
|
-
serverUrl: external_exports.string(),
|
|
30061
|
-
scopes: external_exports.array(external_exports.string()),
|
|
30062
|
-
connectionIds: external_exports.array(external_exports.string())
|
|
30063
|
-
}).optional(),
|
|
30064
|
-
triggers: external_exports.object({
|
|
30065
|
-
scopes: external_exports.array(external_exports.string()),
|
|
30066
|
-
connectionIds: external_exports.array(external_exports.string()),
|
|
30067
|
-
supportedEvents: external_exports.array(TriggerSupportedEventSchema)
|
|
30068
|
-
}).optional()
|
|
30069
|
-
});
|
|
30070
|
-
var McpServerUrlInputSchema = external_exports.object({
|
|
30071
|
-
template: external_exports.string().nullable(),
|
|
30072
|
-
customUrl: external_exports.object({ placeholder: external_exports.string() }).nullable()
|
|
30073
|
-
});
|
|
30074
|
-
var ConnectorSchema = external_exports.object({
|
|
30075
|
-
id: external_exports.string(),
|
|
30076
|
-
name: external_exports.string(),
|
|
30077
|
-
description: external_exports.string(),
|
|
30078
|
-
iconUrl: external_exports.url().nullable().optional(),
|
|
30079
|
-
capabilities: ConnectorCapabilitiesSchema,
|
|
30080
|
-
requiresConnection: external_exports.boolean(),
|
|
30081
|
-
isSystem: external_exports.boolean().optional(),
|
|
30082
|
-
isManaged: external_exports.boolean().optional(),
|
|
30083
|
-
connectsViaCli: external_exports.boolean().optional(),
|
|
30084
|
-
mcpServerUrlInput: McpServerUrlInputSchema.optional()
|
|
30085
|
-
});
|
|
30086
|
-
var GetConnectorsQuerySchema = external_exports.object({ query: external_exports.string().optional() });
|
|
30087
|
-
var GetConnectorActionsQuerySchema = external_exports.object({
|
|
30088
|
-
connectionId: external_exports.uuid().optional(),
|
|
30089
|
-
names: external_exports.preprocess((value) => typeof value === "string" ? value.split(",") : value, external_exports.array(external_exports.string().trim().min(1)).min(1).max(5)).optional().meta({ description: `Actions to return full input and output schemas for, at most 5.` })
|
|
30090
|
-
});
|
|
30091
|
-
var jsonSchemaObject = external_exports.record(external_exports.string(), external_exports.unknown());
|
|
30092
|
-
var ConnectorActionSchema = external_exports.object({
|
|
30093
|
-
name: external_exports.string(),
|
|
30094
|
-
title: external_exports.string().optional(),
|
|
30095
|
-
description: external_exports.string(),
|
|
30096
|
-
inputFields: external_exports.array(external_exports.string()),
|
|
30097
|
-
outputFields: external_exports.array(external_exports.string()),
|
|
30098
|
-
readOnly: external_exports.boolean(),
|
|
30099
|
-
destructive: external_exports.boolean(),
|
|
30100
|
-
inputSchema: jsonSchemaObject.optional(),
|
|
30101
|
-
outputSchema: jsonSchemaObject.optional()
|
|
30102
|
-
});
|
|
30103
|
-
var ConnectorActionsResponseSchema = external_exports.object({
|
|
30104
|
-
connectionId: external_exports.string().optional(),
|
|
30105
|
-
instructions: external_exports.string().optional(),
|
|
30106
|
-
actions: external_exports.array(ConnectorActionSchema)
|
|
30107
|
-
});
|
|
30108
|
-
var RunConnectorActionBodySchema = external_exports.object({
|
|
30109
|
-
connectionId: external_exports.uuid().optional().meta({ description: "The connection to run the action on. Defaults to the only authorised connection for the connector." }),
|
|
30110
|
-
args: external_exports.record(external_exports.string(), external_exports.unknown()).default({}).meta({ description: "Arguments, validated against the action's input schema." })
|
|
30111
|
-
}).meta({ id: "RunConnectorAction" });
|
|
30112
|
-
var RunConnectorActionResponseSchema = external_exports.object({ result: external_exports.unknown() });
|
|
30113
|
-
var TriggerEventDetailSchema = external_exports.object({
|
|
30114
|
-
event: external_exports.string(),
|
|
30115
|
-
name: external_exports.string(),
|
|
30116
|
-
description: external_exports.string(),
|
|
30117
|
-
outputSchema: jsonSchemaObject,
|
|
30118
|
-
filterable: external_exports.array(external_exports.string()),
|
|
30119
|
-
instructions: external_exports.string().optional()
|
|
30120
|
-
});
|
|
30121
|
-
var CONNECTOR_ACTION_ERROR_CODES = [
|
|
30122
|
-
"connection_not_found",
|
|
30123
|
-
"choose_connection",
|
|
30124
|
-
"reconnect_required",
|
|
30125
|
-
"upstream_unavailable",
|
|
30126
|
-
"action_not_found",
|
|
30127
|
-
"action_not_readonly",
|
|
30128
|
-
"invalid_args",
|
|
30129
|
-
"action_failed",
|
|
30130
|
-
"event_not_found"
|
|
30131
|
-
];
|
|
30132
|
-
var ConnectorActionErrorSchema = external_exports.object({
|
|
30133
|
-
code: external_exports.enum(CONNECTOR_ACTION_ERROR_CODES),
|
|
30134
|
-
message: external_exports.string(),
|
|
30135
|
-
connections: external_exports.array(external_exports.object({
|
|
30136
|
-
id: external_exports.string(),
|
|
30137
|
-
accountDisplayLabel: external_exports.string().optional()
|
|
30138
|
-
})).optional()
|
|
30139
|
-
});
|
|
30140
|
-
var connectorDetailsSchema = external_exports.object({
|
|
30141
|
-
name: external_exports.string(),
|
|
30142
|
-
displayName: external_exports.string(),
|
|
30143
|
-
description: external_exports.string(),
|
|
30144
|
-
iconUrl: external_exports.string().nullable().optional()
|
|
30145
|
-
});
|
|
30146
|
-
var connectorListResponseSchema = external_exports.object({
|
|
30147
|
-
data: external_exports.array(ConnectorSchema),
|
|
30148
|
-
nextCursor: external_exports.string().nullable()
|
|
30149
|
-
});
|
|
30150
|
-
|
|
30151
|
-
// ../../packages/sdk/dist/core/dist/esm/schemas/pagination.schema.js
|
|
30152
|
-
var CursorPaginationSchema = external_exports.object({
|
|
30153
|
-
cursor: external_exports.string().optional(),
|
|
30154
|
-
limit: external_exports.preprocess((val) => Number(val), external_exports.number().int().min(1).max(100)).default(20)
|
|
30155
|
-
});
|
|
30156
|
-
|
|
30157
|
-
// ../../packages/sdk/dist/core/dist/esm/schemas/automation-draft.schema.js
|
|
30158
|
-
var automationDraftSchema = external_exports.object({
|
|
30159
|
-
id: external_exports.string(),
|
|
30160
|
-
partialManifest: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
30161
|
-
isComplete: external_exports.boolean(),
|
|
30162
|
-
automationId: external_exports.string().nullable(),
|
|
30163
|
-
conversationId: RolloutCompatibleNullableStringSchema,
|
|
30164
|
-
workspaceId: external_exports.string().nullable(),
|
|
30165
|
-
visibility: external_exports.enum(AUTOMATION_VISIBILITIES).nullish(),
|
|
30166
|
-
createdAt: external_exports.string(),
|
|
30167
|
-
updatedAt: external_exports.string(),
|
|
30168
|
-
connectorDetails: external_exports.array(connectorDetailsSchema).optional()
|
|
30169
|
-
});
|
|
30170
|
-
var automationDraftValidationSchema = external_exports.object({
|
|
30171
|
-
state: external_exports.enum(["incomplete", "ready"]),
|
|
30172
|
-
issues: external_exports.array(external_exports.string()),
|
|
30173
|
-
modified: external_exports.boolean()
|
|
30174
|
-
});
|
|
30175
|
-
var automationDraftWithValidationSchema = automationDraftValidationSchema.extend({ draft: automationDraftSchema });
|
|
30176
|
-
var automationDraftListResponseSchema = external_exports.object({
|
|
30177
|
-
data: external_exports.array(automationDraftSchema),
|
|
30178
|
-
nextCursor: external_exports.string().nullable()
|
|
30179
|
-
});
|
|
30180
|
-
var listAutomationDraftsQuerySchema = CursorPaginationSchema.extend({ conversationId: external_exports.string().min(1).optional() });
|
|
30181
|
-
external_exports.object({ enabled: external_exports.boolean().optional() }).meta({ id: "FinalizeAutomationDraftRequest" });
|
|
30182
|
-
var finalizeAutomationDraftResponseSchema = external_exports.object({ automation: automationSchema });
|
|
30183
|
-
var draftTestTriggerSelectorSchema = external_exports.union([external_exports.object({ index: external_exports.int().min(0) }), external_exports.object({ event: external_exports.string().min(1) })]);
|
|
30184
|
-
var testAutomationDraftRequestSchema = external_exports.object({
|
|
30185
|
-
trigger: draftTestTriggerSelectorSchema.optional(),
|
|
30186
|
-
payload: external_exports.unknown().optional(),
|
|
30187
|
-
metadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
30188
|
-
}).meta({ id: "TestAutomationDraftRequest" });
|
|
30189
|
-
var draftTestTriggerSchema = external_exports.object({
|
|
30190
|
-
index: external_exports.int().min(0),
|
|
30191
|
-
count: external_exports.int().min(1),
|
|
30192
|
-
type: external_exports.enum(TRIGGER_TYPES),
|
|
30193
|
-
event: external_exports.string().optional(),
|
|
30194
|
-
inputSource: external_exports.enum([
|
|
30195
|
-
"schedule",
|
|
30196
|
-
"sample-event",
|
|
30197
|
-
"supplied",
|
|
30198
|
-
"empty"
|
|
30199
|
-
])
|
|
30200
|
-
});
|
|
30201
|
-
var testAutomationDraftResponseSchema = external_exports.object({
|
|
30202
|
-
success: external_exports.literal(true),
|
|
30203
|
-
draftId: external_exports.string(),
|
|
30204
|
-
testRunId: external_exports.string(),
|
|
30205
|
-
status: external_exports.enum(AUTOMATION_RUN_STATUSES),
|
|
30206
|
-
connectorCalls: external_exports.literal("mocked"),
|
|
30207
|
-
trigger: draftTestTriggerSchema
|
|
30208
|
-
});
|
|
30209
|
-
var AUTOMATION_OPEN_DRAFT_CONFLICT_CODE = "automation_open_draft_conflict";
|
|
30210
|
-
var AutomationOpenDraftConflictSchema = external_exports.object({
|
|
30211
|
-
code: external_exports.literal(AUTOMATION_OPEN_DRAFT_CONFLICT_CODE),
|
|
30212
|
-
message: external_exports.string(),
|
|
30213
|
-
draftId: external_exports.string()
|
|
30214
|
-
});
|
|
30215
|
-
var AUTOMATION_DRAFT_NOT_READY_CODE = "automation_draft_not_ready";
|
|
30216
|
-
var AutomationDraftNotReadySchema = external_exports.object({
|
|
30217
|
-
code: external_exports.literal(AUTOMATION_DRAFT_NOT_READY_CODE),
|
|
30218
|
-
message: external_exports.string()
|
|
30219
|
-
});
|
|
30220
|
-
var DRAFT_TEST_REQUEST_ERROR_CODES = [
|
|
30221
|
-
"draft_test_not_ready",
|
|
30222
|
-
"draft_test_trigger_not_found",
|
|
30223
|
-
"draft_test_payload_required",
|
|
30224
|
-
"draft_test_payload_filtered",
|
|
30225
|
-
"draft_test_payload_invalid",
|
|
30226
|
-
"draft_test_payload_unsupported"
|
|
30227
|
-
];
|
|
30228
|
-
var DraftTestRequestErrorSchema = external_exports.object({
|
|
30229
|
-
code: external_exports.enum(DRAFT_TEST_REQUEST_ERROR_CODES),
|
|
30230
|
-
message: external_exports.string()
|
|
30231
|
-
});
|
|
30232
|
-
|
|
30233
30003
|
// ../../packages/sdk/dist/core/dist/esm/schemas/query-param.schema.js
|
|
30234
30004
|
var isoDateTimeOrDateQueryParamSchema = external_exports.union([external_exports.iso.datetime({ offset: true }), external_exports.iso.date()]);
|
|
30235
30005
|
var booleanQueryParamSchema = external_exports.preprocess((value) => value === "true" ? true : value === "false" ? false : value, external_exports.boolean());
|
|
@@ -30748,6 +30518,260 @@ function isRecord(value) {
|
|
|
30748
30518
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
30749
30519
|
}
|
|
30750
30520
|
|
|
30521
|
+
// ../../packages/sdk/dist/core/dist/esm/schemas/automation.schema.js
|
|
30522
|
+
var runStatusSchema = external_exports.discriminatedUnion("status", [
|
|
30523
|
+
external_exports.object({
|
|
30524
|
+
status: external_exports.literal("pending"),
|
|
30525
|
+
lastRun: external_exports.iso.datetime().optional()
|
|
30526
|
+
}),
|
|
30527
|
+
external_exports.object({
|
|
30528
|
+
status: external_exports.literal("running"),
|
|
30529
|
+
lastRun: external_exports.iso.datetime()
|
|
30530
|
+
}),
|
|
30531
|
+
external_exports.object({
|
|
30532
|
+
status: external_exports.literal("completed"),
|
|
30533
|
+
lastRun: external_exports.iso.datetime()
|
|
30534
|
+
}),
|
|
30535
|
+
external_exports.object({
|
|
30536
|
+
status: external_exports.literal("failed"),
|
|
30537
|
+
lastRun: external_exports.iso.datetime(),
|
|
30538
|
+
failureReason: external_exports.string().optional()
|
|
30539
|
+
}),
|
|
30540
|
+
external_exports.object({
|
|
30541
|
+
status: external_exports.literal("cancelled"),
|
|
30542
|
+
lastRun: external_exports.iso.datetime()
|
|
30543
|
+
}),
|
|
30544
|
+
external_exports.object({
|
|
30545
|
+
status: external_exports.literal("skipped"),
|
|
30546
|
+
lastRun: external_exports.iso.datetime(),
|
|
30547
|
+
skipReason: external_exports.string().optional(),
|
|
30548
|
+
skipCategory: external_exports.enum(SKIP_CATEGORIES).optional().catch(void 0)
|
|
30549
|
+
})
|
|
30550
|
+
]);
|
|
30551
|
+
var automationSchema = external_exports.object({
|
|
30552
|
+
id: external_exports.string(),
|
|
30553
|
+
connections: external_exports.array(ConnectionDetailsSchema),
|
|
30554
|
+
enabled: external_exports.boolean(),
|
|
30555
|
+
status: runStatusSchema,
|
|
30556
|
+
activeRun: external_exports.object({
|
|
30557
|
+
runId: external_exports.string(),
|
|
30558
|
+
status: external_exports.enum(["pending", "running"])
|
|
30559
|
+
}).nullish(),
|
|
30560
|
+
connectionStatus: external_exports.enum(AUTOMATION_CONNECTION_STATUSES),
|
|
30561
|
+
draftId: external_exports.string().nullable(),
|
|
30562
|
+
manifest: external_exports.union([manifestSchema, external_exports.record(external_exports.string(), external_exports.unknown())]).nullable(),
|
|
30563
|
+
updatedAt: external_exports.iso.datetime(),
|
|
30564
|
+
createdBy: RolloutCompatibleNullableStringSchema,
|
|
30565
|
+
updatedBy: RolloutCompatibleNullableStringSchema,
|
|
30566
|
+
workspaceId: external_exports.string().nullable(),
|
|
30567
|
+
visibility: external_exports.enum(AUTOMATION_VISIBILITIES),
|
|
30568
|
+
isOwner: external_exports.boolean(),
|
|
30569
|
+
disabledReason: external_exports.enum(AUTOMATION_DISABLED_REASONS).nullable()
|
|
30570
|
+
});
|
|
30571
|
+
var automationListResponseSchema = external_exports.object({
|
|
30572
|
+
data: external_exports.array(automationSchema),
|
|
30573
|
+
nextCursor: external_exports.string().nullable()
|
|
30574
|
+
});
|
|
30575
|
+
var triggerAutomationResponseSchema = external_exports.object({
|
|
30576
|
+
created: external_exports.boolean().default(true),
|
|
30577
|
+
automationId: external_exports.string(),
|
|
30578
|
+
runId: external_exports.string(),
|
|
30579
|
+
status: external_exports.enum(AUTOMATION_RUN_STATUSES),
|
|
30580
|
+
run: AutomationRunDtoSchema.optional()
|
|
30581
|
+
});
|
|
30582
|
+
external_exports.object({
|
|
30583
|
+
enabled: external_exports.boolean().optional(),
|
|
30584
|
+
manifest: manifestSchema.optional()
|
|
30585
|
+
}).refine((data) => Object.keys(data).length > 0, { message: "At least one field must be provided" }).meta({ id: "UpdateAutomation" });
|
|
30586
|
+
external_exports.object({
|
|
30587
|
+
name: external_exports.string().min(1),
|
|
30588
|
+
description: external_exports.string()
|
|
30589
|
+
}).meta({ id: "UpdateAutomationMetadata" });
|
|
30590
|
+
external_exports.object({ value: scheduleValueSchema }).meta({ id: "UpdateAutomationSchedule" });
|
|
30591
|
+
external_exports.object({ visibility: external_exports.enum(AUTOMATION_VISIBILITIES) }).meta({ id: "UpdateAutomationVisibility" });
|
|
30592
|
+
external_exports.object({ visibility: external_exports.enum(AUTOMATION_VISIBILITIES).default("workspace") }).meta({ id: "MoveAutomation" });
|
|
30593
|
+
|
|
30594
|
+
// ../../packages/sdk/dist/core/dist/esm/schemas/connector.schema.js
|
|
30595
|
+
var TriggerSupportedEventSchema = external_exports.object({
|
|
30596
|
+
id: external_exports.string(),
|
|
30597
|
+
name: external_exports.string(),
|
|
30598
|
+
description: external_exports.string()
|
|
30599
|
+
});
|
|
30600
|
+
var ConnectorCapabilitiesSchema = external_exports.object({
|
|
30601
|
+
mcp: external_exports.object({
|
|
30602
|
+
serverUrl: external_exports.string(),
|
|
30603
|
+
scopes: external_exports.array(external_exports.string()),
|
|
30604
|
+
connectionIds: external_exports.array(external_exports.string())
|
|
30605
|
+
}).optional(),
|
|
30606
|
+
triggers: external_exports.object({
|
|
30607
|
+
scopes: external_exports.array(external_exports.string()),
|
|
30608
|
+
connectionIds: external_exports.array(external_exports.string()),
|
|
30609
|
+
supportedEvents: external_exports.array(TriggerSupportedEventSchema)
|
|
30610
|
+
}).optional()
|
|
30611
|
+
});
|
|
30612
|
+
var McpServerUrlInputSchema = external_exports.object({
|
|
30613
|
+
template: external_exports.string().nullable(),
|
|
30614
|
+
customUrl: external_exports.object({ placeholder: external_exports.string() }).nullable()
|
|
30615
|
+
});
|
|
30616
|
+
var ConnectorSchema = external_exports.object({
|
|
30617
|
+
id: external_exports.string(),
|
|
30618
|
+
name: external_exports.string(),
|
|
30619
|
+
description: external_exports.string(),
|
|
30620
|
+
iconUrl: external_exports.url().nullable().optional(),
|
|
30621
|
+
capabilities: ConnectorCapabilitiesSchema,
|
|
30622
|
+
requiresConnection: external_exports.boolean(),
|
|
30623
|
+
isSystem: external_exports.boolean().optional(),
|
|
30624
|
+
isManaged: external_exports.boolean().optional(),
|
|
30625
|
+
connectsViaCli: external_exports.boolean().optional(),
|
|
30626
|
+
mcpServerUrlInput: McpServerUrlInputSchema.optional()
|
|
30627
|
+
});
|
|
30628
|
+
var GetConnectorsQuerySchema = external_exports.object({ query: external_exports.string().optional() });
|
|
30629
|
+
var GetConnectorActionsQuerySchema = external_exports.object({
|
|
30630
|
+
connectionId: external_exports.uuid().optional(),
|
|
30631
|
+
names: external_exports.preprocess((value) => typeof value === "string" ? value.split(",") : value, external_exports.array(external_exports.string().trim().min(1)).min(1).max(5)).optional().meta({ description: `Actions to return full input and output schemas for, at most 5.` })
|
|
30632
|
+
});
|
|
30633
|
+
var jsonSchemaObject = external_exports.record(external_exports.string(), external_exports.unknown());
|
|
30634
|
+
var ConnectorActionSchema = external_exports.object({
|
|
30635
|
+
name: external_exports.string(),
|
|
30636
|
+
title: external_exports.string().optional(),
|
|
30637
|
+
description: external_exports.string(),
|
|
30638
|
+
inputFields: external_exports.array(external_exports.string()),
|
|
30639
|
+
outputFields: external_exports.array(external_exports.string()),
|
|
30640
|
+
readOnly: external_exports.boolean(),
|
|
30641
|
+
destructive: external_exports.boolean(),
|
|
30642
|
+
inputSchema: jsonSchemaObject.optional(),
|
|
30643
|
+
outputSchema: jsonSchemaObject.optional()
|
|
30644
|
+
});
|
|
30645
|
+
var ConnectorActionsResponseSchema = external_exports.object({
|
|
30646
|
+
connectionId: external_exports.string().optional(),
|
|
30647
|
+
instructions: external_exports.string().optional(),
|
|
30648
|
+
actions: external_exports.array(ConnectorActionSchema)
|
|
30649
|
+
});
|
|
30650
|
+
var RunConnectorActionBodySchema = external_exports.object({
|
|
30651
|
+
connectionId: external_exports.uuid().optional().meta({ description: "The connection to run the action on. Defaults to the only authorised connection for the connector." }),
|
|
30652
|
+
args: external_exports.record(external_exports.string(), external_exports.unknown()).default({}).meta({ description: "Arguments, validated against the action's input schema." })
|
|
30653
|
+
}).meta({ id: "RunConnectorAction" });
|
|
30654
|
+
var RunConnectorActionResponseSchema = external_exports.object({ result: external_exports.unknown() });
|
|
30655
|
+
var TriggerEventDetailSchema = external_exports.object({
|
|
30656
|
+
event: external_exports.string(),
|
|
30657
|
+
name: external_exports.string(),
|
|
30658
|
+
description: external_exports.string(),
|
|
30659
|
+
outputSchema: jsonSchemaObject,
|
|
30660
|
+
filterable: external_exports.array(external_exports.string()),
|
|
30661
|
+
instructions: external_exports.string().optional()
|
|
30662
|
+
});
|
|
30663
|
+
var CONNECTOR_ACTION_ERROR_CODES = [
|
|
30664
|
+
"connection_not_found",
|
|
30665
|
+
"choose_connection",
|
|
30666
|
+
"reconnect_required",
|
|
30667
|
+
"upstream_unavailable",
|
|
30668
|
+
"action_not_found",
|
|
30669
|
+
"action_not_readonly",
|
|
30670
|
+
"invalid_args",
|
|
30671
|
+
"action_failed",
|
|
30672
|
+
"event_not_found"
|
|
30673
|
+
];
|
|
30674
|
+
var ConnectorActionErrorSchema = external_exports.object({
|
|
30675
|
+
code: external_exports.enum(CONNECTOR_ACTION_ERROR_CODES),
|
|
30676
|
+
message: external_exports.string(),
|
|
30677
|
+
connections: external_exports.array(external_exports.object({
|
|
30678
|
+
id: external_exports.string(),
|
|
30679
|
+
accountDisplayLabel: external_exports.string().optional()
|
|
30680
|
+
})).optional()
|
|
30681
|
+
});
|
|
30682
|
+
var connectorDetailsSchema = external_exports.object({
|
|
30683
|
+
name: external_exports.string(),
|
|
30684
|
+
displayName: external_exports.string(),
|
|
30685
|
+
description: external_exports.string(),
|
|
30686
|
+
iconUrl: external_exports.string().nullable().optional()
|
|
30687
|
+
});
|
|
30688
|
+
var connectorListResponseSchema = external_exports.object({
|
|
30689
|
+
data: external_exports.array(ConnectorSchema),
|
|
30690
|
+
nextCursor: external_exports.string().nullable()
|
|
30691
|
+
});
|
|
30692
|
+
|
|
30693
|
+
// ../../packages/sdk/dist/core/dist/esm/schemas/pagination.schema.js
|
|
30694
|
+
var CursorPaginationSchema = external_exports.object({
|
|
30695
|
+
cursor: external_exports.string().optional(),
|
|
30696
|
+
limit: external_exports.preprocess((val) => Number(val), external_exports.number().int().min(1).max(100)).default(20)
|
|
30697
|
+
});
|
|
30698
|
+
|
|
30699
|
+
// ../../packages/sdk/dist/core/dist/esm/schemas/automation-draft.schema.js
|
|
30700
|
+
var automationDraftSchema = external_exports.object({
|
|
30701
|
+
id: external_exports.string(),
|
|
30702
|
+
partialManifest: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
30703
|
+
isComplete: external_exports.boolean(),
|
|
30704
|
+
automationId: external_exports.string().nullable(),
|
|
30705
|
+
conversationId: RolloutCompatibleNullableStringSchema,
|
|
30706
|
+
workspaceId: external_exports.string().nullable(),
|
|
30707
|
+
visibility: external_exports.enum(AUTOMATION_VISIBILITIES).nullish(),
|
|
30708
|
+
createdAt: external_exports.string(),
|
|
30709
|
+
updatedAt: external_exports.string(),
|
|
30710
|
+
connectorDetails: external_exports.array(connectorDetailsSchema).optional()
|
|
30711
|
+
});
|
|
30712
|
+
var automationDraftValidationSchema = external_exports.object({
|
|
30713
|
+
state: external_exports.enum(["incomplete", "ready"]),
|
|
30714
|
+
issues: external_exports.array(external_exports.string()),
|
|
30715
|
+
modified: external_exports.boolean()
|
|
30716
|
+
});
|
|
30717
|
+
var automationDraftWithValidationSchema = automationDraftValidationSchema.extend({ draft: automationDraftSchema });
|
|
30718
|
+
var automationDraftListResponseSchema = external_exports.object({
|
|
30719
|
+
data: external_exports.array(automationDraftSchema),
|
|
30720
|
+
nextCursor: external_exports.string().nullable()
|
|
30721
|
+
});
|
|
30722
|
+
var listAutomationDraftsQuerySchema = CursorPaginationSchema.extend({ conversationId: external_exports.string().min(1).optional() });
|
|
30723
|
+
external_exports.object({ enabled: external_exports.boolean().optional() }).meta({ id: "FinalizeAutomationDraftRequest" });
|
|
30724
|
+
var finalizeAutomationDraftResponseSchema = external_exports.object({ automation: automationSchema });
|
|
30725
|
+
var draftTestTriggerSelectorSchema = external_exports.union([external_exports.object({ index: external_exports.int().min(0) }), external_exports.object({ event: external_exports.string().min(1) })]);
|
|
30726
|
+
var testAutomationDraftRequestSchema = external_exports.object({
|
|
30727
|
+
trigger: draftTestTriggerSelectorSchema.optional(),
|
|
30728
|
+
payload: external_exports.unknown().optional(),
|
|
30729
|
+
metadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
30730
|
+
}).meta({ id: "TestAutomationDraftRequest" });
|
|
30731
|
+
var draftTestTriggerSchema = external_exports.object({
|
|
30732
|
+
index: external_exports.int().min(0),
|
|
30733
|
+
count: external_exports.int().min(1),
|
|
30734
|
+
type: external_exports.enum(TRIGGER_TYPES),
|
|
30735
|
+
event: external_exports.string().optional(),
|
|
30736
|
+
inputSource: external_exports.enum([
|
|
30737
|
+
"schedule",
|
|
30738
|
+
"sample-event",
|
|
30739
|
+
"supplied",
|
|
30740
|
+
"empty"
|
|
30741
|
+
])
|
|
30742
|
+
});
|
|
30743
|
+
var testAutomationDraftResponseSchema = external_exports.object({
|
|
30744
|
+
success: external_exports.literal(true),
|
|
30745
|
+
draftId: external_exports.string(),
|
|
30746
|
+
testRunId: external_exports.string(),
|
|
30747
|
+
status: external_exports.enum(AUTOMATION_RUN_STATUSES),
|
|
30748
|
+
connectorCalls: external_exports.literal("mocked"),
|
|
30749
|
+
trigger: draftTestTriggerSchema
|
|
30750
|
+
});
|
|
30751
|
+
var AUTOMATION_OPEN_DRAFT_CONFLICT_CODE = "automation_open_draft_conflict";
|
|
30752
|
+
var AutomationOpenDraftConflictSchema = external_exports.object({
|
|
30753
|
+
code: external_exports.literal(AUTOMATION_OPEN_DRAFT_CONFLICT_CODE),
|
|
30754
|
+
message: external_exports.string(),
|
|
30755
|
+
draftId: external_exports.string()
|
|
30756
|
+
});
|
|
30757
|
+
var AUTOMATION_DRAFT_NOT_READY_CODE = "automation_draft_not_ready";
|
|
30758
|
+
var AutomationDraftNotReadySchema = external_exports.object({
|
|
30759
|
+
code: external_exports.literal(AUTOMATION_DRAFT_NOT_READY_CODE),
|
|
30760
|
+
message: external_exports.string()
|
|
30761
|
+
});
|
|
30762
|
+
var DRAFT_TEST_REQUEST_ERROR_CODES = [
|
|
30763
|
+
"draft_test_not_ready",
|
|
30764
|
+
"draft_test_trigger_not_found",
|
|
30765
|
+
"draft_test_payload_required",
|
|
30766
|
+
"draft_test_payload_filtered",
|
|
30767
|
+
"draft_test_payload_invalid",
|
|
30768
|
+
"draft_test_payload_unsupported"
|
|
30769
|
+
];
|
|
30770
|
+
var DraftTestRequestErrorSchema = external_exports.object({
|
|
30771
|
+
code: external_exports.enum(DRAFT_TEST_REQUEST_ERROR_CODES),
|
|
30772
|
+
message: external_exports.string()
|
|
30773
|
+
});
|
|
30774
|
+
|
|
30751
30775
|
// ../../packages/sdk/dist/core/dist/esm/schemas/draft-test-run.schema.js
|
|
30752
30776
|
var DraftTestRunFailedStepSchema = external_exports.object({
|
|
30753
30777
|
stepId: external_exports.string(),
|
|
@@ -32412,6 +32436,7 @@ var UserOnboardingStateSchema = external_exports.object({
|
|
|
32412
32436
|
});
|
|
32413
32437
|
var AcceptTermsSchema = external_exports.object({ version: external_exports.string().trim().min(1).max(64) }).meta({ id: "AcceptTerms" });
|
|
32414
32438
|
var McpAssistantSettingSchema = external_exports.object({ mcpAssistant: McpAssistantSchema }).meta({ id: "McpAssistantSetting" });
|
|
32439
|
+
var UsageBillingSettingSchema = external_exports.object({ enabled: external_exports.boolean() }).meta({ id: "UsageBillingSetting" });
|
|
32415
32440
|
var ConnectorIdSchema = external_exports.string().trim().min(1);
|
|
32416
32441
|
var InterestedConnectorIdsSchema = external_exports.array(ConnectorIdSchema).max(100);
|
|
32417
32442
|
var ConnectorPreferencesSchema = external_exports.object({ interestedIds: InterestedConnectorIdsSchema });
|
|
@@ -32484,6 +32509,7 @@ var userSettingsEndpoints = {
|
|
|
32484
32509
|
preferences: `${root13}/preferences`,
|
|
32485
32510
|
personalContext: `${root13}/preferences/personal-context`,
|
|
32486
32511
|
terms: `${root13}/terms`,
|
|
32512
|
+
usageBilling: `${root13}/usage-billing`,
|
|
32487
32513
|
featureFlagTraits: "/feature-flag-traits",
|
|
32488
32514
|
pmfSurvey: "/pmf-survey",
|
|
32489
32515
|
pmfSurveyOutcome: "/pmf-survey/outcome"
|
|
@@ -32527,6 +32553,14 @@ var UserSettingsClient = class extends BaseClient {
|
|
|
32527
32553
|
});
|
|
32528
32554
|
return McpAssistantSettingSchema.parse(data);
|
|
32529
32555
|
}
|
|
32556
|
+
async getUsageBilling(options) {
|
|
32557
|
+
const data = await this.request({
|
|
32558
|
+
method: "GET",
|
|
32559
|
+
path: userSettingsEndpoints.usageBilling,
|
|
32560
|
+
options
|
|
32561
|
+
});
|
|
32562
|
+
return UsageBillingSettingSchema.parse(data);
|
|
32563
|
+
}
|
|
32530
32564
|
async getPreferences(options) {
|
|
32531
32565
|
const data = await this.request({
|
|
32532
32566
|
method: "GET",
|
|
@@ -33151,7 +33185,8 @@ function currentMonthUsageWindow(now = /* @__PURE__ */ new Date()) {
|
|
|
33151
33185
|
}
|
|
33152
33186
|
async function readUsageReport(api, { window: window2 = currentMonthUsageWindow(), signal } = {}) {
|
|
33153
33187
|
const options = { signal };
|
|
33154
|
-
const [state, total, runs, chat] = await Promise.all([
|
|
33188
|
+
const [setting, state, total, runs, chat] = await Promise.all([
|
|
33189
|
+
api.userSettings.getUsageBilling(options),
|
|
33155
33190
|
api.usageBilling.readState(options),
|
|
33156
33191
|
api.usageBilling.readUsageSummary(window2, options),
|
|
33157
33192
|
api.usageBilling.readUsageSummary({
|
|
@@ -33164,14 +33199,16 @@ async function readUsageReport(api, { window: window2 = currentMonthUsageWindow(
|
|
|
33164
33199
|
category: CHAT_MESSAGE_USAGE_CATEGORY
|
|
33165
33200
|
}, options)
|
|
33166
33201
|
]);
|
|
33202
|
+
const billed = setting.enabled;
|
|
33167
33203
|
return {
|
|
33168
33204
|
currency: state.currency,
|
|
33205
|
+
billed,
|
|
33169
33206
|
balance: {
|
|
33170
33207
|
amount: state.settled_amount ?? state.available_amount,
|
|
33171
33208
|
availableAmount: state.available_amount,
|
|
33172
|
-
usageAllowed: state.usage_allowed && !state.depleted,
|
|
33173
|
-
lowBalance: state.is_settled_low_balance ?? state.low_balance,
|
|
33174
|
-
blockReason: state.usage_block_reason ?? null
|
|
33209
|
+
usageAllowed: !billed || state.usage_allowed && !state.depleted,
|
|
33210
|
+
lowBalance: billed && (state.is_settled_low_balance ?? state.low_balance),
|
|
33211
|
+
blockReason: billed ? state.usage_block_reason ?? null : null
|
|
33175
33212
|
},
|
|
33176
33213
|
window: window2,
|
|
33177
33214
|
total: {
|
|
@@ -35209,8 +35246,9 @@ var API_SCOPES = {
|
|
|
35209
35246
|
description: "Register, update, and remove webhook endpoints that receive your automation events",
|
|
35210
35247
|
impliedScopes: ["automations:webhooks:read"]
|
|
35211
35248
|
},
|
|
35212
|
-
//
|
|
35213
|
-
//
|
|
35249
|
+
// Todoist's usage-billing reads require it, for the Automations product,
|
|
35250
|
+
// because the balance lives in Todoist's ledger. Here it covers only whether
|
|
35251
|
+
// the user is billed at all.
|
|
35214
35252
|
"automations:billing:read": {
|
|
35215
35253
|
description: "View your Automations balance and what your automations have cost"
|
|
35216
35254
|
}
|
|
@@ -35521,6 +35559,14 @@ function isSkipCategory(category) {
|
|
|
35521
35559
|
return SKIP_CATEGORIES2.includes(category);
|
|
35522
35560
|
}
|
|
35523
35561
|
|
|
35562
|
+
// ../../packages/core/dist/esm/schemas/query-param.schema.js
|
|
35563
|
+
var isoDateTimeOrDateQueryParamSchema2 = external_exports.union([
|
|
35564
|
+
external_exports.iso.datetime({ offset: true }),
|
|
35565
|
+
external_exports.iso.date()
|
|
35566
|
+
]);
|
|
35567
|
+
var booleanQueryParamSchema2 = external_exports.preprocess((value) => value === "true" ? true : value === "false" ? false : value, external_exports.boolean());
|
|
35568
|
+
var booleanQueryFlagSchema = booleanQueryParamSchema2.optional().transform((value) => value === true);
|
|
35569
|
+
|
|
35524
35570
|
// ../../packages/core/dist/esm/utils/cli-command.js
|
|
35525
35571
|
function connectViaCliCommand(connectorId, capability) {
|
|
35526
35572
|
return `tda connector connect ${connectorId} --capability ${capability}`;
|
|
@@ -35629,6 +35675,27 @@ function getRunOutcomeCategory2(run) {
|
|
|
35629
35675
|
return null;
|
|
35630
35676
|
}
|
|
35631
35677
|
|
|
35678
|
+
// ../../packages/core/dist/esm/utils/template.js
|
|
35679
|
+
function* templatePlaceholders2(template) {
|
|
35680
|
+
let cursor = 0;
|
|
35681
|
+
while (cursor < template.length) {
|
|
35682
|
+
const start = template.indexOf("{{", cursor);
|
|
35683
|
+
if (start === -1)
|
|
35684
|
+
return;
|
|
35685
|
+
const close = template.indexOf("}", start + 2);
|
|
35686
|
+
if (close === -1)
|
|
35687
|
+
return;
|
|
35688
|
+
cursor = close + 1;
|
|
35689
|
+
if (template[close + 1] !== "}")
|
|
35690
|
+
continue;
|
|
35691
|
+
cursor++;
|
|
35692
|
+
yield { start, end: cursor, reference: template.slice(start + 2, close).trim() };
|
|
35693
|
+
}
|
|
35694
|
+
}
|
|
35695
|
+
function extractTemplateVariables2(template) {
|
|
35696
|
+
return Array.from(templatePlaceholders2(template), ({ reference }) => reference);
|
|
35697
|
+
}
|
|
35698
|
+
|
|
35632
35699
|
// ../../packages/core/dist/esm/utils/usage-amount-format.js
|
|
35633
35700
|
var MICRO_UNITS_PER_MAJOR_UNIT = 1e6;
|
|
35634
35701
|
function minorUnitsPerMajorUnit(currency, locales) {
|
|
@@ -35977,6 +36044,11 @@ var codeStepSchema2 = baseStepSchema2.merge(external_exports.object({
|
|
|
35977
36044
|
code: external_exports.string().meta({
|
|
35978
36045
|
description: "The code to execute. It has access to trigger and steps objects."
|
|
35979
36046
|
}),
|
|
36047
|
+
// Optional with no default: a code step without `tools` has none, and parsing must
|
|
36048
|
+
// not add an empty map that would change manifests already in use.
|
|
36049
|
+
tools: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())).optional().meta({
|
|
36050
|
+
description: 'A mapping from MCP server connector IDs to arrays of their tool names that the code may call through mcp (e.g., {"todoist-comms": ["create-thread"]}). Omit it when the code calls no tools.'
|
|
36051
|
+
}),
|
|
35980
36052
|
extractedUrls: external_exports.array(external_exports.url()).optional().meta({
|
|
35981
36053
|
description: "URLs that will be fetched during step execution (auto-extracted from code)"
|
|
35982
36054
|
})
|
|
@@ -36108,7 +36180,8 @@ var partialManifestSchema2 = manifestSchemaBase2.partial().extend({
|
|
|
36108
36180
|
manifestVersion: true,
|
|
36109
36181
|
steps: true
|
|
36110
36182
|
});
|
|
36111
|
-
var
|
|
36183
|
+
var templateReferenceRegex2 = /^[\p{ID_Continue}$-]+(?:\.[\p{ID_Continue}$-]+)*$/u;
|
|
36184
|
+
var codegenTemplateReferenceRegex2 = /\{\{\s*([\w.]+)\s*\}\}/g;
|
|
36112
36185
|
var codeStepReferenceRegex2 = /\bsteps\.([a-zA-Z][a-zA-Z0-9]*)(?:\.([a-zA-Z_][\w.]*))?/g;
|
|
36113
36186
|
var backtickStepReferenceRegex2 = /`steps\.([a-zA-Z][a-zA-Z0-9]*)(?:\.([a-zA-Z_][\w.]*))?`/g;
|
|
36114
36187
|
function extractStepReferences2(text2, regex) {
|
|
@@ -36154,11 +36227,13 @@ function validateStepReference2({ stepId, referencedStepId, propertyPath, contex
|
|
|
36154
36227
|
}
|
|
36155
36228
|
return null;
|
|
36156
36229
|
}
|
|
36157
|
-
function validateTemplateVariable2({ variable, context, stepId, currentStepGuard, sourceType = "prompt" }) {
|
|
36230
|
+
function validateTemplateVariable2({ variable, context, stepId, currentStepGuard, sourceType = "prompt", interpolated = true }) {
|
|
36231
|
+
if (interpolated && !templateReferenceRegex2.test(variable)) {
|
|
36232
|
+
return `Step "${stepId}" ${sourceType} contains an invalid placeholder "{{${variable}}}". Use only dot-separated field references such as {{trigger.field}} or {{steps.stepId.field}}. Calculate expressions in a preceding step and reference its output.`;
|
|
36233
|
+
}
|
|
36158
36234
|
const parts = variable.split(".").filter(Boolean);
|
|
36159
|
-
if (parts.length === 0)
|
|
36235
|
+
if (parts.length === 0)
|
|
36160
36236
|
return null;
|
|
36161
|
-
}
|
|
36162
36237
|
const [root16, ...rest] = parts;
|
|
36163
36238
|
if (root16 === "trigger") {
|
|
36164
36239
|
if (rest.length === 0) {
|
|
@@ -36199,16 +36274,6 @@ function validateTemplateVariable2({ variable, context, stepId, currentStepGuard
|
|
|
36199
36274
|
}
|
|
36200
36275
|
return `Step "${stepId}" ${sourceType} references unsupported template variable "{{${variable}}}". Allowed roots are {{trigger...}} and {{steps.<stepId>...}}.`;
|
|
36201
36276
|
}
|
|
36202
|
-
function extractTemplateVariables2(prompt) {
|
|
36203
|
-
const variables = [];
|
|
36204
|
-
for (const match of prompt.matchAll(templateVariableRegex2)) {
|
|
36205
|
-
const variable = match[0]?.replace(/\{\{\s*|\s*\}\}/g, "").trim();
|
|
36206
|
-
if (variable) {
|
|
36207
|
-
variables.push(variable);
|
|
36208
|
-
}
|
|
36209
|
-
}
|
|
36210
|
-
return variables;
|
|
36211
|
-
}
|
|
36212
36277
|
function resolveTriggersFromData2(data) {
|
|
36213
36278
|
if (data.triggers && Array.isArray(data.triggers) && data.triggers.length > 0) {
|
|
36214
36279
|
return data.triggers;
|
|
@@ -36478,13 +36543,14 @@ function validateManifestTemplateVariables2(data, ctx) {
|
|
|
36478
36543
|
}
|
|
36479
36544
|
}
|
|
36480
36545
|
if ("prompt" in step && typeof step.prompt === "string") {
|
|
36481
|
-
const variables = extractTemplateVariables2(step.prompt);
|
|
36546
|
+
const variables = step.type === "codegen" ? Array.from(step.prompt.matchAll(codegenTemplateReferenceRegex2), (match) => (match[1] ?? "").trim()) : extractTemplateVariables2(step.prompt);
|
|
36482
36547
|
for (const variable of variables) {
|
|
36483
36548
|
const error62 = validateTemplateVariable2({
|
|
36484
36549
|
variable,
|
|
36485
36550
|
context,
|
|
36486
36551
|
stepId: step.id,
|
|
36487
|
-
currentStepGuard
|
|
36552
|
+
currentStepGuard,
|
|
36553
|
+
interpolated: step.type !== "codegen"
|
|
36488
36554
|
});
|
|
36489
36555
|
if (!error62)
|
|
36490
36556
|
continue;
|
|
@@ -36561,14 +36627,6 @@ function validateManifestTemplateVariables2(data, ctx) {
|
|
|
36561
36627
|
}
|
|
36562
36628
|
}
|
|
36563
36629
|
|
|
36564
|
-
// ../../packages/core/dist/esm/schemas/query-param.schema.js
|
|
36565
|
-
var isoDateTimeOrDateQueryParamSchema2 = external_exports.union([
|
|
36566
|
-
external_exports.iso.datetime({ offset: true }),
|
|
36567
|
-
external_exports.iso.date()
|
|
36568
|
-
]);
|
|
36569
|
-
var booleanQueryParamSchema2 = external_exports.preprocess((value) => value === "true" ? true : value === "false" ? false : value, external_exports.boolean());
|
|
36570
|
-
var booleanQueryFlagSchema = booleanQueryParamSchema2.optional().transform((value) => value === true);
|
|
36571
|
-
|
|
36572
36630
|
// ../../packages/core/dist/esm/schemas/connector.schema.js
|
|
36573
36631
|
var TriggerSupportedEventSchema2 = external_exports.object({
|
|
36574
36632
|
id: external_exports.string(),
|
|
@@ -39194,7 +39252,7 @@ function formatAutomationTrigger(result) {
|
|
|
39194
39252
|
return `Triggered automation ${result.automationId}.`;
|
|
39195
39253
|
}
|
|
39196
39254
|
return [
|
|
39197
|
-
`Started run ${result.runId} of automation ${result.automationId}.`,
|
|
39255
|
+
result.created === false ? `Run ${result.runId} of automation ${result.automationId} was already in progress.` : `Started run ${result.runId} of automation ${result.automationId}.`,
|
|
39198
39256
|
`Details: ${result.command}`
|
|
39199
39257
|
].join("\n");
|
|
39200
39258
|
}
|
|
@@ -39345,6 +39403,7 @@ async function triggerAutomation(runApi, {
|
|
|
39345
39403
|
return { action: "triggered", automationId, runId: null, status: null, command: null };
|
|
39346
39404
|
}
|
|
39347
39405
|
const identity = {
|
|
39406
|
+
created: started.created,
|
|
39348
39407
|
automationId,
|
|
39349
39408
|
runId: started.runId,
|
|
39350
39409
|
command: `tda run view ${automationId} ${started.runId} ${flag}`
|
|
@@ -43214,14 +43273,14 @@ function formatUsageReport(report) {
|
|
|
43214
43273
|
return [
|
|
43215
43274
|
`Balance: ${money(balance.amount)}`,
|
|
43216
43275
|
...balance.availableAmount < balance.amount ? [` ${money(balance.availableAmount)} available now; runs in progress hold the rest.`] : [],
|
|
43217
|
-
...
|
|
43276
|
+
...describeStanding(report),
|
|
43218
43277
|
"",
|
|
43219
43278
|
`Spent from ${report.window.since} to ${report.window.until}: ${money(report.total.chargedAmount)}`,
|
|
43220
43279
|
` Automation runs: ${money(automationRuns.chargedAmount)} (${count(automationRuns.runCount, "run")})`,
|
|
43221
43280
|
...formatAutomationRows(automationRuns.byAutomation, money),
|
|
43222
43281
|
` Chat messages: ${money(chatMessages.chargedAmount)} (${count(chatMessages.messageCount, "message")})`,
|
|
43223
|
-
|
|
43224
|
-
`In the app: ${balanceUsageUrl()}`
|
|
43282
|
+
// The app shows Balance & Usage only to an account it bills.
|
|
43283
|
+
...report.billed ? ["", `In the app: ${balanceUsageUrl()}`] : []
|
|
43225
43284
|
].join("\n");
|
|
43226
43285
|
}
|
|
43227
43286
|
function formatAutomationRows(rows, money) {
|
|
@@ -43239,7 +43298,12 @@ function describeAutomation2(row) {
|
|
|
43239
43298
|
}
|
|
43240
43299
|
return `${row.name ?? "Unnamed automation"} (${row.automationId})`;
|
|
43241
43300
|
}
|
|
43242
|
-
function
|
|
43301
|
+
function describeStanding({ billed, balance }) {
|
|
43302
|
+
if (!billed) {
|
|
43303
|
+
return [
|
|
43304
|
+
" Usage is not billed on this account: runs and chat messages do not draw on this balance, and nothing is refused for it."
|
|
43305
|
+
];
|
|
43306
|
+
}
|
|
43243
43307
|
if (balance.usageAllowed) {
|
|
43244
43308
|
return balance.lowBalance ? [` Your balance is low. Top up at ${topUpUrl()}.`] : [];
|
|
43245
43309
|
}
|