@vm0/cli 9.240.1 → 9.240.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/{agent-CC6SKDTE.js → agent-UU6BOD2Y.js} +5 -5
  2. package/{banking-KWWMVUGE.js → banking-TZDM6FPW.js} +3 -3
  3. package/{chat-EB6RKC6E.js → chat-VK7ROWG4.js} +4 -4
  4. package/{chunk-GV7CTPQI.js → chunk-23L3UUHO.js} +2 -2
  5. package/{chunk-GV7CTPQI.js.map → chunk-23L3UUHO.js.map} +1 -1
  6. package/{chunk-6F7XCWTU.js → chunk-3B4I4CZP.js} +2 -2
  7. package/{chunk-6F7XCWTU.js.map → chunk-3B4I4CZP.js.map} +1 -1
  8. package/{chunk-6ALDWWYS.js → chunk-FPEMD2NK.js} +2 -2
  9. package/{chunk-N6YH4JM3.js → chunk-IE6CD57U.js} +249 -170
  10. package/{chunk-N6YH4JM3.js.map → chunk-IE6CD57U.js.map} +1 -1
  11. package/{chunk-JWMJI6LS.js → chunk-IS7CXTNO.js} +4 -4
  12. package/{chunk-T5QRISGA.js → chunk-MKADDVH4.js} +19 -12
  13. package/chunk-MKADDVH4.js.map +1 -0
  14. package/{chunk-TYAWHQIR.js → chunk-MZ5MFXZ2.js} +2 -2
  15. package/{chunk-P4YM6FO3.js → chunk-TFOOMGCO.js} +3 -3
  16. package/{chunk-BESFDD3J.js → chunk-XQJWG3AG.js} +4 -4
  17. package/{chunk-GCIVQ5K7.js → chunk-YZCOVBMW.js} +9 -6
  18. package/chunk-YZCOVBMW.js.map +1 -0
  19. package/{computer-use-426SRXJY.js → computer-use-KTH27AG6.js} +3 -3
  20. package/{connector-6YIJ22VY.js → connector-5FB755QM.js} +4 -4
  21. package/{credit-MFMIQSDG.js → credit-TYXZRPFJ.js} +4 -4
  22. package/{developer-support-4O3ZV5VX.js → developer-support-YABCSEMY.js} +3 -3
  23. package/{doctor-YAHO7PJO.js → doctor-NV2P53SL.js} +5 -5
  24. package/{generate-CRNYFBIA.js → generate-ZEZEBATN.js} +5 -5
  25. package/{github-IZZ5W7R6.js → github-QQD7WEMP.js} +3 -3
  26. package/{goal-VIHAN4UG.js → goal-PB4CUVZA.js} +3 -3
  27. package/{host-AU4NSTEP.js → host-S3MAPKUG.js} +3 -3
  28. package/index.js +13 -13
  29. package/{logs-5MBUXZNI.js → logs-MLHFYXLR.js} +6 -6
  30. package/{maps-A4LBRA2Y.js → maps-IZRQS3JF.js} +3 -3
  31. package/{memory-4PLVIY7G.js → memory-J2WMMWSW.js} +3 -3
  32. package/{model-W34GOPB2.js → model-AWWXJUSK.js} +4 -4
  33. package/{model-provider-JMMU4LX3.js → model-provider-2IGQIWVG.js} +4 -4
  34. package/{org-FTGVJKXD.js → org-UYMEOGMZ.js} +3 -3
  35. package/package.json +1 -1
  36. package/{phone-PWHTCFSV.js → phone-26UXR2H2.js} +3 -3
  37. package/{preference-FMWABHOM.js → preference-DBYEHWGL.js} +3 -3
  38. package/{relationship-JK3EQGKR.js → relationship-PXMVIY2D.js} +3 -3
  39. package/{resource-VYIAC4ZQ.js → resource-FNKXDYGT.js} +4 -4
  40. package/{scrape-6EWMP2VJ.js → scrape-UYHZKOR7.js} +3 -3
  41. package/{search-333ILFPD.js → search-ABLZROBC.js} +6 -6
  42. package/{secret-XZFCBXQ4.js → secret-O5WPHVWS.js} +3 -3
  43. package/{slack-Y55PSFEQ.js → slack-HKNKQ4RF.js} +3 -3
  44. package/{teams-MU7O2ZUN.js → teams-4QW3KZWP.js} +3 -3
  45. package/{telegram-JVCLCOBW.js → telegram-K3XIZ7A2.js} +3 -3
  46. package/{variable-M32OKII3.js → variable-LY3F7PLD.js} +3 -3
  47. package/{video-EYLIFRKL.js → video-UY3U3BVR.js} +2 -2
  48. package/{web-MWIJ225B.js → web-K36WUVBQ.js} +3 -3
  49. package/{whoami-C7WISJD6.js → whoami-SECUPAZ5.js} +5 -5
  50. package/{workflow-NSKFK6TX.js → workflow-Q2XBT6JV.js} +292 -263
  51. package/workflow-Q2XBT6JV.js.map +1 -0
  52. package/zero.js +35 -35
  53. package/chunk-GCIVQ5K7.js.map +0 -1
  54. package/chunk-T5QRISGA.js.map +0 -1
  55. package/workflow-NSKFK6TX.js.map +0 -1
  56. /package/{agent-CC6SKDTE.js.map → agent-UU6BOD2Y.js.map} +0 -0
  57. /package/{banking-KWWMVUGE.js.map → banking-TZDM6FPW.js.map} +0 -0
  58. /package/{chat-EB6RKC6E.js.map → chat-VK7ROWG4.js.map} +0 -0
  59. /package/{chunk-6ALDWWYS.js.map → chunk-FPEMD2NK.js.map} +0 -0
  60. /package/{chunk-JWMJI6LS.js.map → chunk-IS7CXTNO.js.map} +0 -0
  61. /package/{chunk-TYAWHQIR.js.map → chunk-MZ5MFXZ2.js.map} +0 -0
  62. /package/{chunk-P4YM6FO3.js.map → chunk-TFOOMGCO.js.map} +0 -0
  63. /package/{chunk-BESFDD3J.js.map → chunk-XQJWG3AG.js.map} +0 -0
  64. /package/{computer-use-426SRXJY.js.map → computer-use-KTH27AG6.js.map} +0 -0
  65. /package/{connector-6YIJ22VY.js.map → connector-5FB755QM.js.map} +0 -0
  66. /package/{credit-MFMIQSDG.js.map → credit-TYXZRPFJ.js.map} +0 -0
  67. /package/{developer-support-4O3ZV5VX.js.map → developer-support-YABCSEMY.js.map} +0 -0
  68. /package/{doctor-YAHO7PJO.js.map → doctor-NV2P53SL.js.map} +0 -0
  69. /package/{generate-CRNYFBIA.js.map → generate-ZEZEBATN.js.map} +0 -0
  70. /package/{github-IZZ5W7R6.js.map → github-QQD7WEMP.js.map} +0 -0
  71. /package/{goal-VIHAN4UG.js.map → goal-PB4CUVZA.js.map} +0 -0
  72. /package/{host-AU4NSTEP.js.map → host-S3MAPKUG.js.map} +0 -0
  73. /package/{logs-5MBUXZNI.js.map → logs-MLHFYXLR.js.map} +0 -0
  74. /package/{maps-A4LBRA2Y.js.map → maps-IZRQS3JF.js.map} +0 -0
  75. /package/{memory-4PLVIY7G.js.map → memory-J2WMMWSW.js.map} +0 -0
  76. /package/{model-W34GOPB2.js.map → model-AWWXJUSK.js.map} +0 -0
  77. /package/{model-provider-JMMU4LX3.js.map → model-provider-2IGQIWVG.js.map} +0 -0
  78. /package/{org-FTGVJKXD.js.map → org-UYMEOGMZ.js.map} +0 -0
  79. /package/{phone-PWHTCFSV.js.map → phone-26UXR2H2.js.map} +0 -0
  80. /package/{preference-FMWABHOM.js.map → preference-DBYEHWGL.js.map} +0 -0
  81. /package/{relationship-JK3EQGKR.js.map → relationship-PXMVIY2D.js.map} +0 -0
  82. /package/{resource-VYIAC4ZQ.js.map → resource-FNKXDYGT.js.map} +0 -0
  83. /package/{scrape-6EWMP2VJ.js.map → scrape-UYHZKOR7.js.map} +0 -0
  84. /package/{search-333ILFPD.js.map → search-ABLZROBC.js.map} +0 -0
  85. /package/{secret-XZFCBXQ4.js.map → secret-O5WPHVWS.js.map} +0 -0
  86. /package/{slack-Y55PSFEQ.js.map → slack-HKNKQ4RF.js.map} +0 -0
  87. /package/{teams-MU7O2ZUN.js.map → teams-4QW3KZWP.js.map} +0 -0
  88. /package/{telegram-JVCLCOBW.js.map → telegram-K3XIZ7A2.js.map} +0 -0
  89. /package/{variable-M32OKII3.js.map → variable-LY3F7PLD.js.map} +0 -0
  90. /package/{video-EYLIFRKL.js.map → video-UY3U3BVR.js.map} +0 -0
  91. /package/{web-MWIJ225B.js.map → web-K36WUVBQ.js.map} +0 -0
  92. /package/{whoami-C7WISJD6.js.map → whoami-SECUPAZ5.js.map} +0 -0
