@vm0/cli 9.221.3 → 9.221.5

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.
Files changed (88) hide show
  1. package/{agent-XDIEG6MI.js → agent-DYWIJQ2R.js} +4 -4
  2. package/{automation-KDDRE5KJ.js → automation-CZYPQV3U.js} +7 -9
  3. package/{automation-KDDRE5KJ.js.map → automation-CZYPQV3U.js.map} +1 -1
  4. package/{banking-JR2STEJN.js → banking-NLYZOBEM.js} +2 -2
  5. package/{chat-X4DBXISE.js → chat-5UZFU2YR.js} +2 -2
  6. package/{chunk-YB6YZSND.js → chunk-463VKP2V.js} +3 -3
  7. package/{chunk-L4D7VYFA.js → chunk-65CYJRLA.js} +2 -2
  8. package/{chunk-J7RLLIWI.js → chunk-HQFETCZ6.js} +26 -2
  9. package/chunk-HQFETCZ6.js.map +1 -0
  10. package/{chunk-M7ZTZ3MX.js → chunk-IFA2V7EW.js} +2 -2
  11. package/{chunk-OWKM4VZT.js → chunk-IMZDXXSW.js} +2 -2
  12. package/{chunk-XPUOYFGN.js → chunk-PB7YKTIG.js} +3 -3
  13. package/{chunk-IAZROOTJ.js → chunk-PCBM5SRN.js} +328 -135
  14. package/chunk-PCBM5SRN.js.map +1 -0
  15. package/{chunk-S4Q6HXP6.js → chunk-PX6FH3KT.js} +2 -2
  16. package/{chunk-RGNTZQST.js → chunk-UZJLZXGK.js} +129 -291
  17. package/chunk-UZJLZXGK.js.map +1 -0
  18. package/{chunk-UNT4HLFG.js → chunk-ZQYA5M55.js} +3 -64
  19. package/{chunk-UNT4HLFG.js.map → chunk-ZQYA5M55.js.map} +1 -1
  20. package/{computer-use-L4VCPFBW.js → computer-use-JWVNMBIM.js} +2 -2
  21. package/{connector-QQMB5RTA.js → connector-YJX3MZGN.js} +382 -395
  22. package/connector-YJX3MZGN.js.map +1 -0
  23. package/{credit-GIIZZWHO.js → credit-FHOJ736M.js} +2 -2
  24. package/{developer-support-2YU76KOI.js → developer-support-BJVUM5OZ.js} +2 -2
  25. package/{doctor-JHR552YR.js → doctor-BDSKVS5W.js} +5 -5
  26. package/{generate-Z2OIFHXN.js → generate-EA5ZRXFE.js} +60 -81
  27. package/generate-EA5ZRXFE.js.map +1 -0
  28. package/{github-EMUHKXMN.js → github-NU7VA3WB.js} +2 -2
  29. package/{goal-2FWIQEHX.js → goal-4H4GUEMC.js} +2 -2
  30. package/{host-GON5OIX5.js → host-SCI3ZPFT.js} +2 -2
  31. package/index.js +13 -13
  32. package/{logs-MKJR2CV7.js → logs-EOG3DCHM.js} +6 -6
  33. package/{maps-QOGARCRF.js → maps-E5GVYSKP.js} +2 -2
  34. package/{model-UGVPILE6.js → model-XP7ACN22.js} +3 -3
  35. package/{model-provider-KJWZZW75.js → model-provider-TAGWSIEW.js} +3 -3
  36. package/{org-REIW226A.js → org-4CMXX52G.js} +2 -2
  37. package/package.json +1 -1
  38. package/{phone-3CYPHVAI.js → phone-T7VLFMEU.js} +2 -2
  39. package/{preference-UTNLNRR7.js → preference-Q4ZCLD2L.js} +2 -2
  40. package/{resource-5VSRXZRY.js → resource-QKFJESUB.js} +2 -2
  41. package/{search-3BRGZEF5.js → search-5QGCMW7I.js} +6 -6
  42. package/{secret-2RIJFHZS.js → secret-LMPIFKPU.js} +3 -3
  43. package/{slack-HLJ5L6KN.js → slack-FKENH3DZ.js} +2 -2
  44. package/{telegram-ERVAKDET.js → telegram-ZG24OBRU.js} +2 -2
  45. package/{variable-YM5QRM72.js → variable-BOATQUX3.js} +2 -2
  46. package/{web-76BIQJPF.js → web-3ASTXCH7.js} +2 -2
  47. package/{whoami-IYNM3PAW.js → whoami-DHCS6YIJ.js} +4 -4
  48. package/{workflow-ACUQX3V6.js → workflow-T2TTFE6C.js} +4 -6
  49. package/{workflow-ACUQX3V6.js.map → workflow-T2TTFE6C.js.map} +1 -1
  50. package/zero.js +31 -31
  51. package/chunk-IAZROOTJ.js.map +0 -1
  52. package/chunk-J7RLLIWI.js.map +0 -1
  53. package/chunk-RGNTZQST.js.map +0 -1
  54. package/chunk-RGP625TN.js +0 -47
  55. package/chunk-RGP625TN.js.map +0 -1
  56. package/connector-QQMB5RTA.js.map +0 -1
  57. package/generate-Z2OIFHXN.js.map +0 -1
  58. /package/{agent-XDIEG6MI.js.map → agent-DYWIJQ2R.js.map} +0 -0
  59. /package/{banking-JR2STEJN.js.map → banking-NLYZOBEM.js.map} +0 -0
  60. /package/{chat-X4DBXISE.js.map → chat-5UZFU2YR.js.map} +0 -0
  61. /package/{chunk-YB6YZSND.js.map → chunk-463VKP2V.js.map} +0 -0
  62. /package/{chunk-L4D7VYFA.js.map → chunk-65CYJRLA.js.map} +0 -0
  63. /package/{chunk-M7ZTZ3MX.js.map → chunk-IFA2V7EW.js.map} +0 -0
  64. /package/{chunk-OWKM4VZT.js.map → chunk-IMZDXXSW.js.map} +0 -0
  65. /package/{chunk-XPUOYFGN.js.map → chunk-PB7YKTIG.js.map} +0 -0
  66. /package/{chunk-S4Q6HXP6.js.map → chunk-PX6FH3KT.js.map} +0 -0
  67. /package/{computer-use-L4VCPFBW.js.map → computer-use-JWVNMBIM.js.map} +0 -0
  68. /package/{credit-GIIZZWHO.js.map → credit-FHOJ736M.js.map} +0 -0
  69. /package/{developer-support-2YU76KOI.js.map → developer-support-BJVUM5OZ.js.map} +0 -0
  70. /package/{doctor-JHR552YR.js.map → doctor-BDSKVS5W.js.map} +0 -0
  71. /package/{github-EMUHKXMN.js.map → github-NU7VA3WB.js.map} +0 -0
  72. /package/{goal-2FWIQEHX.js.map → goal-4H4GUEMC.js.map} +0 -0
  73. /package/{host-GON5OIX5.js.map → host-SCI3ZPFT.js.map} +0 -0
  74. /package/{logs-MKJR2CV7.js.map → logs-EOG3DCHM.js.map} +0 -0
  75. /package/{maps-QOGARCRF.js.map → maps-E5GVYSKP.js.map} +0 -0
  76. /package/{model-UGVPILE6.js.map → model-XP7ACN22.js.map} +0 -0
  77. /package/{model-provider-KJWZZW75.js.map → model-provider-TAGWSIEW.js.map} +0 -0
  78. /package/{org-REIW226A.js.map → org-4CMXX52G.js.map} +0 -0
  79. /package/{phone-3CYPHVAI.js.map → phone-T7VLFMEU.js.map} +0 -0
  80. /package/{preference-UTNLNRR7.js.map → preference-Q4ZCLD2L.js.map} +0 -0
  81. /package/{resource-5VSRXZRY.js.map → resource-QKFJESUB.js.map} +0 -0
  82. /package/{search-3BRGZEF5.js.map → search-5QGCMW7I.js.map} +0 -0
  83. /package/{secret-2RIJFHZS.js.map → secret-LMPIFKPU.js.map} +0 -0
  84. /package/{slack-HLJ5L6KN.js.map → slack-FKENH3DZ.js.map} +0 -0
  85. /package/{telegram-ERVAKDET.js.map → telegram-ZG24OBRU.js.map} +0 -0
  86. /package/{variable-YM5QRM72.js.map → variable-BOATQUX3.js.map} +0 -0
  87. /package/{web-76BIQJPF.js.map → web-3ASTXCH7.js.map} +0 -0
  88. /package/{whoami-IYNM3PAW.js.map → whoami-DHCS6YIJ.js.map} +0 -0
