@vm0/cli 9.249.2 → 9.250.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-TOFXTWYP.js → agent-YJFMD7LA.js} +7 -7
- package/{banking-U7I6EJUO.js → banking-JRKBMYU5.js} +5 -5
- package/{chat-77EDGFMS.js → chat-WYS6FFNJ.js} +6 -6
- package/{chunk-HSGQT7LT.js → chunk-4TTCW5OQ.js} +2 -2
- package/{chunk-4HN7U3JF.js → chunk-7OWH4M4H.js} +3 -3
- package/{chunk-JCLLQRCI.js → chunk-FNXVREX3.js} +2 -2
- package/{chunk-N6TDQYGF.js → chunk-LME44JCZ.js} +2 -2
- package/{chunk-AFNSFKAH.js → chunk-LSSFQNLG.js} +4 -4
- package/{chunk-BQOOTJNB.js → chunk-LVWZ2FVB.js} +3 -3
- package/{chunk-ROB3OE37.js → chunk-MNY7TC57.js} +55 -3
- package/{chunk-ROB3OE37.js.map → chunk-MNY7TC57.js.map} +1 -1
- package/{chunk-5CZNUTFF.js → chunk-O3BA2A2T.js} +2 -2
- package/{chunk-A2NKQGRI.js → chunk-O7VNSQWZ.js} +13 -1
- package/chunk-O7VNSQWZ.js.map +1 -0
- package/{chunk-WDDZJGWL.js → chunk-SY5X55C4.js} +2 -2
- package/{chunk-UNQJRTJQ.js → chunk-YPA52IJ7.js} +2 -2
- package/{computer-use-BCGPVGWS.js → computer-use-D2MPAUYF.js} +5 -5
- package/{connector-CHZSI2LW.js → connector-3CX23I3A.js} +8 -8
- package/{credit-RWFBPKOS.js → credit-AOTIS6VG.js} +7 -7
- package/{developer-support-IVR3HIP7.js → developer-support-57LFRVGG.js} +5 -5
- package/{doctor-KGWTXW2Q.js → doctor-2LCAFBSD.js} +7 -7
- package/{feishu-PLF4P5OG.js → feishu-2NKABJIL.js} +5 -5
- package/{finance-LVFG3WWP.js → finance-NJNJDMAH.js} +5 -5
- package/{generate-4FIBMMJO.js → generate-SIX4HFYT.js} +7 -7
- package/{github-WHNAVVG3.js → github-GZIHWGLS.js} +5 -5
- package/{goal-G4J2BQ5Z.js → goal-7YPU6W4L.js} +5 -5
- package/{host-3W6U2ZUP.js → host-K6BCECUE.js} +5 -5
- package/{logs-P7JLTGXY.js → logs-FXUU3B7R.js} +6 -6
- package/{mail-LIAOXDD4.js → mail-NMQN3UOV.js} +7 -7
- package/{maps-C4NOXSE7.js → maps-TV2AB76X.js} +5 -5
- package/{model-I2MNQ5KC.js → model-6KGNE7AT.js} +6 -6
- package/{model-provider-AOCCHEMP.js → model-provider-AIJG5OUO.js} +6 -6
- package/{org-MVBG3WXZ.js → org-ODZB42L3.js} +5 -5
- package/package.json +1 -1
- package/{phone-4OZQFYHU.js → phone-XPMI6VF2.js} +5 -5
- package/{preference-H2A3WBGQ.js → preference-BVX47Y4Q.js} +5 -5
- package/{resource-CPCQ6V6M.js → resource-IGSGF4EH.js} +5 -5
- package/{scrape-6RMFDYAT.js → scrape-ADTRGJG6.js} +5 -5
- package/{search-HSQVSQZY.js → search-6ZJQPRWM.js} +6 -6
- package/{secret-S4D6CNOX.js → secret-Y4G7BLND.js} +5 -5
- package/{slack-E3E2NIDZ.js → slack-HKTL3FSY.js} +5 -5
- package/{teams-CLEWT2LQ.js → teams-2N2EHMY7.js} +5 -5
- package/{telegram-35FKKA4K.js → telegram-Z4WLU2O2.js} +5 -5
- package/{upgrade-DNGUR42E.js → upgrade-QB2455RE.js} +4 -4
- package/{variable-C7RWUPV6.js → variable-KO6LBIV4.js} +5 -5
- package/{video-JS5VOA2S.js → video-KUPHYWB4.js} +4 -4
- package/{weather-5R2N5OX4.js → weather-RCRWQFDR.js} +5 -5
- package/{web-FXIIYCZ7.js → web-3D7YJGZ5.js} +5 -5
- package/{web-search-SZP7J4UM.js → web-search-IYBKKVMU.js} +5 -5
- package/{whoami-J4FRN67A.js → whoami-REQ5UNRU.js} +7 -7
- package/{workflow-HQHZKXB2.js → workflow-H2AHF7J4.js} +174 -10
- package/workflow-H2AHF7J4.js.map +1 -0
- package/zero.js +41 -41
- package/chunk-A2NKQGRI.js.map +0 -1
- package/workflow-HQHZKXB2.js.map +0 -1
- /package/{agent-TOFXTWYP.js.map → agent-YJFMD7LA.js.map} +0 -0
- /package/{banking-U7I6EJUO.js.map → banking-JRKBMYU5.js.map} +0 -0
- /package/{chat-77EDGFMS.js.map → chat-WYS6FFNJ.js.map} +0 -0
- /package/{chunk-HSGQT7LT.js.map → chunk-4TTCW5OQ.js.map} +0 -0
- /package/{chunk-4HN7U3JF.js.map → chunk-7OWH4M4H.js.map} +0 -0
- /package/{chunk-JCLLQRCI.js.map → chunk-FNXVREX3.js.map} +0 -0
- /package/{chunk-N6TDQYGF.js.map → chunk-LME44JCZ.js.map} +0 -0
- /package/{chunk-AFNSFKAH.js.map → chunk-LSSFQNLG.js.map} +0 -0
- /package/{chunk-BQOOTJNB.js.map → chunk-LVWZ2FVB.js.map} +0 -0
- /package/{chunk-5CZNUTFF.js.map → chunk-O3BA2A2T.js.map} +0 -0
- /package/{chunk-WDDZJGWL.js.map → chunk-SY5X55C4.js.map} +0 -0
- /package/{chunk-UNQJRTJQ.js.map → chunk-YPA52IJ7.js.map} +0 -0
- /package/{computer-use-BCGPVGWS.js.map → computer-use-D2MPAUYF.js.map} +0 -0
- /package/{connector-CHZSI2LW.js.map → connector-3CX23I3A.js.map} +0 -0
- /package/{credit-RWFBPKOS.js.map → credit-AOTIS6VG.js.map} +0 -0
- /package/{developer-support-IVR3HIP7.js.map → developer-support-57LFRVGG.js.map} +0 -0
- /package/{doctor-KGWTXW2Q.js.map → doctor-2LCAFBSD.js.map} +0 -0
- /package/{feishu-PLF4P5OG.js.map → feishu-2NKABJIL.js.map} +0 -0
- /package/{finance-LVFG3WWP.js.map → finance-NJNJDMAH.js.map} +0 -0
- /package/{generate-4FIBMMJO.js.map → generate-SIX4HFYT.js.map} +0 -0
- /package/{github-WHNAVVG3.js.map → github-GZIHWGLS.js.map} +0 -0
- /package/{goal-G4J2BQ5Z.js.map → goal-7YPU6W4L.js.map} +0 -0
- /package/{host-3W6U2ZUP.js.map → host-K6BCECUE.js.map} +0 -0
- /package/{logs-P7JLTGXY.js.map → logs-FXUU3B7R.js.map} +0 -0
- /package/{mail-LIAOXDD4.js.map → mail-NMQN3UOV.js.map} +0 -0
- /package/{maps-C4NOXSE7.js.map → maps-TV2AB76X.js.map} +0 -0
- /package/{model-I2MNQ5KC.js.map → model-6KGNE7AT.js.map} +0 -0
- /package/{model-provider-AOCCHEMP.js.map → model-provider-AIJG5OUO.js.map} +0 -0
- /package/{org-MVBG3WXZ.js.map → org-ODZB42L3.js.map} +0 -0
- /package/{phone-4OZQFYHU.js.map → phone-XPMI6VF2.js.map} +0 -0
- /package/{preference-H2A3WBGQ.js.map → preference-BVX47Y4Q.js.map} +0 -0
- /package/{resource-CPCQ6V6M.js.map → resource-IGSGF4EH.js.map} +0 -0
- /package/{scrape-6RMFDYAT.js.map → scrape-ADTRGJG6.js.map} +0 -0
- /package/{search-HSQVSQZY.js.map → search-6ZJQPRWM.js.map} +0 -0
- /package/{secret-S4D6CNOX.js.map → secret-Y4G7BLND.js.map} +0 -0
- /package/{slack-E3E2NIDZ.js.map → slack-HKTL3FSY.js.map} +0 -0
- /package/{teams-CLEWT2LQ.js.map → teams-2N2EHMY7.js.map} +0 -0
- /package/{telegram-35FKKA4K.js.map → telegram-Z4WLU2O2.js.map} +0 -0
- /package/{upgrade-DNGUR42E.js.map → upgrade-QB2455RE.js.map} +0 -0
- /package/{variable-C7RWUPV6.js.map → variable-KO6LBIV4.js.map} +0 -0
- /package/{video-JS5VOA2S.js.map → video-KUPHYWB4.js.map} +0 -0
- /package/{weather-5R2N5OX4.js.map → weather-RCRWQFDR.js.map} +0 -0
- /package/{web-FXIIYCZ7.js.map → web-3D7YJGZ5.js.map} +0 -0
- /package/{web-search-SZP7J4UM.js.map → web-search-IYBKKVMU.js.map} +0 -0
- /package/{whoami-J4FRN67A.js.map → whoami-REQ5UNRU.js.map} +0 -0
|
@@ -19,14 +19,14 @@ import {
|
|
|
19
19
|
listWorkflows,
|
|
20
20
|
updateWorkflow,
|
|
21
21
|
updateWorkflowAutomation
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
22
|
+
} from "./chunk-MNY7TC57.js";
|
|
23
|
+
import "./chunk-LME44JCZ.js";
|
|
24
24
|
import "./chunk-SB7EZ2ZO.js";
|
|
25
25
|
import {
|
|
26
26
|
source_default,
|
|
27
27
|
withErrorHandler
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
28
|
+
} from "./chunk-LVWZ2FVB.js";
|
|
29
|
+
import "./chunk-O7VNSQWZ.js";
|
|
30
30
|
import {
|
|
31
31
|
Command
|
|
32
32
|
} from "./chunk-LD4ZVU4O.js";
|
|
@@ -620,6 +620,8 @@ function workflowAutomationKindLabel(automation) {
|
|
|
620
620
|
return "Gmail label applied";
|
|
621
621
|
case "github-label-applied":
|
|
622
622
|
return "GitHub label applied";
|
|
623
|
+
case "github-workflow-run-completed":
|
|
624
|
+
return "GitHub workflow completed";
|
|
623
625
|
case "google-calendar-event-created":
|
|
624
626
|
return "Google Calendar event created";
|
|
625
627
|
case "google-calendar-event-updated":
|
|
@@ -687,6 +689,21 @@ function printWorkflowAutomationsTable(automations) {
|
|
|
687
689
|
);
|
|
688
690
|
}
|
|
689
691
|
}
|
|
692
|
+
function printGithubWorkflowRunFilters(automation) {
|
|
693
|
+
if (automation.kind !== "event" || automation.eventType !== "github-workflow-run-completed") {
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
const printFilter = (label, values) => {
|
|
697
|
+
console.log(`${`${label}:`.padEnd(14)}${values?.join(", ") ?? "any"}`);
|
|
698
|
+
};
|
|
699
|
+
const { filters } = automation.eventConfig;
|
|
700
|
+
printFilter("Repositories", filters.repositories);
|
|
701
|
+
printFilter("Workflows", filters.workflows);
|
|
702
|
+
printFilter("Conclusions", filters.conclusions);
|
|
703
|
+
printFilter("Branches", filters.branches);
|
|
704
|
+
printFilter("Events", filters.events);
|
|
705
|
+
printFilter("Actors", filters.actors);
|
|
706
|
+
}
|
|
690
707
|
function printWorkflowAutomationDetails(automation, options) {
|
|
691
708
|
const status = automation.enabled ? source_default.green("enabled") : source_default.yellow("disabled");
|
|
692
709
|
console.log(`${"Kind:".padEnd(14)}${automation.kind}`);
|
|
@@ -717,6 +734,7 @@ function printWorkflowAutomationDetails(automation, options) {
|
|
|
717
734
|
`${"Actor:".padEnd(14)}${automation.eventConfig.filters.actor.type}`
|
|
718
735
|
);
|
|
719
736
|
}
|
|
737
|
+
printGithubWorkflowRunFilters(automation);
|
|
720
738
|
if (isGoogleCalendarAutomation(automation)) {
|
|
721
739
|
console.log(
|
|
722
740
|
`${"Calendar:".padEnd(14)}${automation.eventConfig.calendarId}`
|
|
@@ -1036,6 +1054,7 @@ var EVENT_KINDS = [
|
|
|
1036
1054
|
"gmail-new-message",
|
|
1037
1055
|
"gmail-label-applied",
|
|
1038
1056
|
"github-label-applied",
|
|
1057
|
+
"github-workflow-run-completed",
|
|
1039
1058
|
"google-calendar-event-created",
|
|
1040
1059
|
"google-calendar-event-updated",
|
|
1041
1060
|
"google-calendar-event-cancelled",
|
|
@@ -1079,7 +1098,19 @@ function addGithubAutomationOptions(command) {
|
|
|
1079
1098
|
"GitHub subject filter for github-label-applied: both | issues | pull-requests"
|
|
1080
1099
|
).option(
|
|
1081
1100
|
"--actor <actor>",
|
|
1082
|
-
"GitHub actor filter for
|
|
1101
|
+
"GitHub actor filter: me | anyone for labels, or comma-separated logins for workflow runs"
|
|
1102
|
+
).option(
|
|
1103
|
+
"--repository <repositories>",
|
|
1104
|
+
"GitHub workflow run repositories, comma-separated owner/name values"
|
|
1105
|
+
).option(
|
|
1106
|
+
"--workflow <workflows>",
|
|
1107
|
+
"GitHub workflows, comma-separated IDs, names, or paths"
|
|
1108
|
+
).option(
|
|
1109
|
+
"--conclusion <conclusions>",
|
|
1110
|
+
"Workflow run conclusions, comma-separated values"
|
|
1111
|
+
).option("--branch <branches>", "Workflow run branches, comma-separated").option(
|
|
1112
|
+
"--triggering-event <events>",
|
|
1113
|
+
"Workflow run triggering events, comma-separated"
|
|
1083
1114
|
);
|
|
1084
1115
|
}
|
|
1085
1116
|
function timezoneOrUtc(timezone) {
|
|
@@ -1221,9 +1252,15 @@ function buildSchedule(kind, options) {
|
|
|
1221
1252
|
function hasScheduleAddOptions(options) {
|
|
1222
1253
|
return options.expr !== void 0 || options.at !== void 0 || options.every !== void 0 || options.timezone !== void 0;
|
|
1223
1254
|
}
|
|
1224
|
-
function
|
|
1255
|
+
function hasGithubLabelAutomationOptions(options) {
|
|
1225
1256
|
return options.subject !== void 0 || options.actor !== void 0;
|
|
1226
1257
|
}
|
|
1258
|
+
function hasGithubWorkflowRunSpecificOptions(options) {
|
|
1259
|
+
return options.repository !== void 0 || options.workflow !== void 0 || options.conclusion !== void 0 || options.branch !== void 0 || options.triggeringEvent !== void 0;
|
|
1260
|
+
}
|
|
1261
|
+
function hasGithubAutomationOptions(options) {
|
|
1262
|
+
return hasGithubLabelAutomationOptions(options) || hasGithubWorkflowRunSpecificOptions(options);
|
|
1263
|
+
}
|
|
1227
1264
|
function hasCalendarAutomationOptions(options) {
|
|
1228
1265
|
return options.calendarId !== void 0;
|
|
1229
1266
|
}
|
|
@@ -1317,6 +1354,79 @@ function buildGithubLabelAppliedEventConfig(options, existing) {
|
|
|
1317
1354
|
}
|
|
1318
1355
|
};
|
|
1319
1356
|
}
|
|
1357
|
+
var GITHUB_WORKFLOW_RUN_CONCLUSIONS = [
|
|
1358
|
+
"action_required",
|
|
1359
|
+
"cancelled",
|
|
1360
|
+
"failure",
|
|
1361
|
+
"neutral",
|
|
1362
|
+
"skipped",
|
|
1363
|
+
"stale",
|
|
1364
|
+
"startup_failure",
|
|
1365
|
+
"success",
|
|
1366
|
+
"timed_out"
|
|
1367
|
+
];
|
|
1368
|
+
function parseGithubWorkflowRunFilter(value, fallback) {
|
|
1369
|
+
if (value === void 0) {
|
|
1370
|
+
return fallback ? [...fallback] : void 0;
|
|
1371
|
+
}
|
|
1372
|
+
if (value.trim().toLowerCase() === "any") {
|
|
1373
|
+
return void 0;
|
|
1374
|
+
}
|
|
1375
|
+
const values = Array.from(
|
|
1376
|
+
new Set(
|
|
1377
|
+
value.split(",").map((part) => {
|
|
1378
|
+
return part.trim();
|
|
1379
|
+
}).filter(Boolean)
|
|
1380
|
+
)
|
|
1381
|
+
);
|
|
1382
|
+
if (values.length === 0) {
|
|
1383
|
+
throw new Error("GitHub workflow run filters cannot be empty; use any");
|
|
1384
|
+
}
|
|
1385
|
+
return values;
|
|
1386
|
+
}
|
|
1387
|
+
function parseGithubWorkflowRunConclusions(value, fallback) {
|
|
1388
|
+
const values = parseGithubWorkflowRunFilter(value, fallback);
|
|
1389
|
+
if (!values) {
|
|
1390
|
+
return void 0;
|
|
1391
|
+
}
|
|
1392
|
+
return values.map((conclusion) => {
|
|
1393
|
+
if (GITHUB_WORKFLOW_RUN_CONCLUSIONS.includes(
|
|
1394
|
+
conclusion
|
|
1395
|
+
)) {
|
|
1396
|
+
return conclusion;
|
|
1397
|
+
}
|
|
1398
|
+
throw new Error(
|
|
1399
|
+
`Invalid --conclusion "${conclusion}". Use one of: ${GITHUB_WORKFLOW_RUN_CONCLUSIONS.join(", ")}, any`
|
|
1400
|
+
);
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
function buildGithubWorkflowRunCompletedEventConfig(options, existing) {
|
|
1404
|
+
const filters = existing?.eventConfig.filters;
|
|
1405
|
+
return {
|
|
1406
|
+
provider: "github",
|
|
1407
|
+
event: "workflow_run_completed",
|
|
1408
|
+
filters: {
|
|
1409
|
+
repositories: parseGithubWorkflowRunFilter(
|
|
1410
|
+
options.repository,
|
|
1411
|
+
filters?.repositories
|
|
1412
|
+
),
|
|
1413
|
+
workflows: parseGithubWorkflowRunFilter(
|
|
1414
|
+
options.workflow,
|
|
1415
|
+
filters?.workflows
|
|
1416
|
+
),
|
|
1417
|
+
conclusions: parseGithubWorkflowRunConclusions(
|
|
1418
|
+
options.conclusion,
|
|
1419
|
+
filters?.conclusions
|
|
1420
|
+
),
|
|
1421
|
+
branches: parseGithubWorkflowRunFilter(options.branch, filters?.branches),
|
|
1422
|
+
events: parseGithubWorkflowRunFilter(
|
|
1423
|
+
options.triggeringEvent,
|
|
1424
|
+
filters?.events
|
|
1425
|
+
),
|
|
1426
|
+
actors: parseGithubWorkflowRunFilter(options.actor, filters?.actors)
|
|
1427
|
+
}
|
|
1428
|
+
};
|
|
1429
|
+
}
|
|
1320
1430
|
function buildGmailNewMessageCreateRequest(options) {
|
|
1321
1431
|
assertNoScheduleAddOptions(options);
|
|
1322
1432
|
if (hasGmailLabelOption(options)) {
|
|
@@ -1356,12 +1466,37 @@ function buildGithubLabelAppliedCreateRequest(options) {
|
|
|
1356
1466
|
}
|
|
1357
1467
|
assertNoCalendarAutomationOptions(options);
|
|
1358
1468
|
assertNoNotionAutomationOptions(options);
|
|
1469
|
+
if (hasGithubWorkflowRunSpecificOptions(options)) {
|
|
1470
|
+
throw new Error(
|
|
1471
|
+
"Workflow run filter flags only apply to github-workflow-run-completed automations"
|
|
1472
|
+
);
|
|
1473
|
+
}
|
|
1359
1474
|
return {
|
|
1360
1475
|
kind: "event",
|
|
1361
1476
|
eventType: "github-label-applied",
|
|
1362
1477
|
eventConfig: buildGithubLabelAppliedEventConfig(options)
|
|
1363
1478
|
};
|
|
1364
1479
|
}
|
|
1480
|
+
function buildGithubWorkflowRunCompletedCreateRequest(options) {
|
|
1481
|
+
assertNoScheduleAddOptions(options);
|
|
1482
|
+
if (hasGmailAutomationOptions(options) || hasGmailLabelOption(options)) {
|
|
1483
|
+
throw new Error(
|
|
1484
|
+
"Gmail automation flags only apply to Gmail event automations"
|
|
1485
|
+
);
|
|
1486
|
+
}
|
|
1487
|
+
if (options.subject !== void 0) {
|
|
1488
|
+
throw new Error(
|
|
1489
|
+
"--subject only applies to github-label-applied automations"
|
|
1490
|
+
);
|
|
1491
|
+
}
|
|
1492
|
+
assertNoCalendarAutomationOptions(options);
|
|
1493
|
+
assertNoNotionAutomationOptions(options);
|
|
1494
|
+
return {
|
|
1495
|
+
kind: "event",
|
|
1496
|
+
eventType: "github-workflow-run-completed",
|
|
1497
|
+
eventConfig: buildGithubWorkflowRunCompletedEventConfig(options)
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1365
1500
|
function buildGoogleCalendarEventCreateRequest(eventType, options) {
|
|
1366
1501
|
assertNoScheduleAddOptions(options);
|
|
1367
1502
|
if (hasGmailAutomationOptions(options) || hasGmailLabelOption(options) || hasGithubAutomationOptions(options) || hasNotionAutomationOptions(options)) {
|
|
@@ -1520,6 +1655,8 @@ function buildCreateRequest(kind, options) {
|
|
|
1520
1655
|
return buildGmailLabelAppliedCreateRequest(options);
|
|
1521
1656
|
case "github-label-applied":
|
|
1522
1657
|
return buildGithubLabelAppliedCreateRequest(options);
|
|
1658
|
+
case "github-workflow-run-completed":
|
|
1659
|
+
return buildGithubWorkflowRunCompletedCreateRequest(options);
|
|
1523
1660
|
case "google-calendar-event-created":
|
|
1524
1661
|
return buildGoogleCalendarEventCreateRequest(kind, options);
|
|
1525
1662
|
case "google-calendar-event-updated":
|
|
@@ -1551,6 +1688,11 @@ function buildEventUpdate(options, existing) {
|
|
|
1551
1688
|
"Gmail match flags only apply to Gmail event automations"
|
|
1552
1689
|
);
|
|
1553
1690
|
}
|
|
1691
|
+
if (hasGithubWorkflowRunSpecificOptions(options)) {
|
|
1692
|
+
throw new Error(
|
|
1693
|
+
"Workflow run filter flags only apply to github-workflow-run-completed automations"
|
|
1694
|
+
);
|
|
1695
|
+
}
|
|
1554
1696
|
if (!hasLabelOption && !hasGithubOptions) {
|
|
1555
1697
|
throw new Error(
|
|
1556
1698
|
"Provide --label, --subject, or --actor for github-label-applied automations"
|
|
@@ -1560,6 +1702,24 @@ function buildEventUpdate(options, existing) {
|
|
|
1560
1702
|
eventConfig: buildGithubLabelAppliedEventConfig(options, existing)
|
|
1561
1703
|
};
|
|
1562
1704
|
}
|
|
1705
|
+
if (existing.eventType === "github-workflow-run-completed") {
|
|
1706
|
+
if (hasGmailOptions || hasLabelOption || options.subject !== void 0) {
|
|
1707
|
+
throw new Error(
|
|
1708
|
+
"Gmail, label, and subject flags do not apply to GitHub workflow run automations"
|
|
1709
|
+
);
|
|
1710
|
+
}
|
|
1711
|
+
if (!hasGithubAutomationOptions(options)) {
|
|
1712
|
+
throw new Error(
|
|
1713
|
+
"Provide a GitHub workflow run filter flag; use any to clear a filter"
|
|
1714
|
+
);
|
|
1715
|
+
}
|
|
1716
|
+
return {
|
|
1717
|
+
eventConfig: buildGithubWorkflowRunCompletedEventConfig(
|
|
1718
|
+
options,
|
|
1719
|
+
existing
|
|
1720
|
+
)
|
|
1721
|
+
};
|
|
1722
|
+
}
|
|
1563
1723
|
if (hasGithubOptions) {
|
|
1564
1724
|
throw new Error(
|
|
1565
1725
|
"GitHub automation flags only apply to GitHub event automations"
|
|
@@ -1655,6 +1815,7 @@ Examples:
|
|
|
1655
1815
|
zero workflow automation add triage --agent <agent-id> gmail-new-message --config ./gmail-automation.json
|
|
1656
1816
|
zero workflow automation add triage --agent <agent-id> gmail-label-applied --label "Support"
|
|
1657
1817
|
zero workflow automation add triage --agent <agent-id> github-label-applied --label "triage" --subject both --actor me
|
|
1818
|
+
zero workflow automation add ci-triage --agent <agent-id> github-workflow-run-completed --repository vm0-ai/vm0 --workflow Turbo --conclusion failure,timed_out --branch main --triggering-event push --actor dependabot[bot]
|
|
1658
1819
|
zero workflow automation add triage --agent <agent-id> google-calendar-event-created
|
|
1659
1820
|
zero workflow automation add triage --agent <agent-id> google-calendar-event-updated
|
|
1660
1821
|
zero workflow automation add triage --agent <agent-id> google-calendar-event-cancelled
|
|
@@ -1667,7 +1828,8 @@ Examples:
|
|
|
1667
1828
|
Notes:
|
|
1668
1829
|
- Workflow names resolve under --agent, then ZERO_AGENT_ID
|
|
1669
1830
|
- Gmail automations match all inbound messages when no text match rules are provided
|
|
1670
|
-
- GitHub
|
|
1831
|
+
- GitHub automations require the GitHub App installation in the workspace
|
|
1832
|
+
- GitHub workflow run filters accept comma-separated values; omit a filter to match any value
|
|
1671
1833
|
- Webhook automations print the signing secret only once after creation
|
|
1672
1834
|
- Use the workflow ID when a name is ambiguous`
|
|
1673
1835
|
).action(
|
|
@@ -1691,7 +1853,7 @@ Notes:
|
|
|
1691
1853
|
var updateCommand = addGithubAutomationOptions(
|
|
1692
1854
|
addGmailAutomationOptions(
|
|
1693
1855
|
new Command().name("update").description(
|
|
1694
|
-
"Replace a workflow automation's schedule or
|
|
1856
|
+
"Replace a workflow automation's schedule or event filter config"
|
|
1695
1857
|
).argument("<automation>", "Workflow automation 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")
|
|
1696
1858
|
)
|
|
1697
1859
|
).addHelpText(
|
|
@@ -1704,7 +1866,9 @@ Examples:
|
|
|
1704
1866
|
zero workflow automation update 22222222-2222-4222-8222-222222222222 --from-contains "@example.com"
|
|
1705
1867
|
zero workflow automation update 22222222-2222-4222-8222-222222222222 --config ./gmail-automation.json
|
|
1706
1868
|
zero workflow automation update 22222222-2222-4222-8222-222222222222 --label "Support"
|
|
1707
|
-
zero workflow automation update 22222222-2222-4222-8222-222222222222 --actor anyone
|
|
1869
|
+
zero workflow automation update 22222222-2222-4222-8222-222222222222 --actor anyone
|
|
1870
|
+
zero workflow automation update 22222222-2222-4222-8222-222222222222 --conclusion failure,timed_out --branch main
|
|
1871
|
+
zero workflow automation update 22222222-2222-4222-8222-222222222222 --actor any`
|
|
1708
1872
|
).action(
|
|
1709
1873
|
withErrorHandler(async (id, options) => {
|
|
1710
1874
|
const existing = await getWorkflowAutomation(id);
|
|
@@ -1793,4 +1957,4 @@ Examples:
|
|
|
1793
1957
|
export {
|
|
1794
1958
|
zeroWorkflowCommand
|
|
1795
1959
|
};
|
|
1796
|
-
//# sourceMappingURL=workflow-
|
|
1960
|
+
//# sourceMappingURL=workflow-H2AHF7J4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/zero/workflow/index.ts","../src/commands/zero/workflow/create.ts","../src/lib/skill-directory.ts","../src/commands/zero/workflow/format.ts","../src/commands/zero/workflow/edit.ts","../src/commands/zero/workflow/resolve-workflow-ref.ts","../src/commands/zero/workflow/view.ts","../src/commands/zero/workflow/list.ts","../src/commands/zero/workflow/delete.ts","../src/commands/zero/workflow/copy.ts","../src/commands/zero/workflow/automation/display.ts","../src/lib/domain/relative-time.ts","../src/commands/zero/shared/duration.ts","../src/commands/zero/workflow/automation/index.ts","../src/commands/zero/workflow/automation/gmail-config.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createCommand } from \"./create\";\nimport { editCommand } from \"./edit\";\nimport { viewCommand } from \"./view\";\nimport { listCommand } from \"./list\";\nimport { deleteCommand } from \"./delete\";\nimport { copyCommand } from \"./copy\";\nimport { automationCommand } from \"./automation\";\n\nexport const zeroWorkflowCommand = new Command(\"workflow\")\n .description(\"Manage workflows\")\n .addCommand(createCommand)\n .addCommand(editCommand)\n .addCommand(viewCommand)\n .addCommand(listCommand)\n .addCommand(deleteCommand)\n .addCommand(copyCommand)\n .addCommand(automationCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Create under an agent: zero workflow create my-workflow --agent <agent-id> --instruction \"Do things\"\n List workflows: zero workflow list\n View workflow content: zero workflow view <workflow> --agent <agent-id>\n Update workflow content: zero workflow edit <workflow> --agent <agent-id> --instruction \"New steps\"\n Copy onto another agent: zero workflow copy <workflow> --agent <source-agent-id> --to-agent <target-agent-id>\n Manage automations: zero workflow automation --help\n Delete a workflow: zero workflow delete <workflow> --agent <agent-id> -y`,\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { readFileSync } from \"node:fs\";\nimport { createWorkflow } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { readSupplementaryFiles } from \"../../../lib/skill-directory\";\nimport { formatWorkflowAgentName } from \"./format\";\n\nexport const createCommand = new Command()\n .name(\"create\")\n .description(\"Create a workflow under an agent\")\n .argument(\"<name>\", \"Workflow name (lowercase alphanumeric with hyphens)\")\n .option(\n \"--agent <id>\",\n \"Agent ID to host the workflow (defaults to ZERO_AGENT_ID)\",\n )\n .option(\"--instruction <text>\", \"Workflow instruction text\")\n .option(\n \"--instruction-file <path>\",\n \"Path to a file containing the instruction\",\n )\n .option(\n \"--dir <path>\",\n \"Path to a directory of supplementary files (SKILL.md is not allowed)\",\n )\n .option(\"--display-name <name>\", \"Workflow display name\")\n .option(\"--description <text>\", \"Workflow description\")\n .option(\"--public\", \"Create as an org-public workflow\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero workflow create my-workflow --agent <agent-id> --instruction \"Summarize the inbox\"\n zero workflow create my-workflow --instruction-file ./instruction.md\n zero workflow create my-workflow --instruction \"Do things\" --dir ./workflows/my-workflow/files/\n zero workflow create shared-workflow --instruction \"Shared logic\" --public\n\nNotes:\n - A workflow belongs to exactly one agent; provide --agent or set ZERO_AGENT_ID\n - SKILL.md is synthesized from (name, description, instruction); do not include it\n - --dir uploads supplementary files only; any SKILL.md is rejected\n - New workflows are private by default\n - Copy a workflow onto another agent: zero workflow copy <workflow-id> --to-agent <agent-id>`,\n )\n .action(\n withErrorHandler(\n async (\n name: string,\n options: {\n agent?: string;\n instruction?: string;\n instructionFile?: string;\n dir?: string;\n displayName?: string;\n description?: string;\n public?: boolean;\n },\n ) => {\n const agentId = options.agent ?? process.env.ZERO_AGENT_ID;\n if (!agentId) {\n console.error(chalk.red(\"✗ --agent is required\"));\n console.error(\n chalk.dim(\n \" Provide --agent <agent-id> or run inside an agent sandbox (ZERO_AGENT_ID)\",\n ),\n );\n process.exit(1);\n }\n\n if (options.instruction && options.instructionFile) {\n console.error(\n chalk.red(\"✗ Use either --instruction or --instruction-file\"),\n );\n console.error(chalk.dim(\" Provide only one instruction source\"));\n process.exit(1);\n }\n\n const instruction = options.instructionFile\n ? readFileSync(options.instructionFile, \"utf-8\")\n : options.instruction;\n\n const files = options.dir\n ? readSupplementaryFiles(options.dir)\n : undefined;\n\n const workflow = await createWorkflow({\n agentId,\n chatThreadId: process.env.ZERO_CHAT_THREAD_ID || undefined,\n name,\n instruction,\n files,\n displayName: options.displayName,\n description: options.description,\n visibility: options.public ? \"public\" : undefined,\n });\n\n console.log(chalk.green(`✓ Workflow \"${workflow.name}\" created`));\n console.log(` ID: ${workflow.id}`);\n console.log(` Name: ${workflow.name}`);\n console.log(` Agent Name: ${formatWorkflowAgentName(workflow)}`);\n console.log(` Agent ID: ${workflow.agentId}`);\n console.log(` Visibility: ${workflow.visibility}`);\n if (files) {\n console.log(` Files: ${files.length} file(s)`);\n }\n if (workflow.displayName) {\n console.log(` Display Name: ${workflow.displayName}`);\n }\n if (workflow.description) {\n console.log(` Description: ${workflow.description}`);\n }\n console.log();\n console.log(\n `Copy onto another agent: zero workflow copy ${workflow.id} --to-agent <agent-id>`,\n );\n },\n ),\n );\n","import { readFileSync, readdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nconst IGNORED_NAMES = new Set([\"node_modules\", \".git\", \".DS_Store\"]);\n\n/**\n * Recursively read all supplementary files from a directory.\n *\n * Skips hidden files (starting with .), node_modules, and .git.\n * Rejects SKILL.md: it is synthesized server-side from the workflow's\n * (name, description, instruction) and must not be uploaded.\n */\nexport function readSupplementaryFiles(\n dirPath: string,\n): Array<{ path: string; content: string }> {\n const files: Array<{ path: string; content: string }> = [];\n\n function walk(dir: string, prefix: string) {\n const entries = readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n if (entry.name.startsWith(\".\") || IGNORED_NAMES.has(entry.name)) continue;\n\n const relPath = prefix ? `${prefix}/${entry.name}` : entry.name;\n if (entry.isDirectory()) {\n walk(join(dir, entry.name), relPath);\n } else {\n if (relPath === \"SKILL.md\") {\n throw new Error(\n \"SKILL.md is reserved and generated automatically; remove it from the directory\",\n );\n }\n files.push({\n path: relPath,\n content: readFileSync(join(dir, entry.name), \"utf-8\"),\n });\n }\n }\n }\n\n walk(dirPath, \"\");\n\n return files;\n}\n","import type { ZeroWorkflowSummary } from \"@vm0/api-contracts/contracts/zero-workflows\";\n\ntype WorkflowAgentFields = Pick<\n ZeroWorkflowSummary,\n \"agentDisplayName\" | \"agentName\" | \"agentId\"\n>;\n\nexport function formatWorkflowAgentName(workflow: WorkflowAgentFields): string {\n return workflow.agentDisplayName ?? workflow.agentName ?? \"-\";\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { readFileSync } from \"node:fs\";\nimport { updateWorkflow } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { readSupplementaryFiles } from \"../../../lib/skill-directory\";\nimport {\n resolveWorkflowRef,\n type WorkflowRefOptions,\n} from \"./resolve-workflow-ref\";\n\nexport const editCommand = new Command()\n .name(\"edit\")\n .description(\"Update a workflow's instruction, files, or metadata\")\n .argument(\"<workflow>\", \"Workflow ID or name\")\n .option(\"--agent <id>\", \"Agent ID for resolving workflow names\")\n .option(\"--instruction <text>\", \"New instruction text\")\n .option(\n \"--instruction-file <path>\",\n \"Path to a file containing the instruction\",\n )\n .option(\n \"--dir <path>\",\n \"Path to a directory of supplementary files (SKILL.md is not allowed)\",\n )\n .option(\"--display-name <name>\", \"New display name\")\n .option(\"--description <text>\", \"New description\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero workflow edit tell-a-joke --agent <agent-id> --instruction \"New steps\"\n zero workflow edit <workflow-id> --instruction \"New steps\"\n zero workflow edit <workflow-id> --instruction-file ./instruction.md\n zero workflow edit <workflow-id> --dir ./workflows/my-workflow/files/\n zero workflow edit <workflow-id> --display-name \"My Workflow\" --description \"Does things\"\n\nNotes:\n - SKILL.md is synthesized automatically; --dir uploads supplementary files only\n - At least one of --instruction, --instruction-file, --dir, --display-name, or --description is required`,\n )\n .action(\n withErrorHandler(\n async (\n workflowRef: string,\n options: {\n instruction?: string;\n instructionFile?: string;\n dir?: string;\n displayName?: string;\n description?: string;\n } & WorkflowRefOptions,\n ) => {\n if (options.instruction && options.instructionFile) {\n console.error(\n chalk.red(\"✗ Use either --instruction or --instruction-file\"),\n );\n console.error(chalk.dim(\" Provide only one instruction source\"));\n process.exit(1);\n }\n\n const instruction = options.instructionFile\n ? readFileSync(options.instructionFile, \"utf-8\")\n : options.instruction;\n\n const files = options.dir\n ? readSupplementaryFiles(options.dir)\n : undefined;\n\n if (\n instruction === undefined &&\n files === undefined &&\n options.displayName === undefined &&\n options.description === undefined\n ) {\n console.error(chalk.red(\"✗ Nothing to update\"));\n console.error(\n chalk.dim(\n \" Provide --instruction, --instruction-file, --dir, --display-name, or --description\",\n ),\n );\n process.exit(1);\n }\n\n const workflowId = await resolveWorkflowRef(workflowRef, options);\n const workflow = await updateWorkflow(workflowId, {\n instruction,\n files,\n displayName: options.displayName,\n description: options.description,\n });\n\n console.log(chalk.green(`✓ Workflow \"${workflow.name}\" updated`));\n if (instruction !== undefined) {\n console.log(` Instruction: updated`);\n }\n if (files) {\n console.log(` Files: ${files.length} file(s)`);\n }\n if (options.displayName !== undefined) {\n console.log(` Display Name: ${workflow.displayName ?? \"-\"}`);\n }\n if (options.description !== undefined) {\n console.log(` Description: ${workflow.description ?? \"-\"}`);\n }\n },\n ),\n );\n","import { listWorkflows } from \"../../../lib/api\";\n\nconst UUID_RE =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nconst WORKFLOW_NAME_RE = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;\n\nexport interface WorkflowRefOptions {\n readonly agent?: string;\n}\n\nfunction isWorkflowName(ref: string): boolean {\n return ref.length >= 2 && ref.length <= 64 && WORKFLOW_NAME_RE.test(ref);\n}\n\nexport async function resolveWorkflowRef(\n ref: string,\n options: WorkflowRefOptions,\n): Promise<string> {\n if (UUID_RE.test(ref)) {\n return ref;\n }\n\n if (!isWorkflowName(ref)) {\n throw new Error(\n `Invalid workflow ref: \"${ref}\". Use a workflow ID or a slug name like \"tell-a-joke\"`,\n );\n }\n\n const agentId = options.agent ?? process.env.ZERO_AGENT_ID;\n if (!agentId) {\n throw new Error(\n \"Workflow name refs require an agent scope. Pass --agent <agent-id>, set ZERO_AGENT_ID, or use a workflow ID\",\n );\n }\n if (!UUID_RE.test(agentId)) {\n throw new Error(\n `Invalid agent ID: \"${agentId}\". Pass an agent UUID for --agent or use a workflow ID`,\n );\n }\n\n const workflows = await listWorkflows({ agentId });\n const matches = workflows.filter((workflow) => {\n return workflow.name === ref;\n });\n if (matches.length === 0) {\n throw new Error(\n `Workflow not found: \"${ref}\" under agent \"${agentId}\". Check the name and agent, or use the workflow ID`,\n );\n }\n\n const winners = matches.filter((workflow) => {\n return workflow.shadowedBy == null;\n });\n if (winners.length !== 1) {\n throw new Error(\n `Workflow name \"${ref}\" did not resolve to exactly one runtime winner under agent \"${agentId}\". Use the workflow ID`,\n );\n }\n return winners[0]!.id;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getWorkflow } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { formatWorkflowAgentName } from \"./format\";\nimport {\n resolveWorkflowRef,\n type WorkflowRefOptions,\n} from \"./resolve-workflow-ref\";\n\nexport const viewCommand = new Command()\n .name(\"view\")\n .description(\"View a workflow\")\n .argument(\"<workflow>\", \"Workflow ID or name\")\n .option(\"--agent <id>\", \"Agent ID for resolving workflow names\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero workflow view tell-a-joke --agent <agent-id>\n zero workflow view <workflow-id>`,\n )\n .action(\n withErrorHandler(\n async (workflowRef: string, options: WorkflowRefOptions) => {\n const workflowId = await resolveWorkflowRef(workflowRef, options);\n const workflow = await getWorkflow(workflowId);\n\n console.log(chalk.bold(workflow.name));\n if (workflow.displayName) console.log(chalk.dim(workflow.displayName));\n console.log();\n console.log(`ID: ${workflow.id}`);\n console.log(`Name: ${workflow.name}`);\n console.log(`Visibility: ${workflow.visibility}`);\n console.log(`Agent Name: ${formatWorkflowAgentName(workflow)}`);\n console.log(`Agent ID: ${workflow.agentId}`);\n if (workflow.displayName)\n console.log(`Display Name: ${workflow.displayName}`);\n if (workflow.description)\n console.log(`Description: ${workflow.description}`);\n\n if (workflow.files && workflow.files.length > 0) {\n console.log();\n console.log(chalk.dim(\"── Files ──\"));\n for (const f of workflow.files) {\n console.log(` ${f.path} (${f.size} bytes)`);\n }\n }\n\n console.log();\n if (workflow.instruction) {\n console.log(chalk.dim(\"── Instruction ──\"));\n console.log(workflow.instruction);\n } else {\n console.log(chalk.dim(\"No instruction\"));\n }\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listWorkflows } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { formatWorkflowAgentName } from \"./format\";\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List visible workflows, optionally scoped to one agent\")\n .option(\"--agent <id>\", \"Only list workflows hosted by this agent\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero workflow list\n zero workflow list --agent <agent-id>`,\n )\n .action(\n withErrorHandler(async (options: { agent?: string }) => {\n const workflows = await listWorkflows({ agentId: options.agent });\n\n if (workflows.length === 0) {\n console.log(chalk.dim(\"No workflows found\"));\n console.log(\n chalk.dim(\n \" Create one with: zero workflow create <name> --agent <agent-id> --instruction <text>\",\n ),\n );\n return;\n }\n\n const idWidth = Math.max(\n 2,\n ...workflows.map((s) => {\n return s.id.length;\n }),\n );\n const nameWidth = Math.max(\n 4,\n ...workflows.map((s) => {\n return s.name.length;\n }),\n );\n const agentWidth = Math.max(\n 10,\n ...workflows.map((s) => {\n return formatWorkflowAgentName(s).length;\n }),\n );\n const agentIdWidth = Math.max(\n 8,\n ...workflows.map((s) => {\n return s.agentId.length;\n }),\n );\n\n const header = [\n \"ID\".padEnd(idWidth),\n \"NAME\".padEnd(nameWidth),\n \"VISIBILITY\".padEnd(10),\n \"AGENT NAME\".padEnd(agentWidth),\n \"AGENT ID\".padEnd(agentIdWidth),\n \"DESCRIPTION\",\n ].join(\" \");\n console.log(chalk.dim(header));\n\n for (const workflow of workflows) {\n const row = [\n workflow.id.padEnd(idWidth),\n workflow.name.padEnd(nameWidth),\n workflow.visibility.padEnd(10),\n formatWorkflowAgentName(workflow).padEnd(agentWidth),\n workflow.agentId.padEnd(agentIdWidth),\n workflow.description ?? \"-\",\n ].join(\" \");\n console.log(row);\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { deleteWorkflow, getWorkflow } from \"../../../lib/api\";\nimport { isInteractive, promptConfirm } from \"../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport {\n resolveWorkflowRef,\n type WorkflowRefOptions,\n} from \"./resolve-workflow-ref\";\n\nexport const deleteCommand = new Command()\n .name(\"delete\")\n .alias(\"rm\")\n .description(\"Delete a workflow\")\n .argument(\"<workflow>\", \"Workflow ID or name\")\n .option(\"--agent <id>\", \"Agent ID for resolving workflow names\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero workflow delete tell-a-joke --agent <agent-id> -y\n zero workflow delete <workflow-id>\n zero workflow delete <workflow-id> -y\n\nNotes:\n - Use -y to skip confirmation in non-interactive mode`,\n )\n .action(\n withErrorHandler(\n async (\n workflowRef: string,\n options: { yes?: boolean } & WorkflowRefOptions,\n ) => {\n const workflowId = await resolveWorkflowRef(workflowRef, options);\n const workflow = await getWorkflow(workflowId);\n\n if (!options.yes) {\n if (!isInteractive()) {\n throw new Error(\"--yes flag is required in non-interactive mode\");\n }\n const confirmed = await promptConfirm(\n `Delete workflow '${workflow.name}'?`,\n false,\n );\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteWorkflow(workflowId);\n console.log(chalk.green(`✓ Workflow \"${workflow.name}\" deleted`));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { copyWorkflow, listWorkflowAutomations } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { printWorkflowAutomationsTable } from \"./automation/display\";\nimport { formatWorkflowAgentName } from \"./format\";\nimport {\n resolveWorkflowRef,\n type WorkflowRefOptions,\n} from \"./resolve-workflow-ref\";\n\nexport const copyCommand = new Command()\n .name(\"copy\")\n .description(\"Copy (fork) a workflow onto another agent\")\n .argument(\"<workflow>\", \"Workflow ID or name to copy\")\n .option(\"--agent <id>\", \"Agent ID for resolving workflow names\")\n .requiredOption(\"--to-agent <agent-id>\", \"Target agent ID\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero workflow copy tell-a-joke --agent <source-agent-id> --to-agent <target-agent-id>\n zero workflow copy <workflow-id> --to-agent <target-agent-id>`,\n )\n .action(\n withErrorHandler(\n async (\n workflowRef: string,\n options: { toAgent: string } & WorkflowRefOptions,\n ) => {\n const workflowId = await resolveWorkflowRef(workflowRef, options);\n const workflow = await copyWorkflow(workflowId, options.toAgent);\n\n console.log(chalk.green(`✓ Workflow \"${workflow.name}\" copied`));\n console.log();\n console.log(` ID: ${workflow.id}`);\n console.log(` Name: ${workflow.name}`);\n console.log(` Visibility: ${workflow.visibility}`);\n console.log(` Agent Name: ${formatWorkflowAgentName(workflow)}`);\n console.log(` Agent ID: ${workflow.agentId}`);\n if (workflow.displayName)\n console.log(` Display Name: ${workflow.displayName}`);\n if (workflow.description)\n console.log(` Description: ${workflow.description}`);\n\n const automations = await listWorkflowAutomations(workflow.id);\n\n console.log();\n console.log(\n chalk.dim(`── Copied automations (${automations.length}) ──`),\n );\n if (automations.length === 0) {\n console.log(chalk.dim(\"No automations copied\"));\n } else {\n printWorkflowAutomationsTable(automations);\n }\n console.log();\n console.log(`View it: zero workflow view ${workflow.id}`);\n },\n ),\n );\n","import chalk from \"chalk\";\nimport type { GmailNewMessageEventConfig } from \"@vm0/api-contracts/contracts/zero-workflows\";\nimport type { ZeroWorkflowAutomationSummary } from \"../../../../lib/api\";\nimport { formatRelativeTime } from \"../../../../lib/domain/relative-time\";\nimport { formatDurationSeconds } from \"../../shared/duration\";\n\ntype GmailMatchRules = NonNullable<GmailNewMessageEventConfig[\"match\"]>;\ntype GmailTextMatcher = NonNullable<GmailMatchRules[\"from\"]>;\ntype GmailTextField = \"from\" | \"subject\" | \"body\" | \"to\" | \"cc\";\n\nconst GMAIL_TEXT_FIELDS: readonly GmailTextField[] = [\n \"from\",\n \"subject\",\n \"body\",\n \"to\",\n \"cc\",\n];\n\ntype WorkflowWebhookAutomationSummary = Extract<\n ZeroWorkflowAutomationSummary,\n { readonly kind: \"event\"; readonly eventType: \"webhook-received\" }\n>;\ntype WorkflowNotionChildPageAutomationSummary = Extract<\n ZeroWorkflowAutomationSummary,\n { readonly kind: \"event\"; readonly eventType: \"notion-child-page-created\" }\n>;\ntype WorkflowNotionDatabaseItemAutomationSummary = Extract<\n ZeroWorkflowAutomationSummary,\n {\n readonly kind: \"event\";\n readonly eventType: \"notion-database-item-created\";\n }\n>;\ntype WorkflowNotionPageContentUpdatedAutomationSummary = Extract<\n ZeroWorkflowAutomationSummary,\n {\n readonly kind: \"event\";\n readonly eventType: \"notion-page-content-updated\";\n }\n>;\n\nfunction isWebhookAutomation(\n automation: ZeroWorkflowAutomationSummary,\n): automation is WorkflowWebhookAutomationSummary {\n return (\n automation.kind === \"event\" && automation.eventType === \"webhook-received\"\n );\n}\n\nfunction isNotionChildPageAutomation(\n automation: ZeroWorkflowAutomationSummary,\n): automation is WorkflowNotionChildPageAutomationSummary {\n return (\n automation.kind === \"event\" &&\n automation.eventType === \"notion-child-page-created\"\n );\n}\n\nfunction isNotionDatabaseItemAutomation(\n automation: ZeroWorkflowAutomationSummary,\n): automation is WorkflowNotionDatabaseItemAutomationSummary {\n return (\n automation.kind === \"event\" &&\n automation.eventType === \"notion-database-item-created\"\n );\n}\n\nfunction isNotionPageContentUpdatedAutomation(\n automation: ZeroWorkflowAutomationSummary,\n): automation is WorkflowNotionPageContentUpdatedAutomationSummary {\n return (\n automation.kind === \"event\" &&\n automation.eventType === \"notion-page-content-updated\"\n );\n}\n\nfunction isGoogleCalendarAutomation(\n automation: ZeroWorkflowAutomationSummary,\n): automation is Extract<\n ZeroWorkflowAutomationSummary,\n {\n readonly kind: \"event\";\n readonly eventType:\n | \"google-calendar-event-created\"\n | \"google-calendar-event-updated\"\n | \"google-calendar-event-cancelled\";\n }\n> {\n return (\n automation.kind === \"event\" &&\n (automation.eventType === \"google-calendar-event-created\" ||\n automation.eventType === \"google-calendar-event-updated\" ||\n automation.eventType === \"google-calendar-event-cancelled\")\n );\n}\n\nfunction quote(value: string): string {\n return `\"${value}\"`;\n}\n\nfunction quoteList(values: readonly string[]): string {\n return values.map(quote).join(\", \");\n}\n\nfunction textMatcherParts(\n field: GmailTextField,\n matcher: GmailTextMatcher,\n): string[] {\n const parts: string[] = [];\n if (matcher.contains) {\n parts.push(`${field} contains ${quote(matcher.contains)}`);\n }\n if (matcher.containsAny) {\n parts.push(`${field} contains any of ${quoteList(matcher.containsAny)}`);\n }\n if (matcher.doesNotContain) {\n parts.push(`${field} does not contain ${quote(matcher.doesNotContain)}`);\n }\n if (matcher.doesNotContainAny) {\n parts.push(\n `${field} does not contain any of ${quoteList(matcher.doesNotContainAny)}`,\n );\n }\n return parts;\n}\n\nfunction formatGmailMatchSummary(config: GmailNewMessageEventConfig): string {\n const match = config.match;\n if (!match) {\n return \"all inbound messages\";\n }\n\n const parts: string[] = [];\n for (const field of GMAIL_TEXT_FIELDS) {\n const matcher = match[field];\n if (matcher) {\n parts.push(...textMatcherParts(field, matcher));\n }\n }\n return parts.length > 0 ? parts.join(\"; \") : \"all inbound messages\";\n}\n\nfunction formatGithubSubject(subject: string): string {\n if (subject === \"pull_requests\") {\n return \"pull requests\";\n }\n return subject;\n}\n\nfunction formatWebhookAutomationEntry(\n automation: WorkflowWebhookAutomationSummary,\n): string {\n return `Webhook: ${automation.webhookUrl ?? \"hidden\"}`;\n}\n\nfunction formatNotionParentPage(\n automation: WorkflowNotionChildPageAutomationSummary,\n): string {\n return (\n automation.eventConfig.parentPage.title ??\n automation.eventConfig.parentPage.url\n );\n}\n\nfunction formatNotionDatabase(\n automation: WorkflowNotionDatabaseItemAutomationSummary,\n): string {\n return (\n automation.eventConfig.dataSource.title ??\n automation.eventConfig.dataSource.url\n );\n}\n\nfunction formatNotionContentUpdatedScope(\n automation: WorkflowNotionPageContentUpdatedAutomationSummary,\n): string {\n return automation.eventConfig.scope.type === \"page\"\n ? (automation.eventConfig.scope.page.title ??\n automation.eventConfig.scope.page.url)\n : (automation.eventConfig.scope.dataSource.title ??\n automation.eventConfig.scope.dataSource.url);\n}\n\nfunction formatNotionContentUpdatedScopeUrl(\n automation: WorkflowNotionPageContentUpdatedAutomationSummary,\n): string {\n return automation.eventConfig.scope.type === \"page\"\n ? automation.eventConfig.scope.page.url\n : automation.eventConfig.scope.dataSource.url;\n}\n\nfunction formatWorkflowAutomationEntry(\n automation: ZeroWorkflowAutomationSummary,\n): string {\n if (\n automation.kind === \"event\" &&\n automation.eventType === \"gmail-new-message\"\n ) {\n return `Gmail new message: ${formatGmailMatchSummary(automation.eventConfig)}`;\n }\n if (\n automation.kind === \"event\" &&\n automation.eventType === \"gmail-label-applied\"\n ) {\n return `Gmail label applied: ${quote(automation.eventConfig.labelName)}`;\n }\n if (\n automation.kind === \"event\" &&\n automation.eventType === \"github-label-applied\"\n ) {\n return `GitHub label applied: ${quote(automation.eventConfig.labelName)} (${formatGithubSubject(\n automation.eventConfig.filters.subject,\n )}, actor ${automation.eventConfig.filters.actor.type})`;\n }\n if (\n automation.kind === \"event\" &&\n automation.eventType === \"google-calendar-event-created\"\n ) {\n return `Google Calendar event created: ${automation.eventConfig.calendarId}`;\n }\n if (\n automation.kind === \"event\" &&\n automation.eventType === \"google-calendar-event-updated\"\n ) {\n return `Google Calendar event updated: ${automation.eventConfig.calendarId}`;\n }\n if (\n automation.kind === \"event\" &&\n automation.eventType === \"google-calendar-event-cancelled\"\n ) {\n return `Google Calendar event cancelled: ${automation.eventConfig.calendarId}`;\n }\n if (\n automation.kind === \"event\" &&\n automation.eventType === \"google-meet-transcript-generated\"\n ) {\n return \"Google Meet transcript ready: meetings you organize\";\n }\n if (isWebhookAutomation(automation)) {\n return formatWebhookAutomationEntry(automation);\n }\n\n if (automation.kind !== \"schedule\") {\n return workflowAutomationKindLabel(automation);\n }\n\n const { schedule } = automation;\n switch (schedule.type) {\n case \"cron\":\n return `${schedule.cronExpression} (${schedule.timezone})`;\n case \"once\":\n return `at ${schedule.atTime} (${schedule.timezone})`;\n case \"loop\":\n return `every ${formatDurationSeconds(schedule.intervalSeconds)}`;\n }\n}\n\nfunction formatRunTime(value: string | null): string {\n return value ? formatRelativeTime(value) : chalk.dim(\"-\");\n}\n\nfunction workflowAutomationKindLabel(\n automation: ZeroWorkflowAutomationSummary,\n): string {\n if (automation.kind !== \"event\") {\n return formatWorkflowAutomationEntry(automation);\n }\n switch (automation.eventType) {\n case \"gmail-new-message\":\n return \"Gmail new message\";\n case \"gmail-label-applied\":\n return \"Gmail label applied\";\n case \"github-label-applied\":\n return \"GitHub label applied\";\n case \"github-workflow-run-completed\":\n return \"GitHub workflow completed\";\n case \"google-calendar-event-created\":\n return \"Google Calendar event created\";\n case \"google-calendar-event-updated\":\n return \"Google Calendar event updated\";\n case \"google-calendar-event-cancelled\":\n return \"Google Calendar event cancelled\";\n case \"google-meet-transcript-generated\":\n return \"Google Meet transcript ready\";\n case \"notion-child-page-created\":\n return `New Notion child page: ${formatNotionParentPage(automation)}`;\n case \"notion-database-item-created\":\n return `New Notion database item: ${formatNotionDatabase(automation)}`;\n case \"notion-page-content-updated\":\n return `Notion page content updated: ${formatNotionContentUpdatedScope(automation)}`;\n case \"webhook-received\":\n return \"Webhook\";\n }\n}\n\nfunction signedCurlExample(\n automation: WorkflowWebhookAutomationSummary,\n): string {\n const secret = automation.webhookSecret ?? \"<signing-secret>\";\n const webhookUrl = automation.webhookUrl ?? \"<webhook-url>\";\n return [\n `BODY='{\"hello\":\"world\"}'`,\n \"TIMESTAMP=$(date +%s)\",\n `SIGNATURE=$(printf \"%s.%s\" \"$TIMESTAMP\" \"$BODY\" | openssl dgst -sha256 -hmac \"${secret}\" -hex | awk '{print $2}')`,\n `curl -X POST \"${webhookUrl}\" \\\\`,\n ' -H \"Content-Type: application/json\" \\\\',\n ' -H \"X-VM0-Timestamp: $TIMESTAMP\" \\\\',\n ' -H \"X-VM0-Signature: $SIGNATURE\" \\\\',\n ' --data \"$BODY\"',\n ].join(\"\\n\");\n}\n\nexport function printWorkflowAutomationsTable(\n automations: readonly ZeroWorkflowAutomationSummary[],\n): void {\n const idWidth = Math.max(\n 2,\n ...automations.map((automation) => {\n return automation.id.length;\n }),\n );\n const scheduleWidth = Math.max(\n 7,\n ...automations.map((automation) => {\n return formatWorkflowAutomationEntry(automation).length;\n }),\n );\n\n console.log(\n chalk.dim(\n [\n \"ID\".padEnd(idWidth),\n \"STATUS\".padEnd(8),\n \"AUTOMATION\".padEnd(scheduleWidth),\n \"NEXT RUN\",\n ].join(\" \"),\n ),\n );\n\n for (const automation of automations) {\n const status = automation.enabled\n ? chalk.green(\"enabled\")\n : chalk.yellow(\"disabled\");\n console.log(\n [\n automation.id.padEnd(idWidth),\n status.padEnd(8 + (automation.enabled ? 0 : 2)),\n formatWorkflowAutomationEntry(automation).padEnd(scheduleWidth),\n formatRunTime(automation.nextRunAt),\n ].join(\" \"),\n );\n }\n}\n\nfunction printGithubWorkflowRunFilters(\n automation: ZeroWorkflowAutomationSummary,\n): void {\n if (\n automation.kind !== \"event\" ||\n automation.eventType !== \"github-workflow-run-completed\"\n ) {\n return;\n }\n const printFilter = (\n label: string,\n values: readonly string[] | undefined,\n ) => {\n console.log(`${`${label}:`.padEnd(14)}${values?.join(\", \") ?? \"any\"}`);\n };\n const { filters } = automation.eventConfig;\n printFilter(\"Repositories\", filters.repositories);\n printFilter(\"Workflows\", filters.workflows);\n printFilter(\"Conclusions\", filters.conclusions);\n printFilter(\"Branches\", filters.branches);\n printFilter(\"Events\", filters.events);\n printFilter(\"Actors\", filters.actors);\n}\n\nexport function printWorkflowAutomationDetails(\n automation: ZeroWorkflowAutomationSummary,\n options?: { readonly workflowRef?: string },\n): void {\n const status = automation.enabled\n ? chalk.green(\"enabled\")\n : chalk.yellow(\"disabled\");\n\n console.log(`${\"Kind:\".padEnd(14)}${automation.kind}`);\n console.log(`${\"ID:\".padEnd(14)}${automation.id}`);\n if (options?.workflowRef) {\n console.log(`${\"Workflow:\".padEnd(14)}${options.workflowRef}`);\n }\n console.log(`${\"Status:\".padEnd(14)}${status}`);\n console.log(\n `${\"Automation:\".padEnd(14)}${workflowAutomationKindLabel(automation)}`,\n );\n if (\n automation.kind === \"event\" &&\n automation.eventType === \"gmail-new-message\"\n ) {\n console.log(\n `${\"Match:\".padEnd(14)}${formatGmailMatchSummary(automation.eventConfig)}`,\n );\n }\n if (\n automation.kind === \"event\" &&\n automation.eventType === \"gmail-label-applied\"\n ) {\n console.log(`${\"Label:\".padEnd(14)}${automation.eventConfig.labelName}`);\n }\n if (\n automation.kind === \"event\" &&\n automation.eventType === \"github-label-applied\"\n ) {\n console.log(`${\"Label:\".padEnd(14)}${automation.eventConfig.labelName}`);\n console.log(\n `${\"Subject:\".padEnd(14)}${formatGithubSubject(\n automation.eventConfig.filters.subject,\n )}`,\n );\n console.log(\n `${\"Actor:\".padEnd(14)}${automation.eventConfig.filters.actor.type}`,\n );\n }\n printGithubWorkflowRunFilters(automation);\n if (isGoogleCalendarAutomation(automation)) {\n console.log(\n `${\"Calendar:\".padEnd(14)}${automation.eventConfig.calendarId}`,\n );\n }\n if (isNotionChildPageAutomation(automation)) {\n console.log(\n `${\"Parent page:\".padEnd(14)}${formatNotionParentPage(automation)}`,\n );\n console.log(\n `${\"Parent URL:\".padEnd(14)}${automation.eventConfig.parentPage.url}`,\n );\n }\n if (isNotionDatabaseItemAutomation(automation)) {\n console.log(`${\"Database:\".padEnd(14)}${formatNotionDatabase(automation)}`);\n console.log(\n `${\"Database URL:\".padEnd(14)}${automation.eventConfig.dataSource.url}`,\n );\n }\n if (isNotionPageContentUpdatedAutomation(automation)) {\n const scopeLabel =\n automation.eventConfig.scope.type === \"page\" ? \"Page\" : \"Database\";\n console.log(`${\"Scope:\".padEnd(14)}${scopeLabel}`);\n console.log(\n `${`${scopeLabel}:`.padEnd(14)}${formatNotionContentUpdatedScope(automation)}`,\n );\n console.log(\n `${`${scopeLabel} URL:`.padEnd(14)}${formatNotionContentUpdatedScopeUrl(automation)}`,\n );\n }\n if (isWebhookAutomation(automation)) {\n console.log(\n `${\"Webhook URL:\".padEnd(14)}${automation.webhookUrl ?? \"hidden\"}`,\n );\n console.log(\n `${\"Secret:\".padEnd(14)}${chalk.dim(`ends with ${automation.secretLastFour}`)}`,\n );\n console.log(\n `${\"Last received:\".padEnd(14)}${formatRunTime(automation.lastReceivedAt)}`,\n );\n if (automation.webhookSecret) {\n console.log(\n `${\"Signing key:\".padEnd(14)}${automation.webhookSecret} ${chalk.dim(\n \"(shown only once)\",\n )}`,\n );\n console.log(\"\");\n console.log(chalk.bold(\"Signed curl example:\"));\n console.log(signedCurlExample(automation));\n }\n }\n console.log(`${\"Owner:\".padEnd(14)}${automation.ownerUserId}`);\n console.log(\n `${\"Chat thread:\".padEnd(14)}${automation.chatThreadId ?? chalk.dim(\"-\")}`,\n );\n console.log(\n `${\"Next run:\".padEnd(14)}${formatRunTime(automation.nextRunAt)}`,\n );\n console.log(\n `${\"Last run:\".padEnd(14)}${formatRunTime(automation.lastRunAt)}`,\n );\n}\n","/**\n * Format a date string as relative time (e.g., \"in 2h\", \"3d ago\")\n */\nexport function formatRelativeTime(dateStr: string | null): string {\n if (!dateStr) return \"-\";\n\n const date = new Date(dateStr);\n const now = new Date();\n const diffMs = date.getTime() - now.getTime();\n const diffAbs = Math.abs(diffMs);\n\n const minutes = Math.floor(diffAbs / (1000 * 60));\n const hours = Math.floor(diffAbs / (1000 * 60 * 60));\n const days = Math.floor(diffAbs / (1000 * 60 * 60 * 24));\n\n const isPast = diffMs < 0;\n\n if (days > 0) {\n return isPast ? `${days}d ago` : `in ${days}d`;\n } else if (hours > 0) {\n return isPast ? `${hours}h ago` : `in ${hours}h`;\n } else if (minutes > 0) {\n return isPast ? `${minutes}m ago` : `in ${minutes}m`;\n } else {\n return isPast ? \"just now\" : \"soon\";\n }\n}\n","/**\n * Human-friendly duration handling for loop automations (`--every` / `--loop`).\n */\n\nconst DURATION_PATTERN = /^(\\d+)([smhd])$/;\n\nconst UNIT_SECONDS: Record<string, number> = {\n s: 1,\n m: 60,\n h: 60 * 60,\n d: 24 * 60 * 60,\n};\n\n/**\n * Parse a human duration like \"90s\", \"15m\", \"1h\", \"2d\" into seconds.\n * @throws Error when the input is not a positive integer + unit\n */\nexport function parseDurationSeconds(input: string): number {\n const match = input.match(DURATION_PATTERN);\n if (!match) {\n throw new Error(\n `Invalid duration: \"${input}\". Use <number><unit> with unit s, m, h, or d (e.g. 90s, 15m, 1h)`,\n );\n }\n\n const value = parseInt(match[1]!, 10);\n if (value <= 0) {\n throw new Error(`Invalid duration: \"${input}\". Must be greater than zero`);\n }\n\n return value * UNIT_SECONDS[match[2]!]!;\n}\n\n/**\n * Format seconds back into the largest exact unit (900 → \"15m\", 90 → \"90s\")\n */\nexport function formatDurationSeconds(seconds: number): string {\n for (const [unit, size] of [\n [\"d\", UNIT_SECONDS.d!],\n [\"h\", UNIT_SECONDS.h!],\n [\"m\", UNIT_SECONDS.m!],\n ] as const) {\n if (seconds % size === 0 && seconds >= size) {\n return `${seconds / size}${unit}`;\n }\n }\n return `${seconds}s`;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type {\n GithubLabelAppliedSubjectFilter,\n GithubWorkflowRunConclusion,\n ZeroWorkflowSchedule,\n} from \"@vm0/api-contracts/contracts/zero-workflows\";\nimport {\n type ZeroWorkflowAutomationCreateRequest,\n type ZeroWorkflowAutomationSummary,\n type ZeroWorkflowAutomationUpdateRequest,\n createWorkflowAutomation,\n deleteWorkflowAutomation,\n disableWorkflowAutomation,\n enableWorkflowAutomation,\n getWorkflowAutomation,\n listWorkflowAutomations,\n updateWorkflowAutomation,\n} from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\nimport { parseDurationSeconds } from \"../../shared/duration\";\nimport {\n resolveWorkflowRef,\n type WorkflowRefOptions,\n} from \"../resolve-workflow-ref\";\nimport {\n printWorkflowAutomationDetails,\n printWorkflowAutomationsTable,\n} from \"./display\";\nimport {\n buildGmailLabelAppliedEventConfig,\n buildGmailNewMessageEventConfig,\n hasGmailLabelOption,\n hasGmailAutomationOptions,\n type GmailAutomationOptions,\n} from \"./gmail-config\";\n\ninterface AddOptions extends GmailAutomationOptions {\n readonly expr?: string;\n readonly at?: string;\n readonly every?: string;\n readonly timezone?: string;\n readonly agent?: string;\n readonly subject?: string;\n readonly actor?: string;\n readonly repository?: string;\n readonly workflow?: string;\n readonly conclusion?: string;\n readonly branch?: string;\n readonly triggeringEvent?: string;\n readonly calendarId?: string;\n readonly pageUrl?: string;\n readonly parentPageUrl?: string;\n readonly databaseUrl?: string;\n}\n\ninterface UpdateOptions extends GmailAutomationOptions {\n readonly expr?: string;\n readonly at?: string;\n readonly every?: string;\n readonly timezone?: string;\n readonly subject?: string;\n readonly actor?: string;\n readonly repository?: string;\n readonly workflow?: string;\n readonly conclusion?: string;\n readonly branch?: string;\n readonly triggeringEvent?: string;\n}\n\nconst SCHEDULE_KINDS = [\"cron\", \"once\", \"loop\"] as const;\nconst EVENT_KINDS = [\n \"gmail-new-message\",\n \"gmail-label-applied\",\n \"github-label-applied\",\n \"github-workflow-run-completed\",\n \"google-calendar-event-created\",\n \"google-calendar-event-updated\",\n \"google-calendar-event-cancelled\",\n \"notion-child-page-created\",\n \"notion-database-item-created\",\n \"notion-page-content-updated\",\n \"webhook\",\n] as const;\nconst AUTOMATION_KINDS = [...SCHEDULE_KINDS, ...EVENT_KINDS] as const;\nconst EXACTLY_ONE_FLAG_MESSAGE =\n \"Provide exactly one of --expr (cron), --at (once), --every (loop), Gmail match options, --label, --subject, --actor, --calendar-id, --page-url, --parent-page-url, or --database-url\";\n\nfunction addGmailAutomationOptions(command: Command): Command {\n return command\n .option(\n \"--config <path>\",\n \"Path to a Gmail new message automation config JSON\",\n )\n .option(\"--label <name>\", \"Label name for label-applied automations\")\n .option(\"--from-contains <text>\", \"Require the From header to contain text\")\n .option(\n \"--from-not-contains <text>\",\n \"Require the From header not to contain text\",\n )\n .option(\n \"--subject-contains <text>\",\n \"Require the Subject header to contain text\",\n )\n .option(\n \"--subject-not-contains <text>\",\n \"Require the Subject header not to contain text\",\n )\n .option(\n \"--body-contains <text>\",\n \"Require the message body to contain text\",\n )\n .option(\n \"--body-not-contains <text>\",\n \"Require the message body not to contain text\",\n )\n .option(\"--to-contains <text>\", \"Require the To header to contain text\")\n .option(\n \"--to-not-contains <text>\",\n \"Require the To header not to contain text\",\n )\n .option(\"--cc-contains <text>\", \"Require the Cc header to contain text\")\n .option(\n \"--cc-not-contains <text>\",\n \"Require the Cc header not to contain text\",\n );\n}\n\nfunction addGithubAutomationOptions(command: Command): Command {\n return command\n .option(\n \"--subject <subject>\",\n \"GitHub subject filter for github-label-applied: both | issues | pull-requests\",\n )\n .option(\n \"--actor <actor>\",\n \"GitHub actor filter: me | anyone for labels, or comma-separated logins for workflow runs\",\n )\n .option(\n \"--repository <repositories>\",\n \"GitHub workflow run repositories, comma-separated owner/name values\",\n )\n .option(\n \"--workflow <workflows>\",\n \"GitHub workflows, comma-separated IDs, names, or paths\",\n )\n .option(\n \"--conclusion <conclusions>\",\n \"Workflow run conclusions, comma-separated values\",\n )\n .option(\"--branch <branches>\", \"Workflow run branches, comma-separated\")\n .option(\n \"--triggering-event <events>\",\n \"Workflow run triggering events, comma-separated\",\n );\n}\n\nfunction timezoneOrUtc(timezone: string | undefined): string {\n return timezone ?? \"UTC\";\n}\n\nfunction assertValidTimezone(timezone: string): void {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: timezone });\n}\n\nfunction hasExplicitOffset(value: string): boolean {\n return /(?:Z|[+-]\\d{2}:?\\d{2})$/i.test(value);\n}\n\nfunction parseLocalDateTime(value: string): {\n readonly year: number;\n readonly month: number;\n readonly day: number;\n readonly hour: number;\n readonly minute: number;\n readonly second: number;\n readonly millisecond: number;\n} {\n const match = value.match(\n /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d{1,3}))?)?$/,\n );\n if (!match) {\n throw new Error(\n `Invalid at time: \"${value}\". Use ISO datetime, e.g. 2026-06-10T09:00 or 2026-06-10T09:00:00Z`,\n );\n }\n return {\n year: Number(match[1]),\n month: Number(match[2]),\n day: Number(match[3]),\n hour: Number(match[4]),\n minute: Number(match[5]),\n second: match[6] ? Number(match[6]) : 0,\n millisecond: match[7] ? Number(match[7].padEnd(3, \"0\")) : 0,\n };\n}\n\nfunction zonedParts(instant: Date, timezone: string) {\n const parts = new Intl.DateTimeFormat(\"en-US\", {\n timeZone: timezone,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hourCycle: \"h23\",\n }).formatToParts(instant);\n const values = new Map<string, string>();\n for (const part of parts) {\n if (part.type !== \"literal\") {\n values.set(part.type, part.value);\n }\n }\n return {\n year: Number(values.get(\"year\")),\n month: Number(values.get(\"month\")),\n day: Number(values.get(\"day\")),\n hour: Number(values.get(\"hour\")),\n minute: Number(values.get(\"minute\")),\n second: Number(values.get(\"second\")),\n };\n}\n\nfunction wallTimeToUtcIso(value: string, timezone: string): string {\n assertValidTimezone(timezone);\n if (hasExplicitOffset(value)) {\n const instant = new Date(value);\n if (Number.isNaN(instant.getTime())) {\n throw new Error(`Invalid at time: \"${value}\"`);\n }\n return instant.toISOString();\n }\n\n const target = parseLocalDateTime(value);\n const targetUtc = Date.UTC(\n target.year,\n target.month - 1,\n target.day,\n target.hour,\n target.minute,\n target.second,\n target.millisecond,\n );\n let guess = targetUtc;\n for (let i = 0; i < 3; i++) {\n const parts = zonedParts(new Date(guess), timezone);\n const renderedUtc = Date.UTC(\n parts.year,\n parts.month - 1,\n parts.day,\n parts.hour,\n parts.minute,\n parts.second,\n target.millisecond,\n );\n guess += targetUtc - renderedUtc;\n }\n\n const result = new Date(guess);\n const rendered = zonedParts(result, timezone);\n if (\n rendered.year !== target.year ||\n rendered.month !== target.month ||\n rendered.day !== target.day ||\n rendered.hour !== target.hour ||\n rendered.minute !== target.minute ||\n rendered.second !== target.second\n ) {\n throw new Error(\n `Invalid at time for ${timezone}: \"${value}\". The local time does not exist`,\n );\n }\n return result.toISOString();\n}\n\nfunction buildSchedule(\n kind: string,\n options: UpdateOptions,\n): ZeroWorkflowSchedule {\n switch (kind) {\n case \"cron\":\n if (!options.expr) {\n throw new Error(\n 'cron automations require --expr (e.g. --expr \"0 9 * * *\")',\n );\n }\n return {\n type: \"cron\",\n cronExpression: options.expr,\n timezone: timezoneOrUtc(options.timezone),\n };\n case \"once\": {\n if (!options.at) {\n throw new Error(\n 'once automations require --at (e.g. --at \"2026-06-10T09:00\")',\n );\n }\n const timezone = timezoneOrUtc(options.timezone);\n return {\n type: \"once\",\n atTime: wallTimeToUtcIso(options.at, timezone),\n timezone,\n };\n }\n case \"loop\":\n if (!options.every) {\n throw new Error(\"loop automations require --every (e.g. --every 15m)\");\n }\n return {\n type: \"loop\",\n intervalSeconds: parseDurationSeconds(options.every),\n };\n default:\n throw new Error(\n `Unknown automation kind: \"${kind}\". Use one of: ${AUTOMATION_KINDS.join(\", \")}`,\n );\n }\n}\n\nfunction hasScheduleAddOptions(options: AddOptions): boolean {\n return (\n options.expr !== undefined ||\n options.at !== undefined ||\n options.every !== undefined ||\n options.timezone !== undefined\n );\n}\n\nfunction hasGithubLabelAutomationOptions(\n options: AddOptions | UpdateOptions,\n): boolean {\n return options.subject !== undefined || options.actor !== undefined;\n}\n\nfunction hasGithubWorkflowRunSpecificOptions(\n options: AddOptions | UpdateOptions,\n): boolean {\n return (\n options.repository !== undefined ||\n options.workflow !== undefined ||\n options.conclusion !== undefined ||\n options.branch !== undefined ||\n options.triggeringEvent !== undefined\n );\n}\n\nfunction hasGithubAutomationOptions(\n options: AddOptions | UpdateOptions,\n): boolean {\n return (\n hasGithubLabelAutomationOptions(options) ||\n hasGithubWorkflowRunSpecificOptions(options)\n );\n}\n\nfunction hasCalendarAutomationOptions(options: AddOptions): boolean {\n return options.calendarId !== undefined;\n}\n\nfunction hasNotionAutomationOptions(options: AddOptions): boolean {\n return (\n options.pageUrl !== undefined ||\n options.parentPageUrl !== undefined ||\n options.databaseUrl !== undefined\n );\n}\n\nfunction hasEventAddOptions(options: AddOptions): boolean {\n return (\n hasGmailAutomationOptions(options) ||\n hasGmailLabelOption(options) ||\n hasGithubAutomationOptions(options) ||\n hasCalendarAutomationOptions(options) ||\n hasNotionAutomationOptions(options)\n );\n}\n\nfunction assertNoScheduleAddOptions(options: AddOptions): void {\n if (hasScheduleAddOptions(options)) {\n throw new Error(\n \"--expr, --at, --every, and --timezone only apply to schedule automations\",\n );\n }\n}\n\nfunction assertNoGithubAutomationOptions(\n options: AddOptions,\n message = \"GitHub automation flags only apply to GitHub event automations\",\n): void {\n if (hasGithubAutomationOptions(options)) {\n throw new Error(message);\n }\n}\n\nfunction assertNoCalendarAutomationOptions(options: AddOptions): void {\n if (hasCalendarAutomationOptions(options)) {\n throw new Error(\n \"Google Calendar automation flags only apply to Google Calendar event automations\",\n );\n }\n}\n\nfunction assertNoNotionAutomationOptions(options: AddOptions): void {\n if (hasNotionAutomationOptions(options)) {\n throw new Error(\n \"Notion automation flags only apply to Notion event automations\",\n );\n }\n}\n\nfunction scheduleUpdateFlagCount(options: UpdateOptions): number {\n return [options.expr, options.at, options.every].filter((value) => {\n return value !== undefined;\n }).length;\n}\n\nfunction hasScheduleUpdateOptions(options: UpdateOptions): boolean {\n return scheduleUpdateFlagCount(options) > 0 || options.timezone !== undefined;\n}\n\nfunction parseGithubSubject(\n value: string | undefined,\n fallback: GithubLabelAppliedSubjectFilter = \"both\",\n): GithubLabelAppliedSubjectFilter {\n if (value === undefined) {\n return fallback;\n }\n switch (value) {\n case \"both\":\n case \"issues\":\n return value;\n case \"pull-requests\":\n return \"pull_requests\";\n default:\n throw new Error(\n `Invalid --subject \"${value}\". Use one of: both, issues, pull-requests`,\n );\n }\n}\n\nfunction parseGithubActor(\n value: string | undefined,\n fallback: \"me\" | \"anyone\" = \"me\",\n): \"me\" | \"anyone\" {\n if (value === undefined) {\n return fallback;\n }\n if (value === \"me\" || value === \"anyone\") {\n return value;\n }\n throw new Error(`Invalid --actor \"${value}\". Use one of: me, anyone`);\n}\n\nfunction buildGithubLabelAppliedEventConfig(\n options: AddOptions | UpdateOptions,\n existing?: Extract<\n ZeroWorkflowAutomationSummary,\n { readonly kind: \"event\"; readonly eventType: \"github-label-applied\" }\n >,\n) {\n const labelName = options.label?.trim() ?? existing?.eventConfig.labelName;\n if (!labelName) {\n throw new Error(\n 'github-label-applied automations require --label \"Label name\"',\n );\n }\n\n return {\n provider: \"github\" as const,\n event: \"label_applied\" as const,\n labelName,\n filters: {\n subject: parseGithubSubject(\n options.subject,\n existing?.eventConfig.filters.subject ?? \"both\",\n ),\n actor: {\n type: parseGithubActor(\n options.actor,\n existing?.eventConfig.filters.actor.type ?? \"me\",\n ),\n },\n },\n };\n}\n\nconst GITHUB_WORKFLOW_RUN_CONCLUSIONS: readonly GithubWorkflowRunConclusion[] =\n [\n \"action_required\",\n \"cancelled\",\n \"failure\",\n \"neutral\",\n \"skipped\",\n \"stale\",\n \"startup_failure\",\n \"success\",\n \"timed_out\",\n ];\n\nfunction parseGithubWorkflowRunFilter(\n value: string | undefined,\n fallback: readonly string[] | undefined,\n): string[] | undefined {\n if (value === undefined) {\n return fallback ? [...fallback] : undefined;\n }\n if (value.trim().toLowerCase() === \"any\") {\n return undefined;\n }\n const values = Array.from(\n new Set(\n value\n .split(\",\")\n .map((part) => {\n return part.trim();\n })\n .filter(Boolean),\n ),\n );\n if (values.length === 0) {\n throw new Error(\"GitHub workflow run filters cannot be empty; use any\");\n }\n return values;\n}\n\nfunction parseGithubWorkflowRunConclusions(\n value: string | undefined,\n fallback: readonly GithubWorkflowRunConclusion[] | undefined,\n): GithubWorkflowRunConclusion[] | undefined {\n const values = parseGithubWorkflowRunFilter(value, fallback);\n if (!values) {\n return undefined;\n }\n return values.map((conclusion) => {\n if (\n GITHUB_WORKFLOW_RUN_CONCLUSIONS.includes(\n conclusion as GithubWorkflowRunConclusion,\n )\n ) {\n return conclusion as GithubWorkflowRunConclusion;\n }\n throw new Error(\n `Invalid --conclusion \"${conclusion}\". Use one of: ${GITHUB_WORKFLOW_RUN_CONCLUSIONS.join(\", \")}, any`,\n );\n });\n}\n\nfunction buildGithubWorkflowRunCompletedEventConfig(\n options: AddOptions | UpdateOptions,\n existing?: Extract<\n ZeroWorkflowAutomationSummary,\n {\n readonly kind: \"event\";\n readonly eventType: \"github-workflow-run-completed\";\n }\n >,\n) {\n const filters = existing?.eventConfig.filters;\n return {\n provider: \"github\" as const,\n event: \"workflow_run_completed\" as const,\n filters: {\n repositories: parseGithubWorkflowRunFilter(\n options.repository,\n filters?.repositories,\n ),\n workflows: parseGithubWorkflowRunFilter(\n options.workflow,\n filters?.workflows,\n ),\n conclusions: parseGithubWorkflowRunConclusions(\n options.conclusion,\n filters?.conclusions,\n ),\n branches: parseGithubWorkflowRunFilter(options.branch, filters?.branches),\n events: parseGithubWorkflowRunFilter(\n options.triggeringEvent,\n filters?.events,\n ),\n actors: parseGithubWorkflowRunFilter(options.actor, filters?.actors),\n },\n };\n}\n\nfunction buildGmailNewMessageCreateRequest(\n options: AddOptions,\n): ZeroWorkflowAutomationCreateRequest {\n assertNoScheduleAddOptions(options);\n if (hasGmailLabelOption(options)) {\n throw new Error(\"--label only applies to label-applied event automations\");\n }\n assertNoGithubAutomationOptions(options);\n assertNoCalendarAutomationOptions(options);\n assertNoNotionAutomationOptions(options);\n return {\n kind: \"event\",\n eventType: \"gmail-new-message\",\n eventConfig: buildGmailNewMessageEventConfig(options),\n };\n}\n\nfunction buildGmailLabelAppliedCreateRequest(\n options: AddOptions,\n): ZeroWorkflowAutomationCreateRequest {\n assertNoScheduleAddOptions(options);\n if (hasGmailAutomationOptions(options)) {\n throw new Error(\n \"Gmail match flags and --config only apply to gmail-new-message automations\",\n );\n }\n assertNoGithubAutomationOptions(options);\n assertNoCalendarAutomationOptions(options);\n assertNoNotionAutomationOptions(options);\n return {\n kind: \"event\",\n eventType: \"gmail-label-applied\",\n eventConfig: buildGmailLabelAppliedEventConfig(options),\n };\n}\n\nfunction buildGithubLabelAppliedCreateRequest(\n options: AddOptions,\n): ZeroWorkflowAutomationCreateRequest {\n assertNoScheduleAddOptions(options);\n if (hasGmailAutomationOptions(options)) {\n throw new Error(\n \"Gmail match flags and --config only apply to Gmail event automations\",\n );\n }\n assertNoCalendarAutomationOptions(options);\n assertNoNotionAutomationOptions(options);\n if (hasGithubWorkflowRunSpecificOptions(options)) {\n throw new Error(\n \"Workflow run filter flags only apply to github-workflow-run-completed automations\",\n );\n }\n return {\n kind: \"event\",\n eventType: \"github-label-applied\",\n eventConfig: buildGithubLabelAppliedEventConfig(options),\n };\n}\n\nfunction buildGithubWorkflowRunCompletedCreateRequest(\n options: AddOptions,\n): ZeroWorkflowAutomationCreateRequest {\n assertNoScheduleAddOptions(options);\n if (hasGmailAutomationOptions(options) || hasGmailLabelOption(options)) {\n throw new Error(\n \"Gmail automation flags only apply to Gmail event automations\",\n );\n }\n if (options.subject !== undefined) {\n throw new Error(\n \"--subject only applies to github-label-applied automations\",\n );\n }\n assertNoCalendarAutomationOptions(options);\n assertNoNotionAutomationOptions(options);\n return {\n kind: \"event\",\n eventType: \"github-workflow-run-completed\",\n eventConfig: buildGithubWorkflowRunCompletedEventConfig(options),\n };\n}\n\nfunction buildGoogleCalendarEventCreateRequest(\n eventType:\n | \"google-calendar-event-created\"\n | \"google-calendar-event-updated\"\n | \"google-calendar-event-cancelled\",\n options: AddOptions,\n): ZeroWorkflowAutomationCreateRequest {\n assertNoScheduleAddOptions(options);\n if (\n hasGmailAutomationOptions(options) ||\n hasGmailLabelOption(options) ||\n hasGithubAutomationOptions(options) ||\n hasNotionAutomationOptions(options)\n ) {\n throw new Error(\n \"Gmail, GitHub, and Notion automation flags only apply to their event automations\",\n );\n }\n const calendarId = options.calendarId?.trim() || \"primary\";\n if (eventType === \"google-calendar-event-created\") {\n return {\n kind: \"event\",\n eventType: \"google-calendar-event-created\",\n eventConfig: {\n provider: \"google-calendar\",\n event: \"event_created\",\n calendarId,\n },\n };\n }\n if (eventType === \"google-calendar-event-updated\") {\n return {\n kind: \"event\",\n eventType: \"google-calendar-event-updated\",\n eventConfig: {\n provider: \"google-calendar\",\n event: \"event_updated\",\n calendarId,\n },\n };\n }\n return {\n kind: \"event\",\n eventType: \"google-calendar-event-cancelled\",\n eventConfig: {\n provider: \"google-calendar\",\n event: \"event_cancelled\",\n calendarId,\n },\n };\n}\n\nfunction buildNotionChildPageCreatedCreateRequest(\n options: AddOptions,\n): ZeroWorkflowAutomationCreateRequest {\n assertNoScheduleAddOptions(options);\n if (\n hasGmailAutomationOptions(options) ||\n hasGmailLabelOption(options) ||\n hasGithubAutomationOptions(options) ||\n hasCalendarAutomationOptions(options)\n ) {\n throw new Error(\n \"Gmail, GitHub, and Google Calendar automation flags only apply to their event automations\",\n );\n }\n\n const parentPageUrl = options.parentPageUrl?.trim();\n if (options.pageUrl !== undefined || options.databaseUrl !== undefined) {\n throw new Error(\n \"--page-url and --database-url do not apply to notion-child-page-created automations\",\n );\n }\n if (!parentPageUrl) {\n throw new Error(\n 'notion-child-page-created automations require --parent-page-url \"https://www.notion.so/...\"',\n );\n }\n\n return {\n kind: \"event\",\n eventType: \"notion-child-page-created\",\n eventConfig: {\n provider: \"notion\",\n event: \"child_page_created\",\n parentPageUrl,\n },\n };\n}\n\nfunction buildNotionDatabaseItemCreatedCreateRequest(\n options: AddOptions,\n): ZeroWorkflowAutomationCreateRequest {\n assertNoScheduleAddOptions(options);\n if (\n hasGmailAutomationOptions(options) ||\n hasGmailLabelOption(options) ||\n hasGithubAutomationOptions(options) ||\n hasCalendarAutomationOptions(options)\n ) {\n throw new Error(\n \"Gmail, GitHub, and Google Calendar automation flags only apply to their event automations\",\n );\n }\n\n if (options.pageUrl !== undefined || options.parentPageUrl !== undefined) {\n throw new Error(\n \"--page-url and --parent-page-url do not apply to notion-database-item-created automations\",\n );\n }\n const databaseUrl = options.databaseUrl?.trim();\n if (!databaseUrl) {\n throw new Error(\n 'notion-database-item-created automations require --database-url \"https://www.notion.so/...\"',\n );\n }\n\n return {\n kind: \"event\",\n eventType: \"notion-database-item-created\",\n eventConfig: {\n provider: \"notion\",\n event: \"database_item_created\",\n databaseUrl,\n },\n };\n}\n\nfunction buildNotionPageContentUpdatedCreateRequest(\n options: AddOptions,\n): ZeroWorkflowAutomationCreateRequest {\n assertNoScheduleAddOptions(options);\n if (\n hasGmailAutomationOptions(options) ||\n hasGmailLabelOption(options) ||\n hasGithubAutomationOptions(options) ||\n hasCalendarAutomationOptions(options)\n ) {\n throw new Error(\n \"Gmail, GitHub, and Google Calendar automation flags only apply to their event automations\",\n );\n }\n\n if (options.parentPageUrl !== undefined) {\n throw new Error(\n \"--parent-page-url only applies to notion-child-page-created automations\",\n );\n }\n const pageUrl = options.pageUrl?.trim();\n const databaseUrl = options.databaseUrl?.trim();\n if (\n (pageUrl !== undefined && pageUrl.length > 0) ===\n (databaseUrl !== undefined && databaseUrl.length > 0)\n ) {\n throw new Error(\n 'notion-page-content-updated automations require exactly one of --page-url \"https://www.notion.so/...\" or --database-url \"https://www.notion.so/...\"',\n );\n }\n\n return {\n kind: \"event\",\n eventType: \"notion-page-content-updated\",\n eventConfig:\n pageUrl !== undefined && pageUrl.length > 0\n ? {\n provider: \"notion\",\n event: \"page_content_updated\",\n pageUrl,\n }\n : {\n provider: \"notion\",\n event: \"page_content_updated\",\n databaseUrl: databaseUrl ?? \"\",\n },\n };\n}\n\nfunction buildWebhookCreateRequest(\n options: AddOptions,\n): ZeroWorkflowAutomationCreateRequest {\n assertNoScheduleAddOptions(options);\n if (hasEventAddOptions(options)) {\n throw new Error(\"Event automation flags only apply to event automations\");\n }\n return {\n kind: \"event\",\n eventType: \"webhook-received\",\n eventConfig: {\n provider: \"webhook\",\n event: \"received\",\n auth: { mode: \"hmac-sha256\" },\n },\n };\n}\n\nfunction buildScheduleCreateRequest(\n kind: string,\n options: AddOptions,\n): ZeroWorkflowAutomationCreateRequest {\n if (hasEventAddOptions(options)) {\n throw new Error(\"Event automation flags only apply to event automations\");\n }\n return { schedule: buildSchedule(kind, options) };\n}\n\nfunction buildCreateRequest(\n kind: string,\n options: AddOptions,\n): ZeroWorkflowAutomationCreateRequest {\n switch (kind) {\n case \"gmail-new-message\":\n return buildGmailNewMessageCreateRequest(options);\n case \"gmail-label-applied\":\n return buildGmailLabelAppliedCreateRequest(options);\n case \"github-label-applied\":\n return buildGithubLabelAppliedCreateRequest(options);\n case \"github-workflow-run-completed\":\n return buildGithubWorkflowRunCompletedCreateRequest(options);\n case \"google-calendar-event-created\":\n return buildGoogleCalendarEventCreateRequest(kind, options);\n case \"google-calendar-event-updated\":\n return buildGoogleCalendarEventCreateRequest(kind, options);\n case \"google-calendar-event-cancelled\":\n return buildGoogleCalendarEventCreateRequest(kind, options);\n case \"notion-child-page-created\":\n return buildNotionChildPageCreatedCreateRequest(options);\n case \"notion-database-item-created\":\n return buildNotionDatabaseItemCreatedCreateRequest(options);\n case \"notion-page-content-updated\":\n return buildNotionPageContentUpdatedCreateRequest(options);\n case \"webhook\":\n return buildWebhookCreateRequest(options);\n default:\n return buildScheduleCreateRequest(kind, options);\n }\n}\n\nfunction buildEventUpdate(\n options: UpdateOptions,\n existing: Extract<ZeroWorkflowAutomationSummary, { readonly kind: \"event\" }>,\n): ZeroWorkflowAutomationUpdateRequest {\n const hasGmailOptions = hasGmailAutomationOptions(options);\n const hasLabelOption = hasGmailLabelOption(options);\n const hasGithubOptions = hasGithubAutomationOptions(options);\n\n if (\n existing.eventType === \"google-calendar-event-created\" ||\n existing.eventType === \"google-calendar-event-updated\" ||\n existing.eventType === \"google-calendar-event-cancelled\"\n ) {\n throw new Error(\"Google Calendar event automations cannot be updated\");\n }\n\n if (existing.eventType === \"github-label-applied\") {\n if (hasGmailOptions) {\n throw new Error(\n \"Gmail match flags only apply to Gmail event automations\",\n );\n }\n if (hasGithubWorkflowRunSpecificOptions(options)) {\n throw new Error(\n \"Workflow run filter flags only apply to github-workflow-run-completed automations\",\n );\n }\n if (!hasLabelOption && !hasGithubOptions) {\n throw new Error(\n \"Provide --label, --subject, or --actor for github-label-applied automations\",\n );\n }\n return {\n eventConfig: buildGithubLabelAppliedEventConfig(options, existing),\n };\n }\n\n if (existing.eventType === \"github-workflow-run-completed\") {\n if (hasGmailOptions || hasLabelOption || options.subject !== undefined) {\n throw new Error(\n \"Gmail, label, and subject flags do not apply to GitHub workflow run automations\",\n );\n }\n if (!hasGithubAutomationOptions(options)) {\n throw new Error(\n \"Provide a GitHub workflow run filter flag; use any to clear a filter\",\n );\n }\n return {\n eventConfig: buildGithubWorkflowRunCompletedEventConfig(\n options,\n existing,\n ),\n };\n }\n\n if (hasGithubOptions) {\n throw new Error(\n \"GitHub automation flags only apply to GitHub event automations\",\n );\n }\n\n if (existing.eventType === \"gmail-label-applied\") {\n if (!hasLabelOption || hasGmailOptions) {\n throw new Error(\"Use --label for gmail-label-applied automations\");\n }\n return { eventConfig: buildGmailLabelAppliedEventConfig(options) };\n }\n\n if (!hasGmailOptions || hasLabelOption) {\n throw new Error(\n \"Use Gmail match options for gmail-new-message automations\",\n );\n }\n return { eventConfig: buildGmailNewMessageEventConfig(options) };\n}\n\nfunction buildScheduleUpdate(\n options: UpdateOptions,\n): ZeroWorkflowAutomationUpdateRequest {\n const hasGmailOptions = hasGmailAutomationOptions(options);\n const hasLabelOption = hasGmailLabelOption(options);\n if (hasGmailOptions || hasLabelOption) {\n throw new Error(\n \"Gmail automation flags only apply to Gmail event automations\",\n );\n }\n const flagCount = scheduleUpdateFlagCount(options);\n if (flagCount !== 1) {\n throw new Error(EXACTLY_ONE_FLAG_MESSAGE);\n }\n if (options.timezone && !options.expr && !options.at) {\n throw new Error(\"--timezone only applies to --expr and --at\");\n }\n if (options.expr) {\n return { schedule: buildSchedule(\"cron\", options) };\n }\n if (options.at) {\n return { schedule: buildSchedule(\"once\", options) };\n }\n return { schedule: buildSchedule(\"loop\", options) };\n}\n\nfunction buildUpdate(\n options: UpdateOptions,\n existing: ZeroWorkflowAutomationSummary,\n): ZeroWorkflowAutomationUpdateRequest {\n const hasEventOptions =\n hasGmailAutomationOptions(options) ||\n hasGmailLabelOption(options) ||\n hasGithubAutomationOptions(options);\n if (hasScheduleUpdateOptions(options) && hasEventOptions) {\n throw new Error(\"Use either schedule flags or event automation options\");\n }\n if (hasGmailAutomationOptions(options) && hasGmailLabelOption(options)) {\n throw new Error(\"Use either Gmail match options or --label\");\n }\n\n if (existing.kind === \"event\") {\n if (hasScheduleUpdateOptions(options)) {\n throw new Error(\"Schedule flags only apply to schedule automations\");\n }\n return buildEventUpdate(options, existing);\n }\n\n if (hasGithubAutomationOptions(options)) {\n throw new Error(\n \"GitHub automation flags only apply to GitHub event automations\",\n );\n }\n return buildScheduleUpdate(options);\n}\n\nconst addCommand = addGithubAutomationOptions(\n addGmailAutomationOptions(\n new Command()\n .name(\"add\")\n .description(\"Add an automation to a workflow\")\n .argument(\"<workflow>\", \"Workflow ID or name\")\n .argument(\"<kind>\", `Automation type: ${AUTOMATION_KINDS.join(\" | \")}`)\n .option(\"--expr <expression>\", 'Cron expression for kind \"cron\"')\n .option(\"--at <iso-time>\", 'Fire time for kind \"once\"')\n .option(\n \"--every <duration>\",\n 'Interval for kind \"loop\" (e.g. 15m, 1h, 90s)',\n )\n .option(\n \"-z, --timezone <tz>\",\n \"IANA timezone for cron/once (default: UTC)\",\n ),\n ),\n)\n .option(\n \"--calendar-id <id>\",\n \"Google Calendar ID for Google Calendar event automations (default: primary)\",\n )\n .option(\n \"--page-url <url>\",\n \"Notion page URL for notion-page-content-updated automations\",\n )\n .option(\n \"--parent-page-url <url>\",\n \"Parent Notion page URL for notion-child-page-created automations\",\n )\n .option(\n \"--database-url <url>\",\n \"Notion database URL for notion-database-item-created or notion-page-content-updated automations\",\n )\n .option(\"--agent <id>\", \"Agent ID for resolving a workflow name\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero workflow automation add tell-a-joke --agent <agent-id> cron --expr \"0 9 * * *\" -z Asia/Shanghai\n zero workflow automation add tell-a-joke --agent <agent-id> once --at \"2026-06-10T09:00\" -z Asia/Shanghai\n zero workflow automation add tell-a-joke --agent <agent-id> loop --every 15m\n zero workflow automation add triage --agent <agent-id> gmail-new-message --from-contains \"@example.com\"\n zero workflow automation add triage --agent <agent-id> gmail-new-message --config ./gmail-automation.json\n zero workflow automation add triage --agent <agent-id> gmail-label-applied --label \"Support\"\n zero workflow automation add triage --agent <agent-id> github-label-applied --label \"triage\" --subject both --actor me\n zero workflow automation add ci-triage --agent <agent-id> github-workflow-run-completed --repository vm0-ai/vm0 --workflow Turbo --conclusion failure,timed_out --branch main --triggering-event push --actor dependabot[bot]\n zero workflow automation add triage --agent <agent-id> google-calendar-event-created\n zero workflow automation add triage --agent <agent-id> google-calendar-event-updated\n zero workflow automation add triage --agent <agent-id> google-calendar-event-cancelled\n zero workflow automation add research-notes --agent <agent-id> notion-child-page-created --parent-page-url \"https://www.notion.so/workspace/Page-title-1234567890abcdef1234567890abcdef\"\n zero workflow automation add research-notes --agent <agent-id> notion-database-item-created --database-url \"https://www.notion.so/1234567890abcdef1234567890abcdef?v=abcdef1234567890abcdef1234567890\"\n zero workflow automation add research-notes --agent <agent-id> notion-page-content-updated --page-url \"https://www.notion.so/workspace/Page-title-1234567890abcdef1234567890abcdef\"\n zero workflow automation add research-notes --agent <agent-id> notion-page-content-updated --database-url \"https://www.notion.so/1234567890abcdef1234567890abcdef?v=abcdef1234567890abcdef1234567890\"\n zero workflow automation add triage --agent <agent-id> webhook\n\nNotes:\n - Workflow names resolve under --agent, then ZERO_AGENT_ID\n - Gmail automations match all inbound messages when no text match rules are provided\n - GitHub automations require the GitHub App installation in the workspace\n - GitHub workflow run filters accept comma-separated values; omit a filter to match any value\n - Webhook automations print the signing secret only once after creation\n - Use the workflow ID when a name is ambiguous`,\n )\n .action(\n withErrorHandler(\n async (workflowRef: string, kind: string, options: AddOptions) => {\n if (\n options.timezone &&\n kind !== \"cron\" &&\n kind !== \"once\" &&\n kind !== \"gmail-new-message\"\n ) {\n throw new Error(\n \"--timezone only applies to cron and once automations\",\n );\n }\n const workflowId = await resolveWorkflowRef(workflowRef, options);\n const body = buildCreateRequest(kind, options);\n const automation = await createWorkflowAutomation(workflowId, body);\n\n console.log(\n chalk.green(`✓ Automation added to workflow \"${workflowRef}\"`),\n );\n printWorkflowAutomationDetails(automation, { workflowRef });\n },\n ),\n );\n\nconst updateCommand = addGithubAutomationOptions(\n addGmailAutomationOptions(\n new Command()\n .name(\"update\")\n .description(\n \"Replace a workflow automation's schedule or event filter config\",\n )\n .argument(\"<automation>\", \"Workflow automation ID\")\n .option(\"--expr <expression>\", 'New cron schedule (e.g. \"0 9 * * *\")')\n .option(\"--at <iso-time>\", 'New one-time fire (e.g. \"2026-06-10T09:00\")')\n .option(\"--every <duration>\", \"New loop interval (e.g. 15m, 1h, 90s)\")\n .option(\"-z, --timezone <tz>\", \"IANA timezone for --expr / --at\"),\n ),\n)\n .addHelpText(\n \"after\",\n `\nExamples:\n zero workflow automation update 22222222-2222-4222-8222-222222222222 --expr \"0 9 * * *\" -z Asia/Shanghai\n zero workflow automation update 22222222-2222-4222-8222-222222222222 --at \"2026-06-10T09:00\" -z UTC\n zero workflow automation update 22222222-2222-4222-8222-222222222222 --every 10m\n zero workflow automation update 22222222-2222-4222-8222-222222222222 --from-contains \"@example.com\"\n zero workflow automation update 22222222-2222-4222-8222-222222222222 --config ./gmail-automation.json\n zero workflow automation update 22222222-2222-4222-8222-222222222222 --label \"Support\"\n zero workflow automation update 22222222-2222-4222-8222-222222222222 --actor anyone\n zero workflow automation update 22222222-2222-4222-8222-222222222222 --conclusion failure,timed_out --branch main\n zero workflow automation update 22222222-2222-4222-8222-222222222222 --actor any`,\n )\n .action(\n withErrorHandler(async (id: string, options: UpdateOptions) => {\n const existing = await getWorkflowAutomation(id);\n const automation = await updateWorkflowAutomation(\n id,\n buildUpdate(options, existing),\n );\n\n console.log(chalk.green(`✓ Automation ${automation.id} updated`));\n printWorkflowAutomationDetails(automation);\n }),\n );\n\nconst listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List a workflow's automations\")\n .argument(\"<workflow>\", \"Workflow ID or name\")\n .option(\"--agent <id>\", \"Agent ID for resolving a workflow name\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero workflow automation list tell-a-joke --agent <agent-id>\n zero workflow automation list <workflow-id>`,\n )\n .action(\n withErrorHandler(\n async (workflowRef: string, options: WorkflowRefOptions) => {\n const workflowId = await resolveWorkflowRef(workflowRef, options);\n const automations = await listWorkflowAutomations(workflowId);\n\n if (automations.length === 0) {\n console.log(chalk.dim(\"No automations\"));\n console.log(\n chalk.dim(\n ` Add one with: zero workflow automation add ${workflowRef} cron --expr \"0 9 * * *\"`,\n ),\n );\n return;\n }\n\n printWorkflowAutomationsTable(automations);\n },\n ),\n );\n\nconst showCommand = new Command()\n .name(\"show\")\n .description(\"Show a workflow automation\")\n .argument(\"<automation>\", \"Workflow automation ID\")\n .action(\n withErrorHandler(async (id: string) => {\n const automation = await getWorkflowAutomation(id);\n printWorkflowAutomationDetails(automation);\n }),\n );\n\nconst rmCommand = new Command()\n .name(\"rm\")\n .alias(\"remove\")\n .description(\"Remove a workflow automation\")\n .argument(\"<automation>\", \"Workflow automation ID\")\n .action(\n withErrorHandler(async (id: string) => {\n await deleteWorkflowAutomation(id);\n console.log(chalk.green(`✓ Automation ${id} removed`));\n }),\n );\n\nconst enableCommand = new Command()\n .name(\"enable\")\n .description(\"Enable a workflow automation\")\n .argument(\"<automation>\", \"Workflow automation ID\")\n .action(\n withErrorHandler(async (id: string) => {\n const automation = await enableWorkflowAutomation(id);\n console.log(chalk.green(`✓ Automation ${automation.id} enabled`));\n }),\n );\n\nconst disableCommand = new Command()\n .name(\"disable\")\n .description(\"Disable a workflow automation\")\n .argument(\"<automation>\", \"Workflow automation ID\")\n .action(\n withErrorHandler(async (id: string) => {\n const automation = await disableWorkflowAutomation(id);\n console.log(chalk.green(`✓ Automation ${automation.id} disabled`));\n }),\n );\n\nexport const automationCommand = new Command()\n .name(\"automation\")\n .description(\"Manage a workflow's automations\")\n .addCommand(addCommand)\n .addCommand(updateCommand)\n .addCommand(listCommand)\n .addCommand(showCommand)\n .addCommand(rmCommand)\n .addCommand(enableCommand)\n .addCommand(disableCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Add an automation: zero workflow automation add <workflow-id> cron --expr \"0 9 * * *\"\n Add a Notion page: zero workflow automation add <workflow-id> notion-child-page-created --parent-page-url \"https://www.notion.so/...\"\n Add a webhook: zero workflow automation add <workflow-id> webhook\n Update a schedule: zero workflow automation update <automation-id> --every 10m\n List automations: zero workflow automation list <workflow-id>\n Inspect an automation: zero workflow automation show <automation-id>\n Pause one automation: zero workflow automation disable <automation-id>`,\n );\n","import { readFileSync } from \"node:fs\";\nimport type {\n GmailLabelAppliedEventConfig,\n GmailNewMessageEventConfig,\n} from \"@vm0/api-contracts/contracts/zero-workflows\";\n\ntype GmailMatchRules = NonNullable<GmailNewMessageEventConfig[\"match\"]>;\ntype GmailTextMatcher = NonNullable<GmailMatchRules[\"from\"]>;\ntype GmailTextField = \"from\" | \"subject\" | \"body\" | \"to\" | \"cc\";\n\nexport interface GmailAutomationOptions {\n readonly config?: string;\n readonly label?: string;\n readonly fromContains?: string;\n readonly fromNotContains?: string;\n readonly subjectContains?: string;\n readonly subjectNotContains?: string;\n readonly bodyContains?: string;\n readonly bodyNotContains?: string;\n readonly toContains?: string;\n readonly toNotContains?: string;\n readonly ccContains?: string;\n readonly ccNotContains?: string;\n}\n\ninterface TextFlagSpec {\n readonly field: GmailTextField;\n readonly contains?: string;\n readonly doesNotContain?: string;\n}\n\nconst TEXT_FIELD_LABELS: Record<GmailTextField, string> = {\n from: \"from\",\n subject: \"subject\",\n body: \"body\",\n to: \"to\",\n cc: \"cc\",\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction textFieldFromKey(key: string): GmailTextField | null {\n switch (key) {\n case \"from\":\n case \"subject\":\n case \"body\":\n case \"to\":\n case \"cc\":\n return key;\n default:\n return null;\n }\n}\n\nfunction formatFieldName(field: GmailTextField): string {\n return TEXT_FIELD_LABELS[field];\n}\n\nfunction parseNonEmptyString(value: unknown, path: string): string {\n if (typeof value !== \"string\" || value.length === 0) {\n throw new Error(`${path} must be a non-empty string`);\n }\n return value;\n}\n\nfunction parseNonEmptyStringArray(value: unknown, path: string): string[] {\n if (!Array.isArray(value) || value.length === 0) {\n throw new Error(`${path} must be a non-empty string array`);\n }\n return value.map((item, index) => {\n return parseNonEmptyString(item, `${path}[${index}]`);\n });\n}\n\nfunction parseTextMatcher(\n field: GmailTextField,\n value: unknown,\n): GmailTextMatcher {\n if (!isRecord(value)) {\n throw new Error(`${formatFieldName(field)} must be an object`);\n }\n\n const matcher: {\n contains?: string;\n containsAny?: string[];\n doesNotContain?: string;\n doesNotContainAny?: string[];\n } = {};\n\n for (const key of Object.keys(value)) {\n switch (key) {\n case \"contains\":\n matcher.contains = parseNonEmptyString(\n value[key],\n `${formatFieldName(field)}.contains`,\n );\n break;\n case \"containsAny\":\n matcher.containsAny = parseNonEmptyStringArray(\n value[key],\n `${formatFieldName(field)}.containsAny`,\n );\n break;\n case \"doesNotContain\":\n matcher.doesNotContain = parseNonEmptyString(\n value[key],\n `${formatFieldName(field)}.doesNotContain`,\n );\n break;\n case \"doesNotContainAny\":\n matcher.doesNotContainAny = parseNonEmptyStringArray(\n value[key],\n `${formatFieldName(field)}.doesNotContainAny`,\n );\n break;\n default:\n throw new Error(\n `Unsupported Gmail automation text matcher \"${key}\" for ${formatFieldName(field)}`,\n );\n }\n }\n\n if (\n matcher.contains === undefined &&\n matcher.containsAny === undefined &&\n matcher.doesNotContain === undefined &&\n matcher.doesNotContainAny === undefined\n ) {\n throw new Error(\n `${formatFieldName(field)} must include at least one text matcher`,\n );\n }\n\n return matcher;\n}\n\nfunction parseMatch(value: unknown): GmailMatchRules | undefined {\n if (value === undefined) {\n return undefined;\n }\n if (!isRecord(value)) {\n throw new Error(\"match must be an object\");\n }\n\n const match: GmailMatchRules = {};\n for (const key of Object.keys(value)) {\n const field = textFieldFromKey(key);\n if (field === null) {\n throw new Error(\n `Unsupported Gmail automation match field \"${key}\". Supported fields: from, subject, body, to, cc`,\n );\n }\n match[field] = parseTextMatcher(field, value[key]);\n }\n\n return Object.keys(match).length > 0 ? match : undefined;\n}\n\nfunction readConfigMatch(path: string): GmailMatchRules | undefined {\n let parsed: unknown;\n try {\n parsed = JSON.parse(readFileSync(path, \"utf-8\"));\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(\n `Failed to read Gmail automation config \"${path}\": ${message}`,\n );\n }\n\n if (!isRecord(parsed)) {\n throw new Error(\"Gmail automation config must be a JSON object\");\n }\n\n for (const key of Object.keys(parsed)) {\n if (key !== \"match\") {\n throw new Error(\n `Unsupported Gmail automation config field \"${key}\". Use a top-level match object`,\n );\n }\n }\n\n return parseMatch(parsed.match);\n}\n\nfunction textFlagSpecs(\n options: GmailAutomationOptions,\n): readonly TextFlagSpec[] {\n return [\n {\n field: \"from\",\n contains: options.fromContains,\n doesNotContain: options.fromNotContains,\n },\n {\n field: \"subject\",\n contains: options.subjectContains,\n doesNotContain: options.subjectNotContains,\n },\n {\n field: \"body\",\n contains: options.bodyContains,\n doesNotContain: options.bodyNotContains,\n },\n {\n field: \"to\",\n contains: options.toContains,\n doesNotContain: options.toNotContains,\n },\n {\n field: \"cc\",\n contains: options.ccContains,\n doesNotContain: options.ccNotContains,\n },\n ];\n}\n\nexport function hasGmailAutomationOptions(\n options: GmailAutomationOptions,\n): boolean {\n return (\n options.config !== undefined ||\n textFlagSpecs(options).some((spec) => {\n return spec.contains !== undefined || spec.doesNotContain !== undefined;\n })\n );\n}\n\nexport function hasGmailLabelOption(options: GmailAutomationOptions): boolean {\n return options.label !== undefined;\n}\n\nfunction buildMatchFromFlags(\n options: GmailAutomationOptions,\n): GmailMatchRules | undefined {\n const match: GmailMatchRules = {};\n for (const spec of textFlagSpecs(options)) {\n const matcher: { contains?: string; doesNotContain?: string } = {};\n if (spec.contains !== undefined) {\n if (spec.contains.length === 0) {\n throw new Error(\n `${formatFieldName(spec.field)} contains must be non-empty`,\n );\n }\n matcher.contains = spec.contains;\n }\n if (spec.doesNotContain !== undefined) {\n if (spec.doesNotContain.length === 0) {\n throw new Error(\n `${formatFieldName(spec.field)} doesNotContain must be non-empty`,\n );\n }\n matcher.doesNotContain = spec.doesNotContain;\n }\n if (\n matcher.contains !== undefined ||\n matcher.doesNotContain !== undefined\n ) {\n match[spec.field] = matcher;\n }\n }\n return Object.keys(match).length > 0 ? match : undefined;\n}\n\nexport function buildGmailNewMessageEventConfig(\n options: GmailAutomationOptions,\n): GmailNewMessageEventConfig {\n if (\n options.config !== undefined &&\n textFlagSpecs(options).some((spec) => {\n return spec.contains !== undefined || spec.doesNotContain !== undefined;\n })\n ) {\n throw new Error(\"Use either --config or Gmail text match flags, not both\");\n }\n\n const match =\n options.config !== undefined\n ? readConfigMatch(options.config)\n : buildMatchFromFlags(options);\n\n return match\n ? { provider: \"gmail\", event: \"new_message\", match }\n : { provider: \"gmail\", event: \"new_message\" };\n}\n\nexport function buildGmailLabelAppliedEventConfig(\n options: GmailAutomationOptions,\n): GmailLabelAppliedEventConfig {\n const labelName = options.label?.trim();\n if (!labelName) {\n throw new Error(\n 'gmail-label-applied automations require --label \"Label name\"',\n );\n }\n return { provider: \"gmail\", event: \"label_applied\", labelName };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;AAEA,SAAS,gBAAAA,qBAAoB;;;ACF7B;AAAA,SAAS,cAAc,mBAAmB;AAC1C,SAAS,YAAY;AAErB,IAAM,gBAAgB,oBAAI,IAAI,CAAC,gBAAgB,QAAQ,WAAW,CAAC;AAS5D,SAAS,uBACd,SAC0C;AAC1C,QAAM,QAAkD,CAAC;AAEzD,WAAS,KAAK,KAAa,QAAgB;AACzC,UAAM,UAAU,YAAY,KAAK,EAAE,eAAe,KAAK,CAAC;AACxD,eAAW,SAAS,SAAS;AAC3B,UAAI,MAAM,KAAK,WAAW,GAAG,KAAK,cAAc,IAAI,MAAM,IAAI,EAAG;AAEjE,YAAM,UAAU,SAAS,GAAG,MAAM,IAAI,MAAM,IAAI,KAAK,MAAM;AAC3D,UAAI,MAAM,YAAY,GAAG;AACvB,aAAK,KAAK,KAAK,MAAM,IAAI,GAAG,OAAO;AAAA,MACrC,OAAO;AACL,YAAI,YAAY,YAAY;AAC1B,gBAAM,IAAI;AAAA,YACR;AAAA,UACF;AAAA,QACF;AACA,cAAM,KAAK;AAAA,UACT,MAAM;AAAA,UACN,SAAS,aAAa,KAAK,KAAK,MAAM,IAAI,GAAG,OAAO;AAAA,QACtD,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,OAAK,SAAS,EAAE;AAEhB,SAAO;AACT;;;AC1CA;AAOO,SAAS,wBAAwB,UAAuC;AAC7E,SAAO,SAAS,oBAAoB,S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