@@ -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/index.ts","../src/commands/zero/shared/duration.ts","../src/commands/zero/workflow/automation/display.ts","../src/lib/domain/relative-time.ts","../src/commands/zero/workflow/automation/gmail-config.ts","../src/commands/zero/workflow/legacy-trigger.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\";\nimport { legacyTriggerCommand } from \"./legacy-trigger\";\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 .addCommand(legacyTriggerCommand, { hidden: true })\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 } 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 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(` ID: ${workflow.id}`);\n console.log(` Agent Name: ${formatWorkflowAgentName(workflow)}`);\n console.log(` Agent ID: ${workflow.agentId}`);\n console.log();\n console.log(`View it: zero workflow view ${workflow.id}`);\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type {\n GithubLabelAppliedSubjectFilter,\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 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}\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 \"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 for github-label-applied: me | anyone\",\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 hasGithubAutomationOptions(\n options: AddOptions | UpdateOptions,\n): boolean {\n return options.subject !== undefined || options.actor !== undefined;\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\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 return {\n kind: \"event\",\n eventType: \"github-label-applied\",\n eventConfig: buildGithubLabelAppliedEventConfig(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 \"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 (!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 (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 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 label automations require the GitHub App installation in the workspace\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 Gmail match 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 )\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","/**\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","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 \"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\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 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","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","import { Command } from \"commander\";\n\n// Remove with the legacy API aliases after the #21408 migration window.\nexport const legacyTriggerCommand = new Command(\"trigger\")\n .helpOption(false)\n .allowUnknownOption()\n .argument(\"[args...]\")\n .action(() => {\n console.error(\"renamed: use zero workflow automation\");\n process.exit(1);\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,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W,aAAa,EACxB,WAAW,WAAW,EACtB,WAAW,iBAAiB,EAC5B,WAAW,sBAAsB,EAAE,QAAQ,KAAK,CAAC,EACjD;AAAA,EACC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASF;","names":["readFileSync","readFileSync","readFileSync","readFileSync","readFileSync","listCommand"]}
package/zero.js CHANGED
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from "node:module";
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  configureGlobalProxyFromEnv
6
- } from "./chunk-P4YM6FO3.js";
6
+ } from "./chunk-TFOOMGCO.js";
7
7
  import {
8
8
  decodeZeroTokenPayload
9
9
  } from "./chunk-LRHXR7JT.js";