@@ -4,10 +4,10 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  loadConnectorPermissionInfos,
6
6
  policyIcon
7
- } from "./chunk-OWKM4VZT.js";
7
+ } from "./chunk-IMZDXXSW.js";
8
8
  import {
9
9
  permissionGrantsToFirewallPolicies
10
- } from "./chunk-S4Q6HXP6.js";
10
+ } from "./chunk-PX6FH3KT.js";
11
11
  import {
12
12
  isInteractive,
13
13
  promptConfirm
@@ -24,7 +24,7 @@ import {
24
24
  listZeroUserPermissionGrants,
25
25
  updateZeroAgent,
26
26
  updateZeroAgentInstructions
27
- } from "./chunk-IAZROOTJ.js";
27
+ } from "./chunk-PCBM5SRN.js";
28
28
  import {
29
29
  withErrorHandler
30
30
  } from "./chunk-3F4RFLPX.js";
@@ -595,4 +595,4 @@ Notes:
595
595
  export {
596
596
  zeroAgentCommand
597
597
  };
598
- //# sourceMappingURL=agent-XDIEG6MI.js.map
598
+ //# sourceMappingURL=agent-DYWIJQ2R.js.map
@@ -3,17 +3,15 @@ import { createRequire as __createRequire } from "node:module";
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  formatDurationSeconds,
6
+ formatRelativeTime,
6
7
  parseDurationSeconds
7
- } from "./chunk-J7RLLIWI.js";
8
- import {
9
- formatRelativeTime
10
- } from "./chunk-RGP625TN.js";
8
+ } from "./chunk-HQFETCZ6.js";
11
9
  import {
12
10
  isUUID
13
- } from "./chunk-RGNTZQST.js";
11
+ } from "./chunk-UZJLZXGK.js";
14
12
  import "./chunk-7HZXC5CL.js";
15
- import "./chunk-M7ZTZ3MX.js";
16
- import "./chunk-UNT4HLFG.js";
13
+ import "./chunk-IFA2V7EW.js";
14
+ import "./chunk-ZQYA5M55.js";
17
15
  import {
18
16
  isInteractive,
19
17
  promptConfirm
@@ -30,7 +28,7 @@ import {
30
28
  showAutomation,
31
29
  updateAutomation,
32
30
  updateAutomationTrigger
33
- } from "./chunk-IAZROOTJ.js";
31
+ } from "./chunk-PCBM5SRN.js";
34
32
  import {
35
33
  withErrorHandler
36
34
  } from "./chunk-3F4RFLPX.js";
@@ -500,4 +498,4 @@ Examples:
500
498
  export {
501
499
  zeroAutomationCommand
502
500
  };
