@vm0/cli 9.213.7 → 9.215.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/{agent-XO6L2N44.js → agent-Q36E7SXS.js} +4 -4
- package/{automation-RTPXOLQJ.js → automation-5SCKDOGI.js} +2 -2
- package/{banking-ONFKXLJL.js → banking-CAHWCJAR.js} +2 -2
- package/{chunk-NYVNECWO.js → chunk-6JSMAN54.js} +38 -3
- package/chunk-6JSMAN54.js.map +1 -0
- package/{chunk-C3WSLFCZ.js → chunk-FDLPOCWO.js} +2 -2
- package/{chunk-GPH6IF5E.js → chunk-FRP4XOHX.js} +180 -1
- package/{chunk-GPH6IF5E.js.map → chunk-FRP4XOHX.js.map} +1 -1
- package/{chunk-XZXPLBOS.js → chunk-I7N4KBIX.js} +3 -3
- package/{chunk-3WC7YF42.js → chunk-L3TBICYH.js} +126 -120
- package/chunk-L3TBICYH.js.map +1 -0
- package/{chunk-QY544343.js → chunk-QEJEPV2L.js} +2 -2
- package/{chunk-VHQZF7HL.js → chunk-RRTOFIOK.js} +2 -2
- package/{chunk-IMJM4MSF.js → chunk-THK7OLE6.js} +2 -2
- package/{chunk-BOPFTESJ.js → chunk-VIVZFJDS.js} +2 -2
- package/{chunk-WD35BPZI.js → chunk-WAPN4L25.js} +3 -3
- package/{computer-use-YBL32C2Z.js → computer-use-ZBFSTOOG.js} +2 -2
- package/{connector-VXVCJC7O.js → connector-6RXY5JYL.js} +3 -3
- package/{credit-NPXWPS7N.js → credit-XEMEABCU.js} +2 -2
- package/{developer-support-RJJ6MU4P.js → developer-support-Y4JDVN76.js} +2 -2
- package/{doctor-3DWZ6OK7.js → doctor-SY52EVOR.js} +8 -8
- package/{generate-GVVANLYC.js → generate-JYMF7BHK.js} +4 -4
- package/{github-SWD5WTUP.js → github-PUECSYOR.js} +2 -2
- package/{gmail.generated-HG53NEQU.js → gmail.generated-PQRRPXQT.js} +41 -1
- package/{gmail.generated-HG53NEQU.js.map → gmail.generated-PQRRPXQT.js.map} +1 -1
- package/{goal-73BYBVE4.js → goal-4W22W3U7.js} +2 -2
- package/{google-cloud.generated-V6NTCJJE.js → google-cloud.generated-YXGYYFFQ.js} +33 -1
- package/{google-cloud.generated-V6NTCJJE.js.map → google-cloud.generated-YXGYYFFQ.js.map} +1 -1
- package/{google-drive.generated-OROWMZTF.js → google-drive.generated-T5BTUU7V.js} +25 -1
- package/{google-drive.generated-OROWMZTF.js.map → google-drive.generated-T5BTUU7V.js.map} +1 -1
- package/{host-BK72W6PL.js → host-2HQNNQ2M.js} +2 -2
- package/index.js +14 -14
- package/{logs-D2WBV7KO.js → logs-3CZT3YA4.js} +7 -7
- package/{maps-O4M3KIFK.js → maps-RDJK2SRG.js} +2 -2
- package/{model-7CWVS6JX.js → model-NI5GY7SI.js} +7 -7
- package/model-NI5GY7SI.js.map +1 -0
- package/{model-provider-PMCTLFDQ.js → model-provider-Z7ZLH6ZW.js} +3 -3
- package/{org-MKNE6LO7.js → org-HQ5MS6XK.js} +2 -2
- package/package.json +1 -1
- package/{phone-Y6IXQLKK.js → phone-KLZZM3EP.js} +2 -2
- package/{preference-RZ7N6KYX.js → preference-ZQ5E3XXD.js} +2 -2
- package/{resource-DAKTXKBE.js → resource-TBB6Z5TG.js} +5 -4
- package/resource-TBB6Z5TG.js.map +1 -0
- package/{search-TODYOUN7.js → search-KULB76N7.js} +7 -7
- package/{secret-T523D5LM.js → secret-PSG5K22M.js} +3 -3
- package/{slack-G2TBUALH.js → slack-RN4OJN5B.js} +2 -2
- package/{telegram-2RI22G5A.js → telegram-CZMGZSCK.js} +2 -2
- package/{variable-MGGFJ2U5.js → variable-NT4FX34Y.js} +2 -2
- package/{web-CCVDAUYP.js → web-EDG3KYQ7.js} +2 -2
- package/{whoami-ZZZUZIL7.js → whoami-KDAUQAST.js} +4 -4
- package/{workflow-DR5N3QR7.js → workflow-Z4PJ6M26.js} +295 -77
- package/workflow-Z4PJ6M26.js.map +1 -0
- package/zero.js +30 -30
- package/chunk-3WC7YF42.js.map +0 -1
- package/chunk-NYVNECWO.js.map +0 -1
- package/model-7CWVS6JX.js.map +0 -1
- package/resource-DAKTXKBE.js.map +0 -1
- package/workflow-DR5N3QR7.js.map +0 -1
- /package/{agent-XO6L2N44.js.map → agent-Q36E7SXS.js.map} +0 -0
- /package/{automation-RTPXOLQJ.js.map → automation-5SCKDOGI.js.map} +0 -0
- /package/{banking-ONFKXLJL.js.map → banking-CAHWCJAR.js.map} +0 -0
- /package/{chunk-C3WSLFCZ.js.map → chunk-FDLPOCWO.js.map} +0 -0
- /package/{chunk-XZXPLBOS.js.map → chunk-I7N4KBIX.js.map} +0 -0
- /package/{chunk-QY544343.js.map → chunk-QEJEPV2L.js.map} +0 -0
- /package/{chunk-VHQZF7HL.js.map → chunk-RRTOFIOK.js.map} +0 -0
- /package/{chunk-IMJM4MSF.js.map → chunk-THK7OLE6.js.map} +0 -0
- /package/{chunk-BOPFTESJ.js.map → chunk-VIVZFJDS.js.map} +0 -0
- /package/{chunk-WD35BPZI.js.map → chunk-WAPN4L25.js.map} +0 -0
- /package/{computer-use-YBL32C2Z.js.map → computer-use-ZBFSTOOG.js.map} +0 -0
- /package/{connector-VXVCJC7O.js.map → connector-6RXY5JYL.js.map} +0 -0
- /package/{credit-NPXWPS7N.js.map → credit-XEMEABCU.js.map} +0 -0
- /package/{developer-support-RJJ6MU4P.js.map → developer-support-Y4JDVN76.js.map} +0 -0
- /package/{doctor-3DWZ6OK7.js.map → doctor-SY52EVOR.js.map} +0 -0
- /package/{generate-GVVANLYC.js.map → generate-JYMF7BHK.js.map} +0 -0
- /package/{github-SWD5WTUP.js.map → github-PUECSYOR.js.map} +0 -0
- /package/{goal-73BYBVE4.js.map → goal-4W22W3U7.js.map} +0 -0
- /package/{host-BK72W6PL.js.map → host-2HQNNQ2M.js.map} +0 -0
- /package/{logs-D2WBV7KO.js.map → logs-3CZT3YA4.js.map} +0 -0
- /package/{maps-O4M3KIFK.js.map → maps-RDJK2SRG.js.map} +0 -0
- /package/{model-provider-PMCTLFDQ.js.map → model-provider-Z7ZLH6ZW.js.map} +0 -0
- /package/{org-MKNE6LO7.js.map → org-HQ5MS6XK.js.map} +0 -0
- /package/{phone-Y6IXQLKK.js.map → phone-KLZZM3EP.js.map} +0 -0
- /package/{preference-RZ7N6KYX.js.map → preference-ZQ5E3XXD.js.map} +0 -0
- /package/{search-TODYOUN7.js.map → search-KULB76N7.js.map} +0 -0
- /package/{secret-T523D5LM.js.map → secret-PSG5K22M.js.map} +0 -0
- /package/{slack-G2TBUALH.js.map → slack-RN4OJN5B.js.map} +0 -0
- /package/{telegram-2RI22G5A.js.map → telegram-CZMGZSCK.js.map} +0 -0
- /package/{variable-MGGFJ2U5.js.map → variable-NT4FX34Y.js.map} +0 -0
- /package/{web-CCVDAUYP.js.map → web-EDG3KYQ7.js.map} +0 -0
- /package/{whoami-ZZZUZIL7.js.map → whoami-KDAUQAST.js.map} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
downloadSlackFile,
|
|
7
7
|
initSlackFileUpload,
|
|
8
8
|
sendSlackMessage
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-L3TBICYH.js";
|
|
10
10
|
import "./chunk-LTDQISD7.js";
|
|
11
11
|
import {
|
|
12
12
|
withErrorHandler
|
|
@@ -220,4 +220,4 @@ Examples:
|
|
|
220
220
|
export {
|
|
221
221
|
zeroSlackCommand
|
|
222
222
|
};
|
|
223
|
-
//# sourceMappingURL=slack-
|
|
223
|
+
//# sourceMappingURL=slack-RN4OJN5B.js.map
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
initTelegramFileUpload,
|
|
8
8
|
listTelegramBots,
|
|
9
9
|
sendTelegramMessage
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-L3TBICYH.js";
|
|
11
11
|
import "./chunk-LTDQISD7.js";
|
|
12
12
|
import {
|
|
13
13
|
withErrorHandler
|
|
@@ -335,4 +335,4 @@ Examples:
|
|
|
335
335
|
export {
|
|
336
336
|
zeroTelegramCommand
|
|
337
337
|
};
|
|
338
|
-
//# sourceMappingURL=telegram-
|
|
338
|
+
//# sourceMappingURL=telegram-CZMGZSCK.js.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
deleteZeroVariable,
|
|
10
10
|
listZeroVariables,
|
|
11
11
|
setZeroVariable
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-L3TBICYH.js";
|
|
13
13
|
import "./chunk-LTDQISD7.js";
|
|
14
14
|
import {
|
|
15
15
|
withErrorHandler
|
|
@@ -117,4 +117,4 @@ var zeroVariableCommand = new Command().name("variable").description("Read or wr
|
|
|
117
117
|
export {
|
|
118
118
|
zeroVariableCommand
|
|
119
119
|
};
|
|
120
|
-
//# sourceMappingURL=variable-
|
|
120
|
+
//# sourceMappingURL=variable-NT4FX34Y.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module";
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
|
-
import "./chunk-
|
|
4
|
+
import "./chunk-L3TBICYH.js";
|
|
5
5
|
import "./chunk-LTDQISD7.js";
|
|
6
6
|
import {
|
|
7
7
|
downloadWebFile,
|
|
@@ -106,4 +106,4 @@ Examples:
|
|
|
106
106
|
export {
|
|
107
107
|
zeroWebCommand
|
|
108
108
|
};
|
|
109
|
-
//# sourceMappingURL=web-
|
|
109
|
+
//# sourceMappingURL=web-EDG3KYQ7.js.map
|
|
@@ -4,15 +4,15 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
loadConnectorPermissionInfos,
|
|
6
6
|
policyIcon
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-THK7OLE6.js";
|
|
8
8
|
import {
|
|
9
9
|
permissionGrantsToFirewallPolicies
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FDLPOCWO.js";
|
|
11
11
|
import {
|
|
12
12
|
getZeroAgentUserConnectors,
|
|
13
13
|
listZeroConnectors,
|
|
14
14
|
listZeroUserPermissionGrants
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-L3TBICYH.js";
|
|
16
16
|
import "./chunk-LTDQISD7.js";
|
|
17
17
|
import {
|
|
18
18
|
getActiveOrg,
|
|
@@ -192,4 +192,4 @@ Notes:
|
|
|
192
192
|
export {
|
|
193
193
|
zeroWhoamiCommand
|
|
194
194
|
};
|
|
195
|
-
//# sourceMappingURL=whoami-
|
|
195
|
+
//# sourceMappingURL=whoami-KDAUQAST.js.map
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
runWorkflow,
|
|
28
28
|
updateWorkflow,
|
|
29
29
|
updateWorkflowTrigger
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-L3TBICYH.js";
|
|
31
31
|
import "./chunk-LTDQISD7.js";
|
|
32
32
|
import {
|
|
33
33
|
withErrorHandler
|
|
@@ -462,6 +462,12 @@ function formatGmailMatchSummary(config) {
|
|
|
462
462
|
}
|
|
463
463
|
return parts.length > 0 ? parts.join("; ") : "all inbound messages";
|
|
464
464
|
}
|
|
465
|
+
function formatGithubSubject(subject) {
|
|
466
|
+
if (subject === "pull_requests") {
|
|
467
|
+
return "pull requests";
|
|
468
|
+
}
|
|
469
|
+
return subject;
|
|
470
|
+
}
|
|
465
471
|
function formatWorkflowTriggerEntry(trigger) {
|
|
466
472
|
if (trigger.kind === "event" && trigger.eventType === "gmail-new-message") {
|
|
467
473
|
return `Gmail new message: ${formatGmailMatchSummary(trigger.eventConfig)}`;
|
|
@@ -469,6 +475,14 @@ function formatWorkflowTriggerEntry(trigger) {
|
|
|
469
475
|
if (trigger.kind === "event" && trigger.eventType === "gmail-label-applied") {
|
|
470
476
|
return `Gmail label applied: ${quote(trigger.eventConfig.labelName)}`;
|
|
471
477
|
}
|
|
478
|
+
if (trigger.kind === "event" && trigger.eventType === "github-label-applied") {
|
|
479
|
+
return `GitHub label applied: ${quote(trigger.eventConfig.labelName)} (${formatGithubSubject(
|
|
480
|
+
trigger.eventConfig.filters.subject
|
|
481
|
+
)}, actor ${trigger.eventConfig.filters.actor.type})`;
|
|
482
|
+
}
|
|
483
|
+
if (trigger.kind === "event" && trigger.eventType === "google-calendar-event-created") {
|
|
484
|
+
return `Google Calendar event created: ${trigger.eventConfig.calendarId}`;
|
|
485
|
+
}
|
|
472
486
|
if (isWebhookTrigger(trigger)) {
|
|
473
487
|
return `Webhook: ${trigger.webhookUrl}`;
|
|
474
488
|
}
|
|
@@ -542,7 +556,7 @@ function printWorkflowTriggerDetails(trigger, options) {
|
|
|
542
556
|
}
|
|
543
557
|
console.log(`${"Status:".padEnd(14)}${status}`);
|
|
544
558
|
console.log(
|
|
545
|
-
`${"Trigger:".padEnd(14)}${trigger.kind === "event" ? trigger.eventType === "gmail-new-message" ? "Gmail new message" : trigger.eventType === "gmail-label-applied" ? "Gmail label applied" : "Webhook" : formatWorkflowTriggerEntry(trigger)}`
|
|
559
|
+
`${"Trigger:".padEnd(14)}${trigger.kind === "event" ? trigger.eventType === "gmail-new-message" ? "Gmail new message" : trigger.eventType === "gmail-label-applied" ? "Gmail label applied" : trigger.eventType === "github-label-applied" ? "GitHub label applied" : trigger.eventType === "google-calendar-event-created" ? "Google Calendar event created" : "Webhook" : formatWorkflowTriggerEntry(trigger)}`
|
|
546
560
|
);
|
|
547
561
|
if (trigger.kind === "event" && trigger.eventType === "gmail-new-message") {
|
|
548
562
|
console.log(
|
|
@@ -552,6 +566,20 @@ function printWorkflowTriggerDetails(trigger, options) {
|
|
|
552
566
|
if (trigger.kind === "event" && trigger.eventType === "gmail-label-applied") {
|
|
553
567
|
console.log(`${"Label:".padEnd(14)}${trigger.eventConfig.labelName}`);
|
|
554
568
|
}
|
|
569
|
+
if (trigger.kind === "event" && trigger.eventType === "github-label-applied") {
|
|
570
|
+
console.log(`${"Label:".padEnd(14)}${trigger.eventConfig.labelName}`);
|
|
571
|
+
console.log(
|
|
572
|
+
`${"Subject:".padEnd(14)}${formatGithubSubject(
|
|
573
|
+
trigger.eventConfig.filters.subject
|
|
574
|
+
)}`
|
|
575
|
+
);
|
|
576
|
+
console.log(
|
|
577
|
+
`${"Actor:".padEnd(14)}${trigger.eventConfig.filters.actor.type}`
|
|
578
|
+
);
|
|
579
|
+
}
|
|
580
|
+
if (trigger.kind === "event" && trigger.eventType === "google-calendar-event-created") {
|
|
581
|
+
console.log(`${"Calendar:".padEnd(14)}${trigger.eventConfig.calendarId}`);
|
|
582
|
+
}
|
|
555
583
|
if (isWebhookTrigger(trigger)) {
|
|
556
584
|
console.log(`${"Webhook URL:".padEnd(14)}${trigger.webhookUrl}`);
|
|
557
585
|
console.log(
|
|
@@ -794,15 +822,17 @@ var SCHEDULE_KINDS = ["cron", "once", "loop"];
|
|
|
794
822
|
var EVENT_KINDS = [
|
|
795
823
|
"gmail-new-message",
|
|
796
824
|
"gmail-label-applied",
|
|
825
|
+
"github-label-applied",
|
|
826
|
+
"google-calendar-event-created",
|
|
797
827
|
"webhook"
|
|
798
828
|
];
|
|
799
829
|
var TRIGGER_KINDS = [...SCHEDULE_KINDS, ...EVENT_KINDS];
|
|
800
|
-
var EXACTLY_ONE_FLAG_MESSAGE = "Provide exactly one of --expr (cron), --at (once), --every (loop), Gmail match options, or --
|
|
830
|
+
var EXACTLY_ONE_FLAG_MESSAGE = "Provide exactly one of --expr (cron), --at (once), --every (loop), Gmail match options, --label, --subject, or --actor";
|
|
801
831
|
function addGmailTriggerOptions(command) {
|
|
802
832
|
return command.option(
|
|
803
833
|
"--config <path>",
|
|
804
834
|
"Path to a Gmail new message trigger config JSON"
|
|
805
|
-
).option("--label <name>", "
|
|
835
|
+
).option("--label <name>", "Label name for label-applied triggers").option("--from-contains <text>", "Require the From header to contain text").option(
|
|
806
836
|
"--from-not-contains <text>",
|
|
807
837
|
"Require the From header not to contain text"
|
|
808
838
|
).option(
|
|
@@ -825,6 +855,15 @@ function addGmailTriggerOptions(command) {
|
|
|
825
855
|
"Require the Cc header not to contain text"
|
|
826
856
|
);
|
|
827
857
|
}
|
|
858
|
+
function addGithubTriggerOptions(command) {
|
|
859
|
+
return command.option(
|
|
860
|
+
"--subject <subject>",
|
|
861
|
+
"GitHub subject filter for github-label-applied: both | issues | pull-requests"
|
|
862
|
+
).option(
|
|
863
|
+
"--actor <actor>",
|
|
864
|
+
"GitHub actor filter for github-label-applied: me | anyone"
|
|
865
|
+
);
|
|
866
|
+
}
|
|
828
867
|
function timezoneOrUtc(timezone) {
|
|
829
868
|
return timezone ?? "UTC";
|
|
830
869
|
}
|
|
@@ -964,86 +1003,229 @@ function buildSchedule(kind, options) {
|
|
|
964
1003
|
function hasScheduleAddOptions(options) {
|
|
965
1004
|
return options.expr !== void 0 || options.at !== void 0 || options.every !== void 0 || options.timezone !== void 0;
|
|
966
1005
|
}
|
|
967
|
-
function
|
|
968
|
-
|
|
969
|
-
|
|
1006
|
+
function hasGithubTriggerOptions(options) {
|
|
1007
|
+
return options.subject !== void 0 || options.actor !== void 0;
|
|
1008
|
+
}
|
|
1009
|
+
function hasCalendarTriggerOptions(options) {
|
|
1010
|
+
return options.calendarId !== void 0;
|
|
1011
|
+
}
|
|
1012
|
+
function hasEventAddOptions(options) {
|
|
1013
|
+
return hasGmailTriggerOptions(options) || hasGmailLabelOption(options) || hasGithubTriggerOptions(options) || hasCalendarTriggerOptions(options);
|
|
1014
|
+
}
|
|
1015
|
+
function assertNoScheduleAddOptions(options) {
|
|
1016
|
+
if (hasScheduleAddOptions(options)) {
|
|
1017
|
+
throw new Error(
|
|
1018
|
+
"--expr, --at, --every, and --timezone only apply to schedule triggers"
|
|
1019
|
+
);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
function assertNoGithubTriggerOptions(options, message = "GitHub trigger flags only apply to GitHub event triggers") {
|
|
1023
|
+
if (hasGithubTriggerOptions(options)) {
|
|
1024
|
+
throw new Error(message);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
function assertNoCalendarTriggerOptions(options) {
|
|
1028
|
+
if (hasCalendarTriggerOptions(options)) {
|
|
1029
|
+
throw new Error(
|
|
1030
|
+
"Google Calendar trigger flags only apply to Google Calendar event triggers"
|
|
1031
|
+
);
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
function scheduleUpdateFlagCount(options) {
|
|
1035
|
+
return [options.expr, options.at, options.every].filter((value) => {
|
|
1036
|
+
return value !== void 0;
|
|
1037
|
+
}).length;
|
|
1038
|
+
}
|
|
1039
|
+
function hasScheduleUpdateOptions(options) {
|
|
1040
|
+
return scheduleUpdateFlagCount(options) > 0 || options.timezone !== void 0;
|
|
1041
|
+
}
|
|
1042
|
+
function parseGithubSubject(value, fallback = "both") {
|
|
1043
|
+
if (value === void 0) {
|
|
1044
|
+
return fallback;
|
|
1045
|
+
}
|
|
1046
|
+
switch (value) {
|
|
1047
|
+
case "both":
|
|
1048
|
+
case "issues":
|
|
1049
|
+
return value;
|
|
1050
|
+
case "pull-requests":
|
|
1051
|
+
return "pull_requests";
|
|
1052
|
+
default:
|
|
970
1053
|
throw new Error(
|
|
971
|
-
|
|
1054
|
+
`Invalid --subject "${value}". Use one of: both, issues, pull-requests`
|
|
972
1055
|
);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
function parseGithubActor(value, fallback = "me") {
|
|
1059
|
+
if (value === void 0) {
|
|
1060
|
+
return fallback;
|
|
1061
|
+
}
|
|
1062
|
+
if (value === "me" || value === "anyone") {
|
|
1063
|
+
return value;
|
|
1064
|
+
}
|
|
1065
|
+
throw new Error(`Invalid --actor "${value}". Use one of: me, anyone`);
|
|
1066
|
+
}
|
|
1067
|
+
function buildGithubLabelAppliedEventConfig(options, existing) {
|
|
1068
|
+
const labelName = options.label?.trim() ?? existing?.eventConfig.labelName;
|
|
1069
|
+
if (!labelName) {
|
|
1070
|
+
throw new Error(
|
|
1071
|
+
'github-label-applied triggers require --label "Label name"'
|
|
1072
|
+
);
|
|
1073
|
+
}
|
|
1074
|
+
return {
|
|
1075
|
+
provider: "github",
|
|
1076
|
+
event: "label_applied",
|
|
1077
|
+
labelName,
|
|
1078
|
+
filters: {
|
|
1079
|
+
subject: parseGithubSubject(
|
|
1080
|
+
options.subject,
|
|
1081
|
+
existing?.eventConfig.filters.subject ?? "both"
|
|
1082
|
+
),
|
|
1083
|
+
actor: {
|
|
1084
|
+
type: parseGithubActor(
|
|
1085
|
+
options.actor,
|
|
1086
|
+
existing?.eventConfig.filters.actor.type ?? "me"
|
|
1087
|
+
)
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
function buildGmailNewMessageCreateRequest(options) {
|
|
1093
|
+
assertNoScheduleAddOptions(options);
|
|
1094
|
+
if (hasGmailLabelOption(options)) {
|
|
1095
|
+
throw new Error("--label only applies to label-applied event triggers");
|
|
1096
|
+
}
|
|
1097
|
+
assertNoGithubTriggerOptions(options);
|
|
1098
|
+
assertNoCalendarTriggerOptions(options);
|
|
1099
|
+
return {
|
|
1100
|
+
kind: "event",
|
|
1101
|
+
eventType: "gmail-new-message",
|
|
1102
|
+
eventConfig: buildGmailNewMessageEventConfig(options)
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1105
|
+
function buildGmailLabelAppliedCreateRequest(options) {
|
|
1106
|
+
assertNoScheduleAddOptions(options);
|
|
1107
|
+
if (hasGmailTriggerOptions(options)) {
|
|
1108
|
+
throw new Error(
|
|
1109
|
+
"Gmail match flags and --config only apply to gmail-new-message triggers"
|
|
1110
|
+
);
|
|
1111
|
+
}
|
|
1112
|
+
assertNoGithubTriggerOptions(options);
|
|
1113
|
+
assertNoCalendarTriggerOptions(options);
|
|
1114
|
+
return {
|
|
1115
|
+
kind: "event",
|
|
1116
|
+
eventType: "gmail-label-applied",
|
|
1117
|
+
eventConfig: buildGmailLabelAppliedEventConfig(options)
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1120
|
+
function buildGithubLabelAppliedCreateRequest(options) {
|
|
1121
|
+
assertNoScheduleAddOptions(options);
|
|
1122
|
+
if (hasGmailTriggerOptions(options)) {
|
|
1123
|
+
throw new Error(
|
|
1124
|
+
"Gmail match flags and --config only apply to Gmail event triggers"
|
|
1125
|
+
);
|
|
1126
|
+
}
|
|
1127
|
+
assertNoCalendarTriggerOptions(options);
|
|
1128
|
+
return {
|
|
1129
|
+
kind: "event",
|
|
1130
|
+
eventType: "github-label-applied",
|
|
1131
|
+
eventConfig: buildGithubLabelAppliedEventConfig(options)
|
|
1132
|
+
};
|
|
1133
|
+
}
|
|
1134
|
+
function buildGoogleCalendarEventCreatedCreateRequest(options) {
|
|
1135
|
+
assertNoScheduleAddOptions(options);
|
|
1136
|
+
if (hasGmailTriggerOptions(options) || hasGmailLabelOption(options) || hasGithubTriggerOptions(options)) {
|
|
1137
|
+
throw new Error(
|
|
1138
|
+
"Gmail and GitHub trigger flags only apply to their event triggers"
|
|
1139
|
+
);
|
|
1140
|
+
}
|
|
1141
|
+
return {
|
|
1142
|
+
kind: "event",
|
|
1143
|
+
eventType: "google-calendar-event-created",
|
|
1144
|
+
eventConfig: {
|
|
1145
|
+
provider: "google-calendar",
|
|
1146
|
+
event: "event_created",
|
|
1147
|
+
calendarId: options.calendarId?.trim() || "primary"
|
|
973
1148
|
}
|
|
974
|
-
|
|
975
|
-
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
function buildWebhookCreateRequest(options) {
|
|
1152
|
+
assertNoScheduleAddOptions(options);
|
|
1153
|
+
if (hasEventAddOptions(options)) {
|
|
1154
|
+
throw new Error("Event trigger flags only apply to event triggers");
|
|
1155
|
+
}
|
|
1156
|
+
return {
|
|
1157
|
+
kind: "event",
|
|
1158
|
+
eventType: "webhook-received",
|
|
1159
|
+
eventConfig: {
|
|
1160
|
+
provider: "webhook",
|
|
1161
|
+
event: "received",
|
|
1162
|
+
auth: { mode: "hmac-sha256" }
|
|
976
1163
|
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
1164
|
+
};
|
|
1165
|
+
}
|
|
1166
|
+
function buildScheduleCreateRequest(kind, options) {
|
|
1167
|
+
if (hasEventAddOptions(options)) {
|
|
1168
|
+
throw new Error("Event trigger flags only apply to event triggers");
|
|
982
1169
|
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1170
|
+
return { schedule: buildSchedule(kind, options) };
|
|
1171
|
+
}
|
|
1172
|
+
function buildCreateRequest(kind, options) {
|
|
1173
|
+
switch (kind) {
|
|
1174
|
+
case "gmail-new-message":
|
|
1175
|
+
return buildGmailNewMessageCreateRequest(options);
|
|
1176
|
+
case "gmail-label-applied":
|
|
1177
|
+
return buildGmailLabelAppliedCreateRequest(options);
|
|
1178
|
+
case "github-label-applied":
|
|
1179
|
+
return buildGithubLabelAppliedCreateRequest(options);
|
|
1180
|
+
case "google-calendar-event-created":
|
|
1181
|
+
return buildGoogleCalendarEventCreatedCreateRequest(options);
|
|
1182
|
+
case "webhook":
|
|
1183
|
+
return buildWebhookCreateRequest(options);
|
|
1184
|
+
default:
|
|
1185
|
+
return buildScheduleCreateRequest(kind, options);
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
function buildEventUpdate(options, existing) {
|
|
1189
|
+
const hasGmailOptions = hasGmailTriggerOptions(options);
|
|
1190
|
+
const hasLabelOption = hasGmailLabelOption(options);
|
|
1191
|
+
const hasGithubOptions = hasGithubTriggerOptions(options);
|
|
1192
|
+
if (existing.eventType === "google-calendar-event-created") {
|
|
1193
|
+
throw new Error("Google Calendar event triggers cannot be updated");
|
|
1194
|
+
}
|
|
1195
|
+
if (existing.eventType === "github-label-applied") {
|
|
1196
|
+
if (hasGmailOptions) {
|
|
1197
|
+
throw new Error("Gmail match flags only apply to Gmail event triggers");
|
|
988
1198
|
}
|
|
989
|
-
if (
|
|
1199
|
+
if (!hasLabelOption && !hasGithubOptions) {
|
|
990
1200
|
throw new Error(
|
|
991
|
-
"
|
|
1201
|
+
"Provide --label, --subject, or --actor for github-label-applied triggers"
|
|
992
1202
|
);
|
|
993
1203
|
}
|
|
994
1204
|
return {
|
|
995
|
-
|
|
996
|
-
eventType: "gmail-label-applied",
|
|
997
|
-
eventConfig: buildGmailLabelAppliedEventConfig(options)
|
|
1205
|
+
eventConfig: buildGithubLabelAppliedEventConfig(options, existing)
|
|
998
1206
|
};
|
|
999
1207
|
}
|
|
1000
|
-
if (
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
if (hasGmailTriggerOptions(options) || hasGmailLabelOption(options)) {
|
|
1007
|
-
throw new Error("Gmail trigger flags only apply to Gmail event triggers");
|
|
1208
|
+
if (hasGithubOptions) {
|
|
1209
|
+
throw new Error("GitHub trigger flags only apply to GitHub event triggers");
|
|
1210
|
+
}
|
|
1211
|
+
if (existing.eventType === "gmail-label-applied") {
|
|
1212
|
+
if (!hasLabelOption || hasGmailOptions) {
|
|
1213
|
+
throw new Error("Use --label for gmail-label-applied triggers");
|
|
1008
1214
|
}
|
|
1009
|
-
return {
|
|
1010
|
-
kind: "event",
|
|
1011
|
-
eventType: "webhook-received",
|
|
1012
|
-
eventConfig: {
|
|
1013
|
-
provider: "webhook",
|
|
1014
|
-
event: "received",
|
|
1015
|
-
auth: { mode: "hmac-sha256" }
|
|
1016
|
-
}
|
|
1017
|
-
};
|
|
1215
|
+
return { eventConfig: buildGmailLabelAppliedEventConfig(options) };
|
|
1018
1216
|
}
|
|
1019
|
-
if (
|
|
1020
|
-
throw new Error("Gmail
|
|
1217
|
+
if (!hasGmailOptions || hasLabelOption) {
|
|
1218
|
+
throw new Error("Use Gmail match options for gmail-new-message triggers");
|
|
1021
1219
|
}
|
|
1022
|
-
return {
|
|
1220
|
+
return { eventConfig: buildGmailNewMessageEventConfig(options) };
|
|
1023
1221
|
}
|
|
1024
|
-
function
|
|
1025
|
-
const flagCount = [options.expr, options.at, options.every].filter(
|
|
1026
|
-
(value) => {
|
|
1027
|
-
return value !== void 0;
|
|
1028
|
-
}
|
|
1029
|
-
).length;
|
|
1222
|
+
function buildScheduleUpdate(options) {
|
|
1030
1223
|
const hasGmailOptions = hasGmailTriggerOptions(options);
|
|
1031
1224
|
const hasLabelOption = hasGmailLabelOption(options);
|
|
1032
|
-
if (hasGmailOptions
|
|
1033
|
-
throw new Error("
|
|
1034
|
-
}
|
|
1035
|
-
if (hasLabelOption) {
|
|
1036
|
-
if (flagCount > 0 || options.timezone !== void 0) {
|
|
1037
|
-
throw new Error("Use either schedule flags or --label");
|
|
1038
|
-
}
|
|
1039
|
-
return { eventConfig: buildGmailLabelAppliedEventConfig(options) };
|
|
1040
|
-
}
|
|
1041
|
-
if (hasGmailOptions) {
|
|
1042
|
-
if (flagCount > 0 || options.timezone !== void 0) {
|
|
1043
|
-
throw new Error("Use either schedule flags or Gmail match options");
|
|
1044
|
-
}
|
|
1045
|
-
return { eventConfig: buildGmailNewMessageEventConfig(options) };
|
|
1225
|
+
if (hasGmailOptions || hasLabelOption) {
|
|
1226
|
+
throw new Error("Gmail trigger flags only apply to Gmail event triggers");
|
|
1046
1227
|
}
|
|
1228
|
+
const flagCount = scheduleUpdateFlagCount(options);
|
|
1047
1229
|
if (flagCount !== 1) {
|
|
1048
1230
|
throw new Error(EXACTLY_ONE_FLAG_MESSAGE);
|
|
1049
1231
|
}
|
|
@@ -1058,6 +1240,25 @@ function buildUpdate(options) {
|
|
|
1058
1240
|
}
|
|
1059
1241
|
return { schedule: buildSchedule("loop", options) };
|
|
1060
1242
|
}
|
|
1243
|
+
function buildUpdate(options, existing) {
|
|
1244
|
+
const hasEventOptions = hasGmailTriggerOptions(options) || hasGmailLabelOption(options) || hasGithubTriggerOptions(options);
|
|
1245
|
+
if (hasScheduleUpdateOptions(options) && hasEventOptions) {
|
|
1246
|
+
throw new Error("Use either schedule flags or event trigger options");
|
|
1247
|
+
}
|
|
1248
|
+
if (hasGmailTriggerOptions(options) && hasGmailLabelOption(options)) {
|
|
1249
|
+
throw new Error("Use either Gmail match options or --label");
|
|
1250
|
+
}
|
|
1251
|
+
if (existing.kind === "event") {
|
|
1252
|
+
if (hasScheduleUpdateOptions(options)) {
|
|
1253
|
+
throw new Error("Schedule flags only apply to schedule triggers");
|
|
1254
|
+
}
|
|
1255
|
+
return buildEventUpdate(options, existing);
|
|
1256
|
+
}
|
|
1257
|
+
if (hasGithubTriggerOptions(options)) {
|
|
1258
|
+
throw new Error("GitHub trigger flags only apply to GitHub event triggers");
|
|
1259
|
+
}
|
|
1260
|
+
return buildScheduleUpdate(options);
|
|
1261
|
+
}
|
|
1061
1262
|
async function resolveWorkflowId(ref, options) {
|
|
1062
1263
|
if (UUID_RE.test(ref)) {
|
|
1063
1264
|
return ref;
|
|
@@ -1078,14 +1279,19 @@ async function resolveWorkflowId(ref, options) {
|
|
|
1078
1279
|
}
|
|
1079
1280
|
return matches[0].id;
|
|
1080
1281
|
}
|
|
1081
|
-
var addCommand =
|
|
1082
|
-
|
|
1083
|
-
"--
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1282
|
+
var addCommand = addGithubTriggerOptions(
|
|
1283
|
+
addGmailTriggerOptions(
|
|
1284
|
+
new Command().name("add").description("Add a trigger to a workflow").argument("<workflow>", "Workflow ID or name").argument("<kind>", `Trigger type: ${TRIGGER_KINDS.join(" | ")}`).option("--expr <expression>", 'Cron expression for kind "cron"').option("--at <iso-time>", 'Fire time for kind "once"').option(
|
|
1285
|
+
"--every <duration>",
|
|
1286
|
+
'Interval for kind "loop" (e.g. 15m, 1h, 90s)'
|
|
1287
|
+
).option(
|
|
1288
|
+
"-z, --timezone <tz>",
|
|
1289
|
+
"IANA timezone for cron/once (default: UTC)"
|
|
1290
|
+
)
|
|
1088
1291
|
)
|
|
1292
|
+
).option(
|
|
1293
|
+
"--calendar-id <id>",
|
|
1294
|
+
"Google Calendar ID for google-calendar-event-created (default: primary)"
|
|
1089
1295
|
).option("--agent <id>", "Agent ID for resolving a workflow name").addHelpText(
|
|
1090
1296
|
"after",
|
|
1091
1297
|
`
|
|
@@ -1096,11 +1302,14 @@ Examples:
|
|
|
1096
1302
|
zero workflow trigger add triage gmail-new-message --from-contains "@example.com"
|
|
1097
1303
|
zero workflow trigger add triage gmail-new-message --config ./gmail-trigger.json
|
|
1098
1304
|
zero workflow trigger add triage gmail-label-applied --label "Support"
|
|
1305
|
+
zero workflow trigger add triage github-label-applied --label "triage" --subject both --actor me
|
|
1306
|
+
zero workflow trigger add triage google-calendar-event-created
|
|
1099
1307
|
zero workflow trigger add triage webhook
|
|
1100
1308
|
|
|
1101
1309
|
Notes:
|
|
1102
1310
|
- Workflow names resolve under --agent, then ZERO_AGENT_ID, then all visible workflows
|
|
1103
1311
|
- Gmail triggers match all inbound messages when no text match rules are provided
|
|
1312
|
+
- GitHub label triggers require the GitHub App installation in the workspace
|
|
1104
1313
|
- Webhook triggers print the signing secret only once after creation
|
|
1105
1314
|
- Use the workflow ID when a name is ambiguous`
|
|
1106
1315
|
).action(
|
|
@@ -1119,8 +1328,12 @@ Notes:
|
|
|
1119
1328
|
}
|
|
1120
1329
|
)
|
|
1121
1330
|
);
|
|
1122
|
-
var updateCommand =
|
|
1123
|
-
|
|
1331
|
+
var updateCommand = addGithubTriggerOptions(
|
|
1332
|
+
addGmailTriggerOptions(
|
|
1333
|
+
new Command().name("update").description(
|
|
1334
|
+
"Replace a workflow trigger's schedule or Gmail match config"
|
|
1335
|
+
).argument("<trigger>", "Workflow trigger ID").option("--expr <expression>", 'New cron schedule (e.g. "0 9 * * *")').option("--at <iso-time>", 'New one-time fire (e.g. "2026-06-10T09:00")').option("--every <duration>", "New loop interval (e.g. 15m, 1h, 90s)").option("-z, --timezone <tz>", "IANA timezone for --expr / --at")
|
|
1336
|
+
)
|
|
1124
1337
|
).addHelpText(
|
|
1125
1338
|
"after",
|
|
1126
1339
|
`
|
|
@@ -1130,10 +1343,15 @@ Examples:
|
|
|
1130
1343
|
zero workflow trigger update 22222222-2222-4222-8222-222222222222 --every 10m
|
|
1131
1344
|
zero workflow trigger update 22222222-2222-4222-8222-222222222222 --from-contains "@example.com"
|
|
1132
1345
|
zero workflow trigger update 22222222-2222-4222-8222-222222222222 --config ./gmail-trigger.json
|
|
1133
|
-
zero workflow trigger update 22222222-2222-4222-8222-222222222222 --label "Support"
|
|
1346
|
+
zero workflow trigger update 22222222-2222-4222-8222-222222222222 --label "Support"
|
|
1347
|
+
zero workflow trigger update 22222222-2222-4222-8222-222222222222 --actor anyone`
|
|
1134
1348
|
).action(
|
|
1135
1349
|
withErrorHandler(async (id, options) => {
|
|
1136
|
-
const
|
|
1350
|
+
const existing = await getWorkflowTrigger(id);
|
|
1351
|
+
const trigger = await updateWorkflowTrigger(
|
|
1352
|
+
id,
|
|
1353
|
+
buildUpdate(options, existing)
|
|
1354
|
+
);
|
|
1137
1355
|
console.log(source_default.green(`\u2713 Trigger ${trigger.id} updated`));
|
|
1138
1356
|
printWorkflowTriggerDetails(trigger);
|
|
1139
1357
|
})
|
|
@@ -1215,4 +1433,4 @@ Examples:
|
|
|
1215
1433
|
export {
|
|
1216
1434
|
zeroWorkflowCommand
|
|
1217
1435
|
};
|
|
1218
|
-
//# sourceMappingURL=workflow-
|
|
1436
|
+
//# sourceMappingURL=workflow-Z4PJ6M26.js.map
|