@@ -53,154 +53,154 @@ var ZERO_COMMAND_DEFINITIONS = [
53
53
  name: "org",
54
54
  description: "Manage organization settings, members, and providers",
55
55
  load: async () => {
56
- return (await import("./org-FTGVJKXD.js")).zeroOrgCommand;
56
+ return (await import("./org-UYMEOGMZ.js")).zeroOrgCommand;
57
57
  }
58
58
  },
59
59
  {
60
60
  name: "model",
61
61
  description: "List available models and model-switching guidance",
62
62
  load: async () => {
63
- return (await import("./model-W34GOPB2.js")).zeroModelCommand;
63
+ return (await import("./model-AWWXJUSK.js")).zeroModelCommand;
64
64
  }
65
65
  },
66
66
  {
67
67
  name: "model-provider",
68
68
  description: "Inspect model provider routing",
69
69
  load: async () => {
70
- return (await import("./model-provider-JMMU4LX3.js")).zeroModelProviderCommand;
70
+ return (await import("./model-provider-2IGQIWVG.js")).zeroModelProviderCommand;
71
71
  }
72
72
  },
73
73
  {
74
74
  name: "agent",
75
75
  description: "View or manage zero agents",
76
76
  load: async () => {
77
- return (await import("./agent-CC6SKDTE.js")).zeroAgentCommand;
77
+ return (await import("./agent-UU6BOD2Y.js")).zeroAgentCommand;
78
78
  }
79
79
  },