503
- //# sourceMappingURL=automation-KDDRE5KJ.js.map
501
+ //# sourceMappingURL=automation-CZYPQV3U.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/commands/zero/automation/index.ts","../src/commands/zero/automation/create.ts","../src/commands/zero/automation/at-time-input.ts","../src/commands/zero/automation/trigger-display.ts","../src/commands/zero/automation/list.ts","../src/commands/zero/automation/show.ts","../src/commands/zero/automation/update.ts","../src/commands/zero/automation/delete.ts","../src/commands/zero/automation/enable.ts","../src/commands/zero/automation/disable.ts","../src/commands/zero/automation/run.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createCommand } from \"./create\";\nimport { listCommand } from \"./list\";\nimport { showCommand } from \"./show\";\nimport { updateCommand } from \"./update\";\nimport { deleteCommand } from \"./delete\";\nimport { enableCommand } from \"./enable\";\nimport { disableCommand } from \"./disable\";\nimport { runCommand } from \"./run\";\n\nexport const zeroAutomationCommand = new Command()\n .name(\"automation\")\n .description(\"Create or manage scheduled automations\")\n .addCommand(createCommand)\n .addCommand(listCommand)\n .addCommand(showCommand)\n .addCommand(updateCommand)\n .addCommand(deleteCommand)\n .addCommand(enableCommand)\n .addCommand(disableCommand)\n .addCommand(runCommand)\n // Deprecated aliases — fully functional, but print a stderr notice pointing\n // at the replacement command.\n .addHelpText(\n \"after\",\n `\nExamples:\n Create an automation: zero automation create -n alerts --agent <agent-id> -p \"Summarize alerts\" --cron \"0 9 * * *\"\n List automations: zero automation list\n Inspect one: zero automation show alerts\n Fire manually: zero automation run alerts\n Pause an automation: zero automation disable alerts\n Resume an automation: zero automation enable alerts\n Delete an automation: zero automation delete alerts`,\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type { CreateTriggerRequest } from \"@vm0/api-contracts/contracts/automations\";\nimport { createAutomation, getComposeById } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { isUUID } from \"../../run/shared\";\nimport { requireTimezoneForLocalAtTime } from \"./at-time-input\";\nimport { parseDurationSeconds } from \"./duration\";\nimport { formatTriggerConfig } from \"./trigger-display\";\n\ninterface CreateOptions {\n name: string;\n agent: string;\n prompt: string;\n description?: string;\n cron?: string;\n once?: string;\n loop?: string;\n timezone?: string;\n}\n\n/**\n * Build the automation schedule trigger from exactly one inline flag\n * (--cron / --once / --loop, with optional --timezone).\n */\nfunction buildInlineTrigger(options: CreateOptions): CreateTriggerRequest {\n const sugarCount = [options.cron, options.once, options.loop].filter(\n (value) => {\n return value !== undefined;\n },\n ).length;\n\n if (sugarCount !== 1) {\n throw new Error(\"Use exactly one of --cron, --once, --loop\");\n }\n\n if (options.timezone && !options.cron && !options.once) {\n throw new Error(\"--timezone requires --cron or --once\");\n }\n\n if (options.cron) {\n return {\n kind: \"cron\",\n cronExpression: options.cron,\n timezone: options.timezone,\n };\n }\n if (options.once) {\n requireTimezoneForLocalAtTime(options.once, options.timezone, \"--once\");\n return { kind: \"once\", atTime: options.once, timezone: options.timezone };\n }\n if (options.loop) {\n return {\n kind: \"loop\",\n intervalSeconds: parseDurationSeconds(options.loop),\n };\n }\n throw new Error(\"Use exactly one of --cron, --once, --loop\");\n}\n\nexport const createCommand = new Command()\n .name(\"create\")\n .description(\"Create an automation with a schedule trigger\")\n .requiredOption(\"-n, --name <name>\", \"Automation name\")\n .requiredOption(\"--agent <agent-id>\", \"Agent ID to run\")\n .requiredOption(\n \"-p, --prompt <instruction>\",\n \"Instruction the agent runs when the automation fires\",\n )\n .option(\"--description <text>\", \"Optional description\")\n .option(\"--cron <expression>\", 'Add a cron trigger (e.g. \"0 9 * * *\")')\n .option(\n \"--once <iso-time>\",\n 'Add a one-time trigger (e.g. \"2026-06-10T09:00\")',\n )\n .option(\"--loop <duration>\", \"Add a loop trigger (e.g. 15m, 1h, 90s)\")\n .option(\"-z, --timezone <tz>\", \"IANA timezone for --cron / --once\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Daily at 9am: zero automation create -n alerts --agent 550e8400-e29b-41d4-a716-446655440000 -p \"...\" --cron \"0 9 * * *\"\n One-time: zero automation create -n alerts --agent 550e8400-e29b-41d4-a716-446655440000 -p \"...\" --once \"2026-06-10T09:00\" -z UTC\n Every 15 min: zero automation create -n alerts --agent 550e8400-e29b-41d4-a716-446655440000 -p \"...\" --loop 15m\n\nNotes:\n - Exactly one of --cron, --once, --loop is required`,\n )\n .action(\n withErrorHandler(async (options: CreateOptions) => {\n if (!isUUID(options.agent)) {\n console.error(\n chalk.red(`✗ Invalid agent ID \"${options.agent}\" — expected a UUID`),\n );\n console.error(chalk.dim(\" Run: zero agent list to find agent IDs\"));\n process.exit(1);\n }\n\n const trigger = buildInlineTrigger(options);\n\n const compose = await getComposeById(options.agent);\n\n const { automation } = await createAutomation({\n name: options.name,\n agentId: compose.id,\n instruction: options.prompt,\n description: options.description,\n chatThreadId: process.env.ZERO_CHAT_THREAD_ID,\n trigger,\n });\n\n console.log(chalk.green(`✓ Automation \"${automation.name}\" created`));\n console.log(chalk.dim(` ID: ${automation.id}`));\n console.log(chalk.dim(` Agent: ${compose.name}`));\n console.log(chalk.dim(` Thread: ${automation.chatThreadId}`));\n\n const createdTrigger = automation.triggers[0];\n if (createdTrigger) {\n console.log(\n chalk.dim(\n ` Trigger: ${createdTrigger.kind} ${formatTriggerConfig(createdTrigger)} (${createdTrigger.id})`,\n ),\n );\n }\n\n console.log();\n console.log(\n ` Run manually: ${chalk.cyan(`zero automation run ${automation.name}`)}`,\n );\n }),\n );\n","const EXPLICIT_OFFSET_RE = /(?:[zZ]|[+-]\\d{2}:?\\d{2})$/u;\n\nfunction hasExplicitAtTimeOffset(atTime: string): boolean {\n return EXPLICIT_OFFSET_RE.test(atTime.trim());\n}\n\nexport function requireTimezoneForLocalAtTime(\n atTime: string,\n timezone: string | undefined,\n flagName: \"--at\" | \"--once\",\n): void {\n if (timezone || hasExplicitAtTimeOffset(atTime)) {\n return;\n }\n throw new Error(\n `${flagName} without Z or an explicit offset requires --timezone (e.g. ${flagName} \"2026-06-10T09:00\" --timezone Asia/Shanghai)`,\n );\n}\n","import chalk from \"chalk\";\nimport type { AutomationTriggerResponse } from \"@vm0/api-contracts/contracts/automations\";\nimport { formatRelativeTime } from \"../../../lib/domain/schedule-utils\";\nimport { formatDurationSeconds } from \"./duration\";\n\n/**\n * Shared rendering for an automation's schedule trigger.\n */\n\n/** One-line config summary per trigger kind. */\nexport function formatTriggerConfig(\n trigger: AutomationTriggerResponse,\n): string {\n switch (trigger.kind) {\n case \"cron\":\n return `${trigger.cronExpression} (${trigger.timezone})`;\n case \"once\":\n return `at ${trigger.atTime} (${trigger.timezone})`;\n case \"loop\":\n return `every ${formatDurationSeconds(trigger.intervalSeconds)}`;\n }\n}\n\nfunction formatNextRun(trigger: AutomationTriggerResponse): string {\n if (!trigger.nextRunAt) {\n return chalk.dim(\"-\");\n }\n return formatRelativeTime(trigger.nextRunAt);\n}\n\n/**\n * Print the triggers table: KIND, ID, STATUS, CONFIG, NEXT RUN\n */\nexport function printTriggersTable(\n triggers: readonly AutomationTriggerResponse[],\n): void {\n const kindWidth = Math.max(\n 4,\n ...triggers.map((t) => {\n return t.kind.length;\n }),\n );\n const idWidth = Math.max(\n 2,\n ...triggers.map((t) => {\n return t.id.length;\n }),\n );\n const configWidth = Math.max(\n 6,\n ...triggers.map((t) => {\n return formatTriggerConfig(t).length;\n }),\n );\n\n console.log(\n chalk.dim(\n [\n \"KIND\".padEnd(kindWidth),\n \"ID\".padEnd(idWidth),\n \"STATUS\".padEnd(8),\n \"CONFIG\".padEnd(configWidth),\n \"NEXT RUN\",\n ].join(\" \"),\n ),\n );\n\n for (const trigger of triggers) {\n const status = trigger.enabled\n ? chalk.green(\"enabled\")\n : chalk.yellow(\"disabled\");\n console.log(\n [\n trigger.kind.padEnd(kindWidth),\n trigger.id.padEnd(idWidth),\n status.padEnd(8 + (trigger.enabled ? 0 : 2)),\n formatTriggerConfig(trigger).padEnd(configWidth),\n formatNextRun(trigger),\n ].join(\" \"),\n );\n }\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type { AutomationResponse } from \"@vm0/api-contracts/contracts/automations\";\nimport { listAutomations } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nfunction formatTriggerSummary(automation: AutomationResponse): string {\n const [trigger] = automation.triggers;\n if (!trigger) {\n return chalk.dim(\"-\");\n }\n return trigger.kind;\n}\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List automations with their schedule trigger\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero automation list`,\n )\n .action(\n withErrorHandler(async () => {\n const { automations } = await listAutomations();\n\n if (automations.length === 0) {\n console.log(chalk.dim(\"No automations found\"));\n console.log(\n chalk.dim(\n ' Create one with: zero automation create -n <name> --agent <agent-id> -p \"<instruction>\"',\n ),\n );\n return;\n }\n\n const nameWidth = Math.max(\n 4,\n ...automations.map((a) => {\n return a.name.length;\n }),\n );\n const idWidth = Math.max(\n 2,\n ...automations.map((a) => {\n return a.id.length;\n }),\n );\n const agentWidth = Math.max(\n 5,\n ...automations.map((a) => {\n return (a.displayName ?? a.agentId).length;\n }),\n );\n\n console.log(\n chalk.dim(\n [\n \"NAME\".padEnd(nameWidth),\n \"ID\".padEnd(idWidth),\n \"AGENT\".padEnd(agentWidth),\n \"STATUS\".padEnd(8),\n \"TRIGGER\",\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.name.padEnd(nameWidth),\n automation.id.padEnd(idWidth),\n (automation.displayName ?? automation.agentId).padEnd(agentWidth),\n status.padEnd(8 + (automation.enabled ? 0 : 2)),\n formatTriggerSummary(automation),\n ].join(\" \"),\n );\n }\n\n console.log();\n console.log(\n chalk.dim(` Details: zero automation show <automation-name-or-id>`),\n );\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { showAutomation } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { printTriggersTable } from \"./trigger-display\";\n\nexport const showCommand = new Command()\n .name(\"show\")\n .description(\"Show an automation and its schedule\")\n .argument(\"<automation>\", \"Automation ID or name\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero automation show alerts\n zero automation show 11111111-1111-4111-8111-111111111111\n\nNotes:\n - When the same name exists on multiple agents, the API rejects it as ambiguous — use the ID`,\n )\n .action(\n withErrorHandler(async (ref: string) => {\n const automation = await showAutomation(ref);\n\n const status = automation.enabled\n ? chalk.green(\"enabled\")\n : chalk.yellow(\"disabled\");\n const agent = automation.displayName\n ? `${automation.displayName} ${chalk.dim(`(${automation.agentId})`)}`\n : automation.agentId;\n\n console.log(`${\"Name:\".padEnd(14)}${automation.name}`);\n console.log(`${\"ID:\".padEnd(14)}${automation.id}`);\n console.log(`${\"Agent:\".padEnd(14)}${agent}`);\n console.log(`${\"Status:\".padEnd(14)}${status}`);\n if (automation.description) {\n console.log(`${\"Description:\".padEnd(14)}${automation.description}`);\n }\n console.log(\n `${\"Instruction:\".padEnd(14)}${chalk.dim(automation.instruction)}`,\n );\n console.log(`${\"Thread:\".padEnd(14)}${automation.chatThreadId}`);\n\n console.log();\n const [trigger] = automation.triggers;\n if (!trigger) {\n console.log(chalk.dim(\"No schedule trigger\"));\n return;\n }\n\n printTriggersTable([trigger]);\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type { UpdateTriggerRequest } from \"@vm0/api-contracts/contracts/automations\";\nimport {\n showAutomation,\n updateAutomation,\n updateAutomationTrigger,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { requireTimezoneForLocalAtTime } from \"./at-time-input\";\nimport { parseDurationSeconds } from \"./duration\";\nimport { formatTriggerConfig } from \"./trigger-display\";\n\ninterface UpdateOptions {\n name?: string;\n prompt?: string;\n description?: string;\n cron?: string;\n once?: string;\n loop?: string;\n timezone?: string;\n}\n\n/**\n * Build the optional schedule replacement from the timing sugar flags\n * (--cron / --once / --loop, with optional --timezone). The automation's\n * single time trigger is updated in place; its kind switches to match the\n * flag.\n */\nfunction buildTimingUpdate(\n options: UpdateOptions,\n): UpdateTriggerRequest | undefined {\n const sugarCount = [options.cron, options.once, options.loop].filter(\n (value) => {\n return value !== undefined;\n },\n ).length;\n\n if (sugarCount > 1) {\n throw new Error(\"Use at most one of --cron, --once, --loop\");\n }\n\n if (options.timezone && !options.cron && !options.once) {\n throw new Error(\"--timezone requires --cron or --once\");\n }\n\n if (options.cron) {\n return {\n kind: \"cron\",\n cronExpression: options.cron,\n timezone: options.timezone,\n };\n }\n if (options.once) {\n requireTimezoneForLocalAtTime(options.once, options.timezone, \"--once\");\n return { kind: \"once\", atTime: options.once, timezone: options.timezone };\n }\n if (options.loop) {\n return {\n kind: \"loop\",\n intervalSeconds: parseDurationSeconds(options.loop),\n };\n }\n return undefined;\n}\n\nexport const updateCommand = new Command()\n .name(\"update\")\n .description(\n \"Update an automation's name, instruction, description, or schedule\",\n )\n .argument(\"<automation>\", \"Automation ID or name\")\n .option(\"-n, --name <name>\", \"New automation name\")\n .option(\"-p, --prompt <instruction>\", \"New instruction\")\n .option(\"--description <text>\", \"New description\")\n .option(\"--cron <expression>\", 'New cron schedule (e.g. \"0 9 * * *\")')\n .option(\"--once <iso-time>\", 'New one-time fire (e.g. \"2026-06-10T09:00\")')\n .option(\"--loop <duration>\", \"New loop interval (e.g. 15m, 1h, 90s)\")\n .option(\"-z, --timezone <tz>\", \"IANA timezone for --cron / --once\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero automation update alerts -p \"Summarize alerts and post to Slack\"\n zero automation update alerts -n alerts-v2 --description \"Daily alert digest\"\n zero automation update alerts --cron \"0 18 * * 5\" -z Asia/Shanghai\n zero automation update alerts --loop 10m\n\nNotes:\n - At most one of --cron, --once, --loop; it replaces the automation's schedule trigger in place (the kind may switch, run history is kept)`,\n )\n .action(\n withErrorHandler(async (ref: string, options: UpdateOptions) => {\n const timing = buildTimingUpdate(options);\n const hasIdentityUpdate =\n options.name !== undefined ||\n options.prompt !== undefined ||\n options.description !== undefined;\n\n if (!hasIdentityUpdate && !timing) {\n throw new Error(\n \"Nothing to update: provide --name, --prompt, --description, --cron, --once, or --loop\",\n );\n }\n\n // Resolve the single trigger up front so a missing/ambiguous trigger\n // fails before any field is patched.\n let timeTriggerId: string | undefined;\n if (timing) {\n const automation = await showAutomation(ref);\n const timeTriggers = automation.triggers;\n const [first] = timeTriggers;\n if (!first) {\n throw new Error(`Automation ${ref} has no schedule trigger`);\n }\n timeTriggerId = first.id;\n }\n\n if (hasIdentityUpdate) {\n const automation = await updateAutomation(ref, {\n name: options.name,\n instruction: options.prompt,\n description: options.description,\n });\n console.log(chalk.green(`✓ Automation \"${automation.name}\" updated`));\n }\n\n if (timing && timeTriggerId) {\n const trigger = await updateAutomationTrigger(timeTriggerId, timing);\n console.log(chalk.green(`✓ Trigger ${trigger.id} updated`));\n console.log(\n chalk.dim(\n ` Schedule: ${trigger.kind} ${formatTriggerConfig(trigger)}`,\n ),\n );\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { deleteAutomation } from \"../../../lib/api\";\nimport { isInteractive, promptConfirm } from \"../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const deleteCommand = new Command()\n .name(\"delete\")\n .alias(\"rm\")\n .description(\"Delete an automation (its triggers are removed too)\")\n .argument(\"<automation>\", \"Automation ID or name\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero automation delete alerts\n zero automation delete alerts -y\n\nNotes:\n - Use -y to skip confirmation in non-interactive mode`,\n )\n .action(\n withErrorHandler(async (ref: string, options: { yes?: boolean }) => {\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 automation ${chalk.cyan(ref)} and its schedule trigger?`,\n false,\n );\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteAutomation(ref);\n\n console.log(chalk.green(`✓ Automation \"${ref}\" deleted`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { enableAutomation } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const enableCommand = new Command()\n .name(\"enable\")\n .description(\"Enable an automation\")\n .argument(\"<automation>\", \"Automation ID or name\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero automation enable alerts`,\n )\n .action(\n withErrorHandler(async (ref: string) => {\n const automation = await enableAutomation(ref);\n\n console.log(chalk.green(`✓ Automation \"${automation.name}\" enabled`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { disableAutomation } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const disableCommand = new Command()\n .name(\"disable\")\n .description(\"Disable an automation\")\n .argument(\"<automation>\", \"Automation ID or name\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero automation disable alerts`,\n )\n .action(\n withErrorHandler(async (ref: string) => {\n const automation = await disableAutomation(ref);\n\n console.log(chalk.green(`✓ Automation \"${automation.name}\" disabled`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { runAutomation } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const runCommand = new Command()\n .name(\"run\")\n .description(\"Manually fire an automation (runs its instruction once)\")\n .argument(\"<automation>\", \"Automation ID or name\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero automation run alerts`,\n )\n .action(\n withErrorHandler(async (ref: string) => {\n const { runId } = await runAutomation(ref);\n\n console.log(chalk.green(`✓ Automation \"${ref}\" fired`));\n console.log(chalk.dim(` Run ID: ${runId}`));\n }),\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;;;ACAA;AAAA,IAAM,qBAAqB;AAE3B,SAAS,wBAAwB,QAAyB;AACxD,SAAO,mBAAmB,KAAK,OAAO,KAAK,CAAC;AAC9C;AAEO,SAAS,8BACd,QACA,UACA,UACM;AACN,MAAI,YAAY,wBAAwB,MAAM,GAAG;AAC/C;AAAA,EACF;AACA,QAAM,IAAI;AAAA,IACR,GAAG,QAAQ,8DAA8D,QAAQ;AAAA,EACnF;AACF;;;ACjBA;AAUO,SAAS,oBACd,SACQ;AACR,UAAQ,QAAQ,MAAM;AAAA,IACpB,KAAK;AACH,aAAO,GAAG,QAAQ,cAAc,KAAK,QAAQ,QAAQ;AAAA,IACvD,KAAK;AACH,aAAO,MAAM,QAAQ,MAAM,KAAK,QAAQ,QAAQ;AAAA,IAClD,KAAK;AACH,aAAO,SAAS,sBAAsB,QAAQ,eAAe,CAAC;AAAA,EAClE;AACF;A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AAAA;AAAA;AAGF,EACC;AAAA,EACC,iBAAiB,OAAO,QAAgB;AACtC,UAAM,EAAE,MAAM,IAAI,MAAM,cAAc,GAAG;AAEzC,YAAQ,IAAI,eAAM,MAAM,sBAAiB,GAAG,SAAS,CAAC;AACtD,YAAQ,IAAI,eAAM,IAAI,aAAa,KAAK,EAAE,CAAC;AAAA,EAC7C,CAAC;AACH;;;AVZK,IAAM,wBAAwB,IAAI,QAAQ,EAC9C,KAAK,YAAY,EACjB,YAAY,wCAAwC,EACpD,WAAW,aAAa,EACxB,WAAW,WAAW,EACtB,WAAW,WAAW,EACtB,WAAW,aAAa,EACxB,WAAW,aAAa,EACxB,WAAW,aAAa,EACxB,WAAW,cAAc,EACzB,WAAW,UAAU,EAGrB;AAAA,EACC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASF;","names":[]}
1
+ {"version":3,"sources":["../src/commands/zero/automation/index.ts","../src/commands/zero/automation/create.ts","../src/commands/zero/automation/at-time-input.ts","../src/commands/zero/automation/trigger-display.ts","../src/commands/zero/automation/list.ts","../src/commands/zero/automation/show.ts","../src/commands/zero/automation/update.ts","../src/commands/zero/automation/delete.ts","../src/commands/zero/automation/enable.ts","../src/commands/zero/automation/disable.ts","../src/commands/zero/automation/run.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createCommand } from \"./create\";\nimport { listCommand } from \"./list\";\nimport { showCommand } from \"./show\";\nimport { updateCommand } from \"./update\";\nimport { deleteCommand } from \"./delete\";\nimport { enableCommand } from \"./enable\";\nimport { disableCommand } from \"./disable\";\nimport { runCommand } from \"./run\";\n\nexport const zeroAutomationCommand = new Command()\n .name(\"automation\")\n .description(\"Create or manage scheduled automations\")\n .addCommand(createCommand)\n .addCommand(listCommand)\n .addCommand(showCommand)\n .addCommand(updateCommand)\n .addCommand(deleteCommand)\n .addCommand(enableCommand)\n .addCommand(disableCommand)\n .addCommand(runCommand)\n // Deprecated aliases — fully functional, but print a stderr notice pointing\n // at the replacement command.\n .addHelpText(\n \"after\",\n `\nExamples:\n Create an automation: zero automation create -n alerts --agent <agent-id> -p \"Summarize alerts\" --cron \"0 9 * * *\"\n List automations: zero automation list\n Inspect one: zero automation show alerts\n Fire manually: zero automation run alerts\n Pause an automation: zero automation disable alerts\n Resume an automation: zero automation enable alerts\n Delete an automation: zero automation delete alerts`,\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type { CreateTriggerRequest } from \"@vm0/api-contracts/contracts/automations\";\nimport { createAutomation, getComposeById } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { isUUID } from \"../../run/shared\";\nimport { requireTimezoneForLocalAtTime } from \"./at-time-input\";\nimport { parseDurationSeconds } from \"./duration\";\nimport { formatTriggerConfig } from \"./trigger-display\";\n\ninterface CreateOptions {\n name: string;\n agent: string;\n prompt: string;\n description?: string;\n cron?: string;\n once?: string;\n loop?: string;\n timezone?: string;\n}\n\n/**\n * Build the automation schedule trigger from exactly one inline flag\n * (--cron / --once / --loop, with optional --timezone).\n */\nfunction buildInlineTrigger(options: CreateOptions): CreateTriggerRequest {\n const sugarCount = [options.cron, options.once, options.loop].filter(\n (value) => {\n return value !== undefined;\n },\n ).length;\n\n if (sugarCount !== 1) {\n throw new Error(\"Use exactly one of --cron, --once, --loop\");\n }\n\n if (options.timezone && !options.cron && !options.once) {\n throw new Error(\"--timezone requires --cron or --once\");\n }\n\n if (options.cron) {\n return {\n kind: \"cron\",\n cronExpression: options.cron,\n timezone: options.timezone,\n };\n }\n if (options.once) {\n requireTimezoneForLocalAtTime(options.once, options.timezone, \"--once\");\n return { kind: \"once\", atTime: options.once, timezone: options.timezone };\n }\n if (options.loop) {\n return {\n kind: \"loop\",\n intervalSeconds: parseDurationSeconds(options.loop),\n };\n }\n throw new Error(\"Use exactly one of --cron, --once, --loop\");\n}\n\nexport const createCommand = new Command()\n .name(\"create\")\n .description(\"Create an automation with a schedule trigger\")\n .requiredOption(\"-n, --name <name>\", \"Automation name\")\n .requiredOption(\"--agent <agent-id>\", \"Agent ID to run\")\n .requiredOption(\n \"-p, --prompt <instruction>\",\n \"Instruction the agent runs when the automation fires\",\n )\n .option(\"--description <text>\", \"Optional description\")\n .option(\"--cron <expression>\", 'Add a cron trigger (e.g. \"0 9 * * *\")')\n .option(\n \"--once <iso-time>\",\n 'Add a one-time trigger (e.g. \"2026-06-10T09:00\")',\n )\n .option(\"--loop <duration>\", \"Add a loop trigger (e.g. 15m, 1h, 90s)\")\n .option(\"-z, --timezone <tz>\", \"IANA timezone for --cron / --once\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Daily at 9am: zero automation create -n alerts --agent 550e8400-e29b-41d4-a716-446655440000 -p \"...\" --cron \"0 9 * * *\"\n One-time: zero automation create -n alerts --agent 550e8400-e29b-41d4-a716-446655440000 -p \"...\" --once \"2026-06-10T09:00\" -z UTC\n Every 15 min: zero automation create -n alerts --agent 550e8400-e29b-41d4-a716-446655440000 -p \"...\" --loop 15m\n\nNotes:\n - Exactly one of --cron, --once, --loop is required`,\n )\n .action(\n withErrorHandler(async (options: CreateOptions) => {\n if (!isUUID(options.agent)) {\n console.error(\n chalk.red(`✗ Invalid agent ID \"${options.agent}\" — expected a UUID`),\n );\n console.error(chalk.dim(\" Run: zero agent list to find agent IDs\"));\n process.exit(1);\n }\n\n const trigger = buildInlineTrigger(options);\n\n const compose = await getComposeById(options.agent);\n\n const { automation } = await createAutomation({\n name: options.name,\n agentId: compose.id,\n instruction: options.prompt,\n description: options.description,\n chatThreadId: process.env.ZERO_CHAT_THREAD_ID,\n trigger,\n });\n\n console.log(chalk.green(`✓ Automation \"${automation.name}\" created`));\n console.log(chalk.dim(` ID: ${automation.id}`));\n console.log(chalk.dim(` Agent: ${compose.name}`));\n console.log(chalk.dim(` Thread: ${automation.chatThreadId}`));\n\n const createdTrigger = automation.triggers[0];\n if (createdTrigger) {\n console.log(\n chalk.dim(\n ` Trigger: ${createdTrigger.kind} ${formatTriggerConfig(createdTrigger)} (${createdTrigger.id})`,\n ),\n );\n }\n\n console.log();\n console.log(\n ` Run manually: ${chalk.cyan(`zero automation run ${automation.name}`)}`,\n );\n }),\n );\n","const EXPLICIT_OFFSET_RE = /(?:[zZ]|[+-]\\d{2}:?\\d{2})$/u;\n\nfunction hasExplicitAtTimeOffset(atTime: string): boolean {\n return EXPLICIT_OFFSET_RE.test(atTime.trim());\n}\n\nexport function requireTimezoneForLocalAtTime(\n atTime: string,\n timezone: string | undefined,\n flagName: \"--at\" | \"--once\",\n): void {\n if (timezone || hasExplicitAtTimeOffset(atTime)) {\n return;\n }\n throw new Error(\n `${flagName} without Z or an explicit offset requires --timezone (e.g. ${flagName} \"2026-06-10T09:00\" --timezone Asia/Shanghai)`,\n );\n}\n","import chalk from \"chalk\";\nimport type { AutomationTriggerResponse } from \"@vm0/api-contracts/contracts/automations\";\nimport { formatRelativeTime } from \"../../../lib/domain/schedule-utils\";\nimport { formatDurationSeconds } from \"./duration\";\n\n/**\n * Shared rendering for an automation's schedule trigger.\n */\n\n/** One-line config summary per trigger kind. */\nexport function formatTriggerConfig(\n trigger: AutomationTriggerResponse,\n): string {\n switch (trigger.kind) {\n case \"cron\":\n return `${trigger.cronExpression} (${trigger.timezone})`;\n case \"once\":\n return `at ${trigger.atTime} (${trigger.timezone})`;\n case \"loop\":\n return `every ${formatDurationSeconds(trigger.intervalSeconds)}`;\n }\n}\n\nfunction formatNextRun(trigger: AutomationTriggerResponse): string {\n if (!trigger.nextRunAt) {\n return chalk.dim(\"-\");\n }\n return formatRelativeTime(trigger.nextRunAt);\n}\n\n/**\n * Print the triggers table: KIND, ID, STATUS, CONFIG, NEXT RUN\n */\nexport function printTriggersTable(\n triggers: readonly AutomationTriggerResponse[],\n): void {\n const kindWidth = Math.max(\n 4,\n ...triggers.map((t) => {\n return t.kind.length;\n }),\n );\n const idWidth = Math.max(\n 2,\n ...triggers.map((t) => {\n return t.id.length;\n }),\n );\n const configWidth = Math.max(\n 6,\n ...triggers.map((t) => {\n return formatTriggerConfig(t).length;\n }),\n );\n\n console.log(\n chalk.dim(\n [\n \"KIND\".padEnd(kindWidth),\n \"ID\".padEnd(idWidth),\n \"STATUS\".padEnd(8),\n \"CONFIG\".padEnd(configWidth),\n \"NEXT RUN\",\n ].join(\" \"),\n ),\n );\n\n for (const trigger of triggers) {\n const status = trigger.enabled\n ? chalk.green(\"enabled\")\n : chalk.yellow(\"disabled\");\n console.log(\n [\n trigger.kind.padEnd(kindWidth),\n trigger.id.padEnd(idWidth),\n status.padEnd(8 + (trigger.enabled ? 0 : 2)),\n formatTriggerConfig(trigger).padEnd(configWidth),\n formatNextRun(trigger),\n ].join(\" \"),\n );\n }\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type { AutomationResponse } from \"@vm0/api-contracts/contracts/automations\";\nimport { listAutomations } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nfunction formatTriggerSummary(automation: AutomationResponse): string {\n const [trigger] = automation.triggers;\n if (!trigger) {\n return chalk.dim(\"-\");\n }\n return trigger.kind;\n}\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List automations with their schedule trigger\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero automation list`,\n )\n .action(\n withErrorHandler(async () => {\n const { automations } = await listAutomations();\n\n if (automations.length === 0) {\n console.log(chalk.dim(\"No automations found\"));\n console.log(\n chalk.dim(\n ' Create one with: zero automation create -n <name> --agent <agent-id> -p \"<instruction>\"',\n ),\n );\n return;\n }\n\n const nameWidth = Math.max(\n 4,\n ...automations.map((a) => {\n return a.name.length;\n }),\n );\n const idWidth = Math.max(\n 2,\n ...automations.map((a) => {\n return a.id.length;\n }),\n );\n const agentWidth = Math.max(\n 5,\n ...automations.map((a) => {\n return (a.displayName ?? a.agentId).length;\n }),\n );\n\n console.log(\n chalk.dim(\n [\n \"NAME\".padEnd(nameWidth),\n \"ID\".padEnd(idWidth),\n \"AGENT\".padEnd(agentWidth),\n \"STATUS\".padEnd(8),\n \"TRIGGER\",\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.name.padEnd(nameWidth),\n automation.id.padEnd(idWidth),\n (automation.displayName ?? automation.agentId).padEnd(agentWidth),\n status.padEnd(8 + (automation.enabled ? 0 : 2)),\n formatTriggerSummary(automation),\n ].join(\" \"),\n );\n }\n\n console.log();\n console.log(\n chalk.dim(` Details: zero automation show <automation-name-or-id>`),\n );\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { showAutomation } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { printTriggersTable } from \"./trigger-display\";\n\nexport const showCommand = new Command()\n .name(\"show\")\n .description(\"Show an automation and its schedule\")\n .argument(\"<automation>\", \"Automation ID or name\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero automation show alerts\n zero automation show 11111111-1111-4111-8111-111111111111\n\nNotes:\n - When the same name exists on multiple agents, the API rejects it as ambiguous — use the ID`,\n )\n .action(\n withErrorHandler(async (ref: string) => {\n const automation = await showAutomation(ref);\n\n const status = automation.enabled\n ? chalk.green(\"enabled\")\n : chalk.yellow(\"disabled\");\n const agent = automation.displayName\n ? `${automation.displayName} ${chalk.dim(`(${automation.agentId})`)}`\n : automation.agentId;\n\n console.log(`${\"Name:\".padEnd(14)}${automation.name}`);\n console.log(`${\"ID:\".padEnd(14)}${automation.id}`);\n console.log(`${\"Agent:\".padEnd(14)}${agent}`);\n console.log(`${\"Status:\".padEnd(14)}${status}`);\n if (automation.description) {\n console.log(`${\"Description:\".padEnd(14)}${automation.description}`);\n }\n console.log(\n `${\"Instruction:\".padEnd(14)}${chalk.dim(automation.instruction)}`,\n );\n console.log(`${\"Thread:\".padEnd(14)}${automation.chatThreadId}`);\n\n console.log();\n const [trigger] = automation.triggers;\n if (!trigger) {\n console.log(chalk.dim(\"No schedule trigger\"));\n return;\n }\n\n printTriggersTable([trigger]);\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type { UpdateTriggerRequest } from \"@vm0/api-contracts/contracts/automations\";\nimport {\n showAutomation,\n updateAutomation,\n updateAutomationTrigger,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { requireTimezoneForLocalAtTime } from \"./at-time-input\";\nimport { parseDurationSeconds } from \"./duration\";\nimport { formatTriggerConfig } from \"./trigger-display\";\n\ninterface UpdateOptions {\n name?: string;\n prompt?: string;\n description?: string;\n cron?: string;\n once?: string;\n loop?: string;\n timezone?: string;\n}\n\n/**\n * Build the optional schedule replacement from the timing sugar flags\n * (--cron / --once / --loop, with optional --timezone). The automation's\n * single time trigger is updated in place; its kind switches to match the\n * flag.\n */\nfunction buildTimingUpdate(\n options: UpdateOptions,\n): UpdateTriggerRequest | undefined {\n const sugarCount = [options.cron, options.once, options.loop].filter(\n (value) => {\n return value !== undefined;\n },\n ).length;\n\n if (sugarCount > 1) {\n throw new Error(\"Use at most one of --cron, --once, --loop\");\n }\n\n if (options.timezone && !options.cron && !options.once) {\n throw new Error(\"--timezone requires --cron or --once\");\n }\n\n if (options.cron) {\n return {\n kind: \"cron\",\n cronExpression: options.cron,\n timezone: options.timezone,\n };\n }\n if (options.once) {\n requireTimezoneForLocalAtTime(options.once, options.timezone, \"--once\");\n return { kind: \"once\", atTime: options.once, timezone: options.timezone };\n }\n if (options.loop) {\n return {\n kind: \"loop\",\n intervalSeconds: parseDurationSeconds(options.loop),\n };\n }\n return undefined;\n}\n\nexport const updateCommand = new Command()\n .name(\"update\")\n .description(\n \"Update an automation's name, instruction, description, or schedule\",\n )\n .argument(\"<automation>\", \"Automation ID or name\")\n .option(\"-n, --name <name>\", \"New automation name\")\n .option(\"-p, --prompt <instruction>\", \"New instruction\")\n .option(\"--description <text>\", \"New description\")\n .option(\"--cron <expression>\", 'New cron schedule (e.g. \"0 9 * * *\")')\n .option(\"--once <iso-time>\", 'New one-time fire (e.g. \"2026-06-10T09:00\")')\n .option(\"--loop <duration>\", \"New loop interval (e.g. 15m, 1h, 90s)\")\n .option(\"-z, --timezone <tz>\", \"IANA timezone for --cron / --once\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero automation update alerts -p \"Summarize alerts and post to Slack\"\n zero automation update alerts -n alerts-v2 --description \"Daily alert digest\"\n zero automation update alerts --cron \"0 18 * * 5\" -z Asia/Shanghai\n zero automation update alerts --loop 10m\n\nNotes:\n - At most one of --cron, --once, --loop; it replaces the automation's schedule trigger in place (the kind may switch, run history is kept)`,\n )\n .action(\n withErrorHandler(async (ref: string, options: UpdateOptions) => {\n const timing = buildTimingUpdate(options);\n const hasIdentityUpdate =\n options.name !== undefined ||\n options.prompt !== undefined ||\n options.description !== undefined;\n\n if (!hasIdentityUpdate && !timing) {\n throw new Error(\n \"Nothing to update: provide --name, --prompt, --description, --cron, --once, or --loop\",\n );\n }\n\n // Resolve the single trigger up front so a missing/ambiguous trigger\n // fails before any field is patched.\n let timeTriggerId: string | undefined;\n if (timing) {\n const automation = await showAutomation(ref);\n const timeTriggers = automation.triggers;\n const [first] = timeTriggers;\n if (!first) {\n throw new Error(`Automation ${ref} has no schedule trigger`);\n }\n timeTriggerId = first.id;\n }\n\n if (hasIdentityUpdate) {\n const automation = await updateAutomation(ref, {\n name: options.name,\n instruction: options.prompt,\n description: options.description,\n });\n console.log(chalk.green(`✓ Automation \"${automation.name}\" updated`));\n }\n\n if (timing && timeTriggerId) {\n const trigger = await updateAutomationTrigger(timeTriggerId, timing);\n console.log(chalk.green(`✓ Trigger ${trigger.id} updated`));\n console.log(\n chalk.dim(\n ` Schedule: ${trigger.kind} ${formatTriggerConfig(trigger)}`,\n ),\n );\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { deleteAutomation } from \"../../../lib/api\";\nimport { isInteractive, promptConfirm } from \"../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const deleteCommand = new Command()\n .name(\"delete\")\n .alias(\"rm\")\n .description(\"Delete an automation (its triggers are removed too)\")\n .argument(\"<automation>\", \"Automation ID or name\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero automation delete alerts\n zero automation delete alerts -y\n\nNotes:\n - Use -y to skip confirmation in non-interactive mode`,\n )\n .action(\n withErrorHandler(async (ref: string, options: { yes?: boolean }) => {\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 automation ${chalk.cyan(ref)} and its schedule trigger?`,\n false,\n );\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteAutomation(ref);\n\n console.log(chalk.green(`✓ Automation \"${ref}\" deleted`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { enableAutomation } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const enableCommand = new Command()\n .name(\"enable\")\n .description(\"Enable an automation\")\n .argument(\"<automation>\", \"Automation ID or name\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero automation enable alerts`,\n )\n .action(\n withErrorHandler(async (ref: string) => {\n const automation = await enableAutomation(ref);\n\n console.log(chalk.green(`✓ Automation \"${automation.name}\" enabled`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { disableAutomation } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const disableCommand = new Command()\n .name(\"disable\")\n .description(\"Disable an automation\")\n .argument(\"<automation>\", \"Automation ID or name\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero automation disable alerts`,\n )\n .action(\n withErrorHandler(async (ref: string) => {\n const automation = await disableAutomation(ref);\n\n console.log(chalk.green(`✓ Automation \"${automation.name}\" disabled`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { runAutomation } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const runCommand = new Command()\n .name(\"run\")\n .description(\"Manually fire an automation (runs its instruction once)\")\n .argument(\"<automation>\", \"Automation ID or name\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero automation run alerts`,\n )\n .action(\n withErrorHandler(async (ref: string) => {\n const { runId } = await runAutomation(ref);\n\n console.log(chalk.green(`✓ Automation \"${ref}\" fired`));\n console.log(chalk.dim(` Run ID: ${runId}`));\n }),\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;;;ACAA;AAAA,IAAM,qBAAqB;AAE3B,SAAS,wBAAwB,QAAyB;AACxD,SAAO,mBAAmB,KAAK,OAAO,KAAK,CAAC;AAC9C;AAEO,SAAS,8BACd,QACA,UACA,UACM;AACN,MAAI,YAAY,wBAAwB,MAAM,GAAG;AAC/C;AAAA,EACF;AACA,QAAM,IAAI;AAAA,IACR,GAAG,QAAQ,8DAA8D,QAAQ;AAAA,EACnF;AACF;;;ACjBA;AAUO,SAAS,oBACd,SACQ;AACR,UAAQ,QAAQ,MAAM;AAAA,IACpB,KAAK;AACH,aAAO,GAAG,QAAQ,cAAc,KAAK,QAAQ,QAAQ;AAAA,IACvD,KAAK;AACH,aAAO,MAAM,QAAQ,MAAM,KAAK,QAAQ,QAAQ;AAAA,IAClD,KAAK;AACH,aAAO,SAAS,sBAAsB,QAAQ,eAAe,CAAC;AAAA,EAClE;AACF;AAEA,SAAS,cAAc,SAA4C;AACjE,MAAI,CAAC,QAAQ,WAAW;AACtB,WAAO,eAAM,IAAI,GAAG;AAAA,EACtB;AACA,SAAO,mBAAmB,QAAQ,SAAS;AAC7C;AAKO,SAAS,mBACd,UACM;AACN,QAAM,YAAY,KAAK;AAAA,IACrB;AAAA,IACA,GAAG,SAAS,IAAI,CAAC,MAAM;AACrB,aAAO,EAAE,KA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wBAAwB,IAAI,QAAQ,EAC9C,KAAK,YAAY,EACjB,YAAY,wCAAwC,EACpD,WAAW,aAAa,EACxB,WAAW,WAAW,EACtB,WAAW,WAAW,EACtB,WAAW,aAAa,EACxB,WAAW,aAAa,EACxB,WAAW,aAAa,EACxB,WAAW,cAAc,EACzB,WAAW,UAAU,EAGrB;AAAA,EACC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASF;","names":[]}
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import "./chunk-LTDQISD7.js";
5
5
  import {
6
6
  callZeroBanking
7
- } from "./chunk-IAZROOTJ.js";
7
+ } from "./chunk-PCBM5SRN.js";
8
8
  import {
9
9
  withErrorHandler
10
10
  } from "./chunk-3F4RFLPX.js";
