@todoist/automations-cli 2.1.2 → 2.2.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/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 +142 -43
- package/dist/index.js.map +4 -4
- package/dist/lib/skills/update-installed.js +1 -1
- package/package.json +1 -1
- 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.
|
|
8556
|
+
version: "2.2.0",
|
|
8557
8557
|
description: "Command-line client for Todoist Automations",
|
|
8558
8558
|
type: "module",
|
|
8559
8559
|
bin: {
|
|
@@ -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 ?? [];
|
|
@@ -29132,7 +29154,8 @@ var partialManifestSchema = manifestSchemaBase.partial().extend({
|
|
|
29132
29154
|
manifestVersion: true,
|
|
29133
29155
|
steps: true
|
|
29134
29156
|
});
|
|
29135
|
-
var
|
|
29157
|
+
var templateReferenceRegex = /^[\p{ID_Continue}$-]+(?:\.[\p{ID_Continue}$-]+)*$/u;
|
|
29158
|
+
var codegenTemplateReferenceRegex = /\{\{\s*([\w.]+)\s*\}\}/g;
|
|
29136
29159
|
var codeStepReferenceRegex = /\bsteps\.([a-zA-Z][a-zA-Z0-9]*)(?:\.([a-zA-Z_][\w.]*))?/g;
|
|
29137
29160
|
var backtickStepReferenceRegex = /`steps\.([a-zA-Z][a-zA-Z0-9]*)(?:\.([a-zA-Z_][\w.]*))?`/g;
|
|
29138
29161
|
function extractStepReferences(text2, regex) {
|
|
@@ -29171,7 +29194,8 @@ function validateStepReference({ stepId, referencedStepId, propertyPath, context
|
|
|
29171
29194
|
}
|
|
29172
29195
|
return null;
|
|
29173
29196
|
}
|
|
29174
|
-
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.`;
|
|
29175
29199
|
const parts = variable.split(".").filter(Boolean);
|
|
29176
29200
|
if (parts.length === 0) return null;
|
|
29177
29201
|
const [root16, ...rest] = parts;
|
|
@@ -29201,14 +29225,6 @@ function validateTemplateVariable({ variable, context, stepId, currentStepGuard,
|
|
|
29201
29225
|
}
|
|
29202
29226
|
return `Step "${stepId}" ${sourceType} references unsupported template variable "{{${variable}}}". Allowed roots are {{trigger...}} and {{steps.<stepId>...}}.`;
|
|
29203
29227
|
}
|
|
29204
|
-
function extractTemplateVariables(prompt) {
|
|
29205
|
-
const variables = [];
|
|
29206
|
-
for (const match of prompt.matchAll(templateVariableRegex)) {
|
|
29207
|
-
const variable = match[0]?.replace(/\{\{\s*|\s*\}\}/g, "").trim();
|
|
29208
|
-
if (variable) variables.push(variable);
|
|
29209
|
-
}
|
|
29210
|
-
return variables;
|
|
29211
|
-
}
|
|
29212
29228
|
function resolveTriggersFromData(data) {
|
|
29213
29229
|
if (data.triggers && Array.isArray(data.triggers) && data.triggers.length > 0) return data.triggers;
|
|
29214
29230
|
return [];
|
|
@@ -29463,13 +29479,14 @@ function validateManifestTemplateVariables(data, ctx) {
|
|
|
29463
29479
|
});
|
|
29464
29480
|
}
|
|
29465
29481
|
if ("prompt" in step && typeof step.prompt === "string") {
|
|
29466
|
-
const variables = extractTemplateVariables(step.prompt);
|
|
29482
|
+
const variables = step.type === "codegen" ? Array.from(step.prompt.matchAll(codegenTemplateReferenceRegex), (match) => (match[1] ?? "").trim()) : extractTemplateVariables(step.prompt);
|
|
29467
29483
|
for (const variable of variables) {
|
|
29468
29484
|
const error62 = validateTemplateVariable({
|
|
29469
29485
|
variable,
|
|
29470
29486
|
context,
|
|
29471
29487
|
stepId: step.id,
|
|
29472
|
-
currentStepGuard
|
|
29488
|
+
currentStepGuard,
|
|
29489
|
+
interpolated: step.type !== "codegen"
|
|
29473
29490
|
});
|
|
29474
29491
|
if (!error62) continue;
|
|
29475
29492
|
const parts = variable.split(".");
|
|
@@ -29572,7 +29589,8 @@ var RequiredConnectorSchema = external_exports.object({
|
|
|
29572
29589
|
connectorIconUrl: external_exports.string().nullable(),
|
|
29573
29590
|
requiredTypes: external_exports.array(external_exports.enum(CONNECTION_TYPES)),
|
|
29574
29591
|
requiresConnection: external_exports.boolean(),
|
|
29575
|
-
isSystem: external_exports.boolean().optional()
|
|
29592
|
+
isSystem: external_exports.boolean().optional(),
|
|
29593
|
+
isPermanent: external_exports.boolean().optional()
|
|
29576
29594
|
});
|
|
29577
29595
|
var AutomationConnectionSchema = external_exports.object({
|
|
29578
29596
|
connectorId: external_exports.string(),
|
|
@@ -29957,6 +29975,7 @@ var ReadUsageSummaryResponseSchema = external_exports.object({
|
|
|
29957
29975
|
|
|
29958
29976
|
// ../../packages/sdk/dist/core/dist/esm/types/failure-category.types.js
|
|
29959
29977
|
var FAILURE_CATEGORY_REGISTRY = {
|
|
29978
|
+
ai_quota_exceeded: { reliabilityLabel: "AI usage quota exceeded" },
|
|
29960
29979
|
mcp_upstream_unavailable: { reliabilityLabel: "Mcp Upstream Unavailable" },
|
|
29961
29980
|
mcp_client_missing: { reliabilityLabel: "Mcp Client Missing" },
|
|
29962
29981
|
mcp_tool_missing: { reliabilityLabel: "Mcp Tool Missing" },
|
|
@@ -30604,6 +30623,7 @@ var ConnectorSchema = external_exports.object({
|
|
|
30604
30623
|
capabilities: ConnectorCapabilitiesSchema,
|
|
30605
30624
|
requiresConnection: external_exports.boolean(),
|
|
30606
30625
|
isSystem: external_exports.boolean().optional(),
|
|
30626
|
+
isPermanent: external_exports.boolean().optional(),
|
|
30607
30627
|
isManaged: external_exports.boolean().optional(),
|
|
30608
30628
|
connectsViaCli: external_exports.boolean().optional(),
|
|
30609
30629
|
mcpServerUrlInput: McpServerUrlInputSchema.optional()
|
|
@@ -31039,17 +31059,28 @@ var automationExecutionResultSchema = external_exports.discriminatedUnion("statu
|
|
|
31039
31059
|
|
|
31040
31060
|
// ../../packages/sdk/dist/core/dist/esm/schemas/sample-automation.schema.js
|
|
31041
31061
|
var sampleAutomationInstructionsSchema = external_exports.string().nullable();
|
|
31062
|
+
var sampleAutomationSharedBySchema = external_exports.object({
|
|
31063
|
+
name: external_exports.string().min(1).max(100),
|
|
31064
|
+
imageId: external_exports.string().nullable()
|
|
31065
|
+
});
|
|
31042
31066
|
var sampleAutomationSchema = external_exports.object({
|
|
31043
31067
|
id: external_exports.string(),
|
|
31044
31068
|
manifest: manifestSchema,
|
|
31045
31069
|
connectorDetails: external_exports.array(connectorDetailsSchema),
|
|
31046
31070
|
isOneClickInstallEnabled: external_exports.boolean().default(false),
|
|
31047
|
-
staffPick: external_exports.boolean().default(false)
|
|
31071
|
+
staffPick: external_exports.boolean().default(false),
|
|
31072
|
+
sharedBy: sampleAutomationSharedBySchema.nullable().optional()
|
|
31048
31073
|
});
|
|
31049
31074
|
var sampleAutomationsSchema = external_exports.array(sampleAutomationSchema);
|
|
31050
31075
|
var sampleAutomationDetailSchema = sampleAutomationSchema.extend({ instructions: sampleAutomationInstructionsSchema });
|
|
31051
31076
|
var SAMPLE_AUTOMATION_NOT_FOUND_CODE = "sample_automation_not_found";
|
|
31052
31077
|
|
|
31078
|
+
// ../../packages/sdk/dist/core/dist/esm/schemas/sample-automation-idea.schema.js
|
|
31079
|
+
var shareAutomationIdeaResponseSchema = external_exports.object({
|
|
31080
|
+
id: external_exports.string(),
|
|
31081
|
+
createdAt: external_exports.string().datetime()
|
|
31082
|
+
});
|
|
31083
|
+
|
|
31053
31084
|
// ../../packages/sdk/dist/clients/automations/endpoints.js
|
|
31054
31085
|
var root4 = "/automations";
|
|
31055
31086
|
var automationsEndpoints = {
|
|
@@ -31058,6 +31089,7 @@ var automationsEndpoints = {
|
|
|
31058
31089
|
metadata: (id) => `${root4}/${encodeURIComponent(id)}/metadata`,
|
|
31059
31090
|
schedule: (id) => `${root4}/${encodeURIComponent(id)}/schedule`,
|
|
31060
31091
|
duplicate: (id) => `${root4}/${encodeURIComponent(id)}/duplicate`,
|
|
31092
|
+
shareIdea: (id) => `${root4}/${encodeURIComponent(id)}/share-idea`,
|
|
31061
31093
|
draft: (id) => `${root4}/${encodeURIComponent(id)}/draft`,
|
|
31062
31094
|
trigger: (id) => `${root4}/${encodeURIComponent(id)}/trigger`,
|
|
31063
31095
|
test: (id) => `${root4}/${encodeURIComponent(id)}/test`,
|
|
@@ -31149,6 +31181,15 @@ var AutomationsClient = class extends BaseClient {
|
|
|
31149
31181
|
});
|
|
31150
31182
|
return automationDraftWithValidationSchema.parse(data);
|
|
31151
31183
|
}
|
|
31184
|
+
async shareIdea(id, options) {
|
|
31185
|
+
const parsedId = IdSchema.parse(id);
|
|
31186
|
+
const data = await this.request({
|
|
31187
|
+
method: "POST",
|
|
31188
|
+
path: automationsEndpoints.shareIdea(parsedId),
|
|
31189
|
+
options
|
|
31190
|
+
});
|
|
31191
|
+
return shareAutomationIdeaResponseSchema.parse(data);
|
|
31192
|
+
}
|
|
31152
31193
|
async createDraft(id, options) {
|
|
31153
31194
|
const parsedId = IdSchema.parse(id);
|
|
31154
31195
|
const data = await this.request({
|
|
@@ -31648,6 +31689,7 @@ var workspaceAutomationsEndpoints = {
|
|
|
31648
31689
|
trigger: (workspaceId, id) => `${root8(workspaceId)}/${encodeURIComponent(id)}/trigger`,
|
|
31649
31690
|
draft: (workspaceId, id) => `${root8(workspaceId)}/${encodeURIComponent(id)}/draft`,
|
|
31650
31691
|
duplicate: (workspaceId, id) => `${root8(workspaceId)}/${encodeURIComponent(id)}/duplicate`,
|
|
31692
|
+
shareIdea: (workspaceId, id) => `${root8(workspaceId)}/${encodeURIComponent(id)}/share-idea`,
|
|
31651
31693
|
sampleInstall: (workspaceId, sampleAutomationId) => `${sample2(workspaceId, sampleAutomationId)}/install`,
|
|
31652
31694
|
sampleDraft: (workspaceId, sampleAutomationId) => `${sample2(workspaceId, sampleAutomationId)}/draft`
|
|
31653
31695
|
};
|
|
@@ -31757,6 +31799,14 @@ var WorkspaceAutomationsClient = class extends BaseClient {
|
|
|
31757
31799
|
});
|
|
31758
31800
|
return automationDraftWithValidationSchema.parse(data);
|
|
31759
31801
|
}
|
|
31802
|
+
async shareIdea(workspaceId, id, options) {
|
|
31803
|
+
const data = await this.request({
|
|
31804
|
+
method: "POST",
|
|
31805
|
+
path: workspaceAutomationsEndpoints.shareIdea(IdSchema.parse(workspaceId), IdSchema.parse(id)),
|
|
31806
|
+
options
|
|
31807
|
+
});
|
|
31808
|
+
return shareAutomationIdeaResponseSchema.parse(data);
|
|
31809
|
+
}
|
|
31760
31810
|
async createDraft(workspaceId, id, options) {
|
|
31761
31811
|
const data = await this.request({
|
|
31762
31812
|
method: "POST",
|
|
@@ -31952,7 +32002,8 @@ var connectionsEndpoints = {
|
|
|
31952
32002
|
dependentAutomations: (connectorId) => `${root11}/${encodeURIComponent(connectorId)}/automations`,
|
|
31953
32003
|
create: (connectorId, capability) => `${root11}/${encodeURIComponent(connectorId)}/${encodeURIComponent(capability)}`,
|
|
31954
32004
|
localOAuth: (connectorId, capability) => `${root11}/${encodeURIComponent(connectorId)}/${encodeURIComponent(capability)}/local-oauth`,
|
|
31955
|
-
checkManifest: `${root11}/check-manifest
|
|
32005
|
+
checkManifest: `${root11}/check-manifest`,
|
|
32006
|
+
ensurePermanent: `${root11}/ensure-permanent`
|
|
31956
32007
|
};
|
|
31957
32008
|
|
|
31958
32009
|
// ../../packages/sdk/dist/clients/connections/connections-client.js
|
|
@@ -32062,6 +32113,13 @@ var ConnectionsClient = class extends BaseClient {
|
|
|
32062
32113
|
});
|
|
32063
32114
|
return ManifestConnectionCheckResultSchema.parse(data);
|
|
32064
32115
|
}
|
|
32116
|
+
async ensurePermanent(options) {
|
|
32117
|
+
await this.request({
|
|
32118
|
+
method: "POST",
|
|
32119
|
+
path: connectionsEndpoints.ensurePermanent,
|
|
32120
|
+
options
|
|
32121
|
+
});
|
|
32122
|
+
}
|
|
32065
32123
|
};
|
|
32066
32124
|
|
|
32067
32125
|
// ../../packages/sdk/dist/clients/connectors/endpoints.js
|
|
@@ -32419,6 +32477,7 @@ var UserOnboardingStateSchema = external_exports.object({
|
|
|
32419
32477
|
});
|
|
32420
32478
|
var AcceptTermsSchema = external_exports.object({ version: external_exports.string().trim().min(1).max(64) }).meta({ id: "AcceptTerms" });
|
|
32421
32479
|
var McpAssistantSettingSchema = external_exports.object({ mcpAssistant: McpAssistantSchema }).meta({ id: "McpAssistantSetting" });
|
|
32480
|
+
var UsageBillingSettingSchema = external_exports.object({ enabled: external_exports.boolean() }).meta({ id: "UsageBillingSetting" });
|
|
32422
32481
|
var ConnectorIdSchema = external_exports.string().trim().min(1);
|
|
32423
32482
|
var InterestedConnectorIdsSchema = external_exports.array(ConnectorIdSchema).max(100);
|
|
32424
32483
|
var ConnectorPreferencesSchema = external_exports.object({ interestedIds: InterestedConnectorIdsSchema });
|
|
@@ -32491,6 +32550,7 @@ var userSettingsEndpoints = {
|
|
|
32491
32550
|
preferences: `${root13}/preferences`,
|
|
32492
32551
|
personalContext: `${root13}/preferences/personal-context`,
|
|
32493
32552
|
terms: `${root13}/terms`,
|
|
32553
|
+
usageBilling: `${root13}/usage-billing`,
|
|
32494
32554
|
featureFlagTraits: "/feature-flag-traits",
|
|
32495
32555
|
pmfSurvey: "/pmf-survey",
|
|
32496
32556
|
pmfSurveyOutcome: "/pmf-survey/outcome"
|
|
@@ -32534,6 +32594,14 @@ var UserSettingsClient = class extends BaseClient {
|
|
|
32534
32594
|
});
|
|
32535
32595
|
return McpAssistantSettingSchema.parse(data);
|
|
32536
32596
|
}
|
|
32597
|
+
async getUsageBilling(options) {
|
|
32598
|
+
const data = await this.request({
|
|
32599
|
+
method: "GET",
|
|
32600
|
+
path: userSettingsEndpoints.usageBilling,
|
|
32601
|
+
options
|
|
32602
|
+
});
|
|
32603
|
+
return UsageBillingSettingSchema.parse(data);
|
|
32604
|
+
}
|
|
32537
32605
|
async getPreferences(options) {
|
|
32538
32606
|
const data = await this.request({
|
|
32539
32607
|
method: "GET",
|
|
@@ -33158,7 +33226,8 @@ function currentMonthUsageWindow(now = /* @__PURE__ */ new Date()) {
|
|
|
33158
33226
|
}
|
|
33159
33227
|
async function readUsageReport(api, { window: window2 = currentMonthUsageWindow(), signal } = {}) {
|
|
33160
33228
|
const options = { signal };
|
|
33161
|
-
const [state, total, runs, chat] = await Promise.all([
|
|
33229
|
+
const [setting, state, total, runs, chat] = await Promise.all([
|
|
33230
|
+
api.userSettings.getUsageBilling(options),
|
|
33162
33231
|
api.usageBilling.readState(options),
|
|
33163
33232
|
api.usageBilling.readUsageSummary(window2, options),
|
|
33164
33233
|
api.usageBilling.readUsageSummary({
|
|
@@ -33171,14 +33240,16 @@ async function readUsageReport(api, { window: window2 = currentMonthUsageWindow(
|
|
|
33171
33240
|
category: CHAT_MESSAGE_USAGE_CATEGORY
|
|
33172
33241
|
}, options)
|
|
33173
33242
|
]);
|
|
33243
|
+
const billed = setting.enabled;
|
|
33174
33244
|
return {
|
|
33175
33245
|
currency: state.currency,
|
|
33246
|
+
billed,
|
|
33176
33247
|
balance: {
|
|
33177
33248
|
amount: state.settled_amount ?? state.available_amount,
|
|
33178
33249
|
availableAmount: state.available_amount,
|
|
33179
|
-
usageAllowed: state.usage_allowed && !state.depleted,
|
|
33180
|
-
lowBalance: state.is_settled_low_balance ?? state.low_balance,
|
|
33181
|
-
blockReason: state.usage_block_reason ?? null
|
|
33250
|
+
usageAllowed: !billed || state.usage_allowed && !state.depleted,
|
|
33251
|
+
lowBalance: billed && (state.is_settled_low_balance ?? state.low_balance),
|
|
33252
|
+
blockReason: billed ? state.usage_block_reason ?? null : null
|
|
33182
33253
|
},
|
|
33183
33254
|
window: window2,
|
|
33184
33255
|
total: {
|
|
@@ -35216,8 +35287,9 @@ var API_SCOPES = {
|
|
|
35216
35287
|
description: "Register, update, and remove webhook endpoints that receive your automation events",
|
|
35217
35288
|
impliedScopes: ["automations:webhooks:read"]
|
|
35218
35289
|
},
|
|
35219
|
-
//
|
|
35220
|
-
//
|
|
35290
|
+
// Todoist's usage-billing reads require it, for the Automations product,
|
|
35291
|
+
// because the balance lives in Todoist's ledger. Here it covers only whether
|
|
35292
|
+
// the user is billed at all.
|
|
35221
35293
|
"automations:billing:read": {
|
|
35222
35294
|
description: "View your Automations balance and what your automations have cost"
|
|
35223
35295
|
}
|
|
@@ -35499,6 +35571,7 @@ var ReadUsageSummaryResponseSchema2 = external_exports.object({
|
|
|
35499
35571
|
|
|
35500
35572
|
// ../../packages/core/dist/esm/types/failure-category.types.js
|
|
35501
35573
|
var FAILURE_CATEGORY_REGISTRY2 = {
|
|
35574
|
+
ai_quota_exceeded: { reliabilityLabel: "AI usage quota exceeded" },
|
|
35502
35575
|
mcp_upstream_unavailable: { reliabilityLabel: "Mcp Upstream Unavailable" },
|
|
35503
35576
|
mcp_client_missing: { reliabilityLabel: "Mcp Client Missing" },
|
|
35504
35577
|
mcp_tool_missing: { reliabilityLabel: "Mcp Tool Missing" },
|
|
@@ -35644,6 +35717,27 @@ function getRunOutcomeCategory2(run) {
|
|
|
35644
35717
|
return null;
|
|
35645
35718
|
}
|
|
35646
35719
|
|
|
35720
|
+
// ../../packages/core/dist/esm/utils/template.js
|
|
35721
|
+
function* templatePlaceholders2(template) {
|
|
35722
|
+
let cursor = 0;
|
|
35723
|
+
while (cursor < template.length) {
|
|
35724
|
+
const start = template.indexOf("{{", cursor);
|
|
35725
|
+
if (start === -1)
|
|
35726
|
+
return;
|
|
35727
|
+
const close = template.indexOf("}", start + 2);
|
|
35728
|
+
if (close === -1)
|
|
35729
|
+
return;
|
|
35730
|
+
cursor = close + 1;
|
|
35731
|
+
if (template[close + 1] !== "}")
|
|
35732
|
+
continue;
|
|
35733
|
+
cursor++;
|
|
35734
|
+
yield { start, end: cursor, reference: template.slice(start + 2, close).trim() };
|
|
35735
|
+
}
|
|
35736
|
+
}
|
|
35737
|
+
function extractTemplateVariables2(template) {
|
|
35738
|
+
return Array.from(templatePlaceholders2(template), ({ reference }) => reference);
|
|
35739
|
+
}
|
|
35740
|
+
|
|
35647
35741
|
// ../../packages/core/dist/esm/utils/usage-amount-format.js
|
|
35648
35742
|
var MICRO_UNITS_PER_MAJOR_UNIT = 1e6;
|
|
35649
35743
|
function minorUnitsPerMajorUnit(currency, locales) {
|
|
@@ -36128,7 +36222,8 @@ var partialManifestSchema2 = manifestSchemaBase2.partial().extend({
|
|
|
36128
36222
|
manifestVersion: true,
|
|
36129
36223
|
steps: true
|
|
36130
36224
|
});
|
|
36131
|
-
var
|
|
36225
|
+
var templateReferenceRegex2 = /^[\p{ID_Continue}$-]+(?:\.[\p{ID_Continue}$-]+)*$/u;
|
|
36226
|
+
var codegenTemplateReferenceRegex2 = /\{\{\s*([\w.]+)\s*\}\}/g;
|
|
36132
36227
|
var codeStepReferenceRegex2 = /\bsteps\.([a-zA-Z][a-zA-Z0-9]*)(?:\.([a-zA-Z_][\w.]*))?/g;
|
|
36133
36228
|
var backtickStepReferenceRegex2 = /`steps\.([a-zA-Z][a-zA-Z0-9]*)(?:\.([a-zA-Z_][\w.]*))?`/g;
|
|
36134
36229
|
function extractStepReferences2(text2, regex) {
|
|
@@ -36174,11 +36269,13 @@ function validateStepReference2({ stepId, referencedStepId, propertyPath, contex
|
|
|
36174
36269
|
}
|
|
36175
36270
|
return null;
|
|
36176
36271
|
}
|
|
36177
|
-
function validateTemplateVariable2({ variable, context, stepId, currentStepGuard, sourceType = "prompt" }) {
|
|
36272
|
+
function validateTemplateVariable2({ variable, context, stepId, currentStepGuard, sourceType = "prompt", interpolated = true }) {
|
|
36273
|
+
if (interpolated && !templateReferenceRegex2.test(variable)) {
|
|
36274
|
+
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.`;
|
|
36275
|
+
}
|
|
36178
36276
|
const parts = variable.split(".").filter(Boolean);
|
|
36179
|
-
if (parts.length === 0)
|
|
36277
|
+
if (parts.length === 0)
|
|
36180
36278
|
return null;
|
|
36181
|
-
}
|
|
36182
36279
|
const [root16, ...rest] = parts;
|
|
36183
36280
|
if (root16 === "trigger") {
|
|
36184
36281
|
if (rest.length === 0) {
|
|
@@ -36219,16 +36316,6 @@ function validateTemplateVariable2({ variable, context, stepId, currentStepGuard
|
|
|
36219
36316
|
}
|
|
36220
36317
|
return `Step "${stepId}" ${sourceType} references unsupported template variable "{{${variable}}}". Allowed roots are {{trigger...}} and {{steps.<stepId>...}}.`;
|
|
36221
36318
|
}
|
|
36222
|
-
function extractTemplateVariables2(prompt) {
|
|
36223
|
-
const variables = [];
|
|
36224
|
-
for (const match of prompt.matchAll(templateVariableRegex2)) {
|
|
36225
|
-
const variable = match[0]?.replace(/\{\{\s*|\s*\}\}/g, "").trim();
|
|
36226
|
-
if (variable) {
|
|
36227
|
-
variables.push(variable);
|
|
36228
|
-
}
|
|
36229
|
-
}
|
|
36230
|
-
return variables;
|
|
36231
|
-
}
|
|
36232
36319
|
function resolveTriggersFromData2(data) {
|
|
36233
36320
|
if (data.triggers && Array.isArray(data.triggers) && data.triggers.length > 0) {
|
|
36234
36321
|
return data.triggers;
|
|
@@ -36498,13 +36585,14 @@ function validateManifestTemplateVariables2(data, ctx) {
|
|
|
36498
36585
|
}
|
|
36499
36586
|
}
|
|
36500
36587
|
if ("prompt" in step && typeof step.prompt === "string") {
|
|
36501
|
-
const variables = extractTemplateVariables2(step.prompt);
|
|
36588
|
+
const variables = step.type === "codegen" ? Array.from(step.prompt.matchAll(codegenTemplateReferenceRegex2), (match) => (match[1] ?? "").trim()) : extractTemplateVariables2(step.prompt);
|
|
36502
36589
|
for (const variable of variables) {
|
|
36503
36590
|
const error62 = validateTemplateVariable2({
|
|
36504
36591
|
variable,
|
|
36505
36592
|
context,
|
|
36506
36593
|
stepId: step.id,
|
|
36507
|
-
currentStepGuard
|
|
36594
|
+
currentStepGuard,
|
|
36595
|
+
interpolated: step.type !== "codegen"
|
|
36508
36596
|
});
|
|
36509
36597
|
if (!error62)
|
|
36510
36598
|
continue;
|
|
@@ -36618,6 +36706,12 @@ var ConnectorSchema2 = external_exports.object({
|
|
|
36618
36706
|
* independent from whether a third-party connector requires account setup.
|
|
36619
36707
|
*/
|
|
36620
36708
|
isSystem: external_exports.boolean().optional(),
|
|
36709
|
+
/**
|
|
36710
|
+
* Whether the connector is always connected to the signed-in user's own
|
|
36711
|
+
* account, with one connection per capability that can't be removed.
|
|
36712
|
+
* Unlike `isSystem`, it still runs on a connection.
|
|
36713
|
+
*/
|
|
36714
|
+
isPermanent: external_exports.boolean().optional(),
|
|
36621
36715
|
/**
|
|
36622
36716
|
* Managed connectors (e.g. WhatsApp) share a single linked identity across
|
|
36623
36717
|
* connection types — one onboarding covers both action and trigger uses.
|
|
@@ -43227,14 +43321,14 @@ function formatUsageReport(report) {
|
|
|
43227
43321
|
return [
|
|
43228
43322
|
`Balance: ${money(balance.amount)}`,
|
|
43229
43323
|
...balance.availableAmount < balance.amount ? [` ${money(balance.availableAmount)} available now; runs in progress hold the rest.`] : [],
|
|
43230
|
-
...
|
|
43324
|
+
...describeStanding(report),
|
|
43231
43325
|
"",
|
|
43232
43326
|
`Spent from ${report.window.since} to ${report.window.until}: ${money(report.total.chargedAmount)}`,
|
|
43233
43327
|
` Automation runs: ${money(automationRuns.chargedAmount)} (${count(automationRuns.runCount, "run")})`,
|
|
43234
43328
|
...formatAutomationRows(automationRuns.byAutomation, money),
|
|
43235
43329
|
` Chat messages: ${money(chatMessages.chargedAmount)} (${count(chatMessages.messageCount, "message")})`,
|
|
43236
|
-
|
|
43237
|
-
`In the app: ${balanceUsageUrl()}`
|
|
43330
|
+
// The app shows Balance & Usage only to an account it bills.
|
|
43331
|
+
...report.billed ? ["", `In the app: ${balanceUsageUrl()}`] : []
|
|
43238
43332
|
].join("\n");
|
|
43239
43333
|
}
|
|
43240
43334
|
function formatAutomationRows(rows, money) {
|
|
@@ -43252,7 +43346,12 @@ function describeAutomation2(row) {
|
|
|
43252
43346
|
}
|
|
43253
43347
|
return `${row.name ?? "Unnamed automation"} (${row.automationId})`;
|
|
43254
43348
|
}
|
|
43255
|
-
function
|
|
43349
|
+
function describeStanding({ billed, balance }) {
|
|
43350
|
+
if (!billed) {
|
|
43351
|
+
return [
|
|
43352
|
+
" Usage is not billed on this account: runs and chat messages do not draw on this balance, and nothing is refused for it."
|
|
43353
|
+
];
|
|
43354
|
+
}
|
|
43256
43355
|
if (balance.usageAllowed) {
|
|
43257
43356
|
return balance.lowBalance ? [` Your balance is low. Top up at ${topUpUrl()}.`] : [];
|
|
43258
43357
|
}
|