80
80
  {
81
81
  name: "connector",
82
82
  description: "Check third-party service connections (GitHub, Slack, etc.)",
83
83
  load: async () => {
84
- return (await import("./connector-6YIJ22VY.js")).zeroConnectorCommand;
84
+ return (await import("./connector-5FB755QM.js")).zeroConnectorCommand;
85
85
  }
86
86
  },
87
87
  {
88
88
  name: "relationship",
89
89
  description: "Query relationship memory",
90
90
  load: async () => {
91
- return (await import("./relationship-JK3EQGKR.js")).zeroRelationshipCommand;
91
+ return (await import("./relationship-PXMVIY2D.js")).zeroRelationshipCommand;
92
92
  }
93
93
  },
94
94
  {
95
95
  name: "memory",
96
96
  description: "Recall structured memory",
97
97
  load: async () => {
98
- return (await import("./memory-4PLVIY7G.js")).zeroMemoryCommand;
98
+ return (await import("./memory-J2WMMWSW.js")).zeroMemoryCommand;
99
99
  }
100
100
  },
101
101
  {
102
102
  name: "credit",
103
103
  description: "View or buy credits",
104
104
  load: async () => {
105
- return (await import("./credit-MFMIQSDG.js")).zeroCreditCommand;
105
+ return (await import("./credit-TYXZRPFJ.js")).zeroCreditCommand;
106
106
  }
107
107
  },
108
108
  {
109
109
  name: "doctor",
110
110
  description: "Diagnose runtime issues (connector health, permission denials)",
111
111
  load: async () => {
112
- return (await import("./doctor-YAHO7PJO.js")).zeroDoctorCommand;
112
+ return (await import("./doctor-NV2P53SL.js")).zeroDoctorCommand;
113
113
  }
114
114
  },
115
115
  {
116
116
  name: "preference",
117
117
  description: "View or update user preferences (timezone, notifications)",
118
118
  load: async () => {
119
- return (await import("./preference-FMWABHOM.js")).zeroPreferenceCommand;
119
+ return (await import("./preference-DBYEHWGL.js")).zeroPreferenceCommand;
120
120
  }
121
121
  },
122
122
  {
123
123
  name: "secret",
124
124
  description: "Read or write secrets (API keys, tokens)",
125
125
  load: async () => {
126
- return (await import("./secret-XZFCBXQ4.js")).zeroSecretCommand;
126
+ return (await import("./secret-O5WPHVWS.js")).zeroSecretCommand;
127
127
  }
128
128
  },
129
129
  {
130
130
  name: "github",
131
131
  description: "Upload and download GitHub files",
132
132
  load: async () => {
133
- return (await import("./github-IZZ5W7R6.js")).zeroGithubCommand;
133
+ return (await import("./github-QQD7WEMP.js")).zeroGithubCommand;
134
134
  }
135
135
  },
136
136
  {
137
137
  name: "slack",
138
138
  description: "Send messages, upload files, and download files from Slack as the bot",
139
139
  load: async () => {
140
- return (await import("./slack-Y55PSFEQ.js")).zeroSlackCommand;
140
+ return (await import("./slack-HKNKQ4RF.js")).zeroSlackCommand;
141
141
  }
142
142
  },
143
143
  {
144
144
  name: "teams",
145
145
  description: "Send Microsoft Teams messages, upload files, and download files",
146
146
  load: async () => {
147
- return (await import("./teams-MU7O2ZUN.js")).zeroTeamsCommand;
147
+ return (await import("./teams-4QW3KZWP.js")).zeroTeamsCommand;
148
148
  }
149
149
  },
150
150
  {
151
151
  name: "telegram",
152
152
  description: "Inspect bots, send messages, upload files, and download files from Telegram",
153
153
  load: async () => {
154
- return (await import("./telegram-JVCLCOBW.js")).zeroTelegramCommand;
154
+ return (await import("./telegram-K3XIZ7A2.js")).zeroTelegramCommand;
155
155
  }
156
156
  },
157
157
  {
158
158
  name: "phone",
159
159
  description: "Send AgentPhone messages, upload files, and download media",
160
160
  load: async () => {
161
- return (await import("./phone-PWHTCFSV.js")).zeroPhoneCommand;
161
+ return (await import("./phone-26UXR2H2.js")).zeroPhoneCommand;
162
162
  }
163
163
  },