@@ -115,4 +115,4 @@ Notes:
115
115
  export {
116
116
  zeroBankingCommand
117
117
  };
118
- //# sourceMappingURL=banking-JR2STEJN.js.map
118
+ //# sourceMappingURL=banking-NLYZOBEM.js.map
@@ -5,7 +5,7 @@ import "./chunk-LTDQISD7.js";
5
5
  import {
6
6
  getZeroChatThread,
7
7
  renameZeroChatThread
8
- } from "./chunk-IAZROOTJ.js";
8
+ } from "./chunk-PCBM5SRN.js";
9
9
  import {
10
10
  withErrorHandler
11
11
  } from "./chunk-3F4RFLPX.js";
@@ -120,4 +120,4 @@ Examples:
120
120
  export {
121
121
  zeroChatCommand
122
122
  };
123
- //# sourceMappingURL=chat-X4DBXISE.js.map
123
+ //# sourceMappingURL=chat-5UZFU2YR.js.map
@@ -50,7 +50,7 @@ if (DSN) {
50
50
  Sentry.init({
51
51
  dsn: DSN,
52
52
  environment: process.env.SENTRY_ENVIRONMENT ?? "production",
53
- release: "9.221.3",
53
+ release: "9.221.5",
54
54
  sendDefaultPii: false,
55
55
  tracesSampleRate: 0,
56
56
  shutdownTimeout: 500,
@@ -69,7 +69,7 @@ if (DSN) {
69
69
  }
70
70
  });
71
71
  Sentry.setContext("cli", {
72
- version: "9.221.3",
72
+ version: "9.221.5",
73
73
  command: process.argv.slice(2).join(" ")
74
74
  });
75
75
  Sentry.setContext("runtime", {
@@ -146,4 +146,4 @@ async function configureGlobalProxyFromEnv() {
146
146
  export {
147
147
  configureGlobalProxyFromEnv
148
148
  };
149
- //# sourceMappingURL=chunk-YB6YZSND.js.map
149
+ //# sourceMappingURL=chunk-463VKP2V.js.map
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from "node:module";
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  MODEL_PROVIDER_TYPES
6
- } from "./chunk-IAZROOTJ.js";
6
+ } from "./chunk-PCBM5SRN.js";
7
7
  import {
8
8
  init_esm_shims
9
9
  } from "./chunk-DIRAZ3YX.js";
@@ -40,4 +40,4 @@ export {
40
40
  formatModelProviderRoute,
41
41
  formatModelPolicyStatus
42
42
  };
43
- //# sourceMappingURL=chunk-L4D7VYFA.js.map
43
+ //# sourceMappingURL=chunk-65CYJRLA.js.map
@@ -40,8 +40,32 @@ function formatDurationSeconds(seconds) {
40
40
  return `${seconds}s`;
41
41
  }
42
42
 
43
+ // src/lib/domain/schedule-utils.ts
44
+ init_esm_shims();
45
+ function formatRelativeTime(dateStr) {
46
+ if (!dateStr) return "-";
47
+ const date = new Date(dateStr);
48
+ const now = /* @__PURE__ */ new Date();
49
+ const diffMs = date.getTime() - now.getTime();
50
+ const diffAbs = Math.abs(diffMs);
51
+ const minutes = Math.floor(diffAbs / (1e3 * 60));
52
+ const hours = Math.floor(diffAbs / (1e3 * 60 * 60));
53
+ const days = Math.floor(diffAbs / (1e3 * 60 * 60 * 24));
54
+ const isPast = diffMs < 0;
55
+ if (days > 0) {
56
+ return isPast ? `${days}d ago` : `in ${days}d`;
57
+ } else if (hours > 0) {
58
+ return isPast ? `${hours}h ago` : `in ${hours}h`;
59
+ } else if (minutes > 0) {
60
+ return isPast ? `${minutes}m ago` : `in ${minutes}m`;
61
+ } else {
62
+ return isPast ? "just now" : "soon";
63
+ }
64
+ }
65
+
43
66
  export {
44
67
  parseDurationSeconds,
45
- formatDurationSeconds
68
+ formatDurationSeconds,
69
+ formatRelativeTime
46
70
  };
47
- //# sourceMappingURL=chunk-J7RLLIWI.js.map
71
+ //# sourceMappingURL=chunk-HQFETCZ6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/zero/automation/duration.ts","../src/lib/domain/schedule-utils.ts"],"sourcesContent":["/**\n * Human-friendly duration handling for loop triggers (`--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","/**\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"],"mappings":";;;;;;;;AAAA;AAIA,IAAM,mBAAmB;AAEzB,IAAM,eAAuC;AAAA,EAC3C,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG,KAAK;AAAA,EACR,GAAG,KAAK,KAAK;AACf;AAMO,SAAS,qBAAqB,OAAuB;AAC1D,QAAM,QAAQ,MAAM,MAAM,gBAAgB;AAC1C,MAAI,CAAC,OAAO;AACV,UAAM,IAAI;AAAA,MACR,sBAAsB,KAAK;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,QAAQ,SAAS,MAAM,CAAC,GAAI,EAAE;AACpC,MAAI,SAAS,GAAG;AACd,UAAM,IAAI,MAAM,sBAAsB,KAAK,8BAA8B;AAAA,EAC3E;AAEA,SAAO,QAAQ,aAAa,MAAM,CAAC,CAAE;AACvC;AAKO,SAAS,sBAAsB,SAAyB;AAC7D,aAAW,CAAC,MAAM,IAAI,KAAK;AAAA,IACzB,CAAC,KAAK,aAAa,CAAE;AAAA,IACrB,CAAC,KAAK,aAAa,CAAE;AAAA,IACrB,CAAC,KAAK,aAAa,CAAE;AAAA,EACvB,GAAY;AACV,QAAI,UAAU,SAAS,KAAK,WAAW,MAAM;AAC3C,aAAO,GAAG,UAAU,IAAI,GAAG,IAAI;AAAA,IACjC;AAAA,EACF;AACA,SAAO,GAAG,OAAO;AACnB;;;AC/CA;AAGO,SAAS,mBAAmB,SAAgC;AACjE,MAAI,CAAC,QAAS,QAAO;AAErB,QAAM,OAAO,IAAI,KAAK,OAAO;AAC7B,QAAM,MAAM,oBAAI,KAAK;AACrB,QAAM,SAAS,KAAK,QAAQ,IAAI,IAAI,QAAQ;AAC5C,QAAM,UAAU,KAAK,IAAI,MAAM;AAE/B,QAAM,UAAU,KAAK,MAAM,WAAW,MAAO,GAAG;AAChD,QAAM,QAAQ,KAAK,MAAM,WAAW,MAAO,KAAK,GAAG;AACnD,QAAM,OAAO,KAAK,MAAM,WAAW,MAAO,KAAK,KAAK,GAAG;AAEvD,QAAM,SAAS,SAAS;AAExB,MAAI,OAAO,GAAG;AACZ,WAAO,SAAS,GAAG,IAAI,UAAU,MAAM,IAAI;AAAA,EAC7C,WAAW,QAAQ,GAAG;AACpB,WAAO,SAAS,GAAG,KAAK,UAAU,MAAM,KAAK;AAAA,EAC/C,WAAW,UAAU,GAAG;AACtB,WAAO,SAAS,GAAG,OAAO,UAAU,MAAM,OAAO;AAAA,EACnD,OAAO;AACL,WAAO,SAAS,aAAa;AAAA,EAC/B;AACF;","names":[]}
@@ -8,7 +8,7 @@ import {
8
8
  parseSegment,
9
9
  splitPathSegments,
10
10
  validateBaseUrl
11
- } from "./chunk-IAZROOTJ.js";
11
+ } from "./chunk-PCBM5SRN.js";
12
12
  import {
13
13
  init_esm_shims
14
14
  } from "./chunk-DIRAZ3YX.js";
@@ -609,4 +609,4 @@ export {
609
609
  matchFirewallBaseUrl,
610
610
  findMatchingRoutingPermissions
611
611
  };
612
- //# sourceMappingURL=chunk-M7ZTZ3MX.js.map
612
+ //# sourceMappingURL=chunk-IFA2V7EW.js.map
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  loadFirewallPermissionMetadata,
6
6
  resolveFirewallMetadataPolicies
7
- } from "./chunk-S4Q6HXP6.js";
7
+ } from "./chunk-PX6FH3KT.js";
8
8
  import {
9
9
  source_default
10
10
  } from "./chunk-JUTUEPIR.js";
@@ -87,4 +87,4 @@ export {
87
87
  policyIcon,
88
88
  loadConnectorPermissionInfos
89
89
  };
90
- //# sourceMappingURL=chunk-OWKM4VZT.js.map
90
+ //# sourceMappingURL=chunk-IMZDXXSW.js.map
@@ -12,10 +12,10 @@ import {
12
12
  formatIsoTimestamp,
13
13
  isSupportedFramework,
14
14
  isUUID
15
- } from "./chunk-RGNTZQST.js";
15
+ } from "./chunk-UZJLZXGK.js";
16
16
  import {
17
17
  searchZeroLogs
18
- } from "./chunk-IAZROOTJ.js";
18
+ } from "./chunk-PCBM5SRN.js";
19
19
  import {
20
20
  withErrorHandler
21
21
  } from "./chunk-3F4RFLPX.js";
@@ -178,4 +178,4 @@ export {
178
178
  runLogsSearch,
179
179
  searchCommand
180
180
  };
181
- //# sourceMappingURL=chunk-XPUOYFGN.js.map
181
+ //# sourceMappingURL=chunk-PB7YKTIG.js.map