164
164
  {
165
165
  name: "variable",
166
166
  description: "Read or write non-sensitive configuration values",
167
167
  load: async () => {
168
- return (await import("./variable-M32OKII3.js")).zeroVariableCommand;
168
+ return (await import("./variable-LY3F7PLD.js")).zeroVariableCommand;
169
169
  }
170
170
  },
171
171
  {
172
172
  name: "logs",
173
173
  description: "View and search agent run logs",
174
174
  load: async () => {
175
- return (await import("./logs-5MBUXZNI.js")).zeroLogsCommand;
175
+ return (await import("./logs-MLHFYXLR.js")).zeroLogsCommand;
176
176
  }
177
177
  },
178
178
  {
179
179
  name: "search",
180
180
  description: "Search logs, chat, or get a recipe for external sources",
181
181
  load: async () => {
182
- return (await import("./search-333ILFPD.js")).zeroSearchCommand;
182
+ return (await import("./search-ABLZROBC.js")).zeroSearchCommand;
183
183
  }
184
184
  },
185
185
  {
186
186
  name: "chat",
187
187
  description: "Manage the current web chat thread",
188
188
  load: async () => {
189
- return (await import("./chat-EB6RKC6E.js")).zeroChatCommand;
189
+ return (await import("./chat-VK7ROWG4.js")).zeroChatCommand;
190
190
  }
191
191
  },
192
192
  {
193
193
  name: "resource",
194
194
  description: "Pull registry resources from private R2-backed archives",
195
195
  load: async () => {
196
- return (await import("./resource-VYIAC4ZQ.js")).zeroResourceCommand;
196
+ return (await import("./resource-FNKXDYGT.js")).zeroResourceCommand;
197
197
  }
198
198
  },
199
199
  {
200
200
  name: "whoami",
201
201
  description: "Show agent identity, run ID, and capabilities",
202
202
  load: async () => {
203
- return (await import("./whoami-C7WISJD6.js")).zeroWhoamiCommand;
203
+ return (await import("./whoami-SECUPAZ5.js")).zeroWhoamiCommand;
204
204
  }
205
205
  },
206
206
  {
@@ -214,77 +214,77 @@ var ZERO_COMMAND_DEFINITIONS = [
214
214
  name: "workflow",
215
215
  description: "Manage workflows",
216
216
  load: async () => {
217
- return (await import("./workflow-NSKFK6TX.js")).zeroWorkflowCommand;
217
+ return (await import("./workflow-Q2XBT6JV.js")).zeroWorkflowCommand;
218
218
  }
219
219
  },
220
220
  {
221
221
  name: "goal",
222
222
  description: "Manage the current thread goal",
223
223
  load: async () => {
224
- return (await import("./goal-VIHAN4UG.js")).zeroGoalCommand;
224
+ return (await import("./goal-PB4CUVZA.js")).zeroGoalCommand;
225
225
  }
226
226
  },
227
227
  {
228
228
  name: "developer-support",
229
229
  description: "Submit a diagnostic report to the dev team",
230
230
  load: async () => {
231
- return (await import("./developer-support-4O3ZV5VX.js")).zeroDeveloperSupportCommand;
231
+ return (await import("./developer-support-YABCSEMY.js")).zeroDeveloperSupportCommand;
232
232
  }
233
233
  },
234
234
  {
235
235
  name: "computer-use",
236
236
  description: "Desktop app computer use through Zero CLI",
237
237
  load: async () => {
238
- return (await import("./computer-use-426SRXJY.js")).zeroComputerUseCommand;
238
+ return (await import("./computer-use-KTH27AG6.js")).zeroComputerUseCommand;
239
239
  }
240
240
  },
241
241
  {
242
242
  name: "generate",
243
243
  description: "Generate assets via vm0's built-in pipelines or get connector skill-invocation guidance",
244
244
  load: async () => {
245
- return (await import("./generate-CRNYFBIA.js")).generateCommand;
245
+ return (await import("./generate-ZEZEBATN.js")).generateCommand;
246
246
  }
247
247
  },
248
248
  {
249
249
  name: "web",
250
250
  description: "Upload and download files via the web chat endpoint",
251
251
  load: async () => {
252
- return (await import("./web-MWIJ225B.js")).zeroWebCommand;
252
+ return (await import("./web-K36WUVBQ.js")).zeroWebCommand;
253
253
  }
254
254
  },
255
255
  {
256
256
  name: "video",
257
257
  description: "Video processing utilities",
258
258
  load: async () => {
259
- return (await import("./video-EYLIFRKL.js")).zeroVideoCommand;
259
+ return (await import("./video-UY3U3BVR.js")).zeroVideoCommand;
260
260
  }
261
261
  },
262
262
  {
263
263
  name: "host",
264
264
  description: "Publish static sites and clone owned hosted site files",
265
265
  load: async () => {
266
- return (await import("./host-AU4NSTEP.js")).zeroHostCommand;
266
+ return (await import("./host-S3MAPKUG.js")).zeroHostCommand;
267
267
  }
268
268
  },
269
269
  {
270
270
  name: "maps",
271
271
  description: "Use managed zero maps services",
272
272
  load: async () => {
273
- return (await import("./maps-A4LBRA2Y.js")).zeroMapsCommand;
273
+ return (await import("./maps-IZRQS3JF.js")).zeroMapsCommand;
274
274
  }
275
275
  },
276
276
  {
277
277
  name: "scrape",
278
278
  description: "Scrape public web pages through managed zero scrape",
279
279
  load: async () => {
280
- return (await import("./scrape-6EWMP2VJ.js")).zeroScrapeCommand;
280
+ return (await import("./scrape-UYHZKOR7.js")).zeroScrapeCommand;
281
281
  }
282
282
  },
283
283
  {
284
284
  name: "banking",
285
285
  description: "Use managed zero banking services",
286
286
  load: async () => {
287
- return (await import("./banking-KWWMVUGE.js")).zeroBankingCommand;
287
+ return (await import("./banking-TZDM6FPW.js")).zeroBankingCommand;
288
288
  }
289
289
  }
290
290
  ];
@@ -398,7 +398,7 @@ function registerZeroCommands(prog, commands) {
398
398
  var program = new Command();
399
399
  program.name("zero").description(
400
400
  "Zero CLI \u2014 interact with the zero platform from inside the sandbox"
401
- ).version("9.240.1").addHelpText("after", () => {
401
+ ).version("9.240.3").addHelpText("after", () => {
402
402
  return buildZeroHelpText();
403
403
  });
404
404
  if (process.argv[1]?.endsWith("zero.js") || process.argv[1]?.endsWith("zero.ts") || process.argv[1]?.endsWith("zero")) {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/zero/doctor/platform-url.ts"],"sourcesContent":["import { getApiUrl } from \"../../../lib/api/config\";\n\n/**\n * Transform the API host to the platform (app) host.\n *\n * www.vm0.ai → app.vm0.ai\n * platform.vm0.ai → app.vm0.ai\n * tunnel-user-host-www.vm7.ai → tunnel-user-host-app.vm7.ai\n * custom.example.com → app.custom.example.com\n */\nexport function toPlatformUrl(apiUrl: string): URL {\n const parsed = new URL(apiUrl);\n const parts = parsed.hostname.split(\".\");\n if (parts[0]!.endsWith(\"-www\")) {\n parts[0] = parts[0]!.slice(0, -\"-www\".length) + \"-app\";\n } else if (parts[0] === \"www\" || parts[0] === \"platform\") {\n parts[0] = \"app\";\n } else if (parts[0] !== \"app\" && parts[0] !== \"localhost\") {\n parts.unshift(\"app\");\n }\n parsed.hostname = parts.join(\".\");\n return parsed;\n}\n\nexport async function getPlatformOrigin(): Promise<string> {\n const apiUrl = await getApiUrl();\n return toPlatformUrl(apiUrl).origin;\n}\n"],"mappings":";;;;;;;;;;;AAAA;AAUO,SAAS,cAAc,QAAqB;AACjD,QAAM,SAAS,IAAI,IAAI,MAAM;AAC7B,QAAM,QAAQ,OAAO,SAAS,MAAM,GAAG;AACvC,MAAI,MAAM,CAAC,EAAG,SAAS,MAAM,GAAG;AAC9B,UAAM,CAAC,IAAI,MAAM,CAAC,EAAG,MAAM,GAAG,CAAC,OAAO,MAAM,IAAI;AAAA,EAClD,WAAW,MAAM,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,YAAY;AACxD,UAAM,CAAC,IAAI;AAAA,EACb,WAAW,MAAM,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,aAAa;AACzD,UAAM,QAAQ,KAAK;AAAA,EACrB;AACA,SAAO,WAAW,MAAM,KAAK,GAAG;AAChC,SAAO;AACT;AAEA,eAAsB,oBAAqC;AACzD,QAAM,SAAS,MAAM,UAAU;AAC/B,SAAO,cAAc,MAAM,EAAE;AAC/B;","names":[]}