@vm0/cli 9.180.3 → 9.180.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/zero.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/zero.ts","../src/commands/zero/org/index.ts","../src/commands/zero/org/status.ts","../src/commands/zero/org/set.ts","../src/commands/zero/org/list.ts","../src/commands/zero/org/use.ts","../src/commands/zero/org/members.ts","../src/commands/zero/org/invite.ts","../src/commands/zero/org/remove.ts","../src/commands/zero/org/leave.ts","../src/commands/zero/org/delete.ts","../src/commands/zero/org/secret/index.ts","../src/commands/zero/org/secret/list.ts","../src/commands/zero/org/secret/set.ts","../src/commands/zero/org/secret/remove.ts","../src/commands/zero/org/variable/index.ts","../src/commands/zero/org/variable/list.ts","../src/commands/zero/org/variable/set.ts","../src/commands/zero/org/variable/remove.ts","../src/commands/zero/org/model-provider/index.ts","../src/commands/zero/org/model-provider/list.ts","../src/commands/zero/org/model-provider/setup.ts","../src/lib/domain/model-provider/shared.ts","../src/commands/zero/org/model-provider/remove.ts","../src/commands/zero/agent/index.ts","../src/commands/zero/agent/create.ts","../src/commands/zero/agent/avatar.ts","../src/commands/zero/agent/edit.ts","../src/commands/zero/agent/view.ts","../src/lib/utils/format-utils.ts","../src/commands/zero/agent/list.ts","../src/commands/zero/agent/delete.ts","../src/commands/zero/connector/index.ts","../src/commands/zero/connector/connect.ts","../src/commands/zero/connector/list.ts","../src/commands/zero/connector/agent-context.ts","../src/commands/zero/connector/connected-as.ts","../src/commands/zero/connector/search.ts","../../../packages/connectors/src/connector-search.ts","../src/commands/zero/connector/status.ts","../src/lib/domain/schedule-utils.ts","../src/commands/zero/doctor/platform-url.ts","../src/commands/zero/credit.ts","../src/commands/zero/doctor/index.ts","../src/commands/zero/doctor/check-connector.ts","../src/commands/zero/doctor/permission-deny.ts","../src/commands/zero/doctor/permission-context.ts","../src/commands/zero/doctor/permission-change.ts","../src/commands/zero/doctor/credit.ts","../src/commands/zero/preference/index.ts","../src/commands/zero/run/index.ts","../src/commands/zero/run/run.ts","../src/commands/zero/run/shared.ts","../src/commands/zero/run/continue.ts","../src/commands/zero/schedule/index.ts","../src/commands/zero/schedule/setup.ts","../src/commands/zero/schedule/list.ts","../src/commands/zero/schedule/status.ts","../src/commands/zero/schedule/delete.ts","../src/commands/zero/schedule/enable.ts","../src/commands/zero/schedule/disable.ts","../src/commands/zero/secret/index.ts","../src/commands/zero/secret/list.ts","../src/commands/zero/secret/set.ts","../src/commands/zero/secret/delete.ts","../src/commands/zero/chat/index.ts","../src/commands/zero/chat/message/index.ts","../src/commands/zero/chat/message/send.ts","../src/commands/zero/github/index.ts","../src/commands/zero/github/download-file.ts","../src/commands/zero/github/label-listener/index.ts","../src/commands/zero/github/upload-file.ts","../src/commands/zero/slack/index.ts","../src/commands/zero/slack/message/index.ts","../src/commands/zero/slack/message/send.ts","../src/commands/zero/slack/upload-file.ts","../src/commands/zero/slack/download-file.ts","../src/commands/zero/telegram/index.ts","../src/commands/zero/telegram/bot/index.ts","../src/commands/zero/telegram/bot/list.ts","../src/commands/zero/telegram/download-file.ts","../src/commands/zero/telegram/message/index.ts","../src/commands/zero/telegram/message/send.ts","../src/commands/zero/telegram/upload-file.ts","../src/commands/zero/phone/index.ts","../src/commands/zero/phone/download-file.ts","../src/commands/zero/phone/message.ts","../src/commands/zero/phone/upload-file.ts","../src/commands/zero/variable/index.ts","../src/commands/zero/variable/list.ts","../src/commands/zero/variable/set.ts","../src/commands/zero/variable/delete.ts","../src/commands/zero/whoami.ts","../src/commands/zero/skill/index.ts","../src/commands/zero/skill/create.ts","../src/lib/skill-directory.ts","../src/commands/zero/skill/edit.ts","../src/commands/zero/skill/view.ts","../src/commands/zero/skill/list.ts","../src/commands/zero/skill/delete.ts","../src/commands/zero/logs/index.ts","../src/commands/zero/logs/list.ts","../src/commands/zero/logs/search.ts","../src/commands/zero/search/index.ts","../src/commands/zero/developer-support.ts","../src/commands/zero/computer-use/index.ts","../src/commands/zero/generate/index.ts","../src/commands/zero/generate/image.ts","../src/commands/zero/shared/image-generate.ts","../src/commands/zero/shared/image-style-authoring.ts","../src/commands/zero/shared/resource-registry.ts","../src/commands/zero/shared/resource-listing.ts","../src/commands/zero/generate/lib/dispatch.ts","../src/commands/zero/generate/lib/connector-guidance.ts","../src/commands/zero/generate/lib/lister.ts","../src/commands/zero/generate/artifacts.ts","../src/commands/zero/shared/artifact-generate.ts","../src/commands/zero/shared/html-artifact-authoring.ts","../src/commands/zero/generate/presentation.ts","../src/commands/zero/shared/presentation-generate.ts","../src/commands/zero/generate/sprite.ts","../src/commands/zero/shared/sprite-authoring.ts","../src/commands/zero/generate/video.ts","../src/commands/zero/shared/video-generate.ts","../src/commands/zero/generate/website.ts","../src/commands/zero/generate/voice.ts","../src/commands/zero/shared/voice-generate.ts","../src/commands/zero/generate/lister-only.ts","../src/commands/zero/web/index.ts","../src/commands/zero/web/download-file.ts","../src/commands/zero/web/upload-file.ts","../src/commands/zero/host/index.ts","../src/lib/host/publish-static-site.ts","../src/lib/host/static-site.ts","../src/commands/zero/maps/index.ts","../src/commands/zero/banking/index.ts","../src/commands/zero/model/index.ts","../src/lib/domain/model-policy-display.ts","../src/commands/zero/model-provider/index.ts"],"sourcesContent":["// Zero CLI entry point - standalone binary for zero platform commands\n// Sentry must be initialized before any other imports\nimport \"./instrument.js\";\nimport { Command } from \"commander\";\nimport { configureGlobalProxyFromEnv } from \"./lib/network/proxy.js\";\nimport { zeroOrgCommand } from \"./commands/zero/org\";\nimport { zeroAgentCommand } from \"./commands/zero/agent\";\nimport { zeroConnectorCommand } from \"./commands/zero/connector\";\nimport { zeroCreditCommand } from \"./commands/zero/credit\";\nimport { zeroDoctorCommand } from \"./commands/zero/doctor\";\nimport { zeroPreferenceCommand } from \"./commands/zero/preference\";\nimport { zeroRunCommand } from \"./commands/zero/run\";\nimport { zeroScheduleCommand } from \"./commands/zero/schedule\";\nimport { zeroSecretCommand } from \"./commands/zero/secret\";\nimport { zeroChatCommand } from \"./commands/zero/chat\";\nimport { zeroGithubCommand } from \"./commands/zero/github\";\nimport { zeroSlackCommand } from \"./commands/zero/slack\";\nimport { zeroTelegramCommand } from \"./commands/zero/telegram\";\nimport { zeroPhoneCommand } from \"./commands/zero/phone\";\nimport { zeroVariableCommand } from \"./commands/zero/variable\";\nimport { zeroWhoamiCommand } from \"./commands/zero/whoami\";\nimport { zeroSkillCommand } from \"./commands/zero/skill\";\nimport { zeroLogsCommand } from \"./commands/zero/logs\";\nimport { zeroSearchCommand } from \"./commands/zero/search\";\nimport { zeroDeveloperSupportCommand } from \"./commands/zero/developer-support\";\nimport { zeroComputerUseCommand } from \"./commands/zero/computer-use\";\nimport { generateCommand } from \"./commands/zero/generate\";\nimport { zeroWebCommand } from \"./commands/zero/web\";\nimport { zeroHostCommand } from \"./commands/zero/host\";\nimport { zeroMapsCommand } from \"./commands/zero/maps\";\nimport { zeroBankingCommand } from \"./commands/zero/banking\";\nimport { zeroModelCommand } from \"./commands/zero/model\";\nimport { zeroModelProviderCommand } from \"./commands/zero/model-provider\";\nimport {\n decodeZeroTokenPayload,\n type ZeroTokenPayload,\n} from \"./lib/api/zero-token.js\";\n\n/**\n * Map of command names to the capability required to see them.\n * Commands not in this map are hidden when ZERO_TOKEN is active.\n * Use an array when a top-level command has subcommands with different\n * capability gates and any one of them should make the command visible.\n * Use `null` for commands that should always be visible in sandbox.\n */\nconst COMMAND_CAPABILITY_MAP: Record<\n string,\n string | readonly string[] | null\n> = {\n agent: \"agent:read\",\n skill: \"agent:read\",\n connector: \"connector:read\",\n run: \"agent-run:write\",\n schedule: \"schedule:read\",\n doctor: null,\n credit: \"billing:write\",\n model: null,\n \"model-provider\": null,\n logs: \"agent-run:read\",\n search: \"chat-message:read\",\n chat: \"chat-message:write\",\n github: [\"github:read\", \"github:write\"],\n slack: \"slack:write\",\n telegram: [\"telegram:read\", \"telegram:write\"],\n phone: [\"phone:read\", \"phone:write\"],\n whoami: null,\n \"developer-support\": null,\n \"computer-use\": \"computer-use:write\",\n generate: null,\n web: null,\n host: \"host:write\",\n maps: \"maps:read\",\n banking: \"banking:read\",\n};\n\nconst DEFAULT_COMMANDS: Command[] = [\n zeroOrgCommand,\n zeroModelCommand,\n zeroModelProviderCommand,\n zeroAgentCommand,\n zeroConnectorCommand,\n zeroCreditCommand,\n zeroDoctorCommand,\n zeroPreferenceCommand,\n zeroRunCommand,\n zeroScheduleCommand,\n zeroSecretCommand,\n zeroChatCommand,\n zeroGithubCommand,\n zeroSlackCommand,\n zeroTelegramCommand,\n zeroPhoneCommand,\n zeroVariableCommand,\n zeroLogsCommand,\n zeroSearchCommand,\n zeroWhoamiCommand,\n zeroSkillCommand,\n zeroDeveloperSupportCommand,\n zeroComputerUseCommand,\n generateCommand,\n zeroWebCommand,\n zeroHostCommand,\n zeroMapsCommand,\n zeroBankingCommand,\n];\n\nfunction shouldHideCommand(\n name: string,\n payload: ZeroTokenPayload | undefined,\n): boolean {\n if (!payload) return false;\n const requiredCap = COMMAND_CAPABILITY_MAP[name];\n if (requiredCap === undefined) return true;\n if (requiredCap === null) return false;\n if (typeof requiredCap !== \"string\") {\n return !requiredCap.some((capability) => {\n return payload.capabilities.includes(capability);\n });\n }\n return !payload.capabilities.includes(requiredCap);\n}\n\nexport function buildZeroHelpText(\n payload: ZeroTokenPayload | undefined = decodeZeroTokenPayload(),\n): string {\n const examples = [\n \" Check a connector? zero doctor check-connector --env-name <ENV_NAME>\",\n ...(payload && !payload.capabilities.includes(\"billing:read\")\n ? []\n : [\" Check credits? zero doctor credit\"]),\n ...(shouldHideCommand(\"credit\", payload)\n ? []\n : [\" Buy credits? zero credit 20000\"]),\n \" Send a Slack message? zero slack message send --help\",\n \" Upload GitHub? zero github upload-file --help\",\n \" Download GitHub? zero github download-file --help\",\n \" List Telegram bots? zero telegram bot list\",\n \" Send Telegram? zero telegram message send --help\",\n \" Upload Telegram? zero telegram upload-file --help\",\n \" Download Telegram? zero telegram download-file --help\",\n \" Send AgentPhone? zero phone message --help\",\n \" Upload AgentPhone? zero phone upload-file --help\",\n \" Download AgentPhone? zero phone download-file --help\",\n \" Set up a schedule? zero schedule setup --help\",\n \" List models? zero model ls\",\n \" Model routing? zero model-provider ls\",\n \" Update yourself? zero agent --help\",\n \" Manage custom skills? zero skill --help\",\n \" List generators? zero generate --help\",\n ' Generate image? zero generate image --prompt \"...\"',\n ' Generate website? zero generate website --prompt \"...\"',\n ' Generate voice? zero generate voice --prompt \"...\"',\n ...(shouldHideCommand(\"host\", payload)\n ? []\n : [\" Host a static site? zero host ./dist --site my-site --spa\"]),\n ...(shouldHideCommand(\"maps\", payload)\n ? []\n : [\n ' Get directions? zero maps directions --origin \"SFO\" --destination \"Mountain View\" --json',\n ]),\n ...(shouldHideCommand(\"banking\", payload)\n ? []\n : [\" Read bank data? zero banking accounts --json\"]),\n \" Check your identity? zero whoami\",\n ];\n\n return `\\nExamples:\\n${examples.join(\"\\n\")}`;\n}\n\n/**\n * Register commands with visibility based on ZERO_TOKEN capabilities.\n * Commands not granted by the token are registered as hidden via\n * Commander's public `addCommand(cmd, { hidden: true })` API.\n * When no ZERO_TOKEN is present, all commands remain visible.\n *\n * @param commands - override default commands (used in tests)\n */\nexport function registerZeroCommands(\n prog: Command,\n commands?: Command[],\n): void {\n const token = process.env.ZERO_TOKEN;\n const payload = token ? decodeZeroTokenPayload(token) : undefined;\n\n for (const cmd of commands ?? DEFAULT_COMMANDS) {\n const hidden = shouldHideCommand(cmd.name(), payload);\n prog.addCommand(cmd, hidden ? { hidden: true } : {});\n }\n}\n\nconst program = new Command();\n\ndeclare const __CLI_VERSION__: string;\n\nprogram\n .name(\"zero\")\n .description(\n \"Zero CLI — interact with the zero platform from inside the sandbox\",\n )\n .version(__CLI_VERSION__)\n .addHelpText(\"after\", () => {\n return buildZeroHelpText();\n });\n\nexport { program };\n\nif (\n process.argv[1]?.endsWith(\"zero.js\") ||\n process.argv[1]?.endsWith(\"zero.ts\") ||\n process.argv[1]?.endsWith(\"zero\")\n) {\n configureGlobalProxyFromEnv();\n registerZeroCommands(program);\n program.parse();\n}\n","import { Command } from \"commander\";\nimport { statusCommand } from \"./status\";\nimport { setCommand } from \"./set\";\nimport { listCommand } from \"./list\";\nimport { useCommand } from \"./use\";\nimport { membersCommand } from \"./members\";\nimport { inviteCommand } from \"./invite\";\nimport { removeCommand } from \"./remove\";\nimport { leaveCommand } from \"./leave\";\nimport { deleteCommand } from \"./delete\";\nimport { zeroOrgSecretCommand } from \"./secret\";\nimport { zeroOrgVariableCommand } from \"./variable\";\nimport { zeroOrgModelProviderCommand } from \"./model-provider\";\n\nexport const zeroOrgCommand = new Command()\n .name(\"org\")\n .description(\"Manage organization settings, members, and providers\")\n .addCommand(statusCommand)\n .addCommand(setCommand)\n .addCommand(listCommand)\n .addCommand(useCommand)\n .addCommand(membersCommand)\n .addCommand(inviteCommand)\n .addCommand(removeCommand)\n .addCommand(leaveCommand)\n .addCommand(deleteCommand)\n .addCommand(zeroOrgSecretCommand)\n .addCommand(zeroOrgVariableCommand)\n .addCommand(zeroOrgModelProviderCommand);\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getZeroOrg } from \"../../../lib/api\";\nimport { ApiRequestError } from \"../../../lib/api/core/client-factory\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const statusCommand = new Command()\n .name(\"status\")\n .description(\"View current organization status\")\n .action(\n withErrorHandler(async () => {\n try {\n const org = await getZeroOrg();\n\n console.log(chalk.bold(\"Organization Information:\"));\n console.log(` Slug: ${chalk.green(org.slug)}`);\n } catch (error) {\n if (error instanceof ApiRequestError && error.status === 404) {\n throw new Error(\"No organization configured\", {\n cause: new Error(\"Set your organization with: zero org set <slug>\"),\n });\n }\n throw error;\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getZeroOrg, updateZeroOrg, switchZeroOrg } from \"../../../lib/api\";\nimport { saveConfig } from \"../../../lib/api/config\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const setCommand = new Command()\n .name(\"set\")\n .description(\"Rename your organization slug\")\n .argument(\"<slug>\", \"The new organization slug\")\n .option(\n \"--force\",\n \"Force change existing organization (may break references)\",\n )\n .action(\n withErrorHandler(async (slug: string, options: { force?: boolean }) => {\n try {\n const existingOrg = await getZeroOrg();\n\n if (!options.force) {\n throw new Error(\n `You already have an organization: ${existingOrg.slug}`,\n {\n cause: new Error(`To change, use: zero org set ${slug} --force`),\n },\n );\n }\n\n const org = await updateZeroOrg({ slug, force: true });\n\n const result = await switchZeroOrg(org.slug);\n await saveConfig({\n token: result.access_token,\n });\n\n console.log(chalk.green(`✓ Organization updated to ${org.slug}`));\n console.log();\n console.log(\"Your agents will now be namespaced as:\");\n console.log(chalk.cyan(` ${org.slug}/<agent-name>`));\n } catch (error) {\n if (\n error instanceof Error &&\n error.message.includes(\"already exists\")\n ) {\n throw new Error(\n `Organization \"${slug}\" is already taken. Please choose a different slug.`,\n );\n }\n throw error;\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroOrgs } from \"../../../lib/api\";\nimport { getActiveOrg } from \"../../../lib/api/config\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const listCommand = new Command()\n .name(\"list\")\n .description(\"List all accessible organizations\")\n .action(\n withErrorHandler(async () => {\n const result = await listZeroOrgs();\n const activeOrg = await getActiveOrg();\n\n console.log(chalk.bold(\"Available organizations:\"));\n for (const org of result.orgs) {\n const isCurrent = org.slug === activeOrg;\n const marker = isCurrent ? chalk.green(\"* \") : \" \";\n const roleLabel = org.role ? ` (${org.role})` : \"\";\n const currentLabel = isCurrent ? chalk.dim(\" ← current\") : \"\";\n console.log(`${marker}${org.slug}${roleLabel}${currentLabel}`);\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroOrgs, switchZeroOrg } from \"../../../lib/api\";\nimport { saveConfig } from \"../../../lib/api/config\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const useCommand = new Command()\n .name(\"use\")\n .description(\"Switch to a different organization\")\n .argument(\"<slug>\", \"Organization slug to switch to\")\n .action(\n withErrorHandler(async (slug: string) => {\n const orgList = await listZeroOrgs();\n const target = orgList.orgs.find((s) => {\n return s.slug === slug;\n });\n if (!target) {\n throw new Error(`Organization '${slug}' not found or not accessible.`);\n }\n\n const result = await switchZeroOrg(slug);\n await saveConfig({\n token: result.access_token,\n });\n console.log(chalk.green(`✓ Switched to organization: ${slug}`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getZeroOrgMembers } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const membersCommand = new Command()\n .name(\"members\")\n .description(\"View organization members\")\n .action(\n withErrorHandler(async () => {\n const status = await getZeroOrgMembers();\n\n console.log(chalk.bold(`Organization: ${status.slug}`));\n console.log(` Role: ${status.role}`);\n console.log(\n ` Created: ${new Date(status.createdAt).toLocaleDateString()}`,\n );\n console.log();\n console.log(chalk.bold(\"Members:\"));\n for (const member of status.members) {\n const roleTag =\n member.role === \"admin\"\n ? chalk.yellow(` (${member.role})`)\n : chalk.dim(` (${member.role})`);\n console.log(` ${member.email}${roleTag}`);\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { inviteZeroOrgMember } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const inviteCommand = new Command()\n .name(\"invite\")\n .description(\"Invite a member to the current organization\")\n .requiredOption(\"--email <email>\", \"Email address of the member to invite\")\n .option(\n \"--role <role>\",\n \"Role for the invited member (member or admin)\",\n \"member\",\n )\n .action(\n withErrorHandler(async (options: { email: string; role: string }) => {\n if (options.role !== \"member\" && options.role !== \"admin\") {\n throw new Error(\n `Invalid role \"${options.role}\". Must be \"member\" or \"admin\".`,\n );\n }\n await inviteZeroOrgMember(options.email, options.role);\n console.log(\n chalk.green(`✓ Invitation sent to ${options.email} as ${options.role}`),\n );\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { removeZeroOrgMember } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const removeCommand = new Command()\n .name(\"remove\")\n .description(\"Remove a member from the current organization\")\n .argument(\"<email>\", \"Email address of the member to remove\")\n .action(\n withErrorHandler(async (email: string) => {\n await removeZeroOrgMember(email);\n console.log(chalk.green(`✓ Removed ${email} from organization`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { leaveZeroOrg, listZeroOrgs, switchZeroOrg } from \"../../../lib/api\";\nimport { saveConfig } from \"../../../lib/api/config\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const leaveCommand = new Command()\n .name(\"leave\")\n .description(\"Leave the current organization\")\n .action(\n withErrorHandler(async () => {\n await leaveZeroOrg();\n\n const { orgs } = await listZeroOrgs();\n if (orgs.length === 0) {\n await saveConfig({ token: undefined });\n console.log(chalk.green(\"✓ Left organization.\"));\n console.log(\n chalk.yellow(\"No remaining organizations. Run: vm0 auth login\"),\n );\n return;\n }\n\n const nextOrg = orgs[0]!.slug;\n const result = await switchZeroOrg(nextOrg);\n await saveConfig({\n token: result.access_token,\n });\n console.log(chalk.green(`✓ Left organization. Switched to: ${nextOrg}`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { deleteZeroOrg } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const deleteCommand = new Command()\n .name(\"delete\")\n .description(\"Delete the current organization (admin only)\")\n .argument(\"<slug>\", \"Organization slug to confirm deletion\")\n .action(\n withErrorHandler(async (slug: string) => {\n await deleteZeroOrg(slug);\n console.log(chalk.green(`✓ Organization '${slug}' has been deleted.`));\n }),\n );\n","import { Command } from \"commander\";\nimport { listCommand } from \"./list\";\nimport { setCommand } from \"./set\";\nimport { removeCommand } from \"./remove\";\n\nexport const zeroOrgSecretCommand = new Command()\n .name(\"secret\")\n .description(\"Manage org-level secrets (admin)\")\n .addCommand(listCommand)\n .addCommand(setCommand)\n .addCommand(removeCommand);\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroOrgSecrets } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List all org-level secrets\")\n .action(\n withErrorHandler(async () => {\n const result = await listZeroOrgSecrets();\n\n if (result.secrets.length === 0) {\n console.log(chalk.dim(\"No org secrets found\"));\n console.log();\n console.log(\"To add an org secret:\");\n console.log(\n chalk.cyan(\" zero org secret set MY_API_KEY --body <value>\"),\n );\n return;\n }\n\n console.log(chalk.bold(\"Org Secrets:\"));\n console.log();\n\n for (const secret of result.secrets) {\n console.log(` ${chalk.cyan(secret.name)}`);\n if (secret.description) {\n console.log(` ${chalk.dim(secret.description)}`);\n }\n console.log(\n ` ${chalk.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`,\n );\n console.log();\n }\n\n console.log(chalk.dim(`Total: ${result.secrets.length} secret(s)`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { setZeroOrgSecret } from \"../../../../lib/api\";\nimport {\n isInteractive,\n promptPassword,\n} from \"../../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nexport const setCommand = new Command()\n .name(\"set\")\n .description(\"Create or update an org-level secret (admin only)\")\n .argument(\"<name>\", \"Secret name (uppercase, e.g., MY_API_KEY)\")\n .option(\n \"-b, --body <value>\",\n \"Secret value (required in non-interactive mode)\",\n )\n .option(\"-d, --description <description>\", \"Optional description\")\n .action(\n withErrorHandler(\n async (\n name: string,\n options: { body?: string; description?: string },\n ) => {\n let value: string;\n\n if (options.body !== undefined) {\n value = options.body;\n } else if (isInteractive()) {\n const prompted = await promptPassword(\"Enter secret value:\");\n if (prompted === undefined) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n value = prompted;\n } else {\n throw new Error(\"--body is required in non-interactive mode\", {\n cause: new Error(\n `Usage: zero org secret set ${name} --body \"your-secret-value\"`,\n ),\n });\n }\n\n let secret;\n try {\n secret = await setZeroOrgSecret({\n name,\n value,\n description: options.description,\n });\n } catch (error) {\n if (\n error instanceof Error &&\n error.message.includes(\"must contain only uppercase\")\n ) {\n throw new Error(error.message, {\n cause: new Error(\n \"Examples of valid secret names: MY_API_KEY, GITHUB_TOKEN, AWS_ACCESS_KEY_ID\",\n ),\n });\n }\n throw error;\n }\n\n console.log(chalk.green(`✓ Org secret \"${secret.name}\" saved`));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { deleteZeroOrgSecret } from \"../../../../lib/api\";\nimport {\n isInteractive,\n promptConfirm,\n} from \"../../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nexport const removeCommand = new Command()\n .name(\"remove\")\n .description(\"Delete an org-level secret (admin only)\")\n .argument(\"<name>\", \"Secret name to delete\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .action(\n withErrorHandler(async (name: string, options: { yes?: boolean }) => {\n if (!options.yes) {\n if (!isInteractive()) {\n throw new Error(\"--yes flag is required in non-interactive mode\");\n }\n\n const confirmed = await promptConfirm(\n `Are you sure you want to delete org secret \"${name}\"?`,\n false,\n );\n\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteZeroOrgSecret(name);\n console.log(chalk.green(`✓ Org secret \"${name}\" deleted`));\n }),\n );\n","import { Command } from \"commander\";\nimport { listCommand } from \"./list\";\nimport { setCommand } from \"./set\";\nimport { removeCommand } from \"./remove\";\n\nexport const zeroOrgVariableCommand = new Command()\n .name(\"variable\")\n .description(\"Manage org-level variables (admin)\")\n .addCommand(listCommand)\n .addCommand(setCommand)\n .addCommand(removeCommand);\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroOrgVariables } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\n/**\n * Truncate value for display if too long\n */\nfunction truncateValue(value: string, maxLength: number = 60): string {\n if (value.length <= maxLength) {\n return value;\n }\n return value.slice(0, maxLength - 15) + \"... [truncated]\";\n}\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List all org-level variables\")\n .action(\n withErrorHandler(async () => {\n const result = await listZeroOrgVariables();\n\n if (result.variables.length === 0) {\n console.log(chalk.dim(\"No org variables found\"));\n console.log();\n console.log(\"To add an org variable:\");\n console.log(chalk.cyan(\" zero org variable set MY_VAR <value>\"));\n return;\n }\n\n console.log(chalk.bold(\"Org Variables:\"));\n console.log();\n\n for (const variable of result.variables) {\n const displayValue = truncateValue(variable.value);\n console.log(` ${chalk.cyan(variable.name)} = ${displayValue}`);\n if (variable.description) {\n console.log(` ${chalk.dim(variable.description)}`);\n }\n console.log(\n ` ${chalk.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`,\n );\n console.log();\n }\n\n console.log(chalk.dim(`Total: ${result.variables.length} variable(s)`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { setZeroOrgVariable } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nexport const setCommand = new Command()\n .name(\"set\")\n .description(\"Create or update an org-level variable (admin only)\")\n .argument(\"<name>\", \"Variable name (uppercase, e.g., MY_VAR)\")\n .argument(\"<value>\", \"Variable value\")\n .option(\"-d, --description <description>\", \"Optional description\")\n .action(\n withErrorHandler(\n async (\n name: string,\n value: string,\n options: { description?: string },\n ) => {\n let variable;\n try {\n variable = await setZeroOrgVariable({\n name,\n value,\n description: options.description,\n });\n } catch (error) {\n if (\n error instanceof Error &&\n error.message.includes(\"must contain only uppercase\")\n ) {\n throw new Error(error.message, {\n cause: new Error(\n \"Examples of valid variable names: MY_VAR, API_URL, DEBUG_MODE\",\n ),\n });\n }\n throw error;\n }\n\n console.log(chalk.green(`✓ Org variable \"${variable.name}\" saved`));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { deleteZeroOrgVariable } from \"../../../../lib/api\";\nimport {\n isInteractive,\n promptConfirm,\n} from \"../../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nexport const removeCommand = new Command()\n .name(\"remove\")\n .description(\"Delete an org-level variable (admin only)\")\n .argument(\"<name>\", \"Variable name to delete\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .action(\n withErrorHandler(async (name: string, options: { yes?: boolean }) => {\n if (!options.yes) {\n if (!isInteractive()) {\n throw new Error(\"--yes flag is required in non-interactive mode\");\n }\n\n const confirmed = await promptConfirm(\n `Are you sure you want to delete org variable \"${name}\"?`,\n false,\n );\n\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteZeroOrgVariable(name);\n console.log(chalk.green(`✓ Org variable \"${name}\" deleted`));\n }),\n );\n","import { Command } from \"commander\";\nimport { createListCommand } from \"./list\";\nimport { createSetupCommand } from \"./setup\";\nimport { createRemoveCommand } from \"./remove\";\n\nexport const zeroOrgModelProviderCommand = new Command()\n .name(\"model-provider\")\n .description(\"Manage org-level model providers\")\n .addCommand(\n createListCommand({\n scopeLabel: \"org-level\",\n title: \"Org Model Providers\",\n setupCommand: \"zero org model-provider setup\",\n }),\n )\n .addCommand(\n createSetupCommand({\n commandPrefix: \"zero org model-provider setup\",\n description: \"Configure an org-level model provider\",\n scopeLabel: \"Org\",\n }),\n )\n .addCommand(createRemoveCommand({ scopeLabel: \"Org\" }));\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroOrgModelProviders } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\ninterface CreateListCommandOptions {\n scopeLabel?: string;\n title?: string;\n setupCommand?: string;\n}\n\nexport function createListCommand(\n options: CreateListCommandOptions = {},\n): Command {\n const scopeLabel = options.scopeLabel ?? \"org-level\";\n const title = options.title ?? \"Org Model Providers\";\n const setupCommand = options.setupCommand ?? \"zero org model-provider setup\";\n\n return new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(`List all ${scopeLabel} model providers`)\n .action(\n withErrorHandler(async () => {\n const result = await listZeroOrgModelProviders();\n\n if (result.modelProviders.length === 0) {\n console.log(chalk.dim(`No ${scopeLabel} model providers configured`));\n console.log();\n console.log(`To add a ${scopeLabel} model provider:`);\n console.log(chalk.cyan(` ${setupCommand}`));\n return;\n }\n\n // Group by framework\n const byFramework = result.modelProviders.reduce(\n (acc, p) => {\n const fw = p.framework;\n if (!acc[fw]) {\n acc[fw] = [];\n }\n acc[fw].push(p);\n return acc;\n },\n {} as Record<string, typeof result.modelProviders>,\n );\n\n console.log(chalk.bold(`${title}:`));\n console.log();\n\n for (const [framework, providers] of Object.entries(byFramework)) {\n console.log(` ${chalk.cyan(framework)}:`);\n for (const provider of providers) {\n console.log(` ${provider.type}`);\n console.log(chalk.dim(` ID: ${provider.id}`));\n console.log(\n chalk.dim(\n ` Updated: ${new Date(provider.updatedAt).toLocaleString()}`,\n ),\n );\n }\n console.log();\n }\n\n console.log(\n chalk.dim(`Total: ${result.modelProviders.length} provider(s)`),\n );\n }),\n );\n}\n\nexport const listCommand = createListCommand();\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport prompts from \"prompts\";\nimport {\n listZeroOrgModelProviders,\n upsertZeroOrgModelProvider,\n} from \"../../../../lib/api\";\nimport {\n MODEL_PROVIDER_TYPES,\n hasAuthMethods,\n getSelectableProviderTypes,\n type ModelProviderType,\n} from \"@vm0/api-contracts/contracts/model-providers\";\nimport { isInteractive } from \"../../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../../lib/command\";\nimport {\n type SetupInput,\n handleNonInteractiveMode,\n promptForAuthMethod,\n promptForSecrets,\n collectSecrets,\n} from \"../../../../lib/domain/model-provider/shared\";\n\ninterface CreateSetupCommandOptions {\n commandPrefix?: string;\n description?: string;\n scopeLabel?: string;\n}\n\nasync function handleInteractiveMode(\n commandPrefix: string,\n): Promise<SetupInput | null> {\n if (!isInteractive()) {\n throw new Error(\"Interactive mode requires a TTY\", {\n cause: new Error(\n `Use non-interactive mode: ${commandPrefix} --type <type> --secret \"<value>\"`,\n ),\n });\n }\n\n let cancelled = false;\n const onCancel = () => {\n cancelled = true;\n return false;\n };\n\n // Fetch configured org providers to annotate choices\n const { modelProviders: configuredProviders } =\n await listZeroOrgModelProviders();\n const configuredTypes = new Set(\n configuredProviders.map((p) => {\n return p.type;\n }),\n );\n\n // Build provider choices with configuration status (only selectable providers)\n const annotatedChoices = getSelectableProviderTypes().map((type) => {\n const config = MODEL_PROVIDER_TYPES[type];\n const isConfigured = configuredTypes.has(type);\n const isExperimental = hasAuthMethods(type);\n let title: string = config.label;\n if (isConfigured) {\n title = `${title} ✓`;\n }\n if (isExperimental) {\n title = `${title} ${chalk.dim(\"(experimental)\")}`;\n }\n return {\n title,\n value: type,\n };\n });\n\n const typeResponse = await prompts(\n {\n type: \"select\",\n name: \"type\",\n message: \"Select provider type:\",\n choices: annotatedChoices,\n },\n { onCancel },\n );\n\n if (cancelled) {\n console.log(chalk.dim(\"Cancelled\"));\n return null;\n }\n\n const type = typeResponse.type as ModelProviderType;\n\n // Check if provider is already configured using the list we already fetched\n const existingProvider = configuredProviders.find((p) => {\n return p.type === type;\n });\n\n if (existingProvider) {\n console.log();\n console.log(`\"${type}\" is already configured`);\n console.log();\n\n const actionResponse = await prompts(\n {\n type: \"select\",\n name: \"action\",\n message: \"\",\n choices: [\n { title: \"Keep existing secret\", value: \"keep\" },\n { title: \"Update secret\", value: \"update\" },\n ],\n },\n { onCancel },\n );\n\n if (cancelled) {\n console.log(chalk.dim(\"Cancelled\"));\n return null;\n }\n\n if (actionResponse.action === \"keep\") {\n return {\n type,\n keepExistingSecret: true,\n isInteractiveMode: true,\n };\n }\n // Fall through to secret prompt for \"update\"\n }\n\n const config = MODEL_PROVIDER_TYPES[type];\n\n console.log();\n if (\"helpText\" in config) {\n console.log(chalk.dim(config.helpText));\n }\n console.log();\n\n // Handle multi-auth providers\n if (hasAuthMethods(type)) {\n const authMethod = await promptForAuthMethod(type);\n const secrets = await promptForSecrets(type, authMethod);\n\n return {\n type,\n authMethod,\n secrets,\n isInteractiveMode: true,\n };\n }\n\n // Single-secret provider (legacy)\n const secretLabel = \"secretLabel\" in config ? config.secretLabel : \"secret\";\n\n const secretResponse = await prompts(\n {\n type: \"password\",\n name: \"secret\",\n message: `Enter your ${secretLabel}:`,\n validate: (value: string) => {\n return value.length > 0 || `${secretLabel} is required`;\n },\n },\n { onCancel },\n );\n\n if (cancelled) {\n console.log(chalk.dim(\"Cancelled\"));\n return null;\n }\n\n const secret = secretResponse.secret as string;\n\n return { type, secret, isInteractiveMode: true };\n}\n\nexport function createSetupCommand(\n options: CreateSetupCommandOptions = {},\n): Command {\n const commandPrefix =\n options.commandPrefix ?? \"zero org model-provider setup\";\n const description =\n options.description ?? \"Configure an org-level model provider\";\n const scopeLabel = options.scopeLabel ?? \"Org\";\n\n return new Command()\n .name(\"setup\")\n .description(description)\n .option(\"-t, --type <type>\", \"Provider type (for non-interactive mode)\")\n .option(\n \"-s, --secret <value>\",\n \"Secret value (can be used multiple times, supports VALUE or KEY=VALUE format)\",\n collectSecrets,\n [],\n )\n .option(\n \"-a, --auth-method <method>\",\n \"Auth method (required for multi-auth providers like aws-bedrock)\",\n )\n .action(\n withErrorHandler(\n async (options: {\n type?: string;\n secret?: string[];\n authMethod?: string;\n }) => {\n let input: SetupInput;\n const secretArgs = options.secret ?? [];\n\n if (options.type && secretArgs.length > 0) {\n input = handleNonInteractiveMode({\n type: options.type,\n secret: secretArgs,\n authMethod: options.authMethod,\n commandPrefix,\n });\n } else if (options.type || secretArgs.length > 0) {\n throw new Error(\"Both --type and --secret are required\");\n } else {\n const result = await handleInteractiveMode(commandPrefix);\n if (result === null) {\n return;\n }\n input = result;\n }\n\n // Handle \"keep existing secret\" flow\n if (input.keepExistingSecret) {\n console.log(\n chalk.green(\n `✓ ${scopeLabel} model provider \"${input.type}\" unchanged`,\n ),\n );\n return;\n }\n\n // Standard upsert flow with secret\n const { created } = await upsertZeroOrgModelProvider({\n type: input.type,\n secret: input.secret,\n authMethod: input.authMethod,\n secrets: input.secrets,\n });\n\n const action = created ? \"created\" : \"updated\";\n console.log(\n chalk.green(\n `✓ ${scopeLabel} model provider \"${input.type}\" ${action}`,\n ),\n );\n },\n ),\n );\n}\n\nexport const setupCommand = createSetupCommand();\n","import chalk from \"chalk\";\nimport prompts from \"prompts\";\nimport {\n MODEL_PROVIDER_TYPES,\n hasAuthMethods,\n getAuthMethodsForType,\n getDefaultAuthMethod,\n getSecretsForAuthMethod,\n type ModelProviderType,\n} from \"@vm0/api-contracts/contracts/model-providers\";\n\nexport interface SetupInput {\n type: ModelProviderType;\n secret?: string;\n // Multi-auth support\n authMethod?: string;\n secrets?: Record<string, string>;\n keepExistingSecret?: boolean;\n isInteractiveMode?: boolean;\n}\n\nfunction validateProviderType(typeStr: string): ModelProviderType {\n if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {\n const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(\", \");\n throw new Error(`Invalid type \"${typeStr}\"`, {\n cause: new Error(`Valid types: ${validTypes}`),\n });\n }\n return typeStr as ModelProviderType;\n}\n\nfunction validateAuthMethod(\n type: ModelProviderType,\n authMethodStr: string,\n): string | never {\n const authMethods = getAuthMethodsForType(type);\n if (!authMethods || !(authMethodStr in authMethods)) {\n const validMethods = authMethods\n ? Object.keys(authMethods).join(\", \")\n : \"none\";\n throw new Error(`Invalid auth method \"${authMethodStr}\"`, {\n cause: new Error(`Valid auth methods: ${validMethods}`),\n });\n }\n return authMethodStr;\n}\n\n/**\n * Parse secret arguments into a secrets object.\n * Supports two formats:\n * - Single value (e.g., \"sk-xxx\") - auto-mapped to the provider's secret name\n * - KEY=VALUE format (e.g., \"AWS_REGION=us-east-1\") - explicit mapping\n */\nfunction parseSecrets(\n type: ModelProviderType,\n authMethod: string,\n secretArgs: string[],\n): Record<string, string> {\n const secretsConfig = getSecretsForAuthMethod(type, authMethod);\n if (!secretsConfig) {\n throw new Error(`Invalid auth method \"${authMethod}\"`);\n }\n\n const secretNames = Object.keys(secretsConfig);\n\n // Single value without = sign: only allowed for single-secret auth methods\n const firstArg = secretArgs[0];\n if (secretArgs.length === 1 && firstArg && !firstArg.includes(\"=\")) {\n if (secretNames.length !== 1) {\n throw new Error(\n \"Must use KEY=VALUE format for multi-secret auth methods\",\n { cause: new Error(`Required secrets: ${secretNames.join(\", \")}`) },\n );\n }\n const firstSecretName = secretNames[0];\n if (!firstSecretName) {\n throw new Error(\"No secrets defined for this auth method\");\n }\n return { [firstSecretName]: firstArg };\n }\n\n // KEY=VALUE format\n const secrets: Record<string, string> = {};\n for (const arg of secretArgs) {\n const eqIndex = arg.indexOf(\"=\");\n if (eqIndex === -1) {\n throw new Error(`Invalid secret format \"${arg}\"`, {\n cause: new Error(\"Use KEY=VALUE format (e.g., AWS_REGION=us-east-1)\"),\n });\n }\n const key = arg.slice(0, eqIndex);\n const value = arg.slice(eqIndex + 1);\n secrets[key] = value;\n }\n return secrets;\n}\n\n/**\n * Validate secrets against the auth method config.\n */\nfunction validateSecrets(\n type: ModelProviderType,\n authMethod: string,\n secrets: Record<string, string>,\n): void {\n const secretsConfig = getSecretsForAuthMethod(type, authMethod);\n if (!secretsConfig) {\n throw new Error(`Invalid auth method \"${authMethod}\"`);\n }\n\n // Check required fields\n for (const [name, fieldConfig] of Object.entries(secretsConfig)) {\n if (fieldConfig.required && !secrets[name]) {\n const requiredNames = Object.entries(secretsConfig)\n .filter(([, fc]) => {\n return fc.required;\n })\n .map(([n]) => {\n return n;\n })\n .join(\", \");\n throw new Error(`Missing required secret: ${name}`, {\n cause: new Error(`Required secrets: ${requiredNames}`),\n });\n }\n }\n\n // Check for unknown fields\n for (const name of Object.keys(secrets)) {\n if (!(name in secretsConfig)) {\n const validNames = Object.keys(secretsConfig).join(\", \");\n throw new Error(`Unknown secret: ${name}`, {\n cause: new Error(`Valid secrets: ${validNames}`),\n });\n }\n }\n}\n\nexport function handleNonInteractiveMode(options: {\n type: string;\n secret: string[];\n authMethod?: string;\n commandPrefix?: string;\n}): SetupInput {\n const type = validateProviderType(options.type);\n const cmdPrefix = options.commandPrefix ?? \"zero org model-provider setup\";\n\n // Handle multi-auth providers\n if (hasAuthMethods(type)) {\n // Determine auth method\n let authMethod: string;\n if (options.authMethod) {\n authMethod = validateAuthMethod(type, options.authMethod);\n } else {\n const defaultAuthMethod = getDefaultAuthMethod(type);\n const authMethods = getAuthMethodsForType(type);\n if (!defaultAuthMethod || !authMethods) {\n throw new Error(`Provider \"${type}\" requires --auth-method`);\n }\n // If there's only one auth method, use it; otherwise require explicit selection\n const authMethodNames = Object.keys(authMethods);\n if (authMethodNames.length === 1) {\n authMethod = authMethodNames[0]!;\n } else {\n const methods = authMethodNames.join(\", \");\n throw new Error(\n `--auth-method is required for \"${type}\" (multiple auth methods available)`,\n {\n cause: new Error(\n `Available: ${methods}. Example: ${cmdPrefix} --type ${type} --auth-method ${authMethodNames[0]} --secret KEY=VALUE`,\n ),\n },\n );\n }\n }\n\n // Parse and validate secrets\n const secrets = parseSecrets(type, authMethod, options.secret);\n validateSecrets(type, authMethod, secrets);\n\n return {\n type,\n authMethod,\n secrets,\n isInteractiveMode: false,\n };\n }\n\n // Single-secret provider (legacy)\n // Accept single value or KEY=VALUE format\n const secretArgs = options.secret;\n const firstArg = secretArgs[0];\n if (!firstArg) {\n throw new Error(\"Secret is required\");\n }\n\n // If KEY=VALUE format, extract the value\n let secret: string;\n if (firstArg.includes(\"=\")) {\n secret = firstArg.slice(firstArg.indexOf(\"=\") + 1);\n } else {\n secret = firstArg;\n }\n\n return {\n type,\n secret,\n isInteractiveMode: false,\n };\n}\n\n/**\n * Prompt for auth method selection (only for multi-auth providers)\n */\nexport async function promptForAuthMethod(\n type: ModelProviderType,\n): Promise<string> {\n const authMethods = getAuthMethodsForType(type);\n const defaultAuthMethod = getDefaultAuthMethod(type);\n\n if (!authMethods) {\n return \"default\";\n }\n\n const choices = Object.entries(authMethods).map(([method, config]) => {\n return {\n title:\n method === defaultAuthMethod\n ? `${config.label} (Recommended)`\n : config.label,\n value: method,\n };\n });\n\n const response = await prompts(\n {\n type: \"select\",\n name: \"authMethod\",\n message: \"Select authentication method:\",\n choices,\n },\n {\n onCancel: () => {\n return process.exit(0);\n },\n },\n );\n\n return response.authMethod as string;\n}\n\n/**\n * Determine if a secret should be masked (password type)\n * Non-secret values like region should be visible\n */\nfunction isSensitiveSecret(name: string): boolean {\n const nonSecretPatterns = [\"REGION\", \"ENDPOINT\", \"URL\"];\n return !nonSecretPatterns.some((pattern) => {\n return name.toUpperCase().includes(pattern);\n });\n}\n\nexport async function promptForSecrets(\n type: ModelProviderType,\n authMethod: string,\n): Promise<Record<string, string>> {\n const secretsConfig = getSecretsForAuthMethod(type, authMethod);\n\n if (!secretsConfig) {\n throw new Error(`Invalid auth method \"${authMethod}\"`);\n }\n\n const secrets: Record<string, string> = {};\n\n for (const [name, fieldConfig] of Object.entries(secretsConfig)) {\n if (fieldConfig.helpText) {\n console.log(chalk.dim(fieldConfig.helpText));\n }\n\n const isSensitive = isSensitiveSecret(name);\n const placeholder =\n \"placeholder\" in fieldConfig ? (fieldConfig.placeholder as string) : \"\";\n\n if (fieldConfig.required) {\n const response = await prompts(\n {\n type: isSensitive ? \"password\" : \"text\",\n name: \"value\",\n message: `${fieldConfig.label}:`,\n initial: placeholder ? \"\" : undefined,\n validate: (value: string) => {\n return value.length > 0 || `${fieldConfig.label} is required`;\n },\n },\n {\n onCancel: () => {\n return process.exit(0);\n },\n },\n );\n secrets[name] = response.value as string;\n } else {\n // Optional field\n const response = await prompts(\n {\n type: isSensitive ? \"password\" : \"text\",\n name: \"value\",\n message: `${fieldConfig.label} (optional):`,\n },\n {\n onCancel: () => {\n return process.exit(0);\n },\n },\n );\n const value = response.value as string;\n if (value && value.trim()) {\n secrets[name] = value.trim();\n }\n }\n }\n\n return secrets;\n}\n\n/**\n * Collect secret values from repeatable --secret option\n */\nexport function collectSecrets(value: string, previous: string[]): string[] {\n return previous.concat([value]);\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { deleteZeroOrgModelProvider } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\nimport {\n MODEL_PROVIDER_TYPES,\n type ModelProviderType,\n} from \"@vm0/api-contracts/contracts/model-providers\";\n\ninterface CreateRemoveCommandOptions {\n scopeLabel?: string;\n}\n\nexport function createRemoveCommand(\n options: CreateRemoveCommandOptions = {},\n): Command {\n const scopeLabel = options.scopeLabel ?? \"Org\";\n\n return new Command()\n .name(\"remove\")\n .description(`Remove a ${scopeLabel.toLowerCase()} model provider`)\n .argument(\"<type>\", \"Model provider type to remove\")\n .action(\n withErrorHandler(async (type: string) => {\n if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {\n const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(\", \");\n throw new Error(`Invalid type \"${type}\"`, {\n cause: new Error(`Valid types: ${validTypes}`),\n });\n }\n\n await deleteZeroOrgModelProvider(type as ModelProviderType);\n console.log(\n chalk.green(`✓ ${scopeLabel} model provider \"${type}\" removed`),\n );\n }),\n );\n}\n\nexport const removeCommand = createRemoveCommand();\n","import { Command } from \"commander\";\nimport { createCommand } from \"./create\";\nimport { editCommand } from \"./edit\";\nimport { viewCommand } from \"./view\";\nimport { listCommand } from \"./list\";\nimport { deleteCommand } from \"./delete\";\n\nexport const zeroAgentCommand = new Command(\"agent\")\n .description(\"View or manage zero agents\")\n .addCommand(createCommand)\n .addCommand(editCommand)\n .addCommand(viewCommand)\n .addCommand(listCommand)\n .addCommand(deleteCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Your agent ID is in $ZERO_AGENT_ID (or run: zero whoami)\n View your config: zero agent view $ZERO_AGENT_ID --instructions\n Update description: zero agent edit $ZERO_AGENT_ID --description \"new role\"\n Update tone: zero agent edit $ZERO_AGENT_ID --sound friendly\n Update instructions: zero agent edit $ZERO_AGENT_ID --instructions-file <path>\n Add a custom skill: zero agent edit $ZERO_AGENT_ID --add-skill my-skill\n Remove a skill: zero agent edit $ZERO_AGENT_ID --remove-skill my-skill\n\nNotes:\n Manage custom skills with 'zero skill --help'`,\n );\n","import { Command } from \"commander\";\nimport { readFileSync } from \"node:fs\";\nimport chalk from \"chalk\";\nimport { zeroAgentCustomSkillNameSchema } from \"@vm0/api-contracts/contracts/zero-agents\";\nimport { createZeroAgent, updateZeroAgentInstructions } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolveAvatarUrl } from \"./avatar\";\n\nexport const createCommand = new Command()\n .name(\"create\")\n .description(\"Create a new zero agent\")\n .option(\n \"--skills <items>\",\n \"Comma-separated custom skill names to attach (e.g. my-skill,other-skill)\",\n )\n .option(\"--display-name <name>\", \"Agent display name\")\n .option(\"--description <text>\", \"Agent description\")\n .option(\n \"--sound <tone>\",\n \"Agent tone: professional, friendly, direct, supportive\",\n )\n .option(\"--avatar <preset>\", \"Avatar preset: preset:0 through preset:4\")\n .option(\n \"--avatar-rotation <1-5>\",\n \"Head angle: 1=far-left 3=center 5=far-right\",\n )\n .option(\n \"--avatar-skin <tone>\",\n \"Skin tone: light | light-medium | medium | medium-dark | dark\",\n )\n .option(\"--avatar-hair-style <1-5>\", \"Hair style: 1–5\")\n .option(\n \"--avatar-hair-color <color>\",\n \"Hair color: blonde | teal | grey | pink | brown\",\n )\n .option(\n \"--avatar-expression <expr>\",\n \"Expression: calm | content | neutral | pleasant | excited\",\n )\n .option(\"--avatar-intensity <level>\", \"Intensity: chill | normal | hyped\")\n .option(\"--instructions-file <path>\", \"Path to instructions file\")\n .addHelpText(\n \"after\",\n `\nAvatar:\n Quick presets (--avatar):\n preset:0 light skin, brown hair, calm, hyped\n preset:1 light-medium skin, grey hair, calm, normal\n preset:2 medium skin, pink hair, neutral, chill\n preset:3 medium-dark skin, blonde hair, pleasant, hyped\n preset:4 dark skin, teal hair, excited, normal\n\n Custom attributes (--avatar-* flags, omitted fields use defaults):\n --avatar-rotation 1=far-left 3=center(default) 5=far-right\n --avatar-skin light / light-medium / medium(default) / medium-dark / dark\n --avatar-hair-style 1–5 (default: 1)\n --avatar-hair-color blonde / teal / grey / pink / brown(default)\n --avatar-expression calm(default) / content / neutral / pleasant / excited\n --avatar-intensity chill / normal(default) / hyped\n\n Note: --avatar and --avatar-* cannot be used together.\n\nExamples:\n Minimal: zero agent create --display-name \"My Agent\"\n Quick preset: zero agent create --display-name \"My Agent\" --avatar preset:2\n Custom avatar: zero agent create --display-name \"My Agent\" --avatar-skin dark --avatar-hair-color teal --avatar-intensity hyped\n With skills: zero agent create --skills my-skill,other-skill --display-name \"My Agent\"\n With instructions: zero agent create --display-name \"My Agent\" --instructions-file ./instructions.md`,\n )\n .action(\n withErrorHandler(\n async (options: {\n skills?: string;\n displayName?: string;\n description?: string;\n sound?: string;\n avatar?: string;\n avatarRotation?: string;\n avatarSkin?: string;\n avatarHairStyle?: string;\n avatarHairColor?: string;\n avatarExpression?: string;\n avatarIntensity?: string;\n instructionsFile?: string;\n }) => {\n const customSkills = options.skills\n ? options.skills.split(\",\").map((s) => {\n return s.trim();\n })\n : undefined;\n\n if (customSkills) {\n for (const name of customSkills) {\n const result = zeroAgentCustomSkillNameSchema.safeParse(name);\n if (!result.success) {\n throw new Error(\n `Invalid skill name \"${name}\": must be 2-64 characters, lowercase alphanumeric and hyphens only (e.g. my-skill)`,\n );\n }\n }\n }\n\n const avatarUrl = resolveAvatarUrl(options);\n\n const agent = await createZeroAgent({\n displayName: options.displayName,\n description: options.description,\n sound: options.sound,\n avatarUrl,\n customSkills,\n });\n\n if (options.instructionsFile) {\n const content = readFileSync(options.instructionsFile, \"utf-8\");\n await updateZeroAgentInstructions(agent.agentId, content);\n }\n\n console.log(chalk.green(`✓ Agent \"${agent.agentId}\" created`));\n console.log(` Agent ID: ${agent.agentId}`);\n if (customSkills?.length) {\n console.log(` Skills: ${customSkills.join(\", \")}`);\n }\n if (agent.displayName) {\n console.log(` Display Name: ${agent.displayName}`);\n }\n\n console.log();\n console.log(\"Next steps to authorize connectors for this agent:\");\n console.log(\" - Search connectors this agent needs:\");\n console.log(\n ` zero connector search <keyword> --agent ${agent.agentId}`,\n );\n console.log(\n \" - Check authorization status (prints an authorize URL if not authorized):\",\n );\n console.log(\n ` zero connector status <type> --agent ${agent.agentId}`,\n );\n },\n ),\n );\n","const SKIN_MAP: Record<string, number> = {\n light: 0,\n \"light-medium\": 1,\n medium: 2,\n \"medium-dark\": 3,\n dark: 4,\n};\n\nconst HAIR_COLOR_MAP: Record<string, number> = {\n blonde: 1,\n teal: 2,\n grey: 3,\n pink: 4,\n brown: 5,\n};\n\nconst EXPRESSION_MAP: Record<string, number> = {\n calm: 1,\n content: 2,\n neutral: 3,\n pleasant: 4,\n excited: 5,\n};\n\nconst INTENSITY_MAP: Record<string, \"d\" | \"m\" | \"h\"> = {\n chill: \"d\",\n normal: \"m\",\n hyped: \"h\",\n};\n\nfunction lookupRequired<T>(\n value: string,\n map: Readonly<Record<string, T>>,\n flag: string,\n): T {\n if (!(value in map)) {\n throw new Error(\n `Invalid ${flag} \"${value}\". Must be one of: ${Object.keys(map).join(\", \")}`,\n );\n }\n return map[value]!;\n}\n\nfunction parseIntRange(\n value: string,\n flag: string,\n min: number,\n max: number,\n): number {\n const n = Number(value);\n if (!Number.isInteger(n) || n < min || n > max) {\n throw new Error(`Invalid ${flag} \"${value}\". Must be ${min}–${max}`);\n }\n return n;\n}\n\nfunction buildCustomSvgAvatar(opts: AvatarOptions): string {\n const r =\n opts.avatarRotation !== undefined\n ? parseIntRange(opts.avatarRotation, \"--avatar-rotation\", 1, 5)\n : 3;\n const h =\n opts.avatarHairStyle !== undefined\n ? parseIntRange(opts.avatarHairStyle, \"--avatar-hair-style\", 1, 5)\n : 1;\n const s =\n opts.avatarSkin !== undefined\n ? lookupRequired(opts.avatarSkin, SKIN_MAP, \"--avatar-skin\")\n : 2;\n const c =\n opts.avatarHairColor !== undefined\n ? lookupRequired(\n opts.avatarHairColor,\n HAIR_COLOR_MAP,\n \"--avatar-hair-color\",\n )\n : 5;\n const f =\n opts.avatarExpression !== undefined\n ? lookupRequired(\n opts.avatarExpression,\n EXPRESSION_MAP,\n \"--avatar-expression\",\n )\n : 1;\n const i =\n opts.avatarIntensity !== undefined\n ? lookupRequired(\n opts.avatarIntensity,\n INTENSITY_MAP,\n \"--avatar-intensity\",\n )\n : \"m\";\n return `svg:r${r}s${s}h${h}c${c}f${f}${i}`;\n}\n\nexport interface AvatarOptions {\n avatar?: string;\n avatarRotation?: string;\n avatarSkin?: string;\n avatarHairStyle?: string;\n avatarHairColor?: string;\n avatarExpression?: string;\n avatarIntensity?: string;\n}\n\nexport function resolveAvatarUrl(opts: AvatarOptions): string | undefined {\n const hasPreset = opts.avatar !== undefined;\n const hasCustom =\n opts.avatarRotation !== undefined ||\n opts.avatarSkin !== undefined ||\n opts.avatarHairStyle !== undefined ||\n opts.avatarHairColor !== undefined ||\n opts.avatarExpression !== undefined ||\n opts.avatarIntensity !== undefined;\n\n if (!hasPreset && !hasCustom) return undefined;\n\n if (hasPreset && hasCustom) {\n throw new Error(\n \"--avatar cannot be combined with --avatar-* attribute options\",\n );\n }\n\n if (hasPreset) {\n if (!/^preset:[0-4]$/.test(opts.avatar!)) {\n throw new Error(\n `Invalid --avatar \"${opts.avatar}\". Use preset:0 through preset:4`,\n );\n }\n return opts.avatar;\n }\n\n return buildCustomSvgAvatar(opts);\n}\n\nconst REVERSE_SKIN_MAP: Record<number, string> = {\n 0: \"light\",\n 1: \"light-medium\",\n 2: \"medium\",\n 3: \"medium-dark\",\n 4: \"dark\",\n};\n\nconst REVERSE_HAIR_COLOR_MAP: Record<number, string> = {\n 1: \"blonde\",\n 2: \"teal\",\n 3: \"grey\",\n 4: \"pink\",\n 5: \"brown\",\n};\n\nconst REVERSE_EXPRESSION_MAP: Record<number, string> = {\n 1: \"calm\",\n 2: \"content\",\n 3: \"neutral\",\n 4: \"pleasant\",\n 5: \"excited\",\n};\n\nconst REVERSE_INTENSITY_MAP: Record<string, string> = {\n d: \"chill\",\n m: \"normal\",\n h: \"hyped\",\n};\n\nconst PRESET_DESCRIPTIONS: Record<string, string> = {\n \"preset:0\": \"light skin, brown hair, calm, hyped\",\n \"preset:1\": \"light-medium skin, grey hair, calm, normal\",\n \"preset:2\": \"medium skin, pink hair, neutral, chill\",\n \"preset:3\": \"medium-dark skin, blonde hair, pleasant, hyped\",\n \"preset:4\": \"dark skin, teal hair, excited, normal\",\n};\n\nfunction parseSvgAvatar(svg: string): string | undefined {\n const match = svg.match(/^svg:r(\\d)s(\\d)h(\\d)c(\\d)f(\\d)([dmh])$/);\n if (!match) return undefined;\n\n const [, r, s, h, c, f, i] = match as RegExpExecArray;\n const parts: string[] = [];\n\n const skin = REVERSE_SKIN_MAP[Number(s)];\n if (skin) parts.push(`${skin} skin`);\n\n const hairColor = REVERSE_HAIR_COLOR_MAP[Number(c)];\n if (hairColor) parts.push(`${hairColor} hair`);\n\n const expression = REVERSE_EXPRESSION_MAP[Number(f)];\n if (expression) parts.push(expression);\n\n const intensity = REVERSE_INTENSITY_MAP[i!];\n if (intensity) parts.push(intensity);\n\n if (parts.length === 0) return undefined;\n\n let desc = parts.join(\", \");\n if (r !== \"3\") {\n const rotationLabels: Record<string, string> = {\n \"1\": \"far-left\",\n \"2\": \"left\",\n \"4\": \"right\",\n \"5\": \"far-right\",\n };\n const rot = rotationLabels[r!];\n if (rot) desc += `, ${rot}`;\n }\n if (h !== \"1\") {\n desc += `, hair style ${h}`;\n }\n\n return desc;\n}\n\nexport function formatAvatar(\n avatarUrl: string | null | undefined,\n): string | undefined {\n if (!avatarUrl) return undefined;\n\n if (avatarUrl.startsWith(\"preset:\")) {\n const desc = PRESET_DESCRIPTIONS[avatarUrl];\n return desc ? `${avatarUrl} (${desc})` : avatarUrl;\n }\n\n if (avatarUrl.startsWith(\"svg:\")) {\n const desc = parseSvgAvatar(avatarUrl);\n return desc ? `custom (${desc})` : avatarUrl;\n }\n\n return avatarUrl;\n}\n","import { Command } from \"commander\";\nimport { readFileSync } from \"node:fs\";\nimport chalk from \"chalk\";\nimport { zeroAgentCustomSkillNameSchema } from \"@vm0/api-contracts/contracts/zero-agents\";\nimport {\n getZeroAgent,\n updateZeroAgent,\n updateZeroAgentInstructions,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { type AvatarOptions, resolveAvatarUrl } from \"./avatar\";\n\ninterface AgentEditOptions extends AvatarOptions {\n displayName?: string;\n description?: string;\n sound?: string;\n skills?: string;\n addSkill?: string;\n removeSkill?: string;\n instructionsFile?: string;\n}\n\nfunction hasAvatarUpdate(options: AvatarOptions): boolean {\n return (\n options.avatar !== undefined ||\n options.avatarRotation !== undefined ||\n options.avatarSkin !== undefined ||\n options.avatarHairStyle !== undefined ||\n options.avatarHairColor !== undefined ||\n options.avatarExpression !== undefined ||\n options.avatarIntensity !== undefined\n );\n}\n\nfunction hasAgentFieldUpdate(options: AgentEditOptions): boolean {\n return (\n options.displayName !== undefined ||\n options.description !== undefined ||\n options.sound !== undefined ||\n hasAvatarUpdate(options) ||\n options.skills !== undefined ||\n options.addSkill !== undefined ||\n options.removeSkill !== undefined\n );\n}\n\nasync function applyAgentUpdate(\n agentId: string,\n options: AgentEditOptions,\n): Promise<void> {\n const hasAvatar = hasAvatarUpdate(options);\n const resolvedAvatarUrl = hasAvatar ? resolveAvatarUrl(options) : undefined;\n\n const current = await getZeroAgent(agentId);\n const customSkills = resolveCustomSkills(options, current.customSkills ?? []);\n\n const avatarUrl = hasAvatar\n ? resolvedAvatarUrl\n : (current.avatarUrl ?? undefined);\n\n await updateZeroAgent(agentId, {\n displayName:\n options.displayName !== undefined\n ? options.displayName\n : (current.displayName ?? undefined),\n description:\n options.description !== undefined\n ? options.description\n : (current.description ?? undefined),\n sound:\n options.sound !== undefined\n ? options.sound\n : (current.sound ?? undefined),\n avatarUrl,\n customSkills,\n });\n}\n\nfunction validateSkillName(name: string): void {\n const result = zeroAgentCustomSkillNameSchema.safeParse(name);\n if (!result.success) {\n throw new Error(\n `Invalid skill name \"${name}\": must be 2-64 characters, lowercase alphanumeric and hyphens only (e.g. my-skill)`,\n );\n }\n}\n\nfunction resolveCustomSkills(\n options: { skills?: string; addSkill?: string; removeSkill?: string },\n existing: string[],\n): string[] | undefined {\n if (options.skills && (options.addSkill || options.removeSkill)) {\n throw new Error(\"Cannot use --skills with --add-skill or --remove-skill\");\n }\n\n if (options.skills) {\n const names = options.skills.split(\",\").map((s) => {\n return s.trim();\n });\n for (const name of names) {\n validateSkillName(name);\n }\n return names;\n }\n\n if (options.addSkill) {\n validateSkillName(options.addSkill);\n if (existing.includes(options.addSkill)) {\n throw new Error(\n `Skill \"${options.addSkill}\" is already attached to this agent`,\n );\n }\n return [...existing, options.addSkill];\n }\n\n if (options.removeSkill) {\n if (!existing.includes(options.removeSkill)) {\n throw new Error(\n `Skill \"${options.removeSkill}\" is not attached to this agent`,\n );\n }\n return existing.filter((s) => {\n return s !== options.removeSkill;\n });\n }\n\n return undefined;\n}\n\nexport const editCommand = new Command()\n .name(\"edit\")\n .description(\"Edit a zero agent\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\"--display-name <name>\", \"New display name\")\n .option(\"--description <text>\", \"New description\")\n .option(\n \"--sound <tone>\",\n \"New tone: professional, friendly, direct, supportive\",\n )\n .option(\"--avatar <preset>\", \"Avatar preset: preset:0 through preset:4\")\n .option(\n \"--avatar-rotation <1-5>\",\n \"Head angle: 1=far-left 3=center 5=far-right\",\n )\n .option(\n \"--avatar-skin <tone>\",\n \"Skin tone: light | light-medium | medium | medium-dark | dark\",\n )\n .option(\"--avatar-hair-style <1-5>\", \"Hair style: 1–5\")\n .option(\n \"--avatar-hair-color <color>\",\n \"Hair color: blonde | teal | grey | pink | brown\",\n )\n .option(\n \"--avatar-expression <expr>\",\n \"Expression: calm | content | neutral | pleasant | excited\",\n )\n .option(\"--avatar-intensity <level>\", \"Intensity: chill | normal | hyped\")\n .option(\n \"--skills <items>\",\n \"Comma-separated custom skill names to attach (replaces existing)\",\n )\n .option(\"--add-skill <name>\", \"Add a custom skill to the agent\")\n .option(\"--remove-skill <name>\", \"Remove a custom skill from the agent\")\n .option(\"--instructions-file <path>\", \"Path to new instructions file\")\n .addHelpText(\n \"after\",\n `\nAvatar:\n Quick presets (--avatar):\n preset:0 light skin, brown hair, calm, hyped\n preset:1 light-medium skin, grey hair, calm, normal\n preset:2 medium skin, pink hair, neutral, chill\n preset:3 medium-dark skin, blonde hair, pleasant, hyped\n preset:4 dark skin, teal hair, excited, normal\n\n Custom attributes (--avatar-* flags, replace the entire avatar):\n --avatar-rotation 1=far-left 3=center(default) 5=far-right\n --avatar-skin light / light-medium / medium(default) / medium-dark / dark\n --avatar-hair-style 1–5 (default: 1)\n --avatar-hair-color blonde / teal / grey / pink / brown(default)\n --avatar-expression calm(default) / content / neutral / pleasant / excited\n --avatar-intensity chill / normal(default) / hyped\n\n Note: --avatar and --avatar-* cannot be used together.\n\nExamples:\n Update description: zero agent edit <agent-id> --description \"new role\"\n Update tone: zero agent edit <agent-id> --sound friendly\n Quick preset avatar: zero agent edit <agent-id> --avatar preset:2\n Custom avatar: zero agent edit <agent-id> --avatar-skin dark --avatar-hair-color teal --avatar-intensity hyped\n Replace all skills: zero agent edit <agent-id> --skills my-skill,other-skill\n Add a skill: zero agent edit <agent-id> --add-skill my-skill\n Remove a skill: zero agent edit <agent-id> --remove-skill my-skill\n Update instructions: zero agent edit <agent-id> --instructions-file ./instructions.md\n Update yourself: zero agent edit $ZERO_AGENT_ID --description \"new role\"\n\nNotes:\n - At least one option is required\n - Unspecified fields are preserved (not cleared)\n - --skills replaces the entire skill list; --add-skill/--remove-skill modify incrementally\n - --skills cannot be combined with --add-skill or --remove-skill\n - To create or edit skill content, use: zero skill --help`,\n )\n .action(\n withErrorHandler(async (agentId: string, options: AgentEditOptions) => {\n const hasAgentUpdate = hasAgentFieldUpdate(options);\n\n if (!hasAgentUpdate && !options.instructionsFile) {\n throw new Error(\n \"At least one option is required (--display-name, --description, --sound, --avatar, --avatar-*, --skills, --add-skill, --remove-skill, --instructions-file)\",\n );\n }\n\n if (hasAgentUpdate) {\n await applyAgentUpdate(agentId, options);\n }\n\n if (options.instructionsFile) {\n const content = readFileSync(options.instructionsFile, \"utf-8\");\n await updateZeroAgentInstructions(agentId, content);\n }\n\n console.log(chalk.green(`✓ Agent \"${agentId}\" updated`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n getZeroAgent,\n getZeroAgentInstructions,\n getZeroAgentUserConnectors,\n listZeroConnectors,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport {\n isFirewallConnectorType,\n getConnectorFirewall,\n resolveFirewallPolicies,\n} from \"@vm0/connectors/firewalls\";\nimport type {\n FirewallPolicies,\n FirewallPolicyValue,\n} from \"@vm0/connectors/firewall-types\";\nimport type { ConnectorResponse } from \"@vm0/api-contracts/contracts/connector-schemas\";\nimport { policyIcon } from \"../../../lib/utils/format-utils\";\nimport { formatAvatar } from \"./avatar\";\n\ninterface ConnectorPermissionInfo {\n type: string;\n hasPermissions: boolean;\n permissions: Array<{ name: string; description?: string }>;\n policies: Record<string, FirewallPolicyValue> | null;\n unknownPolicy: FirewallPolicyValue;\n allowed: number;\n total: number;\n}\n\nfunction getConnectorPermissionInfo(\n type: string,\n resolvedPolicies: FirewallPolicies | null,\n): ConnectorPermissionInfo {\n if (!isFirewallConnectorType(type)) {\n return {\n type,\n hasPermissions: false,\n permissions: [],\n policies: null,\n unknownPolicy: \"allow\",\n allowed: 0,\n total: 0,\n };\n }\n\n const refPolicy = resolvedPolicies?.[type];\n const policies =\n refPolicy && Object.keys(refPolicy.policies).length > 0\n ? refPolicy.policies\n : null;\n const config = getConnectorFirewall(type);\n const permissions = config.apis.flatMap((a) => {\n return a.permissions ?? [];\n });\n const total = permissions.length;\n const allowed = policies\n ? permissions.filter((p) => {\n return policies[p.name] === \"allow\";\n }).length\n : 0;\n\n const unknownPolicy = refPolicy?.unknownPolicy ?? \"allow\";\n return {\n type,\n hasPermissions: true,\n permissions,\n policies,\n unknownPolicy,\n allowed,\n total,\n };\n}\n\nfunction printDetailedPermissions(info: ConnectorPermissionInfo): void {\n if (!info.policies) {\n const icon = policyIcon(info.unknownPolicy);\n console.log(` ${icon} unknown endpoints`);\n return;\n }\n\n const nameWidth = Math.max(\n \"unknown endpoints\".length,\n ...info.permissions.map((p) => {\n return p.name.length;\n }),\n );\n\n for (const perm of info.permissions) {\n const policy = info.policies[perm.name] ?? \"deny\";\n const desc = perm.description ?? \"\";\n console.log(\n ` ${policyIcon(policy)} ${perm.name.padEnd(nameWidth)} ${desc}`,\n );\n }\n\n const unknownIcon = policyIcon(info.unknownPolicy);\n console.log(\n ` ${unknownIcon} ${\"unknown endpoints\".padEnd(nameWidth)} Endpoints not matching any rule`,\n );\n}\n\nfunction formatConnectorIdentity(\n connector: ConnectorResponse | undefined,\n): string {\n if (!connector) return \"\";\n if (connector.externalUsername) return `@${connector.externalUsername}`;\n if (connector.externalEmail) return connector.externalEmail;\n return \"\";\n}\n\nfunction formatConnectorSummary(\n info: ConnectorPermissionInfo,\n identity?: ConnectorResponse,\n): string {\n const id = formatConnectorIdentity(identity);\n const idStr = id ? ` ${id}` : \"\";\n if (!info.hasPermissions) return `${info.type}${idStr}`;\n if (!info.policies) return `${info.type}${idStr} (full access)`;\n return `${info.type}${idStr} (${info.allowed}/${info.total} allowed)`;\n}\n\nfunction formatDetailIdentity(\n connector: ConnectorResponse | undefined,\n): string {\n if (!connector) return \"\";\n let identity = \"\";\n if (connector.externalUsername && connector.externalEmail) {\n identity = `@${connector.externalUsername} (${connector.externalEmail})`;\n } else if (connector.externalUsername) {\n identity = `@${connector.externalUsername}`;\n } else if (connector.externalEmail) {\n identity = connector.externalEmail;\n }\n if (!identity) return \"\";\n if (connector.needsReconnect) {\n identity += ` ${chalk.yellow(\"(needs reconnect)\")}`;\n }\n return identity;\n}\n\nexport const viewCommand = new Command()\n .name(\"view\")\n .description(\"View a zero agent\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\"--instructions\", \"Also show instructions content\")\n .option(\"--permissions\", \"Show full permission details for each connector\")\n .addHelpText(\n \"after\",\n `\nExamples:\n View basic info: zero agent view <agent-id>\n Include instructions: zero agent view <agent-id> --instructions\n Show permissions: zero agent view <agent-id> --permissions\n View yourself: zero agent view $ZERO_AGENT_ID --instructions`,\n )\n .action(\n withErrorHandler(\n async (\n agentId: string,\n options: { instructions?: boolean; permissions?: boolean },\n ) => {\n const [agent, connectorTypes, connectorIdentities] = await Promise.all([\n getZeroAgent(agentId),\n getZeroAgentUserConnectors(agentId),\n listZeroConnectors().catch(() => {\n return { connectors: [] as ConnectorResponse[] };\n }),\n ]);\n\n const identityMap = new Map<string, ConnectorResponse>(\n connectorIdentities.connectors.map((c) => {\n return [c.type, c];\n }),\n );\n\n console.log(chalk.bold(agent.agentId));\n if (agent.displayName) console.log(chalk.dim(agent.displayName));\n console.log();\n console.log(`Agent ID: ${agent.agentId}`);\n\n const resolvedPolicies = resolveFirewallPolicies(\n agent.permissionPolicies,\n connectorTypes,\n );\n\n const connectorInfos = connectorTypes.map((type) => {\n return getConnectorPermissionInfo(type, resolvedPolicies);\n });\n\n if (connectorInfos.length > 0) {\n const summaries = connectorInfos.map((info) => {\n return formatConnectorSummary(info, identityMap.get(info.type));\n });\n console.log(`Connectors: ${summaries.join(\", \")}`);\n }\n\n if (agent.customSkills?.length > 0) {\n console.log(`Skills: ${agent.customSkills.join(\", \")}`);\n }\n if (agent.description)\n console.log(`Description: ${agent.description}`);\n if (agent.sound) console.log(`Sound: ${agent.sound}`);\n const avatar = formatAvatar(agent.avatarUrl);\n if (avatar) console.log(`Avatar: ${avatar}`);\n\n if (options.permissions && connectorInfos.length > 0) {\n console.log();\n console.log(chalk.bold(\"Connectors:\"));\n for (const info of connectorInfos) {\n const identity = formatDetailIdentity(identityMap.get(info.type));\n console.log(` ${info.type.padEnd(14)}${identity}`);\n if (info.hasPermissions) {\n printDetailedPermissions(info);\n }\n }\n }\n\n if (options.instructions) {\n console.log();\n const result = await getZeroAgentInstructions(agentId);\n if (result.content) {\n console.log(chalk.dim(\"── Instructions ──\"));\n console.log(result.content);\n } else {\n console.log(chalk.dim(\"No instructions set\"));\n }\n }\n },\n ),\n );\n","import chalk from \"chalk\";\nimport type { FirewallPolicyValue } from \"@vm0/connectors/firewall-types\";\n\nexport function policyIcon(policy: FirewallPolicyValue): string {\n if (policy === \"allow\") return chalk.green(\"✓\");\n if (policy === \"ask\") return chalk.yellow(\"?\");\n return chalk.dim(\"✗\");\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroAgents } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List all zero agents\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero agent list\n\nNotes:\n - Use this to discover teammate agent IDs before delegating with \"zero run\"`,\n )\n .action(\n withErrorHandler(async () => {\n const agents = await listZeroAgents();\n\n if (agents.length === 0) {\n console.log(chalk.dim(\"No zero agents found\"));\n console.log(\n chalk.dim(\n ' Create one with: zero agent create --display-name \"My Agent\"',\n ),\n );\n return;\n }\n\n const idWidth = Math.max(\n 8,\n ...agents.map((a) => {\n return a.agentId.length;\n }),\n );\n const displayWidth = Math.max(\n 12,\n ...agents.map((a) => {\n return (a.displayName ?? \"\").length;\n }),\n );\n\n const header = [\n \"AGENT ID\".padEnd(idWidth),\n \"DISPLAY NAME\".padEnd(displayWidth),\n ].join(\" \");\n console.log(chalk.dim(header));\n\n for (const agent of agents) {\n const row = [\n agent.agentId.padEnd(idWidth),\n (agent.displayName ?? \"-\").padEnd(displayWidth),\n ].join(\" \");\n console.log(row);\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getZeroAgent, deleteZeroAgent } from \"../../../lib/api\";\nimport { isInteractive, promptConfirm } from \"../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const deleteCommand = new Command()\n .name(\"delete\")\n .alias(\"rm\")\n .description(\"Delete a zero agent\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero agent delete <agent-id>\n zero agent delete <agent-id> -y\n\nNotes:\n - Use -y to skip confirmation in non-interactive mode`,\n )\n .action(\n withErrorHandler(async (agentId: string, options: { yes?: boolean }) => {\n await getZeroAgent(agentId);\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 zero agent '${agentId}'?`,\n false,\n );\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteZeroAgent(agentId);\n console.log(chalk.green(`✓ Agent \"${agentId}\" deleted`));\n }),\n );\n","import { Command } from \"commander\";\nimport { connectCommand } from \"./connect\";\nimport { listCommand } from \"./list\";\nimport { searchCommand } from \"./search\";\nimport { statusCommand } from \"./status\";\n\nexport const zeroConnectorCommand = new Command()\n .name(\"connector\")\n .description(\"Check third-party service connections (GitHub, Slack, etc.)\")\n .addCommand(connectCommand)\n .addCommand(listCommand)\n .addCommand(searchCommand)\n .addCommand(statusCommand);\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n CONNECTOR_TYPE_KEYS,\n CONNECTOR_TYPES,\n connectorTypeSchema,\n type ConnectorAuthMethodId,\n type ConnectorType,\n} from \"@vm0/connectors/connectors\";\nimport {\n getConfiguredConnectorAuthMethods,\n getConnectorAuthMethod,\n} from \"@vm0/connectors/connector-utils\";\nimport { connectZeroConnectorManualGrant } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\ninterface ConnectOptions {\n readonly authMethod?: string;\n readonly value?: readonly string[];\n readonly json?: boolean;\n}\n\nfunction collectValue(value: string, previous: string[]): string[] {\n return [...previous, value];\n}\n\nfunction parseConnectorValues(rawValues: readonly string[] | undefined) {\n if (!rawValues || rawValues.length === 0) {\n throw new Error(\"At least one --value NAME=VALUE is required\", {\n cause: new Error(\n \"Example: zero connector connect zendesk --value ZENDESK_API_TOKEN=token\",\n ),\n });\n }\n\n const values: Record<string, string> = {};\n for (const rawValue of rawValues) {\n const separatorIndex = rawValue.indexOf(\"=\");\n if (separatorIndex <= 0) {\n throw new Error(\"Invalid --value format\", {\n cause: new Error(\"Use --value NAME=VALUE\"),\n });\n }\n\n const name = rawValue.slice(0, separatorIndex);\n if (!name.trim()) {\n throw new Error(\"Invalid --value format\", {\n cause: new Error(\"Field name cannot be empty\"),\n });\n }\n\n values[name] = rawValue.slice(separatorIndex + 1);\n }\n\n return values;\n}\n\nfunction parseConnectorType(type: string): ConnectorType {\n const parsed = connectorTypeSchema.safeParse(type);\n if (parsed.success) {\n return parsed.data;\n }\n\n throw new Error(`Unknown connector type: ${type}`, {\n cause: new Error(`Available connectors: ${CONNECTOR_TYPE_KEYS.join(\", \")}`),\n });\n}\n\nfunction parseConfiguredAuthMethod(\n type: ConnectorType,\n rawAuthMethod: string,\n): ConnectorAuthMethodId {\n const configuredAuthMethods = getConfiguredConnectorAuthMethods(type);\n const authMethod = configuredAuthMethods.find((method) => {\n return method === rawAuthMethod;\n });\n if (authMethod) {\n return authMethod;\n }\n\n throw new Error(\n `${type} connector does not have ${rawAuthMethod} auth method`,\n {\n cause: new Error(\n `Available auth methods: ${configuredAuthMethods.join(\", \")}`,\n ),\n },\n );\n}\n\nfunction getManualGrantAuthMethods(\n type: ConnectorType,\n): ConnectorAuthMethodId[] {\n return getConfiguredConnectorAuthMethods(type).filter((authMethod) => {\n return getConnectorAuthMethod(type, authMethod)?.grant.kind === \"manual\";\n });\n}\n\nfunction parseManualGrantAuthMethod(\n type: ConnectorType,\n rawAuthMethod: string | undefined,\n): ConnectorAuthMethodId {\n if (rawAuthMethod) {\n const authMethod = parseConfiguredAuthMethod(type, rawAuthMethod);\n if (getConnectorAuthMethod(type, authMethod)?.grant.kind === \"manual\") {\n return authMethod;\n }\n\n throw new Error(\n `${type} ${authMethod} auth method does not use a manual grant`,\n );\n }\n\n const authMethods = getManualGrantAuthMethods(type);\n const authMethod = authMethods[0];\n if (authMethods.length === 1 && authMethod) {\n return authMethod;\n }\n\n if (authMethods.length === 0) {\n throw new Error(`${type} connector does not use a manual grant`);\n }\n\n throw new Error(`${type} connector has multiple manual grant auth methods`, {\n cause: new Error(`Pass --auth-method ${authMethods.join(\"|\")}`),\n });\n}\n\nexport const connectCommand = new Command()\n .name(\"connect\")\n .description(\"Connect a connector with manual grant values\")\n .argument(\"<type>\", \"Connector type (e.g., zendesk)\")\n .option(\"--auth-method <method>\", \"Connector auth method to use\")\n .option(\n \"--value <name=value>\",\n \"Connector field value; repeat for multiple fields\",\n collectValue,\n [],\n )\n .option(\"--json\", \"Print the connector response as JSON\")\n .action(\n withErrorHandler(async (type: string, options: ConnectOptions) => {\n const connectorType = parseConnectorType(type);\n const authMethod = parseManualGrantAuthMethod(\n connectorType,\n options.authMethod,\n );\n const connector = await connectZeroConnectorManualGrant(\n connectorType,\n authMethod,\n parseConnectorValues(options.value),\n );\n\n if (options.json) {\n console.log(JSON.stringify(connector, null, 2));\n return;\n }\n\n console.log(\n chalk.green(`✓ ${CONNECTOR_TYPES[connectorType].label} connected`),\n );\n console.log(chalk.dim(` Type: ${connector.type}`));\n console.log(chalk.dim(` Auth Method: ${connector.authMethod}`));\n console.log(chalk.dim(` Run: zero connector status ${connector.type}`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n CONNECTOR_TYPES,\n type ConnectorType,\n} from \"@vm0/connectors/connectors\";\nimport { listZeroConnectors, searchZeroConnectors } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolveAgentContext } from \"./agent-context\";\nimport { padEndAnsi, renderConnectedAsCell, stripAnsi } from \"./connected-as\";\n\nfunction isConnectorType(type: string): type is ConnectorType {\n return type in CONNECTOR_TYPES;\n}\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List all connectors and their status\")\n .option(\"--agent <id>\", \"Show per-agent authorization column\")\n .action(\n withErrorHandler(async (options: { agent?: string }) => {\n const [{ connectors }, availableCatalog, agentCtx] = await Promise.all([\n listZeroConnectors(),\n searchZeroConnectors(),\n resolveAgentContext(options.agent),\n ]);\n const connectedMap = new Map(\n connectors.map((c) => {\n return [c.type, c];\n }),\n );\n\n const allTypes = availableCatalog.connectors\n .map((connector) => {\n return connector.id;\n })\n .filter(isConnectorType);\n\n const typeWidth = Math.max(\n 4,\n ...allTypes.map((t) => {\n return t.length;\n }),\n );\n\n const connectedAsHeader = \"CONNECTED AS\";\n const connectedCells = allTypes.map((type) => {\n return renderConnectedAsCell(connectedMap.get(type));\n });\n const connectedAsWidth = Math.max(\n connectedAsHeader.length,\n ...connectedCells.map((c) => {\n return stripAnsi(c).length;\n }),\n );\n\n const authorizedHeader = agentCtx\n ? `AUTHORIZED FOR ${agentCtx.displayName}`\n : null;\n\n // Print header\n const headerParts = [\n \"TYPE\".padEnd(typeWidth),\n connectedAsHeader.padEnd(connectedAsWidth),\n ];\n if (authorizedHeader) headerParts.push(authorizedHeader);\n console.log(chalk.dim(headerParts.join(\" \")));\n\n // Print rows\n for (let i = 0; i < allTypes.length; i++) {\n const type = allTypes[i]!;\n const connectedCell = padEndAnsi(connectedCells[i]!, connectedAsWidth);\n const parts = [type.padEnd(typeWidth), connectedCell];\n if (agentCtx) {\n parts.push(\n agentCtx.authorizedTypes.has(type)\n ? chalk.green(\"✓\")\n : chalk.dim(\"-\"),\n );\n }\n console.log(parts.join(\" \"));\n }\n }),\n );\n","import { getZeroAgent, getZeroAgentUserConnectors } from \"../../../lib/api\";\n\ninterface AgentContext {\n agentId: string;\n displayName: string;\n authorizedTypes: Set<string>;\n}\n\nexport async function resolveAgentContext(\n flagAgentId: string | undefined,\n): Promise<AgentContext | null> {\n const agentId = flagAgentId ?? process.env.ZERO_AGENT_ID;\n if (!agentId) return null;\n\n const [agent, enabledTypes] = await Promise.all([\n getZeroAgent(agentId),\n getZeroAgentUserConnectors(agentId),\n ]);\n\n return {\n agentId: agent.agentId,\n displayName: agent.displayName ?? agent.agentId,\n authorizedTypes: new Set(enabledTypes),\n };\n}\n","import chalk from \"chalk\";\nimport { hasRequiredConnectorAuthMethodScopes } from \"@vm0/connectors/connector-utils\";\nimport type { ConnectorListResponse } from \"@vm0/api-contracts/contracts/connector-schemas\";\n\ntype Connector = ConnectorListResponse[\"connectors\"][number];\n\nfunction renderIdentity(connector: Connector): string {\n if (connector.externalUsername) return `@${connector.externalUsername}`;\n if (connector.externalEmail) return connector.externalEmail;\n return \"-\";\n}\n\nexport function renderConnectedAsCell(\n connector: Connector | undefined,\n): string {\n if (!connector) return chalk.dim(\"(not connected)\");\n const identity = renderIdentity(connector);\n if (connector.needsReconnect) {\n return chalk.yellow(`${identity} (reconnect needed)`);\n }\n const scopeMismatch = !hasRequiredConnectorAuthMethodScopes(\n connector.type,\n connector.authMethod,\n connector.oauthScopes,\n );\n if (scopeMismatch) {\n return chalk.yellow(`${identity} (permissions update available)`);\n }\n return identity;\n}\n\nconst ESC = \"\\u001b\";\nconst ANSI_PATTERN = new RegExp(`${ESC}\\\\[[0-9;]*m`, \"g\");\n\nexport function stripAnsi(s: string): string {\n return s.replace(ANSI_PATTERN, \"\");\n}\n\nexport function padEndAnsi(s: string, width: number): string {\n const visible = stripAnsi(s).length;\n return s + \" \".repeat(Math.max(0, width - visible));\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n CONNECTOR_TYPES,\n type ConnectorType,\n} from \"@vm0/connectors/connectors\";\nimport { searchConnectors } from \"@vm0/connectors/connector-search\";\nimport { listZeroConnectors, searchZeroConnectors } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolveAgentContext } from \"./agent-context\";\nimport { padEndAnsi, renderConnectedAsCell, stripAnsi } from \"./connected-as\";\n\nconst DEFAULT_LIMIT = 5;\nconst EXACT_MATCH_THRESHOLD = 80;\n\nfunction isConnectorType(type: string): type is ConnectorType {\n return type in CONNECTOR_TYPES;\n}\n\nfunction parseLimit(raw: string): number {\n const n = Number.parseInt(raw, 10);\n if (!Number.isFinite(n) || n <= 0) {\n throw new Error(`--limit must be a positive integer, got \"${raw}\".`);\n }\n return n;\n}\n\nexport const searchCommand = new Command()\n .name(\"search\")\n .description(\n \"Search connectors by type, label, environment name, secret, or tag\",\n )\n .argument(\"<keyword>\", \"Search keyword (case-insensitive)\")\n .option(\"--agent <id>\", \"Show per-agent authorization column\")\n .option(\n \"--limit <n>\",\n `Maximum number of results to display (default ${DEFAULT_LIMIT})`,\n parseLimit,\n DEFAULT_LIMIT,\n )\n .action(\n withErrorHandler(\n async (keyword: string, options: { agent?: string; limit: number }) => {\n const trimmed = keyword.trim();\n if (!trimmed) {\n throw new Error(\"Keyword cannot be empty.\");\n }\n\n const [{ connectors }, availableCatalog, agentCtx] = await Promise.all([\n listZeroConnectors(),\n searchZeroConnectors(),\n resolveAgentContext(options.agent),\n ]);\n const connectedMap = new Map(\n connectors.map((c) => {\n return [c.type, c];\n }),\n );\n\n const availableTypes = new Set(\n availableCatalog.connectors\n .map((connector) => {\n return connector.id;\n })\n .filter(isConnectorType),\n );\n\n const { results, total } = searchConnectors(\n trimmed,\n options.limit,\n (type) => {\n return availableTypes.has(type);\n },\n );\n\n if (results.length === 0) {\n console.log(\"No matches found.\");\n return;\n }\n\n const topScore = results[0]!.score;\n if (topScore < EXACT_MATCH_THRESHOLD) {\n console.log(\"No exact match. Showing closest:\");\n }\n if (total > options.limit) {\n console.log(`Too many results (top ${options.limit} of ${total}):`);\n }\n\n const typeHeader = \"TYPE\";\n const connectedAsHeader = \"CONNECTED AS\";\n\n const connectedCells = results.map((r) => {\n return renderConnectedAsCell(connectedMap.get(r.type));\n });\n\n const typeWidth = Math.max(\n typeHeader.length,\n ...results.map((r) => {\n return r.type.length;\n }),\n );\n const connectedAsWidth = Math.max(\n connectedAsHeader.length,\n ...connectedCells.map((c) => {\n return stripAnsi(c).length;\n }),\n );\n\n const headerParts = [\n typeHeader.padEnd(typeWidth),\n connectedAsHeader.padEnd(connectedAsWidth),\n ];\n if (agentCtx) {\n headerParts.push(`AUTHORIZED FOR ${agentCtx.displayName}`);\n }\n console.log(chalk.dim(headerParts.join(\" \")));\n\n for (let i = 0; i < results.length; i++) {\n const result = results[i]!;\n const parts = [\n result.type.padEnd(typeWidth),\n padEndAnsi(connectedCells[i]!, connectedAsWidth),\n ];\n if (agentCtx) {\n parts.push(\n agentCtx.authorizedTypes.has(result.type)\n ? chalk.green(\"✓\")\n : chalk.dim(\"-\"),\n );\n }\n console.log(parts.join(\" \"));\n }\n },\n ),\n );\n","import {\n CONNECTOR_TYPE_KEYS,\n CONNECTOR_TYPES,\n type ConnectorAccessConfig,\n type ConnectorAuthMethodConfig,\n type ConnectorConfig,\n type ConnectorType,\n} from \"./connectors\";\nimport { getConnectorEnvBindingEntries } from \"./connector-utils\";\n\n/**\n * Result of a connector search hit, one per matched connector type.\n */\nexport interface ConnectorSearchResult {\n readonly type: ConnectorType;\n readonly score: number;\n /** Short label describing the matched field (e.g. \"type\", \"env:GH_TOKEN\", \"tag:vcs\", \"token:gh\"). */\n readonly matchedField: string;\n}\n\nexport interface ConnectorSearchOutput {\n /** Results sorted by score desc then type asc, already capped at `limit`. */\n readonly results: readonly ConnectorSearchResult[];\n /** Total candidates above the minimum threshold, before applying `limit`. */\n readonly total: number;\n}\n\nconst TOKEN_BOUNDARY = /[_\\-\\s]+/;\nconst CASE_BOUNDARY = /(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/;\nconst MIN_SCORE = 10;\n\n/**\n * Split a string into lowercase tokens on `_`, `-`, whitespace, and\n * camel/Pascal case boundaries. Digits stay attached to the preceding letters\n * (e.g. `v2`). Empty tokens are dropped and duplicates deduped.\n */\nfunction tokenize(input: string): Set<string> {\n const tokens = new Set<string>();\n for (const chunk of input.split(TOKEN_BOUNDARY)) {\n if (!chunk) continue;\n for (const sub of chunk.split(CASE_BOUNDARY)) {\n const lower = sub.toLowerCase();\n if (lower) tokens.add(lower);\n }\n }\n return tokens;\n}\n\nfunction connectorAccessEnvBindings(\n access: ConnectorAccessConfig,\n): Record<string, string> {\n switch (access.kind) {\n case \"static\":\n case \"refresh-token\":\n return access.envBindings;\n case \"none\":\n return {};\n }\n}\n\nfunction getManualGrantFields(\n method: ConnectorAuthMethodConfig,\n): Record<string, unknown> | undefined {\n return method.grant.kind === \"manual\" ? method.grant.fields : undefined;\n}\n\nfunction listSecretNames(config: ConnectorConfig): string[] {\n const names: string[] = [];\n for (const method of Object.values(config.authMethods)) {\n for (const name of Object.keys(getManualGrantFields(method) ?? {})) {\n names.push(name);\n }\n for (const valueRef of Object.values(\n connectorAccessEnvBindings(method.access),\n )) {\n if (valueRef.startsWith(\"$secrets.\")) {\n names.push(valueRef.slice(\"$secrets.\".length));\n }\n }\n }\n return names;\n}\n\ntype ScoreHit = { score: number; matchedField: string };\n\nfunction listEnvNames(type: ConnectorType): string[] {\n return [\n ...new Set(\n getConnectorEnvBindingEntries(type).map(({ envName }) => {\n return envName;\n }),\n ),\n ];\n}\n\nfunction findExactMatch(\n keywordLower: string,\n type: ConnectorType,\n config: ConnectorConfig,\n): ScoreHit | null {\n if (type.toLowerCase() === keywordLower) {\n return { score: 100, matchedField: \"type\" };\n }\n for (const envName of listEnvNames(type)) {\n if (envName.toLowerCase() === keywordLower) {\n return { score: 90, matchedField: `env:${envName}` };\n }\n }\n if (config.label.toLowerCase() === keywordLower) {\n return { score: 80, matchedField: \"label\" };\n }\n const tags = config.tags ?? [];\n for (const tag of tags) {\n if (tag === keywordLower) {\n return { score: 70, matchedField: `tag:${tag}` };\n }\n }\n return null;\n}\n\nfunction findSubstringMatch(\n keywordLower: string,\n type: ConnectorType,\n config: ConnectorConfig,\n): ScoreHit | null {\n if (type.toLowerCase().includes(keywordLower)) {\n return { score: 50, matchedField: \"type\" };\n }\n if (config.label.toLowerCase().includes(keywordLower)) {\n return { score: 50, matchedField: \"label\" };\n }\n for (const envName of listEnvNames(type)) {\n if (envName.toLowerCase().includes(keywordLower)) {\n return { score: 40, matchedField: `env:${envName}` };\n }\n }\n for (const name of listSecretNames(config)) {\n if (name.toLowerCase().includes(keywordLower)) {\n return { score: 30, matchedField: `secret:${name}` };\n }\n }\n const tags = config.tags ?? [];\n for (const tag of tags) {\n if (tag.includes(keywordLower)) {\n return { score: 25, matchedField: `tag:${tag}` };\n }\n }\n return null;\n}\n\nfunction collectCandidateTokens(\n type: ConnectorType,\n config: ConnectorConfig,\n): Set<string> {\n const tokens = new Set<string>();\n const sources = [\n type,\n config.label,\n ...listEnvNames(type),\n ...listSecretNames(config),\n ...(config.tags ?? []),\n ];\n for (const source of sources) {\n for (const token of tokenize(source)) {\n tokens.add(token);\n }\n }\n return tokens;\n}\n\nfunction findTokenIntersection(\n keywordTokens: Set<string>,\n type: ConnectorType,\n config: ConnectorConfig,\n): ScoreHit | null {\n const candidateTokens = collectCandidateTokens(type, config);\n let intersection = 0;\n let firstCommon = \"\";\n for (const token of keywordTokens) {\n if (candidateTokens.has(token)) {\n intersection++;\n if (!firstCommon) firstCommon = token;\n }\n }\n if (intersection === 0) return null;\n return { score: 10 * intersection, matchedField: `token:${firstCommon}` };\n}\n\nfunction scoreConnector(\n keywordLower: string,\n keywordTokens: Set<string>,\n type: ConnectorType,\n config: ConnectorConfig,\n): ScoreHit | null {\n const exact = findExactMatch(keywordLower, type, config);\n if (exact) return exact;\n\n const candidates: ScoreHit[] = [];\n const substring = findSubstringMatch(keywordLower, type, config);\n if (substring) candidates.push(substring);\n const token = findTokenIntersection(keywordTokens, type, config);\n if (token) candidates.push(token);\n\n if (candidates.length === 0) return null;\n const best = candidates.reduce((a, b) => {\n return a.score >= b.score ? a : b;\n });\n if (best.score < MIN_SCORE) return null;\n return best;\n}\n\n/**\n * Search the connector catalog by weighted multi-field ranking.\n *\n * Matches the keyword against type keys, labels, environment names, secret names,\n * and `tags`. Score is the max over matched rules (never a sum). Results with\n * score below the minimum threshold are dropped. Sort order: score desc, then\n * type asc.\n */\nexport function searchConnectors(\n keyword: string,\n limit: number,\n filter?: (type: ConnectorType) => boolean,\n): ConnectorSearchOutput {\n const trimmed = keyword.trim();\n if (!trimmed) return { results: [], total: 0 };\n\n const keywordLower = trimmed.toLowerCase();\n const keywordTokens = tokenize(trimmed);\n\n const hits: ConnectorSearchResult[] = [];\n for (const type of CONNECTOR_TYPE_KEYS) {\n if (filter && !filter(type)) continue;\n const config = CONNECTOR_TYPES[type];\n const hit = scoreConnector(keywordLower, keywordTokens, type, config);\n if (!hit) continue;\n hits.push({ type, score: hit.score, matchedField: hit.matchedField });\n }\n\n hits.sort((a, b) => {\n if (b.score !== a.score) return b.score - a.score;\n return a.type.localeCompare(b.type);\n });\n\n const capped = limit > 0 ? hits.slice(0, limit) : hits;\n return { results: capped, total: hits.length };\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n CONNECTOR_TYPE_KEYS,\n CONNECTOR_TYPES,\n type ConnectorType,\n connectorTypeSchema,\n} from \"@vm0/connectors/connectors\";\nimport {\n getConnectorAuthMethodScopeDiff,\n hasRequiredConnectorAuthMethodScopes,\n} from \"@vm0/connectors/connector-utils\";\nimport { getZeroConnector, searchZeroConnectors } from \"../../../lib/api\";\nimport { formatDateTime } from \"../../../lib/domain/schedule-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolveAgentContext } from \"./agent-context\";\nimport { getPlatformOrigin } from \"../doctor/platform-url\";\n\nconst LABEL_WIDTH = 16;\n\ntype Connector = NonNullable<Awaited<ReturnType<typeof getZeroConnector>>>;\ntype AgentContext = NonNullable<\n Awaited<ReturnType<typeof resolveAgentContext>>\n>;\n\nfunction isConnectorType(type: string): type is ConnectorType {\n return type in CONNECTOR_TYPES;\n}\n\nasync function availableConnectorTypes(): Promise<Set<ConnectorType>> {\n const catalog = await searchZeroConnectors();\n return new Set(\n catalog.connectors\n .map((connector) => {\n return connector.id;\n })\n .filter(isConnectorType),\n );\n}\n\nfunction printConnectorDetails(\n type: ConnectorType,\n connector: Connector | null,\n): void {\n if (connector) {\n console.log(\n `${\"Status:\".padEnd(LABEL_WIDTH)}${\n connector.needsReconnect\n ? chalk.yellow(\"reconnect needed\")\n : chalk.green(\"connected\")\n }`,\n );\n console.log(\n `${\"Account:\".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`,\n );\n console.log(`${\"Auth Method:\".padEnd(LABEL_WIDTH)}${connector.authMethod}`);\n\n if (connector.oauthScopes && connector.oauthScopes.length > 0) {\n console.log(\n `${\"OAuth Scopes:\".padEnd(LABEL_WIDTH)}${connector.oauthScopes.join(\", \")}`,\n );\n }\n\n if (\n !hasRequiredConnectorAuthMethodScopes(\n type,\n connector.authMethod,\n connector.oauthScopes,\n )\n ) {\n const diff = getConnectorAuthMethodScopeDiff(\n type,\n connector.authMethod,\n connector.oauthScopes,\n );\n console.log(\n `${\"Permissions:\".padEnd(LABEL_WIDTH)}${chalk.yellow(\"update available\")}`,\n );\n if (diff.addedScopes.length > 0) {\n console.log(\n `${\" Added:\".padEnd(LABEL_WIDTH)}${diff.addedScopes.join(\", \")}`,\n );\n }\n if (diff.removedScopes.length > 0) {\n console.log(\n `${\" Removed:\".padEnd(LABEL_WIDTH)}${diff.removedScopes.join(\", \")}`,\n );\n }\n }\n\n console.log(\n `${\"Connected:\".padEnd(LABEL_WIDTH)}${formatDateTime(connector.createdAt)}`,\n );\n\n if (connector.updatedAt !== connector.createdAt) {\n console.log(\n `${\"Last Updated:\".padEnd(LABEL_WIDTH)}${formatDateTime(connector.updatedAt)}`,\n );\n }\n } else {\n console.log(\n `${\"Status:\".padEnd(LABEL_WIDTH)}${chalk.dim(\"not connected\")}`,\n );\n }\n}\n\nasync function printAgentAction(\n type: ConnectorType,\n connector: Connector | null,\n agentCtx: AgentContext,\n): Promise<void> {\n const authorized = agentCtx.authorizedTypes.has(type);\n const isConnected = connector !== null;\n const needsReconnect = connector?.needsReconnect === true;\n const agentLabel =\n agentCtx.displayName === agentCtx.agentId\n ? agentCtx.agentId\n : `${agentCtx.displayName} (${agentCtx.agentId})`;\n\n console.log();\n if (needsReconnect) {\n const origin = await getPlatformOrigin();\n const url = `${origin}/connectors`;\n console.log(\n `The ${type} connector is connected but needs to be reconnected before agent ${agentLabel} can use it.`,\n );\n console.log(`Reconnect it at: [Reconnect ${type}](${url})`);\n } else if (authorized && !isConnected) {\n const origin = await getPlatformOrigin();\n const url = `${origin}/connectors/${type}/connect?agentId=${agentCtx.agentId}`;\n console.log(\n `The ${type} connector is authorized for agent ${agentLabel}, but it is not connected.`,\n );\n console.log(`Connect it at: [Connect ${type}](${url})`);\n } else if (authorized) {\n console.log(`The ${type} connector is authorized for agent ${agentLabel}.`);\n } else if (!isConnected) {\n const origin = await getPlatformOrigin();\n const url = `${origin}/connectors/${type}/connect?agentId=${agentCtx.agentId}`;\n console.log(\n `The ${type} connector is not connected. Once connected, it will be authorized for agent ${agentLabel}.`,\n );\n console.log(`Connect and authorize it at: [Connect ${type}](${url})`);\n } else {\n const origin = await getPlatformOrigin();\n const url = `${origin}/connectors/${type}/authorize?agentId=${agentCtx.agentId}`;\n console.log(\n `The ${type} connector is not authorized for agent ${agentLabel}.`,\n );\n console.log(`Authorize it at: [Authorize ${type}](${url})`);\n }\n}\n\nasync function printStandaloneAction(\n type: ConnectorType,\n connector: Connector | null,\n): Promise<void> {\n if (connector && !connector.needsReconnect) return;\n\n const origin = await getPlatformOrigin();\n console.log();\n if (connector?.needsReconnect) {\n const url = `${origin}/connectors`;\n console.log(\n `The ${type} connector is connected but needs to be reconnected.`,\n );\n console.log(`Reconnect it at: [Reconnect ${type}](${url})`);\n } else {\n const url = `${origin}/connectors/${type}/connect`;\n console.log(`Connect it at: [Connect ${type}](${url})`);\n }\n}\n\nexport const statusCommand = new Command()\n .name(\"status\")\n .description(\"Show detailed status of a connector\")\n .argument(\"<type>\", \"Connector type (e.g., github)\")\n .option(\"--agent <id>\", \"Show authorization state for the given agent\")\n .action(\n withErrorHandler(async (type: string, options: { agent?: string }) => {\n const parseResult = connectorTypeSchema.safeParse(type);\n if (!parseResult.success) {\n const available = CONNECTOR_TYPE_KEYS.join(\", \");\n throw new Error(`Unknown connector type: ${type}`, {\n cause: new Error(`Available connectors: ${available}`),\n });\n }\n\n const [connector, availableTypes, agentCtx] = await Promise.all([\n getZeroConnector(parseResult.data),\n availableConnectorTypes(),\n resolveAgentContext(options.agent),\n ]);\n const available = availableTypes.has(parseResult.data);\n\n console.log(`Connector: ${chalk.cyan(type)}`);\n console.log();\n\n printConnectorDetails(parseResult.data, connector);\n if (!available) {\n console.log();\n console.log(`The ${type} connector is not available for this account.`);\n return;\n }\n\n if (agentCtx) {\n await printAgentAction(parseResult.data, connector, agentCtx);\n } else {\n await printStandaloneAction(parseResult.data, connector);\n }\n }),\n );\n","/**\n * Format a date string as relative time (e.g., \"in 2h\", \"3d ago\")\n */\nexport function formatRelativeTime(dateStr: string | null): string {\n if (!dateStr) return \"-\";\n\n const date = new Date(dateStr);\n const now = new Date();\n const diffMs = date.getTime() - now.getTime();\n const diffAbs = Math.abs(diffMs);\n\n const minutes = Math.floor(diffAbs / (1000 * 60));\n const hours = Math.floor(diffAbs / (1000 * 60 * 60));\n const days = Math.floor(diffAbs / (1000 * 60 * 60 * 24));\n\n const isPast = diffMs < 0;\n\n if (days > 0) {\n return isPast ? `${days}d ago` : `in ${days}d`;\n } else if (hours > 0) {\n return isPast ? `${hours}h ago` : `in ${hours}h`;\n } else if (minutes > 0) {\n return isPast ? `${minutes}m ago` : `in ${minutes}m`;\n } else {\n return isPast ? \"just now\" : \"soon\";\n }\n}\n\n/**\n * Format a date string with both absolute and relative time\n * e.g., \"2025-01-14 09:00 (in 2h)\"\n * Uses local timezone, but doesn't include timezone in output (shown separately)\n */\nexport function formatDateTime(dateStr: string | null): string {\n if (!dateStr) return \"-\";\n\n const date = new Date(dateStr);\n\n // Format: YYYY-MM-DD HH:MM (no seconds, no timezone - shown separately)\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n const hours = String(date.getHours()).padStart(2, \"0\");\n const minutes = String(date.getMinutes()).padStart(2, \"0\");\n\n const formatted = `${year}-${month}-${day} ${hours}:${minutes}`;\n const relative = formatRelativeTime(dateStr);\n\n return `${formatted} (${relative})`;\n}\n\n/**\n * Frequency type for schedule wizard\n */\nexport type ScheduleFrequency =\n | \"daily\"\n | \"weekly\"\n | \"monthly\"\n | \"once\"\n | \"loop\";\n\n/**\n * Generate cron expression from user-friendly inputs\n * @param frequency - Schedule frequency type\n * @param time - Time in HH:MM format (24-hour)\n * @param day - Day of week (0-6, Sun=0) for weekly, or day of month (1-31) for monthly\n * @returns Cron expression string\n */\nexport function generateCronExpression(\n frequency: Exclude<ScheduleFrequency, \"once\" | \"loop\">,\n time: string,\n day?: number,\n): string {\n const [hourStr, minuteStr] = time.split(\":\");\n const hour = parseInt(hourStr ?? \"0\", 10);\n const minute = parseInt(minuteStr ?? \"0\", 10);\n\n switch (frequency) {\n case \"daily\":\n return `${minute} ${hour} * * *`;\n case \"weekly\":\n return `${minute} ${hour} * * ${day ?? 1}`;\n case \"monthly\":\n return `${minute} ${hour} ${day ?? 1} * *`;\n }\n}\n\n/**\n * Detect system timezone using Intl API\n * @returns IANA timezone identifier (e.g., \"America/New_York\")\n */\nexport function detectTimezone(): string {\n return Intl.DateTimeFormat().resolvedOptions().timeZone;\n}\n\n/**\n * Validate time format (HH:MM, 24-hour)\n * @param time - Time string to validate\n * @returns true if valid, error message if invalid\n */\nexport function validateTimeFormat(time: string): boolean | string {\n const match = time.match(/^(\\d{1,2}):(\\d{2})$/);\n if (!match) {\n return \"Invalid format. Use HH:MM (e.g., 09:00)\";\n }\n\n const hour = parseInt(match[1]!, 10);\n const minute = parseInt(match[2]!, 10);\n\n if (hour < 0 || hour > 23) {\n return \"Hour must be 0-23\";\n }\n if (minute < 0 || minute > 59) {\n return \"Minute must be 0-59\";\n }\n if (minute % 5 !== 0) {\n return \"Minute must be a multiple of 5 (0, 5, 10, ..., 55)\";\n }\n\n return true;\n}\n\n/**\n * Validate date format (YYYY-MM-DD)\n * @param date - Date string to validate\n * @returns true if valid, error message if invalid\n */\nexport function validateDateFormat(date: string): boolean | string {\n const match = date.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/);\n if (!match) {\n return \"Invalid format. Use YYYY-MM-DD (e.g., 2025-01-15)\";\n }\n\n const year = parseInt(match[1]!, 10);\n const month = parseInt(match[2]!, 10);\n const day = parseInt(match[3]!, 10);\n\n if (year < 2000 || year > 2100) {\n return \"Year must be between 2000 and 2100\";\n }\n if (month < 1 || month > 12) {\n return \"Month must be 1-12\";\n }\n if (day < 1 || day > 31) {\n return \"Day must be 1-31\";\n }\n\n // Validate the date is actually valid (e.g., not Feb 30)\n const testDate = new Date(year, month - 1, day);\n if (\n testDate.getFullYear() !== year ||\n testDate.getMonth() !== month - 1 ||\n testDate.getDate() !== day\n ) {\n return \"Invalid date\";\n }\n\n return true;\n}\n\n/**\n * Get tomorrow's date in local timezone as YYYY-MM-DD\n * @returns Date string in YYYY-MM-DD format\n */\nexport function getTomorrowDateLocal(): string {\n const tomorrow = new Date();\n tomorrow.setDate(tomorrow.getDate() + 1);\n const year = tomorrow.getFullYear();\n const month = String(tomorrow.getMonth() + 1).padStart(2, \"0\");\n const day = String(tomorrow.getDate()).padStart(2, \"0\");\n return `${year}-${month}-${day}`;\n}\n\n/**\n * Get current time in local timezone as HH:MM\n * @returns Time string in HH:MM format\n */\nexport function getCurrentTimeLocal(): string {\n const now = new Date();\n const hours = String(now.getHours()).padStart(2, \"0\");\n const minutes = String(now.getMinutes()).padStart(2, \"0\");\n return `${hours}:${minutes}`;\n}\n\n/**\n * Convert a human-readable datetime string to ISO format\n * Supports formats: \"YYYY-MM-DD HH:MM\" or full ISO string\n * @param dateTimeStr - DateTime string (e.g., \"2025-01-15 14:30\")\n * @returns ISO format string (e.g., \"2025-01-15T14:30:00.000Z\")\n */\nexport function toISODateTime(dateTimeStr: string): string {\n // If already in ISO format, return as-is\n if (dateTimeStr.includes(\"T\") && dateTimeStr.endsWith(\"Z\")) {\n return dateTimeStr;\n }\n\n // Convert \"YYYY-MM-DD HH:MM\" to ISO\n const isoStr = dateTimeStr.replace(\" \", \"T\") + \":00\";\n const date = new Date(isoStr);\n return date.toISOString();\n}\n","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","import { Command, Option } from \"commander\";\nimport chalk from \"chalk\";\n\nimport { createZeroCreditCheckout, getZeroOrgMembers } from \"../../lib/api\";\nimport { withErrorHandler } from \"../../lib/command\";\nimport { getPlatformOrigin } from \"./doctor/platform-url\";\n\nfunction parseCredits(value: string): number {\n const credits = Number(value.replaceAll(\",\", \"\"));\n if (!Number.isInteger(credits) || credits <= 0) {\n throw new Error(\"credits must be a positive integer\");\n }\n return credits;\n}\n\nexport const zeroCreditCommand = new Command()\n .name(\"credit\")\n .description(\"Create a Stripe checkout link to buy credits\")\n .argument(\"<credits>\", \"Number of credits to buy\", parseCredits)\n .addOption(\n new Option(\"--auto-recharge\", \"Enable auto-recharge after checkout\"),\n )\n .option(\n \"--auto-recharge-threshold <credits>\",\n \"Recharge when balance is at or below this number of credits\",\n parseCredits,\n )\n .option(\n \"--auto-recharge-amount <credits>\",\n \"Credits to buy for each auto-recharge\",\n parseCredits,\n )\n .action(\n withErrorHandler(\n async (\n credits: number,\n options: {\n readonly autoRecharge?: boolean;\n readonly autoRechargeThreshold?: number;\n readonly autoRechargeAmount?: number;\n },\n ) => {\n const members = await getZeroOrgMembers();\n if (members.role !== \"admin\") {\n console.log(\n chalk.yellow(\n \"Only organization admins can buy credits. Run `zero doctor credit` to see the current credit status and org admins.\",\n ),\n );\n return;\n }\n\n const origin = await getPlatformOrigin();\n const successUrl = `${origin}/?settings=usage&credit=success`;\n const cancelUrl = `${origin}/?settings=usage&credit=canceled`;\n if (\n options.autoRecharge !== true &&\n (options.autoRechargeThreshold !== undefined ||\n options.autoRechargeAmount !== undefined)\n ) {\n throw new Error(\n \"--auto-recharge-threshold and --auto-recharge-amount require --auto-recharge\",\n );\n }\n\n if (\n options.autoRecharge === true &&\n (options.autoRechargeThreshold === undefined ||\n options.autoRechargeAmount === undefined)\n ) {\n throw new Error(\n \"--auto-recharge requires --auto-recharge-threshold and --auto-recharge-amount\",\n );\n }\n\n const autoRecharge =\n options.autoRecharge === true\n ? {\n enabled: true,\n threshold: options.autoRechargeThreshold,\n amount: options.autoRechargeAmount,\n }\n : undefined;\n\n const result = await createZeroCreditCheckout({\n credits,\n successUrl,\n cancelUrl,\n ...(autoRecharge ? { autoRecharge } : {}),\n });\n console.log(chalk.bold(\"Credit checkout link:\"));\n console.log(result.url);\n },\n ),\n );\n","import { Command } from \"commander\";\nimport { checkConnectorCommand } from \"./check-connector\";\nimport { permissionDenyCommand } from \"./permission-deny\";\nimport { permissionChangeCommand } from \"./permission-change\";\nimport { creditCommand } from \"./credit\";\n\nexport const zeroDoctorCommand = new Command()\n .name(\"doctor\")\n .description(\"Diagnose runtime issues (connector health, permission denials)\")\n .addCommand(checkConnectorCommand)\n .addCommand(creditCommand)\n .addCommand(permissionDenyCommand)\n .addCommand(permissionChangeCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Check a connector? zero doctor check-connector --env-name GITHUB_TOKEN\n Check a URL? zero doctor check-connector --url https://api.github.com/repos/owner/repo\n Check credits? zero doctor credit\n Check with permission? zero doctor check-connector --env-name SLACK_TOKEN --check-permission chat:write\n Permission denied? zero doctor permission-deny github --method GET --path /repos/owner/repo\n Change a permission? zero doctor permission-change github --permission contents:read --enable\n\nNotes:\n - Use zero doctor credit when a run or generation fails because the org has insufficient credits, when a user asks how to recharge, or before trying to buy credits\n - Use this when your task fails due to a missing connector environment name or permission denial\n - Use zero generate <type> (no --prompt) to see every provider available for a given generation type\n - The doctor will identify the issue and give the user a link to resolve it`,\n );\n","import { Command, Option } from \"commander\";\nimport {\n CONNECTOR_TYPE_KEYS,\n CONNECTOR_TYPES,\n type ConnectorType,\n} from \"@vm0/connectors/connectors\";\nimport {\n getConnectorEnvBindingEntries,\n getDiagnosticConnectorTypeForRuntimeEnvName,\n} from \"@vm0/connectors/connector-utils\";\nimport {\n type FirewallBaseUrlMatch,\n findMatchingPermissions,\n matchFirewallBaseUrl,\n} from \"@vm0/connectors/firewall-rule-matcher\";\nimport { extractSecretNamesFromApis } from \"@vm0/connectors/firewall-types\";\nimport {\n getConnectorFirewall,\n isFirewallConnectorType,\n} from \"@vm0/connectors/firewalls\";\nimport type { NetworkPolicies } from \"@vm0/connectors/firewall-types\";\nimport type { RunContextResponse } from \"@vm0/api-contracts/contracts/zero-runs\";\nimport { getApiUrl } from \"../../../lib/api/config\";\nimport {\n getZeroConnector,\n searchZeroConnectors,\n} from \"../../../lib/api/domains/zero-connectors\";\nimport { getZeroAgentUserConnectors } from \"../../../lib/api/domains/zero-agents\";\nimport { getZeroRunContext } from \"../../../lib/api/domains/zero-runs\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { toPlatformUrl } from \"./platform-url\";\nimport { decodeZeroTokenPayload } from \"../../../lib/api/zero-token\";\n\ninterface CheckConnectorOptions {\n envName?: string;\n url?: string;\n method: string;\n checkPermission?: string;\n}\n\ninterface DiagContext {\n envName: string;\n connectorType: string;\n label: string;\n connectorAvailable: boolean;\n platformOrigin: string;\n agentId: string | undefined;\n}\n\ninterface UrlLookupResult {\n connectorType: string;\n envName: string;\n matchedBase: string;\n relativePath: string;\n}\n\nfunction isConnectorType(type: string): type is ConnectorType {\n return type in CONNECTOR_TYPES;\n}\n\nasync function connectorTypeIsAvailable(type: string): Promise<boolean> {\n if (!isConnectorType(type)) {\n return false;\n }\n const catalog = await searchZeroConnectors();\n return catalog.connectors.some((connector) => {\n return connector.id === type;\n });\n}\n\n/**\n * Reverse-lookup a full URL to find which connector handles it.\n * Iterates all connector firewall configs and checks if the URL\n * starts with any registered base URL (scheme + host + optional path prefix).\n */\nfunction resolveConnectorFromUrl(url: string): UrlLookupResult | null {\n const allTypes = CONNECTOR_TYPE_KEYS;\n\n let bestMatch: {\n connectorType: string;\n match: FirewallBaseUrlMatch;\n } | null = null;\n\n for (const type of allTypes) {\n if (!isFirewallConnectorType(type)) continue;\n const config = getConnectorFirewall(type);\n for (const api of config.apis) {\n const match = matchFirewallBaseUrl(url, api.base);\n if (match !== null) {\n // Pick the longest (most specific) base URL match\n if (!bestMatch || match.score > bestMatch.match.score) {\n bestMatch = { connectorType: type, match };\n }\n }\n }\n }\n\n if (!bestMatch) return null;\n\n // Derive the environment name from the connector's configured env bindings.\n const envBindingEntries = getConnectorEnvBindingEntries(\n bestMatch.connectorType as ConnectorType,\n );\n const envName = envBindingEntries[0]?.envName;\n if (!envName) return null;\n\n return {\n connectorType: bestMatch.connectorType,\n envName,\n matchedBase: bestMatch.match.displayBase,\n relativePath: bestMatch.match.relativePath,\n };\n}\n\nfunction checkEnvName(ctx: DiagContext): boolean {\n console.log(\"## Step 1: Sandbox environment name\");\n console.log(\"\");\n const envPresent = Boolean(process.env[ctx.envName]);\n console.log(\n `Checking process.env.${ctx.envName}: ${envPresent ? \"present\" : \"not present\"}`,\n );\n if (envPresent) {\n console.log(\n \"A placeholder value is present in the sandbox environment. This value is not the real credential — it is a stand-in that gets replaced at the network boundary when requests are sent to registered base URLs.\",\n );\n } else {\n console.log(\n \"No value found for this environment name. Note: credential replacement at the network boundary is independent of this name — the proxy injects auth headers based on the destination URL.\",\n );\n }\n console.log(\"\");\n return envPresent;\n}\n\nasync function checkConnectorStatus(ctx: DiagContext): Promise<{\n isConnected: boolean;\n isExpired: boolean;\n hasPermission: boolean;\n}> {\n console.log(\"## Step 2: Connector configuration\");\n console.log(\"\");\n console.log(\n \"A Connector holds the real credentials (OAuth tokens or API keys) for an external service. These credentials are never injected into the sandbox. Instead, when the sandbox sends an HTTP request to a base URL registered by the Connector, the network boundary intercepts the request and replaces the auth headers with real credentials. For this to work, three conditions must be met:\",\n );\n console.log(\"\");\n\n const [connector, enabledTypes] = await Promise.all([\n getZeroConnector(ctx.connectorType as ConnectorType),\n ctx.agentId\n ? getZeroAgentUserConnectors(ctx.agentId)\n : Promise.resolve(null),\n ]);\n\n const isConnected = connector !== null;\n const isExpired = connector?.needsReconnect === true;\n const hasPermission =\n enabledTypes !== null && enabledTypes.includes(ctx.connectorType);\n\n // 2a: Connector status — user must have configured the connector (OAuth or API token)\n console.log(\n `### 2a: Connector status (user must configure via OAuth login or API key)`,\n );\n console.log(\"\");\n if (!ctx.connectorAvailable) {\n console.log(\n `The ${ctx.label} connector is not available for this account.`,\n );\n } else if (!isConnected) {\n console.log(`The ${ctx.label} connector is not connected.`);\n if (ctx.agentId && hasPermission) {\n const connectUrl = `${ctx.platformOrigin}/connectors/${ctx.connectorType}/connect?agentId=${ctx.agentId}`;\n console.log(`Connect it at: [Connect ${ctx.label}](${connectUrl})`);\n } else if (!ctx.agentId) {\n // No agentId: can't scope the authorize page, so fall back to a plain\n // connect link. With agentId, 2b's Authorize link performs the initial\n // OAuth connect before granting permission — one link covers both steps.\n const connectUrl = `${ctx.platformOrigin}/connectors/${ctx.connectorType}/connect`;\n console.log(`Connect it at: [Connect ${ctx.label}](${connectUrl})`);\n }\n } else if (isExpired) {\n const url = `${ctx.platformOrigin}/connectors`;\n console.log(\n `The ${ctx.label} connector is connected but has expired and needs to be reconnected.`,\n );\n console.log(`Reconnect it at: [Reconnect ${ctx.label}](${url})`);\n } else {\n console.log(`The ${ctx.label} connector is connected and active.`);\n }\n console.log(\"\");\n\n // 2b: Agent authorization — user must authorize the agent to use this connector\n console.log(\n `### 2b: Agent authorization (user must authorize agent to use this connector)`,\n );\n console.log(\"\");\n if (!ctx.connectorAvailable) {\n console.log(\n `Skipped — the ${ctx.label} connector is not available for this account.`,\n );\n } else if (!ctx.agentId) {\n console.log(\"ZERO_AGENT_ID is not set — cannot check agent authorization.\");\n } else if (isExpired) {\n // The /authorize page treats an expired connector as \"already connected\"\n // and won't re-trigger OAuth. Defer to 2a's Reconnect link in that case.\n console.log(\n `Skipped — agent authorization can only be checked once the ${ctx.label} connector is reconnected (see 2a).`,\n );\n } else if (hasPermission) {\n console.log(\n isConnected\n ? `The ${ctx.label} connector is authorized for this agent.`\n : `The ${ctx.label} connector is authorized for this agent, but it is not connected.`,\n );\n } else {\n const url = `${ctx.platformOrigin}/connectors/${ctx.connectorType}/authorize?agentId=${ctx.agentId}`;\n console.log(\n isConnected\n ? `The ${ctx.label} connector is not authorized for this agent (${ctx.agentId}).`\n : `The ${ctx.label} connector needs to be connected and authorized for this agent (${ctx.agentId}).`,\n );\n console.log(`Authorize it at: [Authorize ${ctx.label}](${url})`);\n }\n console.log(\"\");\n\n return { isConnected, isExpired, hasPermission };\n}\n\nasync function checkConnectorDomains(\n ctx: DiagContext,\n): Promise<NetworkPolicies | null> {\n // 2c: Registered base URLs — connector defines which URL prefixes get credential replacement\n console.log(\n `### 2c: Registered base URLs (credential replacement only applies to URLs matching these prefixes)`,\n );\n console.log(\"\");\n\n const payload = decodeZeroTokenPayload();\n const runId = payload?.runId;\n\n if (!runId) {\n console.log(\n \"Cannot determine run ID from ZERO_TOKEN — skipping base URL check.\",\n );\n console.log(\"\");\n return null;\n }\n\n const runContext = await getZeroRunContext(runId);\n\n printConnectorDomains(ctx, runContext);\n console.log(\"\");\n return runContext.networkPolicies;\n}\n\nfunction printConnectorDomains(\n ctx: DiagContext,\n runContext: RunContextResponse,\n): void {\n const matchingEntry = runContext.firewalls.find((fw) => {\n return fw.name === ctx.connectorType;\n });\n\n if (!matchingEntry) {\n console.log(\n `No configuration found for the ${ctx.label} connector in this run.`,\n );\n console.log(\n \"This means no base URLs are registered for credential replacement for this connector.\",\n );\n return;\n }\n\n console.log(\n `The ${ctx.label} connector is configured for this run with the following base URLs:`,\n );\n for (const api of matchingEntry.apis) {\n console.log(` - ${api.base}`);\n }\n console.log(\"\");\n console.log(\n \"When the sandbox sends an HTTP request matching one of these URL prefixes, the network boundary intercepts the request and injects real credentials into the auth headers.\",\n );\n\n if (isFirewallConnectorType(ctx.connectorType)) {\n const firewallConfig = getConnectorFirewall(ctx.connectorType);\n const secretNames = extractSecretNamesFromApis(firewallConfig.apis);\n if (secretNames.length > 0) {\n console.log(`Credentials resolved from: ${secretNames.join(\", \")}`);\n }\n }\n}\n\nfunction checkPermissionPolicy(\n connectorType: string,\n label: string,\n permissionName: string,\n networkPolicies: NetworkPolicies | null,\n): void {\n console.log(\"## Step 3: Permission policy check\");\n console.log(\"\");\n console.log(\n `Checking permission: \"${permissionName}\" for the ${label} connector.`,\n );\n console.log(\n `Beyond credential replacement, the ${label} connector enforces permission policies on each API path. A request either matches a named permission or falls through to the unknown-endpoint policy.`,\n );\n console.log(\"\");\n\n if (!networkPolicies) {\n console.log(\n \"Network policies are not available for this run — cannot check permission status.\",\n );\n console.log(\"\");\n return;\n }\n\n const connectorPolicies = networkPolicies[connectorType];\n\n if (!connectorPolicies) {\n console.log(\n `No policy entry found for the ${label} connector in this run's network policies.`,\n );\n console.log(\n \"When a connector has no policy entry, all requests are fully permissive (allowed).\",\n );\n console.log(\"\");\n return;\n }\n\n console.log(`Permission policies for the ${label} connector:`);\n console.log(` allow list: [${connectorPolicies.allow.join(\", \")}]`);\n console.log(` deny list: [${connectorPolicies.deny.join(\", \")}]`);\n console.log(` unknown endpoint policy: ${connectorPolicies.unknownPolicy}`);\n console.log(\"\");\n\n const isInAllow = connectorPolicies.allow.includes(permissionName);\n const isInDeny = connectorPolicies.deny.includes(permissionName);\n\n if (isInAllow) {\n console.log(\n `Result: \"${permissionName}\" is in the allow list. Requests matching this permission are allowed.`,\n );\n } else if (isInDeny) {\n console.log(\n `Result: \"${permissionName}\" is in the deny list. Requests matching this permission are denied.`,\n );\n } else {\n console.log(\n `Result: \"${permissionName}\" is not in any permission list. It will be handled by the unknown endpoint policy: ${connectorPolicies.unknownPolicy}.`,\n );\n }\n console.log(\"\");\n}\n\n/**\n * When --url is provided, auto-detect the matching permission by running\n * the URL's relative path against the connector's firewall rules.\n */\nfunction resolvePermissionFromUrl(\n connectorType: string,\n label: string,\n method: string,\n relativePath: string,\n matchedBase: string,\n networkPolicies: NetworkPolicies | null,\n): void {\n console.log(\"## Step 3: Permission policy check (auto-detected from URL)\");\n console.log(\"\");\n console.log(\n `Matching ${method} ${relativePath} (relative to base URL ${matchedBase}) against the ${label} connector's permission rules.`,\n );\n console.log(\"\");\n\n if (!isFirewallConnectorType(connectorType)) {\n console.log(\n `The ${label} connector does not have permission rules defined.`,\n );\n console.log(\"\");\n return;\n }\n\n const config = getConnectorFirewall(connectorType);\n const matchedPermissions = findMatchingPermissions(\n method,\n relativePath,\n config,\n { apiBase: matchedBase },\n );\n\n if (matchedPermissions.length === 0) {\n console.log(\n `No named permission matches ${method} ${relativePath}. This request falls through to the unknown-endpoint policy.`,\n );\n } else {\n console.log(`Matched permissions: [${matchedPermissions.join(\", \")}]`);\n }\n console.log(\"\");\n\n if (!networkPolicies) {\n console.log(\n \"Network policies are not available for this run — cannot check allow/deny status.\",\n );\n console.log(\"\");\n return;\n }\n\n const connectorPolicies = networkPolicies[connectorType];\n\n if (!connectorPolicies) {\n console.log(\n `No policy entry found for the ${label} connector. All requests are fully permissive (allowed).`,\n );\n console.log(\"\");\n return;\n }\n\n console.log(`Permission policies for the ${label} connector:`);\n console.log(` allow list: [${connectorPolicies.allow.join(\", \")}]`);\n console.log(` deny list: [${connectorPolicies.deny.join(\", \")}]`);\n console.log(` unknown endpoint policy: ${connectorPolicies.unknownPolicy}`);\n console.log(\"\");\n\n if (matchedPermissions.length === 0) {\n console.log(\n `Result: No permission matched. The unknown endpoint policy applies: ${connectorPolicies.unknownPolicy}.`,\n );\n } else {\n for (const perm of matchedPermissions) {\n const isInAllow = connectorPolicies.allow.includes(perm);\n const isInDeny = connectorPolicies.deny.includes(perm);\n if (isInAllow) {\n console.log(`Result: \"${perm}\" is in the allow list — allowed.`);\n } else if (isInDeny) {\n console.log(`Result: \"${perm}\" is in the deny list — denied.`);\n } else {\n console.log(\n `Result: \"${perm}\" is not in any list — falls through to unknown endpoint policy: ${connectorPolicies.unknownPolicy}.`,\n );\n }\n }\n }\n console.log(\"\");\n}\n\nexport const checkConnectorCommand = new Command()\n .name(\"check-connector\")\n .description(\n \"Diagnose connector health: environment name, connector configuration, and permission policies\",\n )\n .addOption(\n new Option(\n \"--env-name <ENV_NAME>\",\n \"The connector environment name to check (e.g. GITHUB_TOKEN)\",\n ),\n )\n .addOption(\n new Option(\n \"--url <URL>\",\n \"A full URL to diagnose — auto-detects the connector, environment name, and permission (e.g. https://api.github.com/repos/owner/repo)\",\n ),\n )\n .addOption(\n new Option(\n \"--method <METHOD>\",\n \"HTTP method to use when matching permissions with --url (default: GET)\",\n ).default(\"GET\"),\n )\n .addOption(\n new Option(\n \"--check-permission <name>\",\n \"Check whether a specific permission is allowed or denied (e.g. contents:read)\",\n ),\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n zero doctor check-connector --env-name GITHUB_TOKEN\n zero doctor check-connector --url https://api.github.com/repos/owner/repo\n zero doctor check-connector --url https://slack.com/api/chat.postMessage --method POST\n zero doctor check-connector --env-name SLACK_TOKEN --check-permission chat:write\n\nHow connectors work:\n A Connector holds the real credentials for an external service. These credentials\n are never injected into the sandbox. Instead, when the sandbox sends an HTTP\n request to a base URL registered by the Connector, the network boundary intercepts\n the request and replaces the auth headers with real credentials.\n\n This command checks each part of that pipeline and reports what it finds.`,\n )\n .action(\n withErrorHandler(async (opts: CheckConnectorOptions) => {\n if (!opts.envName && !opts.url) {\n throw new Error(\n \"Either --env-name or --url is required. Use --help for usage.\",\n );\n }\n\n let envName: string;\n let connectorType: string;\n let urlLookup: UrlLookupResult | null = null;\n\n if (opts.url) {\n urlLookup = resolveConnectorFromUrl(opts.url);\n if (!urlLookup) {\n throw new Error(\n `No connector found for URL: ${opts.url} — no registered base URL matches this URL`,\n );\n }\n connectorType = urlLookup.connectorType;\n envName = opts.envName ?? urlLookup.envName;\n console.log(\n `URL ${opts.url} matches the ${CONNECTOR_TYPES[connectorType as ConnectorType].label} connector (type: ${connectorType}).`,\n );\n console.log(` Matched base URL: ${urlLookup.matchedBase}`);\n console.log(` Relative path: ${urlLookup.relativePath}`);\n console.log(` Environment name: ${envName}`);\n } else {\n envName = opts.envName!;\n const resolvedConnectorType =\n getDiagnosticConnectorTypeForRuntimeEnvName(envName);\n if (!resolvedConnectorType) {\n throw new Error(\n `Unknown environment name: ${envName} — not managed by any connector`,\n );\n }\n connectorType = resolvedConnectorType;\n console.log(\n `${envName} is managed by the ${CONNECTOR_TYPES[connectorType as ConnectorType].label} connector (type: ${connectorType}).`,\n );\n }\n console.log(\"\");\n\n const { label } = CONNECTOR_TYPES[connectorType as ConnectorType];\n const [apiUrl, connectorAvailable] = await Promise.all([\n getApiUrl(),\n connectorTypeIsAvailable(connectorType),\n ]);\n const platformUrl = toPlatformUrl(apiUrl);\n\n const ctx: DiagContext = {\n envName,\n connectorType,\n label,\n connectorAvailable,\n platformOrigin: platformUrl.origin,\n agentId: process.env.ZERO_AGENT_ID || undefined,\n };\n\n checkEnvName(ctx);\n const { isConnected, isExpired, hasPermission } =\n await checkConnectorStatus(ctx);\n const networkPolicies = await checkConnectorDomains(ctx);\n\n // Summary for Step 2\n if (isConnected && !isExpired && hasPermission) {\n console.log(\n `Steps 1-2 summary: The ${label} connector is connected, active, and authorized. Outbound requests to the registered base URLs will have credentials injected at the network boundary.`,\n );\n }\n console.log(\"\");\n\n // Step 3: Permission policy check\n if (urlLookup) {\n // --url mode: auto-detect permission from URL path\n resolvePermissionFromUrl(\n connectorType,\n label,\n opts.method,\n urlLookup.relativePath,\n urlLookup.matchedBase,\n networkPolicies,\n );\n } else if (opts.checkPermission) {\n // --env-name mode with explicit --check-permission\n checkPermissionPolicy(\n connectorType,\n label,\n opts.checkPermission,\n networkPolicies,\n );\n }\n\n // Re-diagnose hint\n const args: string[] = [];\n if (opts.url) {\n args.push(`--url ${opts.url}`);\n if (opts.method !== \"GET\") {\n args.push(`--method ${opts.method}`);\n }\n } else {\n args.push(`--env-name ${envName}`);\n }\n if (opts.checkPermission) {\n args.push(`--check-permission ${opts.checkPermission}`);\n }\n console.log(\n `To re-diagnose after changes, run: zero doctor check-connector ${args.join(\" \")}`,\n );\n }),\n );\n","import { Command, Option } from \"commander\";\nimport { CONNECTOR_TYPES } from \"@vm0/connectors/connectors\";\nimport { findMatchingPermissions } from \"@vm0/connectors/firewall-rule-matcher\";\nimport {\n getConnectorFirewall,\n isFirewallConnectorType,\n} from \"@vm0/connectors/firewalls\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolvePermissionGrantMode } from \"./permission-context\";\n\nexport const permissionDenyCommand = new Command()\n .name(\"permission-deny\")\n .description(\n \"Diagnose a permission denial and find the permission that covers it\",\n )\n .argument(\"<connector-ref>\", \"The connector type (e.g. github)\")\n .addOption(\n new Option(\n \"--method <method>\",\n \"The denied HTTP method\",\n ).makeOptionMandatory(),\n )\n .addOption(\n new Option(\"--path <path>\", \"The denied path\").makeOptionMandatory(),\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n zero doctor permission-deny github --method GET --path /repos/owner/repo/pulls\n zero doctor permission-deny slack --method POST --path /chat.postMessage\n\nNotes:\n - Identifies which named permission covers a denied request\n - Use permission-change to request or enable the permission`,\n )\n .action(\n withErrorHandler(\n async (connectorRef: string, opts: { method: string; path: string }) => {\n if (!isFirewallConnectorType(connectorRef)) {\n throw new Error(`Unknown connector type: ${connectorRef}`);\n }\n\n const { label } = CONNECTOR_TYPES[connectorRef];\n const config = getConnectorFirewall(connectorRef);\n const permissions = findMatchingPermissions(\n opts.method,\n opts.path,\n config,\n );\n\n console.log(\n `The ${label} permission filtered ${opts.method} ${opts.path}.`,\n );\n\n if (permissions.length === 0) {\n console.log(\"No named permission was found covering this request.\");\n return;\n }\n\n // Count total rules per permission name across all APIs\n const ruleCount = new Map<string, number>();\n for (const api of config.apis) {\n if (!api.permissions) continue;\n for (const perm of api.permissions) {\n ruleCount.set(\n perm.name,\n (ruleCount.get(perm.name) ?? 0) + perm.rules.length,\n );\n }\n }\n\n // Pick the permission with the fewest rules (most specific)\n const permission = permissions.reduce((narrowest, current) => {\n return (ruleCount.get(current) ?? Infinity) <\n (ruleCount.get(narrowest) ?? Infinity)\n ? current\n : narrowest;\n });\n console.log(`This is covered by the \"${permission}\" permission.`);\n const permissionGrantMode = await resolvePermissionGrantMode();\n const reasonArg =\n permissionGrantMode === \"user-grants\"\n ? \"\"\n : ' --reason \"why this is needed\"';\n const actionVerb =\n permissionGrantMode === \"user-grants\" ? \"allow\" : \"request\";\n console.log(\n `To ${actionVerb} this permission, run: zero doctor permission-change ${connectorRef} --permission ${permission} --enable${reasonArg}`,\n );\n },\n ),\n );\n","import { getZeroOrg } from \"../../../lib/api/domains/zero-orgs\";\nimport { getZeroAgent } from \"../../../lib/api/domains/zero-agents\";\nimport { decodeZeroTokenPayload } from \"../../../lib/api/zero-token\";\nimport { decodeCliTokenPayload } from \"../../../lib/api/cli-token\";\nimport { getToken } from \"../../../lib/api/config\";\nimport type { OrgResponse } from \"@vm0/api-contracts/contracts/orgs\";\n\ntype AgentRole = \"admin\" | \"owner\" | \"member\" | \"unknown\";\ntype PermissionGrantMode = NonNullable<OrgResponse[\"permissionGrantMode\"]>;\n\ninterface PermissionChangeContext {\n readonly role: AgentRole;\n readonly permissionGrantMode: PermissionGrantMode;\n}\n\nconst LEGACY_PERMISSION_GRANT_MODE: PermissionGrantMode = \"legacy\";\n\nfunction roleFromOrg(org: OrgResponse): AgentRole {\n if (org.role === \"admin\") return \"admin\";\n if (org.role === \"member\") return \"member\";\n return \"unknown\";\n}\n\nfunction permissionGrantModeFromOrg(org: OrgResponse): PermissionGrantMode {\n return org.permissionGrantMode ?? LEGACY_PERMISSION_GRANT_MODE;\n}\n\n/**\n * Resolve the current user's userId from the available token.\n * Tries ZERO_TOKEN (sandbox) first, then CLI token.\n */\nasync function resolveUserId(): Promise<string | undefined> {\n const zeroPayload = decodeZeroTokenPayload();\n if (zeroPayload?.userId) return zeroPayload.userId;\n\n const token = await getToken();\n const cliPayload = decodeCliTokenPayload(token);\n return cliPayload?.userId;\n}\n\nexport async function resolvePermissionGrantMode(): Promise<PermissionGrantMode> {\n try {\n const org = await getZeroOrg();\n return permissionGrantModeFromOrg(org);\n } catch {\n return LEGACY_PERMISSION_GRANT_MODE;\n }\n}\n\nexport async function resolvePermissionChangeContext(\n agentId: string | undefined,\n): Promise<PermissionChangeContext> {\n try {\n const org = await getZeroOrg();\n const permissionGrantMode = permissionGrantModeFromOrg(org);\n\n if (!agentId || permissionGrantMode === \"user-grants\") {\n return {\n role: roleFromOrg(org),\n permissionGrantMode,\n };\n }\n\n if (org.role === \"admin\") {\n return { role: \"admin\", permissionGrantMode };\n }\n\n if (org.role === \"member\") {\n const userId = await resolveUserId();\n if (userId) {\n const agent = await getZeroAgent(agentId);\n if (agent.ownerId === userId) {\n return { role: \"owner\", permissionGrantMode };\n }\n }\n return { role: \"member\", permissionGrantMode };\n }\n\n return { role: \"unknown\", permissionGrantMode };\n } catch {\n return {\n role: \"unknown\",\n permissionGrantMode: LEGACY_PERMISSION_GRANT_MODE,\n };\n }\n}\n","import { Command, Option } from \"commander\";\nimport { CONNECTOR_TYPES } from \"@vm0/connectors/connectors\";\nimport {\n getConnectorFirewall,\n isFirewallConnectorType,\n} from \"@vm0/connectors/firewalls\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolvePermissionChangeContext } from \"./permission-context\";\nimport { getPlatformOrigin } from \"./platform-url\";\n\nfunction findPermissionInConfig(ref: string, permissionName: string): boolean {\n if (!isFirewallConnectorType(ref)) return false;\n const config = getConnectorFirewall(ref);\n for (const api of config.apis) {\n if (!api.permissions) continue;\n for (const p of api.permissions) {\n if (p.name === permissionName) return true;\n }\n }\n return false;\n}\n\n// Keep legacy approval request reasons short enough for permission-page URLs.\nconst REASON_MAX_LENGTH = 500;\ntype PermissionAction = \"enable\" | \"disable\";\ntype PermissionChangeRole = Awaited<\n ReturnType<typeof resolvePermissionChangeContext>\n>[\"role\"];\n\nfunction addReasonParam(\n urlParams: URLSearchParams,\n role: PermissionChangeRole,\n usesUserGrants: boolean,\n reason?: string,\n): void {\n if (usesUserGrants || role !== \"member\" || !reason) return;\n\n const truncated =\n reason.length > REASON_MAX_LENGTH\n ? reason.slice(0, REASON_MAX_LENGTH)\n : reason;\n urlParams.set(\"reason\", truncated);\n}\n\nfunction printSensitivePermissionGuidance(\n connectorRef: string,\n permission: string,\n action: PermissionAction,\n usesUserGrants: boolean,\n): void {\n if (action !== \"enable\") return;\n\n const approvalWording = usesUserGrants\n ? \"Only allow this permission below\"\n : \"Only request user approval below\";\n\n // Slack chat:write: strongly recommend bot-based messaging over user identity\n if (connectorRef === \"slack\" && permission === \"chat:write\") {\n console.log(\"\");\n console.log(\n \"IMPORTANT: Granting chat:write allows sending messages AS THE USER's identity, not as a bot.\",\n );\n console.log(\n \"Use `zero slack message send -c <channel> -t <text>` to send messages as the bot instead — this is the recommended approach for most use cases.\",\n );\n console.log(\n `${approvalWording} if acting as the user is specifically required.`,\n );\n console.log(\"\");\n }\n\n // Gmail gmail.send: strongly recommend draft-based workflow over direct send\n if (connectorRef === \"gmail\" && permission === \"gmail.send\") {\n console.log(\"\");\n console.log(\n \"IMPORTANT: Granting gmail.send allows the agent to send emails directly as the user.\",\n );\n console.log(\n \"Consider keeping gmail.send disabled and using gmail.compose instead — the agent can create drafts for the user to review and send manually.\",\n );\n console.log(\n `${approvalWording} if direct sending is specifically required.`,\n );\n console.log(\"\");\n }\n}\n\nfunction printPermissionActionMessage(args: {\n readonly usesUserGrants: boolean;\n readonly action: PermissionAction;\n readonly role: PermissionChangeRole;\n readonly permission: string;\n readonly label: string;\n readonly url: string;\n readonly reason?: string;\n}): void {\n if (args.usesUserGrants) {\n const grantAction = args.action === \"enable\" ? \"allow\" : \"deny\";\n console.log(\n `You can ${grantAction} the \"${args.permission}\" permission for your connector access: [Manage ${args.label} permissions](${args.url})`,\n );\n return;\n }\n\n if (args.role === \"admin\" || args.role === \"owner\") {\n console.log(\n `You can ${args.action} the \"${args.permission}\" permission directly: [Manage ${args.label} permissions](${args.url})`,\n );\n return;\n }\n\n if (args.role !== \"member\") {\n console.log(\n `To ${args.action} the \"${args.permission}\" permission for ${args.label}: [Manage ${args.label} permissions](${args.url})`,\n );\n return;\n }\n\n if (!args.reason) {\n console.log(\n `IMPORTANT: Re-run with \\`--reason \"one sentence why this is needed\"\\` so the admin can review your request faster.`,\n );\n return;\n }\n\n if (args.action === \"enable\") {\n console.log(\n `Permission changes require admin approval. Request access at: [Request ${args.label} access](${args.url})`,\n );\n return;\n }\n\n console.log(\n `Permission changes require admin approval. Contact an org admin to disable this permission: [View ${args.label} permissions](${args.url})`,\n );\n}\n\nasync function outputPermissionChangeMessage(\n connectorRef: string,\n permission: string,\n action: PermissionAction,\n reason?: string,\n): Promise<void> {\n const { label } =\n CONNECTOR_TYPES[connectorRef as keyof typeof CONNECTOR_TYPES];\n\n const platformOrigin = await getPlatformOrigin();\n const agentId = process.env.ZERO_AGENT_ID;\n const context = await resolvePermissionChangeContext(agentId || undefined);\n const role = context.role;\n const permissionGrantMode = context.permissionGrantMode;\n const usesUserGrants = permissionGrantMode === \"user-grants\";\n\n const urlParams = new URLSearchParams({\n ref: connectorRef,\n permission,\n action: action === \"enable\" ? \"allow\" : \"deny\",\n });\n addReasonParam(urlParams, role, usesUserGrants, reason);\n\n const pagePath = agentId ? `/agents/${agentId}/permissions` : \"/agents\";\n const url = `${platformOrigin}${pagePath}?${urlParams.toString()}`;\n\n printSensitivePermissionGuidance(\n connectorRef,\n permission,\n action,\n usesUserGrants,\n );\n printPermissionActionMessage({\n usesUserGrants,\n action,\n role,\n permission,\n label,\n url,\n reason,\n });\n}\n\nexport const permissionChangeCommand = new Command()\n .name(\"permission-change\")\n .description(\"Change or request a permission (enable or disable)\")\n .argument(\"<connector-ref>\", \"The connector type (e.g. github)\")\n .addOption(\n new Option(\n \"--permission <name>\",\n \"The permission name to change\",\n ).makeOptionMandatory(),\n )\n .addOption(\n new Option(\n \"--enable\",\n \"Enable or request enabling the permission\",\n ).conflicts(\"disable\"),\n )\n .addOption(\n new Option(\n \"--disable\",\n \"Disable or request disabling the permission\",\n ).conflicts(\"enable\"),\n )\n .addOption(\n new Option(\n \"--reason <text>\",\n \"Brief reason for admin approval requests (max 500 chars)\",\n ),\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n zero doctor permission-change github --permission contents:read --enable\n zero doctor permission-change slack --permission chat:write --disable\n\nNotes:\n - Outputs a platform URL for the user to adjust the permission\n - Depending on rollout state, members either request approval or manage their own permission grants`,\n )\n .action(\n withErrorHandler(\n async (\n connectorRef: string,\n opts: {\n permission: string;\n enable?: boolean;\n disable?: boolean;\n reason?: string;\n },\n ) => {\n if (!opts.enable && !opts.disable) {\n throw new Error(\"Either --enable or --disable is required\");\n }\n\n if (!isFirewallConnectorType(connectorRef)) {\n throw new Error(`Unknown connector type: ${connectorRef}`);\n }\n\n if (!findPermissionInConfig(connectorRef, opts.permission)) {\n throw new Error(\n `Unknown permission \"${opts.permission}\" for ${connectorRef}`,\n );\n }\n\n const action = opts.enable ? \"enable\" : \"disable\";\n await outputPermissionChangeMessage(\n connectorRef,\n opts.permission,\n action,\n opts.reason,\n );\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\n\nimport {\n getZeroBillingStatus,\n getZeroOrg,\n getZeroOrgMembers,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nfunction memberName(member: {\n readonly email: string;\n readonly firstName: string | null;\n readonly lastName: string | null;\n}): string {\n const name = [member.firstName, member.lastName].filter(Boolean).join(\" \");\n return name ? `${name} <${member.email}>` : member.email;\n}\n\nexport const creditCommand = new Command()\n .name(\"credit\")\n .description(\"Diagnose current organization credit and purchase access\")\n .action(\n withErrorHandler(async () => {\n const [org, billing, members] = await Promise.all([\n getZeroOrg(),\n getZeroBillingStatus(),\n getZeroOrgMembers(),\n ]);\n const admins = members.members.filter((member) => {\n return member.role === \"admin\";\n });\n const isAdmin = members.role === \"admin\";\n const canPurchaseCredits = isAdmin;\n\n console.log(chalk.bold(\"Credit diagnostics:\"));\n console.log(` Org: ${chalk.green(org.slug)}`);\n console.log(` Tier: ${chalk.cyan(billing.tier)}`);\n console.log(\n ` Available credits: ${chalk.cyan(billing.credits.toLocaleString())}`,\n );\n console.log(` Current user role: ${chalk.cyan(members.role)}`);\n console.log(\n ` Can purchase credits: ${\n canPurchaseCredits ? chalk.green(\"yes\") : chalk.yellow(\"no\")\n }`,\n );\n console.log(\n ` Auto-recharge: ${\n billing.autoRecharge.enabled ? chalk.green(\"enabled\") : \"disabled\"\n }`,\n );\n if (billing.autoRecharge.enabled) {\n console.log(\n ` Threshold: ${billing.autoRecharge.threshold?.toLocaleString() ?? \"not set\"}`,\n );\n console.log(\n ` Amount: ${billing.autoRecharge.amount?.toLocaleString() ?? \"not set\"}`,\n );\n }\n\n if (!isAdmin) {\n console.log(chalk.bold(\"\\nOrganization admins:\"));\n for (const admin of admins) {\n console.log(` - ${memberName(admin)}`);\n }\n console.log(\n chalk.yellow(\n \"\\nAsk an organization admin to buy credits or upgrade the plan.\",\n ),\n );\n } else if (billing.tier === \"free\") {\n console.log(\n \"\\nFree-tier admins can upgrade to Pro from billing or buy credits with `zero credit <credits>`.\",\n );\n } else {\n console.log(\"\\nUse `zero credit <credits>` to buy more credits.\");\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n getZeroUserPreferences,\n updateZeroUserPreferences,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { isInteractive, promptText } from \"../../../lib/utils/prompt-utils\";\n\n/**\n * Detect system timezone using Intl API\n */\nfunction detectTimezone(): string {\n return Intl.DateTimeFormat().resolvedOptions().timeZone;\n}\n\n/**\n * Validate timezone using Intl.DateTimeFormat\n */\nfunction isValidTimezone(timezone: string): boolean {\n try {\n Intl.DateTimeFormat(undefined, { timeZone: timezone });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Display current preferences\n */\nfunction displayPreferences(prefs: { timezone: string | null }): void {\n console.log(chalk.bold(\"Current preferences:\"));\n console.log(\n ` Timezone: ${prefs.timezone ? chalk.cyan(prefs.timezone) : chalk.dim(\"not set\")}`,\n );\n}\n\ninterface PreferenceOpts {\n timezone?: string;\n}\n\n/**\n * Build updates from CLI flags, exiting on invalid input\n */\nfunction buildUpdates(opts: PreferenceOpts): { timezone?: string } | null {\n if (opts.timezone === undefined) return null;\n\n if (!isValidTimezone(opts.timezone)) {\n throw new Error(`Invalid timezone: ${opts.timezone}`, {\n cause: new Error(\n \"Use an IANA timezone identifier (e.g., America/New_York, Asia/Shanghai)\",\n ),\n });\n }\n\n return { timezone: opts.timezone };\n}\n\n/**\n * Print confirmation after a successful update\n */\nfunction printUpdateResult(\n updates: { timezone?: string },\n result: { timezone: string | null },\n): void {\n if (updates.timezone !== undefined) {\n console.log(\n chalk.green(\n `Timezone set to ${chalk.cyan(result.timezone ?? updates.timezone)}`,\n ),\n );\n }\n}\n\n/**\n * Interactive prompts when no flags provided\n */\nasync function interactiveSetup(prefs: {\n timezone: string | null;\n}): Promise<void> {\n if (!prefs.timezone) {\n const detectedTz = detectTimezone();\n console.log(chalk.dim(`\\nSystem timezone detected: ${detectedTz}`));\n const tz = await promptText(\n \"Set timezone? (enter timezone or leave empty to skip)\",\n detectedTz,\n );\n if (tz?.trim()) {\n if (!isValidTimezone(tz.trim())) {\n throw new Error(`Invalid timezone: ${tz.trim()}`);\n }\n await updateZeroUserPreferences({ timezone: tz.trim() });\n console.log(chalk.green(`Timezone set to ${chalk.cyan(tz.trim())}`));\n }\n }\n}\n\n/**\n * zero preference\n *\n * View or update user preferences (timezone).\n */\nexport const zeroPreferenceCommand = new Command()\n .name(\"preference\")\n .description(\"View or update user preferences (timezone, notifications)\")\n .option(\"--timezone <timezone>\", \"IANA timezone (e.g., America/New_York)\")\n .action(\n withErrorHandler(async (opts: PreferenceOpts) => {\n const updates = buildUpdates(opts);\n\n if (updates) {\n const result = await updateZeroUserPreferences(updates);\n printUpdateResult(updates, result);\n return;\n }\n\n // No flags: display current preferences\n const prefs = await getZeroUserPreferences();\n displayPreferences(prefs);\n\n if (isInteractive()) {\n await interactiveSetup(prefs);\n } else if (!prefs.timezone) {\n console.log();\n console.log(\n `To set timezone: ${chalk.cyan(\"zero preference --timezone <timezone>\")}`,\n );\n console.log(\n chalk.dim(\"Example: zero preference --timezone America/New_York\"),\n );\n }\n }),\n );\n","import { mainRunCommand } from \"./run\";\nimport { continueCommand } from \"./continue\";\n\nmainRunCommand.addCommand(continueCommand);\n\nmainRunCommand.addHelpText(\n \"after\",\n `\nExamples:\n Discover teammates: zero agent list\n Delegate a task: zero run <agent-id> \"your task\"\n Continue delegation: zero run continue <session-id> \"follow up\"`,\n);\n\nexport const zeroRunCommand = mainRunCommand;\n","import { Command, Option } from \"commander\";\nimport { createZeroRun } from \"../../../lib/api\";\nimport { isUUID, renderRunCreated } from \"../../run/shared\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { pollZeroEvents, showZeroNextSteps } from \"./shared\";\n\nexport const mainRunCommand = new Command()\n .name(\"run\")\n .description(\"Delegate a task to a teammate agent\")\n .argument(\"<agent-id>\", \"Agent UUID (from `zero agent list`)\")\n .argument(\"<prompt>\", \"Task prompt for the agent\")\n .option(\n \"--model-provider <type>\",\n \"Override model provider (e.g., anthropic-api-key)\",\n )\n .option(\"--verbose\", \"Show full tool inputs and outputs\")\n .addOption(new Option(\"--debug-no-mock-claude\").hideHelp())\n .addOption(new Option(\"--debug-no-mock-codex\").hideHelp())\n .addHelpText(\n \"after\",\n `\nExamples:\n Delegate a task: zero run <agent-id> \"summarize the latest issues\"\n With verbose output: zero run <agent-id> \"fix the bug\" --verbose\n\nNotes:\n - Get agent IDs from \"zero agent list\"\n - The command streams events until the delegated run completes\n - On success, a session ID is printed for follow-up with \"zero run continue\"`,\n )\n .action(\n withErrorHandler(\n async (\n agentId: string,\n prompt: string,\n options: {\n modelProvider?: string;\n verbose?: boolean;\n debugNoMockClaude?: boolean;\n debugNoMockCodex?: boolean;\n },\n ) => {\n // 1. Validate agent-id is a UUID\n if (!isUUID(agentId)) {\n throw new Error(`Invalid agent ID format: ${agentId}`, {\n cause: new Error(\n \"Agent ID must be a valid UUID. Use `zero agent list` to find agent IDs.\",\n ),\n });\n }\n\n // 2. Create zero run\n const response = await createZeroRun({\n agentId,\n prompt,\n modelProvider: options.modelProvider,\n debugNoMockClaude: options.debugNoMockClaude,\n debugNoMockCodex: options.debugNoMockCodex,\n });\n\n // 3. Check for immediate failure\n if (response.status === \"failed\") {\n throw new Error(\n \"Run preparation failed\",\n response.error ? { cause: new Error(response.error) } : undefined,\n );\n }\n\n // 4. Display run started/queued info\n renderRunCreated(response);\n\n // 5. Poll for events\n const result = await pollZeroEvents(response.runId, {\n verbose: options.verbose,\n });\n if (!result.succeeded) {\n throw new Error(\"Run failed\");\n }\n\n // 6. Show next steps\n showZeroNextSteps(result);\n },\n ),\n );\n","import chalk from \"chalk\";\nimport { getZeroRunAgentEvents, getZeroRun } from \"../../../lib/api\";\nimport type { RunResult } from \"../../../lib/api\";\nimport { EventStreamNormalizer } from \"../../../lib/events/event-stream-normalizer\";\nimport { EventRenderer } from \"../../../lib/events/event-renderer\";\nimport type { PollResult, EventRenderingOptions } from \"../../run/shared\";\n\ninterface SequencedEvent {\n sequenceNumber: number;\n}\n\ntype ZeroRunResponse = Awaited<ReturnType<typeof getZeroRun>>;\ntype TerminalRunStatus = \"completed\" | \"failed\" | \"timeout\" | \"cancelled\";\ntype TerminalRunResponse = ZeroRunResponse & { status: TerminalRunStatus };\n\nconst TERMINAL_RUN_STATUSES: readonly TerminalRunStatus[] = [\n \"completed\",\n \"failed\",\n \"timeout\",\n \"cancelled\",\n];\n\n/**\n * Safely narrow GetRunResponse.result to RunResult.\n * GetRunResponse.result has all fields optional (due to .passthrough()),\n * but RunResult requires checkpointId, agentSessionId, conversationId.\n * Extra fields (artifact, volumes) are preserved at runtime via passthrough.\n */\nfunction toRunResult(result: {\n output?: string;\n executionTimeMs?: number;\n agentSessionId?: string;\n checkpointId?: string;\n conversationId?: string;\n}): RunResult | undefined {\n const { checkpointId, agentSessionId, conversationId } = result;\n if (!checkpointId || !agentSessionId || !conversationId) {\n return undefined;\n }\n return { checkpointId, agentSessionId, conversationId };\n}\n\nfunction filterContiguousEvents<T extends SequencedEvent>(\n events: T[],\n lastSequence: number,\n): T[] {\n const contiguousEvents: T[] = [];\n let expectedSequence = lastSequence + 1;\n\n for (const event of events) {\n if (event.sequenceNumber < expectedSequence) {\n continue;\n }\n if (event.sequenceNumber !== expectedSequence) {\n break;\n }\n contiguousEvents.push(event);\n expectedSequence++;\n }\n\n return contiguousEvents;\n}\n\nconst POLL_INTERVAL_MS = 1000;\nconst TERMINAL_DRAIN_POLL_INTERVAL_MS = 500;\nconst TERMINAL_DRAIN_IDLE_MS = 1000;\nconst TERMINAL_DRAIN_MAX_MS = 3000;\n\nfunction isTerminalRunResponse(\n runResponse: ZeroRunResponse,\n): runResponse is TerminalRunResponse {\n return TERMINAL_RUN_STATUSES.includes(\n runResponse.status as TerminalRunStatus,\n );\n}\n\nfunction shouldDrainNextEventPage<T>(\n eventsResponse: { hasMore: boolean; events: T[] },\n contiguousEvents: T[],\n): boolean {\n return (\n eventsResponse.hasMore &&\n contiguousEvents.length > 0 &&\n contiguousEvents.length === eventsResponse.events.length\n );\n}\n\nfunction hasSequenceGap<T>(\n eventsResponse: { events: T[] },\n contiguousEvents: T[],\n): boolean {\n return (\n eventsResponse.events.length > 0 &&\n contiguousEvents.length < eventsResponse.events.length\n );\n}\n\nfunction shouldCompleteTerminalDrain(\n terminalSeenAt: number,\n lastTerminalProgressAt: number,\n blockedByGap: boolean,\n): boolean {\n const now = Date.now();\n const terminalElapsedMs = now - terminalSeenAt;\n const terminalIdleMs = now - lastTerminalProgressAt;\n return (\n terminalElapsedMs >= TERMINAL_DRAIN_MAX_MS ||\n (!blockedByGap && terminalIdleMs >= TERMINAL_DRAIN_IDLE_MS)\n );\n}\n\nfunction renderTerminalRunResult(\n runId: string,\n runResponse: TerminalRunResponse,\n): PollResult {\n if (runResponse.status === \"completed\") {\n EventRenderer.renderRunCompleted(\n runResponse.result ? toRunResult(runResponse.result) : undefined,\n );\n return {\n succeeded: true,\n runId,\n sessionId: runResponse.result?.agentSessionId,\n checkpointId: runResponse.result?.checkpointId,\n };\n }\n\n if (runResponse.status === \"failed\") {\n EventRenderer.renderRunFailed(runResponse.error, runId);\n return { succeeded: false, runId };\n }\n\n if (runResponse.status === \"timeout\") {\n console.error(chalk.red(\"\\n✗ Run timed out\"));\n return { succeeded: false, runId };\n }\n\n console.error(chalk.yellow(\"\\n✗ Run cancelled\"));\n return { succeeded: false, runId };\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => {\n return setTimeout(resolve, ms);\n });\n}\n\n/**\n * Poll for zero run events until run completes.\n * Uses dual-poll approach: telemetry endpoint for events, getById for status.\n */\nexport async function pollZeroEvents(\n runId: string,\n options?: EventRenderingOptions,\n): Promise<PollResult> {\n const renderer = new EventRenderer({ verbose: options?.verbose });\n const normalizer = new EventStreamNormalizer();\n\n let lastSequence = -1;\n let complete = false;\n let result: PollResult = { succeeded: true, runId };\n let terminalRunResponse: TerminalRunResponse | undefined;\n let terminalSeenAt = 0;\n let lastTerminalProgressAt = 0;\n const flushPendingEvents = (): void => {\n for (const parsed of normalizer.flush()) {\n renderer.render(parsed);\n }\n };\n\n while (!complete) {\n // 1. Fetch events from telemetry endpoint\n const eventsResponse = await getZeroRunAgentEvents(runId, {\n since: lastSequence,\n limit: 100,\n order: \"asc\",\n });\n\n const contiguousEvents = filterContiguousEvents(\n eventsResponse.events,\n lastSequence,\n );\n\n // 2. Parse and render each event\n for (const event of contiguousEvents) {\n const parsedEvents = normalizer.process(\n event.eventData,\n eventsResponse.framework,\n );\n for (const parsed of parsedEvents) {\n renderer.render(parsed);\n }\n }\n\n // 3. Track last sequence number for pagination\n if (contiguousEvents.length > 0) {\n lastSequence =\n contiguousEvents[contiguousEvents.length - 1]!.sequenceNumber;\n if (terminalRunResponse) {\n lastTerminalProgressAt = Date.now();\n }\n }\n\n const blockedByGap = hasSequenceGap(eventsResponse, contiguousEvents);\n\n // If this page is fully contiguous and the server says more are already\n // queryable, drain the next page before checking terminal status. Otherwise\n // a completed run with >100 unseen events would render only the final page's\n // first batch and then exit.\n if (shouldDrainNextEventPage(eventsResponse, contiguousEvents)) {\n continue;\n }\n\n // 4. Fetch run status separately. During terminal drain, keep the latest\n // terminal state because timeout runs can still be upgraded to completed.\n const runResponse = await getZeroRun(runId);\n if (isTerminalRunResponse(runResponse)) {\n if (!terminalRunResponse) {\n terminalSeenAt = Date.now();\n lastTerminalProgressAt = terminalSeenAt;\n }\n terminalRunResponse = runResponse;\n }\n\n if (terminalRunResponse) {\n if (\n shouldCompleteTerminalDrain(\n terminalSeenAt,\n lastTerminalProgressAt,\n blockedByGap,\n )\n ) {\n flushPendingEvents();\n result = renderTerminalRunResult(runId, terminalRunResponse);\n complete = true;\n }\n }\n\n if (!complete) {\n await sleep(\n terminalRunResponse\n ? TERMINAL_DRAIN_POLL_INTERVAL_MS\n : POLL_INTERVAL_MS,\n );\n }\n }\n\n return result;\n}\n\n/**\n * Display next steps after successful zero run\n */\nexport function showZeroNextSteps(result: PollResult): void {\n const { sessionId } = result;\n\n console.log();\n\n if (sessionId) {\n console.log(\" Continue delegation:\");\n console.log(\n chalk.cyan(` zero run continue ${sessionId} \"your next prompt\"`),\n );\n }\n}\n","import { Command } from \"commander\";\nimport { createZeroRun } from \"../../../lib/api\";\nimport { isUUID, renderRunCreated } from \"../../run/shared\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { pollZeroEvents, showZeroNextSteps } from \"./shared\";\n\nexport const continueCommand = new Command()\n .name(\"continue\")\n .description(\"Continue a previous delegation from a session\")\n .argument(\"<session-id>\", \"Session ID from a previous run\")\n .argument(\"<prompt>\", \"Follow-up prompt for the agent\")\n .option(\n \"--model-provider <type>\",\n \"Override model provider (e.g., anthropic-api-key)\",\n )\n .option(\"--verbose\", \"Show full tool inputs and outputs\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero run continue <session-id> \"now deploy it\"\n zero run continue <session-id> \"add tests\" --verbose\n\nNotes:\n - The session ID is printed after a successful \"zero run\" delegation\n - Continues the same agent session with full prior context`,\n )\n .action(\n withErrorHandler(\n async (\n sessionId: string,\n prompt: string,\n options: {\n modelProvider?: string;\n verbose?: boolean;\n },\n ) => {\n // 1. Validate session-id is a UUID\n if (!isUUID(sessionId)) {\n throw new Error(`Invalid session ID format: ${sessionId}`, {\n cause: new Error(\"Session ID must be a valid UUID\"),\n });\n }\n\n // 2. Create zero run with sessionId (no agentId needed)\n const response = await createZeroRun({\n sessionId,\n prompt,\n modelProvider: options.modelProvider,\n });\n\n // 3. Check for immediate failure\n if (response.status === \"failed\") {\n throw new Error(\n \"Run preparation failed\",\n response.error ? { cause: new Error(response.error) } : undefined,\n );\n }\n\n // 4. Display run started/queued info\n renderRunCreated(response);\n\n // 5. Poll for events\n const result = await pollZeroEvents(response.runId, {\n verbose: options.verbose,\n });\n if (!result.succeeded) {\n throw new Error(\"Run failed\");\n }\n\n // 6. Show next steps\n showZeroNextSteps(result);\n },\n ),\n );\n","import { Command } from \"commander\";\nimport { setupCommand } from \"./setup\";\nimport { listCommand } from \"./list\";\nimport { statusCommand } from \"./status\";\nimport { deleteCommand } from \"./delete\";\nimport { enableCommand } from \"./enable\";\nimport { disableCommand } from \"./disable\";\n\nexport const zeroScheduleCommand = new Command()\n .name(\"schedule\")\n .description(\"Create or manage recurring scheduled tasks\")\n .addCommand(setupCommand)\n .addCommand(listCommand)\n .addCommand(statusCommand)\n .addCommand(deleteCommand)\n .addCommand(enableCommand)\n .addCommand(disableCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Create a schedule: zero schedule setup --help\n Check all schedules: zero schedule list\n Check schedule status: zero schedule status <agent-id>\n Pause a schedule: zero schedule disable <agent-id>\n Resume a schedule: zero schedule enable <agent-id>\n Delete a schedule: zero schedule delete <agent-id>`,\n );\n","import { Command } from \"commander\";\nimport { readFileSync } from \"node:fs\";\nimport chalk from \"chalk\";\nimport {\n isInteractive,\n promptText,\n promptSelect,\n promptConfirm,\n} from \"../../../lib/utils/prompt-utils\";\nimport {\n generateCronExpression,\n detectTimezone,\n validateTimeFormat,\n validateDateFormat,\n getTomorrowDateLocal,\n getCurrentTimeLocal,\n toISODateTime,\n type ScheduleFrequency,\n} from \"../../../lib/domain/schedule-utils\";\nimport {\n resolveCompose,\n deployZeroSchedule,\n listZeroSchedules,\n enableZeroSchedule,\n getZeroUserPreferences,\n ApiRequestError,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nconst FREQUENCY_CHOICES = [\n { title: \"Daily\", value: \"daily\" as const, description: \"Run every day\" },\n {\n title: \"Weekly\",\n value: \"weekly\" as const,\n description: \"Run once per week\",\n },\n {\n title: \"Monthly\",\n value: \"monthly\" as const,\n description: \"Run once per month\",\n },\n {\n title: \"One-time\",\n value: \"once\" as const,\n description: \"Run once at specific time\",\n },\n {\n title: \"Loop\",\n value: \"loop\" as const,\n description: \"Run repeatedly at fixed intervals\",\n },\n];\n\nconst DAY_OF_WEEK_CHOICES = [\n { title: \"Monday\", value: 1 },\n { title: \"Tuesday\", value: 2 },\n { title: \"Wednesday\", value: 3 },\n { title: \"Thursday\", value: 4 },\n { title: \"Friday\", value: 5 },\n { title: \"Saturday\", value: 6 },\n { title: \"Sunday\", value: 0 },\n];\n\nfunction parseDayOption(\n day: string,\n frequency: ScheduleFrequency,\n): number | undefined {\n if (frequency === \"weekly\") {\n const dayMap: Record<string, number> = {\n sun: 0,\n mon: 1,\n tue: 2,\n wed: 3,\n thu: 4,\n fri: 5,\n sat: 6,\n };\n return dayMap[day.toLowerCase()];\n } else if (frequency === \"monthly\") {\n const num = parseInt(day, 10);\n if (num >= 1 && num <= 31) {\n return num;\n }\n }\n return undefined;\n}\n\nfunction formatInTimezone(isoDate: string, timezone: string): string {\n const date = new Date(isoDate);\n const parts = new Intl.DateTimeFormat(\"en-CA\", {\n timeZone: timezone,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n }).formatToParts(date);\n\n const get = (type: string) => {\n return (\n parts.find((p) => {\n return p.type === type;\n })?.value ?? \"\"\n );\n };\n return `${get(\"year\")}-${get(\"month\")}-${get(\"day\")} ${get(\"hour\")}:${get(\"minute\")}`;\n}\n\nfunction parseFrequencyFromCron(\n cron: string,\n): { frequency: ScheduleFrequency; day?: number; time: string } | null {\n const parts = cron.split(\" \");\n if (parts.length !== 5) return null;\n\n const [minute, hour, dayOfMonth, , dayOfWeek] = parts;\n const time = `${hour!.padStart(2, \"0\")}:${minute!.padStart(2, \"0\")}`;\n\n if (dayOfMonth === \"*\" && dayOfWeek === \"*\") {\n return { frequency: \"daily\", time };\n } else if (dayOfMonth === \"*\" && dayOfWeek !== \"*\") {\n return { frequency: \"weekly\", day: parseInt(dayOfWeek!, 10), time };\n } else if (dayOfMonth !== \"*\" && dayOfWeek === \"*\") {\n return { frequency: \"monthly\", day: parseInt(dayOfMonth!, 10), time };\n }\n\n return null;\n}\n\ninterface SetupOptions {\n name?: string;\n frequency?: string;\n time?: string;\n day?: string;\n interval?: string;\n timezone?: string;\n prompt?: string;\n promptFile?: string;\n enable?: boolean;\n}\n\ninterface ExistingScheduleDefaults {\n frequency?: ScheduleFrequency;\n day?: number;\n time?: string;\n intervalSeconds?: number;\n}\n\ninterface ScheduleListItem {\n name: string;\n agentId: string;\n triggerType?: \"cron\" | \"once\" | \"loop\";\n cronExpression?: string | null;\n atTime?: string | null;\n intervalSeconds?: number | null;\n timezone: string;\n prompt: string;\n enabled?: boolean;\n}\n\nfunction getExistingDefaults(\n existingSchedule: ScheduleListItem | undefined,\n): ExistingScheduleDefaults {\n const defaults: ExistingScheduleDefaults = {};\n\n if (existingSchedule?.triggerType === \"loop\") {\n defaults.frequency = \"loop\";\n defaults.intervalSeconds = existingSchedule.intervalSeconds ?? undefined;\n } else if (existingSchedule?.cronExpression) {\n const parsed = parseFrequencyFromCron(existingSchedule.cronExpression);\n if (parsed) {\n defaults.frequency = parsed.frequency;\n defaults.day = parsed.day;\n defaults.time = parsed.time;\n }\n } else if (existingSchedule?.atTime) {\n defaults.frequency = \"once\";\n }\n\n return defaults;\n}\n\nasync function gatherFrequency(\n optionFrequency: string | undefined,\n existingFrequency: ScheduleFrequency | undefined,\n): Promise<ScheduleFrequency | null> {\n let frequency = optionFrequency as ScheduleFrequency | undefined;\n\n if (\n frequency &&\n [\"daily\", \"weekly\", \"monthly\", \"once\", \"loop\"].includes(frequency)\n ) {\n return frequency;\n }\n\n if (!isInteractive()) {\n throw new Error(\"--frequency is required (daily|weekly|monthly|once|loop)\");\n }\n\n const defaultIndex = existingFrequency\n ? FREQUENCY_CHOICES.findIndex((c) => {\n return c.value === existingFrequency;\n })\n : 0;\n\n frequency = await promptSelect<ScheduleFrequency>(\n \"Schedule frequency\",\n FREQUENCY_CHOICES,\n defaultIndex >= 0 ? defaultIndex : 0,\n );\n\n return frequency || null;\n}\n\nasync function gatherDay(\n frequency: ScheduleFrequency,\n optionDay: string | undefined,\n existingDay: number | undefined,\n): Promise<number | null> {\n if (frequency !== \"weekly\" && frequency !== \"monthly\") {\n return null;\n }\n\n if (optionDay) {\n const day = parseDayOption(optionDay, frequency);\n if (day === undefined) {\n throw new Error(\n `Invalid day: ${optionDay}. Use mon-sun for weekly or 1-31 for monthly.`,\n );\n }\n return day;\n }\n\n if (!isInteractive()) {\n throw new Error(\"--day is required for weekly/monthly\");\n }\n\n if (frequency === \"weekly\") {\n const defaultDayIndex =\n existingDay !== undefined\n ? DAY_OF_WEEK_CHOICES.findIndex((c) => {\n return c.value === existingDay;\n })\n : 0;\n const day = await promptSelect(\n \"Day of week\",\n DAY_OF_WEEK_CHOICES,\n defaultDayIndex >= 0 ? defaultDayIndex : 0,\n );\n return day ?? null;\n }\n\n const dayStr = await promptText(\n \"Day of month (1-31)\",\n existingDay?.toString() || \"1\",\n );\n if (!dayStr) return null;\n\n const day = parseInt(dayStr, 10);\n if (isNaN(day) || day < 1 || day > 31) {\n throw new Error(\"Day must be between 1 and 31\");\n }\n return day;\n}\n\nasync function gatherRecurringTime(\n optionTime: string | undefined,\n existingTime: string | undefined,\n): Promise<string | undefined> {\n if (optionTime) {\n const validation = validateTimeFormat(optionTime);\n if (validation !== true) {\n throw new Error(`Invalid time: ${validation}`);\n }\n return optionTime;\n }\n\n if (!isInteractive()) {\n throw new Error(\"--time is required (HH:MM format)\");\n }\n\n return await promptText(\n \"Time (HH:MM)\",\n existingTime || \"09:00\",\n validateTimeFormat,\n );\n}\n\nasync function gatherOneTimeSchedule(\n optionDay: string | undefined,\n optionTime: string | undefined,\n existingTime: string | undefined,\n): Promise<string | null> {\n if (optionDay && optionTime) {\n if (!validateDateFormat(optionDay)) {\n throw new Error(\n `Invalid date format: ${optionDay}. Use YYYY-MM-DD format.`,\n );\n }\n if (!validateTimeFormat(optionTime)) {\n throw new Error(`Invalid time format: ${optionTime}. Use HH:MM format.`);\n }\n return `${optionDay} ${optionTime}`;\n }\n\n if (!isInteractive()) {\n throw new Error(\"One-time schedules require interactive mode\", {\n cause: new Error(\n \"Or provide --day (YYYY-MM-DD) and --time (HH:MM) flags\",\n ),\n });\n }\n\n const tomorrowDate = getTomorrowDateLocal();\n const date = await promptText(\n \"Date (YYYY-MM-DD, default tomorrow)\",\n tomorrowDate,\n validateDateFormat,\n );\n if (!date) return null;\n\n const currentTime = getCurrentTimeLocal();\n const time = await promptText(\n \"Time (HH:MM)\",\n existingTime || currentTime,\n validateTimeFormat,\n );\n if (!time) return null;\n\n return `${date} ${time}`;\n}\n\nasync function gatherTimezone(\n optionTimezone: string | undefined,\n existingTimezone: string | undefined | null,\n): Promise<string | undefined> {\n if (optionTimezone) return optionTimezone;\n\n let userTimezone: string | null = null;\n try {\n const prefs = await getZeroUserPreferences();\n userTimezone = prefs.timezone;\n } catch {\n console.log(\n chalk.dim(\"Could not fetch timezone preference, using detected timezone\"),\n );\n }\n\n const defaultTimezone = userTimezone || detectTimezone();\n\n if (!isInteractive()) {\n return defaultTimezone;\n }\n\n return await promptText(\"Timezone\", existingTimezone || defaultTimezone);\n}\n\nasync function gatherPromptText(\n optionPrompt: string | undefined,\n optionPromptFile: string | undefined,\n existingPrompt: string | undefined | null,\n): Promise<string | undefined> {\n if (optionPrompt && optionPromptFile) {\n throw new Error(\"Cannot use --prompt and --prompt-file together\");\n }\n\n if (optionPromptFile) {\n return readFileSync(optionPromptFile, \"utf-8\");\n }\n\n if (optionPrompt) return optionPrompt;\n\n if (!isInteractive()) {\n throw new Error(\"--prompt or --prompt-file is required\");\n }\n\n return await promptText(\n \"Prompt to run\",\n existingPrompt || \"let's start working.\",\n );\n}\n\nasync function gatherInterval(\n optionInterval: string | undefined,\n existingInterval: number | undefined,\n): Promise<number | null> {\n if (optionInterval) {\n const val = parseInt(optionInterval, 10);\n if (isNaN(val) || val < 0) {\n throw new Error(\n \"Invalid interval. Must be a non-negative integer (seconds)\",\n );\n }\n return val;\n }\n\n if (!isInteractive()) {\n throw new Error(\"--interval is required for loop schedules (seconds)\");\n }\n\n const defaultVal =\n existingInterval !== undefined ? String(existingInterval) : \"300\";\n const result = await promptText(\n \"Interval in seconds (time between runs)\",\n defaultVal,\n (v: string) => {\n const n = parseInt(v, 10);\n if (isNaN(n) || n < 0) return \"Must be a non-negative integer\";\n return true;\n },\n );\n if (!result) return null;\n return parseInt(result, 10);\n}\n\nasync function gatherTiming(\n frequency: ScheduleFrequency,\n options: SetupOptions,\n defaults: ExistingScheduleDefaults,\n): Promise<{\n day: number | undefined;\n time: string | undefined;\n atTime: string | undefined;\n intervalSeconds: number | undefined;\n} | null> {\n if (frequency === \"loop\") {\n const intervalSeconds = await gatherInterval(\n options.interval,\n defaults.intervalSeconds,\n );\n if (intervalSeconds === null) return null;\n return {\n day: undefined,\n time: undefined,\n atTime: undefined,\n intervalSeconds,\n };\n }\n\n if (frequency === \"once\") {\n const result = await gatherOneTimeSchedule(\n options.day,\n options.time,\n defaults.time,\n );\n if (!result) return null;\n return {\n day: undefined,\n time: undefined,\n atTime: result,\n intervalSeconds: undefined,\n };\n }\n\n const day =\n (await gatherDay(frequency, options.day, defaults.day)) ?? undefined;\n if (day === null && (frequency === \"weekly\" || frequency === \"monthly\")) {\n return null;\n }\n\n const time = await gatherRecurringTime(options.time, defaults.time);\n if (!time) return null;\n\n return { day, time, atTime: undefined, intervalSeconds: undefined };\n}\n\nasync function findExistingSchedule(\n agentId: string,\n scheduleName: string,\n): Promise<ScheduleListItem | undefined> {\n const { schedules } = await listZeroSchedules();\n return schedules.find((s) => {\n return s.agentId === agentId && s.name === scheduleName;\n });\n}\n\ninterface DeployResult {\n created: boolean;\n schedule: {\n triggerType?: \"cron\" | \"once\" | \"loop\";\n timezone: string;\n cronExpression?: string | null;\n nextRunAt?: string | null;\n atTime?: string | null;\n intervalSeconds?: number | null;\n };\n}\n\nasync function buildAndDeploy(params: {\n scheduleName: string;\n agentId: string;\n agentName: string;\n frequency: ScheduleFrequency;\n time: string | undefined;\n day: number | undefined;\n atTime: string | undefined;\n intervalSeconds: number | undefined;\n timezone: string;\n prompt: string;\n existingEnabled: boolean | undefined;\n}): Promise<DeployResult> {\n let cronExpression: string | undefined;\n let atTimeISO: string | undefined;\n\n if (params.frequency === \"loop\") {\n // Loop mode: intervalSeconds is passed directly\n } else if (params.atTime) {\n atTimeISO = toISODateTime(params.atTime);\n } else if (params.time && params.frequency !== \"once\") {\n cronExpression = generateCronExpression(\n params.frequency,\n params.time,\n params.day,\n );\n }\n\n console.log(\n `\\nDeploying schedule for agent ${chalk.cyan(params.agentName)}...`,\n );\n\n // Preserve enabled state on update so loop schedules don't lose nextRunAt.\n // On create, existingEnabled is undefined → omit the field so the server\n // applies its default (disabled; enable happens later via the enable flow).\n const deployResult = await deployZeroSchedule({\n name: params.scheduleName,\n agentId: params.agentId,\n cronExpression,\n atTime: atTimeISO,\n intervalSeconds: params.intervalSeconds,\n timezone: params.timezone,\n prompt: params.prompt,\n ...(params.existingEnabled !== undefined && {\n enabled: params.existingEnabled,\n }),\n });\n\n return deployResult;\n}\n\nfunction displayDeployResult(\n scheduleName: string,\n deployResult: DeployResult,\n): void {\n if (deployResult.created) {\n console.log(chalk.green(`✓ Schedule \"${scheduleName}\" created`));\n } else {\n console.log(chalk.green(`✓ Schedule \"${scheduleName}\" updated`));\n }\n\n console.log(chalk.dim(` Timezone: ${deployResult.schedule.timezone}`));\n\n if (\n deployResult.schedule.triggerType === \"loop\" &&\n deployResult.schedule.intervalSeconds != null\n ) {\n console.log(\n chalk.dim(\n ` Mode: Loop (interval ${deployResult.schedule.intervalSeconds}s)`,\n ),\n );\n } else if (deployResult.schedule.cronExpression) {\n console.log(chalk.dim(` Cron: ${deployResult.schedule.cronExpression}`));\n if (deployResult.schedule.nextRunAt) {\n const nextRun = formatInTimezone(\n deployResult.schedule.nextRunAt,\n deployResult.schedule.timezone,\n );\n console.log(chalk.dim(` Next run: ${nextRun}`));\n }\n } else if (deployResult.schedule.atTime) {\n const atTimeFormatted = formatInTimezone(\n deployResult.schedule.atTime,\n deployResult.schedule.timezone,\n );\n console.log(chalk.dim(` At: ${atTimeFormatted}`));\n }\n}\n\nasync function tryEnableSchedule(\n scheduleName: string,\n agentId: string,\n agentName: string,\n): Promise<void> {\n try {\n await enableZeroSchedule({ name: scheduleName, agentId });\n console.log(chalk.green(`✓ Schedule \"${scheduleName}\" enabled`));\n } catch (error) {\n console.error(chalk.yellow(\"⚠ Failed to enable schedule\"));\n if (error instanceof ApiRequestError) {\n if (error.code === \"SCHEDULE_PAST\") {\n console.error(chalk.dim(\" Scheduled time has already passed\"));\n } else {\n console.error(chalk.dim(` ${error.message}`));\n }\n } else if (error instanceof Error) {\n console.error(chalk.dim(` ${error.message}`));\n }\n console.log(\n ` To enable manually: ${chalk.cyan(`zero schedule enable ${agentName}`)}`,\n );\n }\n}\n\nfunction showEnableHint(agentName: string): void {\n console.log();\n console.log(\n ` To enable: ${chalk.cyan(`zero schedule enable ${agentName}`)}`,\n );\n}\n\nasync function handleScheduleEnabling(params: {\n scheduleName: string;\n agentId: string;\n agentName: string;\n enableFlag: boolean;\n shouldPromptEnable: boolean;\n}): Promise<void> {\n const { scheduleName, agentId, agentName, enableFlag, shouldPromptEnable } =\n params;\n\n if (enableFlag) {\n await tryEnableSchedule(scheduleName, agentId, agentName);\n return;\n }\n\n if (shouldPromptEnable && isInteractive()) {\n const enableNow = await promptConfirm(\"Enable this schedule?\", true);\n if (enableNow) {\n await tryEnableSchedule(scheduleName, agentId, agentName);\n } else {\n showEnableHint(agentName);\n }\n return;\n }\n\n if (shouldPromptEnable) {\n showEnableHint(agentName);\n }\n}\n\nexport const setupCommand = new Command()\n .name(\"setup\")\n .description(\"Create or edit a schedule for a zero agent\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\"-n, --name <schedule-name>\", 'Schedule name (default: \"default\")')\n .option(\"-f, --frequency <type>\", \"Frequency: daily|weekly|monthly|once|loop\")\n .option(\"-t, --time <HH:MM>\", \"Time to run (24-hour format)\")\n .option(\"-d, --day <day>\", \"Day of week (mon-sun) or day of month (1-31)\")\n .option(\"-i, --interval <seconds>\", \"Interval in seconds for loop mode\")\n .option(\"-z, --timezone <tz>\", \"IANA timezone\")\n .option(\"-p, --prompt <text>\", \"Prompt to run\")\n .option(\n \"--prompt-file <path>\",\n \"Read prompt from file (cannot be used with --prompt)\",\n )\n .option(\"-e, --enable\", \"Enable schedule immediately after creation\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Daily at 9am: zero schedule setup <agent-id> -f daily -t 09:00 -p \"run report\"\n Weekly on Monday: zero schedule setup <agent-id> -f weekly -d mon -t 10:00 -p \"weekly sync\"\n Monthly on the 1st: zero schedule setup <agent-id> -f monthly -d 1 -t 08:00 -p \"monthly review\"\n One-time: zero schedule setup <agent-id> -f once -d 2026-04-01 -t 14:00 -p \"one-off task\"\n Loop every 5 minutes: zero schedule setup <agent-id> -f loop -i 300 -p \"poll for updates\"\n Prompt from file: zero schedule setup <agent-id> -f daily -t 09:00 --prompt-file ./prompt.md\n Create and enable: zero schedule setup <agent-id> -f daily -t 09:00 -p \"run report\" --enable\n\nNotes:\n - Re-running setup with the same agent updates the existing \"default\" schedule\n - Use -n to manage multiple named schedules for the same agent\n - All flags are required in non-interactive mode; interactive mode prompts for missing values\n - If the user wants to be notified when a schedule completes, ask them where they want to receive the notification: web chat or Slack, then include it in the prompt`,\n )\n .action(\n withErrorHandler(async (agentIdentifier: string, options: SetupOptions) => {\n // 1. Resolve agent identifier (UUID or name) to compose ID\n const compose = await resolveCompose(agentIdentifier);\n if (!compose) {\n throw new Error(`Agent not found: ${agentIdentifier}`);\n }\n const agentId = compose.id;\n const scheduleName = options.name || \"default\";\n\n // 2. Check for existing schedule\n const existingSchedule = await findExistingSchedule(\n agentId,\n scheduleName,\n );\n\n const agentName = compose.name;\n console.log(\n chalk.dim(\n existingSchedule\n ? `Editing existing schedule for agent ${agentName}`\n : `Creating new schedule for agent ${agentName}`,\n ),\n );\n\n const defaults = getExistingDefaults(existingSchedule);\n\n // 3. Gather frequency\n const frequency = await gatherFrequency(\n options.frequency,\n defaults.frequency,\n );\n if (!frequency) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n\n // 4. Gather day and time\n const timing = await gatherTiming(frequency, options, defaults);\n if (!timing) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n const { day, time, atTime, intervalSeconds } = timing;\n\n // 5. Gather timezone\n const timezone = await gatherTimezone(\n options.timezone,\n existingSchedule?.timezone,\n );\n if (!timezone) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n\n // 6. Gather prompt\n const promptText_ = await gatherPromptText(\n options.prompt,\n options.promptFile,\n existingSchedule?.prompt,\n );\n if (!promptText_) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n\n // 7. Build trigger and deploy\n const deployResult = await buildAndDeploy({\n scheduleName,\n agentId,\n agentName,\n frequency,\n time,\n day,\n atTime,\n intervalSeconds,\n timezone,\n prompt: promptText_,\n existingEnabled: existingSchedule?.enabled,\n });\n\n // 8. Display deployment result\n displayDeployResult(scheduleName, deployResult);\n\n // 9. Handle schedule enabling\n const shouldPromptEnable =\n deployResult.created ||\n (existingSchedule !== undefined && !existingSchedule.enabled);\n\n await handleScheduleEnabling({\n scheduleName,\n agentId,\n agentName,\n enableFlag: options.enable ?? false,\n shouldPromptEnable,\n });\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroSchedules } from \"../../../lib/api\";\nimport { formatRelativeTime } from \"../../../lib/domain/schedule-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List all zero schedules\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero schedule list`,\n )\n .action(\n withErrorHandler(async () => {\n const result = await listZeroSchedules();\n\n if (result.schedules.length === 0) {\n console.log(chalk.dim(\"No schedules found\"));\n console.log(\n chalk.dim(\" Create one with: zero schedule setup <agent-id>\"),\n );\n return;\n }\n\n const agentWidth = Math.max(\n 5,\n ...result.schedules.map((s) => {\n return s.agentId.length;\n }),\n );\n const scheduleWidth = Math.max(\n 8,\n ...result.schedules.map((s) => {\n return s.name.length;\n }),\n );\n const triggerWidth = Math.max(\n 7,\n ...result.schedules.map((s) => {\n return s.cronExpression\n ? s.cronExpression.length + s.timezone.length + 3\n : s.atTime?.length || 0;\n }),\n );\n\n const header = [\n \"AGENT\".padEnd(agentWidth),\n \"SCHEDULE\".padEnd(scheduleWidth),\n \"TRIGGER\".padEnd(triggerWidth),\n \"STATUS\".padEnd(8),\n \"NEXT RUN\",\n ].join(\" \");\n console.log(chalk.dim(header));\n\n for (const schedule of result.schedules) {\n const trigger = schedule.cronExpression\n ? `${schedule.cronExpression} (${schedule.timezone})`\n : schedule.atTime || \"-\";\n\n const status = schedule.enabled\n ? chalk.green(\"enabled\")\n : chalk.yellow(\"disabled\");\n\n const nextRun = schedule.enabled\n ? formatRelativeTime(schedule.nextRunAt)\n : \"-\";\n\n const row = [\n schedule.agentId.padEnd(agentWidth),\n schedule.name.padEnd(scheduleWidth),\n trigger.padEnd(triggerWidth),\n status.padEnd(8 + (schedule.enabled ? 0 : 2)),\n nextRun,\n ].join(\" \");\n console.log(row);\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { resolveZeroScheduleByAgent } from \"../../../lib/api\";\nimport {\n formatDateTime,\n detectTimezone,\n} from \"../../../lib/domain/schedule-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport type { ScheduleResponse } from \"@vm0/api-contracts/contracts/zero-schedules\";\n\n/**\n * Format date with styled relative time (adds chalk formatting)\n */\nfunction formatDateTimeStyled(dateStr: string | null): string {\n if (!dateStr) return chalk.dim(\"-\");\n const formatted = formatDateTime(dateStr);\n return formatted.replace(/\\(([^)]+)\\)$/, chalk.dim(\"($1)\"));\n}\n\n/**\n * Format trigger (cron or at) - timezone shown separately\n */\nfunction formatTrigger(schedule: ScheduleResponse): string {\n if (schedule.triggerType === \"loop\" && schedule.intervalSeconds !== null) {\n return `interval ${schedule.intervalSeconds}s ${chalk.dim(\"(loop)\")}`;\n }\n if (schedule.cronExpression) {\n return schedule.cronExpression;\n }\n if (schedule.atTime) {\n return `${schedule.atTime} ${chalk.dim(\"(one-time)\")}`;\n }\n return chalk.dim(\"-\");\n}\n\n/**\n * Print run configuration section\n */\nfunction printRunConfiguration(\n schedule: ScheduleResponse,\n showFullPrompt: boolean,\n): void {\n const statusText = schedule.enabled\n ? chalk.green(\"enabled\")\n : chalk.yellow(\"disabled\");\n console.log(`${\"Status:\".padEnd(16)}${statusText}`);\n\n console.log(`${\"Agent:\".padEnd(16)}${schedule.agentId}`);\n\n if (showFullPrompt) {\n console.log(`${\"Prompt:\".padEnd(16)}${chalk.dim(schedule.prompt)}`);\n } else {\n const truncated = schedule.prompt.length > 60;\n const promptPreview = truncated\n ? schedule.prompt.slice(0, 57) + \"...\"\n : schedule.prompt;\n console.log(`${\"Prompt:\".padEnd(16)}${chalk.dim(promptPreview)}`);\n if (truncated) {\n console.log(\n chalk.dim(\" Run with --prompt (-p) to see full prompt\"),\n );\n }\n }\n\n if (schedule.vars && Object.keys(schedule.vars).length > 0) {\n console.log(\n `${\"Variables:\".padEnd(16)}${Object.keys(schedule.vars).join(\", \")}`,\n );\n }\n\n if (schedule.secretNames && schedule.secretNames.length > 0) {\n console.log(`${\"Secrets:\".padEnd(16)}${schedule.secretNames.join(\", \")}`);\n }\n\n if (\n schedule.volumeVersions &&\n Object.keys(schedule.volumeVersions).length > 0\n ) {\n console.log(\n `${\"Volumes:\".padEnd(16)}${Object.keys(schedule.volumeVersions).join(\", \")}`,\n );\n }\n}\n\n/**\n * Print time schedule section\n */\nfunction printTimeSchedule(schedule: ScheduleResponse): void {\n console.log();\n console.log(`${\"Trigger:\".padEnd(16)}${formatTrigger(schedule)}`);\n console.log(`${\"Timezone:\".padEnd(16)}${detectTimezone()}`);\n\n if (schedule.enabled) {\n console.log(\n `${\"Next Run:\".padEnd(16)}${formatDateTimeStyled(schedule.nextRunAt)}`,\n );\n }\n\n if (schedule.triggerType === \"loop\" || schedule.triggerType === \"cron\") {\n const failureText =\n schedule.consecutiveFailures > 0\n ? chalk.yellow(`${schedule.consecutiveFailures}/3`)\n : chalk.dim(\"0/3\");\n console.log(`${\"Failures:\".padEnd(16)}${failureText}`);\n }\n}\n\nexport const statusCommand = new Command()\n .name(\"status\")\n .description(\"Show detailed status of a zero schedule\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\n \"-n, --name <schedule-name>\",\n \"Schedule name (required when agent has multiple schedules)\",\n )\n .option(\"-p, --prompt\", \"Show full prompt content without truncation\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero schedule status <agent-id>\n zero schedule status <agent-id> -n my-schedule\n zero schedule status <agent-id> --prompt`,\n )\n .action(\n withErrorHandler(\n async (\n agentName: string,\n options: { name?: string; prompt?: boolean },\n ) => {\n const schedule = await resolveZeroScheduleByAgent(\n agentName,\n options.name,\n );\n\n console.log();\n console.log(`Schedule for agent: ${chalk.cyan(agentName)}`);\n console.log(chalk.dim(\"━\".repeat(50)));\n\n printRunConfiguration(schedule, options.prompt ?? false);\n printTimeSchedule(schedule);\n\n console.log();\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n deleteZeroSchedule,\n resolveZeroScheduleByAgent,\n} from \"../../../lib/api\";\nimport { isInteractive, promptConfirm } from \"../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const deleteCommand = new Command()\n .name(\"delete\")\n .alias(\"rm\")\n .description(\"Delete a zero schedule\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\n \"-n, --name <schedule-name>\",\n \"Schedule name (required when agent has multiple schedules)\",\n )\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero schedule delete <agent-id>\n zero schedule delete <agent-id> -n my-schedule -y\n\nNotes:\n - Use -y to skip confirmation in non-interactive mode`,\n )\n .action(\n withErrorHandler(\n async (agentName: string, options: { name?: string; yes?: boolean }) => {\n const resolved = await resolveZeroScheduleByAgent(\n agentName,\n options.name,\n );\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 schedule for agent ${chalk.cyan(agentName)}?`,\n false,\n );\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteZeroSchedule({\n name: resolved.name,\n agentId: resolved.agentId,\n });\n\n console.log(chalk.green(`✓ Schedule \"${resolved.name}\" deleted`));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n enableZeroSchedule,\n resolveZeroScheduleByAgent,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const enableCommand = new Command()\n .name(\"enable\")\n .description(\"Enable a zero schedule\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\n \"-n, --name <schedule-name>\",\n \"Schedule name (required when agent has multiple schedules)\",\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n zero schedule enable <agent-id>\n zero schedule enable <agent-id> -n my-schedule`,\n )\n .action(\n withErrorHandler(async (agentName: string, options: { name?: string }) => {\n const resolved = await resolveZeroScheduleByAgent(\n agentName,\n options.name,\n );\n\n await enableZeroSchedule({\n name: resolved.name,\n agentId: resolved.agentId,\n });\n\n console.log(chalk.green(`✓ Schedule \"${resolved.name}\" enabled`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n disableZeroSchedule,\n resolveZeroScheduleByAgent,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const disableCommand = new Command()\n .name(\"disable\")\n .description(\"Disable a zero schedule\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\n \"-n, --name <schedule-name>\",\n \"Schedule name (required when agent has multiple schedules)\",\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n zero schedule disable <agent-id>\n zero schedule disable <agent-id> -n my-schedule`,\n )\n .action(\n withErrorHandler(async (agentName: string, options: { name?: string }) => {\n const resolved = await resolveZeroScheduleByAgent(\n agentName,\n options.name,\n );\n\n await disableZeroSchedule({\n name: resolved.name,\n agentId: resolved.agentId,\n });\n\n console.log(chalk.green(`✓ Schedule \"${resolved.name}\" disabled`));\n }),\n );\n","import { Command } from \"commander\";\nimport { listCommand } from \"./list\";\nimport { setCommand } from \"./set\";\nimport { deleteCommand } from \"./delete\";\n\nexport const zeroSecretCommand = new Command()\n .name(\"secret\")\n .description(\"Read or write secrets (API keys, tokens)\")\n .addCommand(listCommand)\n .addCommand(setCommand)\n .addCommand(deleteCommand);\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getConnectorStoredSecretDisplayInfo } from \"@vm0/connectors/connector-utils\";\nimport { listZeroSecrets } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List all secrets\")\n .action(\n withErrorHandler(async () => {\n const result = await listZeroSecrets();\n\n if (result.secrets.length === 0) {\n console.log(chalk.dim(\"No secrets found\"));\n console.log();\n console.log(\"To add a secret:\");\n console.log(chalk.cyan(\" zero secret set MY_API_KEY --body <value>\"));\n return;\n }\n\n console.log(chalk.bold(\"Secrets:\"));\n console.log();\n\n for (const secret of result.secrets) {\n let typeIndicator = \"\";\n let derivedLine: string | null = null;\n\n if (secret.type === \"model-provider\") {\n typeIndicator = chalk.dim(\" [model-provider]\");\n } else if (secret.type === \"connector\") {\n const derived = getConnectorStoredSecretDisplayInfo(secret.name);\n if (derived) {\n typeIndicator = chalk.dim(` [${derived.connectorLabel} connector]`);\n derivedLine = chalk.dim(\n `Available as: ${derived.envNames.join(\", \")}`,\n );\n } else {\n typeIndicator = chalk.dim(\" [connector]\");\n }\n } else if (secret.type === \"user\") {\n const derived = getConnectorStoredSecretDisplayInfo(secret.name);\n if (derived) {\n typeIndicator = chalk.dim(` [${derived.connectorLabel} connector]`);\n derivedLine = chalk.dim(\n `Available as: ${derived.envNames.join(\", \")}`,\n );\n }\n }\n\n console.log(` ${chalk.cyan(secret.name)}${typeIndicator}`);\n if (derivedLine) {\n console.log(` ${derivedLine}`);\n }\n if (secret.description) {\n console.log(` ${chalk.dim(secret.description)}`);\n }\n console.log(\n ` ${chalk.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`,\n );\n console.log();\n }\n\n console.log(chalk.dim(`Total: ${result.secrets.length} secret(s)`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { setZeroSecret } from \"../../../lib/api\";\nimport { isInteractive, promptPassword } from \"../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const setCommand = new Command()\n .name(\"set\")\n .description(\"Create or update a secret\")\n .argument(\"<name>\", \"Secret name (uppercase, e.g., MY_API_KEY)\")\n .option(\n \"-b, --body <value>\",\n \"Secret value (required in non-interactive mode)\",\n )\n .option(\"-d, --description <description>\", \"Optional description\")\n .action(\n withErrorHandler(\n async (\n name: string,\n options: { body?: string; description?: string },\n ) => {\n let value: string;\n\n if (options.body !== undefined) {\n value = options.body;\n } else if (isInteractive()) {\n const prompted = await promptPassword(\"Enter secret value:\");\n if (prompted === undefined) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n value = prompted;\n } else {\n throw new Error(\"--body is required in non-interactive mode\", {\n cause: new Error(\n `Usage: zero secret set ${name} --body \"your-secret-value\"`,\n ),\n });\n }\n\n let secret;\n try {\n secret = await setZeroSecret({\n name,\n value,\n description: options.description,\n });\n } catch (error) {\n if (\n error instanceof Error &&\n error.message.includes(\"must contain only uppercase\")\n ) {\n throw new Error(error.message, {\n cause: new Error(\n \"Examples of valid secret names: MY_API_KEY, GITHUB_TOKEN, AWS_ACCESS_KEY_ID\",\n ),\n });\n }\n throw error;\n }\n\n console.log(chalk.green(`✓ Secret \"${secret.name}\" saved`));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { deleteZeroSecret } from \"../../../lib/api\";\nimport { isInteractive, promptConfirm } from \"../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const deleteCommand = new Command()\n .name(\"delete\")\n .description(\"Delete a secret\")\n .argument(\"<name>\", \"Secret name to delete\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .action(\n withErrorHandler(async (name: string, options: { yes?: boolean }) => {\n if (!options.yes) {\n if (!isInteractive()) {\n throw new Error(\"--yes flag is required in non-interactive mode\");\n }\n\n const confirmed = await promptConfirm(\n `Are you sure you want to delete secret \"${name}\"?`,\n false,\n );\n\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteZeroSecret(name);\n console.log(chalk.green(`✓ Secret \"${name}\" deleted`));\n }),\n );\n","import { Command } from \"commander\";\nimport { zeroChatMessageCommand } from \"./message\";\n\nexport const zeroChatCommand = new Command()\n .name(\"chat\")\n .description(\"Send messages to web chat threads\")\n .addCommand(zeroChatMessageCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Send to thread: zero chat message send -t <thread-id> --text \"Hello!\"\n Send to agent: zero chat message send -a <agent-id> --text \"Hello!\"`,\n );\n","import { Command } from \"commander\";\nimport { sendCommand } from \"./send\";\n\nexport const zeroChatMessageCommand = new Command()\n .name(\"message\")\n .description(\"Manage chat messages\")\n .addCommand(sendCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n zero chat message send -t <thread-id> --text \"Hello!\"`,\n );\n","import { readFileSync } from \"fs\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { sendChatMessage } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nexport const sendCommand = new Command()\n .name(\"send\")\n .description(\"Send a message to a web chat thread\")\n .option(\"-t, --thread <id>\", \"Existing chat thread ID\")\n .option(\"-a, --agent <agentId>\", \"Agent ID (creates a new thread)\")\n .option(\"--text <message>\", \"Message text\")\n .option(\"--title <title>\", \"Thread title (only with --agent)\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Send to existing thread: zero chat message send -t <thread-id> --text \"Hello!\"\n Send to agent (new thread): zero chat message send -a <agent-id> --text \"Hello!\"\n\nNotes:\n - Either --thread or --agent is required; they are mutually exclusive\n - --text is required (or pipe via stdin)`,\n )\n .action(\n withErrorHandler(\n async (options: {\n thread?: string;\n agent?: string;\n text?: string;\n title?: string;\n }) => {\n let text = options.text;\n const { thread, agent, title } = options;\n\n // Validate mutual exclusion: exactly one of --thread or --agent\n if (!thread && !agent) {\n throw new Error(\"Either --thread or --agent must be provided\", {\n cause: new Error(\n 'Usage: zero chat message send -t THREAD_ID --text \"your message\"\\n zero chat message send -a AGENT_ID --text \"your message\"',\n ),\n });\n }\n if (thread && agent) {\n throw new Error(\"--thread and --agent are mutually exclusive\", {\n cause: new Error(\n \"Provide either --thread to send to an existing thread or --agent to create a new thread, not both\",\n ),\n });\n }\n\n // Read from stdin if text not provided and stdin is explicitly piped\n if (!text && process.stdin.isTTY === false) {\n text = readFileSync(\"/dev/stdin\", \"utf8\").trim();\n }\n\n if (!text) {\n throw new Error(\"--text is required\", {\n cause: new Error(\n 'Usage: zero chat message send -t THREAD_ID --text \"your message\"',\n ),\n });\n }\n\n const result = await sendChatMessage({\n thread: thread || undefined,\n agent: agent || undefined,\n text,\n title: title || undefined,\n });\n\n console.log(\n chalk.green(\n `✓ Message sent (id: ${result.messageId}, thread: ${result.threadId})`,\n ),\n );\n },\n ),\n );\n","import { Command } from \"commander\";\nimport { downloadFileCommand } from \"./download-file\";\nimport { labelListenerCommand } from \"./label-listener\";\nimport { uploadFileCommand } from \"./upload-file\";\n\nexport const zeroGithubCommand = new Command()\n .name(\"github\")\n .description(\"Manage GitHub integration files and label listeners\")\n .addCommand(downloadFileCommand)\n .addCommand(labelListenerCommand)\n .addCommand(uploadFileCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload a file: zero github upload-file -f /tmp/report.pdf -r vm0-ai/vm0 -i 42\n Download a file: zero github download-file https://github.com/user-attachments/assets/abc123 -o /tmp/out.png\n List labels: zero github label-listener list`,\n );\n","import { basename, join } from \"path\";\nimport { tmpdir } from \"os\";\nimport { Command } from \"commander\";\nimport { downloadGithubFile } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nfunction filenameFromUrl(fileUrl: string): string {\n if (URL.canParse(fileUrl)) {\n const segment = new URL(fileUrl).pathname.split(\"/\").filter(Boolean).pop();\n if (!segment) {\n return \"file\";\n }\n try {\n return decodeURIComponent(segment);\n } catch {\n return segment;\n }\n }\n return basename(fileUrl) || \"file\";\n}\n\nfunction defaultOutPath(fileUrl: string, filename?: string): string {\n return join(tmpdir(), `github-${filename || filenameFromUrl(fileUrl)}`);\n}\n\nexport const downloadFileCommand = new Command()\n .name(\"download-file\")\n .description(\"Download a file from a GitHub context block\")\n .argument(\"<url>\", \"URL from a [GitHub file] block\")\n .option(\n \"-o, --out <path>\",\n \"Output path for the downloaded file (default: /tmp/github-<filename-or-url-basename>)\",\n )\n .option(\"--filename <name>\", \"Filename hint from the [GitHub file] block\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Download to default temp path: zero github download-file https://github.com/user-attachments/assets/abc123 --filename screenshot.png\n Download to explicit path: zero github download-file https://github.com/user-attachments/assets/abc123 -o /tmp/screenshot.png\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"path\":\"/tmp/github-screenshot.png\",\"mimetype\":\"image/png\",\"size\":12345}\n\nHow to read the downloaded file:\n - Images (png/jpg/gif/webp/svg): open the file path with your image viewing tool\n - Videos (mp4/mov/webm): extract frames first with\n ffmpeg -i <path> -vf \"fps=1\" -q:v 2 /tmp/github_frame_%03d.jpg\n then view the extracted frames\n - PDF/text/csv/json/markdown: read the file directly\n\nNotes:\n - The URL comes from a [GitHub file] block\n - Streams the GitHub file bytes through VM0 directly to disk`,\n )\n .action(\n withErrorHandler(\n async (fileUrl: string, options: { out?: string; filename?: string }) => {\n const outPath =\n options.out ?? defaultOutPath(fileUrl, options.filename);\n const result = await downloadGithubFile(\n fileUrl,\n outPath,\n options.filename,\n );\n console.log(JSON.stringify(result));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type {\n GithubLabelListener,\n GithubLabelTriggerMode,\n UpdateGithubLabelListenerBody,\n} from \"@vm0/api-contracts/contracts/integrations-github\";\nimport {\n createGithubLabelListener,\n deleteGithubLabelListener,\n getGithubInstallation,\n updateGithubLabelListener,\n} from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nfunction parseTriggerMode(value: string): GithubLabelTriggerMode {\n if (value === \"created_by_me\" || value === \"anyone\") {\n return value;\n }\n throw new Error(\"trigger-mode must be one of: created_by_me, anyone\");\n}\n\nfunction enabledLabel(listener: GithubLabelListener): string {\n return listener.enabled ? chalk.green(\"yes\") : chalk.dim(\"no\");\n}\n\nfunction manageableLabel(listener: GithubLabelListener): string {\n return listener.canManage ? chalk.green(\"yes\") : chalk.dim(\"no\");\n}\n\nfunction printListeners(listeners: readonly GithubLabelListener[]): void {\n if (listeners.length === 0) {\n console.log(chalk.dim(\"No GitHub label listeners found\"));\n return;\n }\n\n const idWidth = Math.max(\n 2,\n ...listeners.map((listener) => {\n return listener.id.length;\n }),\n );\n const labelWidth = Math.max(\n 5,\n ...listeners.map((listener) => {\n return listener.labelName.length;\n }),\n );\n const agentWidth = Math.max(\n 5,\n ...listeners.map((listener) => {\n return (listener.agent?.name ?? \"-\").length;\n }),\n );\n\n console.log(\n chalk.dim(\n [\n \"ID\".padEnd(idWidth),\n \"LABEL\".padEnd(labelWidth),\n \"AGENT\".padEnd(agentWidth),\n \"TRIGGER\".padEnd(13),\n \"ENABLED\",\n \"CAN MANAGE\",\n ].join(\" \"),\n ),\n );\n\n for (const listener of listeners) {\n console.log(\n [\n listener.id.padEnd(idWidth),\n listener.labelName.padEnd(labelWidth),\n (listener.agent?.name ?? \"-\").padEnd(agentWidth),\n listener.triggerMode.padEnd(13),\n enabledLabel(listener).padEnd(7),\n manageableLabel(listener),\n ].join(\" \"),\n );\n }\n}\n\nconst listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List GitHub label listeners for the active organization\")\n .option(\"--json\", \"Print raw JSON\")\n .action(\n withErrorHandler(async (options: { json?: boolean }) => {\n const installation = await getGithubInstallation();\n if (options.json) {\n console.log(JSON.stringify(installation.labelListeners));\n return;\n }\n printListeners(installation.labelListeners);\n }),\n );\n\nconst createCommand = new Command()\n .name(\"create\")\n .description(\"Create a GitHub label listener\")\n .requiredOption(\"--label <name>\", \"GitHub label name to watch\")\n .requiredOption(\n \"--agent-id <id>\",\n \"Agent ID to run when the label is applied\",\n )\n .requiredOption(\"--prompt <text>\", \"Prompt to pass to the agent\")\n .option(\n \"--trigger-mode <mode>\",\n \"Who can trigger the listener: anyone | created_by_me\",\n \"anyone\",\n )\n .option(\"--disabled\", \"Create the listener disabled\")\n .option(\"--json\", \"Print raw JSON\")\n .action(\n withErrorHandler(\n async (options: {\n label: string;\n agentId: string;\n prompt: string;\n triggerMode: string;\n disabled?: boolean;\n json?: boolean;\n }) => {\n const result = await createGithubLabelListener({\n labelName: options.label,\n agentId: options.agentId,\n prompt: options.prompt,\n triggerMode: parseTriggerMode(options.triggerMode),\n enabled: options.disabled ? false : undefined,\n });\n\n if (options.json) {\n console.log(JSON.stringify(result.listener));\n return;\n }\n console.log(`Created GitHub label listener ${result.listener.id}`);\n },\n ),\n );\n\nconst updateCommand = new Command()\n .name(\"update\")\n .alias(\"edit\")\n .description(\"Update a GitHub label listener\")\n .argument(\"<listener-id>\", \"GitHub label listener ID\")\n .option(\"--label <name>\", \"New GitHub label name\")\n .option(\"--agent-id <id>\", \"New agent ID\")\n .option(\"--prompt <text>\", \"New prompt\")\n .option(\n \"--trigger-mode <mode>\",\n \"Who can trigger the listener: anyone | created_by_me\",\n )\n .option(\"--enable\", \"Enable the listener\")\n .option(\"--disable\", \"Disable the listener\")\n .option(\"--json\", \"Print raw JSON\")\n .action(\n withErrorHandler(\n async (\n listenerId: string,\n options: {\n label?: string;\n agentId?: string;\n prompt?: string;\n triggerMode?: string;\n enable?: boolean;\n disable?: boolean;\n json?: boolean;\n },\n ) => {\n if (options.enable && options.disable) {\n throw new Error(\"Use only one of --enable or --disable\");\n }\n\n const body: UpdateGithubLabelListenerBody = {};\n if (options.label !== undefined) body.labelName = options.label;\n if (options.agentId !== undefined) body.agentId = options.agentId;\n if (options.prompt !== undefined) body.prompt = options.prompt;\n if (options.triggerMode !== undefined) {\n body.triggerMode = parseTriggerMode(options.triggerMode);\n }\n if (options.enable) body.enabled = true;\n if (options.disable) body.enabled = false;\n\n if (Object.keys(body).length === 0) {\n throw new Error(\n \"Provide at least one change: --label, --agent-id, --prompt, --trigger-mode, --enable, or --disable\",\n );\n }\n\n const result = await updateGithubLabelListener(listenerId, body);\n if (options.json) {\n console.log(JSON.stringify(result.listener));\n return;\n }\n console.log(`Updated GitHub label listener ${result.listener.id}`);\n },\n ),\n );\n\nconst deleteCommand = new Command()\n .name(\"delete\")\n .alias(\"rm\")\n .description(\"Delete a GitHub label listener\")\n .argument(\"<listener-id>\", \"GitHub label listener ID\")\n .option(\"--json\", \"Print raw JSON\")\n .action(\n withErrorHandler(\n async (listenerId: string, options: { json?: boolean }) => {\n const result = await deleteGithubLabelListener(listenerId);\n if (options.json) {\n console.log(JSON.stringify(result));\n return;\n }\n console.log(`Deleted GitHub label listener ${listenerId}`);\n },\n ),\n );\n\nexport const labelListenerCommand = new Command()\n .name(\"label-listener\")\n .alias(\"label-listeners\")\n .alias(\"labels\")\n .description(\"Manage GitHub label listeners\")\n .addCommand(listCommand)\n .addCommand(createCommand)\n .addCommand(updateCommand)\n .addCommand(deleteCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n List listeners: zero github label-listener list\n Create listener: zero github label-listener create --label zero --agent-id <agent-id> --prompt \"Handle this issue\"\n Edit listener: zero github label-listener update <listener-id> --disable\n Delete listener: zero github label-listener delete <listener-id>\n\nNotes:\n - Updating or deleting a listener is allowed only for the listener owner or an org admin.`,\n );\n","import { readFileSync, statSync } from \"fs\";\nimport { basename, extname } from \"path\";\nimport { Command } from \"commander\";\nimport {\n completeGithubFileUpload,\n initGithubFileUpload,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nconst MIME_BY_EXTENSION: Record<string, string> = {\n \".png\": \"image/png\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".gif\": \"image/gif\",\n \".webp\": \"image/webp\",\n \".svg\": \"image/svg+xml\",\n \".mp4\": \"video/mp4\",\n \".webm\": \"video/webm\",\n \".mov\": \"video/quicktime\",\n \".pdf\": \"application/pdf\",\n \".txt\": \"text/plain\",\n \".csv\": \"text/csv\",\n \".md\": \"text/markdown\",\n \".json\": \"application/json\",\n};\n\nfunction inferContentType(localPath: string): string {\n const ext = extname(localPath).toLowerCase();\n return MIME_BY_EXTENSION[ext] ?? \"application/octet-stream\";\n}\n\nfunction parseIssueNumber(value: string): number {\n const parsed = Number(value);\n if (!Number.isSafeInteger(parsed) || parsed <= 0) {\n throw new Error(\"issue-number must be a positive integer\");\n }\n return parsed;\n}\n\nexport const uploadFileCommand = new Command()\n .name(\"upload-file\")\n .description(\"Upload a local file to a GitHub issue or pull request comment\")\n .requiredOption(\"-f, --file <path>\", \"Local file path to upload\")\n .requiredOption(\"-r, --repo <owner/name>\", \"GitHub repository\")\n .requiredOption(\n \"-i, --issue-number <number>\",\n \"GitHub issue or pull request number\",\n )\n .option(\"--caption <text>\", \"Text to include before the file link\")\n .option(\"--content-type <mime>\", \"Override inferred content type\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload a file: zero github upload-file -f /tmp/report.pdf -r vm0-ai/vm0 -i 42\n With a caption: zero github upload-file -f /tmp/data.csv -r vm0-ai/vm0 -i 42 --caption \"Daily report\"\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"commentId\":\"123\",\"repo\":\"vm0-ai/vm0\",\"issueNumber\":42,\"filename\":\"report.pdf\",\"mimetype\":\"application/pdf\",\"size\":12345,\"url\":\"https://...\"}\n\nNotes:\n - Uses the GitHub App installation on the server side\n - Uploads through VM0 storage first, then posts a GitHub comment containing the file URL`,\n )\n .action(\n withErrorHandler(\n async (options: {\n file: string;\n repo: string;\n issueNumber: string;\n caption?: string;\n contentType?: string;\n }) => {\n let fileSize: number;\n try {\n const stat = statSync(options.file);\n if (!stat.isFile()) {\n throw new Error(`Not a regular file: ${options.file}`);\n }\n fileSize = stat.size;\n } catch (error) {\n if (error instanceof Error && error.message.startsWith(\"Not \")) {\n throw error;\n }\n throw new Error(`File not found: ${options.file}`);\n }\n\n if (fileSize === 0) {\n throw new Error(\"File is empty\");\n }\n\n const filename = basename(options.file);\n const contentType =\n options.contentType ?? inferContentType(options.file);\n const issueNumber = parseIssueNumber(options.issueNumber);\n\n const prepared = await initGithubFileUpload({\n filename,\n contentType,\n length: fileSize,\n });\n\n const fileContent = readFileSync(options.file);\n const uploadResponse = await fetch(prepared.uploadUrl, {\n method: \"PUT\",\n headers: { \"Content-Type\": prepared.contentType },\n body: new Uint8Array(fileContent),\n });\n\n if (!uploadResponse.ok) {\n throw new Error(\n `File upload failed: ${uploadResponse.status} ${uploadResponse.statusText}`,\n );\n }\n\n const result = await completeGithubFileUpload({\n uploadId: prepared.uploadId,\n repo: options.repo,\n issueNumber,\n contentType: prepared.contentType,\n caption: options.caption,\n });\n\n console.log(JSON.stringify(result));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport { zeroSlackMessageCommand } from \"./message\";\nimport { uploadFileCommand } from \"./upload-file\";\nimport { downloadFileCommand } from \"./download-file\";\n\nexport const zeroSlackCommand = new Command()\n .name(\"slack\")\n .description(\n \"Send messages, upload files, and download files from Slack as the bot\",\n )\n .addCommand(zeroSlackMessageCommand)\n .addCommand(uploadFileCommand)\n .addCommand(downloadFileCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Send a message: zero slack message send -c <channel-id> -t \"Hello!\"\n Reply in a thread: zero slack message send -c <channel-id> --thread <ts> -t \"reply\"\n Upload a file: zero slack upload-file -f /tmp/report.pdf -c <channel-id>\n Download a file: zero slack download-file <file-id> -o /tmp/out.png`,\n );\n","import { Command } from \"commander\";\nimport { sendCommand } from \"./send\";\n\nexport const zeroSlackMessageCommand = new Command()\n .name(\"message\")\n .description(\"Manage Slack messages\")\n .addCommand(sendCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n zero slack message send -c <channel-id> -t \"Hello!\"`,\n );\n","import { readFileSync } from \"fs\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { sendSlackMessage } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nexport const sendCommand = new Command()\n .name(\"send\")\n .description(\"Send a message to a Slack channel or DM a user\")\n .option(\"-c, --channel <id>\", \"Channel ID\")\n .option(\"-u, --user <id>\", 'Slack user ID for DM (use \"me\" for yourself)')\n .option(\"-t, --text <message>\", \"Message text\")\n .option(\"--thread <ts>\", \"Thread timestamp for replies\")\n .option(\"--blocks <json>\", \"Block Kit JSON string\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Simple message: zero slack message send -c C01234 -t \"Hello!\"\n DM a user: zero slack message send -u U0A8V9X98QJ -t \"Hello!\"\n DM yourself: zero slack message send -u me -t \"Hello!\"\n Reply in thread: zero slack message send -c C01234 --thread 1234567890.123456 -t \"reply\"\n Rich blocks: zero slack message send -c C01234 --blocks '[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"*Bold*\"}}]'\n\nNotes:\n - Either --channel or --user is required; they are mutually exclusive\n - Either --text or --blocks is required; both can be used together`,\n )\n .action(\n withErrorHandler(\n async (options: {\n channel?: string;\n user?: string;\n text?: string;\n thread?: string;\n blocks?: string;\n }) => {\n let text = options.text;\n const { channel, user, thread, blocks: blocksStr } = options;\n\n // Validate mutual exclusion: exactly one of --channel or --user\n if (!channel && !user) {\n throw new Error(\"Either --channel or --user must be provided\", {\n cause: new Error(\n 'Usage: zero slack message send -c CHANNEL_ID -t \"your message\"\\n zero slack message send -u USER_ID -t \"your message\"',\n ),\n });\n }\n if (channel && user) {\n throw new Error(\"--channel and --user are mutually exclusive\", {\n cause: new Error(\n \"Provide either --channel to send to a channel or --user to DM a user, not both\",\n ),\n });\n }\n\n // Read from stdin if text not provided and stdin is explicitly piped\n // (isTTY is false when piped, undefined when no TTY context e.g. tests)\n if (!text && process.stdin.isTTY === false) {\n text = readFileSync(\"/dev/stdin\", \"utf8\").trim();\n }\n\n // Parse blocks JSON if provided\n let blocks: Array<{ type: string; [key: string]: unknown }> | undefined;\n if (blocksStr) {\n try {\n blocks = JSON.parse(blocksStr) as Array<{\n type: string;\n [key: string]: unknown;\n }>;\n } catch {\n throw new Error(\"Invalid JSON for --blocks flag\", {\n cause: new Error(\n \"Provide a valid JSON array of Block Kit blocks\",\n ),\n });\n }\n }\n\n // Validate at least one of text or blocks\n if (!text && !blocks) {\n throw new Error(\"Either --text or --blocks must be provided\", {\n cause: new Error(\n 'Usage: zero slack message send -c CHANNEL_ID -t \"your message\"',\n ),\n });\n }\n\n const result = await sendSlackMessage({\n channel: channel || undefined,\n user: user || undefined,\n text: text || undefined,\n threadTs: thread,\n blocks,\n });\n\n const tsInfo = result.ts ? ` (ts: ${result.ts})` : \"\";\n console.log(chalk.green(`✓ Message sent${tsInfo}`));\n },\n ),\n );\n","import { statSync, readFileSync } from \"fs\";\nimport { basename } from \"path\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { initSlackFileUpload, completeSlackFileUpload } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const uploadFileCommand = new Command()\n .name(\"upload-file\")\n .description(\"Upload a file to a Slack channel as the bot\")\n .requiredOption(\"-f, --file <path>\", \"Local file path to upload\")\n .requiredOption(\"-c, --channel <id>\", \"Slack channel ID\")\n .option(\"--thread <ts>\", \"Thread timestamp to post as a reply\")\n .option(\"--title <title>\", \"Display title for the file\")\n .option(\"--comment <text>\", \"Initial comment to accompany the file\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload a file: zero slack upload-file -f /tmp/report.pdf -c C01234\n Upload to thread: zero slack upload-file -f /tmp/log.txt -c C01234 --thread 1234567890.123456\n With title and comment: zero slack upload-file -f /tmp/data.csv -c C01234 --title \"Daily Report\" --comment \"Here's the report\"\n\nNotes:\n - Uses the bot token (not user SLACK_TOKEN), so no files:write permission is needed\n - Returns file_id and permalink for reference`,\n )\n .action(\n withErrorHandler(\n async (options: {\n file: string;\n channel: string;\n thread?: string;\n title?: string;\n comment?: string;\n }) => {\n // Validate file exists and get size\n let fileSize: number;\n try {\n const stat = statSync(options.file);\n fileSize = stat.size;\n } catch {\n throw new Error(`File not found: ${options.file}`);\n }\n\n if (fileSize === 0) {\n throw new Error(\"File is empty\");\n }\n\n const filename = basename(options.file);\n\n // Step 1: Get pre-signed upload URL from server\n const { uploadUrl, fileId } = await initSlackFileUpload({\n filename,\n length: fileSize,\n });\n\n // Step 2: Upload file directly to Slack's pre-signed URL\n const fileContent = readFileSync(options.file);\n const uploadResponse = await fetch(uploadUrl, {\n method: \"POST\",\n body: fileContent,\n });\n\n if (!uploadResponse.ok) {\n throw new Error(\n `File upload failed: ${uploadResponse.status} ${uploadResponse.statusText}`,\n );\n }\n\n // Step 3: Complete the upload and share to channel/thread\n const result = await completeSlackFileUpload({\n fileId,\n channel: options.channel,\n threadTs: options.thread,\n title: options.title,\n initialComment: options.comment,\n });\n\n console.log(chalk.green(`✓ File uploaded (file_id: ${result.fileId})`));\n console.log(chalk.dim(` permalink: ${result.permalink}`));\n },\n ),\n );\n","import { basename, join } from \"path\";\nimport { tmpdir } from \"os\";\nimport { Command } from \"commander\";\nimport { downloadSlackFile } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\n/**\n * Derive a local output path for a Slack file id.\n * Uses the system temp directory; extension is appended later once the\n * mimetype is known.\n *\n * `basename` strips any path separators from `fileId` so a hostile id like\n * `../etc/passwd` cannot escape `tmpdir()`.\n */\nfunction defaultOutPath(fileId: string): string {\n return join(tmpdir(), `slack-${basename(fileId)}`);\n}\n\nexport const downloadFileCommand = new Command()\n .name(\"download-file\")\n .description(\"Download a Slack file by id using the bot token\")\n .argument(\"<file-id>\", \"Slack file id (e.g. F01234ABCD)\")\n .option(\n \"-o, --out <path>\",\n \"Output path for the downloaded file (default: /tmp/slack-<file-id>)\",\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n Download to default temp path: zero slack download-file F01234ABCD\n Download to explicit path: zero slack download-file F01234ABCD -o /tmp/image.png\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"path\":\"/tmp/slack-F01234ABCD\",\"mimetype\":\"image/png\",\"size\":12345}\n\nHow to read the downloaded file:\n - Images (png/jpg/gif/webp/svg): open the file path with your image viewing tool\n - Videos (mp4/mov/webm): extract frames first with\n ffmpeg -i <path> -vf \"fps=1\" -q:v 2 /tmp/<file-id>_frame_%03d.jpg\n then view the extracted frames\n - PDF/text/csv/json/markdown: read the file directly\n\nNotes:\n - Uses the bot token on the server side; no user Slack token is needed\n - Streams the file bytes directly to disk`,\n )\n .action(\n withErrorHandler(async (fileId: string, options: { out?: string }) => {\n const outPath = options.out ?? defaultOutPath(fileId);\n const result = await downloadSlackFile(fileId, outPath);\n console.log(JSON.stringify(result));\n }),\n );\n","import { Command } from \"commander\";\nimport { zeroTelegramBotCommand } from \"./bot\";\nimport { downloadFileCommand } from \"./download-file\";\nimport { zeroTelegramMessageCommand } from \"./message\";\nimport { uploadFileCommand } from \"./upload-file\";\n\nexport const zeroTelegramCommand = new Command()\n .name(\"telegram\")\n .description(\n \"Inspect bots, send messages, upload files, and download files from Telegram\",\n )\n .addCommand(zeroTelegramBotCommand)\n .addCommand(zeroTelegramMessageCommand)\n .addCommand(downloadFileCommand)\n .addCommand(uploadFileCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n List bots: zero telegram bot list\n Send a message: zero telegram message send --bot-id <bot-id> -c <chat-id> -t \"Hello!\"\n Upload a file: zero telegram upload-file -f /tmp/report.pdf --bot-id <bot-id> -c <chat-id>\n Download a file: zero telegram download-file <file-id> --bot-id <bot-id> -o /tmp/out.jpg`,\n );\n","import { Command } from \"commander\";\nimport { listCommand } from \"./list\";\n\nexport const zeroTelegramBotCommand = new Command()\n .name(\"bot\")\n .description(\"Inspect Telegram bots\")\n .addCommand(listCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n zero telegram bot list`,\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listTelegramBots } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\nimport type { TelegramBotListItem } from \"@vm0/api-contracts/contracts/integrations\";\n\nfunction usernameLabel(bot: TelegramBotListItem): string {\n if (!bot.username) return \"-\";\n return bot.username.startsWith(\"@\") ? bot.username : `@${bot.username}`;\n}\n\nfunction statusLabel(bot: TelegramBotListItem): string {\n if (bot.tokenStatus === \"valid\") return chalk.green(\"valid\");\n if (bot.tokenStatus === \"invalid\") return chalk.red(\"invalid\");\n return chalk.yellow(\"unknown\");\n}\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List Telegram bots available in the active organization\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero telegram bot list\n\nNotes:\n - Use this to find the --bot-id value before sending Telegram messages.`,\n )\n .action(\n withErrorHandler(async () => {\n const result = await listTelegramBots();\n const { bots } = result;\n\n if (bots.length === 0) {\n console.log(chalk.dim(\"No Telegram bots found\"));\n console.log(\n chalk.dim(\" Add one from Settings > Integrations > Telegram\"),\n );\n return;\n }\n\n const botIdWidth = Math.max(\n 6,\n ...bots.map((bot) => {\n return bot.id.length;\n }),\n );\n const usernameWidth = Math.max(\n 8,\n ...bots.map((bot) => {\n return usernameLabel(bot).length;\n }),\n );\n const agentWidth = Math.max(\n 5,\n ...bots.map((bot) => {\n return (bot.agent?.name ?? \"-\").length;\n }),\n );\n\n const header = [\n \"BOT ID\".padEnd(botIdWidth),\n \"USERNAME\".padEnd(usernameWidth),\n \"AGENT\".padEnd(agentWidth),\n \"CONNECTED\",\n \"TOKEN\",\n ].join(\" \");\n console.log(chalk.dim(header));\n\n for (const bot of bots) {\n const row = [\n bot.id.padEnd(botIdWidth),\n usernameLabel(bot).padEnd(usernameWidth),\n (bot.agent?.name ?? \"-\").padEnd(agentWidth),\n (bot.isConnected ? \"yes\" : \"no\").padEnd(9),\n statusLabel(bot),\n ].join(\" \");\n console.log(row);\n }\n }),\n );\n","import { basename, join } from \"path\";\nimport { tmpdir } from \"os\";\nimport { Command } from \"commander\";\nimport { downloadTelegramFile } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\n/**\n * Derive a local output path for a Telegram file id.\n * Uses the system temp directory.\n *\n * `basename` strips any path separators from `fileId` so a hostile id like\n * `../etc/passwd` cannot escape `tmpdir()`.\n */\nfunction defaultOutPath(fileId: string): string {\n return join(tmpdir(), `telegram-${basename(fileId)}`);\n}\n\nexport const downloadFileCommand = new Command()\n .name(\"download-file\")\n .description(\"Download a Telegram file by id using the bot token\")\n .argument(\"<file-id>\", \"Telegram file id from a [Telegram file] block\")\n .option(\n \"-o, --out <path>\",\n \"Output path for the downloaded file (default: /tmp/telegram-<file-id>)\",\n )\n .requiredOption(\n \"--bot-id <bot-id>\",\n \"Telegram bot id from the [Telegram file] block\",\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n Download to default temp path: zero telegram download-file AgACAgUAAxkBAA --bot-id 123456789\n Download to explicit path: zero telegram download-file AgACAgUAAxkBAA --bot-id 123456789 -o /tmp/photo.jpg\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"path\":\"/tmp/telegram-AgACAgUAAxkBAA\",\"mimetype\":\"image/jpeg\",\"size\":12345}\n\nHow to read the downloaded file:\n - Images (png/jpg/gif/webp/svg): open the file path with your image viewing tool\n - Videos (mp4/mov/webm): extract frames first with\n ffmpeg -i <path> -vf \"fps=1\" -q:v 2 /tmp/<file-id>_frame_%03d.jpg\n then view the extracted frames\n - PDF/text/csv/json/markdown: read the file directly\n\nNotes:\n - Uses the Telegram bot token on the server side\n - Streams the file bytes directly to disk`,\n )\n .action(\n withErrorHandler(\n async (fileId: string, options: { out?: string; botId: string }) => {\n const outPath = options.out ?? defaultOutPath(fileId);\n const result = await downloadTelegramFile(\n fileId,\n options.botId,\n outPath,\n );\n console.log(JSON.stringify(result));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport { sendCommand } from \"./send\";\n\nexport const zeroTelegramMessageCommand = new Command()\n .name(\"message\")\n .description(\"Manage Telegram messages\")\n .addCommand(sendCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n zero telegram message send --bot-id <bot-id> -c <chat-id> -t \"Hello!\"`,\n );\n","import { readFileSync } from \"fs\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { sendTelegramMessage } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nfunction parsePositiveInteger(value: string, flag: string): number {\n const parsed = Number(value);\n if (!Number.isInteger(parsed) || parsed <= 0) {\n throw new Error(`${flag} must be a positive integer`);\n }\n return parsed;\n}\n\nexport const sendCommand = new Command()\n .name(\"send\")\n .description(\"Send a message to a Telegram chat as the bot\")\n .requiredOption(\"--bot-id <id>\", \"Telegram bot ID\")\n .requiredOption(\"-c, --chat-id <id>\", \"Telegram chat ID\")\n .option(\"-t, --text <message>\", \"Message text\")\n .option(\"--reply-to-message-id <id>\", \"Message ID to reply to\")\n .option(\"--message-thread-id <id>\", \"Telegram forum topic thread ID\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Simple message: zero telegram message send --bot-id 123456789 -c -1001234567890 -t \"Hello!\"\n Reply to message: zero telegram message send --bot-id 123456789 -c -1001234567890 --reply-to-message-id 42 -t \"reply\"\n Forum topic message: zero telegram message send --bot-id 123456789 -c -1001234567890 --message-thread-id 7 -t \"topic update\"\n\nNotes:\n - Message text can be provided with --text or piped on stdin\n - Choose an explicit --bot-id. Run \"zero telegram bot list\" to inspect available bots.`,\n )\n .action(\n withErrorHandler(\n async (options: {\n botId: string;\n chatId: string;\n text?: string;\n replyToMessageId?: string;\n messageThreadId?: string;\n }) => {\n let text = options.text;\n if (!text && process.stdin.isTTY === false) {\n text = readFileSync(\"/dev/stdin\", \"utf8\").trim();\n }\n\n if (!text) {\n throw new Error(\"Either --text or piped stdin must be provided\", {\n cause: new Error(\n 'Usage: zero telegram message send --bot-id BOT_ID -c CHAT_ID -t \"your message\"',\n ),\n });\n }\n\n const result = await sendTelegramMessage({\n botId: options.botId,\n chatId: options.chatId,\n text,\n replyToMessageId: options.replyToMessageId\n ? parsePositiveInteger(\n options.replyToMessageId,\n \"reply-to-message-id\",\n )\n : undefined,\n messageThreadId: options.messageThreadId\n ? parsePositiveInteger(options.messageThreadId, \"message-thread-id\")\n : undefined,\n });\n\n console.log(\n chalk.green(`✓ Message sent (message_id: ${result.messageId})`),\n );\n },\n ),\n );\n","import { readFileSync, statSync } from \"fs\";\nimport { basename, extname } from \"path\";\nimport { Command } from \"commander\";\nimport {\n completeTelegramFileUpload,\n initTelegramFileUpload,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nconst MIME_BY_EXTENSION: Record<string, string> = {\n \".png\": \"image/png\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".gif\": \"image/gif\",\n \".webp\": \"image/webp\",\n \".svg\": \"image/svg+xml\",\n \".mp4\": \"video/mp4\",\n \".webm\": \"video/webm\",\n \".mov\": \"video/quicktime\",\n \".pdf\": \"application/pdf\",\n \".txt\": \"text/plain\",\n \".csv\": \"text/csv\",\n \".md\": \"text/markdown\",\n \".json\": \"application/json\",\n};\n\nfunction inferContentType(localPath: string): string {\n const ext = extname(localPath).toLowerCase();\n return MIME_BY_EXTENSION[ext] ?? \"application/octet-stream\";\n}\n\nfunction parseMessageThreadId(value: string | undefined): number | undefined {\n if (!value) return undefined;\n const parsed = Number(value);\n if (!Number.isSafeInteger(parsed) || parsed <= 0) {\n throw new Error(\"message-thread-id must be a positive integer\");\n }\n return parsed;\n}\n\nexport const uploadFileCommand = new Command()\n .name(\"upload-file\")\n .description(\"Upload a local file to a Telegram chat as the bot\")\n .requiredOption(\"-f, --file <path>\", \"Local file path to upload\")\n .requiredOption(\"--bot-id <bot-id>\", \"Telegram bot id to send through\")\n .requiredOption(\"-c, --chat-id <chat-id>\", \"Telegram chat id or @channel\")\n .option(\"--caption <text>\", \"Caption to accompany the file\")\n .option(\"--message-thread-id <id>\", \"Forum topic message thread id\")\n .option(\"--content-type <mime>\", \"Override inferred content type\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload a file: zero telegram upload-file -f /tmp/report.pdf --bot-id 123456789 -c -1001234567890\n Upload to a topic: zero telegram upload-file -f /tmp/log.txt --bot-id 123456789 -c -1001234567890 --message-thread-id 42\n With a caption: zero telegram upload-file -f /tmp/data.csv --bot-id 123456789 -c @channel --caption \"Daily report\"\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"messageId\":123,\"chatId\":\"-1001234567890\",\"fileId\":\"...\",\"filename\":\"report.pdf\",\"mimetype\":\"application/pdf\",\"size\":12345,\"url\":\"https://...\"}\n\nNotes:\n - Uses the Telegram bot token on the server side\n - Uploads through VM0 storage first, then asks Telegram to fetch the file URL\n - VM0 does not apply file type or size restrictions before calling Telegram`,\n )\n .action(\n withErrorHandler(\n async (options: {\n file: string;\n botId: string;\n chatId: string;\n caption?: string;\n messageThreadId?: string;\n contentType?: string;\n }) => {\n let fileSize: number;\n try {\n const stat = statSync(options.file);\n if (!stat.isFile()) {\n throw new Error(`Not a regular file: ${options.file}`);\n }\n fileSize = stat.size;\n } catch (error) {\n if (error instanceof Error && error.message.startsWith(\"Not \")) {\n throw error;\n }\n throw new Error(`File not found: ${options.file}`);\n }\n\n if (fileSize === 0) {\n throw new Error(\"File is empty\");\n }\n const filename = basename(options.file);\n const contentType =\n options.contentType ?? inferContentType(options.file);\n const messageThreadId = parseMessageThreadId(options.messageThreadId);\n\n const prepared = await initTelegramFileUpload({\n filename,\n contentType,\n length: fileSize,\n });\n\n const fileContent = readFileSync(options.file);\n const uploadResponse = await fetch(prepared.uploadUrl, {\n method: \"PUT\",\n headers: { \"Content-Type\": prepared.contentType },\n body: new Uint8Array(fileContent),\n });\n\n if (!uploadResponse.ok) {\n throw new Error(\n `File upload failed: ${uploadResponse.status} ${uploadResponse.statusText}`,\n );\n }\n\n const result = await completeTelegramFileUpload({\n uploadId: prepared.uploadId,\n botId: options.botId,\n chatId: options.chatId,\n contentType: prepared.contentType,\n caption: options.caption,\n messageThreadId,\n });\n\n console.log(JSON.stringify(result));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport { downloadFileCommand } from \"./download-file\";\nimport { messageCommand } from \"./message\";\nimport { uploadFileCommand } from \"./upload-file\";\n\nexport const zeroPhoneCommand = new Command()\n .name(\"phone\")\n .description(\"Send AgentPhone messages, upload files, and download media\")\n .addCommand(messageCommand)\n .addCommand(downloadFileCommand)\n .addCommand(uploadFileCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Send a message: zero phone message --to +15551234567 -t \"Hello!\"\n Upload a file: zero phone upload-file -f /tmp/report.pdf --to +15551234567\n Download a file: zero phone download-file <file-id> -o /tmp/out.jpg`,\n );\n","import { basename, join } from \"path\";\nimport { tmpdir } from \"os\";\nimport { Command } from \"commander\";\nimport { downloadPhoneFile } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nfunction defaultOutPath(fileId: string): string {\n return join(tmpdir(), `phone-${basename(fileId)}`);\n}\n\nexport const downloadFileCommand = new Command()\n .name(\"download-file\")\n .description(\"Download an AgentPhone media file by id\")\n .argument(\n \"<file-id>\",\n \"AgentPhone message id from an [AgentPhone file] block\",\n )\n .option(\n \"-o, --out <path>\",\n \"Output path for the downloaded file (default: /tmp/phone-<file-id>)\",\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n Download to default temp path: zero phone download-file msg_123\n Download to explicit path: zero phone download-file msg_123 -o /tmp/photo.jpg\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"path\":\"/tmp/phone-msg_123\",\"mimetype\":\"image/jpeg\",\"size\":12345}\n\nHow to read the downloaded file:\n - Images (png/jpg/gif/webp/svg): open the file path with your image viewing tool\n - Videos (mp4/mov/webm): extract frames first with\n ffmpeg -i <path> -vf \"fps=1\" -q:v 2 /tmp/<file-id>_frame_%03d.jpg\n then view the extracted frames\n - PDF/text/csv/json/markdown: read the file directly`,\n )\n .action(\n withErrorHandler(async (fileId: string, options: { out?: string }) => {\n const outPath = options.out ?? defaultOutPath(fileId);\n const result = await downloadPhoneFile(fileId, outPath);\n console.log(JSON.stringify(result));\n }),\n );\n","import { readFileSync } from \"fs\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { sendPhoneMessage } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const messageCommand = new Command()\n .name(\"message\")\n .description(\"Send an AgentPhone text message\")\n .requiredOption(\"--to <phone>\", \"Connected phone handle to message\")\n .option(\"--agent-id <id>\", \"AgentPhone agent ID (inferred when omitted)\")\n .option(\"-t, --text <message>\", \"Message text\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Send a message: zero phone message --to +15551234567 -t \"Hello!\"\n From stdin: printf \"Hello!\" | zero phone message --to +15551234567\n\nNotes:\n - The phone handle must already be connected to the authenticated VM0 user\n - AgentPhone agent ID is inferred from the conversation when omitted`,\n )\n .action(\n withErrorHandler(\n async (options: { to: string; agentId?: string; text?: string }) => {\n let text = options.text;\n if (!text && process.stdin.isTTY === false) {\n text = readFileSync(\"/dev/stdin\", \"utf8\").trim();\n }\n\n if (!text) {\n throw new Error(\"Either --text or piped stdin must be provided\", {\n cause: new Error(\n 'Usage: zero phone message --to +15551234567 -t \"your message\"',\n ),\n });\n }\n\n const result = await sendPhoneMessage({\n toNumber: options.to,\n text,\n agentphoneAgentId: options.agentId,\n });\n\n console.log(\n chalk.green(`✓ Message sent (message_id: ${result.messageId})`),\n );\n },\n ),\n );\n","import { readFileSync, statSync } from \"fs\";\nimport { basename, extname } from \"path\";\nimport { Command } from \"commander\";\nimport { completePhoneFileUpload, initPhoneFileUpload } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nconst MIME_BY_EXTENSION: Record<string, string> = {\n \".png\": \"image/png\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".gif\": \"image/gif\",\n \".webp\": \"image/webp\",\n \".svg\": \"image/svg+xml\",\n \".mp4\": \"video/mp4\",\n \".webm\": \"video/webm\",\n \".mov\": \"video/quicktime\",\n \".pdf\": \"application/pdf\",\n \".txt\": \"text/plain\",\n \".csv\": \"text/csv\",\n \".md\": \"text/markdown\",\n \".json\": \"application/json\",\n};\n\nfunction inferContentType(localPath: string): string {\n const ext = extname(localPath).toLowerCase();\n return MIME_BY_EXTENSION[ext] ?? \"application/octet-stream\";\n}\n\nexport const uploadFileCommand = new Command()\n .name(\"upload-file\")\n .description(\"Upload a local file to an AgentPhone conversation\")\n .requiredOption(\"-f, --file <path>\", \"Local file path to upload\")\n .requiredOption(\"--to <phone>\", \"Connected phone handle to message\")\n .option(\"--agent-id <id>\", \"AgentPhone agent ID (inferred when omitted)\")\n .option(\"--caption <text>\", \"Caption to accompany the file\")\n .option(\"--content-type <mime>\", \"Override inferred content type\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload a file: zero phone upload-file -f /tmp/report.pdf --to +15551234567\n With a caption: zero phone upload-file -f /tmp/photo.jpg --to +15551234567 --caption \"Here it is\"\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"messageId\":\"msg_123\",\"toNumber\":\"+15551234567\",\"filename\":\"report.pdf\",\"mimetype\":\"application/pdf\",\"size\":12345,\"url\":\"https://...\"}`,\n )\n .action(\n withErrorHandler(\n async (options: {\n file: string;\n to: string;\n agentId?: string;\n caption?: string;\n contentType?: string;\n }) => {\n let fileSize: number;\n try {\n const stat = statSync(options.file);\n if (!stat.isFile()) {\n throw new Error(`Not a regular file: ${options.file}`);\n }\n fileSize = stat.size;\n } catch (error) {\n if (error instanceof Error && error.message.startsWith(\"Not \")) {\n throw error;\n }\n throw new Error(`File not found: ${options.file}`);\n }\n\n if (fileSize === 0) {\n throw new Error(\"File is empty\");\n }\n\n const filename = basename(options.file);\n const contentType =\n options.contentType ?? inferContentType(options.file);\n\n const prepared = await initPhoneFileUpload({\n filename,\n contentType,\n length: fileSize,\n });\n\n const fileContent = readFileSync(options.file);\n const uploadResponse = await fetch(prepared.uploadUrl, {\n method: \"PUT\",\n headers: { \"Content-Type\": prepared.contentType },\n body: new Uint8Array(fileContent),\n });\n\n if (!uploadResponse.ok) {\n throw new Error(\n `File upload failed: ${uploadResponse.status} ${uploadResponse.statusText}`,\n );\n }\n\n const result = await completePhoneFileUpload({\n uploadId: prepared.uploadId,\n toNumber: options.to,\n agentphoneAgentId: options.agentId,\n contentType: prepared.contentType,\n caption: options.caption,\n });\n\n console.log(JSON.stringify(result));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport { listCommand } from \"./list\";\nimport { setCommand } from \"./set\";\nimport { deleteCommand } from \"./delete\";\n\nexport const zeroVariableCommand = new Command()\n .name(\"variable\")\n .description(\"Read or write non-sensitive configuration values\")\n .addCommand(listCommand)\n .addCommand(setCommand)\n .addCommand(deleteCommand);\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroVariables } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\n/**\n * Truncate value for display if too long\n */\nfunction truncateValue(value: string, maxLength: number = 60): string {\n if (value.length <= maxLength) {\n return value;\n }\n return value.slice(0, maxLength - 15) + \"... [truncated]\";\n}\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List all variables\")\n .action(\n withErrorHandler(async () => {\n const result = await listZeroVariables();\n\n if (result.variables.length === 0) {\n console.log(chalk.dim(\"No variables found\"));\n console.log();\n console.log(\"To add a variable:\");\n console.log(chalk.cyan(\" zero variable set MY_VAR <value>\"));\n return;\n }\n\n console.log(chalk.bold(\"Variables:\"));\n console.log();\n\n for (const variable of result.variables) {\n const displayValue = truncateValue(variable.value);\n console.log(` ${chalk.cyan(variable.name)} = ${displayValue}`);\n if (variable.description) {\n console.log(` ${chalk.dim(variable.description)}`);\n }\n console.log(\n ` ${chalk.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`,\n );\n console.log();\n }\n\n console.log(chalk.dim(`Total: ${result.variables.length} variable(s)`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { setZeroVariable } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const setCommand = new Command()\n .name(\"set\")\n .description(\"Create or update a variable\")\n .argument(\"<name>\", \"Variable name (uppercase, e.g., MY_VAR)\")\n .argument(\"<value>\", \"Variable value\")\n .option(\"-d, --description <description>\", \"Optional description\")\n .action(\n withErrorHandler(\n async (\n name: string,\n value: string,\n options: { description?: string },\n ) => {\n let variable;\n try {\n variable = await setZeroVariable({\n name,\n value,\n description: options.description,\n });\n } catch (error) {\n if (\n error instanceof Error &&\n error.message.includes(\"must contain only uppercase\")\n ) {\n throw new Error(error.message, {\n cause: new Error(\n \"Examples of valid variable names: MY_VAR, API_URL, DEBUG_MODE\",\n ),\n });\n }\n throw error;\n }\n\n console.log(chalk.green(`✓ Variable \"${variable.name}\" saved`));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { deleteZeroVariable } from \"../../../lib/api\";\nimport { isInteractive, promptConfirm } from \"../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const deleteCommand = new Command()\n .name(\"delete\")\n .description(\"Delete a variable\")\n .argument(\"<name>\", \"Variable name to delete\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .action(\n withErrorHandler(async (name: string, options: { yes?: boolean }) => {\n if (!options.yes) {\n if (!isInteractive()) {\n throw new Error(\"--yes flag is required in non-interactive mode\");\n }\n\n const confirmed = await promptConfirm(\n `Are you sure you want to delete variable \"${name}\"?`,\n false,\n );\n\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteZeroVariable(name);\n console.log(chalk.green(`✓ Variable \"${name}\" deleted`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n getApiUrl,\n getActiveOrg,\n getToken,\n decodeZeroTokenPayload,\n} from \"../../lib/api/config\";\nimport {\n listZeroConnectors,\n getZeroAgent,\n getZeroAgentUserConnectors,\n} from \"../../lib/api\";\nimport { withErrorHandler } from \"../../lib/command\";\nimport {\n isFirewallConnectorType,\n getConnectorFirewall,\n resolveFirewallPolicies,\n} from \"@vm0/connectors/firewalls\";\nimport type { FirewallPolicies } from \"@vm0/connectors/firewall-types\";\nimport { policyIcon } from \"../../lib/utils/format-utils\";\n\n/**\n * Detect if running inside a zero sandbox (agent runtime).\n * Uses ZERO_AGENT_ID (not VM0_RUN_ID) because the zero CLI operates in the\n * zero agent context where ZERO_AGENT_ID is the canonical sandbox indicator.\n */\nfunction isInsideSandbox(): boolean {\n return !!process.env.ZERO_AGENT_ID;\n}\n\nfunction formatConnectorIdentity(connector: {\n externalUsername: string | null;\n externalEmail: string | null;\n needsReconnect: boolean;\n}): string {\n let identity = \"\";\n if (connector.externalUsername && connector.externalEmail) {\n identity = `@${connector.externalUsername} (${connector.externalEmail})`;\n } else if (connector.externalUsername) {\n identity = `@${connector.externalUsername}`;\n } else if (connector.externalEmail) {\n identity = connector.externalEmail;\n }\n if (connector.needsReconnect) {\n identity += ` ${chalk.yellow(\"(needs reconnect)\")}`;\n }\n return identity;\n}\n\nfunction printConnectorPermissions(\n type: string,\n resolvedPolicies: FirewallPolicies | null,\n): void {\n if (!isFirewallConnectorType(type)) return;\n\n const refPolicy = resolvedPolicies?.[type];\n if (!refPolicy) {\n console.log(chalk.dim(\" full access — no permission rules configured\"));\n return;\n }\n\n const config = getConnectorFirewall(type);\n const permissions = config.apis.flatMap((a) => {\n return a.permissions ?? [];\n });\n\n if (\n permissions.length === 0 &&\n Object.keys(refPolicy.policies).length === 0\n ) {\n const unknownIcon = policyIcon(refPolicy.unknownPolicy ?? \"allow\");\n console.log(` ${unknownIcon} unknown endpoints`);\n return;\n }\n\n const nameWidth = Math.max(\n \"unknown endpoints\".length,\n ...permissions.map((p) => {\n return p.name.length;\n }),\n );\n\n for (const perm of permissions) {\n const policy = refPolicy.policies[perm.name] ?? \"deny\";\n const icon = policyIcon(policy);\n const desc = perm.description ?? \"\";\n console.log(` ${icon} ${perm.name.padEnd(nameWidth)} ${desc}`);\n }\n\n const unknownIcon = policyIcon(refPolicy.unknownPolicy ?? \"allow\");\n console.log(\n ` ${unknownIcon} ${\"unknown endpoints\".padEnd(nameWidth)} Endpoints not matching any rule`,\n );\n}\n\nasync function showSandboxInfo(showPermissions: boolean): Promise<void> {\n const agentId = process.env.ZERO_AGENT_ID;\n const payload = decodeZeroTokenPayload();\n\n console.log(`Agent ID: ${agentId}`);\n console.log(`Run ID: ${payload?.runId ?? chalk.dim(\"unavailable\")}`);\n console.log(`Org ID: ${payload?.orgId ?? chalk.dim(\"unavailable\")}`);\n\n // Capabilities section\n if (payload?.capabilities?.length) {\n console.log();\n console.log(chalk.bold(\"Capabilities:\"));\n console.log(` ${payload.capabilities.join(\", \")}`);\n }\n\n // Connected Services section\n try {\n if (showPermissions) {\n // Full mode: fetch all 3 APIs for permission details\n const [connectorsResult, agentResult, enabledResult] =\n await Promise.allSettled([\n listZeroConnectors(),\n getZeroAgent(agentId!),\n getZeroAgentUserConnectors(agentId!),\n ]);\n\n if (connectorsResult.status === \"rejected\") return;\n\n const identities = connectorsResult.value.connectors.filter((c) => {\n return c.externalUsername !== null || c.externalEmail !== null;\n });\n\n if (identities.length === 0) return;\n\n let resolvedPolicies: FirewallPolicies | null = null;\n const permissionDataAvailable =\n agentResult.status === \"fulfilled\" &&\n enabledResult.status === \"fulfilled\";\n if (permissionDataAvailable) {\n resolvedPolicies = resolveFirewallPolicies(\n agentResult.value.permissionPolicies,\n enabledResult.value,\n );\n }\n\n console.log();\n console.log(chalk.bold(\"Connectors:\"));\n for (const connector of identities) {\n const identity = formatConnectorIdentity(connector);\n console.log(` ${connector.type.padEnd(14)}${identity}`);\n\n if (permissionDataAvailable) {\n printConnectorPermissions(connector.type, resolvedPolicies);\n }\n }\n } else {\n // Default mode: only fetch connector identities (1 API call)\n const connectors = await listZeroConnectors();\n const identities = connectors.connectors.filter((c) => {\n return c.externalUsername !== null || c.externalEmail !== null;\n });\n\n if (identities.length === 0) return;\n\n console.log();\n console.log(chalk.bold(\"Connectors:\"));\n for (const connector of identities) {\n const identity = formatConnectorIdentity(connector);\n console.log(` ${connector.type.padEnd(14)}${identity}`);\n }\n }\n } catch {\n // Silently skip — connector info is supplementary\n }\n}\n\nasync function showLocalInfo(): Promise<void> {\n const token = await getToken();\n const apiUrl = await getApiUrl();\n const activeOrg = await getActiveOrg();\n\n // Auth section\n console.log(chalk.bold(\"Auth:\"));\n if (token) {\n const tokenSource = process.env.ZERO_TOKEN\n ? \"ZERO_TOKEN env var\"\n : process.env.VM0_TOKEN\n ? \"VM0_TOKEN env var\"\n : \"config file\";\n console.log(\n ` Status: ${chalk.green(\"Authenticated\")} (via ${tokenSource})`,\n );\n } else {\n console.log(` Status: ${chalk.dim(\"Not authenticated\")}`);\n }\n console.log(` API: ${apiUrl}`);\n console.log();\n\n // Org section\n if (activeOrg) {\n console.log(chalk.bold(\"Org:\"));\n console.log(` Active: ${activeOrg}`);\n }\n}\n\nexport const zeroWhoamiCommand = new Command()\n .name(\"whoami\")\n .description(\"Show agent identity, run ID, and capabilities\")\n .option(\"--permissions\", \"Show full permission details for each connector\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero whoami\n zero whoami --permissions\n\nNotes:\n - Inside sandbox: shows agent ID, run ID, org ID, and granted capabilities\n - Use --permissions to see detailed permission breakdown per connector\n - Your agent ID is also available as $ZERO_AGENT_ID`,\n )\n .action(\n withErrorHandler(async (options: { permissions?: boolean }) => {\n if (isInsideSandbox()) {\n await showSandboxInfo(options.permissions ?? false);\n } else {\n await showLocalInfo();\n }\n }),\n );\n","import { Command } from \"commander\";\nimport { createCommand } from \"./create\";\nimport { editCommand } from \"./edit\";\nimport { viewCommand } from \"./view\";\nimport { listCommand } from \"./list\";\nimport { deleteCommand } from \"./delete\";\n\nexport const zeroSkillCommand = new Command(\"skill\")\n .description(\"Manage custom skills\")\n .addCommand(createCommand)\n .addCommand(editCommand)\n .addCommand(viewCommand)\n .addCommand(listCommand)\n .addCommand(deleteCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Create from directory: zero skill create my-skill --dir ./skills/my-skill/\n List all skills: zero skill list\n View skill content: zero skill view my-skill\n Update skill content: zero skill edit my-skill --dir ./skills/my-skill/\n Delete a skill: zero skill delete my-skill -y\n\nSkill Binding:\n Bind to agent: zero agent edit <id> --add-skill my-skill\n Unbind from agent: zero agent edit <id> --remove-skill my-skill\n Replace all skills: zero agent edit <id> --skills a,b,c`,\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { createSkill } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { readSkillDirectory } from \"../../../lib/skill-directory\";\n\nexport const createCommand = new Command()\n .name(\"create\")\n .description(\"Create a custom skill in the organization\")\n .argument(\"<name>\", \"Skill name (lowercase alphanumeric with hyphens)\")\n .requiredOption(\"--dir <path>\", \"Path to directory containing SKILL.md\")\n .option(\"--display-name <name>\", \"Skill display name\")\n .option(\"--description <text>\", \"Skill description\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero skill create my-skill --dir ./skills/my-skill/\n zero skill create my-skill --dir ./skills/my-skill/ --display-name \"My Skill\" --description \"Does things\"\n\nNotes:\n - The directory must contain a SKILL.md file\n - All files in the directory are uploaded (hidden files and node_modules excluded)\n - The skill is created in the organization but not bound to any agent\n - Use 'zero agent edit <id> --add-skill <name>' to bind a skill to an agent`,\n )\n .action(\n withErrorHandler(\n async (\n name: string,\n options: {\n dir: string;\n displayName?: string;\n description?: string;\n },\n ) => {\n const files = readSkillDirectory(options.dir);\n\n const skill = await createSkill({\n name,\n files,\n displayName: options.displayName,\n description: options.description,\n });\n\n console.log(chalk.green(`✓ Skill \"${skill.name}\" created`));\n console.log(` Name: ${skill.name}`);\n console.log(` Files: ${files.length} file(s)`);\n if (skill.displayName) {\n console.log(` Display Name: ${skill.displayName}`);\n }\n if (skill.description) {\n console.log(` Description: ${skill.description}`);\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 files from a skill directory.\n *\n * Skips hidden files (starting with .), node_modules, and .git.\n * Throws if SKILL.md is not found at the root.\n */\nexport function readSkillDirectory(\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 files.push({\n path: relPath,\n content: readFileSync(join(dir, entry.name), \"utf-8\"),\n });\n }\n }\n }\n\n walk(dirPath, \"\");\n\n if (\n !files.some((f) => {\n return f.path === \"SKILL.md\";\n })\n ) {\n throw new Error(`SKILL.md not found in ${dirPath}`);\n }\n\n return files;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { updateSkill } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { readSkillDirectory } from \"../../../lib/skill-directory\";\n\nexport const editCommand = new Command()\n .name(\"edit\")\n .description(\"Update a custom skill's content\")\n .argument(\"<name>\", \"Skill name\")\n .requiredOption(\n \"--dir <path>\",\n \"Path to directory containing updated skill files\",\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n zero skill edit my-skill --dir ./skills/my-skill/`,\n )\n .action(\n withErrorHandler(async (name: string, options: { dir: string }) => {\n const files = readSkillDirectory(options.dir);\n await updateSkill(name, { files });\n\n console.log(\n chalk.green(`✓ Skill \"${name}\" updated (${files.length} file(s))`),\n );\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getSkill } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const viewCommand = new Command()\n .name(\"view\")\n .description(\"View a custom skill\")\n .argument(\"<name>\", \"Skill name\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero skill view my-skill`,\n )\n .action(\n withErrorHandler(async (name: string) => {\n const skill = await getSkill(name);\n\n console.log(chalk.bold(skill.name));\n if (skill.displayName) console.log(chalk.dim(skill.displayName));\n console.log();\n console.log(`Name: ${skill.name}`);\n if (skill.displayName) console.log(`Display Name: ${skill.displayName}`);\n if (skill.description) console.log(`Description: ${skill.description}`);\n\n if (skill.files && skill.files.length > 0) {\n console.log();\n console.log(chalk.dim(\"── Files ──\"));\n for (const f of skill.files) {\n console.log(` ${f.path} (${f.size} bytes)`);\n }\n }\n\n console.log();\n if (skill.content) {\n console.log(chalk.dim(\"── SKILL.md ──\"));\n console.log(skill.content);\n } else {\n console.log(chalk.dim(\"No content\"));\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listSkills } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List custom skills in the organization\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero skill list`,\n )\n .action(\n withErrorHandler(async () => {\n const skills = await listSkills();\n\n if (skills.length === 0) {\n console.log(chalk.dim(\"No custom skills found\"));\n console.log(\n chalk.dim(\" Create one with: zero skill create <name> --dir <path>\"),\n );\n return;\n }\n\n const nameWidth = Math.max(\n 4,\n ...skills.map((s) => {\n return s.name.length;\n }),\n );\n const displayWidth = Math.max(\n 12,\n ...skills.map((s) => {\n return (s.displayName ?? \"\").length;\n }),\n );\n\n const header = [\n \"NAME\".padEnd(nameWidth),\n \"DISPLAY NAME\".padEnd(displayWidth),\n \"DESCRIPTION\",\n ].join(\" \");\n console.log(chalk.dim(header));\n\n for (const skill of skills) {\n const row = [\n skill.name.padEnd(nameWidth),\n (skill.displayName ?? \"-\").padEnd(displayWidth),\n skill.description ?? \"-\",\n ].join(\" \");\n console.log(row);\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getSkill, deleteSkill } from \"../../../lib/api\";\nimport { isInteractive, promptConfirm } from \"../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const deleteCommand = new Command()\n .name(\"delete\")\n .alias(\"rm\")\n .description(\"Delete a custom skill from the organization\")\n .argument(\"<name>\", \"Skill name\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero skill delete my-skill\n zero skill delete my-skill -y\n\nNotes:\n - This removes the skill from the organization and unbinds it from all agents\n - Use -y to skip confirmation in non-interactive mode`,\n )\n .action(\n withErrorHandler(async (name: string, options: { yes?: boolean }) => {\n await getSkill(name);\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 skill '${name}'? This will unbind it from all agents.`,\n false,\n );\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteSkill(name);\n console.log(chalk.green(`✓ Skill \"${name}\" deleted`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getZeroRunAgentEvents, type RunEvent } from \"../../../lib/api\";\nimport { parseTime } from \"../../../lib/utils/time-parser\";\nimport { EventStreamNormalizer } from \"../../../lib/events/event-stream-normalizer\";\nimport { EventRenderer } from \"../../../lib/events/event-renderer\";\nimport { paginate } from \"../../../lib/utils/paginate\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { isUUID } from \"../../run/shared\";\nimport { listCommand } from \"./list\";\nimport { searchCommand } from \"./search\";\n\nconst PAGE_LIMIT = 100;\n\nfunction renderAgentEvent(\n event: RunEvent,\n renderer: EventRenderer,\n normalizer: EventStreamNormalizer,\n framework: string,\n): void {\n const parsedEvents = normalizer.process(\n event.eventData,\n framework,\n new Date(event.createdAt),\n );\n for (const parsed of parsedEvents) {\n renderer.render(parsed);\n }\n}\n\nasync function showAgentEvents(\n runId: string,\n options: {\n since?: number;\n targetCount: number | \"all\";\n order: \"asc\" | \"desc\";\n },\n): Promise<void> {\n const firstResponse = await getZeroRunAgentEvents(runId, {\n since: options.since,\n limit: PAGE_LIMIT,\n order: options.order,\n });\n\n if (firstResponse.events.length === 0) {\n console.log(chalk.yellow(\"No agent events found for this run\"));\n return;\n }\n\n let allEvents: RunEvent[];\n\n if (\n !firstResponse.hasMore ||\n (options.targetCount !== \"all\" &&\n firstResponse.events.length >= options.targetCount)\n ) {\n allEvents =\n options.targetCount === \"all\"\n ? firstResponse.events\n : firstResponse.events.slice(0, options.targetCount);\n } else {\n const lastEvent = firstResponse.events[firstResponse.events.length - 1];\n const firstPageTimestamp = lastEvent\n ? new Date(lastEvent.createdAt).getTime()\n : undefined;\n\n const remainingEvents = await paginate<RunEvent>({\n fetchPage: async (since) => {\n const response = await getZeroRunAgentEvents(runId, {\n since,\n limit: PAGE_LIMIT,\n order: options.order,\n });\n return { items: response.events, hasMore: response.hasMore };\n },\n getTimestamp: (event) => {\n return new Date(event.createdAt).getTime();\n },\n targetCount:\n options.targetCount === \"all\"\n ? \"all\"\n : options.targetCount - firstResponse.events.length,\n initialSince: firstPageTimestamp,\n });\n\n allEvents = [...firstResponse.events, ...remainingEvents];\n\n if (\n options.targetCount !== \"all\" &&\n allEvents.length > options.targetCount\n ) {\n allEvents = allEvents.slice(0, options.targetCount);\n }\n }\n\n const events =\n options.order === \"desc\" ? [...allEvents].reverse() : allEvents;\n\n const renderer = new EventRenderer({\n showTimestamp: true,\n verbose: true,\n });\n const normalizer = new EventStreamNormalizer();\n const framework = firstResponse.framework;\n\n for (const event of events) {\n renderAgentEvent(event, renderer, normalizer, framework);\n }\n for (const parsed of normalizer.flush()) {\n renderer.render(parsed);\n }\n}\n\nexport const zeroLogsCommand = new Command()\n .name(\"logs\")\n .description(\"View and search agent run logs\")\n .argument(\"[runId]\", \"Run ID to view agent events for\")\n .addCommand(listCommand)\n .addCommand(searchCommand)\n .option(\n \"--since <time>\",\n \"Show logs since timestamp (e.g., 5m, 2h, 1d, 2024-01-15T10:30:00Z)\",\n )\n .option(\"--tail <n>\", \"Show last N entries (default: 5)\")\n .option(\"--head <n>\", \"Show first N entries\")\n .option(\"--all\", \"Fetch all log entries\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero logs list\n zero logs <runId>\n zero logs <runId> --tail 10\n zero logs <runId> --all\n zero logs search \"error\"`,\n )\n .action(\n withErrorHandler(\n async (\n runId: string | undefined,\n options: {\n since?: string;\n tail?: string;\n head?: string;\n all?: boolean;\n },\n ) => {\n if (!runId) {\n zeroLogsCommand.help();\n return;\n }\n\n if (!isUUID(runId)) {\n console.error(\n chalk.red(`✗ Invalid run ID \"${runId}\" — expected a UUID`),\n );\n console.error(chalk.dim(\" Run: zero logs list to find run IDs\"));\n process.exit(1);\n }\n\n const countModes = [\n options.tail !== undefined,\n options.head !== undefined,\n options.all === true,\n ].filter(Boolean).length;\n if (countModes > 1) {\n throw new Error(\n \"Options --tail, --head, and --all are mutually exclusive\",\n );\n }\n\n let since: number | undefined;\n if (options.since) {\n since = parseTime(options.since);\n }\n\n const isAll = options.all === true;\n const isHead = options.head !== undefined;\n const isTail = options.tail !== undefined;\n\n let targetCount: number | \"all\";\n if (isAll) {\n targetCount = \"all\";\n } else if (isHead) {\n targetCount = Math.max(1, parseInt(options.head!, 10));\n } else if (isTail) {\n targetCount = Math.max(1, parseInt(options.tail!, 10));\n } else {\n targetCount = 5;\n }\n\n const order: \"asc\" | \"desc\" = isHead ? \"asc\" : \"desc\";\n\n await showAgentEvents(runId, { since, targetCount, order });\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroLogs } from \"../../../lib/api\";\nimport { parseTime } from \"../../../lib/utils/time-parser\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nfunction formatStatus(status: string): string {\n switch (status) {\n case \"completed\":\n return chalk.green(status);\n case \"failed\":\n case \"timeout\":\n return chalk.red(status);\n case \"running\":\n case \"pending\":\n case \"queued\":\n return chalk.yellow(status);\n case \"cancelled\":\n return chalk.dim(status);\n default:\n return status;\n }\n}\n\nfunction formatTime(iso: string): string {\n return new Date(iso).toISOString().replace(/\\.\\d{3}Z$/, \"Z\");\n}\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List agent run logs\")\n .option(\"--agent <id>\", \"Filter by Zero agent ID\")\n .option(\n \"--status <status>\",\n \"Filter by status (queued|pending|running|completed|failed|timeout|cancelled)\",\n )\n .option(\n \"--since <time>\",\n \"Filter runs created since (e.g., 5m, 2h, 1d, 2024-01-15T10:30:00Z)\",\n )\n .option(\"--limit <n>\", \"Maximum number of results (default: 20)\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero logs list\n zero logs list --agent 123e4567-e89b-12d3-a456-426614174000\n zero logs list --status completed --limit 10\n zero logs list --since 1h\n zero logs list --since 1d --status completed`,\n )\n .action(\n withErrorHandler(\n async (options: {\n agent?: string;\n status?: string;\n since?: string;\n limit?: string;\n }) => {\n const limit = options.limit ? parseInt(options.limit, 10) : undefined;\n const since = options.since ? parseTime(options.since) : undefined;\n\n const result = await listZeroLogs({\n agentId: options.agent,\n status: options.status,\n since,\n limit,\n });\n\n if (result.data.length === 0) {\n console.log(chalk.dim(\"No logs found\"));\n return;\n }\n\n const nameCol = Math.max(\n 5,\n ...result.data.map((r) => {\n return (r.displayName || r.agentId || \"-\").length;\n }),\n );\n const statusCol = Math.max(\n 6,\n ...result.data.map((r) => {\n return r.status.length;\n }),\n );\n\n const header = [\n \"RUN ID\".padEnd(38),\n \"AGENT\".padEnd(nameCol),\n \"STATUS\".padEnd(statusCol),\n \"CREATED\",\n ].join(\" \");\n console.log(chalk.dim(header));\n\n for (const entry of result.data) {\n const runId = entry.id;\n const name = entry.displayName || entry.agentId || \"-\";\n const row = [\n runId.padEnd(38),\n name.padEnd(nameCol),\n formatStatus(entry.status).padEnd(statusCol),\n formatTime(entry.createdAt),\n ].join(\" \");\n console.log(row);\n }\n\n if (result.pagination.hasMore) {\n console.log();\n console.log(\n chalk.dim(\n ` Showing ${result.data.length} of more results. Use --limit to adjust.`,\n ),\n );\n }\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n searchZeroLogs,\n type RunEvent,\n type LogsSearchResponse,\n} from \"../../../lib/api\";\nimport { parseTime } from \"../../../lib/utils/time-parser\";\nimport { parseEvent } from \"../../../lib/events/event-parser-factory\";\nimport { EventRenderer } from \"../../../lib/events/event-renderer\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { isUUID } from \"../../run/shared\";\n\nconst SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1000;\n\nexport interface LogsSearchCliOptions {\n afterContext?: string;\n beforeContext?: string;\n context?: string;\n agentId?: string;\n run?: string;\n since?: string;\n limit?: string;\n}\n\ninterface LogsSearchCommandOptions extends Omit<\n LogsSearchCliOptions,\n \"agentId\"\n> {\n agent?: string;\n}\n\nfunction renderEvent(event: RunEvent, renderer: EventRenderer): void {\n const eventData = event.eventData as Record<string, unknown>;\n const parsed = parseEvent(eventData);\n if (parsed) {\n parsed.timestamp = new Date(event.createdAt);\n renderer.render(parsed);\n }\n}\n\nfunction formatRunHeader(\n runId: string,\n agentName: string,\n timestamp: string,\n): string {\n const time = new Date(timestamp).toISOString().replace(/\\.\\d{3}Z$/, \"Z\");\n return `── Run ${runId} (${agentName}, ${time}) ──────────`;\n}\n\nfunction parseContextOptions(options: LogsSearchCliOptions): {\n before: number;\n after: number;\n} {\n const contextN = options.context ? parseInt(options.context, 10) : 0;\n const before = options.beforeContext\n ? parseInt(options.beforeContext, 10)\n : contextN;\n const after = options.afterContext\n ? parseInt(options.afterContext, 10)\n : contextN;\n\n if (isNaN(before) || before < 0 || before > 10) {\n throw new Error(\"--before-context must be between 0 and 10\");\n }\n if (isNaN(after) || after < 0 || after > 10) {\n throw new Error(\"--after-context must be between 0 and 10\");\n }\n\n return { before, after };\n}\n\nfunction parseLimit(value: string | undefined): number | undefined {\n if (!value) return undefined;\n const limit = parseInt(value, 10);\n if (isNaN(limit) || limit < 1 || limit > 50) {\n throw new Error(\"--limit must be between 1 and 50\");\n }\n return limit;\n}\n\nfunction renderResults(response: LogsSearchResponse): void {\n const grouped = new Map<\n string,\n { agentName: string; results: LogsSearchResponse[\"results\"] }\n >();\n for (const result of response.results) {\n const existing = grouped.get(result.runId);\n if (existing) {\n existing.results.push(result);\n } else {\n grouped.set(result.runId, {\n agentName: result.agentName,\n results: [result],\n });\n }\n }\n\n let isFirstGroup = true;\n for (const [runId, group] of grouped) {\n if (!isFirstGroup) {\n console.log();\n }\n isFirstGroup = false;\n\n const firstTimestamp = group.results[0]!.matchedEvent.createdAt;\n console.log(\n chalk.bold(formatRunHeader(runId, group.agentName, firstTimestamp)),\n );\n\n for (const result of group.results) {\n const renderer = new EventRenderer({\n showTimestamp: true,\n verbose: false,\n buffered: false,\n });\n\n for (const event of result.contextBefore) {\n renderEvent(event, renderer);\n }\n renderEvent(result.matchedEvent, renderer);\n for (const event of result.contextAfter) {\n renderEvent(event, renderer);\n }\n }\n }\n\n if (response.hasMore) {\n console.log();\n console.log(\n chalk.dim(\n ` Showing first ${response.results.length} matches. Use --limit to see more.`,\n ),\n );\n }\n}\n\nexport async function runLogsSearch(\n keyword: string,\n options: LogsSearchCliOptions,\n): Promise<void> {\n const { before, after } = parseContextOptions(options);\n\n if (options.run && !isUUID(options.run)) {\n console.error(\n chalk.red(`✗ Invalid run ID \"${options.run}\" — expected a UUID`),\n );\n console.error(chalk.dim(\" Run: zero logs list to find run IDs\"));\n process.exit(1);\n }\n\n const since = options.since\n ? parseTime(options.since)\n : Date.now() - SEVEN_DAYS_MS;\n const limit = parseLimit(options.limit);\n\n const response = await searchZeroLogs({\n keyword,\n agentId: options.agentId,\n runId: options.run,\n since,\n limit,\n before,\n after,\n });\n\n if (response.results.length === 0) {\n console.log(chalk.dim(\"No matches found\"));\n console.log(\n chalk.dim(\n \" Try a broader search with --since 30d or a different keyword\",\n ),\n );\n return;\n }\n\n renderResults(response);\n}\n\nexport const searchCommand = new Command()\n .name(\"search\")\n .description(\"Search agent events across runs\")\n .argument(\"<keyword>\", \"Search keyword\")\n .option(\"-A, --after-context <n>\", \"Show n events after each match\")\n .option(\"-B, --before-context <n>\", \"Show n events before each match\")\n .option(\"-C, --context <n>\", \"Show n events before and after each match\")\n .option(\"--agent <id>\", \"Filter by Zero agent ID\")\n .option(\"--run <id>\", \"Filter by specific run ID\")\n .option(\"--since <time>\", \"Search logs since (default: 7d)\")\n .option(\"--limit <n>\", \"Maximum number of matches (default: 20)\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero logs search \"error\"\n zero logs search \"timeout\" --agent 123e4567-e89b-12d3-a456-426614174000 -C 2\n zero logs search \"failed\" --since 30d --limit 50`,\n )\n .action(\n withErrorHandler(\n async (keyword: string, options: LogsSearchCommandOptions) => {\n const { agent, ...searchOptions } = options;\n await runLogsSearch(keyword, { ...searchOptions, agentId: agent });\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { runLogsSearch, type LogsSearchCliOptions } from \"../logs/search\";\nimport { searchZeroChat } from \"../../../lib/api\";\nimport type {\n ChatSearchMessage,\n ChatSearchResponse,\n} from \"@vm0/api-contracts/contracts/chat-threads\";\nimport { parseTime } from \"../../../lib/utils/time-parser\";\n\nconst SUPPORTED_SOURCES = [\"logs\", \"chat\", \"slack\"] as const;\ntype Source = (typeof SUPPORTED_SOURCES)[number];\n\nconst SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1000;\n\nexport const SEARCH_EXPLAINER = `\nAvailable sources:\n logs full agent event stream (tool calls, tokens, system events) from agent runs\n chat user/assistant text messages as shown in the web chat UI\n slack returns a recipe for calling the Slack API directly; requires the Slack connector\n\nUsage: zero search <query> --source <logs|chat|slack> [flags]\nRun 'zero search --help' for all flags.`;\n\nexport function buildSlackRecipe(query: string): string {\n const encoded = encodeURIComponent(query);\n return `The \\`slack\\` source does not call Slack from this CLI. Run the\nfollowing inside an agent sandbox that has $SLACK_TOKEN available:\n\n curl -H \"Authorization: Bearer $SLACK_TOKEN\" \\\\\n \"https://slack.com/api/search.messages?query=${encoded}\"\n\nIf you don't have $SLACK_TOKEN, check the connector status:\n zero connector status slack\n\nTo verify the token and network policy end-to-end:\n zero doctor check-connector --env-name SLACK_TOKEN\n\nSlack API docs: https://api.slack.com/methods/search.messages\n\nNote: CLI-local flags (--limit, --since, -A/-B/-C) are ignored for the\nslack source. Pass equivalents to Slack's API via count= / highlight=\nquery parameters instead.`;\n}\n\ninterface SearchOptions {\n source: string[];\n agent?: string;\n run?: string;\n since?: string;\n limit?: string;\n afterContext?: string;\n beforeContext?: string;\n context?: string;\n}\n\nfunction collectSource(value: string, previous: string[]): string[] {\n return [...previous, value];\n}\n\nfunction parseContextOptions(options: SearchOptions): {\n before: number;\n after: number;\n} {\n const contextN = options.context ? parseInt(options.context, 10) : 0;\n const before = options.beforeContext\n ? parseInt(options.beforeContext, 10)\n : contextN;\n const after = options.afterContext\n ? parseInt(options.afterContext, 10)\n : contextN;\n\n if (isNaN(before) || before < 0 || before > 10) {\n throw new Error(\"--before-context must be between 0 and 10\");\n }\n if (isNaN(after) || after < 0 || after > 10) {\n throw new Error(\"--after-context must be between 0 and 10\");\n }\n\n return { before, after };\n}\n\nfunction parseLimit(value: string | undefined): number | undefined {\n if (!value) return undefined;\n const limit = parseInt(value, 10);\n if (isNaN(limit) || limit < 1 || limit > 50) {\n throw new Error(\"--limit must be between 1 and 50\");\n }\n return limit;\n}\n\nasync function runLogsSource(\n query: string,\n options: SearchOptions,\n): Promise<void> {\n const logsOptions: LogsSearchCliOptions = {\n afterContext: options.afterContext,\n beforeContext: options.beforeContext,\n context: options.context,\n agentId: options.agent,\n run: options.run,\n since: options.since,\n limit: options.limit,\n };\n await runLogsSearch(query, logsOptions);\n}\n\nfunction formatTimestamp(iso: string): string {\n return new Date(iso).toISOString().replace(/\\.\\d{3}Z$/, \"Z\");\n}\n\nfunction renderChatMessage(msg: ChatSearchMessage, isMatch: boolean): void {\n const marker = isMatch ? chalk.yellow(\"▸\") : chalk.dim(\"·\");\n const header = `${marker} ${chalk.dim(msg.role)} ${chalk.dim(formatTimestamp(msg.createdAt))}`;\n console.log(header);\n console.log(isMatch ? msg.content : chalk.dim(msg.content));\n}\n\nfunction renderChatResults(response: ChatSearchResponse): void {\n let isFirst = true;\n for (const result of response.results) {\n if (!isFirst) console.log();\n isFirst = false;\n\n console.log(\n chalk.bold(\n `── Thread ${result.chatThreadId} (${result.agentName}) ──────────`,\n ),\n );\n for (const msg of result.contextBefore) {\n renderChatMessage(msg, false);\n }\n renderChatMessage(result.matchedMessage, true);\n for (const msg of result.contextAfter) {\n renderChatMessage(msg, false);\n }\n }\n\n if (response.hasMore) {\n console.log();\n console.log(\n chalk.dim(\n ` Showing first ${response.results.length} matches. Use --limit to see more.`,\n ),\n );\n }\n}\n\nasync function runChatSource(\n query: string,\n options: SearchOptions,\n): Promise<void> {\n if (options.run) {\n throw new Error(\"--run is not supported with --source chat\");\n }\n\n const { before, after } = parseContextOptions(options);\n const limit = parseLimit(options.limit);\n const since = options.since\n ? parseTime(options.since)\n : Date.now() - SEVEN_DAYS_MS;\n\n const response = await searchZeroChat({\n keyword: query,\n agentId: options.agent,\n since,\n limit,\n before,\n after,\n });\n\n if (response.results.length === 0) {\n console.log(chalk.dim(\"No matches found\"));\n console.log(\n chalk.dim(\n \" Try a broader search with --since 30d or a different keyword\",\n ),\n );\n return;\n }\n\n renderChatResults(response);\n}\n\nasync function runSlackSource(\n query: string,\n _options: SearchOptions,\n): Promise<void> {\n console.log(buildSlackRecipe(query));\n}\n\nexport const zeroSearchCommand = new Command()\n .name(\"search\")\n .description(\"Search logs, chat, or get a recipe for external sources\")\n .argument(\"<query>\", \"Search query\")\n .option(\n \"--source <type>\",\n \"Source to search: logs | chat | slack (pass once)\",\n collectSource,\n [] as string[],\n )\n .option(\"--agent <id>\", \"Filter by Zero agent ID\")\n .option(\"--run <id>\", \"Filter by run ID\")\n .option(\"--since <time>\", \"Time window (e.g., 7d, 2h)\")\n .option(\"--limit <n>\", \"Maximum number of matches\")\n .option(\"-A, --after-context <n>\", \"Show n items after each match\")\n .option(\"-B, --before-context <n>\", \"Show n items before each match\")\n .option(\"-C, --context <n>\", \"Show n items before and after each match\")\n .addHelpText(\"after\", SEARCH_EXPLAINER)\n .action(\n withErrorHandler(async (query: string, options: SearchOptions) => {\n const sources = options.source;\n\n if (sources.length === 0) {\n console.log(SEARCH_EXPLAINER);\n return;\n }\n\n if (sources.length > 1) {\n throw new Error(\"Only one --source is allowed.\");\n }\n\n const source = sources[0]!;\n if (!SUPPORTED_SOURCES.includes(source as Source)) {\n throw new Error(\n `Unknown --source \"${source}\". Expected one of: ${SUPPORTED_SOURCES.join(\", \")}`,\n );\n }\n\n switch (source as Source) {\n case \"logs\":\n await runLogsSource(query, options);\n return;\n case \"chat\":\n await runChatSource(query, options);\n return;\n case \"slack\":\n await runSlackSource(query, options);\n return;\n }\n }),\n );\n","import { Command } from \"commander\";\nimport { withErrorHandler } from \"../../lib/command\";\nimport {\n requestDeveloperSupportConsent,\n submitDeveloperSupport,\n} from \"../../lib/api\";\n\nexport const zeroDeveloperSupportCommand = new Command()\n .name(\"developer-support\")\n .description(\"Submit a diagnostic report to the dev team\")\n .requiredOption(\"--title <text>\", \"Issue title\")\n .requiredOption(\"--description <text>\", \"Diagnostic description\")\n .option(\"--consent-code <code>\", \"User-provided verification code\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Step 1 — Get consent code:\n zero developer-support --title \"GitHub 403 error\" --description \"Connector connected but API returns 403\"\n\n Step 2 — Submit with code:\n zero developer-support --title \"GitHub 403 error\" --description \"Connector connected but API returns 403\" --consent-code A7X3\n\nNotes:\n - The consent code must be provided by the user to confirm sharing their conversation\n - The dev team will receive a diagnostic bundle with conversation, environment, and connector info`,\n )\n .action(\n withErrorHandler(\n async (options: {\n title: string;\n description: string;\n consentCode?: string;\n }) => {\n if (!options.consentCode) {\n const { consentCode } = await requestDeveloperSupportConsent({\n title: options.title,\n description: options.description,\n });\n console.log(\n \"Consent required to share chat history with developers.\",\n );\n console.log(`Code: ${consentCode}`);\n console.log(\"Ask the user to confirm by providing this code.\");\n } else {\n const { reference } = await submitDeveloperSupport({\n title: options.title,\n description: options.description,\n consentCode: options.consentCode,\n });\n console.log(\"Developer support request submitted successfully.\");\n console.log(`Reference: ${reference}`);\n }\n },\n ),\n );\n","import { mkdir, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { Command } from \"commander\";\nimport type {\n ComputerUseCommandResponse,\n ComputerUseReadCommandKind,\n ComputerUseWriteCommandKind,\n} from \"@vm0/api-contracts/contracts/zero-computer-use\";\nimport {\n createComputerUseReadCommand,\n createComputerUseWriteCommand,\n fetchComputerUseScreenshot,\n getComputerUseCommand,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command/with-error-handler\";\n\ninterface ComputerUseCommandOptions {\n readonly timeout?: string;\n}\n\ninterface ComputerUseAppOptions extends ComputerUseCommandOptions {\n readonly app: string;\n}\n\ninterface ComputerUseClickOptions extends ComputerUseAppOptions {\n readonly snapshotId?: string;\n readonly element?: string;\n readonly elementIndex?: string;\n readonly x?: string;\n readonly y?: string;\n readonly button?: \"left\" | \"right\" | \"middle\";\n readonly clickCount?: string;\n}\n\ninterface ComputerUseScrollOptions extends ComputerUseAppOptions {\n readonly snapshotId?: string;\n readonly element?: string;\n readonly elementIndex?: string;\n readonly direction: \"up\" | \"down\" | \"left\" | \"right\";\n readonly pages?: string;\n}\n\ninterface ComputerUseSetValueOptions extends ComputerUseAppOptions {\n readonly snapshotId?: string;\n readonly element?: string;\n readonly elementIndex?: string;\n readonly value: string;\n}\n\ninterface ComputerUsePerformActionOptions extends ComputerUseAppOptions {\n readonly snapshotId?: string;\n readonly element?: string;\n readonly elementIndex?: string;\n readonly action: string;\n}\n\ninterface ComputerUseTypeTextOptions extends ComputerUseAppOptions {\n readonly snapshotId?: string;\n readonly text: string;\n}\n\ninterface ComputerUsePressKeyOptions extends ComputerUseAppOptions {\n readonly snapshotId?: string;\n readonly key: string;\n}\n\nconst COMPUTER_USE_OUTPUT_DIR = \"/tmp/vm0/computer-use\";\nconst DATA_URL_PATTERN = /^data:([^;,]+);base64,(.*)$/s;\nconst COMPUTER_USE_HELP_TEXT = `\nWorkflow:\n 1. Start the Zero Desktop app and make sure Computer Use is online.\n 2. Run \"zero computer-use list-apps\" to find the target app's bundleId.\n --app accepts a bundle id only (e.g. com.google.Chrome); the name is for\n display. Apps listed without a bundleId cannot be targeted.\n 3. Run \"zero computer-use get-app-state --app <bundleId>\" to get a screenshot,\n snapshotId, visible element indexes, and accessibility state.\n 4. Prefer element actions with --snapshot-id and --element-index. Use --x/--y\n only when the target is visible in the returned screenshot but has no useful\n accessibility element.\n 5. Read the JSON result. Screenshot and App State data are saved under\n /tmp/vm0/computer-use and replaced with local file paths in CLI output.\n Files are named from app and snapshotId; rerunning the same snapshot\n overwrites the same files.\n\nNotes:\n Write commands are sent to the connected Desktop host and may wait for local\n approval before they run. Coordinate fallbacks use screenshot coordinates from\n get-app-state; pass the matching --snapshot-id when acting on a prior snapshot.\n type-text sends literal keyboard input to the target app's current focus. It\n first verifies the focused element is editable and fails with\n element_not_editable when it is not (for example a focused table or list), so\n click into a text field before typing. Use set-value when you need\n deterministic accessibility value assignment.\n press-key accepts xdotool-style names such as shift+semicolon, Control_L+J,\n ctrl+alt+n, and BackSpace, plus existing macOS-style forms such as Command+L.\n type-text and press-key accept the same --snapshot-id as the element actions:\n pass it to deliver keyboard input to that snapshot's window. Without it, the\n most relevant window for the app is picked, which is ambiguous for multi-window\n apps.\n\nExamples:\n List available apps:\n zero computer-use list-apps\n\n Inspect Safari state:\n zero computer-use get-app-state --app com.apple.Safari\n\n Click element index 7 from snapshot desktop_abc:\n zero computer-use click --app com.apple.Safari --snapshot-id desktop_abc --element-index 7\n\n Click screenshot coordinate (320, 240) from snapshot desktop_abc:\n zero computer-use click --app com.apple.Safari --snapshot-id desktop_abc --x 320 --y 240\n\n Type text into the snapshot desktop_abc window in Safari:\n zero computer-use type-text --app com.apple.Safari --snapshot-id desktop_abc --text \"Hello\"\n\n Press a keyboard shortcut in the snapshot desktop_abc window:\n zero computer-use press-key --app com.apple.Safari --snapshot-id desktop_abc --key shift+semicolon\n\n Open an app without activating the current foreground app:\n zero computer-use open-app --app com.culturedcode.ThingsMac`;\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n\nfunction parseTimeoutSeconds(value: string | undefined): number {\n if (!value) return 30;\n const seconds = Number.parseInt(value, 10);\n if (!Number.isFinite(seconds) || seconds <= 0) {\n throw new Error(\"Timeout must be a positive number of seconds\");\n }\n return seconds;\n}\n\nfunction parseOptionalNonNegativeInteger(\n value: string | undefined,\n label: string,\n): number | undefined {\n if (value === undefined) return undefined;\n const parsed = Number.parseInt(value, 10);\n if (!Number.isFinite(parsed) || parsed < 0) {\n throw new Error(`${label} must be a non-negative integer`);\n }\n return parsed;\n}\n\nfunction parsePositiveInteger(\n value: string | undefined,\n label: string,\n): number {\n if (value === undefined) {\n throw new Error(`${label} is required`);\n }\n const parsed = Number.parseInt(value, 10);\n if (!Number.isFinite(parsed) || parsed <= 0) {\n throw new Error(`${label} must be a positive integer`);\n }\n return parsed;\n}\n\nfunction parsePositiveNumber(\n value: string | undefined,\n label: string,\n): number | undefined {\n if (value === undefined) return undefined;\n const parsed = Number.parseFloat(value);\n if (!Number.isFinite(parsed) || parsed <= 0) {\n throw new Error(`${label} must be a positive number`);\n }\n return parsed;\n}\n\nfunction parseMouseButton(\n value: string | undefined,\n): \"left\" | \"right\" | \"middle\" {\n if (value === \"left\" || value === \"right\" || value === \"middle\") {\n return value;\n }\n throw new Error(\"button must be left, right, or middle\");\n}\n\nfunction elementTargetPayload(options: {\n readonly element?: string;\n readonly elementIndex?: string;\n}): { readonly elementId?: string; readonly elementIndex?: number } {\n const elementIndex = parseOptionalNonNegativeInteger(\n options.elementIndex,\n \"element-index\",\n );\n if (!options.element && elementIndex === undefined) {\n throw new Error(\"element or element-index is required\");\n }\n return {\n ...(options.element ? { elementId: options.element } : {}),\n ...(elementIndex !== undefined ? { elementIndex } : {}),\n };\n}\n\nfunction sanitizeFilenamePart(value: unknown, fallback: string): string {\n if (typeof value !== \"string\") {\n return fallback;\n }\n const sanitized = value\n .trim()\n .replace(/[^A-Za-z0-9._-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 80);\n return sanitized.length > 0 ? sanitized : fallback;\n}\n\nfunction extensionForMimeType(mimeType: string): string {\n if (mimeType === \"image/png\") {\n return \"png\";\n }\n if (mimeType === \"image/jpeg\") {\n return \"jpg\";\n }\n if (mimeType === \"image/webp\") {\n return \"webp\";\n }\n const suffix = mimeType.startsWith(\"image/\") ? mimeType.slice(6) : \"bin\";\n return sanitizeFilenamePart(suffix, \"bin\").toLowerCase();\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction stringField(\n value: Record<string, unknown>,\n key: string,\n): string | undefined {\n const field = value[key];\n return typeof field === \"string\" ? field : undefined;\n}\n\nasync function writeScreenshotDataUrl(\n result: Record<string, unknown>,\n dataUrl: string,\n): Promise<string | null> {\n const match = DATA_URL_PATTERN.exec(dataUrl);\n if (!match) {\n return null;\n }\n\n const mimeType = match[1] ?? \"\";\n if (!mimeType.startsWith(\"image/\")) {\n throw new Error(`Unsupported screenshot MIME type: ${mimeType}`);\n }\n\n const base64Data = match[2] ?? \"\";\n const appName = sanitizeFilenamePart(result.app, \"app\");\n const snapshotId = sanitizeFilenamePart(result.snapshotId, \"snapshot\");\n const outputPath = join(\n COMPUTER_USE_OUTPUT_DIR,\n `${appName}-${snapshotId}.${extensionForMimeType(mimeType)}`,\n );\n\n await mkdir(COMPUTER_USE_OUTPUT_DIR, { recursive: true });\n await writeFile(outputPath, Buffer.from(base64Data, \"base64\"));\n return outputPath;\n}\n\nfunction screenshotPointerType(value: unknown): \"s3\" | \"expired\" | null {\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n const type = (value as { readonly type?: unknown }).type;\n return type === \"s3\" || type === \"expired\" ? type : null;\n}\n\nasync function writeScreenshotBytes(\n result: Record<string, unknown>,\n buffer: Buffer,\n mimeType: string,\n): Promise<string> {\n const appName = sanitizeFilenamePart(result.app, \"app\");\n const snapshotId = sanitizeFilenamePart(result.snapshotId, \"snapshot\");\n const outputPath = join(\n COMPUTER_USE_OUTPUT_DIR,\n `${appName}-${snapshotId}.${extensionForMimeType(mimeType)}`,\n );\n\n await mkdir(COMPUTER_USE_OUTPUT_DIR, { recursive: true });\n await writeFile(outputPath, buffer);\n return outputPath;\n}\n\nasync function writeAppStateText(\n result: Record<string, unknown>,\n appState: string,\n): Promise<string> {\n const appName = sanitizeFilenamePart(result.app, \"app\");\n const snapshotId = sanitizeFilenamePart(result.snapshotId, \"snapshot\");\n const outputPath = join(\n COMPUTER_USE_OUTPUT_DIR,\n `${appName}-${snapshotId}.appState.txt`,\n );\n\n await mkdir(COMPUTER_USE_OUTPUT_DIR, { recursive: true });\n await writeFile(outputPath, appState, \"utf8\");\n return outputPath;\n}\n\nfunction compactActionResult(\n action: Record<string, unknown>,\n): Record<string, unknown> {\n const compact: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(action)) {\n if (\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\"\n ) {\n compact[key] = value;\n }\n }\n return compact;\n}\n\nexport async function formatComputerUseResultForConsole(\n result: Record<string, unknown>,\n commandId: string,\n): Promise<string> {\n const printable: Record<string, unknown> = { status: \"succeeded\" };\n const apps = result.apps;\n if (Array.isArray(apps)) {\n printable.apps = apps;\n }\n const snapshotId = stringField(result, \"snapshotId\");\n if (snapshotId) {\n printable.snapshotId = snapshotId;\n }\n const appState = stringField(result, \"appState\");\n if (appState) {\n printable.appState = await writeAppStateText(result, appState);\n }\n const screenshot = result.screenshot;\n if (typeof screenshot === \"string\") {\n const screenshotPath = await writeScreenshotDataUrl(result, screenshot);\n printable.screenshot = screenshotPath ?? screenshot;\n } else {\n const pointerType = screenshotPointerType(screenshot);\n if (pointerType === \"s3\") {\n const { buffer, mimeType } = await fetchComputerUseScreenshot(commandId);\n printable.screenshot = await writeScreenshotBytes(\n result,\n buffer,\n mimeType,\n );\n } else if (pointerType === \"expired\") {\n printable.screenshot = \"[screenshot expired]\";\n }\n }\n const action = result.action;\n if (isRecord(action)) {\n printable.action = compactActionResult(action);\n }\n return JSON.stringify(printable, null, 2);\n}\n\nasync function commandOutputText(\n command: ComputerUseCommandResponse,\n): Promise<string> {\n if (!command.result) {\n return \"\";\n }\n return await formatComputerUseResultForConsole(command.result, command.id);\n}\n\nasync function waitForCommand(\n commandId: string,\n timeoutSeconds: number,\n): Promise<void> {\n const deadline = Date.now() + timeoutSeconds * 1000;\n while (Date.now() <= deadline) {\n const command = await getComputerUseCommand(commandId);\n if (\n command.status === \"pending_approval\" ||\n command.status === \"queued\" ||\n command.status === \"running\"\n ) {\n if (process.stdout.isTTY) {\n process.stdout.write(\".\");\n }\n await sleep(1_000);\n continue;\n }\n\n if (process.stdout.isTTY) {\n process.stdout.write(\"\\n\");\n }\n\n if (command.status === \"failed\") {\n throw new Error(\n command.error\n ? `${command.error.code}: ${command.error.message}`\n : \"Computer-use command failed\",\n );\n }\n\n const text = await commandOutputText(command);\n if (text) {\n console.log(text);\n }\n return;\n }\n\n throw new Error(`Computer-use command timed out: ${commandId}`);\n}\n\nasync function runReadCommand(\n kind: ComputerUseReadCommandKind,\n options: ComputerUseCommandOptions,\n payload: { readonly app?: string } = {},\n): Promise<void> {\n const timeoutSeconds = parseTimeoutSeconds(options.timeout);\n const created = await createComputerUseReadCommand({\n kind,\n timeoutMs: timeoutSeconds * 1000,\n ...payload,\n });\n await waitForCommand(created.commandId, timeoutSeconds);\n}\n\nasync function runWriteCommand(\n kind: ComputerUseWriteCommandKind,\n options: ComputerUseCommandOptions,\n payload: {\n readonly app: string;\n readonly snapshotId?: string;\n readonly elementId?: string;\n readonly elementIndex?: number;\n readonly x?: number;\n readonly y?: number;\n readonly button?: \"left\" | \"right\" | \"middle\";\n readonly clickCount?: number;\n readonly direction?: \"up\" | \"down\" | \"left\" | \"right\";\n readonly pages?: number;\n readonly value?: string;\n readonly text?: string;\n readonly key?: string;\n readonly action?: string;\n },\n): Promise<void> {\n const timeoutSeconds = parseTimeoutSeconds(options.timeout);\n const created = await createComputerUseWriteCommand({\n kind,\n timeoutMs: timeoutSeconds * 1000,\n ...payload,\n });\n await waitForCommand(created.commandId, timeoutSeconds);\n}\n\nfunction addTargetOptions(command: Command): Command {\n return command.option(\"--timeout <seconds>\", \"Maximum time to wait\", \"30\");\n}\n\nfunction appOption(command: Command): Command {\n return command.requiredOption(\n \"--app <bundleId>\",\n \"Target app bundle id (e.g. com.google.Chrome); run list-apps to find it\",\n );\n}\n\nconst listAppsCommand = addTargetOptions(\n new Command()\n .name(\"list-apps\")\n .description(\"List apps available to the Desktop Computer Use host\")\n .action(\n withErrorHandler(async (options: ComputerUseCommandOptions) => {\n await runReadCommand(\"apps.list\", options);\n }),\n ),\n);\n\nconst getAppStateCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"get-app-state\")\n .description(\n \"Get screenshot and accessibility state without activating an app\",\n )\n .action(\n withErrorHandler(async (options: ComputerUseAppOptions) => {\n await runReadCommand(\"app.state\", options, { app: options.app });\n }),\n ),\n ),\n);\n\nconst clickCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"click\")\n .description(\n \"Click an accessibility element or background screenshot coordinate\",\n )\n .option(\"--snapshot-id <id>\", \"Snapshot id returned by get-app-state\")\n .option(\"--element <id>\", \"Element id from get-app-state\")\n .option(\"--element-index <index>\", \"Element index from get-app-state\")\n .option(\"--x <points>\", \"Screenshot x coordinate fallback\")\n .option(\"--y <points>\", \"Screenshot y coordinate fallback\")\n .option(\"--button <button>\", \"Mouse button\", \"left\")\n .option(\"--click-count <count>\", \"Number of clicks\", \"1\")\n .action(\n withErrorHandler(async (options: ComputerUseClickOptions) => {\n const x = parseOptionalNonNegativeInteger(options.x, \"x\");\n const y = parseOptionalNonNegativeInteger(options.y, \"y\");\n const elementIndex = parseOptionalNonNegativeInteger(\n options.elementIndex,\n \"element-index\",\n );\n await runWriteCommand(\"element.click\", options, {\n app: options.app,\n ...(options.snapshotId ? { snapshotId: options.snapshotId } : {}),\n ...(options.element ? { elementId: options.element } : {}),\n ...(elementIndex !== undefined ? { elementIndex } : {}),\n ...(x !== undefined ? { x } : {}),\n ...(y !== undefined ? { y } : {}),\n button: parseMouseButton(options.button),\n clickCount: parsePositiveInteger(options.clickCount, \"click-count\"),\n });\n }),\n ),\n ),\n);\n\nconst scrollCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"scroll\")\n .description(\"Scroll an accessibility element\")\n .option(\"--snapshot-id <id>\", \"Snapshot id returned by get-app-state\")\n .option(\"--element <id>\", \"Element id from get-app-state\")\n .option(\"--element-index <index>\", \"Element index from get-app-state\")\n .requiredOption(\n \"--direction <direction>\",\n \"Scroll direction: up, down, left, or right\",\n )\n .option(\"--pages <count>\", \"Number of pages to scroll\", \"1\")\n .action(\n withErrorHandler(async (options: ComputerUseScrollOptions) => {\n await runWriteCommand(\"element.scroll\", options, {\n app: options.app,\n ...(options.snapshotId ? { snapshotId: options.snapshotId } : {}),\n ...elementTargetPayload(options),\n direction: options.direction,\n pages: parsePositiveNumber(options.pages, \"pages\"),\n });\n }),\n ),\n ),\n);\n\nconst setValueCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"set-value\")\n .description(\"Set the value of a settable accessibility element\")\n .option(\"--snapshot-id <id>\", \"Snapshot id returned by get-app-state\")\n .option(\"--element <id>\", \"Element id from get-app-state\")\n .option(\"--element-index <index>\", \"Element index from get-app-state\")\n .requiredOption(\"--value <text>\", \"Value to assign\")\n .action(\n withErrorHandler(async (options: ComputerUseSetValueOptions) => {\n await runWriteCommand(\"element.set_value\", options, {\n app: options.app,\n ...(options.snapshotId ? { snapshotId: options.snapshotId } : {}),\n ...elementTargetPayload(options),\n value: options.value,\n });\n }),\n ),\n ),\n);\n\nconst typeTextCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"type-text\")\n .description(\"Type literal keyboard input into the target app\")\n .option(\"--snapshot-id <id>\", \"Snapshot id returned by get-app-state\")\n .requiredOption(\"--text <text>\", \"Text to type\")\n .action(\n withErrorHandler(async (options: ComputerUseTypeTextOptions) => {\n await runWriteCommand(\"keyboard.type_text\", options, {\n app: options.app,\n ...(options.snapshotId ? { snapshotId: options.snapshotId } : {}),\n text: options.text,\n });\n }),\n ),\n ),\n);\n\nconst pressKeyCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"press-key\")\n .description(\"Send a background key or key combination to the target app\")\n .option(\"--snapshot-id <id>\", \"Snapshot id returned by get-app-state\")\n .requiredOption(\n \"--key <key>\",\n \"Key or xdotool-style combination, for example Command+K, shift+semicolon, or Control_L+J\",\n )\n .action(\n withErrorHandler(async (options: ComputerUsePressKeyOptions) => {\n await runWriteCommand(\"keyboard.press_key\", options, {\n app: options.app,\n ...(options.snapshotId ? { snapshotId: options.snapshotId } : {}),\n key: options.key,\n });\n }),\n ),\n ),\n);\n\nconst performActionCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"perform-action\")\n .description(\"Invoke a secondary accessibility action\")\n .option(\"--snapshot-id <id>\", \"Snapshot id returned by get-app-state\")\n .option(\"--element <id>\", \"Element id from get-app-state\")\n .option(\"--element-index <index>\", \"Element index from get-app-state\")\n .requiredOption(\"--action <name>\", \"Accessibility action name\")\n .action(\n withErrorHandler(async (options: ComputerUsePerformActionOptions) => {\n await runWriteCommand(\"element.perform_action\", options, {\n app: options.app,\n ...(options.snapshotId ? { snapshotId: options.snapshotId } : {}),\n ...elementTargetPayload(options),\n action: options.action,\n });\n }),\n ),\n ),\n);\n\nconst openAppCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"open-app\")\n .description(\"Open an app on the Desktop host without activating it\")\n .action(\n withErrorHandler(async (options: ComputerUseAppOptions) => {\n await runWriteCommand(\"app.open\", options, { app: options.app });\n }),\n ),\n ),\n);\n\nexport const zeroComputerUseCommand = new Command()\n .name(\"computer-use\")\n .description(\"Desktop app computer use through Zero CLI\")\n .addHelpText(\"after\", COMPUTER_USE_HELP_TEXT)\n .addCommand(listAppsCommand)\n .addCommand(getAppStateCommand)\n .addCommand(clickCommand)\n .addCommand(scrollCommand)\n .addCommand(setValueCommand)\n .addCommand(typeTextCommand)\n .addCommand(pressKeyCommand)\n .addCommand(performActionCommand)\n .addCommand(openAppCommand);\n","import { Command } from \"commander\";\nimport { imageCommand } from \"./image\";\nimport {\n dashboardDesignCommand,\n docsDesignCommand,\n mobileAppDesignCommand,\n posterCommand,\n reportCommand,\n} from \"./artifacts\";\nimport { presentationCommand } from \"./presentation\";\nimport { spriteCommand } from \"./sprite\";\nimport { videoCommand } from \"./video\";\nimport { websiteCommand } from \"./website\";\nimport { voiceCommand } from \"./voice\";\nimport { createListerOnlyCommand } from \"./lister-only\";\n\nconst musicCommand = createListerOnlyCommand({\n name: \"music\",\n generationType: \"music\",\n description: \"List connectors that provide music generation\",\n});\n\nconst textCommand = createListerOnlyCommand({\n name: \"text\",\n generationType: \"text\",\n description: \"List connectors that provide text generation\",\n});\n\nconst codeCommand = createListerOnlyCommand({\n name: \"code\",\n generationType: \"code\",\n description: \"List connectors that provide code generation\",\n});\n\nconst documentCommand = createListerOnlyCommand({\n name: \"document\",\n generationType: \"document\",\n description: \"List connectors that provide document generation\",\n});\n\nfunction buildGenerateHelpText(): string {\n const examples = [\n ' Generate image: zero generate image --prompt \"A watercolor fox\"',\n ' Generate deck: zero generate presentation --prompt \"A product roadmap\"',\n ' Generate report: zero generate report --prompt \"A Q2 usage report\"',\n ' Generate docs: zero generate docs-design --prompt \"A setup guide\"',\n ' Generate video: zero generate video --prompt \"A cinematic city shot\"',\n ' Generate site: zero generate website --prompt \"A launch site\"',\n ' Generate sprite: zero generate sprite --prompt \"A slime monster idle loop\"',\n ' Generate speech: zero generate voice --prompt \"Hello\"',\n \" Show music choices: zero generate music\",\n \"\",\n \" Show image choices: zero generate image\",\n \" Show report choices: zero generate report\",\n \" Use a connector: zero generate video --provider heygen\",\n \" Force built-in: zero generate image --provider built-in --model gpt-image-1.5 --prompt ...\",\n ];\n\n return `\\nExamples:\\n${examples.join(\"\\n\")}\\n\\nNotes:\\n - Run \"zero generate <type>\" with no --prompt to list generation choices for that type.\n - Media and connector-backed generation types may expose --provider for vm0 or connector execution guidance.\n - HTML artifact types use registry-backed --design-system and --template selection.`;\n}\n\nexport const generateCommand = new Command()\n .name(\"generate\")\n .description(\n \"Generate assets via vm0's built-in pipelines or get connector skill-invocation guidance\",\n )\n .addCommand(imageCommand)\n .addCommand(presentationCommand)\n .addCommand(reportCommand)\n .addCommand(docsDesignCommand)\n .addCommand(posterCommand)\n .addCommand(dashboardDesignCommand)\n .addCommand(mobileAppDesignCommand)\n .addCommand(videoCommand)\n .addCommand(websiteCommand)\n .addCommand(spriteCommand)\n .addCommand(voiceCommand)\n .addCommand(musicCommand)\n .addCommand(textCommand)\n .addCommand(codeCommand)\n .addCommand(documentCommand)\n .addHelpText(\"after\", buildGenerateHelpText);\n","import { createImageGenerateCommand } from \"../shared/image-generate\";\n\nexport const imageCommand = createImageGenerateCommand({\n name: \"image\",\n generationType: \"image\",\n usageCommand: \"zero generate image\",\n examples: ` Styled image: zero generate image --style vm0:image-style:notion-illustration --prompt \"A product manager mapping a launch plan\"\n Skip style: zero generate image --skip-style --prompt \"A watercolor fox\"\n Pipe prompt: cat prompt.txt | zero generate image --skip-style\n GPT Image model: zero generate image --skip-style --model gpt-image-1.5 --prompt \"A poster\" --size 1024x1536 --quality high\n Flux model: zero generate image --skip-style --model flux-pro-1.1 --prompt \"A product hero shot\" --seed 42\n Nano Banana 2: zero generate image --skip-style --model nano-banana-2 --prompt \"A crisp launch poster with readable typography\"\n Image-to-image: zero generate image --skip-style --model flux-pro-1.1 --image-url https://example.com/mockup.png --prompt \"Turn this mockup into a polished product shot\"\n List providers: zero generate image\n Use a connector: zero generate image --provider replicate`,\n});\n","import { Command, InvalidArgumentError } from \"commander\";\nimport chalk from \"chalk\";\nimport { generateWebImage } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { createStyledImageAuthoringPacket } from \"./image-style-authoring\";\nimport { findImageStyle, listImageStyles } from \"./resource-registry\";\nimport { formatRegistryListing } from \"./resource-listing\";\nimport { dispatchGenerate } from \"../generate/lib/dispatch\";\nimport type { GenerationType } from \"../generate/lib/lister\";\n\ninterface ImageOptions {\n prompt?: string;\n provider?: string;\n model: string;\n size: string;\n quality: string;\n background: string;\n format: string;\n compression?: string;\n moderation: string;\n seed?: number;\n safetyTolerance: string;\n enhancePrompt?: boolean;\n imageUrl: string[];\n maskImageUrl?: string;\n inputFidelity?: string;\n imagePromptStrength?: string;\n style?: string;\n skipStyle?: boolean;\n all?: boolean;\n}\n\ninterface ImageGenerateCommandConfig {\n name: string;\n generationType: GenerationType;\n usageCommand: string;\n examples: string;\n}\n\nfunction requireStyleError(usageCommand: string): Error {\n const styles = listImageStyles();\n const message = [\n \"--style <id> or --skip-style is required\",\n \"\",\n \"Available styles:\",\n formatRegistryListing(styles, \"image styles\"),\n \"\",\n `Examples:`,\n ` ${usageCommand} --style ${styles[0]?.id ?? \"<style-id>\"} --prompt \"...\"`,\n ` ${usageCommand} --skip-style --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nfunction unknownStyleError(id: string, usageCommand: string): Error {\n const styles = listImageStyles();\n const message = [\n `Unknown image style: ${id}`,\n \"\",\n \"Available styles:\",\n formatRegistryListing(styles, \"image styles\"),\n \"\",\n `Example:`,\n ` ${usageCommand} --style ${styles[0]?.id ?? \"<style-id>\"} --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nfunction parseCompression(value: string | undefined): number | undefined {\n if (value === undefined) {\n return undefined;\n }\n\n const compression = Number(value);\n if (!Number.isInteger(compression) || compression < 0 || compression > 100) {\n throw new Error(\"--compression must be an integer from 0 to 100\");\n }\n\n return compression;\n}\n\nfunction parseSeed(value: string): number {\n const seed = Number(value);\n if (!Number.isInteger(seed) || seed < 0 || !Number.isSafeInteger(seed)) {\n throw new InvalidArgumentError(\"seed must be a non-negative safe integer\");\n }\n return seed;\n}\n\nfunction collectString(value: string, previous: string[]): string[] {\n return [...previous, value];\n}\n\nfunction parseInputFidelity(value: string | undefined): string | undefined {\n if (value === undefined) {\n return undefined;\n }\n if (value !== \"low\" && value !== \"high\") {\n throw new Error(\"--input-fidelity must be low or high\");\n }\n return value;\n}\n\nfunction parseImagePromptStrength(\n value: string | undefined,\n): number | undefined {\n if (value === undefined) {\n return undefined;\n }\n const strength = Number(value);\n if (!Number.isFinite(strength) || strength < 0 || strength > 1) {\n throw new Error(\"--image-prompt-strength must be a number from 0 to 1\");\n }\n return strength;\n}\n\nexport function createImageGenerateCommand(\n config: ImageGenerateCommandConfig,\n): Command {\n return new Command()\n .name(config.name)\n .description(\"Generate a billed image file from a prompt\")\n .option(\"--prompt <text>\", \"Image prompt; can also be piped via stdin\")\n .option(\n \"--provider <name>\",\n \"Provider: 'built-in' to run vm0's pipeline, or a connector name to get its skill-invocation guidance\",\n )\n .option(\n \"--all\",\n \"When listing providers (no --prompt given), include unavailable or not-yet-authorized connectors\",\n )\n .option(\n \"--model <model>\",\n \"Model: gpt-image-1 (default), gpt-image-2, gpt-image-1.5, gpt-image-1-mini, flux-pro-1.1, flux-pro-1.1-ultra, qwen-image, seedream4, or nano-banana-2\",\n \"gpt-image-1\",\n )\n .option(\n \"--size <size>\",\n \"Image size: auto or WIDTHxHEIGHT; support varies by model\",\n \"1024x1024\",\n )\n .option(\n \"--quality <quality>\",\n \"Image quality: low, medium, high, or auto\",\n \"medium\",\n )\n .option(\n \"--background <background>\",\n \"Background: auto, opaque, or transparent when supported\",\n \"auto\",\n )\n .option(\"--format <format>\", \"Output format: png, webp, or jpeg\", \"png\")\n .option(\"--compression <0-100>\", \"Output compression for jpeg/webp only\")\n .option(\n \"--moderation <moderation>\",\n \"Moderation strictness: auto or low\",\n \"auto\",\n )\n .option(\"--seed <integer>\", \"Deterministic seed for fal models\", parseSeed)\n .option(\"--safety-tolerance <level>\", \"fal safety tolerance: 1-6\", \"4\")\n .option(\"--enhance-prompt\", \"Enable fal prompt enhancement when supported\")\n .option(\n \"--image-url <url>\",\n \"Source/mockup image URL for image-to-image; repeat for multi-image edit models\",\n collectString,\n [],\n )\n .option(\n \"--mask-image-url <url>\",\n \"Mask image URL for supported edit models\",\n )\n .option(\n \"--input-fidelity <low|high>\",\n \"Source-image fidelity for GPT edit models\",\n )\n .option(\n \"--image-prompt-strength <0-1>\",\n \"Reference strength override for Flux Redux\",\n )\n .option(\n \"--style <id>\",\n \"Image style id from the registry (see Image Styles below)\",\n )\n .option(\n \"--skip-style\",\n \"Opt out of styled image generation for this invocation\",\n )\n .addHelpText(\"after\", () => {\n const styles = listImageStyles();\n return `\nExamples:\n${config.examples}\n\nOutput:\n Prints the generated /f/ image file URL and metadata. With --style <id>,\n prints a source-selection packet for the current agent\n with the selected style locked in.\n\nNotes:\n - Authenticates via ZERO_TOKEN (requires file:write capability)\n - Charges org credits after successful image generation\n - Uses fal.ai for all image model execution\n\nModels:\n - fal.ai: gpt-image-1 (default), gpt-image-2, gpt-image-1.5,\n gpt-image-1-mini, flux-pro-1.1, flux-pro-1.1-ultra, qwen-image,\n seedream4, nano-banana-2.\n GPT Image models bill by fal output image quality and size.\n Other fal generations bill by output image or rounded-up output\n megapixel, depending on the model.\n\nOptions:\n - Prompt: required, up to 32,000 characters; stdin is supported.\n - Style: required. Pass --style <id> to generate in a registered style\n or --skip-style to bypass styled generation entirely.\n - Size: gpt-image-2 accepts auto or WIDTHxHEIGHT. Popular sizes include\n 1024x1024,\n 1536x1024, 1024x1536, 2048x2048, 2048x1152, 3840x2160,\n and 2160x3840. Custom sizes must have edges <= 3840px, both\n edges divisible by 16, long:short ratio <= 3:1, and total pixels\n between 655,360 and 8,294,400. gpt-image-1.5, gpt-image-1, and\n gpt-image-1-mini use auto, 1024x1024, 1536x1024, or 1024x1536.\n - Quality: low, medium, high, or auto. Low is fastest for drafts.\n - Background: auto, opaque, or transparent when supported. gpt-image-2,\n Flux, Qwen, and Seedream do not support transparent backgrounds.\n - Format: png, jpeg, or webp for GPT Image and Nano Banana 2 models; png or\n jpeg for the other fal models.\n - fal-only controls: --seed and --safety-tolerance for supported fal models;\n --enhance-prompt for flux-pro-1.1. --compression and --moderation low are\n not supported on the fal-backed image path.\n - Image-to-image: pass --image-url to use the model's fal edit/redux endpoint.\n Nano Banana 2 accepts up to 14 source images. Flux Redux accepts\n --image-prompt-strength to override the provider default; GPT edit models\n accept --input-fidelity and supported models accept --mask-image-url.\n\nImage Styles:\n${formatRegistryListing(styles, \"image styles\")}`;\n })\n .action(\n withErrorHandler(async (options: ImageOptions, command: Command) => {\n const dispatch = await dispatchGenerate({\n generationType: config.generationType,\n provider: options.provider,\n prompt: options.prompt,\n all: options.all,\n });\n if (dispatch.outcome === \"handled\") return;\n const prompt = dispatch.prompt;\n\n if (options.style && options.skipStyle) {\n throw new Error(\"--style and --skip-style cannot be combined\");\n }\n if (!options.style && !options.skipStyle) {\n throw requireStyleError(config.usageCommand);\n }\n if (options.style) {\n const style = findImageStyle(options.style);\n if (!style) {\n throw unknownStyleError(options.style, config.usageCommand);\n }\n\n const packet = createStyledImageAuthoringPacket({\n prompt,\n style,\n details: [\n `Model preference if direct image generation is used: ${options.model}`,\n `Requested size: ${options.size}`,\n `Requested quality: ${options.quality}`,\n `Requested background: ${options.background}`,\n `Requested format: ${options.format}`,\n `Source image URLs: ${\n options.imageUrl.length > 0\n ? options.imageUrl.join(\", \")\n : \"none\"\n }`,\n `Mask image URL: ${options.maskImageUrl ?? \"none\"}`,\n ],\n });\n\n console.log(packet.instructions);\n return;\n }\n\n const compression = parseCompression(options.compression);\n const inputFidelity = parseInputFidelity(options.inputFidelity);\n const imagePromptStrength = parseImagePromptStrength(\n options.imagePromptStrength,\n );\n const hasSourceImage = options.imageUrl.length > 0;\n const size =\n hasSourceImage && command.getOptionValueSource(\"size\") === \"default\"\n ? \"auto\"\n : options.size;\n const result = await generateWebImage({\n prompt,\n model: options.model,\n size,\n quality: options.quality,\n background: options.background,\n outputFormat: options.format,\n outputCompression: compression,\n moderation: options.moderation,\n seed: options.seed,\n safetyTolerance: options.safetyTolerance,\n enhancePrompt: options.enhancePrompt,\n imageUrls: options.imageUrl,\n maskImageUrl: options.maskImageUrl,\n inputFidelity,\n imagePromptStrength,\n });\n\n console.log(chalk.green(`✓ Image generated: ${result.url}`));\n console.log(chalk.dim(` File: ${result.filename}`));\n console.log(chalk.dim(` Size: ${result.imageSize}`));\n console.log(chalk.dim(` Quality: ${result.quality}`));\n console.log(chalk.dim(` Format: ${result.outputFormat}`));\n if (result.outputCompression !== undefined) {\n console.log(chalk.dim(` Compression: ${result.outputCompression}`));\n }\n if (result.moderation) {\n console.log(chalk.dim(` Moderation: ${result.moderation}`));\n }\n if (result.safetyTolerance) {\n console.log(\n chalk.dim(` Safety tolerance: ${result.safetyTolerance}`),\n );\n }\n if (result.seed !== undefined) {\n console.log(chalk.dim(` Seed: ${result.seed}`));\n }\n console.log(chalk.dim(` Credits charged: ${result.creditsCharged}`));\n console.log(chalk.dim(` Model: ${result.model}`));\n console.log(chalk.dim(` Provider: ${result.provider}`));\n }),\n );\n}\n","import {\n type GenerationOutputKind,\n type ResourceCandidateSlice,\n type RegistryEntry,\n selectResourceCandidates,\n} from \"./resource-registry\";\n\ninterface StyledImageAuthoringOptions {\n readonly prompt: string;\n readonly details: readonly string[];\n readonly style: RegistryEntry;\n}\n\ninterface StyledImageAuthoringPacket {\n readonly type: \"generation-source-selection\";\n readonly kind: \"image\";\n readonly prompt: string;\n readonly registryVersion: string;\n readonly artifact: {\n readonly outputMode: \"primary-image\";\n readonly primaryArtifact: {\n readonly kind: GenerationOutputKind;\n readonly path: string;\n };\n readonly supportingAssets: readonly {\n readonly kind: GenerationOutputKind | \"metadata\";\n readonly path: string;\n readonly optional: boolean;\n }[];\n readonly previewKind: \"image\";\n readonly outputDir: string;\n };\n readonly selection: {\n readonly candidates: ResourceCandidateSlice[\"candidates\"];\n readonly outputSchema: {\n readonly imageStyle: \"string\";\n readonly skills: \"string[]\";\n readonly rationale: \"string\";\n };\n };\n readonly authoring: {\n readonly details: readonly string[];\n readonly artifactRules: readonly string[];\n };\n readonly outputDir: string;\n readonly instructions: string;\n}\n\nconst outputDir = \"./generated/images\";\nconst artifactRules = [\n \"Resolve the selected style source before generating the image.\",\n \"Use the style skill's referenced assets and generation path when it provides one.\",\n \"Produce a single final image file and keep any temporary metadata under the output directory.\",\n] as const;\n\nexport function createStyledImageAuthoringPacket(\n options: StyledImageAuthoringOptions,\n): StyledImageAuthoringPacket {\n const baseSlice = selectResourceCandidates();\n const candidateSlice: ResourceCandidateSlice = {\n ...baseSlice,\n candidates: {\n ...baseSlice.candidates,\n imageStyles: [options.style],\n },\n };\n const selectionSchema = {\n imageStyle: \"string\",\n skills: \"string[]\",\n rationale: \"string\",\n } as const;\n const artifact = {\n outputMode: \"primary-image\",\n primaryArtifact: {\n kind: \"image\",\n path: `${outputDir}/`,\n },\n supportingAssets: [\n {\n kind: \"metadata\",\n path: `${outputDir}/metadata.json`,\n optional: true,\n },\n ],\n previewKind: \"image\",\n outputDir,\n } as const;\n const instructions = [\n `# Zero generate image --style ${options.style.id}`,\n \"\",\n \"This is a federated generation source-selection packet for the current agent.\",\n \"Zero is not generating this image on the server yet. The image style has already been selected by the caller — resolve it and generate the styled image.\",\n \"\",\n \"## User Prompt\",\n options.prompt,\n \"\",\n \"## Selected Image Style\",\n `- \\`${options.style.id}\\` — ${options.style.name}`,\n \"\",\n \"## Stage 1: Supporting Resource Selection\",\n \"- The image style is locked. Optionally pick supporting skills/templates from the candidate slice below.\",\n \"- Choose only IDs present in this packet; do not invent registry IDs.\",\n \"- Treat the selection JSON as internal working state, then continue to generation.\",\n \"\",\n \"## Selection Output Schema\",\n \"```json\",\n JSON.stringify(selectionSchema, null, 2),\n \"```\",\n \"\",\n \"## Candidate Registry Slice\",\n `Registry: \\`${candidateSlice.registryVersion}\\``,\n \"Sources:\",\n ...candidateSlice.sources.map((src) => {\n return `- \\`${src.repo}@${src.ref}\\``;\n }),\n \"\",\n \"```json\",\n JSON.stringify(candidateSlice.candidates, null, 2),\n \"```\",\n \"\",\n \"## Stage 2: Resolve Selected Resources\",\n \"- Fetch or read the selected resource source before generation.\",\n \"- Each candidate carries a `source` object with `path` and optional `repo`/`ref`; when `repo`/`ref` are omitted, fall back to the registry-level source above.\",\n \"- For directory refs, inspect the most relevant files such as `SKILL.md`, references, examples, and templates.\",\n \"- If a source file cannot be fetched, state that limitation and fall back to the registry metadata for that resource.\",\n \"\",\n \"## Stage 3: Generate Image\",\n \"- Generate one production-quality image using the selected style.\",\n \"- Follow the selected style skill's generation path when it defines one.\",\n \"- If the style skill delegates to a model or connector, use that flow directly instead of restating the style text manually.\",\n \"\",\n \"## Artifact Output Model\",\n `- Primary artifact: \\`${artifact.primaryArtifact.kind}\\` under \\`${artifact.primaryArtifact.path}\\`.`,\n `- Output mode: \\`${artifact.outputMode}\\`.`,\n \"- Supporting metadata may live inside the same output directory when useful.\",\n \"\",\n \"## Requested Parameters\",\n ...options.details.map((detail) => {\n return `- ${detail}`;\n }),\n \"\",\n \"## Image Authoring Rules\",\n ...artifactRules.map((rule) => {\n return `- ${rule}`;\n }),\n \"\",\n \"## Verification\",\n \"- Verify the final image exists and is nonblank.\",\n \"- Check that the selected style's required reference anchors or source assets were used when applicable.\",\n \"- Report the final image URL or path and the selected registry resource ID.\",\n ].join(\"\\n\");\n\n return {\n type: \"generation-source-selection\",\n kind: \"image\",\n prompt: options.prompt,\n registryVersion: candidateSlice.registryVersion,\n artifact,\n selection: {\n candidates: candidateSlice.candidates,\n outputSchema: selectionSchema,\n },\n authoring: {\n details: options.details,\n artifactRules,\n },\n outputDir,\n instructions,\n };\n}\n","export type GenerationTarget =\n | \"image\"\n | \"presentation\"\n | \"website\"\n | \"dashboard-design\"\n | \"mobile-app-design\"\n | \"poster\"\n | \"intro-video\"\n | \"report\"\n | \"docs-design\";\n\nexport type GenerationOutputKind =\n | \"website\"\n | \"image\"\n | \"audio\"\n | \"video\"\n | \"presentation\"\n | \"report\"\n | \"poster\"\n | \"dashboard-design\"\n | \"mobile-app-design\"\n | \"docs-design\"\n | \"bundle\";\n\ntype ResourceKind =\n | \"skill\"\n | \"template\"\n | \"design-system\"\n | \"image-style\"\n | \"audio-style\"\n | \"video-template\"\n | \"bundle-template\";\n\ninterface ResourceSourceRef {\n readonly path: string;\n readonly repo?: string;\n readonly ref?: string;\n}\n\nexport interface RegistryEntry {\n readonly id: string;\n readonly kind: ResourceKind;\n readonly name: string;\n readonly description: string;\n readonly desc?: string;\n readonly source: ResourceSourceRef;\n /**\n * Generation targets this entry applies to. Mandatory for `kind: \"template\"`\n * so we can filter templates per `generate` subcommand. Optional and unused\n * for other kinds — design systems apply to all HTML targets, image styles\n * apply only to image generation, and so on.\n */\n readonly targets?: readonly GenerationTarget[];\n}\n\nexport interface ResourceCandidateSlice {\n readonly registryVersion: string;\n readonly source: {\n readonly repo: string;\n readonly ref: string;\n };\n readonly sources: readonly {\n readonly repo: string;\n readonly ref: string;\n }[];\n readonly candidates: {\n readonly skills: readonly RegistryEntry[];\n readonly templates: readonly RegistryEntry[];\n readonly designSystems: readonly RegistryEntry[];\n readonly imageStyles: readonly RegistryEntry[];\n readonly audioStyles: readonly RegistryEntry[];\n readonly videoTemplates: readonly RegistryEntry[];\n readonly bundleTemplates: readonly RegistryEntry[];\n };\n}\n\nconst RESOURCE_REGISTRY_REPO = \"nexu-io/open-design\";\nconst RESOURCE_REGISTRY_COMMIT = \"3fb620af423534643677c7c6fae76be088fa770a\";\nconst VM0_SKILLS_REPO = \"vm0-ai/vm0-skills\";\nconst VM0_SKILLS_REF = \"main\";\n\nconst RESOURCE_REGISTRY_VERSION = \"v1\";\n\nconst RESOURCE_REGISTRY: readonly RegistryEntry[] = [\n {\n id: \"skill:article-magazine\",\n kind: \"skill\",\n name: \"Article Magazine\",\n description:\n \"Shapes research or editorial material into a magazine-like narrative with strong hierarchy.\",\n source: { path: \"skills/article-magazine/SKILL.md\" },\n },\n {\n id: \"skill:design-brief\",\n kind: \"skill\",\n name: \"Design Brief\",\n description:\n \"Converts a product, brand, or feature request into a structured design brief.\",\n source: { path: \"skills/design-brief/SKILL.md\" },\n },\n {\n id: \"skill:8-bit-orbit-video-template\",\n kind: \"skill\",\n name: \"8 Bit Orbit Video Template\",\n description:\n \"HyperFrames-based video template for retro pixel deck motion design — multi-scene HTML-to-video composition with advanced transitions and ready-to-render default style.\",\n source: { path: \"skills/8-bit-orbit-video-template/SKILL.md\" },\n },\n {\n id: \"skill:after-hours-editorial-template\",\n kind: \"skill\",\n name: \"After Hours Editorial Template\",\n description:\n \"Luxury dark-editorial HyperFrames template for three-page cinematic storyboards — haute couture title cards and magazine chapter spreads with moody serif-led storytelling.\",\n source: { path: \"skills/after-hours-editorial-template/SKILL.md\" },\n },\n {\n id: \"skill:algorithmic-art\",\n kind: \"skill\",\n name: \"Algorithmic Art\",\n description:\n \"Create generative art using p5.js with seeded randomness so every render is reproducible. Useful for procedural posters, motion-style stills, and artistic frame studies.\",\n source: { path: \"skills/algorithmic-art/SKILL.md\" },\n },\n {\n id: \"skill:apple-hig\",\n kind: \"skill\",\n name: \"Apple HIG\",\n description:\n \"Apple Human Interface Guidelines as 14 agent skills covering platforms, foundations, components, patterns, inputs, and technologies for iOS, macOS, visionOS, watchOS, and tvOS.\",\n source: { path: \"skills/apple-hig/SKILL.md\" },\n },\n {\n id: \"skill:brainstorming\",\n kind: \"skill\",\n name: \"Brainstorming\",\n description:\n \"Transform rough ideas into fully-formed designs through structured questioning and alternative exploration. Useful early in concept work.\",\n source: { path: \"skills/brainstorming/SKILL.md\" },\n },\n {\n id: \"skill:brand-guidelines\",\n kind: \"skill\",\n name: \"Brand Guidelines\",\n description:\n \"Apply Anthropic's official brand colors and typography to artifacts for consistent visual identity and professional design standards. A reference for shaping your own.\",\n source: { path: \"skills/brand-guidelines/SKILL.md\" },\n },\n {\n id: \"skill:canvas-design\",\n kind: \"skill\",\n name: \"Canvas Design\",\n description:\n \"Create beautiful visual art in PNG and PDF documents using design philosophy and aesthetic principles for posters, illustrations, and static pieces.\",\n source: { path: \"skills/canvas-design/SKILL.md\" },\n },\n {\n id: \"skill:card-twitter\",\n kind: \"skill\",\n name: \"Card Twitter\",\n description: \"Twitter quote or data card designed to pair with a post.\",\n source: { path: \"skills/card-twitter/SKILL.md\" },\n },\n {\n id: \"skill:card-xiaohongshu\",\n kind: \"skill\",\n name: \"Card Xiaohongshu\",\n description:\n \"Xiaohongshu-style knowledge cards, arranged as a swipeable multi-card carousel.\",\n source: { path: \"skills/card-xiaohongshu/SKILL.md\" },\n },\n {\n id: \"skill:color-expert\",\n kind: \"skill\",\n name: \"Color Expert\",\n description:\n \"Color science expert skill with 286K words of reference material covering OKLCH/OKLAB, palette generation, accessibility/contrast, color naming, pigment mixing, and historical color theory.\",\n source: { path: \"skills/color-expert/SKILL.md\" },\n },\n {\n id: \"skill:creative-director\",\n kind: \"skill\",\n name: \"Creative Director\",\n description:\n \"AI creative director with recursive self-assessment: 20+ methodologies (SIT, TRIZ, Bisociation, SCAMPER, Synectics), 3-axis evaluation calibrated against Cannes/D&AD/HumanKind, 5-phase process from brief to presentation.\",\n source: { path: \"skills/creative-director/SKILL.md\" },\n },\n {\n id: \"skill:d3-visualization\",\n kind: \"skill\",\n name: \"D3 Visualization\",\n description:\n \"Teaches the agent to produce D3 charts and interactive data visualizations. Useful for editorial dashboards, reports, and explanatory graphics.\",\n source: { path: \"skills/d3-visualization/SKILL.md\" },\n },\n {\n id: \"skill:deck-guizang-editorial\",\n kind: \"skill\",\n name: \"Deck Guizang Editorial\",\n description:\n \"Editorial magazine meets e-ink: 10 layouts and 5 palettes (Ink, Indigo Porcelain, Forest Ink, Kraft Paper, Dune).\",\n source: { path: \"skills/deck-guizang-editorial/SKILL.md\" },\n },\n {\n id: \"skill:deck-open-slide-canvas\",\n kind: \"skill\",\n name: \"Deck Open Slide Canvas\",\n description:\n \"Locked 1920x1080 canvas deck with React component-level free composition, not bound to a fixed template.\",\n source: { path: \"skills/deck-open-slide-canvas/SKILL.md\" },\n },\n {\n id: \"skill:deck-swiss-international\",\n kind: \"skill\",\n name: \"Deck Swiss International\",\n description:\n \"16-column grid, one saturated accent, and 22 locked layouts (Klein Blue, Lemon, Mint, Safety Orange).\",\n source: { path: \"skills/deck-swiss-international/SKILL.md\" },\n },\n {\n id: \"skill:design-consultation\",\n kind: \"skill\",\n name: \"Design Consultation\",\n description:\n \"Build a complete design system from scratch with creative risks and realistic product mockups. Useful for kickoff workshops and brand-from-zero work.\",\n source: { path: \"skills/design-consultation/SKILL.md\" },\n },\n {\n id: \"skill:design-md\",\n kind: \"skill\",\n name: \"Design MD\",\n description:\n \"Create and manage DESIGN.md files. Useful for capturing design direction, tokens, and visual rules in a single source of truth.\",\n source: { path: \"skills/design-md/SKILL.md\" },\n },\n {\n id: \"skill:design-review\",\n kind: \"skill\",\n name: \"Design Review\",\n description:\n \"Designer Who Codes: visual audit then fixes with atomic commits and before/after screenshots. Useful for tightening shipped UI before launch.\",\n source: { path: \"skills/design-review/SKILL.md\" },\n },\n {\n id: \"skill:digits-fintech-swiss-template\",\n kind: \"skill\",\n name: \"Digits Fintech Swiss Template\",\n description:\n \"Swiss-grid fintech deck template in black / warm paper / neon-lime — strict modular layout, bold numeric cards, restrained motion, keyboard/click navigation.\",\n source: { path: \"skills/digits-fintech-swiss-template/SKILL.md\" },\n },\n {\n id: \"skill:doc-kami-parchment\",\n kind: \"skill\",\n name: \"DOC Kami Parchment\",\n description:\n \"Warm parchment canvas (#f5f4ed), monochrome ink-blue accent (#1B365D), one serif family, and editorial-grade typography.\",\n source: { path: \"skills/doc-kami-parchment/SKILL.md\" },\n },\n {\n id: \"skill:editorial-burgundy-principles-template\",\n kind: \"skill\",\n name: \"Editorial Burgundy Principles Template\",\n description:\n \"Editorial studio deck template in burgundy / blush / muted-gold — pill tags, large typographic statements, principle cards, guided keyboard/click navigation.\",\n source: { path: \"skills/editorial-burgundy-principles-template/SKILL.md\" },\n },\n {\n id: \"skill:enhance-prompt\",\n kind: \"skill\",\n name: \"Enhance Prompt\",\n description:\n \"Improve prompts with design specs and UI/UX vocabulary. Useful for design-to-code workflows and clarifying requests for visual output.\",\n source: { path: \"skills/enhance-prompt/SKILL.md\" },\n },\n {\n id: \"skill:faq-page\",\n kind: \"skill\",\n name: \"FAQ Page\",\n description:\n \"A Frequently Asked Questions (FAQ) page with collapsible accordion sections, search functionality, and category filtering.\",\n source: { path: \"skills/faq-page/SKILL.md\" },\n },\n {\n id: \"skill:field-notes-editorial-template\",\n kind: \"skill\",\n name: \"Field Notes Editorial Template\",\n description:\n \"Editorial Field Notes report template — soft paper background, serif hero typography, rounded pastel insight cards, retention chart panel. Premium magazine-style.\",\n source: { path: \"skills/field-notes-editorial-template/SKILL.md\" },\n },\n {\n id: \"skill:figma-create-design-system-rules\",\n kind: \"skill\",\n name: \"Figma Create Design System Rules\",\n description:\n \"Generate project-specific design system rules for Figma-to-code workflows. Useful for capturing tokens, naming, and lint rules in one source.\",\n source: { path: \"skills/figma-create-design-system-rules/SKILL.md\" },\n },\n {\n id: \"skill:figma-generate-design\",\n kind: \"skill\",\n name: \"Figma Generate Design\",\n description:\n \"Build or update screens in Figma from code or description using design system components. Translate app pages into Figma using design tokens.\",\n source: { path: \"skills/figma-generate-design/SKILL.md\" },\n },\n {\n id: \"skill:figma-generate-library\",\n kind: \"skill\",\n name: \"Figma Generate Library\",\n description:\n \"Build or update a professional-grade design system library in Figma from a codebase. Useful for keeping the Figma source of truth in sync with shipped components.\",\n source: { path: \"skills/figma-generate-library/SKILL.md\" },\n },\n {\n id: \"skill:figma-implement-design\",\n kind: \"skill\",\n name: \"Figma Implement Design\",\n description:\n \"Translate Figma designs into production-ready code with 1:1 visual fidelity. Useful for handing off Figma frames straight to a frontend agent.\",\n source: { path: \"skills/figma-implement-design/SKILL.md\" },\n },\n {\n id: \"skill:flutter-animating-apps\",\n kind: \"skill\",\n name: \"Flutter Animating Apps\",\n description:\n \"Implement animated effects, transitions, and motion in Flutter apps. Useful for native iOS/Android motion design.\",\n source: { path: \"skills/flutter-animating-apps/SKILL.md\" },\n },\n {\n id: \"skill:frame-data-chart-nyt\",\n kind: \"skill\",\n name: \"Frame Data Chart Nyt\",\n description:\n \"NYT-newsroom typography, staggered reveal animation, and editorial-grade charts (line, bar, or range band).\",\n source: { path: \"skills/frame-data-chart-nyt/SKILL.md\" },\n },\n {\n id: \"skill:frame-flowchart-sticky\",\n kind: \"skill\",\n name: \"Frame Flowchart Sticky\",\n description:\n \"SVG curve connectors, sticky-note nodes, and cursor interaction with a whiteboard-brainstorm feel.\",\n source: { path: \"skills/frame-flowchart-sticky/SKILL.md\" },\n },\n {\n id: \"skill:frame-glitch-title\",\n kind: \"skill\",\n name: \"Frame Glitch Title\",\n description:\n \"Digital glitch, chromatic offset, and data-corruption title frame for video transitions or cyberpunk heroes.\",\n source: { path: \"skills/frame-glitch-title/SKILL.md\" },\n },\n {\n id: \"skill:frame-light-leak-cinema\",\n kind: \"skill\",\n name: \"Frame Light Leak Cinema\",\n description:\n \"Film light leaks, grain, 16:9 letterbox, and large serif type for cinematic openings or chapter cards.\",\n source: { path: \"skills/frame-light-leak-cinema/SKILL.md\" },\n },\n {\n id: \"skill:frame-liquid-bg-hero\",\n kind: \"skill\",\n name: \"Frame Liquid Bg Hero\",\n description:\n \"WebGL-style fluid displacement background with a quote overlay, suited to video intros, landing heroes, or posters.\",\n source: { path: \"skills/frame-liquid-bg-hero/SKILL.md\" },\n },\n {\n id: \"skill:frame-logo-outro\",\n kind: \"skill\",\n name: \"Frame Logo Outro\",\n description:\n \"Segmented logo assembly, glow bloom, and tagline reveal for video outros or brand closing frames.\",\n source: { path: \"skills/frame-logo-outro/SKILL.md\" },\n },\n {\n id: \"skill:frame-macos-notification\",\n kind: \"skill\",\n name: \"Frame Macos Notification\",\n description:\n \"Realistic macOS notification banner with app icon, title, and body, suited to video overlays or product teasers.\",\n source: { path: \"skills/frame-macos-notification/SKILL.md\" },\n },\n {\n id: \"skill:frontend-design\",\n kind: \"skill\",\n name: \"Frontend Design\",\n description:\n \"Frontend design and UI/UX development tools for shipping production-ready interfaces with strong typographic and layout discipline.\",\n source: { path: \"skills/frontend-design/SKILL.md\" },\n },\n {\n id: \"skill:frontend-dev\",\n kind: \"skill\",\n name: \"Frontend Dev\",\n description:\n \"Full-stack frontend with cinematic animations, AI-generated media via MiniMax API, and generative art. Useful for hero pages and showcase sites.\",\n source: { path: \"skills/frontend-dev/SKILL.md\" },\n },\n {\n id: \"skill:frontend-skill\",\n kind: \"skill\",\n name: \"Frontend Skill\",\n description:\n \"Create visually strong landing pages, websites, and app UIs with restrained composition. OpenAI's production frontend playbook.\",\n source: { path: \"skills/frontend-skill/SKILL.md\" },\n },\n {\n id: \"skill:frontend-slides\",\n kind: \"skill\",\n name: \"Frontend Slides\",\n description:\n \"Generate animation-rich HTML presentations with visual style previews. Useful for online keynotes, embedded talks, and interactive briefs.\",\n source: { path: \"skills/frontend-slides/SKILL.md\" },\n },\n {\n id: \"skill:gsap-core\",\n kind: \"skill\",\n name: \"GSAP Core\",\n description:\n \"Core GSAP API with gsap.to(), from(), fromTo(), easing, duration, stagger, and defaults. Production-grade web animation primitives.\",\n source: { path: \"skills/gsap-core/SKILL.md\" },\n },\n {\n id: \"skill:gsap-react\",\n kind: \"skill\",\n name: \"GSAP React\",\n description:\n \"GSAP React integration with useGSAP hook, refs, gsap.context(), cleanup, and SSR. Ships safe motion in React + Next.js apps.\",\n source: { path: \"skills/gsap-react/SKILL.md\" },\n },\n {\n id: \"skill:gsap-scrolltrigger\",\n kind: \"skill\",\n name: \"GSAP Scrolltrigger\",\n description:\n \"GSAP ScrollTrigger for scroll-linked animations, pinning, scrub, and refresh handling. Useful for editorial sites and product pages.\",\n source: { path: \"skills/gsap-scrolltrigger/SKILL.md\" },\n },\n {\n id: \"skill:gsap-timeline\",\n kind: \"skill\",\n name: \"GSAP Timeline\",\n description:\n \"GSAP Timelines with sequencing, position parameter, labels, nesting, and playback control. Useful for orchestrating multi-step motion sequences.\",\n source: { path: \"skills/gsap-timeline/SKILL.md\" },\n },\n {\n id: \"skill:hand-drawn-diagrams\",\n kind: \"skill\",\n name: \"Hand Drawn Diagrams\",\n description:\n \"Generate hand-drawn Excalidraw diagrams from a prompt - animated SVG, hosted edit link, and PNG export. Works with Claude Code, Codex, Gemini CLI, and any agent supporting standard skill paths.\",\n source: { path: \"skills/hand-drawn-diagrams/SKILL.md\" },\n },\n {\n id: \"skill:hatch-pet\",\n kind: \"skill\",\n name: \"Hatch Pet\",\n description:\n \"Create, repair, validate, preview, and package Codex-compatible animated pet spritesheets with an 8x9 atlas, QA contact sheets, preview videos, and pet.json packaging.\",\n source: { path: \"skills/hatch-pet/SKILL.md\" },\n },\n {\n id: \"skill:html-ppt-retro-quarterly-review\",\n kind: \"skill\",\n name: \"HTML PPT Retro Quarterly Review\",\n description:\n \"Retro Quarterly Review template — bold blue + orange editorial with slab headlines, cream paper sections, structured grids, fast premium motion pacing in video mode.\",\n source: { path: \"skills/html-ppt-retro-quarterly-review/SKILL.md\" },\n },\n {\n id: \"skill:login-flow\",\n kind: \"skill\",\n name: \"Login Flow\",\n description: \"Mobile login and authentication flow screens.\",\n source: { path: \"skills/login-flow/SKILL.md\" },\n },\n {\n id: \"skill:mockup-device-3d\",\n kind: \"skill\",\n name: \"Mockup Device 3D\",\n description:\n \"Static iPhone and MacBook 3D-style showcase with real HTML embedded on screens, glass-lens refraction, and 360-degree turntable composition.\",\n source: { path: \"skills/mockup-device-3d/SKILL.md\" },\n },\n {\n id: \"skill:paywall-upgrade-cro\",\n kind: \"skill\",\n name: \"Paywall Upgrade Cro\",\n description:\n \"Design and optimize upgrade screens, paywalls, and upsell modals. Useful for SaaS conversion design and pricing-page experiments.\",\n source: { path: \"skills/paywall-upgrade-cro/SKILL.md\" },\n },\n {\n id: \"skill:plan-design-review\",\n kind: \"skill\",\n name: \"Plan Design Review\",\n description:\n \"Senior Designer review: rates each design dimension 0-10, explains what a 10 looks like, and flags AI Slop signals. Useful as a gate before merging UI work.\",\n source: { path: \"skills/plan-design-review/SKILL.md\" },\n },\n {\n id: \"skill:platform-design\",\n kind: \"skill\",\n name: \"Platform Design\",\n description:\n \"300+ design rules from Apple HIG, Material Design 3, and WCAG 2.2 for cross-platform apps. Useful when shipping a single design across iOS, Android, and the web.\",\n source: { path: \"skills/platform-design/SKILL.md\" },\n },\n {\n id: \"skill:poster-hero\",\n kind: \"skill\",\n name: \"Poster Hero\",\n description:\n \"Vertical poster or Moments-style share image with strong visual impact.\",\n source: { path: \"skills/poster-hero/SKILL.md\" },\n },\n {\n id: \"skill:ppt-keynote\",\n kind: \"skill\",\n name: \"PPT Keynote\",\n description:\n \"Apple Keynote-quality slides, one card per screen, with keyboard left/right navigation.\",\n source: { path: \"skills/ppt-keynote/SKILL.md\" },\n },\n {\n id: \"skill:release-notes-one-pager\",\n kind: \"skill\",\n name: \"Release Notes One Pager\",\n description:\n 'Release notes one-page HTML with highlights, Added, Fixed, Breaking changes, Known issues, and Upgrade note. Writes explicit \"None\" style sections whenever the user does not provide details.',\n source: { path: \"skills/release-notes-one-pager/SKILL.md\" },\n },\n {\n id: \"skill:resume-modern\",\n kind: \"skill\",\n name: \"Resume Modern\",\n description:\n \"Modern minimal resume, single A4 page, ready for print or PDF export.\",\n source: { path: \"skills/resume-modern/SKILL.md\" },\n },\n {\n id: \"skill:screenshots-marketing\",\n kind: \"skill\",\n name: \"Screenshots Marketing\",\n description:\n \"Generate marketing screenshots with Playwright. Useful for landing-page hero shots, App Store screenshots, and changelog visuals.\",\n source: { path: \"skills/screenshots-marketing/SKILL.md\" },\n },\n {\n id: \"skill:shadcn-ui\",\n kind: \"skill\",\n name: \"Shadcn UI\",\n description:\n \"Build UI components with shadcn/ui. Pairs with the Stitch design loop to ship structured, accessible components quickly.\",\n source: { path: \"skills/shadcn-ui/SKILL.md\" },\n },\n {\n id: \"skill:shader-dev\",\n kind: \"skill\",\n name: \"Shader Dev\",\n description:\n \"GLSL shader techniques for ray marching, fluid simulation, particle systems, and procedural generation. Useful for hero visuals and motion stills.\",\n source: { path: \"skills/shader-dev/SKILL.md\" },\n },\n {\n id: \"skill:slack-gif-creator\",\n kind: \"skill\",\n name: \"Slack GIF Creator\",\n description:\n \"Create animated GIFs optimized for Slack with validators for size constraints and composable animation primitives.\",\n source: { path: \"skills/slack-gif-creator/SKILL.md\" },\n },\n {\n id: \"skill:slides\",\n kind: \"skill\",\n name: \"Slides\",\n description:\n \"Create and edit .pptx presentation decks with PptxGenJS. Useful for sales decks, kickoff briefs, and design-system showcases.\",\n source: { path: \"skills/slides/SKILL.md\" },\n },\n {\n id: \"skill:social-reddit-card\",\n kind: \"skill\",\n name: \"Social Reddit Card\",\n description:\n \"Realistic Reddit post card with vote rail and comment count, suited to video overlays or story sharing.\",\n source: { path: \"skills/social-reddit-card/SKILL.md\" },\n },\n {\n id: \"skill:social-spotify-card\",\n kind: \"skill\",\n name: \"Social Spotify Card\",\n description:\n \"Spotify Now Playing-style card with album art, progress bar, and playback controls, suited to video overlays or personal homepages.\",\n source: { path: \"skills/social-spotify-card/SKILL.md\" },\n },\n {\n id: \"skill:social-x-post-card\",\n kind: \"skill\",\n name: \"Social X Post Card\",\n description:\n \"Realistic X post card with engagement metrics (likes, reposts, views), suited to video overlays or shareable image cards.\",\n source: { path: \"skills/social-x-post-card/SKILL.md\" },\n },\n {\n id: \"skill:stitch-loop\",\n kind: \"skill\",\n name: \"Stitch Loop\",\n description:\n \"Iterative design-to-code feedback loop. Critique adjust ship cycle for tightening visual fidelity between brief and built UI.\",\n source: { path: \"skills/stitch-loop/SKILL.md\" },\n },\n {\n id: \"skill:swiftui-design\",\n kind: \"skill\",\n name: \"Swiftui Design\",\n description:\n \"SwiftUI skill - anti AI-slop rules, design direction advisor, brand asset protocol, and five-dimension review. Works with Claude Code, Cursor, Codex, and OpenCode.\",\n source: { path: \"skills/swiftui-design/SKILL.md\" },\n },\n {\n id: \"skill:swiss-creative-mode-template\",\n kind: \"skill\",\n name: \"Swiss Creative Mode Template\",\n description:\n \"Swiss-inspired creative-mode presentation template — bold editorial typography, high-contrast geometric cards, interactive slide navigation, theme switching, hotspot overlays.\",\n source: { path: \"skills/swiss-creative-mode-template/SKILL.md\" },\n },\n {\n id: \"skill:swiss-user-research-video-template\",\n kind: \"skill\",\n name: \"Swiss User Research Video Template\",\n description:\n \"Swiss-style user-research narrative template in warm-paper editorial aesthetics — minimalist typography, donut breakdowns, keyboard/click navigation, single-file HTML.\",\n source: { path: \"skills/swiss-user-research-video-template/SKILL.md\" },\n },\n {\n id: \"skill:taste-skill\",\n kind: \"skill\",\n name: \"Taste Skill\",\n description:\n \"High-agency frontend skill that gives AI good taste with tunable design variance, motion intensity, and visual density to stop generic UI slop.\",\n source: { path: \"skills/taste-skill/SKILL.md\" },\n },\n {\n id: \"skill:theme-factory\",\n kind: \"skill\",\n name: \"Theme Factory\",\n description:\n \"Apply professional font and color themes to artifacts including slides, docs, reports, and HTML landing pages. Ships 10 pre-set themes.\",\n source: { path: \"skills/theme-factory/SKILL.md\" },\n },\n {\n id: \"skill:threejs\",\n kind: \"skill\",\n name: \"Threejs\",\n description:\n \"Three.js skills for creating 3D elements and interactive experiences in the browser - scenes, materials, controls, and post-processing.\",\n source: { path: \"skills/threejs/SKILL.md\" },\n },\n {\n id: \"skill:ui-skills\",\n kind: \"skill\",\n name: \"UI Skills\",\n description:\n \"Opinionated, evolving constraints to guide agents when building interfaces. Useful for keeping output coherent across many small UI pieces.\",\n source: { path: \"skills/ui-skills/SKILL.md\" },\n },\n {\n id: \"skill:ui-ux-pro-max\",\n kind: \"skill\",\n name: \"UI UX Pro Max\",\n description:\n \"Catalog-only UI/UX Pro Max entry. The full upstream templates, data, and search workflow are not bundled in this registry.\",\n source: { path: \"skills/ui-ux-pro-max/SKILL.md\" },\n },\n {\n id: \"skill:vfx-text-cursor\",\n kind: \"skill\",\n name: \"VFX Text Cursor\",\n description:\n \"Cursor light trail, chromatic rays, and directional flares for word-by-word quote reveals in video intros.\",\n source: { path: \"skills/vfx-text-cursor/SKILL.md\" },\n },\n {\n id: \"skill:video-hyperframes\",\n kind: \"skill\",\n name: \"Video Hyperframes\",\n description:\n \"Hyperframes / Remotion-compatible continuous frame animation with autoplay support.\",\n source: { path: \"skills/video-hyperframes/SKILL.md\" },\n },\n {\n id: \"skill:web-design-guidelines\",\n kind: \"skill\",\n name: \"Web Design Guidelines\",\n description:\n \"Web design guidelines and standards by the Vercel engineering team. Covers layout, typography, color, motion, and accessibility for product UI.\",\n source: { path: \"skills/web-design-guidelines/SKILL.md\" },\n },\n {\n id: \"skill:weread-year-in-review-video-template\",\n kind: \"skill\",\n name: \"Weread Year In Review Video Template\",\n description:\n \"WeRead-inspired HyperFrames video template for vertical annual reading reports — warm paper texture, editorial Chinese typography, book-page metaphors, deterministic motion.\",\n source: { path: \"skills/weread-year-in-review-video-template/SKILL.md\" },\n },\n {\n id: \"skill:wpds\",\n kind: \"skill\",\n name: \"WPDS\",\n description:\n \"WordPress Design System. Apply WordPress's official design tokens, typography, and component patterns to themes and sites.\",\n source: { path: \"skills/wpds/SKILL.md\" },\n },\n {\n id: \"template:dashboard\",\n kind: \"template\",\n name: \"Dashboard\",\n description:\n \"Admin or analytics dashboard in a single HTML file with fixed sidebar, top bar, KPI cards, and one or two charts.\",\n source: { path: \"design-templates/dashboard\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:finance-report\",\n kind: \"template\",\n name: \"Finance Report\",\n description:\n \"Quarterly or monthly financial report with masthead KPIs, revenue and burn charts, P&L summary, highlights, and outlook.\",\n source: { path: \"design-templates/finance-report\" },\n targets: [\"report\"],\n },\n {\n id: \"template:docs-page\",\n kind: \"template\",\n name: \"Docs Page\",\n description:\n \"Documentation page with inline-start navigation, scrollable article body, and inline-end table of contents.\",\n source: { path: \"design-templates/docs-page\" },\n targets: [\"docs-design\"],\n },\n {\n id: \"template:mobile-app\",\n kind: \"template\",\n name: \"Mobile App Design\",\n description:\n \"Mobile app screen rendered inside a pixel-accurate iPhone 15 Pro frame using reusable screen archetypes.\",\n source: { path: \"design-templates/mobile-app\" },\n targets: [\"mobile-app-design\"],\n },\n {\n id: \"template:html-ppt-graphify-dark-graph\",\n kind: \"template\",\n name: \"Graphify Dark Graph\",\n description:\n \"Dark knowledge-graph deck with midnight gradients, force-graph cover visuals, command-line highlights, and glass-morphism cards.\",\n source: { path: \"design-templates/html-ppt-graphify-dark-graph\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-retro-zine\",\n kind: \"template\",\n name: \"Zhangzara Retro Zine\",\n description:\n \"Retro editorial zine presentation template with expressive composition, tactile paper energy, and bold magazine-like rhythm.\",\n source: { path: \"design-templates/html-ppt-zhangzara-retro-zine\" },\n targets: [\"presentation\", \"poster\"],\n },\n {\n id: \"template:weekly-update\",\n kind: \"template\",\n name: \"Weekly Update\",\n description:\n \"Single-file horizontal-swipe weekly team update deck for shipped work, in-flight work, blockers, metrics, and asks.\",\n source: { path: \"design-templates/weekly-update\" },\n targets: [\"report\", \"presentation\"],\n },\n {\n id: \"template:web-prototype-taste-editorial\",\n kind: \"template\",\n name: \"Taste Editorial Web Prototype\",\n description:\n \"Editorial-minimalist web prototype with warm monochrome canvas, serif display type, hairline borders, pastel chips, and ambient micro-motion.\",\n source: { path: \"design-templates/web-prototype-taste-editorial\" },\n targets: [\"website\"],\n },\n {\n id: \"template:audio-jingle\",\n kind: \"template\",\n name: \"Audio Jingle\",\n description:\n \"Audio generation skill — jingles, beds, voiceover, and sound effects. Routes music requests to Suno V5 / Udio / Lyria, speech to MiniMax TTS / FishAudio / ElevenLabs V3, and SFX to ElevenLabs SFX or AudioCraft. Output is one MP3/WAV file…\",\n source: { path: \"design-templates/audio-jingle\" },\n targets: [\"intro-video\"],\n },\n {\n id: \"template:blog-post\",\n kind: \"template\",\n name: \"Blog Post\",\n description:\n \"A long-form article / blog post — masthead, hero image placeholder, article body with figures and pull quotes, author byline, related posts.\",\n source: { path: \"design-templates/blog-post\" },\n targets: [\"website\"],\n },\n {\n id: \"template:clinical-case-report\",\n kind: \"template\",\n name: \"Clinical Case Report\",\n description:\n \"Structured medical case presentation for clinical rounds, conferences, and documentation. Generates SOAP-format or narrative case reports with physiologically accurate vitals, labs, and evidence-based plans.\",\n source: { path: \"design-templates/clinical-case-report\" },\n targets: [\"report\"],\n },\n {\n id: \"template:critique\",\n kind: \"template\",\n name: \"Critique\",\n description:\n \"Run a 5-dimension expert design review on any HTML artifact in the project — Philosophy / Visual hierarchy / Detail / Functionality / Innovation, each scored 0–10. Outputs a single self-contained HTML report with a radar chart, evidence…\",\n source: { path: \"design-templates/critique\" },\n targets: [\n \"website\",\n \"dashboard-design\",\n \"presentation\",\n \"report\",\n \"docs-design\",\n \"poster\",\n \"mobile-app-design\",\n ],\n },\n {\n id: \"template:dating-web\",\n kind: \"template\",\n name: \"Dating Web\",\n description:\n \"A consumer-feeling dating / matchmaking dashboard — left rail navigation, ticker bar of community signals, headline KPIs, a 30-day mutual-matches bar chart, and a match-rate trend block. Editorial typography, restrained accent.\",\n source: { path: \"design-templates/dating-web\" },\n targets: [\"website\"],\n },\n {\n id: \"template:dcf-valuation\",\n kind: \"template\",\n name: \"Dcf Valuation\",\n description:\n \"Discounted cash flow valuation and intrinsic value analysis for public companies.\",\n source: { path: \"design-templates/dcf-valuation\" },\n targets: [\"report\"],\n },\n {\n id: \"template:digital-eguide\",\n kind: \"template\",\n name: \"Digital Eguide\",\n description:\n 'A two-spread digital e-guide preview — page 1 is a cover (display title, author, \"What\\'s inside\" stats, table of contents teaser); page 2 is a spread (lesson body with pull-quote and a step list). Lifestyle / creator brand tone.',\n source: { path: \"design-templates/digital-eguide\" },\n targets: [\"website\", \"docs-design\"],\n },\n {\n id: \"template:email-marketing\",\n kind: \"template\",\n name: \"Email Marketing\",\n description:\n \"A brand product-launch email — masthead with wordmark, hero image block, headline lockup with skewed-italic accent, body copy, primary CTA, and a specifications grid. Pure HTML email layout (centered single column, table fallback).\",\n source: { path: \"design-templates/email-marketing\" },\n targets: [\"website\"],\n },\n {\n id: \"template:eng-runbook\",\n kind: \"template\",\n name: \"Eng Runbook\",\n description:\n \"An engineering runbook — service overview, alerts table, dashboards links, common procedures with copy-pasteable commands, on-call rotation, and an incident-response checklist.\",\n source: { path: \"design-templates/eng-runbook\" },\n targets: [\"docs-design\"],\n },\n {\n id: \"template:flowai-live-dashboard-template\",\n kind: \"template\",\n name: \"Flowai Live Dashboard Template\",\n description:\n \"FlowAI team-management dashboard — three tabs (Members, Details, Activity Log), KPI row, role chart, presence sparklines, contributor panel, light/dark, CSV export, single HTML.\",\n source: { path: \"design-templates/flowai-live-dashboard-template\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:gamified-app\",\n kind: \"template\",\n name: \"Gamified App\",\n description:\n \"A multi-frame gamified mobile-app prototype — three phone frames on a dark showcase stage. Frame 1: cover / poster, Frame 2: today's quests with XP ribbons and a level bar, Frame 3: quest detail. Vivid quest tiles, level ribbon, bottom t…\",\n source: { path: \"design-templates/gamified-app\" },\n targets: [\"website\", \"mobile-app-design\"],\n },\n {\n id: \"template:github-dashboard\",\n kind: \"template\",\n name: \"Github Dashboard\",\n description:\n \"GitHub repository analytics dashboard — stars, forks, contributors, issues, pull requests, recent activity, and top contributors.\",\n source: { path: \"design-templates/github-dashboard\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:guizang-ppt\",\n kind: \"template\",\n name: \"Guizang PPT\",\n description:\n \"电子杂志 × 电子墨水风格的横向翻页网页 PPT — WebGL 流体背景、衬线标题、章节幕封、数据大字报、图片网格。适合分享 / 演讲 / 发布会 / 杂志风 PPT。\",\n source: { path: \"design-templates/guizang-ppt\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:hr-onboarding\",\n kind: \"template\",\n name: \"Hr Onboarding\",\n description:\n 'A new-hire onboarding plan as a single page — first week schedule, buddy + manager intro, learning track, equipment checklist, and \"you\\'re set when…\" outcomes.',\n source: { path: \"design-templates/hr-onboarding\" },\n targets: [\"docs-design\"],\n },\n {\n id: \"template:html-ppt\",\n kind: \"template\",\n name: \"HTML PPT\",\n description:\n \"HTML PPT Studio — static HTML presentations driven by templates. Many styles, layouts, animations, and keyboard navigation for talks, pitches, reports, and 小红书图文.\",\n source: { path: \"design-templates/html-ppt\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-course-module\",\n kind: \"template\",\n name: \"HTML PPT Course Module\",\n description:\n \"Online-course / workshop module deck — warm paper background + Playfair serif, persistent left sidebar of learning objectives, MCQ self-check page. Use for teaching modules, training materials, workshop slides.\",\n source: { path: \"design-templates/html-ppt-course-module\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-dir-key-nav-minimal\",\n kind: \"template\",\n name: \"HTML PPT Dir Key Nav Minimal\",\n description:\n \"极简方向键 keynote — 每页独立单色背景、160px display 标题、4px accent 线、箭头 → 前缀 Mono 列表、← → kbd 提示。适合 keynote、launch、公开演讲。\",\n source: { path: \"design-templates/html-ppt-dir-key-nav-minimal\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-hermes-cyber-terminal\",\n kind: \"template\",\n name: \"HTML PPT Hermes Cyber Terminal\",\n description:\n \"暗终端 honest-review deck — 黑底 + 赛博网格 + CRT 暗角 + 扫描线、`$ prompt` 命令行标题、薄荷绿大字、JetBrains Mono、stroke-only 柱状图。适合 CLI/agent/dev tool 测评。\",\n source: { path: \"design-templates/html-ppt-hermes-cyber-terminal\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-knowledge-arch-blueprint\",\n kind: \"template\",\n name: \"HTML PPT Knowledge Arch Blueprint\",\n description:\n \"奶油蓝图架构 deck — 奶油纸底色 + 单一锈红高亮、48px 蓝图网格、2px 黑边硬卡片、pipeline 步骤盒、右侧 insight callout、Playfair 衬线大字。零渐变零软阴影。\",\n source: { path: \"design-templates/html-ppt-knowledge-arch-blueprint\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-obsidian-claude-gradient\",\n kind: \"template\",\n name: \"HTML PPT Obsidian Claude Gradient\",\n description:\n \"GitHub 暗紫渐变 deck — GitHub-dark + 紫蓝 radial 环境光 + 60px 网格、紫色 pill 标签、三色渐变标题、GitHub 风代码 palette。适合开发者工作流 / MCP / Agent 教程。\",\n source: { path: \"design-templates/html-ppt-obsidian-claude-gradient\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-pitch-deck\",\n kind: \"template\",\n name: \"HTML PPT Pitch Deck\",\n description:\n \"Investor-ready 10-slide HTML pitch deck — white + blue→purple gradient hero, big numbers, traction bar chart, $4.5M-style ask page.\",\n source: { path: \"design-templates/html-ppt-pitch-deck\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-presenter-mode-reveal\",\n kind: \"template\",\n name: \"HTML PPT Presenter Mode Reveal\",\n description:\n \"演讲者模式 deck — tokyo-night 默认主题,5 套主题 T 键切换,每页带 150-300 字逐字稿示例,按 S 打开 CURRENT/NEXT/SCRIPT/TIMER 四张磁吸卡片。适合提词器场景。\",\n source: { path: \"design-templates/html-ppt-presenter-mode-reveal\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-product-launch\",\n kind: \"template\",\n name: \"HTML PPT Product Launch\",\n description:\n \"Launch keynote deck — dark hero + light content, warm orange→peach accent, feature cards, pricing tiers, CTA.\",\n source: { path: \"design-templates/html-ppt-product-launch\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-taste-brutalist\",\n kind: \"template\",\n name: \"HTML PPT Taste Brutalist\",\n description:\n \"16:9 HTML deck in tactical-telemetry / CRT-terminal taste. Deactivated-CRT charcoal slides, white-phosphor monospace, hazard-red accent, scanline overlay, ASCII syntax, density over decoration. Distilled from Leonxlnx/taste-skill `brutal…\",\n source: { path: \"design-templates/html-ppt-taste-brutalist\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-taste-editorial\",\n kind: \"template\",\n name: \"HTML PPT Taste Editorial\",\n description:\n \"16:9 HTML deck in editorial-minimalist taste. Warm cream slides, serif display + grotesque body, hairline rules, monospace meta, generous macro-whitespace, one accent. Distilled from Leonxlnx/taste-skill `minimalist-skill`.\",\n source: { path: \"design-templates/html-ppt-taste-editorial\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-tech-sharing\",\n kind: \"template\",\n name: \"HTML PPT Tech Sharing\",\n description:\n \"Conference / internal tech-talk deck — GitHub-dark, JetBrains Mono, terminal code blocks, agenda + Q&A pages. Use for engineering presentations, internal sharing sessions, conference talks, and code-heavy walkthroughs.\",\n source: { path: \"design-templates/html-ppt-tech-sharing\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-testing-safety-alert\",\n kind: \"template\",\n name: \"HTML PPT Testing Safety Alert\",\n description:\n \"红琥珀警示 deck — 顶/底 45° 红黑 hazard 条纹、红色否定标题、L1/L2/L3 三档卡片、policy-yaml 代码块、红绿 checklist、事故堆叠柱状图。适合安全 / 风险 / 复盘 / 红队。\",\n source: { path: \"design-templates/html-ppt-testing-safety-alert\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-weekly-report\",\n kind: \"template\",\n name: \"HTML PPT Weekly Report\",\n description:\n \"Team weekly / status-update deck — corporate clarity, 8-cell KPI grid, shipped list, 8-week bar chart, next-week table. Use for 周报, business reviews, team status updates, and exec dashboards.\",\n source: { path: \"design-templates/html-ppt-weekly-report\" },\n targets: [\"presentation\", \"report\"],\n },\n {\n id: \"template:html-ppt-xhs-pastel-card\",\n kind: \"template\",\n name: \"HTML PPT Xhs Pastel Card\",\n description:\n \"柔和马卡龙慢生活 deck — 奶油底 + 柔光 blob、Playfair 斜体 + sans 正文、28px 圆角马卡龙卡片、SVG donut 图、chip+page 顶栏。适合生活方式 / 个人成长 / 慢生活内容。\",\n source: { path: \"design-templates/html-ppt-xhs-pastel-card\" },\n targets: [\"presentation\", \"poster\"],\n },\n {\n id: \"template:html-ppt-xhs-post\",\n kind: \"template\",\n name: \"HTML PPT Xhs Post\",\n description:\n \"小红书 / Instagram 风 9 页 3:4 竖版图文(810×1080)— 暖色 pastel、虚线 sticker 卡片、底部页码点点。\",\n source: { path: \"design-templates/html-ppt-xhs-post\" },\n targets: [\"presentation\", \"poster\"],\n },\n {\n id: \"template:html-ppt-xhs-white-editorial\",\n kind: \"template\",\n name: \"HTML PPT Xhs White Editorial\",\n description:\n \"白底杂志风 deck — 纯白 + 顶部 10 色彩虹 bar、80-110px display 标题、紫→蓝→绿→橙→粉渐变文字、马卡龙软卡片组、黑底白字 .focus pill。小红书图文 + 横版 PPT 双用。\",\n source: { path: \"design-templates/html-ppt-xhs-white-editorial\" },\n targets: [\"presentation\", \"poster\"],\n },\n {\n id: \"template:html-ppt-zhangzara-8-bit-orbit\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara 8 Bit Orbit\",\n description:\n \"8-Bit Orbit — pixel-art neon arcade aesthetic on a deep navy void. For cyberpunk, gaming, web3, indie dev tools, hackathon demos that should feel like a CRT screen at 2am.\",\n source: { path: \"design-templates/html-ppt-zhangzara-8-bit-orbit\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-biennale-yellow\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Biennale Yellow\",\n description:\n \"Biennale Yellow — solar yellow on warm parchment with deep indigo serif and sun-glow gradients. For art-biennale posters, museum programmes, curatorial pitches, literary publications.\",\n source: { path: \"design-templates/html-ppt-zhangzara-biennale-yellow\" },\n targets: [\"presentation\", \"poster\"],\n },\n {\n id: \"template:html-ppt-zhangzara-block-frame\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Block Frame\",\n description:\n \"BlockFrame — neobrutalist deck with pastel-neon color blocks and chunky black borders. Pop-graphic and design-led for indie SaaS launches, agency credentials, brand redesigns.\",\n source: { path: \"design-templates/html-ppt-zhangzara-block-frame\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-blue-professional\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Blue Professional\",\n description:\n \"Blue Professional — cream paper background with electric cobalt blue accents; clean modern professional. For B2B SaaS pitches, consulting deliverables, advisory updates, investor reports.\",\n source: { path: \"design-templates/html-ppt-zhangzara-blue-professional\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-bold-poster\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Bold Poster\",\n description:\n \"Bold Poster — editorial poster aesthetic with massive Shrikhand display and a single fire-engine red accent. For magazine-cover brand manifestos and editorial / cultural pitches.\",\n source: { path: \"design-templates/html-ppt-zhangzara-bold-poster\" },\n targets: [\"presentation\", \"poster\"],\n },\n {\n id: \"template:html-ppt-zhangzara-broadside\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Broadside\",\n description:\n \"Broadside — dark editorial canvas with a single fire orange accent and bilingual Latin/Chinese type stack. For manifestos, magazine pitches, design talks, bilingual EN/CN decks.\",\n source: { path: \"design-templates/html-ppt-zhangzara-broadside\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-capsule\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Capsule\",\n description:\n \"Capsule — modular pill-shaped cards on warm bone with a full pastel-pop palette. For lifestyle brands, creator portfolios, DTC launches, beauty / wellness, agency credentials.\",\n source: { path: \"design-templates/html-ppt-zhangzara-capsule\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-cartesian\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Cartesian\",\n description:\n \"Cartesian — quiet warm-neutral palette with classical Playfair serifs; tasteful and unhurried. For investment theses, white papers, advisory work, longform research, gallery decks.\",\n source: { path: \"design-templates/html-ppt-zhangzara-cartesian\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-cobalt-grid\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Cobalt Grid\",\n description:\n \"Cobalt Grid — electric cobalt italic serifs on a graph-paper canvas with stair-stepped pixel-glitch decorations. For design / research bulletins, art publications, curated trend reports.\",\n source: { path: \"design-templates/html-ppt-zhangzara-cobalt-grid\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-coral\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Coral\",\n description:\n \"Coral — cream and coral on near-black, set in oversized Bebas Neue. Warm-graphic editorial for fashion, beauty, fitness, F&B, lifestyle brands, agency credentials.\",\n source: { path: \"design-templates/html-ppt-zhangzara-coral\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-creative-mode\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Creative Mode\",\n description:\n \"Creative Mode — cream paper canvas with confident multi-color accents and Archivo Black display. For creative agency pitches, design studio decks, ad credentials, brand creative reviews.\",\n source: { path: \"design-templates/html-ppt-zhangzara-creative-mode\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-daisy-days\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Daisy Days\",\n description:\n \"Daisy Days — cheerful pastel deck with hand-drawn daisies, stars, and rainbows. Friendly, soft, and warm for educational content, kids and family, wellness, community workshops.\",\n source: { path: \"design-templates/html-ppt-zhangzara-daisy-days\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-editorial-tri-tone\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Editorial Tri Tone\",\n description:\n \"Editorial Tri-Tone — three-color editorial: dusty pink, mustard cream, deep burgundy; Bricolage + Instrument Serif. For fashion-magazine spreads, brand decks, lifestyle media.\",\n source: { path: \"design-templates/html-ppt-zhangzara-editorial-tri-tone\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-grove\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Grove\",\n description:\n \"Grove — forest-green canvas with cream type, classical Playfair serifs, single rust accent. For sustainability and wellness brands, outdoor products, wineries, advisory deliverables.\",\n source: { path: \"design-templates/html-ppt-zhangzara-grove\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-long-table\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Long Table\",\n description:\n \"Long Table — warm cream and rust-red supper-club aesthetic with bold uppercase grotesk headlines and italic Fraunces. For supper clubs, dinner series, lifestyle and wine brands.\",\n source: { path: \"design-templates/html-ppt-zhangzara-long-table\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-mat\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Mat\",\n description:\n \"Mat — dark sage canvas with bone paper and burnt-orange accent; mid-century modern with wood undertones. For architecture/interior brands, ceramics, craft, furniture, advisory decks.\",\n source: { path: \"design-templates/html-ppt-zhangzara-mat\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-monochrome\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Monochrome\",\n description:\n \"Monochrome — ivory ledger paper with all-black type; Lora serif headlines, Jost body, no color. For research synthesis, white papers, longform reports, bilingual EN/CN deliverables.\",\n source: { path: \"design-templates/html-ppt-zhangzara-monochrome\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-neo-grid-bold\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Neo Grid Bold\",\n description:\n \"Neo-Grid Bold — editorial neo-brutalism with a single neon yellow accent on off-white paper. For design-led pitches, brand work, founder talks, conference keynotes.\",\n source: { path: \"design-templates/html-ppt-zhangzara-neo-grid-bold\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-peoples-platform\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Peoples Platform\",\n description:\n \"People's Platform (Block & Bold) — activist poster energy: blue, orange, red on cream, with Alfa Slab + Caveat Brush. For cultural commentary, manifestos, civic decks, campaign pitches.\",\n source: { path: \"design-templates/html-ppt-zhangzara-peoples-platform\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-pin-and-paper\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Pin And Paper\",\n description:\n \"Pin & Paper — yellow paper with safety-pin illustrations, ink-blue handwritten Caveat, paper-grain texture. For qualitative research, founder reflections, longform brand stories.\",\n source: { path: \"design-templates/html-ppt-zhangzara-pin-and-paper\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-pink-script\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Pink Script\",\n description:\n \"Pink Script (After Hours) — black canvas, hot pink accent, pearl-cream paper, Instrument Serif. Late-night editorial luxury for fashion, creator brands, nightlife, and luxury reveals.\",\n source: { path: \"design-templates/html-ppt-zhangzara-pink-script\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-playful\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Playful\",\n description:\n \"Playful — sun-warm peach background with Syne display: a friendly indie launch deck. For creator portfolios, indie product launches, lifestyle brands, small-business pitches.\",\n source: { path: \"design-templates/html-ppt-zhangzara-playful\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-raw-grid\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Raw Grid\",\n description:\n \"Raw Grid — neo-brutalist deck with thick borders, offset shadows, and a pink/sage/ink palette. For founder pitches, accelerator demos, brand decks, indie launches, creator portfolios.\",\n source: { path: \"design-templates/html-ppt-zhangzara-raw-grid\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-retro-windows\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Retro Windows\",\n description:\n \"Retro Windows — Windows 95 chrome: gray title bars, MS Sans Serif, pixel typography, full nostalgia. For retro gaming, Y2K-aesthetic brands, creator portfolios, tech-history talks.\",\n source: { path: \"design-templates/html-ppt-zhangzara-retro-windows\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-sakura-chroma\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Sakura Chroma\",\n description:\n \"Sakura Chroma — vintage Japanese cassette-package aesthetic: cream paper, diagonal rainbow ribbons, condensed bold type, JIS-style spec checkboxes. For analog / kawaii-tech decks.\",\n source: { path: \"design-templates/html-ppt-zhangzara-sakura-chroma\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-scatterbrain\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Scatterbrain\",\n description:\n \"Scatterbrain — Post-it inspired: pastel sticky notes, Caveat handwriting, Shrikhand + Zilla Slab. For brainstorms, workshops, creative-agency credentials, ideation pitches.\",\n source: { path: \"design-templates/html-ppt-zhangzara-scatterbrain\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-signal\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Signal\",\n description:\n \"Signal — deep navy canvas with bone paper and a single muted-gold accent; institutional with quiet weight. For investor decks, board presentations, consulting deliverables, legal briefs.\",\n source: { path: \"design-templates/html-ppt-zhangzara-signal\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-soft-editorial\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Soft Editorial\",\n description:\n \"Soft Editorial — Cormorant Garamond serif on warm paper with sage, blush, and lemon accents. For literary brand stories, gallery decks, advisory deliverables, lifestyle media.\",\n source: { path: \"design-templates/html-ppt-zhangzara-soft-editorial\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-stencil-tablet\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Stencil Tablet\",\n description:\n \"Stencil & Tablet — bone paper with stencil-cut headlines and a six-color earth palette. Archaeology meets brand: museum decks, art/architecture brands, heritage and craft work.\",\n source: { path: \"design-templates/html-ppt-zhangzara-stencil-tablet\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-studio\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Studio\",\n description:\n \"Studio — black canvas with electric-yellow type; high-voltage design studio aesthetic. For studio credentials, creative agency pitches, brand showcases, fashion / sneaker work.\",\n source: { path: \"design-templates/html-ppt-zhangzara-studio\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-vellum\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Vellum\",\n description:\n \"Vellum — deep navy canvas with warm-yellow italic Cormorant serifs and a single dusty teal accent. Quiet, scholarly aesthetic for research synthesis, white papers, advisory work.\",\n source: { path: \"design-templates/html-ppt-zhangzara-vellum\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:hyperframes\",\n kind: \"template\",\n name: \"Hyperframes\",\n description:\n \"HTML video composition skill — captions, voiceover, audio-reactive animation, scene transitions, and timing in HyperFrames HTML. For CLI commands see hyperframes-cli.\",\n source: { path: \"design-templates/hyperframes\" },\n targets: [\"intro-video\"],\n },\n {\n id: \"template:ib-pitch-book\",\n kind: \"template\",\n name: \"Ib Pitch Book\",\n description:\n \"Investment-banking pitch book — trading comps, precedent transactions, valuation football field, DCF sensitivity, strategic-options matrix. For Board / sell-side discussion materials.\",\n source: { path: \"design-templates/ib-pitch-book\" },\n targets: [\"report\", \"presentation\"],\n },\n {\n id: \"template:image-poster\",\n kind: \"template\",\n name: \"Image Poster\",\n description:\n \"Single-image generation skill for posters, key art, and editorial illustrations. Defaults to gpt-image-2 but is provider-agnostic — the same workflow drives Flux, Imagen, or Midjourney via the active upstream tooling. Output is one or mo…\",\n source: { path: \"design-templates/image-poster\" },\n targets: [\"poster\"],\n },\n {\n id: \"template:invoice\",\n kind: \"template\",\n name: \"Invoice\",\n description:\n \"A printable invoice page — sender + recipient block, line items table, tax breakdown, totals, and payment instructions.\",\n source: { path: \"design-templates/invoice\" },\n targets: [\"report\"],\n },\n {\n id: \"template:kami-deck\",\n kind: \"template\",\n name: \"Kami Deck\",\n description:\n \"Produce a print-grade slide deck in the kami (紙 / 纸) design system — warm parchment background (or ink-blue for cover / chapter slides), serif at one weight, ink-blue accent ≤ 5% per slide, no italic. Horizontal magazine swipe pagination…\",\n source: { path: \"design-templates/kami-deck\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:kami-landing\",\n kind: \"template\",\n name: \"Kami Landing\",\n description:\n \"Produce a print-grade single-page kami (紙 / 纸) document — warm parchment canvas, ink-blue accent, serif at one weight, no italic, no cool grays. The output reads like a professional white paper or studio one-pager, not an app UI. Multili…\",\n source: { path: \"design-templates/kami-landing\" },\n targets: [\"website\"],\n },\n {\n id: \"template:kanban-board\",\n kind: \"template\",\n name: \"Kanban Board\",\n description:\n \"Kanban / task board with columns (To do / In progress / In review / Done), draggable-looking cards, assignee avatars, swimlanes, and a top filter bar.\",\n source: { path: \"design-templates/kanban-board\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:last30days\",\n kind: \"template\",\n name: \"Last30days\",\n description:\n \"Recent community and social trend research over the last 30 days.\",\n source: { path: \"design-templates/last30days\" },\n targets: [\"dashboard-design\", \"report\"],\n },\n {\n id: \"template:live-artifact\",\n kind: \"template\",\n name: \"Live Artifact\",\n description:\n \"Create refreshable, auditable artifacts backed by connector or local data. Trigger when the user asks for live dashboards, refreshable reports, synced views, or reusable data-backed artifacts.\",\n source: { path: \"design-templates/live-artifact\" },\n targets: [\"dashboard-design\", \"report\", \"website\"],\n },\n {\n id: \"template:live-dashboard\",\n kind: \"template\",\n name: \"Live Dashboard\",\n description:\n \"Notion-style team dashboard as a Live Artifact — KPIs, 7-day sparkline, activity feed, and a linked-database task table wired to Notion via Composio. Refreshable, with mock fallback.\",\n source: { path: \"design-templates/live-dashboard\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:magazine-poster\",\n kind: \"template\",\n name: \"Magazine Poster\",\n description:\n \"An editorial-style poster — newsprint paper, dateline, oversized serif headline with a struck-through word and italic accent, a 2-column body block, and 6 numbered sections with annotated pull-quote captions. Reads like a Sunday-paper fu…\",\n source: { path: \"design-templates/magazine-poster\" },\n targets: [\"poster\"],\n },\n {\n id: \"template:meeting-notes\",\n kind: \"template\",\n name: \"Meeting Notes\",\n description:\n 'Meeting notes page — title bar with attendees, agenda checklist, decisions block, action items table with owners + dates, and a \"next meeting\" footer.',\n source: { path: \"design-templates/meeting-notes\" },\n targets: [\"docs-design\"],\n },\n {\n id: \"template:mobile-onboarding\",\n kind: \"template\",\n name: \"Mobile Onboarding\",\n description:\n \"A multi-screen mobile onboarding flow rendered as three phone frames side by side — splash, value-prop, sign-in. Status bar, swipe dots, primary CTA.\",\n source: { path: \"design-templates/mobile-onboarding\" },\n targets: [\"mobile-app-design\"],\n },\n {\n id: \"template:motion-frames\",\n kind: \"template\",\n name: \"Motion Frames\",\n description:\n \"A single-frame motion-design composition with looping CSS animations — rotating type ring, animated globe, ticking timer, parallax labels. Renders as a hero video poster you can hand straight to HyperFrames or any keyframe-based exporter.\",\n source: { path: \"design-templates/motion-frames\" },\n targets: [\"intro-video\"],\n },\n {\n id: \"template:open-design-landing\",\n kind: \"template\",\n name: \"Editorial Landing\",\n description:\n \"Single-page editorial landing site in the Atelier Zero visual language (Monocle / Apartamento / Études collage). Composes from a typed inputs.json with optional gpt-image-2 assets.\",\n source: { path: \"design-templates/open-design-landing\" },\n targets: [\"website\"],\n },\n {\n id: \"template:open-design-landing-deck\",\n kind: \"template\",\n name: \"Editorial Landing Deck\",\n description:\n \"Single-file slide deck in the Atelier Zero visual language — warm-paper, italic-serif emphasis, coral terminating dots, surreal collage. Horizontal swipe + ESC overview grid.\",\n source: { path: \"design-templates/open-design-landing-deck\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:orbit-general\",\n kind: \"template\",\n name: \"Orbit General\",\n description:\n \"Open Orbit daily digest — pulls 24h activity from every connected connector (GitHub, Linear, Notion, Slack, …) into a bento-grid dashboard. Invoked by the Orbit scheduler.\",\n source: { path: \"design-templates/orbit-general\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:orbit-github\",\n kind: \"template\",\n name: \"Orbit Github\",\n description:\n \"Open Orbit GitHub digest — 24h of PRs, reviews, issues, CI, and merges rendered in GitHub's native Notifications + PR-diff visual language. Invoked by the Orbit scheduler.\",\n source: { path: \"design-templates/orbit-github\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:orbit-gmail\",\n kind: \"template\",\n name: \"Orbit Gmail\",\n description:\n \"Open Orbit Gmail digest — 24h of inbox activity (replies, mentions, cc, bulk) rendered as the Orbit Daily Digest email inside Gmail's reading view. Invoked by the Orbit scheduler.\",\n source: { path: \"design-templates/orbit-gmail\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:orbit-linear\",\n kind: \"template\",\n name: \"Orbit Linear\",\n description:\n \"Open Orbit Linear digest — 24h of issue movement, status changes, assignments, and cycle progress in Linear's native Inbox + cycle visual language. Invoked by the Orbit scheduler.\",\n source: { path: \"design-templates/orbit-linear\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:orbit-notion\",\n kind: \"template\",\n name: \"Orbit Notion\",\n description:\n \"Open Orbit Notion digest — 24h of doc edits, comments, mentions, and database row changes rendered as a native Notion page. Invoked by the Orbit scheduler.\",\n source: { path: \"design-templates/orbit-notion\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:pm-spec\",\n kind: \"template\",\n name: \"Pm Spec\",\n description:\n \"Product spec / PRD as a single page — problem, success metrics, scope, user stories, design notes, rollout plan, open questions.\",\n source: { path: \"design-templates/pm-spec\" },\n targets: [\"docs-design\"],\n },\n {\n id: \"template:pricing-page\",\n kind: \"template\",\n name: \"Pricing Page\",\n description:\n \"A standalone pricing page — header, plan tiers, feature comparison table, and an FAQ.\",\n source: { path: \"design-templates/pricing-page\" },\n targets: [\"website\"],\n },\n {\n id: \"template:replit-deck\",\n kind: \"template\",\n name: \"Replit Deck\",\n description:\n \"Single-file horizontal-swipe HTML deck in the style of Replit Slides's landing-page template gallery. Eight distinct themes (helix, holm, vance, bevel, world-dark, world-mint, atlas, bluehouse) — each a complete visual system (palette +…\",\n source: { path: \"design-templates/replit-deck\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:saas-landing\",\n kind: \"template\",\n name: \"Saas Landing\",\n description:\n \"Single-page SaaS landing with hero, features, social proof, pricing, and CTA. Respects the active DESIGN.md color/typography/layout tokens.\",\n source: { path: \"design-templates/saas-landing\" },\n targets: [\"website\"],\n },\n {\n id: \"template:simple-deck\",\n kind: \"template\",\n name: \"Simple Deck\",\n description:\n \"Single-file horizontal-swipe HTML deck. Built by copying the seed `assets/template.html` (which carries the proven 5-rule iframe nav script) and pasting slide layouts from `references/layouts.md`. Pitch decks, product overviews, study ma…\",\n source: { path: \"design-templates/simple-deck\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:social-carousel\",\n kind: \"template\",\n name: \"Social Carousel\",\n description:\n 'A three-card social-media carousel laid out as 1080×1080 squares — three cinematic, on-brand panels with display headlines that connect across the series (\"onwards.\" → \"to the next one.\" → \"looking ahead.\"). Each card has a brand mark, a…',\n source: { path: \"design-templates/social-carousel\" },\n targets: [\"poster\"],\n },\n {\n id: \"template:social-media-dashboard\",\n kind: \"template\",\n name: \"Social Media Dashboard\",\n description:\n 'Creator-facing social media analytics dashboard in a single HTML file. A platform switcher (X / LinkedIn / YouTube / Instagram), a row of KPI cards (followers, engagement rate, likes, reposts), a follower-growth chart, a \"top post this w…',\n source: { path: \"design-templates/social-media-dashboard\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:social-media-matrix-tracker-template\",\n kind: \"template\",\n name: \"Social Media Matrix Tracker Template\",\n description: \"社媒矩阵数据追踪面板模板(Social Media Matrix Tracker)。\",\n source: { path: \"design-templates/social-media-matrix-tracker-template\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:sprite-animation\",\n kind: \"template\",\n name: \"Sprite Animation\",\n description:\n \"A pixel / sprite-style animated explainer slide — full-bleed cream stage, bold display year, animated pixel-art mascot (e.g. Hanafuda card, mushroom, or 8-bit console), kinetic Japanese display type, ticking timeline ribbon. Reads like a…\",\n source: { path: \"design-templates/sprite-animation\" },\n targets: [\"intro-video\"],\n },\n {\n id: \"template:team-okrs\",\n kind: \"template\",\n name: \"Team Okrs\",\n description:\n 'OKR tracker page — quarter banner, three objectives with their key results as progress bars, owner avatars, status pills, and a \"this quarter at a glance\" sidebar.',\n source: { path: \"design-templates/team-okrs\" },\n targets: [\"docs-design\", \"dashboard-design\"],\n },\n {\n id: \"template:trading-analysis-dashboard-template\",\n kind: \"template\",\n name: \"Trading Analysis Dashboard Template\",\n description:\n \"Professional trading analysis dashboard template (single-file HTML) with light/dark theme switch, dense market panels, chart interactions, demo/live playback, and command palette behavior.\",\n source: { path: \"design-templates/trading-analysis-dashboard-template\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:tweaks\",\n kind: \"template\",\n name: \"Tweaks\",\n description:\n \"Wrap any HTML artifact with a side panel of live, parameterized controls — accent color, type scale, density, motion, theme — that rewrite CSS custom properties in real time and persist to localStorage. Lets the user explore variants of…\",\n source: { path: \"design-templates/tweaks\" },\n targets: [\n \"website\",\n \"dashboard-design\",\n \"presentation\",\n \"report\",\n \"docs-design\",\n \"poster\",\n \"mobile-app-design\",\n ],\n },\n {\n id: \"template:video-shortform\",\n kind: \"template\",\n name: \"Video Shortform\",\n description:\n \"Short-form video generation skill — 3-10 second clips for product reveals, motion teasers, ambient loops. Defaults to Seedance 2 but works the same with Kling 3 / 4, Veo 3 or Sora 2. Output is one MP4 saved to the project folder. When th…\",\n source: { path: \"design-templates/video-shortform\" },\n targets: [\"intro-video\"],\n },\n {\n id: \"template:waitlist-page\",\n kind: \"template\",\n name: \"Waitlist Page\",\n description:\n \"Minimal pre-launch landing with email capture, brand logo, and optional decorative layer. Reads DESIGN.md for colors, typography, and layout rules.\",\n source: { path: \"design-templates/waitlist-page\" },\n targets: [\"website\"],\n },\n {\n id: \"template:web-prototype\",\n kind: \"template\",\n name: \"Web Prototype\",\n description:\n \"General-purpose desktop web prototype. Single self-contained HTML file built by copying the seed `assets/template.html` and pasting section layouts from `references/layouts.md`. Default for any landing / marketing / docs / SaaS page when…\",\n source: { path: \"design-templates/web-prototype\" },\n targets: [\"website\"],\n },\n {\n id: \"template:web-prototype-taste-brutalist\",\n kind: \"template\",\n name: \"Web Prototype Taste Brutalist\",\n description:\n \"Swiss industrial-print web prototype. Newsprint canvas, monolithic black grotesque, viewport-bleeding numerals, hairline grid dividers, hazard-red accent, ASCII syntax decoration. Distilled from Leonxlnx/taste-skill `brutalist-skill` (Sw…\",\n source: { path: \"design-templates/web-prototype-taste-brutalist\" },\n targets: [\"website\"],\n },\n {\n id: \"template:web-prototype-taste-soft\",\n kind: \"template\",\n name: \"Web Prototype Taste Soft\",\n description:\n \"Apple-tier soft web prototype. Silver/cream canvas, double-bezel cards, button-in-button CTAs, generous squircle radii, spring motion, ambient mesh. Distilled from Leonxlnx/taste-skill `soft-skill` + sections 4–8 of `taste-skill`.\",\n source: { path: \"design-templates/web-prototype-taste-soft\" },\n targets: [\"website\"],\n },\n {\n id: \"template:wireframe-sketch\",\n kind: \"template\",\n name: \"Wireframe Sketch\",\n description:\n \"A hand-drawn wireframe exploration — graph-paper background, marker / pencil tone, multiple tab labels for variants, sticky-note annotations, scribbled chart placeholders, hatched fills. Reads like a designer's whiteboard before any pixe…\",\n source: { path: \"design-templates/wireframe-sketch\" },\n targets: [\"website\", \"mobile-app-design\", \"dashboard-design\"],\n },\n {\n id: \"template:x-research\",\n kind: \"template\",\n name: \"X Research\",\n description:\n \"X/Twitter public sentiment research for recent market, company, product, or community discourse.\",\n source: { path: \"design-templates/x-research\" },\n targets: [\"report\"],\n },\n {\n id: \"design-system:dashboard\",\n kind: \"design-system\",\n name: \"Dashboard\",\n description:\n \"Dark cloud-platform aesthetic with modular grids, glass-like panels, and strong data hierarchy for productivity dashboards.\",\n source: { path: \"design-systems/dashboard\" },\n },\n {\n id: \"design-system:trading-terminal\",\n kind: \"design-system\",\n name: \"Trading Terminal\",\n description:\n \"Bloomberg-style financial trading terminal: dark-only, data-dense, with cyan and coral buy/sell signals readable at a glance.\",\n source: { path: \"design-systems/trading-terminal\" },\n },\n {\n id: \"design-system:warm-editorial\",\n kind: \"design-system\",\n name: \"Warm Editorial\",\n description:\n \"Serif-led magazine aesthetic with terracotta accents on warm off-white paper for readable narrative pages, zines, and reports.\",\n source: { path: \"design-systems/warm-editorial\" },\n },\n {\n id: \"design-system:editorial\",\n kind: \"design-system\",\n name: \"Editorial\",\n description:\n \"Magazine-inspired editorial layout with refined serif typography, structured grids, and elegant reading experiences.\",\n source: { path: \"design-systems/editorial\" },\n },\n {\n id: \"design-system:mono\",\n kind: \"design-system\",\n name: \"Mono\",\n description:\n \"Monospace-driven, matrix-inspired design with high-contrast elements, compact density, and a hacker-chic aesthetic.\",\n source: { path: \"design-systems/mono\" },\n },\n {\n id: \"design-system:apple\",\n kind: \"design-system\",\n name: \"Apple\",\n description:\n \"Consumer electronics design system with premium white space, SF Pro-style typography, and cinematic imagery.\",\n source: { path: \"design-systems/apple\" },\n },\n {\n id: \"design-system:agentic\",\n kind: \"design-system\",\n name: \"Agentic\",\n description:\n \"Conversational AI-first interface with minimal controls, clear outcomes, and delegated task flows for agentic workflows.\",\n source: { path: \"design-systems/agentic\" },\n },\n {\n id: \"design-system:airbnb\",\n kind: \"design-system\",\n name: \"Airbnb\",\n description:\n \"Travel marketplace. Warm coral accent, photography-driven, rounded UI.\",\n source: { path: \"design-systems/airbnb\" },\n },\n {\n id: \"design-system:airtable\",\n kind: \"design-system\",\n name: \"Airtable\",\n description:\n \"Spreadsheet-database hybrid. Colorful, friendly, structured data aesthetic.\",\n source: { path: \"design-systems/airtable\" },\n },\n {\n id: \"design-system:ant\",\n kind: \"design-system\",\n name: \"Ant\",\n description:\n \"Structured, enterprise-focused design system emphasizing clarity, consistency, and efficiency for data-dense web applications.\",\n source: { path: \"design-systems/ant\" },\n },\n {\n id: \"design-system:application\",\n kind: \"design-system\",\n name: \"Application\",\n description:\n \"App dashboard with purple-themed aesthetic, top-bar navigation, card-based layouts, and developer-first workflows.\",\n source: { path: \"design-systems/application\" },\n },\n {\n id: \"design-system:arc\",\n kind: \"design-system\",\n name: \"Arc\",\n description:\n '\"The browser that browses for you.\" Translucent surfaces, gradient warmth, sidebar-first layout.',\n source: { path: \"design-systems/arc\" },\n },\n {\n id: \"design-system:artistic\",\n kind: \"design-system\",\n name: \"Artistic\",\n description:\n \"High-contrast, expressive style with creative typography and bold color choices for visually striking interfaces.\",\n source: { path: \"design-systems/artistic\" },\n },\n {\n id: \"design-system:atelier-zero\",\n kind: \"design-system\",\n name: \"Atelier Zero\",\n description:\n \"A magazine-grade, collage-driven visual system: warm paper canvas, surreal.\",\n source: { path: \"design-systems/atelier-zero\" },\n },\n {\n id: \"design-system:bento\",\n kind: \"design-system\",\n name: \"Bento\",\n description:\n \"Modular grid layout with card-like blocks, clear hierarchy, soft spacing, and subtle visual contrast for organized, scannable interfaces.\",\n source: { path: \"design-systems/bento\" },\n },\n {\n id: \"design-system:binance\",\n kind: \"design-system\",\n name: \"Binance\",\n description:\n \"Crypto exchange. Bold yellow accent on monochrome, trading-floor urgency.\",\n source: { path: \"design-systems/binance\" },\n },\n {\n id: \"design-system:bmw\",\n kind: \"design-system\",\n name: \"Bmw\",\n description:\n \"Luxury automotive. Dark premium surfaces, precise German engineering aesthetic.\",\n source: { path: \"design-systems/bmw\" },\n },\n {\n id: \"design-system:bmw-m\",\n kind: \"design-system\",\n name: \"Bmw M\",\n description:\n \"Motorsport performance sub-brand. Near-black cockpit surfaces, BMW M tricolor accents, sharp engineering geometry.\",\n source: { path: \"design-systems/bmw-m\" },\n },\n {\n id: \"design-system:bold\",\n kind: \"design-system\",\n name: \"Bold\",\n description:\n \"Strong visual presence with heavyweight typography, high-contrast colors, and commanding layouts.\",\n source: { path: \"design-systems/bold\" },\n },\n {\n id: \"design-system:brutalism\",\n kind: \"design-system\",\n name: \"Brutalism\",\n description:\n \"Raw, anti-design aesthetic inspired by concrete architecture with unadorned elements, jarring layouts, and functional minimalism.\",\n source: { path: \"design-systems/brutalism\" },\n },\n {\n id: \"design-system:bugatti\",\n kind: \"design-system\",\n name: \"Bugatti\",\n description:\n \"Hypercar brand. Cinema-black canvas, monochrome austerity, monumental display type.\",\n source: { path: \"design-systems/bugatti\" },\n },\n {\n id: \"design-system:cafe\",\n kind: \"design-system\",\n name: \"Cafe\",\n description:\n \"Cozy cafe-inspired interface with warm tones, soft typography, and clean layouts for a relaxed browsing experience.\",\n source: { path: \"design-systems/cafe\" },\n },\n {\n id: \"design-system:cal\",\n kind: \"design-system\",\n name: \"Cal\",\n description:\n \"Open-source scheduling. Clean neutral UI, developer-oriented simplicity.\",\n source: { path: \"design-systems/cal\" },\n },\n {\n id: \"design-system:canva\",\n kind: \"design-system\",\n name: \"Canva\",\n description:\n \"Visual creation platform. Vivid purple-blue gradient, generous spacing, friendly geometry.\",\n source: { path: \"design-systems/canva\" },\n },\n {\n id: \"design-system:cisco\",\n kind: \"design-system\",\n name: \"Cisco\",\n description:\n \"Enterprise infrastructure brand. Dark trust surfaces, Cisco Blue signal, technical clarity.\",\n source: { path: \"design-systems/cisco\" },\n },\n {\n id: \"design-system:claude\",\n kind: \"design-system\",\n name: \"Claude\",\n description:\n \"Anthropic's AI assistant. Warm terracotta accent, clean editorial layout.\",\n source: { path: \"design-systems/claude\" },\n },\n {\n id: \"design-system:clay\",\n kind: \"design-system\",\n name: \"Clay\",\n description:\n \"Creative agency. Organic shapes, soft gradients, art-directed layout.\",\n source: { path: \"design-systems/clay\" },\n },\n {\n id: \"design-system:claymorphism\",\n kind: \"design-system\",\n name: \"Claymorphism\",\n description:\n \"Soft, rounded 3D-like shapes mimicking malleable clay with playful, puffy elements and colorful surfaces.\",\n source: { path: \"design-systems/claymorphism\" },\n },\n {\n id: \"design-system:clean\",\n kind: \"design-system\",\n name: \"Clean\",\n description:\n \"Simplicity-focused design with ample whitespace, legible typography, and a limited color palette to reduce visual clutter.\",\n source: { path: \"design-systems/clean\" },\n },\n {\n id: \"design-system:clickhouse\",\n kind: \"design-system\",\n name: \"Clickhouse\",\n description:\n \"Fast analytics database. Yellow-accented, technical documentation style.\",\n source: { path: \"design-systems/clickhouse\" },\n },\n {\n id: \"design-system:cohere\",\n kind: \"design-system\",\n name: \"Cohere\",\n description:\n \"Enterprise AI platform. Vibrant gradients, data-rich dashboard aesthetic.\",\n source: { path: \"design-systems/cohere\" },\n },\n {\n id: \"design-system:coinbase\",\n kind: \"design-system\",\n name: \"Coinbase\",\n description:\n \"Crypto exchange. Clean blue identity, trust-focused, institutional feel.\",\n source: { path: \"design-systems/coinbase\" },\n },\n {\n id: \"design-system:colorful\",\n kind: \"design-system\",\n name: \"Colorful\",\n description:\n \"Vibrant, high-contrast palettes and gradients for engaging, memorable, and modern user experiences.\",\n source: { path: \"design-systems/colorful\" },\n },\n {\n id: \"design-system:composio\",\n kind: \"design-system\",\n name: \"Composio\",\n description:\n \"Tool integration platform. Modern dark with colorful integration icons.\",\n source: { path: \"design-systems/composio\" },\n },\n {\n id: \"design-system:contemporary\",\n kind: \"design-system\",\n name: \"Contemporary\",\n description:\n \"Current-era minimalist design with bento grids, dark mode support, and high-performance accessible layouts.\",\n source: { path: \"design-systems/contemporary\" },\n },\n {\n id: \"design-system:corporate\",\n kind: \"design-system\",\n name: \"Corporate\",\n description:\n \"Professional, brand-aligned design with structured grids, minimalist layouts, and consistent enterprise patterns.\",\n source: { path: \"design-systems/corporate\" },\n },\n {\n id: \"design-system:cosmic\",\n kind: \"design-system\",\n name: \"Cosmic\",\n description:\n \"Futuristic sci-fi aesthetic with dark themes, vibrant neon accents, and immersive spatial elements.\",\n source: { path: \"design-systems/cosmic\" },\n },\n {\n id: \"design-system:creative\",\n kind: \"design-system\",\n name: \"Creative\",\n description:\n \"Playful, character-driven design with expressive typography and bold graphics for landing pages and creative projects.\",\n source: { path: \"design-systems/creative\" },\n },\n {\n id: \"design-system:cursor\",\n kind: \"design-system\",\n name: \"Cursor\",\n description:\n \"AI-first code editor. Sleek dark interface, gradient accents.\",\n source: { path: \"design-systems/cursor\" },\n },\n {\n id: \"design-system:default\",\n kind: \"design-system\",\n name: \"Default\",\n description: \"A clean, product-oriented default.\",\n source: { path: \"design-systems/default\" },\n },\n {\n id: \"design-system:discord\",\n kind: \"design-system\",\n name: \"Discord\",\n description:\n \"Voice / chat platform. Deep blurple, dark-first surfaces, playful accent moments.\",\n source: { path: \"design-systems/discord\" },\n },\n {\n id: \"design-system:dithered\",\n kind: \"design-system\",\n name: \"Dithered\",\n description:\n \"Dot-pattern rendering technique that simulates shades with a limited palette for nostalgic, retro, high-contrast visuals.\",\n source: { path: \"design-systems/dithered\" },\n },\n {\n id: \"design-system:doodle\",\n kind: \"design-system\",\n name: \"Doodle\",\n description:\n \"Hand-drawn, sketch-like style with doodles, handwritten fonts, and imperfect lines for a playful, informal feel.\",\n source: { path: \"design-systems/doodle\" },\n },\n {\n id: \"design-system:dramatic\",\n kind: \"design-system\",\n name: \"Dramatic\",\n description:\n \"High-contrast, theatrical design with bold layouts, immersive visuals, and unconventional compositions that command attention.\",\n source: { path: \"design-systems/dramatic\" },\n },\n {\n id: \"design-system:duolingo\",\n kind: \"design-system\",\n name: \"Duolingo\",\n description:\n \"Language-learning platform. Bright owl green, chunky shadows, gamified joy.\",\n source: { path: \"design-systems/duolingo\" },\n },\n {\n id: \"design-system:elegant\",\n kind: \"design-system\",\n name: \"Elegant\",\n description:\n \"Graceful, refined aesthetic with delicate typography, minimal palettes, and polished layouts that exude sophistication.\",\n source: { path: \"design-systems/elegant\" },\n },\n {\n id: \"design-system:elevenlabs\",\n kind: \"design-system\",\n name: \"Elevenlabs\",\n description:\n \"AI voice platform. Dark cinematic UI, audio-waveform aesthetics.\",\n source: { path: \"design-systems/elevenlabs\" },\n },\n {\n id: \"design-system:energetic\",\n kind: \"design-system\",\n name: \"Energetic\",\n description:\n \"Dynamic, vibrant style with thick borders, geometric shapes, high-contrast colors, and expressive typography conveying motion and vitality.\",\n source: { path: \"design-systems/energetic\" },\n },\n {\n id: \"design-system:enterprise\",\n kind: \"design-system\",\n name: \"Enterprise\",\n description:\n \"Clean, high-contrast enterprise design for data-driven workflows with intuitive drag-and-drop patterns and structured layouts.\",\n source: { path: \"design-systems/enterprise\" },\n },\n {\n id: \"design-system:expo\",\n kind: \"design-system\",\n name: \"Expo\",\n description:\n \"React Native platform. Dark theme, tight letter-spacing, code-centric.\",\n source: { path: \"design-systems/expo\" },\n },\n {\n id: \"design-system:expressive\",\n kind: \"design-system\",\n name: \"Expressive\",\n description:\n \"Vibrant, personality-driven design with bold colors, playful graphics, and dynamic layouts that balance creativity with structure.\",\n source: { path: \"design-systems/expressive\" },\n },\n {\n id: \"design-system:fantasy\",\n kind: \"design-system\",\n name: \"Fantasy\",\n description:\n \"Game-inspired fantasy aesthetic with bold, premium visuals, rich color palettes, and immersive thematic elements.\",\n source: { path: \"design-systems/fantasy\" },\n },\n {\n id: \"design-system:ferrari\",\n kind: \"design-system\",\n name: \"Ferrari\",\n description:\n \"Luxury automotive. Chiaroscuro editorial, Ferrari Red accents, cinematic black.\",\n source: { path: \"design-systems/ferrari\" },\n },\n {\n id: \"design-system:figma\",\n kind: \"design-system\",\n name: \"Figma\",\n description:\n \"Collaborative design tool. Vibrant multi-color, playful yet professional.\",\n source: { path: \"design-systems/figma\" },\n },\n {\n id: \"design-system:flat\",\n kind: \"design-system\",\n name: \"Flat\",\n description:\n \"Two-dimensional minimalist style with vibrant colors, clean typography, and no 3D effects for fast, user-friendly interfaces.\",\n source: { path: \"design-systems/flat\" },\n },\n {\n id: \"design-system:framer\",\n kind: \"design-system\",\n name: \"Framer\",\n description:\n \"Website builder. Bold black and blue, motion-first, design-forward.\",\n source: { path: \"design-systems/framer\" },\n },\n {\n id: \"design-system:friendly\",\n kind: \"design-system\",\n name: \"Friendly\",\n description:\n \"Approachable, intuitive design with rounded elements, ample whitespace, and soft pastel color palettes.\",\n source: { path: \"design-systems/friendly\" },\n },\n {\n id: \"design-system:futuristic\",\n kind: \"design-system\",\n name: \"Futuristic\",\n description:\n \"Forward-looking design with tech-inspired typography, modern layouts, and a sleek, innovation-driven aesthetic.\",\n source: { path: \"design-systems/futuristic\" },\n },\n {\n id: \"design-system:github\",\n kind: \"design-system\",\n name: \"Github\",\n description:\n \"Code-forward platform. Functional density, blue-on-white precision, Primer foundations.\",\n source: { path: \"design-systems/github\" },\n },\n {\n id: \"design-system:glassmorphism\",\n kind: \"design-system\",\n name: \"Glassmorphism\",\n description:\n \"Frosted glass effect with translucent layers, subtle blur, and luminous borders for depth and modern elegance.\",\n source: { path: \"design-systems/glassmorphism\" },\n },\n {\n id: \"design-system:gradient\",\n kind: \"design-system\",\n name: \"Gradient\",\n description:\n \"Smooth color transitions and gradient-rich surfaces for modern, playful interfaces with visual depth.\",\n source: { path: \"design-systems/gradient\" },\n },\n {\n id: \"design-system:hashicorp\",\n kind: \"design-system\",\n name: \"Hashicorp\",\n description:\n \"Infrastructure automation. Enterprise-clean, black and white.\",\n source: { path: \"design-systems/hashicorp\" },\n },\n {\n id: \"design-system:hud\",\n kind: \"design-system\",\n name: \"Hud\",\n description:\n \"Fighter jet / helicopter head-up display. Phosphor green on near-black, all-caps data overlays, angular geometry. Zero ambiguity at speed and altitude.\",\n source: { path: \"design-systems/hud\" },\n },\n {\n id: \"design-system:huggingface\",\n kind: \"design-system\",\n name: \"Huggingface\",\n description:\n \"ML community hub. Sunny yellow accent, monospace identity, cheerful and dense.\",\n source: { path: \"design-systems/huggingface\" },\n },\n {\n id: \"design-system:ibm\",\n kind: \"design-system\",\n name: \"Ibm\",\n description:\n \"Enterprise technology. Carbon design system, structured blue palette.\",\n source: { path: \"design-systems/ibm\" },\n },\n {\n id: \"design-system:intercom\",\n kind: \"design-system\",\n name: \"Intercom\",\n description:\n \"Customer messaging. Friendly blue palette, conversational UI patterns.\",\n source: { path: \"design-systems/intercom\" },\n },\n {\n id: \"design-system:kami\",\n kind: \"design-system\",\n name: \"Kami\",\n description:\n \"Editorial paper system: warm parchment canvas, ink-blue accent, serif-led hierarchy. Built for resumes, one-pagers, white papers, portfolios, slide decks — anything that should feel like high-quality print rather than UI. Multilingual by…\",\n source: { path: \"design-systems/kami\" },\n },\n {\n id: \"design-system:kraken\",\n kind: \"design-system\",\n name: \"Kraken\",\n description:\n \"Crypto trading. Purple-accented dark UI, data-dense dashboards.\",\n source: { path: \"design-systems/kraken\" },\n },\n {\n id: \"design-system:lamborghini\",\n kind: \"design-system\",\n name: \"Lamborghini\",\n description:\n \"Supercar brand. True black surfaces, gold accents, dramatic uppercase typography.\",\n source: { path: \"design-systems/lamborghini\" },\n },\n {\n id: \"design-system:levels\",\n kind: \"design-system\",\n name: \"Levels\",\n description:\n \"Conversion-focused design that removes friction and guides users toward action through clarity, trust, and speed.\",\n source: { path: \"design-systems/levels\" },\n },\n {\n id: \"design-system:linear-app\",\n kind: \"design-system\",\n name: \"Linear App\",\n description: \"Project management. Ultra-minimal, precise, purple accent.\",\n source: { path: \"design-systems/linear-app\" },\n },\n {\n id: \"design-system:lingo\",\n kind: \"design-system\",\n name: \"Lingo\",\n description:\n \"Playful, minimal design with bright colors, rounded shapes, tactile 3D borders, and friendly illustrations for approachable interfaces.\",\n source: { path: \"design-systems/lingo\" },\n },\n {\n id: \"design-system:loom\",\n kind: \"design-system\",\n name: \"Loom\",\n description:\n \"Loom async video. Purple primary, friendly surfaces, video-first layout. Clean and professional without being corporate.\",\n source: { path: \"design-systems/loom\" },\n },\n {\n id: \"design-system:lovable\",\n kind: \"design-system\",\n name: \"Lovable\",\n description:\n \"AI full-stack builder. Playful gradients, friendly dev aesthetic.\",\n source: { path: \"design-systems/lovable\" },\n },\n {\n id: \"design-system:luxury\",\n kind: \"design-system\",\n name: \"Luxury\",\n description:\n \"High-end dark aesthetic with bold headings, monochromatic palette, and premium feel for luxury brand experiences.\",\n source: { path: \"design-systems/luxury\" },\n },\n {\n id: \"design-system:mastercard\",\n kind: \"design-system\",\n name: \"Mastercard\",\n description:\n \"Global payments network. Warm cream canvas, orbital pill shapes, editorial warmth.\",\n source: { path: \"design-systems/mastercard\" },\n },\n {\n id: \"design-system:material\",\n kind: \"design-system\",\n name: \"Material\",\n description:\n \"Google's Material Design with layered surfaces, dynamic theming, built-in motion, and responsive cross-platform patterns.\",\n source: { path: \"design-systems/material\" },\n },\n {\n id: \"design-system:meta\",\n kind: \"design-system\",\n name: \"Meta\",\n description:\n \"Tech retail store. Photography-first, binary light/dark surfaces, Meta Blue CTAs.\",\n source: { path: \"design-systems/meta\" },\n },\n {\n id: \"design-system:minimal\",\n kind: \"design-system\",\n name: \"Minimal\",\n description:\n \"Stripped-back design emphasizing whitespace, clean typography, and restrained color for maximum clarity and focus.\",\n source: { path: \"design-systems/minimal\" },\n },\n {\n id: \"design-system:minimax\",\n kind: \"design-system\",\n name: \"Minimax\",\n description: \"AI model provider. Bold dark interface with neon accents.\",\n source: { path: \"design-systems/minimax\" },\n },\n {\n id: \"design-system:mintlify\",\n kind: \"design-system\",\n name: \"Mintlify\",\n description:\n \"Documentation platform. Clean, green-accented, reading-optimized.\",\n source: { path: \"design-systems/mintlify\" },\n },\n {\n id: \"design-system:miro\",\n kind: \"design-system\",\n name: \"Miro\",\n description:\n \"Visual collaboration. Bright yellow accent, infinite canvas aesthetic.\",\n source: { path: \"design-systems/miro\" },\n },\n {\n id: \"design-system:mission-control\",\n kind: \"design-system\",\n name: \"Mission Control\",\n description:\n \"Space/aerospace mission monitoring. Dark command center, amber telemetry, monospace precision. Functional clarity above all else.\",\n source: { path: \"design-systems/mission-control\" },\n },\n {\n id: \"design-system:mistral-ai\",\n kind: \"design-system\",\n name: \"Mistral AI\",\n description:\n \"Open-weight LLM provider. French-engineered minimalism, purple-toned.\",\n source: { path: \"design-systems/mistral-ai\" },\n },\n {\n id: \"design-system:modern\",\n kind: \"design-system\",\n name: \"Modern\",\n description:\n \"Contemporary editorial style with serif typography, minimal palettes, and clean layouts for polished digital products.\",\n source: { path: \"design-systems/modern\" },\n },\n {\n id: \"design-system:mongodb\",\n kind: \"design-system\",\n name: \"Mongodb\",\n description:\n \"Document database. Green leaf branding, developer documentation focus.\",\n source: { path: \"design-systems/mongodb\" },\n },\n {\n id: \"design-system:neobrutalism\",\n kind: \"design-system\",\n name: \"Neobrutalism\",\n description:\n \"Modern take on brutalism with bold borders, vivid accent colors, and raw, high-contrast layouts on warm surfaces.\",\n source: { path: \"design-systems/neobrutalism\" },\n },\n {\n id: \"design-system:neon\",\n kind: \"design-system\",\n name: \"Neon\",\n description:\n \"Electric neon glow effects with high-contrast color pairings for bold, attention-grabbing interfaces.\",\n source: { path: \"design-systems/neon\" },\n },\n {\n id: \"design-system:neumorphism\",\n kind: \"design-system\",\n name: \"Neumorphism\",\n description:\n \"Soft, extruded UI elements with inner and outer shadows on monochromatic surfaces for a tactile, embedded look.\",\n source: { path: \"design-systems/neumorphism\" },\n },\n {\n id: \"design-system:nike\",\n kind: \"design-system\",\n name: \"Nike\",\n description:\n \"Athletic retail. Monochrome UI, massive uppercase type, full-bleed photography.\",\n source: { path: \"design-systems/nike\" },\n },\n {\n id: \"design-system:notion\",\n kind: \"design-system\",\n name: \"Notion\",\n description:\n \"All-in-one workspace. Warm minimalism, serif headings, soft surfaces.\",\n source: { path: \"design-systems/notion\" },\n },\n {\n id: \"design-system:nvidia\",\n kind: \"design-system\",\n name: \"Nvidia\",\n description:\n \"GPU computing. Green-black energy, technical power aesthetic.\",\n source: { path: \"design-systems/nvidia\" },\n },\n {\n id: \"design-system:ollama\",\n kind: \"design-system\",\n name: \"Ollama\",\n description: \"Run LLMs locally. Terminal-first, monochrome simplicity.\",\n source: { path: \"design-systems/ollama\" },\n },\n {\n id: \"design-system:openai\",\n kind: \"design-system\",\n name: \"Openai\",\n description:\n \"Calm, near-monochrome system anchored in deep teal-black with generous white space and editorial typography.\",\n source: { path: \"design-systems/openai\" },\n },\n {\n id: \"design-system:opencode-ai\",\n kind: \"design-system\",\n name: \"Opencode AI\",\n description: \"AI coding platform. Developer-centric dark theme.\",\n source: { path: \"design-systems/opencode-ai\" },\n },\n {\n id: \"design-system:pacman\",\n kind: \"design-system\",\n name: \"Pacman\",\n description:\n \"Retro arcade-inspired design with pixel fonts, dotted borders, playful high-contrast colors, and 8-bit game aesthetics.\",\n source: { path: \"design-systems/pacman\" },\n },\n {\n id: \"design-system:paper\",\n kind: \"design-system\",\n name: \"Paper\",\n description:\n \"Paper-textured, print-inspired design with minimal colors, clean serif/sans typography, and tactile surface qualities.\",\n source: { path: \"design-systems/paper\" },\n },\n {\n id: \"design-system:perplexity\",\n kind: \"design-system\",\n name: \"Perplexity\",\n description:\n \"Conversational AI search engine. Deep-dark canvas, sharp typography, single violet accent, dense information hierarchy.\",\n source: { path: \"design-systems/perplexity\" },\n },\n {\n id: \"design-system:perspective\",\n kind: \"design-system\",\n name: \"Perspective\",\n description:\n \"Spatial depth design with isometric views, vanishing points, and layered elements that guide attention through 3D-like realism.\",\n source: { path: \"design-systems/perspective\" },\n },\n {\n id: \"design-system:pinterest\",\n kind: \"design-system\",\n name: \"Pinterest\",\n description: \"Visual discovery. Red accent, masonry grid, image-first.\",\n source: { path: \"design-systems/pinterest\" },\n },\n {\n id: \"design-system:playstation\",\n kind: \"design-system\",\n name: \"Playstation\",\n description:\n \"Gaming console retail. Three-surface channel layout, quiet-authority display type, cyan hover-scale.\",\n source: { path: \"design-systems/playstation\" },\n },\n {\n id: \"design-system:posthog\",\n kind: \"design-system\",\n name: \"Posthog\",\n description:\n \"Product analytics. Playful hedgehog branding, developer-friendly dark UI.\",\n source: { path: \"design-systems/posthog\" },\n },\n {\n id: \"design-system:premium\",\n kind: \"design-system\",\n name: \"Premium\",\n description:\n \"Apple-inspired premium aesthetic with precise spacing, modern typography, and a refined, polished visual language.\",\n source: { path: \"design-systems/premium\" },\n },\n {\n id: \"design-system:professional\",\n kind: \"design-system\",\n name: \"Professional\",\n description:\n \"Polished, business-ready design with modern typography, structured layouts, and a trustworthy visual identity.\",\n source: { path: \"design-systems/professional\" },\n },\n {\n id: \"design-system:publication\",\n kind: \"design-system\",\n name: \"Publication\",\n description:\n \"Print-inspired visual language for books, magazines, and reports with editorial grids and expressive typography.\",\n source: { path: \"design-systems/publication\" },\n },\n {\n id: \"design-system:raycast\",\n kind: \"design-system\",\n name: \"Raycast\",\n description:\n \"Productivity launcher. Sleek dark chrome, vibrant gradient accents.\",\n source: { path: \"design-systems/raycast\" },\n },\n {\n id: \"design-system:refined\",\n kind: \"design-system\",\n name: \"Refined\",\n description:\n \"Carefully curated, modern minimal style with elegant serif typography and understated, sophisticated palettes.\",\n source: { path: \"design-systems/refined\" },\n },\n {\n id: \"design-system:renault\",\n kind: \"design-system\",\n name: \"Renault\",\n description:\n \"French automotive. Vibrant aurora gradients, NouvelR typography, bold energy.\",\n source: { path: \"design-systems/renault\" },\n },\n {\n id: \"design-system:replicate\",\n kind: \"design-system\",\n name: \"Replicate\",\n description: \"Run ML models via API. Clean white canvas, code-forward.\",\n source: { path: \"design-systems/replicate\" },\n },\n {\n id: \"design-system:resend\",\n kind: \"design-system\",\n name: \"Resend\",\n description: \"Email API. Minimal dark theme, monospace accents.\",\n source: { path: \"design-systems/resend\" },\n },\n {\n id: \"design-system:retro\",\n kind: \"design-system\",\n name: \"Retro\",\n description:\n \"Throwback design with vintage-inspired typography, high-contrast retro palettes, and nostalgic visual elements.\",\n source: { path: \"design-systems/retro\" },\n },\n {\n id: \"design-system:revolut\",\n kind: \"design-system\",\n name: \"Revolut\",\n description:\n \"Digital banking. Sleek dark interface, gradient cards, fintech precision.\",\n source: { path: \"design-systems/revolut\" },\n },\n {\n id: \"design-system:runwayml\",\n kind: \"design-system\",\n name: \"Runwayml\",\n description: \"AI video generation. Cinematic dark UI, media-rich layout.\",\n source: { path: \"design-systems/runwayml\" },\n },\n {\n id: \"design-system:sanity\",\n kind: \"design-system\",\n name: \"Sanity\",\n description: \"Headless CMS. Red accent, content-first editorial layout.\",\n source: { path: \"design-systems/sanity\" },\n },\n {\n id: \"design-system:sentry\",\n kind: \"design-system\",\n name: \"Sentry\",\n description:\n \"Error monitoring. Dark dashboard, data-dense, pink-purple accent.\",\n source: { path: \"design-systems/sentry\" },\n },\n {\n id: \"design-system:shadcn\",\n kind: \"design-system\",\n name: \"Shadcn\",\n description:\n \"Shadcn/ui-inspired design with minimal, clean components, monochrome palette, and utility-first patterns.\",\n source: { path: \"design-systems/shadcn\" },\n },\n {\n id: \"design-system:shopify\",\n kind: \"design-system\",\n name: \"Shopify\",\n description:\n \"E-commerce platform. Dark-first cinematic, neon green accent, ultra-light type.\",\n source: { path: \"design-systems/shopify\" },\n },\n {\n id: \"design-system:simple\",\n kind: \"design-system\",\n name: \"Simple\",\n description:\n \"Straightforward, no-frills design with clean typography, neutral colors, and intuitive layouts that stay out of the way.\",\n source: { path: \"design-systems/simple\" },\n },\n {\n id: \"design-system:skeumorphism\",\n kind: \"design-system\",\n name: \"Skeumorphism\",\n description:\n \"Real-world mimicry with textured surfaces, 3D effects, and familiar physical metaphors for intuitive digital interfaces.\",\n source: { path: \"design-systems/skeumorphism\" },\n },\n {\n id: \"design-system:slack\",\n kind: \"design-system\",\n name: \"Slack\",\n description:\n \"Workplace communication platform. Aubergine-primary, multi-accent logo palette, light surfaces with dark sidebar, warm and approachable.\",\n source: { path: \"design-systems/slack\" },\n },\n {\n id: \"design-system:sleek\",\n kind: \"design-system\",\n name: \"Sleek\",\n description:\n \"Modern minimalist aesthetic with clean lines, intentional color palette, subtle interactions, and consistent spacing.\",\n source: { path: \"design-systems/sleek\" },\n },\n {\n id: \"design-system:spacex\",\n kind: \"design-system\",\n name: \"Spacex\",\n description:\n \"Space technology. Stark black and white, full-bleed imagery, futuristic.\",\n source: { path: \"design-systems/spacex\" },\n },\n {\n id: \"design-system:spacious\",\n kind: \"design-system\",\n name: \"Spacious\",\n description:\n \"Generous whitespace, consistent padding, and grid-based layouts for clean, readable, and breathing interfaces.\",\n source: { path: \"design-systems/spacious\" },\n },\n {\n id: \"design-system:spotify\",\n kind: \"design-system\",\n name: \"Spotify\",\n description:\n \"Music streaming. Vibrant green on dark, bold type, album-art-driven.\",\n source: { path: \"design-systems/spotify\" },\n },\n {\n id: \"design-system:starbucks\",\n kind: \"design-system\",\n name: \"Starbucks\",\n description:\n \"Global coffee retail brand. Four-tier green system, warm cream canvas, full-pill buttons.\",\n source: { path: \"design-systems/starbucks\" },\n },\n {\n id: \"design-system:storytelling\",\n kind: \"design-system\",\n name: \"Storytelling\",\n description:\n \"Narrative-driven design using visuals, copy, and interaction to guide users through engaging, emotionally resonant journeys.\",\n source: { path: \"design-systems/storytelling\" },\n },\n {\n id: \"design-system:stripe\",\n kind: \"design-system\",\n name: \"Stripe\",\n description:\n \"Payment infrastructure. Signature purple gradients, weight-300 elegance.\",\n source: { path: \"design-systems/stripe\" },\n },\n {\n id: \"design-system:supabase\",\n kind: \"design-system\",\n name: \"Supabase\",\n description:\n \"Open-source Firebase alternative. Dark emerald theme, code-first.\",\n source: { path: \"design-systems/supabase\" },\n },\n {\n id: \"design-system:superhuman\",\n kind: \"design-system\",\n name: \"Superhuman\",\n description:\n \"Fast email client. Premium dark UI, keyboard-first, purple glow.\",\n source: { path: \"design-systems/superhuman\" },\n },\n {\n id: \"design-system:tesla\",\n kind: \"design-system\",\n name: \"Tesla\",\n description:\n \"Electric automotive. Radical subtraction, full-viewport photography, near-zero UI.\",\n source: { path: \"design-systems/tesla\" },\n },\n {\n id: \"design-system:tetris\",\n kind: \"design-system\",\n name: \"Tetris\",\n description:\n \"Classic block-game inspired design with playful colors, bold display fonts, and compact, high-energy layouts.\",\n source: { path: \"design-systems/tetris\" },\n },\n {\n id: \"design-system:theverge\",\n kind: \"design-system\",\n name: \"Theverge\",\n description:\n \"Tech editorial media. Acid-mint and ultraviolet accents, Manuka display, rave-flyer story tiles.\",\n source: { path: \"design-systems/theverge\" },\n },\n {\n id: \"design-system:together-ai\",\n kind: \"design-system\",\n name: \"Together AI\",\n description:\n \"Open-source AI infrastructure. Technical, blueprint-style design.\",\n source: { path: \"design-systems/together-ai\" },\n },\n {\n id: \"design-system:totality-festival\",\n kind: \"design-system\",\n name: \"Totality Festival\",\n description:\n 'A cosmic-premium, glassmorphic dark system that captures the visceral awe of a solar eclipse — obsidian surfaces, amber \"corona\" highlights, and cyan atmospheric accents.',\n source: { path: \"design-systems/totality-festival\" },\n },\n {\n id: \"design-system:uber\",\n kind: \"design-system\",\n name: \"Uber\",\n description:\n \"Mobility platform. Bold black and white, tight type, urban energy.\",\n source: { path: \"design-systems/uber\" },\n },\n {\n id: \"design-system:urdu\",\n kind: \"design-system\",\n name: \"Urdu\",\n description:\n \"Urdu-first digital experiences with native RTL support,Nastaliq typography, and bilingual harmony.\",\n source: { path: \"design-systems/urdu\" },\n },\n {\n id: \"design-system:vercel\",\n kind: \"design-system\",\n name: \"Vercel\",\n description: \"Frontend deployment. Black and white precision, Geist font.\",\n source: { path: \"design-systems/vercel\" },\n },\n {\n id: \"design-system:vibrant\",\n kind: \"design-system\",\n name: \"Vibrant\",\n description:\n \"Lively, colorful design with bold playful typography, warm accents, and dynamic visual energy.\",\n source: { path: \"design-systems/vibrant\" },\n },\n {\n id: \"design-system:vintage\",\n kind: \"design-system\",\n name: \"Vintage\",\n description:\n \"1950s-1990s nostalgia with skeuomorphic touches, grainy textures, retro color palettes, and pixel-style typography.\",\n source: { path: \"design-systems/vintage\" },\n },\n {\n id: \"design-system:vodafone\",\n kind: \"design-system\",\n name: \"Vodafone\",\n description:\n \"Global telecom brand. Monumental uppercase display, Vodafone Red chapter bands.\",\n source: { path: \"design-systems/vodafone\" },\n },\n {\n id: \"design-system:voltagent\",\n kind: \"design-system\",\n name: \"Voltagent\",\n description:\n \"AI agent framework. Void-black canvas, emerald accent, terminal-native.\",\n source: { path: \"design-systems/voltagent\" },\n },\n {\n id: \"design-system:warp\",\n kind: \"design-system\",\n name: \"Warp\",\n description:\n \"Modern terminal. Dark IDE-like interface, block-based command UI.\",\n source: { path: \"design-systems/warp\" },\n },\n {\n id: \"design-system:webex\",\n kind: \"design-system\",\n name: \"Webex\",\n description:\n \"Collaboration platform. Momentum typography, blue action system, multi-user accent spectrum.\",\n source: { path: \"design-systems/webex\" },\n },\n {\n id: \"design-system:webflow\",\n kind: \"design-system\",\n name: \"Webflow\",\n description:\n \"Visual web builder. Blue-accented, polished marketing site aesthetic.\",\n source: { path: \"design-systems/webflow\" },\n },\n {\n id: \"design-system:wechat\",\n kind: \"design-system\",\n name: \"Wechat\",\n description:\n \"Brand visual language for WeChat Mini Programs, official accounts, and open ecosystem extensions.\",\n source: { path: \"design-systems/wechat\" },\n },\n {\n id: \"design-system:wired\",\n kind: \"design-system\",\n name: \"Wired\",\n description:\n \"Tech magazine. Paper-white broadsheet density, custom serif display, mono kickers, ink-blue links.\",\n source: { path: \"design-systems/wired\" },\n },\n {\n id: \"design-system:wise\",\n kind: \"design-system\",\n name: \"Wise\",\n description: \"Money transfer. Bright green accent, friendly and clear.\",\n source: { path: \"design-systems/wise\" },\n },\n {\n id: \"design-system:x-ai\",\n kind: \"design-system\",\n name: \"X AI\",\n description: \"Elon Musk's AI lab. Stark monochrome, futuristic minimalism.\",\n source: { path: \"design-systems/x-ai\" },\n },\n {\n id: \"design-system:xiaohongshu\",\n kind: \"design-system\",\n name: \"Xiaohongshu\",\n description:\n \"Lifestyle UGC social platform. Singular brand red, generous radius, content-first.\",\n source: { path: \"design-systems/xiaohongshu\" },\n },\n {\n id: \"design-system:zapier\",\n kind: \"design-system\",\n name: \"Zapier\",\n description:\n \"Automation platform. Warm orange, friendly illustration-driven.\",\n source: { path: \"design-systems/zapier\" },\n },\n {\n id: \"image-style:notion-illustration\",\n kind: \"image-style\",\n name: \"Notion Illustration\",\n description:\n \"Zero-native illustration style for hand-drawn product spot illustrations with simple ink contours and soft backgrounds.\",\n desc: 'Notion-editorial-style hand-drawn spot illustration. Black brush-pen ink on white, tapered confident strokes, solid-black curly hair, solid-black pants/shoes, 3/4 face turned toward viewer with closed-eye smile and soft nose hint, open breathing body outlines, and 1-3 supporting scene props + ambient marks that frame the moment. Trigger when user says /notion-illustration, asks for a \"Notion-style illustration\", \"Notion spot illustration\", or a new piece in this hand-drawn brush-pen Notion editorial style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/notion-illustration\",\n },\n },\n {\n id: \"image-style:vm0-illustration\",\n kind: \"image-style\",\n name: \"vm0 Illustration\",\n description:\n \"vm0 in-app spot illustration style with bold hand-drawn ink line art, white-filled interiors, and a soft rounded color backdrop.\",\n desc: \"Generate vm0-style vm0 in-app spot illustrations: bold hand-drawn ink line art with white-filled interiors, a soft rounded color backdrop, transparent output, and simple iconic metaphors for product states.\",\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/vm0-illustration\",\n },\n },\n {\n id: \"image-style:postcard-illustration\",\n kind: \"image-style\",\n name: \"Postcard Illustration\",\n description:\n \"Hand-drawn editorial postcard / travel-journal illustration with fine black ink linework, flat saturated gouache fills, sharp edges, dense small repeated ink patterns, paper-grain texture, sparse white speckles, and a tall portrait composition.\",\n desc: 'Hand-drawn editorial postcard illustration style. Fine black marker/pen ink linework over flat saturated gouache color fills with sharp edges, dense small repeated ink patterns on surfaces (rows of windows, shingle curves, hatching, stippling), subtle paper-grain background texture, tiny scattered white speckles (snow / petals / sparkle), and a tall portrait composition with a layered foreground-midground-background. Travel-journal / urban-sketcher aesthetic. Trigger when the user says /postcard-illustration, asks for a \"postcard illustration\", \"travel illustration\", \"urban sketcher style\", or briefs a palette + scene archetype + complexity.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/postcard-illustration\",\n },\n },\n {\n id: \"image-style:folk-storybook\",\n kind: \"image-style\",\n name: \"Folk Storybook Illustration\",\n description:\n \"Folk-art children's picture-book illustration — hand-painted gouache and watercolor scenes with anthropomorphic animal characters, closed-crescent-eye smiles, dusty muted folk palette, and decorative pattern surfaces.\",\n desc: \"Folk-art children's picture-book illustration style — hand-painted gouache/watercolor scene on aged paper, anthropomorphic animal characters with closed-crescent-eye smiles, dusty muted folk palette, decorative pattern surfaces (wallpaper, rugs, textiles), and a hushed lullaby mood. Trigger when users ask for a folk-art illustration, storybook scene, cozy animal illustration, or any new piece in this Eastern European picture-book style.\",\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/folk-storybook\",\n },\n },\n {\n id: \"image-style:papernook\",\n kind: \"image-style\",\n name: \"Papernook\",\n description:\n \"Hand-drawn editorial illustration set in a cozy cluttered personal-studio scene with warm cream paper, scratchy ink, painterly gouache fills, dot-eye character face, and dense edge-to-edge thematic props.\",\n desc: 'Hand-drawn editorial illustration in the spirit of a cluttered personal-studio scene. Loose scratchy black ink outlines that wobble, textured gouache fills with visible brush marks, warm cream paper background, simplified dot-eye character face, and a DENSE edge-to-edge composition where a centered character is orbited by thematic props that visually act out the scene metaphor. Default palette: dusty cornflower blue, soft coral pink, fresh sage green, charcoal, warm cream — no mustard, no burnt-orange. Trigger when user says /papernook, asks for a \"papernook illustration\", a \"cozy cluttered editorial scene\", a \"warm-cream desk scene\", or a new piece in this hand-drawn studio-clutter editorial style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/papernook\",\n },\n },\n {\n id: \"image-style:painterly-botanical\",\n kind: \"image-style\",\n name: \"Painterly Botanical\",\n description:\n \"Painterly watercolor + gouache portrait illustration with a single figure embraced by lush botanicals, closed-eye introspective expression, and a softly tinted paper-wash background.\",\n desc: 'Painterly watercolor + gouache portrait illustration. Single figure (closed eyes, contemplative) embraced by botanicals — leaves, blossoms, grasses. Translucent washes with visible pigment bleeds, sparse crisp ink line accents on key edges, tiny handwritten cursive signature in an upper corner, and a tinted paper-wash background (never pure white). Eight user axes drive composition: subject, hair, pose, botanicals, palette, background wash, complexity (L1/L2/L3), and format. Trigger when a brief describes a contemplative figure with foliage, a \"watercolor portrait\", a \"botanical embrace\", or asks for a piece in this painterly editorial style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/painterly-botanical\",\n },\n },\n {\n id: \"image-style:iso-scene\",\n kind: \"image-style\",\n name: \"Isometric Editorial Scene\",\n description:\n \"Isometric editorial-magazine scene illustration with ultra-fine hairline outlines, flat fills, a saturated monochromatic background, and a scene-as-metaphor composition built from theme-native props.\",\n desc: 'Isometric editorial-magazine scene illustration in a locked flat-vector style — ultra-fine hairline outlines, monochromatic saturated background filling the canvas, and a single composed scene whose props themselves embody the theme. Trigger when users say /iso-scene, ask for an \"isometric editorial illustration\", a \"scene illustration in the editorial machine style\", or brief with palette + scene archetype + complexity.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/iso-scene\",\n },\n },\n {\n id: \"image-style:inkdab\",\n kind: \"image-style\",\n name: \"Inkdab Illustration\",\n description:\n \"Brush-pen editorial illustration where a free-floating color dab is painted first, then loose black ink linework is drawn freely on top — never as an outline around the color. Scribbled hatched hair, open-outline bodies, pure white background.\",\n desc: 'Brush-pen editorial illustration style — a flat accent-color \"dab\" painted first, then loose black ink drawn freely on top. ONE flat accent-color shape per prop (painted-first, never outlined in black), black hand-wobbled ink on pure white background, scribbled hatched hair, open-outline bodies with zero fill, and one small solid-accent triangle floating freely as a recurring motif. Trigger when user says /inkdab, asks for an \"inkdab illustration\", a \"brush-pen illustration with a single accent color\", a \"free-floating color block illustration\", or briefs in the style of the included reference images.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/inkdab\",\n },\n },\n {\n id: \"image-style:riso-relic\",\n kind: \"image-style\",\n name: \"Riso Relic\",\n description:\n 'Pop-art retro risograph poster of a single nostalgic everyday object on a saturated single-hue field — bold black ink outlines, halftone grain, hand-drawn doodle accents, tiny \"SMALL OBJECTS IN TIME\" banner up top, chunky retro headline with offset drop-shadow at the bottom.',\n desc: 'Pop-art retro risograph poster of a single nostalgic everyday object — saturated single-color background, bold black ink outlines, halftone/riso grain, hand-drawn doodle accents (sparkles, squiggles, dots, music notes, lightning), tiny white \"SMALL OBJECTS IN TIME\" banner at top, chunky retro display headline at bottom with offset black drop-shadow. Trigger when user says /riso-relic, asks for a \"riso poster\", a \"small objects in time\" illustration, or any new piece in this nostalgic pop-art relic-object style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/riso-relic\",\n },\n },\n {\n id: \"image-style:inkstomp\",\n kind: \"image-style\",\n name: \"Inkstomp\",\n description:\n \"Loud indie-packaging poster style — full-bleed saturated flat color, a two-line hand-lettered headline, and one weird-cute black brush-ink character.\",\n desc: 'Inkstomp — a loud, hand-screened indie-packaging poster style. Full-bleed saturated flat color filling the entire canvas, a two-line hand-lettered headline (thin arched caps over chunky drop-shadowed display), and one weird-cute character drawn in thick uniform black brush ink. Trigger when the user says /inkstomp, asks for an \"inkstomp poster\", a \"Ray Fenwick / Hattie Stewart packaging poster\", an \"indie brush-ink flavor card\", or briefs in a \"palette + headline + character\" shape.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/inkstomp\",\n },\n },\n {\n id: \"image-style:folk-muse\",\n kind: \"image-style\",\n name: \"Folk Muse\",\n description:\n \"Flat folk-art gouache portrait style — a single contemplative chest-up figure framed by an asymmetric botanical surround, with painted irises, smooth flat hair, a hand against the cheek, and a patterned robe.\",\n desc: 'Flat folk-art gouache portrait illustration in the contemporary editorial style of Carson Ellis, Maja Tomljanovic, and Bodil Jane. A single chest-up figure with an elongated mannerist oval face, tiny almond half-lidded eyes, smooth flat hair, one hand pressed against the face, a patterned robe filling the lower frame, and an asymmetric botanical surround filling the background edge-to-edge. Hand-painted matte gouache texture, flat color blocks, no harsh outlines, no photorealism. Calm, slightly melancholic, contemplative mood. Trigger when the user says /folk-muse, asks for a \"folk-art portrait\", \"gouache portrait\", \"Carson Ellis style portrait\", or any new piece in this contemplative folk-portrait style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/folk-muse\",\n },\n },\n {\n id: \"image-style:sunlit-gouache\",\n kind: \"image-style\",\n name: \"Sunlit Gouache\",\n description:\n \"Bright pastel travel-painting illustration in opaque gouache on textured paper with chunky flat brushstrokes, vertical one-point perspective, and figures walking into warm sunlight.\",\n desc: 'Sunlit Gouache travel-painting illustration. Opaque gouache on textured paper, visible chunky flat brushstrokes with dry-brush highlights, locked six-color palette (cream, butter-yellow, sky-blue, sage-green, terracotta, one small red accent), vertical 2:3 one-point-perspective composition drawing the eye into a bright sunlit focal point, figures seen from behind walking into the scene, an overhead band of hanging elements (awning, prayer flags, catenary, bunting, lanterns) creating depth, dappled painterly reflections on the ground, airy optimistic warm mood. Trigger when user says /sunlit-gouache, asks for a \"sunlit gouache illustration\", \"painterly travel scene\", \"gouache café/market/temple/station scene\", or a new piece in this bright pastel painted-light style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/sunlit-gouache\",\n },\n },\n {\n id: \"image-style:mosaic-still-life\",\n kind: \"image-style\",\n name: \"Mosaic Still Life\",\n description:\n \"Editorial still-life illustration in a mosaic-tile + painterly hybrid style — tessellated ground/sky/wall surfaces with crisp painterly objects, an animal companion, and a patterned textile peeking through.\",\n desc: 'Mosaic-tile + painterly hybrid editorial illustration. Tessellated/pointillist mosaic surfaces (grass, sky, sand, walls, floors) anchor the scene, with crisp painterly still-life objects rendered ON TOP. Always features a still-life centerpiece on a table, an animal companion at the heart of the scene, and at least one patterned textile peeking through. Cozy, nostalgic, bucolic mood. Trigger when user says /mosaic-still-life, asks for a \"mosaic illustration\", \"mosaic-tile editorial illustration\", \"tessellated still life\", or briefs with a palette + scene + animal in this style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/mosaic-still-life\",\n },\n },\n {\n id: \"image-style:ink-mascot\",\n kind: \"image-style\",\n name: \"Ink Mascot\",\n description:\n \"Vintage editorial marketing card. Bold serif headline and short serif descriptor over a hand-drawn black-ink anthropomorphic mascot (stick limbs, chunky white sneakers) on a single solid saturated flat color background.\",\n desc: 'Generate a 3:5 portrait editorial marketing card in a locked vintage-textbook style. Bold serif headline plus an optional short serif descriptor sit on a single solid saturated flat color background (no gradient, no divider, no ground line). A hand-drawn black-ink anthropomorphic hero object — paint bucket, magnifying glass, envelope, notebook, funnel, megaphone, rocket, seedling, gift box, compass, etc. — stands with two thin stick arms, two stick legs, and chunky white sneakers with black laces (the signature detail). Crosshatch and stipple shading on rounded surfaces; floating ink doodles (sparkles, arrows, hearts, percent or dollar signs, motion lines) at the requested density. Dialable along six axes: concept, palette, hero object, action, doodle density (L1 minimal, L2 balanced, L3 packed), and type layout (A title-top, B headline-bottom, C headline-only, D big-word + tiny-descriptor). Trigger when user says /ink-mascot, asks for a \"marketing card illustration\", a \"retro editorial mascot poster\", or briefs with a marketing concept plus palette plus character.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/ink-mascot\",\n },\n },\n {\n id: \"image-style:sticker-sheet\",\n kind: \"image-style\",\n name: \"Sticker Sheet\",\n description:\n \"Hand-painted gouache sticker-sheet illustration with ~20 themed objects floating on white, punchy saturated palette, wobbly hand-drawn ink overlay, and tiny decorative marks on every item.\",\n desc: 'Sticker Sheet — hand-painted gouache sticker-sheet illustration. ~20 small floating themed objects on pure white, punchy saturated palette (coral, mustard, sage, dusty pink, navy, cream, warm brown), flat brushy gouache fills with wobbly hand-drawn ink linework and tiny decorative marks (dots, hatches, squiggles) on every object. Each object slightly tilted, no drop shadows, cheerful cozy lifestyle journal mood. Trigger when user says /sticker-sheet, asks for a \"sticker sheet illustration\", \"hand-painted gouache sticker pack\", \"themed object sheet\", or briefs with a scene theme + object count in this house style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/sticker-sheet\",\n },\n },\n {\n id: \"image-style:flat-poster\",\n kind: \"image-style\",\n name: \"Flat Poster\",\n description:\n \"Vertical flat-color editorial poster style — saturated solid background, one centered hand-drawn vector subject in bold deep-navy outlines with strict two-tone fill, headline pinned top-left, wordmark pinned bottom-right.\",\n desc: 'Flat Poster — a vertical flat-color editorial poster style for brand benefit cards, marketing posters, and in-app campaign visuals. Portrait 2:3 canvas filled edge-to-edge with one saturated hue; a single centered hand-drawn vector subject in deep-navy outlines with strict two-tone fill (pure white plus one darker bg-tint accent); a bold rounded sans-serif headline pinned top-left; a short wordmark (default VM0) pinned bottom-right; small floating accent marks around the subject; no body copy. Six creative dials: palette, subject archetype, composition preset, accent marks, headline voice, mood. Trigger when the user says /flat-poster, asks for a \"flat-color editorial poster\", a \"brand benefit card\", a \"marketing card in the bold outline + flat color style\", or briefs with a palette + subject + headline shape.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/flat-poster\",\n },\n },\n {\n id: \"image-style:mellow-pop\",\n kind: \"image-style\",\n name: \"Mellow Pop\",\n description:\n \"Chill flat-vector editorial poster of a serene recurring character on a fully saturated solid color background, with a signature pop of bright leaf-green and a scene-as-metaphor composition.\",\n desc: 'Mellow-pop flat-vector editorial illustration: a recurring chill character with closed-eye smile, tiny nose hint, and short dark bobbed hair, posed inside a scene-as-metaphor composition on a single fully saturated solid color background, with a signature pop of bright leaf-green woven into every piece (hero prop, plants, motifs, or sweater). Thin uniform black outlines, flat solid fills only, no gradients or texture. Five dials per brief: palette, scene metaphor, complexity (L1/L2/L3), pose, outfit accent. Trigger when user says /mellow-pop, asks for a \"mellow-pop illustration\", \"chill flat-vector poster\", or briefs with a scene metaphor + palette + complexity.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/mellow-pop\",\n },\n },\n {\n id: \"image-style:grainy-duotone\",\n kind: \"image-style\",\n name: \"Grainy Duotone\",\n description:\n \"Editorial spot illustration on a warm cream background — grainy charcoal-stippled hands, outline-free flat two-tone color blocks with internal patterns, and scattered ambient marks.\",\n desc: 'Grainy-duotone editorial spot illustration: warm cream off-white background, grainy charcoal-stippled hands (and occasional faces) drawn in textured black ink, paired with free-floating flat two-tone color blocks that carry NO outlines and are filled with internal patterns (grid, dots, spiral, hatching, squiggles, wavy lines), surrounded by scattered ambient marks (zigzags, triangles, x marks, circles, dashes). Square 1:1 scene-as-metaphor compositions. Five creative dials per brief: palette (two flat hues, e.g. teal+yellow / coral+sage / lavender+mustard / navy+peach / burgundy+dusty pink), elements (hand(s) + 1-3 props like flag, sprout, magnifier, balloons, ladder), scene archetype (Launch / Grow / Connect / Discover / Communicate / Reflect / Navigate / Care / Transform / Build), complexity (L1 minimal / L2 balanced / L3 rich), and mood (celebratory / calm / curious / reflective / determined / warm / quiet). Trigger when user says /grainy-duotone, asks for a \"grainy two-tone editorial illustration\", \"charcoal-stippled hand illustration\", \"duotone editorial spot\", or briefs with a scene metaphor + two-color palette + complexity.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/grainy-duotone\",\n },\n },\n {\n id: \"image-style:op-ed-cover\",\n kind: \"image-style\",\n name: \"Op-Ed Cover\",\n description:\n \"Editorial magazine op-ed cover — flat-vector scene with paper grain, elongated ink-line characters, muted retro palette, and a serif headline block in the lower-right.\",\n desc: 'Editorial magazine op-ed cover illustration. Flat-vector + paper-grain scene with expressive elongated ink-line characters, gentle painterly shading, 1950s-60s editorial mood, and a serif headline overlay block in the lower-right corner carrying a witty contrarian or declarative title with two short lines of italic body copy. 5-axis framework: palette (background + accent + ink), complexity (L1 single hero / L2 small ensemble / L3 busy crowd), scene metaphor (specific cultural microcosm), headline voice (declarative / pun / appreciative / contrarian), and headline block style (solid vs. translucent). Trigger when user says /op-ed-cover, asks for an \"editorial magazine illustration\", an \"op-ed cover\", a \"magazine essay illustration\", or a scene with a headline overlay in this style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/op-ed-cover\",\n },\n },\n {\n id: \"image-style:grain-poster\",\n kind: \"image-style\",\n name: \"Grain Poster\",\n description:\n \"Flat-vector editorial poster of a serene full-body figure with one hero prop — riso grain on a single textile, closed-eye smile + red cheek blush, muted limited palette.\",\n desc: 'Grain Poster — flat-vector editorial illustration of a serene full-body figure interacting with one hero prop (bicycle, bouquet, cat, book, skateboard, sun hat, guitar, dog leash). Closed-eye smile + single round red cheek blush + dark nose mark + solid black hair, silhouette-first (no inked outlines). Riso/halftone grain confined to exactly ONE textile element (skirt or trousers); every other surface is flat color. Muted single-hue background, generous negative space, no headlines or wordmarks. Six tunable dials: palette (cool-dawn · sunset-coral · twilight · forest-green · custom), mood, scene, cast, complexity (L1/L2/L3), framing. Strongest at L1 + side-profile + solo. Trigger when user says /grain-poster, asks for a \"flat-vector editorial poster\", \"riso-grain figure poster\", \"grainy editorial illustration\", or briefs with a scene + palette + cast in this house style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/grain-poster\",\n },\n },\n {\n id: \"image-style:light-pop-portrait\",\n kind: \"image-style\",\n name: \"Light Pop Portrait\",\n description:\n \"Light hand-drawn flat-vector single-character portrait on a fully saturated color block — chunky black hair, big shiny eyes, tiny red nose, pink five-point-star sparkle blush.\",\n desc: 'Light Pop Portrait — a hand-drawn flat-vector single-character portrait style for playful avatars, mood pieces, and editorial character cards. Square 1:1 canvas filled with one fully saturated background hue; a single child–tween character with chunky glossy-black hair (with one or two flyaway strands), big round shiny eyes (single white glint each, thin lashes above), tiny round red nose, expressive small mouth, and pink FIVE-POINT STAR sparkle blush on the cheeks (never solid dots). Thin delicate slightly-wavy hand-drawn contour lines, flat solid fills only, no gradients or texture, ~5-color palette per piece. Eight creative dials: expression, hairstyle, gender register, pose, palette, headwear, prop, outfit. Trigger when user says /light-pop-portrait, asks for a \"light pop portrait\", \"flat-vector character portrait\", \"saturated color-block character\", or briefs with expression + hairstyle + palette + prop.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/light-pop-portrait\",\n },\n },\n {\n id: \"image-style:endpaper\",\n kind: \"image-style\",\n name: \"Endpaper\",\n description:\n \"Riso-grain flat-vector collection of chill characters or objects scattered across a saturated solid color field, with two-tone interior shading and closed-eye sleepy faces.\",\n desc: 'Riso-grain flat-vector editorial collection illustration. Many small animals or objects scattered across a fully saturated solid color background — like the inside endpaper of a children\\'s picture book. Subtle riso/screenprint grain inside every fill, two-tone interior shading on every character (darker top + lighter belly), closed crescent-eye sleepy smiles with tiny dot noses, NO outlines on character bodies, loose hand-drawn line details on props (yarn spirals, leaf veins, pot stripes), scattered curated composition where characters overlap and touch the canvas edges. Five dials: background hue, cast (cats/dogs/foxes/birds/sea-creatures/houseplants/kitchen-objects/etc.), character palette (3–5 curated fills), density (L1 sparse / L2 balanced / L3 packed), prop vocabulary matched to cast. Trigger when user says /endpaper, asks for an \"endpaper illustration\", a \"scattered animal or object collection on saturated color\", a \"children\\'s-book endpaper scene\", or briefs with a cast + background hue + density + palette.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/endpaper\",\n },\n },\n {\n id: \"image-style:editorial-flatfolk\",\n kind: \"image-style\",\n name: \"Editorial Flatfolk\",\n description:\n \"Editorial hand-drawn naive book-illustration style — flat saturated color blocks, loose ink line overlay, paper grain, and a strong sense of place.\",\n desc: 'Editorial hand-drawn naive book-illustration style. Flat saturated color blocks with loose hand-drawn ink line work sitting ON TOP of the color, subtle paper grain across the canvas, simple ink hatching for sky / sun rays / rain / snow, and a strong sense of place built from tall narrow architecture and a one-point depth axis. Five dials per brief: palette (warm-primary, coastal-peach, jewel-night, winter-cool, autumn-rust, monsoon-twilight), scene metaphor (street, harbor, market, transit, park, square, interior, alpine-village), perspective (one-point street, frontal facade, low-angle hero, isometric, top-down), cast (solo wanderer, paired, small crowd, none), and light/weather (midday sun, golden hour, rain, snow, blue hour). Trigger when user says /editorial-flatfolk, asks for an \"editorial flat-folk illustration\", a \"saturated naive book-illustration scene\", a \"tall narrow row-house illustration\", or briefs a palette + scene metaphor + season.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/editorial-flatfolk\",\n },\n },\n {\n id: \"image-style:soft-vector\",\n kind: \"image-style\",\n name: \"Soft Vector\",\n description:\n \"Airy flat-vector spot illustration — square pale-blue canvas, thin ~1.5-2px dark-navy linework with intentionally open / unclosed outlines, flat fills, one muted accent hue, centered subject with breathing room.\",\n desc: 'Soft Vector — an airy flat-vector spot illustration style for in-app onboarding art, empty states, billing cards, and friendly UI moments. Square 1:1 canvas on a single flat pale-blue field #EEF1F5; thin uniform dark-navy outlines (~1.5-2px, rounded caps, NOT chunky); the signature lift comes from several intentionally OPEN / unclosed outlines per piece (mug rim gap, handle that doesn\\'t close, ground line ending in mid-air, cloud silhouette break, lamp arm fade, pot rim gap); strictly flat colour fills with no gradients or shading; one muted lead accent (mustard / lime-sage / warm-orange / violet) plus neutrals; subject centered at ~60-75% of canvas with generous breathing room; scattered thin-navy micro-marks (dots, plus signs, sparkles, or motion ticks). Six dials per brief: palette accent, scene metaphor, complexity (L1/L2/L3), cast, accent marks, action/mood. Trigger when user says /soft-vector, asks for a \"soft-vector illustration\", a \"friendly UI onboarding illustration\", a \"thin-line flat spot illustration\", or briefs a scene metaphor + palette + complexity in this house style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/soft-vector\",\n },\n },\n {\n id: \"image-style:loose-contour\",\n kind: \"image-style\",\n name: \"Loose Contour\",\n description:\n \"Flat editorial spot illustration — open teal contour lines, offset color blobs (printing-misregistration look), one ribbon line on warm cream paper.\",\n desc: 'Loose-contour flat editorial spot illustration: confident open-contour ink drawings in dark teal-green (#1e4d4a) over flat offset color blobs (printing-misregistration look) on warm cream paper (#f0ebdc), with exactly one continuous looping ribbon line of the same teal weaving through the scene. Tight 5-color palette: cream + teal + mustard + soft blue + coral. Lines are deliberately broken at joints and edges. Five dials per brief: scene metaphor, cast, complexity (L1/L2/L3), accent lead, ribbon path. Trigger when user says /loose-contour, asks for a \"loose-contour illustration\", \"offset-blob editorial illustration\", or \"cream paper ribbon-line scene\".',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/loose-contour\",\n },\n },\n {\n id: \"image-style:jade-blockprint\",\n kind: \"image-style\",\n name: \"Jade Blockprint\",\n description:\n \"Two-tone hand-drawn block-print spot illustration — accent color painted as free-floating shapes on white, with chunky black ink layered on top. Eight palettes.\",\n desc: 'Jade-blockprint two-pass hand-drawn block-print spot illustration: one accent color painted FIRST as free-floating shapes on pure white, then chunky black ink line art layered ON TOP. Color blobs have no perimeter outline — ink draws detail, hatching, and motion marks, never traces the colored shape. Wobbly variable-weight linework with occasional flooded black masses; tiny linocut speckle grain inside color fills. Eight named palettes (jade, coral, cobalt, plum, sage, rose, slate, terracotta) plus custom-hex override. Resolves vague briefs (growth, trust, freedom, fairness) into concrete scene metaphors via an internal synthesizer table before generating. Five dials per piece: palette, scene metaphor, complexity (L1 single object / L2 mini-scene / L3 vignette), motion marks, speckle density. Trigger when the user says /jade-blockprint, asks for a \"block-print illustration\", \"linocut spot illustration\", \"two-tone screen-print\", or briefs a metaphor for a blog cover or marketing card in this style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/jade-blockprint\",\n },\n },\n {\n id: \"image-style:shadow-pop\",\n kind: \"image-style\",\n name: \"Shadow Pop\",\n description:\n \"Bright flat-vector illustration with offset black shape shadows, white dashed stitching, palette confetti, and transparent PNG output.\",\n desc: 'Bright flat-vector editorial illustration style — every colored shape sits in front of an offset black silhouette of itself (the signature depth trick, no outlines on the fills), with white hand-drawn dashed stitching, scattered palette-colored sparkle confetti, and a fully transparent PNG background so the piece drops cleanly onto any surface. Five dials per brief — palette (default / berry-pop / tropical / citrus-cobalt), scene metaphor, complexity (L1 / L2 / L3), confetti density, and subject domain. Trigger when user says /shadow-pop, asks for a \"shadow-pop illustration\", a \"bright flat-vector illustration with offset shadow\", an \"in-app illustration with offset shadow trick\", or briefs in the style of the included reference images.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/shadow-pop\",\n },\n },\n {\n id: \"image-style:tiny-wanderer\",\n kind: \"image-style\",\n name: \"Tiny Wanderer\",\n description:\n \"Contemplative bande-dessinée landscape illustration — tiny human dwarfed by vast nature, ink hatching + flat color, vertical portrait canvas.\",\n desc: 'Contemplative bande-dessinée landscape illustration in a locked house style — a tiny human (or 2–3 figures) is dwarfed by a vast natural panorama, hand-drawn black ink contour + parallel/cross-hatching for clouds, rock walls, foliage, grass, and water texture, sitting on flat color blocks beneath the ink (no gradients, no airbrush). Restrained 3–5 color palette per piece including black ink, vertical portrait canvas (1024x1536, reads ~3:5). Always outdoor/wilderness. Moebius / Christophe Chabouté travel-sketchbook lineage, quiet wonder mood. Six dials per brief: palette family (sage-plains / sunset-warm / coastal-teal / cool-mist / autumn-rust / winter-pale / custom), landscape archetype (plains+clouds / mountain valley / river vista / rocky ridge / coastal cliffs / misty gorge / forest clearing / alpine pass / desert mesa / lakeshore), activity (walking / cycling / hiking / standing-and-gazing), solitude count (1 / 2 / 3), complexity (L1 single plane / L2 fore+mid / L3 full multi-plane vista), and weather/time (midday / golden hour / sunset / overcast / mist / blue hour). Trigger when user says /tiny-wanderer, asks for a \"tiny wanderer illustration\", \"bande-dessinée landscape\", \"Moebius-style travel illustration\", \"ink-hatched vertical landscape\", or briefs with a palette + landscape archetype + complexity in this house style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/tiny-wanderer\",\n },\n },\n {\n id: \"image-style:iberian-vignette\",\n kind: \"image-style\",\n name: \"Iberian Vignette\",\n description:\n \"Hand-drawn editorial vignette style — loose wobble ink, flat muted cream + burgundy + one accent (sage / mustard / dusty blue / terracotta), minimal abstract faces, observed Mediterranean composition with a serif Spanish wordmark at the bottom.\",\n desc: 'Iberian-vignette hand-drawn editorial illustration: loose hand-drawn ink linework with visible wobble and varied weight, flat muted color fills (no gradients, no shading, no texture) on a warm cream off-white background, burgundy/wine always present as the anchor color somewhere in the scene, exactly one secondary accent per piece (sage green / mustard yellow / dusty muted blue / terracotta-rust), minimal abstract faces (tiny dot or short-mark eyes, soft nose hint, almost no mouth), hair as flat color masses, warm sand skin tones, casually-observed body language (leaning, holding, mid-action, never stiffly posed), and a short Spanish serif lowercase wordmark anchored at the bottom center of the canvas. Always grounded by an architectural / scenic prop (stone arched doorway, tall arched window, balcony, sunlit courtyard, wooden counter, archway, stoop, open terrace). Six dials per brief: scene metaphor (trade shop, domestic moment, leisure ritual), cast (solo L1 / pair L2 / 3-4 figures L3), architectural prop, secondary accent (one only), wordmark (Spanish noun), complexity (L1/L2/L3). Trained on nano-banana-2 image-to-image with one of three locked anchor references (mañana / ritmo / familia). Trigger when user says /iberian-vignette, asks for an \"Iberian vignette illustration\", a \"Spanish editorial illustration\", a \"Mediterranean observed-moment scene\", or briefs a scene metaphor + cast + complexity in this hand-drawn editorial style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/iberian-vignette\",\n },\n },\n {\n id: \"image-style:cozy-parlor\",\n kind: \"image-style\",\n name: \"Cozy Parlor\",\n description:\n \"Hand-painted watercolor + ink-line scene — one anthropomorphic animal in a quiet domestic interior, clean cool-white paper, neutral palette with one hot accent pop.\",\n desc: \"Hand-painted watercolor + brushy black ink line on clean cool-white paper (no amber tint). ONE anthropomorphic animal mid-quiet-activity in a domestic interior. Closed-crescent-eye smile, minimal facial features, expression through posture. At least two patterned surfaces per piece. Cool/neutral palette lead (sage, slate-blue, cornflower, lavender, mint, dove-gray) with a single hot accent pop (cherry-red, mustard, magenta-pink) on one object. Six dials per brief — cast, activity, palette family, pattern motif stack, hot accent object, and complexity (L1/L2/L3). Trigger when user says /cozy-parlor, asks for a 'cozy parlor illustration', a 'watercolor animal scene', a 'picture-book interior', or a new piece in this neutral-palette watercolor style.\",\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/cozy-parlor\",\n },\n },\n {\n id: \"image-style:crowd-ink\",\n kind: \"image-style\",\n name: \"Crowd Ink\",\n description:\n \"Hand-drawn editorial crowd illustration — sketchy black ink contours over flat 3-color spot fills on pure white, scene-as-metaphor composition.\",\n desc: 'Hand-drawn editorial crowd illustration style — confident sketchy black ink contour lines with slightly irregular weight, flat 3-color spot fills sitting under or beside the ink lines (edges allowed to misregister slightly), on a PURE WHITE background (never cream). Fine-line backdrop drawn lighter than the foreground figures, scattered atmospheric marks in negative space (birds / leaves / steam / confetti / dots), and a scene-as-metaphor composition with a cast that varies per piece. Six dials per brief — palette (tested families: urban editorial / cool transit / warm natural / cozy interior), scene metaphor, complexity (L2 small group of 3–5 / L3 full crowd of 8–10), cast, backdrop, atmospheric motif. Trigger when the user says /crowd-ink, asks for a \"crowd-ink illustration\", \"editorial crowd scene\", \"hand-drawn ink-and-spot-color illustration\", \"New-Yorker-style crowd vignette\", or briefs with palette + scene metaphor + complexity level.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/crowd-ink\",\n },\n },\n {\n id: \"image-style:ink-storefront\",\n kind: \"image-style\",\n name: \"Ink Storefront\",\n description:\n \"Single-color hand-drawn ink fineliner illustration of a small storefront on warm cream paper — hand-lettered shop sign, foliage, and street props.\",\n desc: 'Boutique-poster illustration style — a single-color hand-drawn ink line drawing of a small storefront (café, boulangerie, florist, bookshop, ramen, wine bar, barber, record store, etc.) seen from street level on warm cream paper #f4ecd8. Locked frame: portrait 1024x1536, monochromatic ink with occasional double-stroke shadow under awnings and signs, a hand-lettered shop sign baked into the building, foliage and at least one small street prop (bike, A-frame chalkboard, planters, lanterns, café tables, dog/cat at the door), and a faint horizontal sidewalk line across the bottom. No solid color fills, no shading, no gradients. Seven dials per brief — ink color, shop name + subtitle, archetype, perspective (flat facade vs 3/4 corner), foreground props, foliage density, and complexity (L1 single facade / L2 small scene / L3 full vignette). Trigger when user says /ink-storefront, asks for a \"shopfront illustration\", \"storefront poster\", \"boutique fineliner illustration\", \"café line drawing\", or briefs with a shop name + ink color + archetype in this house style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/ink-storefront\",\n },\n },\n];\n\nfunction filterByKind(kind: ResourceKind): readonly RegistryEntry[] {\n return RESOURCE_REGISTRY.filter((entry) => {\n return entry.kind === kind;\n });\n}\n\nexport function listImageStyles(): readonly RegistryEntry[] {\n return filterByKind(\"image-style\");\n}\n\nexport function findImageStyle(id: string): RegistryEntry | undefined {\n return listImageStyles().find((entry) => {\n return entry.id === id;\n });\n}\n\nexport function listDesignSystems(): readonly RegistryEntry[] {\n return filterByKind(\"design-system\");\n}\n\nexport function findDesignSystem(id: string): RegistryEntry | undefined {\n return listDesignSystems().find((entry) => {\n return entry.id === id;\n });\n}\n\nexport function listTemplates(\n target?: GenerationTarget,\n): readonly RegistryEntry[] {\n const all = filterByKind(\"template\");\n if (target === undefined) {\n return all;\n }\n return all.filter((entry) => {\n return entry.targets?.includes(target) ?? false;\n });\n}\n\nexport function findTemplate(id: string): RegistryEntry | undefined {\n return filterByKind(\"template\").find((entry) => {\n return entry.id === id;\n });\n}\n\nexport function toGenerationTarget(value: string): GenerationTarget {\n if (value === \"dashboard\") {\n return \"dashboard-design\";\n }\n\n if (value === \"docs\") {\n return \"docs-design\";\n }\n\n if (value === \"mobile-app\") {\n return \"mobile-app-design\";\n }\n\n return value as GenerationTarget;\n}\n\nexport function selectResourceCandidates(\n target?: GenerationTarget,\n): ResourceCandidateSlice {\n return {\n registryVersion: RESOURCE_REGISTRY_VERSION,\n source: {\n repo: RESOURCE_REGISTRY_REPO,\n ref: RESOURCE_REGISTRY_COMMIT,\n },\n sources: [\n {\n repo: RESOURCE_REGISTRY_REPO,\n ref: RESOURCE_REGISTRY_COMMIT,\n },\n {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n },\n ],\n candidates: {\n skills: filterByKind(\"skill\"),\n templates: listTemplates(target),\n designSystems: filterByKind(\"design-system\"),\n imageStyles: filterByKind(\"image-style\"),\n audioStyles: filterByKind(\"audio-style\"),\n videoTemplates: filterByKind(\"video-template\"),\n bundleTemplates: filterByKind(\"bundle-template\"),\n },\n };\n}\n","import type { RegistryEntry } from \"./resource-registry\";\n\n/**\n * Format a list of registry entries for help text or error messages.\n *\n * Each entry renders as a two-line block:\n *\n * ```\n * <id>\n * <desc or description>\n * ```\n *\n * Blank line between entries. Returns a single placeholder line when the\n * list is empty so callers can drop this directly into help output.\n */\nexport function formatRegistryListing(\n entries: readonly RegistryEntry[],\n emptyLabel: string,\n): string {\n if (entries.length === 0) {\n return ` (no ${emptyLabel} registered)`;\n }\n return entries\n .map((entry) => {\n const desc = entry.desc ?? entry.description;\n return ` ${entry.id}\\n ${desc}`;\n })\n .join(\"\\n\\n\");\n}\n\n/**\n * Canonicalize a user-supplied registry id by prepending the resource-kind\n * prefix when missing. Accepts either `apple` or `design-system:apple`,\n * `html-ppt-pitch-deck` or `template:html-ppt-pitch-deck`, etc.\n */\nexport function canonicalizeRegistryId(prefix: string, value: string): string {\n const fullPrefix = `${prefix}:`;\n if (value.startsWith(fullPrefix)) {\n return value;\n }\n return `${fullPrefix}${value}`;\n}\n","import { readFileSync } from \"node:fs\";\nimport { printConnectorGuidance } from \"./connector-guidance\";\nimport { runLister, type GenerationType } from \"./lister\";\n\ninterface DispatchOptions {\n readonly generationType: GenerationType;\n readonly provider?: string;\n readonly prompt?: string;\n readonly all?: boolean;\n}\n\n/**\n * Resolve the dispatch for `zero generate <type>`.\n *\n * Returns `\"execute\"` when the caller should run the built-in pipeline.\n * Otherwise prints the appropriate output (lister or connector guidance)\n * and returns `\"handled\"`.\n *\n * The dispatcher consumes any piped stdin used to satisfy the prompt and\n * places the resolved text on `options.prompt` for the caller to use.\n */\nexport async function dispatchGenerate(\n options: DispatchOptions,\n): Promise<{ outcome: \"handled\" } | { outcome: \"execute\"; prompt: string }> {\n const provider = options.provider?.trim();\n\n if (provider && provider !== \"built-in\") {\n printConnectorGuidance(options.generationType, provider);\n return { outcome: \"handled\" };\n }\n\n const resolvedPrompt = resolvePrompt(options.prompt);\n\n if (resolvedPrompt === null) {\n await runLister(options.generationType, {\n all: options.all,\n });\n return { outcome: \"handled\" };\n }\n\n return { outcome: \"execute\", prompt: resolvedPrompt };\n}\n\nfunction resolvePrompt(prompt: string | undefined): string | null {\n if (prompt?.trim()) {\n return prompt.trim();\n }\n\n if (process.stdin.isTTY === false) {\n try {\n const piped = readFileSync(\"/dev/stdin\", \"utf8\").trim();\n if (piped.length > 0) {\n return piped;\n }\n } catch {\n // stdin not readable (e.g. test runner with no piped input);\n // treat as no piped prompt and fall through to lister.\n }\n }\n\n return null;\n}\n","import {\n CONNECTOR_TYPES,\n type ConnectorConfig,\n type ConnectorType,\n} from \"@vm0/connectors/connectors\";\nimport { getConnectorGenerationTypes } from \"@vm0/connectors/connector-utils\";\nimport type { GenerationType } from \"./lister\";\n\nfunction toConnectorGenerationType(\n generationType: GenerationType,\n): string | null {\n switch (generationType) {\n case \"voice\":\n case \"music\":\n return \"audio\";\n case \"dashboard-design\":\n case \"docs-design\":\n case \"mobile-app-design\":\n case \"poster\":\n case \"report\":\n return null;\n default:\n return generationType;\n }\n}\n\nfunction isConnectorType(value: string): value is ConnectorType {\n return value in CONNECTOR_TYPES;\n}\n\ninterface ConnectorGuidance {\n readonly type: ConnectorType;\n readonly label: string;\n readonly supportsGenerationType: boolean;\n}\n\nfunction resolveConnector(\n provider: string,\n generationType: GenerationType,\n): ConnectorGuidance | null {\n if (!isConnectorType(provider)) return null;\n const config: ConnectorConfig = CONNECTOR_TYPES[provider];\n const connectorGenerationType = toConnectorGenerationType(generationType);\n const supports =\n connectorGenerationType !== null &&\n getConnectorGenerationTypes(provider).some((entry) => {\n return entry === connectorGenerationType;\n });\n return {\n type: provider,\n label: config.label,\n supportsGenerationType: supports,\n };\n}\n\nexport function printConnectorGuidance(\n generationType: GenerationType,\n provider: string,\n): void {\n const guidance = resolveConnector(provider, generationType);\n\n if (!guidance) {\n console.log(`Provider \"${provider}\" is not a known connector.`);\n console.log(\"\");\n console.log(\n `Run \"zero generate ${generationType}\" to see every provider available for this generation type.`,\n );\n return;\n }\n\n if (!guidance.supportsGenerationType) {\n console.log(\n `${guidance.label} (${guidance.type}) does not advertise ${generationType} generation.`,\n );\n console.log(\"\");\n console.log(\n `Run \"zero generate ${generationType}\" to see every provider that supports this generation type.`,\n );\n return;\n }\n\n console.log(\n `${guidance.label} (${guidance.type}) handles ${generationType} generation through its own connector skill, not through \"zero generate\".`,\n );\n console.log(\"\");\n console.log(`Next steps:`);\n console.log(` - Use the \"${guidance.type}\" skill in this session.`);\n console.log(\n ` - Or call the connector directly via its documented endpoints.`,\n );\n console.log(\"\");\n console.log(\n `Run \"zero connector status ${guidance.type}\" to verify the connector is connected and authorized for the current agent.`,\n );\n}\n","import chalk from \"chalk\";\nimport {\n CONNECTOR_TYPE_KEYS,\n CONNECTOR_TYPES,\n type ConnectorConfig,\n type ConnectorGenerationType,\n type ConnectorType,\n} from \"@vm0/connectors/connectors\";\nimport { getConnectorGenerationTypes } from \"@vm0/connectors/connector-utils\";\nimport type { ConnectorListResponse } from \"@vm0/api-contracts/contracts/connector-schemas\";\nimport { getZeroAgentUserConnectors } from \"../../../../lib/api/domains/zero-agents\";\nimport {\n listZeroConnectors,\n searchZeroConnectors,\n} from \"../../../../lib/api/domains/zero-connectors\";\nimport { getPlatformOrigin } from \"../../doctor/platform-url\";\n\ntype BuiltInGenerationType =\n | \"dashboard-design\"\n | \"docs-design\"\n | \"image\"\n | \"mobile-app-design\"\n | \"music\"\n | \"poster\"\n | \"presentation\"\n | \"report\"\n | \"sprite\"\n | \"video\"\n | \"voice\"\n | \"website\";\nexport type GenerationType = ConnectorGenerationType | BuiltInGenerationType;\n\ninterface BuiltInGenerationProvider {\n label: string;\n model: string;\n command: string;\n reason: string;\n}\n\ninterface BuiltInGenerationCommand {\n label: string;\n command: string;\n models: string;\n}\n\ninterface GenerationContext {\n readonly lines: readonly string[];\n}\n\nconst BUILT_IN_GENERATION_PROVIDERS: Partial<\n Record<GenerationType, readonly BuiltInGenerationProvider[]>\n> = {\n image: [\n {\n label: \"Built-in fal.ai\",\n model: \"gpt-image-1\",\n command: \"zero generate image --provider built-in --model gpt-image-1 -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"gpt-image-2\",\n command: \"zero generate image --provider built-in --model gpt-image-2 -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"gpt-image-1.5\",\n command:\n \"zero generate image --provider built-in --model gpt-image-1.5 -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"gpt-image-1-mini\",\n command:\n \"zero generate image --provider built-in --model gpt-image-1-mini -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"fal-ai/flux-pro/v1.1\",\n command:\n \"zero generate image --provider built-in --model flux-pro-1.1 -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"fal-ai/flux-pro/v1.1-ultra\",\n command:\n \"zero generate image --provider built-in --model flux-pro-1.1-ultra -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"fal-ai/qwen-image\",\n command: \"zero generate image --provider built-in --model qwen-image -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"fal-ai/bytedance/seedream/v4/text-to-image\",\n command: \"zero generate image --provider built-in --model seedream4 -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"fal-ai/nano-banana-2\",\n command:\n \"zero generate image --provider built-in --model nano-banana-2 -h\",\n reason: \"available without connector setup\",\n },\n ],\n video: [\n {\n label: \"Built-in\",\n model: \"dreamina-seedance-2-0-260128\",\n command:\n \"zero generate video --provider built-in --model dreamina-seedance-2.0 -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in\",\n model: \"dreamina-seedance-2-0-fast-260128\",\n command:\n \"zero generate video --provider built-in --model dreamina-seedance-2.0-fast -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in\",\n model: \"seedance-1-5-pro-251215\",\n command:\n \"zero generate video --provider built-in --model seedance-1.5-pro -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"fal-ai/veo3.1/fast\",\n command: \"zero generate video --provider built-in --model veo3.1-fast -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"fal-ai/kling-video/v3/4k/text-to-video\",\n command: \"zero generate video --provider built-in --model kling-v3-4k -h\",\n reason: \"available without connector setup\",\n },\n ],\n voice: [\n {\n label: \"Built-in\",\n model: \"gpt-4o-mini-tts\",\n command: \"zero generate voice --provider built-in -h\",\n reason: \"available without connector setup\",\n },\n ],\n};\n\nconst BUILT_IN_GENERATION_COMMANDS: Partial<\n Record<GenerationType, BuiltInGenerationCommand>\n> = {\n image: {\n label: \"Built-in image generation\",\n command: \"zero generate image --provider built-in -h\",\n models:\n \"fal.ai: gpt-image-1 (default), gpt-image-2, gpt-image-1.5, gpt-image-1-mini, flux-pro-1.1, flux-pro-1.1-ultra, qwen-image, seedream4, nano-banana-2\",\n },\n video: {\n label: \"Built-in video generation\",\n command: \"zero generate video --provider built-in -h\",\n models:\n \"dreamina-seedance-2.0-fast (default), dreamina-seedance-2.0, seedance-1.5-pro, veo3.1-fast, kling-v3-4k\",\n },\n presentation: {\n label: \"Built-in presentation generation\",\n command: \"zero generate presentation -h\",\n models: \"gpt-5.5\",\n },\n report: {\n label: \"Built-in report generation\",\n command: \"zero generate report -h\",\n models: \"gpt-5.5\",\n },\n \"docs-design\": {\n label: \"Built-in docs design generation\",\n command: \"zero generate docs-design -h\",\n models: \"gpt-5.5\",\n },\n poster: {\n label: \"Built-in poster generation\",\n command: \"zero generate poster -h\",\n models: \"gpt-5.5\",\n },\n \"dashboard-design\": {\n label: \"Built-in dashboard design generation\",\n command: \"zero generate dashboard-design -h\",\n models: \"gpt-5.5\",\n },\n \"mobile-app-design\": {\n label: \"Built-in mobile app design generation\",\n command: \"zero generate mobile-app-design -h\",\n models: \"gpt-5.5\",\n },\n website: {\n label: \"Built-in website generation\",\n command: \"zero generate website -h\",\n models: \"gpt-5.5\",\n },\n sprite: {\n label: \"Built-in sprite asset generation\",\n command: \"zero generate sprite -h\",\n models: \"gpt-image-2 (recommended) via built-in image generation\",\n },\n voice: {\n label: \"Built-in voice generation\",\n command: \"zero generate voice --provider built-in -h\",\n models: \"gpt-4o-mini-tts\",\n },\n};\n\nconst GENERATION_CONTEXT: Partial<Record<GenerationType, GenerationContext>> = {\n website: {\n lines: [\n \"Standalone static website artifacts can be authored locally and published with zero host for a public URL.\",\n \"zero host is for static directories with index.html; it is not a general deploy system for apps that need a backend, database, worker, or long-running process.\",\n \"Existing web app changes should usually follow the project's own build, test, and deploy workflow.\",\n ],\n },\n};\n\nconst GENERATION_TYPE_LABELS: Record<GenerationType, string> = {\n audio: \"Audio\",\n code: \"Code\",\n \"dashboard-design\": \"Dashboard design\",\n document: \"Document\",\n \"docs-design\": \"Docs design\",\n image: \"Image\",\n \"mobile-app-design\": \"Mobile app design\",\n music: \"Music\",\n poster: \"Poster\",\n presentation: \"Presentation\",\n report: \"Report\",\n sprite: \"Sprite\",\n text: \"Text\",\n video: \"Video\",\n voice: \"Voice\",\n website: \"Website\",\n};\n\ntype ConnectedConnector = ConnectorListResponse[\"connectors\"][number];\n\ntype CandidateStatus =\n | \"ready\"\n | \"needs-reconnect\"\n | \"not-authorized\"\n | \"not-connected\"\n | \"not-available\";\n\ninterface ListerOptions {\n all?: boolean;\n}\n\ninterface GenerationCandidate {\n type: ConnectorType;\n label: string;\n status: CandidateStatus;\n reason: string;\n account?: string;\n authMethod?: string;\n actionLabel?: string;\n actionUrl?: string;\n}\n\nfunction getConnectorGenerationType(\n generationType: GenerationType,\n): ConnectorGenerationType | null {\n switch (generationType) {\n case \"voice\":\n case \"music\":\n return \"audio\";\n case \"dashboard-design\":\n case \"docs-design\":\n case \"mobile-app-design\":\n case \"poster\":\n case \"presentation\":\n case \"report\":\n case \"sprite\":\n case \"website\":\n return null;\n case \"audio\":\n case \"code\":\n case \"document\":\n case \"image\":\n case \"text\":\n case \"video\":\n return generationType;\n }\n}\n\nfunction getBuiltInProviders(\n generationType: GenerationType,\n): readonly BuiltInGenerationProvider[] {\n return BUILT_IN_GENERATION_PROVIDERS[generationType] ?? [];\n}\n\nfunction getBuiltInCommand(\n generationType: GenerationType,\n): BuiltInGenerationCommand | null {\n return BUILT_IN_GENERATION_COMMANDS[generationType] ?? null;\n}\n\nfunction getGenerationContext(\n generationType: GenerationType,\n): GenerationContext | null {\n return GENERATION_CONTEXT[generationType] ?? null;\n}\n\nfunction getGenerationConnectors(\n generationType: ConnectorGenerationType,\n): Array<[ConnectorType, ConnectorConfig]> {\n return CONNECTOR_TYPE_KEYS.map((type): [ConnectorType, ConnectorConfig] => {\n return [type, CONNECTOR_TYPES[type]];\n })\n .filter(([type]) => {\n return getConnectorGenerationTypes(type).includes(generationType);\n })\n .sort(([a], [b]) => {\n return a.localeCompare(b);\n });\n}\n\nfunction isConnectorType(type: string): type is ConnectorType {\n return type in CONNECTOR_TYPES;\n}\n\nasync function getFeatureAvailableConnectorTypes(): Promise<\n Set<ConnectorType>\n> {\n const catalog = await searchZeroConnectors();\n return new Set(\n catalog.connectors\n .map((connector) => {\n return connector.id;\n })\n .filter(isConnectorType),\n );\n}\n\nfunction formatAccount(connector: ConnectedConnector): string | undefined {\n if (connector.externalUsername) return `@${connector.externalUsername}`;\n if (connector.externalEmail) return connector.externalEmail;\n if (connector.externalId) return connector.externalId;\n return undefined;\n}\n\nfunction getAction(\n status: CandidateStatus,\n type: ConnectorType,\n label: string,\n agentId: string | undefined,\n platformOrigin: string,\n): { actionLabel?: string; actionUrl?: string } {\n if (status === \"needs-reconnect\") {\n return {\n actionLabel: `Reconnect ${label}`,\n actionUrl: `${platformOrigin}/connectors`,\n };\n }\n\n if (status === \"not-authorized\" && agentId) {\n return {\n actionLabel: `Authorize ${label}`,\n actionUrl: `${platformOrigin}/connectors/${type}/authorize?agentId=${agentId}`,\n };\n }\n\n if (status === \"not-connected\") {\n if (agentId) {\n return {\n actionLabel: `Connect and authorize ${label}`,\n actionUrl: `${platformOrigin}/connectors/${type}/connect?agentId=${agentId}`,\n };\n }\n\n return {\n actionLabel: `Connect ${label}`,\n actionUrl: `${platformOrigin}/connectors/${type}/connect`,\n };\n }\n\n return {};\n}\n\nfunction toCandidate(params: {\n type: ConnectorType;\n config: ConnectorConfig;\n connector: ConnectedConnector | undefined;\n configuredTypes: Set<ConnectorType>;\n availableTypes: Set<ConnectorType>;\n authorizedTypes: Set<string> | null;\n agentId: string | undefined;\n platformOrigin: string;\n}): GenerationCandidate {\n const {\n type,\n config,\n connector,\n configuredTypes,\n availableTypes,\n authorizedTypes,\n agentId,\n platformOrigin,\n } = params;\n\n let status: CandidateStatus;\n let reason: string;\n\n if (!availableTypes.has(type)) {\n status = \"not-available\";\n reason = \"not available for this account\";\n } else if (connector?.needsReconnect) {\n status = \"needs-reconnect\";\n reason = \"connected, reconnect required\";\n } else if (!connector) {\n status = configuredTypes.has(type) ? \"not-connected\" : \"not-available\";\n reason =\n status === \"not-connected\"\n ? agentId\n ? \"not connected or authorized for current agent\"\n : \"not connected\"\n : \"not available in this environment\";\n } else if (authorizedTypes && !authorizedTypes.has(type)) {\n status = \"not-authorized\";\n reason = \"connected, not authorized for current agent\";\n } else {\n status = \"ready\";\n reason = agentId\n ? \"connected and authorized for current agent\"\n : \"connected; agent authorization was not checked\";\n }\n\n return {\n type,\n label: config.label,\n status,\n reason,\n account: connector ? formatAccount(connector) : undefined,\n authMethod: connector?.authMethod,\n ...getAction(status, type, config.label, agentId, platformOrigin),\n };\n}\n\nfunction pad(value: string, width: number): string {\n return value.padEnd(width);\n}\n\nfunction renderRows(candidates: GenerationCandidate[]): void {\n const typeWidth = Math.max(\n 4,\n ...candidates.map((candidate) => {\n return candidate.type.length;\n }),\n );\n const labelWidth = Math.max(\n 5,\n ...candidates.map((candidate) => {\n return candidate.label.length;\n }),\n );\n\n for (const candidate of candidates) {\n const suffix =\n candidate.status === \"ready\"\n ? (candidate.account ?? candidate.authMethod ?? \"\")\n : candidate.reason;\n console.log(\n ` ${pad(candidate.type, typeWidth)} ${pad(candidate.label, labelWidth)} ${suffix}`,\n );\n }\n}\n\nfunction renderActions(candidates: GenerationCandidate[]): void {\n const actionable = candidates.filter((candidate) => {\n return candidate.actionLabel && candidate.actionUrl;\n });\n if (actionable.length === 0) return;\n\n console.log(\"\");\n console.log(\"Next actions:\");\n for (const candidate of actionable) {\n console.log(` [${candidate.actionLabel}](${candidate.actionUrl})`);\n }\n}\n\nfunction renderBuiltInProvider(generationType: GenerationType): void {\n const command = getBuiltInCommand(generationType);\n if (command) {\n console.log(\"\");\n console.log(\"Built-in command:\");\n console.log(` vm0 ${command.label}`);\n console.log(` Models: ${command.models}`);\n console.log(` Use: ${command.command}`);\n return;\n }\n\n const providers = getBuiltInProviders(generationType);\n if (providers.length === 0) return;\n\n console.log(\"\");\n console.log(\n providers.length === 1 ? \"Built-in provider:\" : \"Built-in providers:\",\n );\n for (const provider of providers) {\n console.log(` vm0 ${provider.label} Model: ${provider.model}`);\n console.log(` Use: ${provider.command}`);\n }\n}\n\nfunction renderGenerationContext(generationType: GenerationType): void {\n const context = getGenerationContext(generationType);\n if (!context) return;\n\n console.log(\"\");\n console.log(\"Context:\");\n for (const line of context.lines) {\n console.log(` - ${line}`);\n }\n}\n\nfunction renderText(params: {\n generationType: GenerationType;\n agentId: string | undefined;\n ready: GenerationCandidate[];\n other: GenerationCandidate[];\n showAll: boolean;\n}): void {\n const { generationType, agentId, ready, other, showAll } = params;\n const label = GENERATION_TYPE_LABELS[generationType];\n const scope = agentId ? \"for current agent\" : \"(connected connectors)\";\n\n console.log(`${label} generation choices ${scope}`);\n console.log(\"\");\n\n if (agentId) {\n console.log(`${\"Agent:\".padEnd(10)}${agentId}`);\n console.log(\"\");\n } else {\n console.log(\n \"ZERO_AGENT_ID is not set, so agent authorization could not be checked.\",\n );\n console.log(\"\");\n }\n\n const hasBuiltInCommand = getBuiltInCommand(generationType) !== null;\n const showConnectorSummary =\n ready.length > 0 || !hasBuiltInCommand || showAll;\n if (showConnectorSummary) {\n console.log(\"Connectors:\");\n if (ready.length > 0) {\n renderRows(ready);\n } else {\n console.log(` No ready ${generationType} generation connectors found.`);\n }\n }\n\n renderBuiltInProvider(generationType);\n renderGenerationContext(generationType);\n\n if (showAll && other.length > 0) {\n console.log(\"\");\n console.log(`Other ${generationType} generation connectors`);\n console.log(\"\");\n renderRows(other);\n }\n\n if (showAll) {\n renderActions(other);\n }\n}\n\nexport async function runLister(\n generationType: GenerationType,\n options: ListerOptions = {},\n): Promise<void> {\n const connectorGenerationType = getConnectorGenerationType(generationType);\n const agentId = process.env.ZERO_AGENT_ID;\n const [connectorList, availableTypes, enabledTypes, platformOrigin] =\n await Promise.all([\n listZeroConnectors(),\n getFeatureAvailableConnectorTypes(),\n agentId ? getZeroAgentUserConnectors(agentId) : Promise.resolve(null),\n getPlatformOrigin(),\n ]);\n const connectedMap = new Map(\n connectorList.connectors.map((connector) => {\n return [connector.type, connector];\n }),\n );\n const configuredTypes = new Set(connectorList.configuredTypes);\n const authorizedTypes = enabledTypes ? new Set(enabledTypes) : null;\n const candidates = connectorGenerationType\n ? getGenerationConnectors(connectorGenerationType).map(\n ([connectorType, config]) => {\n return toCandidate({\n type: connectorType,\n config,\n connector: connectedMap.get(connectorType),\n configuredTypes,\n availableTypes,\n authorizedTypes,\n agentId,\n platformOrigin,\n });\n },\n )\n : [];\n const ready = candidates.filter((candidate) => {\n return candidate.status === \"ready\";\n });\n const other = candidates.filter((candidate) => {\n return candidate.status !== \"ready\";\n });\n renderText({\n generationType,\n agentId,\n ready,\n other,\n showAll: options.all === true,\n });\n\n const shouldShowOtherHint =\n !options.all &&\n other.length > 0 &&\n (ready.length > 0 || getBuiltInCommand(generationType) === null);\n if (shouldShowOtherHint) {\n console.log(\"\");\n console.log(\n chalk.dim(\n `Use --all to see every ${generationType} generation candidate.`,\n ),\n );\n }\n}\n","import { createArtifactGenerateCommand } from \"../shared/artifact-generate\";\n\nfunction standardDetails(kind: string) {\n return (options: { title?: string }) => {\n return [\n `Artifact kind: ${kind}`,\n `Requested title/name: ${options.title ?? \"not specified\"}`,\n ];\n };\n}\n\nexport const reportCommand = createArtifactGenerateCommand({\n name: \"report\",\n generationType: \"report\",\n target: \"report\",\n description: \"Generate an HTML report from a prompt\",\n usageCommand: \"zero generate report\",\n examples: ` Generate report: zero generate report --prompt \"A Q2 usage report for the API team\"\n Custom site slug: zero generate report --site-slug api-usage-q2 --prompt \"A Q2 usage report\"\n Show choices: zero generate report`,\n details: standardDetails(\"report\"),\n artifactRules: [\n \"Produce an analytical report, not a marketing page.\",\n \"Use concrete metrics, tables, chart-like visuals, and a clear findings section.\",\n \"Keep source assumptions visible when the prompt does not provide real data.\",\n \"Verify the report is readable at desktop and mobile widths.\",\n ],\n});\n\nexport const docsDesignCommand = createArtifactGenerateCommand({\n name: \"docs-design\",\n generationType: \"docs-design\",\n target: \"docs-design\",\n description: \"Generate a documentation design from a prompt\",\n usageCommand: \"zero generate docs-design\",\n examples: ` Generate docs design: zero generate docs-design --prompt \"Docs for adding artifact targets\"\n Custom site slug: zero generate docs-design --site-slug artifact-target-docs --prompt \"Artifact target docs\"\n Show choices: zero generate docs-design`,\n details: standardDetails(\"docs-design\"),\n artifactRules: [\n \"Produce a documentation design mockup, not a production documentation system.\",\n \"Include navigation, article structure, code or command examples when relevant, and clear section anchors as static design content.\",\n \"Use restrained documentation styling optimized for long-form reading.\",\n \"Verify the page works at mobile and desktop widths.\",\n ],\n});\n\nexport const posterCommand = createArtifactGenerateCommand({\n name: \"poster\",\n generationType: \"poster\",\n target: \"poster\",\n description: \"Generate an HTML poster from a prompt\",\n usageCommand: \"zero generate poster\",\n examples: ` Generate poster: zero generate poster --prompt \"A launch poster for artifact targets\"\n Custom site slug: zero generate poster --site-slug artifact-poster --prompt \"A launch poster\"\n Show choices: zero generate poster`,\n details: standardDetails(\"poster\"),\n artifactRules: [\n \"Produce a poster-style HTML artifact with strong hierarchy and composition.\",\n \"Treat this as an HTML poster surface; do not imply a raster image was generated unless image assets are actually created.\",\n \"Make the poster responsive enough to inspect on mobile and desktop.\",\n \"Keep text deliberate and avoid placeholder copy.\",\n ],\n});\n\nexport const dashboardDesignCommand = createArtifactGenerateCommand({\n name: \"dashboard-design\",\n generationType: \"dashboard-design\",\n target: \"dashboard-design\",\n description: \"Generate a dashboard design from a prompt\",\n usageCommand: \"zero generate dashboard-design\",\n examples: ` Generate dash design: zero generate dashboard-design --prompt \"An ops dashboard for generation runs\"\n Custom site slug: zero generate dashboard-design --site-slug generation-ops --prompt \"A generation ops dashboard\"\n Show choices: zero generate dashboard-design`,\n details: standardDetails(\"dashboard-design\"),\n artifactRules: [\n \"Produce a dashboard design mockup, not a live operational dashboard.\",\n \"Include scannable KPIs, chart-like visuals, lists or tables, and realistic empty/loading/error states as static design content.\",\n \"Prioritize dense, repeat-use UI over decorative sections.\",\n \"Verify the dashboard does not overflow at desktop and mobile widths.\",\n ],\n});\n\nexport const mobileAppDesignCommand = createArtifactGenerateCommand({\n name: \"mobile-app-design\",\n generationType: \"mobile-app-design\",\n target: \"mobile-app-design\",\n description: \"Generate a mobile app design prototype from a prompt\",\n usageCommand: \"zero generate mobile-app-design\",\n examples: ` Generate mobile UI: zero generate mobile-app-design --prompt \"A mobile review screen for generation artifacts\"\n Custom site slug: zero generate mobile-app-design --site-slug generation-mobile-review --prompt \"A mobile review screen\"\n Show choices: zero generate mobile-app-design`,\n details: standardDetails(\"mobile-app-design\"),\n artifactRules: [\n \"Produce a design prototype, not a runnable or installable mobile app.\",\n \"Render the design inside a realistic phone frame with status bar, device chrome, and home indicator when possible.\",\n \"Focus on one mobile screen and one primary job.\",\n \"Use mobile-appropriate tap targets, type sizes, and spacing.\",\n ],\n});\n","import { Command } from \"commander\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport {\n findDesignSystem,\n findTemplate,\n listDesignSystems,\n listTemplates,\n type GenerationTarget,\n toGenerationTarget,\n} from \"./resource-registry\";\nimport {\n canonicalizeRegistryId,\n formatRegistryListing,\n} from \"./resource-listing\";\nimport { createHtmlArtifactAuthoringPacket } from \"./html-artifact-authoring\";\nimport { dispatchGenerate } from \"../generate/lib/dispatch\";\nimport type { GenerationType } from \"../generate/lib/lister\";\n\ninterface ArtifactOptions {\n prompt?: string;\n siteSlug?: string;\n title?: string;\n designSystem?: string;\n template?: string;\n}\n\ninterface ArtifactCommandConfig {\n name: string;\n generationType: GenerationType;\n target: GenerationTarget;\n description: string;\n usageCommand: string;\n examples: string;\n details: (options: ArtifactOptions) => readonly string[];\n artifactRules: readonly string[];\n}\n\nfunction unknownDesignSystemError(id: string, usageCommand: string): Error {\n const designSystems = listDesignSystems();\n const message = [\n `Unknown design system: ${id}`,\n \"\",\n \"Available design systems:\",\n formatRegistryListing(designSystems, \"design systems\"),\n \"\",\n `Example:`,\n ` ${usageCommand} --design-system ${\n designSystems[0]?.id ?? \"<design-system-id>\"\n } --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nfunction unknownTemplateError(\n id: string,\n usageCommand: string,\n target: GenerationTarget,\n): Error {\n const templates = listTemplates(target);\n const message = [\n `Unknown template for ${target}: ${id}`,\n \"\",\n `Available templates for ${target}:`,\n formatRegistryListing(templates, `${target} templates`),\n \"\",\n `Example:`,\n ` ${usageCommand} --template ${\n templates[0]?.id ?? \"<template-id>\"\n } --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nexport function createArtifactGenerateCommand(\n config: ArtifactCommandConfig,\n): Command {\n return new Command()\n .name(config.name)\n .description(config.description)\n .option(\"--prompt <text>\", \"Artifact prompt; can also be piped via stdin\")\n .option(\"--site-slug <slug>\", \"Hosted site slug override\")\n .option(\"--title <text>\", \"Requested artifact title or name\")\n .option(\n \"--design-system <id>\",\n \"Design system id from the registry (see Design Systems below). Accepts either 'apple' or 'design-system:apple'.\",\n )\n .option(\n \"--template <id>\",\n `Template id from the registry, scoped to ${config.target} (see Templates below). Accepts either short id or full 'template:<id>'.`,\n )\n .addHelpText(\"after\", () => {\n const designSystems = listDesignSystems();\n const templates = listTemplates(config.target);\n return `\nExamples:\n${config.examples}\n\nOutput:\n Prints a source-selection packet for the current agent. The\n agent authors a static HTML artifact and hosts it with zero host. With no\n --prompt and no piped input, prints the generation choices instead.\n\nNotes:\n - Authenticates via ZERO_TOKEN\n\nDesign Systems:\n${formatRegistryListing(designSystems, \"design systems\")}\n\nTemplates (${config.target}):\n${formatRegistryListing(templates, `${config.target} templates`)}`;\n })\n .action(\n withErrorHandler(async (options: ArtifactOptions) => {\n const dispatch = await dispatchGenerate({\n generationType: config.generationType,\n prompt: options.prompt,\n });\n if (dispatch.outcome === \"handled\") return;\n const prompt = dispatch.prompt;\n\n let resolvedDesignSystem;\n if (options.designSystem !== undefined) {\n const canonical = canonicalizeRegistryId(\n \"design-system\",\n options.designSystem,\n );\n const entry = findDesignSystem(canonical);\n if (!entry) {\n throw unknownDesignSystemError(\n options.designSystem,\n config.usageCommand,\n );\n }\n resolvedDesignSystem = entry;\n }\n\n let resolvedTemplate;\n if (options.template !== undefined) {\n const canonical = canonicalizeRegistryId(\n \"template\",\n options.template,\n );\n const entry = findTemplate(canonical);\n if (!entry || !entry.targets?.includes(config.target)) {\n throw unknownTemplateError(\n options.template,\n config.usageCommand,\n config.target,\n );\n }\n resolvedTemplate = entry;\n }\n\n const extraDetails = [\n `Selected design system: ${\n resolvedDesignSystem\n ? `${resolvedDesignSystem.id} (${resolvedDesignSystem.name})`\n : \"agent decides\"\n }`,\n `Selected template: ${\n resolvedTemplate\n ? `${resolvedTemplate.id} (${resolvedTemplate.name})`\n : \"agent decides\"\n }`,\n ];\n\n const packet = createHtmlArtifactAuthoringPacket({\n kind: toGenerationTarget(config.target),\n prompt,\n slugSource: options.title,\n siteSlug: options.siteSlug,\n details: [...config.details(options), ...extraDetails],\n artifactRules: config.artifactRules,\n });\n\n console.log(packet.instructions);\n }),\n );\n}\n","import {\n type GenerationOutputKind,\n type ResourceCandidateSlice,\n type GenerationTarget,\n selectResourceCandidates,\n} from \"./resource-registry\";\n\ntype HtmlArtifactKind = GenerationTarget;\n\ninterface HtmlArtifactAuthoringOptions {\n readonly kind: HtmlArtifactKind;\n readonly prompt: string;\n readonly slugSource?: string;\n readonly siteSlug?: string;\n readonly details: readonly string[];\n readonly artifactRules: readonly string[];\n}\n\ninterface HtmlArtifactAuthoringPacket {\n readonly type: \"generation-source-selection\";\n readonly kind: HtmlArtifactKind;\n readonly prompt: string;\n readonly registryVersion: string;\n readonly artifact: {\n readonly outputMode: \"primary-artifact-with-supporting-assets\";\n readonly primaryArtifact: {\n readonly kind: GenerationOutputKind;\n readonly path: string;\n };\n readonly supportingAssets: readonly {\n readonly kind: GenerationOutputKind | \"metadata\";\n readonly path: string;\n readonly optional: boolean;\n }[];\n readonly previewKind: \"hosted-url\";\n readonly outputDir: string;\n };\n readonly selection: {\n readonly candidates: ResourceCandidateSlice[\"candidates\"];\n readonly outputSchema: {\n readonly skills: \"string[]\";\n readonly template: \"string\";\n readonly designSystem: \"string | null\";\n readonly imageStyle: \"string | null\";\n readonly audioStyle: \"string | null\";\n readonly videoTemplate: \"string | null\";\n readonly bundleTemplate: \"string | null\";\n readonly rationale: \"string\";\n };\n };\n readonly authoring: {\n readonly details: readonly string[];\n readonly artifactRules: readonly string[];\n };\n readonly outputDir: string;\n readonly site: string;\n readonly hostCommand: string;\n readonly instructions: string;\n}\n\nfunction slugify(value: string): string {\n const slug = value\n .toLowerCase()\n .replace(/[^a-z0-9]+/gu, \"-\")\n .replace(/^-+|-+$/gu, \"\")\n .replace(/-{2,}/gu, \"-\")\n .slice(0, 48)\n .replace(/-+$/u, \"\");\n return slug.length >= 3 ? slug : \"html-artifact\";\n}\n\nfunction titleForKind(kind: HtmlArtifactKind): string {\n const titles: Record<HtmlArtifactKind, string> = {\n image: \"image\",\n presentation: \"HTML presentation\",\n website: \"hosted website\",\n \"dashboard-design\": \"dashboard design prototype\",\n \"mobile-app-design\": \"mobile app design prototype\",\n poster: \"poster\",\n \"intro-video\": \"intro video storyboard\",\n report: \"report\",\n \"docs-design\": \"documentation design prototype\",\n };\n\n return titles[kind];\n}\n\nfunction outputDirForSite(site: string): string {\n return `./generated/mockups/${site}`;\n}\n\nexport function createHtmlArtifactAuthoringPacket(\n options: HtmlArtifactAuthoringOptions,\n): HtmlArtifactAuthoringPacket {\n const site =\n options.siteSlug ?? slugify(options.slugSource ?? options.prompt);\n const outputDir = outputDirForSite(site);\n const hostCommand = `zero host ${outputDir} --site ${site}${\n options.kind === \"website\" ? \" --spa\" : \"\"\n }`;\n const title = titleForKind(options.kind);\n const candidateSlice = selectResourceCandidates(options.kind);\n const selectionSchema = {\n skills: \"string[]\",\n template: \"string\",\n designSystem: \"string | null\",\n imageStyle: \"string | null\",\n audioStyle: \"string | null\",\n videoTemplate: \"string | null\",\n bundleTemplate: \"string | null\",\n rationale: \"string\",\n } as const;\n const artifact = {\n outputMode: \"primary-artifact-with-supporting-assets\",\n primaryArtifact: {\n kind: options.kind as GenerationOutputKind,\n path: `${outputDir}/index.html`,\n },\n supportingAssets: [\n {\n kind: \"image\",\n path: `${outputDir}/assets/`,\n optional: true,\n },\n {\n kind: \"audio\",\n path: `${outputDir}/assets/`,\n optional: true,\n },\n {\n kind: \"video\",\n path: `${outputDir}/assets/`,\n optional: true,\n },\n {\n kind: \"metadata\",\n path: `${outputDir}/metadata.json`,\n optional: true,\n },\n ],\n previewKind: \"hosted-url\",\n outputDir,\n } as const;\n const instructions = [\n `# Zero generate ${options.kind}`,\n \"\",\n \"This is a federated generation source-selection packet for the current agent.\",\n `Zero is not generating this ${title} on the server. You select resources, resolve them, and author the artifact.`,\n \"\",\n \"## User Prompt\",\n options.prompt,\n \"\",\n \"## Stage 1: Resource Selection\",\n \"- Choose generation resources from the bundled federated registry slice below.\",\n \"- Select one template, one or more skills, zero or one design system, and optional media/style resources when relevant.\",\n \"- Choose only IDs present in this packet; do not invent registry IDs.\",\n \"- Prefer compatible resources, but the user prompt is the highest-priority signal.\",\n \"- Treat the selection JSON as internal working state, then continue to authoring.\",\n \"\",\n \"## Selection Output Schema\",\n \"```json\",\n JSON.stringify(selectionSchema, null, 2),\n \"```\",\n \"\",\n \"## Candidate Registry Slice\",\n `Registry: \\`${candidateSlice.registryVersion}\\``,\n \"Sources:\",\n ...candidateSlice.sources.map((src) => {\n return `- \\`${src.repo}@${src.ref}\\``;\n }),\n \"\",\n \"```json\",\n JSON.stringify(candidateSlice.candidates, null, 2),\n \"```\",\n \"\",\n \"## Stage 2: Resolve Selected Resources\",\n \"- For every selected resource, fetch or read the referenced source before authoring.\",\n \"- Each candidate carries a `source` object with `path` and optional `repo`/`ref`; when `repo`/`ref` are omitted, fall back to the registry-level source above.\",\n \"- For directory refs, inspect the most relevant files such as `SKILL.md`, `DESIGN.md`, `README.md`, tokens, examples, and templates.\",\n \"- If a source file cannot be fetched, state that limitation and fall back to the registry metadata for that resource.\",\n \"\",\n \"## Stage 3: Author Artifact\",\n `Author a production-quality ${title} as a static HTML artifact using the selected generation resources.`,\n \"\",\n \"## Artifact Output Model\",\n `- Primary artifact: \\`${artifact.primaryArtifact.kind}\\` at \\`${artifact.primaryArtifact.path}\\`.`,\n `- Output mode: \\`${artifact.outputMode}\\`.`,\n \"- Supporting images, audio, video, or metadata may live inside the same output directory when the result needs them.\",\n \"- Treat the output directory as a project bundle when multiple media types are generated, while keeping the HTML entry point primary.\",\n \"\",\n \"## Output Contract\",\n `- Write the artifact under \\`${outputDir}/\\`.`,\n `- The entry file must be \\`${outputDir}/index.html\\`.`,\n \"- Keep every local asset inside the same output directory.\",\n \"- Do not reference files from another project path.\",\n \"- Use descriptive filenames and canonical HTML: close non-void tags and double-quote attributes.\",\n \"- Prefer a single self-contained HTML file unless the artifact genuinely needs separate assets.\",\n \"\",\n \"## Requested Parameters\",\n ...options.details.map((detail) => {\n return `- ${detail}`;\n }),\n \"\",\n \"## Authoring Rules\",\n \"- Let the selected template define structure, the selected design system define visual language, and the selected skills define process.\",\n \"- Read the local codebase, brand assets, and existing design systems when the prompt depends on this repository.\",\n \"- Avoid generic AI design defaults: no stock SaaS gradients, no emoji-as-icons, no filler stats, no decorative chrome that does not help the artifact.\",\n \"- Build the actual artifact first, not a marketing explanation of the artifact.\",\n \"- Make controls and interactions real when they are visible.\",\n \"- Keep text readable at desktop and mobile preview sizes.\",\n ...options.artifactRules.map((rule) => {\n return `- ${rule}`;\n }),\n \"\",\n \"## Verification\",\n \"- Use `agent-browser` for browser verification when available. Start with `agent-browser skills get core` if you need command guidance.\",\n \"- Prefer `agent-browser` over Playwright, Puppeteer, or installing browser automation dependencies.\",\n \"- Open the HTML locally and verify it is nonblank.\",\n \"- Check that keyboard/click interactions work when present.\",\n \"- Check that text does not overflow or overlap at desktop and mobile viewport sizes.\",\n \"- Run the final hosting command only after the artifact looks correct.\",\n \"\",\n \"## Publish\",\n `When everything is OK, publish it with:`,\n \"\",\n \"```bash\",\n hostCommand,\n \"```\",\n ].join(\"\\n\");\n\n return {\n type: \"generation-source-selection\",\n kind: options.kind,\n prompt: options.prompt,\n registryVersion: candidateSlice.registryVersion,\n artifact,\n selection: {\n candidates: candidateSlice.candidates,\n outputSchema: selectionSchema,\n },\n authoring: {\n details: options.details,\n artifactRules: options.artifactRules,\n },\n outputDir,\n site,\n hostCommand,\n instructions,\n };\n}\n","import { createPresentationGenerateCommand } from \"../shared/presentation-generate\";\n\nexport const presentationCommand = createPresentationGenerateCommand({\n name: \"presentation\",\n generationType: \"presentation\",\n usageCommand: \"zero generate presentation\",\n examples: ` Generate deck: zero generate presentation --prompt \"A strategy deck for reducing support volume\"\n Pipe prompt: cat brief.txt | zero generate presentation\n Pick slide count: zero generate presentation --slides 10 --prompt \"A product launch narrative\"\n Custom site slug: zero generate presentation --site-slug api-migration-plan --prompt \"API migration plan\"\n Show choices: zero generate presentation`,\n});\n","import { Command, InvalidArgumentError } from \"commander\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { createHtmlArtifactAuthoringPacket } from \"./html-artifact-authoring\";\nimport {\n findDesignSystem,\n findTemplate,\n listDesignSystems,\n listTemplates,\n} from \"./resource-registry\";\nimport {\n canonicalizeRegistryId,\n formatRegistryListing,\n} from \"./resource-listing\";\nimport { dispatchGenerate } from \"../generate/lib/dispatch\";\nimport type { GenerationType } from \"../generate/lib/lister\";\n\nconst PRESENTATION_TARGET = \"presentation\";\n\ninterface PresentationOptions {\n prompt?: string;\n slides: number;\n title?: string;\n siteSlug?: string;\n designSystem?: string;\n template?: string;\n}\n\ninterface PresentationGenerateCommandConfig {\n name: string;\n generationType: GenerationType;\n usageCommand: string;\n examples: string;\n}\n\nfunction parseSlideCount(value: string): number {\n const slideCount = Number(value);\n if (!Number.isInteger(slideCount)) {\n throw new InvalidArgumentError(\"slides must be an integer\");\n }\n return slideCount;\n}\n\nfunction unknownDesignSystemError(id: string, usageCommand: string): Error {\n const designSystems = listDesignSystems();\n const message = [\n `Unknown design system: ${id}`,\n \"\",\n \"Available design systems:\",\n formatRegistryListing(designSystems, \"design systems\"),\n \"\",\n `Example:`,\n ` ${usageCommand} --design-system ${\n designSystems[0]?.id ?? \"<design-system-id>\"\n } --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nfunction unknownTemplateError(\n id: string,\n usageCommand: string,\n target: string,\n): Error {\n const templates = listTemplates(PRESENTATION_TARGET);\n const message = [\n `Unknown template for ${target}: ${id}`,\n \"\",\n `Available templates for ${target}:`,\n formatRegistryListing(templates, `${target} templates`),\n \"\",\n `Example:`,\n ` ${usageCommand} --template ${\n templates[0]?.id ?? \"<template-id>\"\n } --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nexport function createPresentationGenerateCommand(\n config: PresentationGenerateCommandConfig,\n): Command {\n return new Command()\n .name(config.name)\n .description(\"Generate an HTML presentation from a prompt\")\n .option(\n \"--prompt <text>\",\n \"Presentation prompt; can also be piped via stdin\",\n )\n .option(\"--site-slug <slug>\", \"Hosted site slug override\")\n .option(\"--title <text>\", \"Requested deck title\")\n .option(\n \"--design-system <id>\",\n \"Design system id from the registry (see Design Systems below). Accepts either 'apple' or 'design-system:apple'.\",\n )\n .option(\n \"--template <id>\",\n \"Template id from the registry, scoped to presentation (see Templates below). Accepts either 'html-ppt-pitch-deck' or 'template:html-ppt-pitch-deck'.\",\n )\n .option(\"--slides <count>\", \"Slide count: 4-20\", parseSlideCount, 8)\n .addHelpText(\"after\", () => {\n const designSystems = listDesignSystems();\n const templates = listTemplates(PRESENTATION_TARGET);\n return `\nExamples:\n${config.examples}\n\nOutput:\n Prints a source-selection packet for the current agent.\n\nNotes:\n - Authenticates via ZERO_TOKEN\n - The agent authors the HTML presentation artifact and hosts it with zero host\n\nDesign Systems:\n${formatRegistryListing(designSystems, \"design systems\")}\n\nTemplates (presentation):\n${formatRegistryListing(templates, \"presentation templates\")}`;\n })\n .action(\n withErrorHandler(async (options: PresentationOptions) => {\n const dispatch = await dispatchGenerate({\n generationType: config.generationType,\n prompt: options.prompt,\n });\n if (dispatch.outcome === \"handled\") return;\n const prompt = dispatch.prompt;\n\n let resolvedDesignSystem;\n if (options.designSystem !== undefined) {\n const canonical = canonicalizeRegistryId(\n \"design-system\",\n options.designSystem,\n );\n const entry = findDesignSystem(canonical);\n if (!entry) {\n throw unknownDesignSystemError(\n options.designSystem,\n config.usageCommand,\n );\n }\n resolvedDesignSystem = entry;\n }\n\n let resolvedTemplate;\n if (options.template !== undefined) {\n const canonical = canonicalizeRegistryId(\n \"template\",\n options.template,\n );\n const entry = findTemplate(canonical);\n if (!entry || !entry.targets?.includes(PRESENTATION_TARGET)) {\n throw unknownTemplateError(\n options.template,\n config.usageCommand,\n PRESENTATION_TARGET,\n );\n }\n resolvedTemplate = entry;\n }\n\n const packet = createHtmlArtifactAuthoringPacket({\n kind: \"presentation\",\n prompt,\n slugSource: options.title,\n siteSlug: options.siteSlug,\n details: [\n `Slide count: ${options.slides}`,\n `Requested deck title: ${options.title ?? \"not specified\"}`,\n `Selected design system: ${\n resolvedDesignSystem\n ? `${resolvedDesignSystem.id} (${resolvedDesignSystem.name})`\n : \"agent decides\"\n }`,\n `Selected template: ${\n resolvedTemplate\n ? `${resolvedTemplate.id} (${resolvedTemplate.name})`\n : \"agent decides\"\n }`,\n ],\n artifactRules: [\n \"Think like a presentation designer, not a web page designer.\",\n \"Use a fixed 1920x1080 slide canvas and scale it uniformly for smaller viewports.\",\n \"Use one section per slide and keep repeated elements in consistent positions.\",\n \"Make keyboard navigation work with ArrowLeft, ArrowRight, Home, and End.\",\n \"Keep slide text readable from across a room; avoid memo-like walls of text.\",\n \"Before laying out slides, establish the deck's arc: the opening problem or question, how it develops, and what conclusion lands; every slide should serve a clear narrative role in that arc.\",\n \"Vary slide forms across the deck — full-bleed statement, evidence with data, pull quote, section break, summary — and avoid defaulting every slide to title-plus-bullets.\",\n \"Each slide carries one idea; prefer a single strong statement over a list, and never exceed three bullets on any slide.\",\n ],\n });\n\n console.log(packet.instructions);\n }),\n );\n}\n","import { Command } from \"commander\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport {\n createSpriteAuthoringPacket,\n type SpritePlan,\n} from \"../shared/sprite-authoring\";\nimport { dispatchGenerate } from \"./lib/dispatch\";\n\nconst SPRITE_USAGE_COMMAND = \"zero generate sprite\";\nconst DEFAULT_MODEL = \"gpt-image-2\";\nconst AGENT_DECIDES = \"agent decides\";\n\nconst ASSET_TYPES = [\n \"player\",\n \"npc\",\n \"creature\",\n \"character\",\n \"spell\",\n \"projectile\",\n \"impact\",\n \"prop\",\n \"summon\",\n \"fx\",\n] as const;\n\nconst ACTIONS = [\n \"single\",\n \"idle\",\n \"cast\",\n \"attack\",\n \"shoot\",\n \"jump\",\n \"hurt\",\n \"combat\",\n \"walk\",\n \"run\",\n \"hover\",\n \"charge\",\n \"projectile\",\n \"impact\",\n \"explode\",\n \"death\",\n] as const;\n\nconst VIEWS = [\"topdown\", \"side\", \"3-4\"] as const;\n\nconst SHEETS = [\n \"auto\",\n \"2x2\",\n \"2x3\",\n \"2x4\",\n \"3x3\",\n \"3x4\",\n \"4x4\",\n \"5x5\",\n \"strip-1x3\",\n \"strip-1x4\",\n \"custom\",\n] as const;\n\nconst BUNDLES = [\n \"single\",\n \"unit\",\n \"spell\",\n \"combat\",\n \"line\",\n \"hero-action\",\n \"engine-atlas\",\n] as const;\n\nconst ART_STYLES = [\n \"pixel-art\",\n \"clean-hd\",\n \"pixel-inspired\",\n \"retro-pixel\",\n \"map-style\",\n \"project-native\",\n] as const;\n\nconst ANCHORS = [\"center\", \"bottom\", \"feet\"] as const;\nconst MARGINS = [\"tight\", \"normal\", \"safe\"] as const;\nconst EFFECT_POLICIES = [\"all\", \"largest\"] as const;\n\ninterface SpriteOptions {\n readonly prompt?: string;\n readonly assetType?: string;\n readonly action?: string;\n readonly view?: string;\n readonly sheet?: string;\n readonly frames?: string;\n readonly bundle?: string;\n readonly artStyle?: string;\n readonly anchor?: string;\n readonly margin?: string;\n readonly effectPolicy?: string;\n readonly reference?: string;\n readonly model: string;\n readonly name?: string;\n}\n\nfunction validateEnum(\n flag: string,\n value: string | undefined,\n allowed: readonly string[],\n): void {\n if (value !== undefined && !allowed.includes(value)) {\n throw new Error(\n `${flag} must be one of: ${allowed.join(\", \")} (got \"${value}\")`,\n );\n }\n}\n\nfunction resolveFrames(value: string | undefined): string {\n if (value === undefined) {\n return AGENT_DECIDES;\n }\n if (value === \"auto\") {\n return value;\n }\n const frames = Number(value);\n if (!Number.isInteger(frames) || frames < 1 || frames > 64) {\n throw new Error(\"--frames must be 'auto' or an integer from 1 to 64\");\n }\n return String(frames);\n}\n\nfunction slugify(value: string): string {\n const slug = value\n .toLowerCase()\n .replace(/[^a-z0-9]+/gu, \"-\")\n .replace(/^-+|-+$/gu, \"\")\n .replace(/-{2,}/gu, \"-\")\n .slice(0, 48)\n .replace(/-+$/u, \"\");\n return slug.length >= 3 ? slug : \"sprite\";\n}\n\nexport const spriteCommand = new Command()\n .name(\"sprite\")\n .description(\n \"Prepare 2D game sprite/asset authoring instructions from a prompt\",\n )\n .option(\"--prompt <text>\", \"Sprite prompt/theme; can also be piped via stdin\")\n .option(\"--asset-type <type>\", `Asset type: ${ASSET_TYPES.join(\", \")}`)\n .option(\"--action <action>\", `Animation/action: ${ACTIONS.join(\", \")}`)\n .option(\n \"--view <view>\",\n `Camera view: ${VIEWS.join(\", \")} (3-4 means 3/4 view)`,\n )\n .option(\"--sheet <grid>\", `Sheet/grid shape: ${SHEETS.join(\", \")}`, \"auto\")\n .option(\"--frames <count>\", \"Frame count: 'auto' or an integer (1-64)\")\n .option(\"--bundle <preset>\", `Bundle preset: ${BUNDLES.join(\", \")}`)\n .option(\n \"--art-style <style>\",\n `Sprite art style (the sprite analog of 'zero generate image --style'): ${ART_STYLES.join(\", \")}`,\n )\n .option(\"--anchor <anchor>\", `Frame anchor: ${ANCHORS.join(\", \")}`)\n .option(\"--margin <margin>\", `Safe-area margin: ${MARGINS.join(\", \")}`)\n .option(\n \"--effect-policy <policy>\",\n `Detached-FX component policy: ${EFFECT_POLICIES.join(\", \")}`,\n )\n .option(\n \"--reference <url>\",\n \"Reference image URL for identity/style consistency\",\n )\n .option(\n \"--model <model>\",\n \"Recommended image model for raw sheets\",\n DEFAULT_MODEL,\n )\n .option(\"--name <slug>\", \"Output bundle name/slug\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Generate sprite: ${SPRITE_USAGE_COMMAND} --prompt \"A green slime monster idle loop\"\n Pick asset + action: ${SPRITE_USAGE_COMMAND} --asset-type creature --action idle --sheet 3x3 --prompt \"A fire dragon boss\"\n Hero action bundle: ${SPRITE_USAGE_COMMAND} --asset-type player --bundle hero-action --view side --prompt \"A knight with idle, run, attack, jump\"\n 4-direction walk: ${SPRITE_USAGE_COMMAND} --asset-type player --action walk --view topdown --sheet 4x4 --prompt \"A 16-bit RPG villager\"\n Pixel art style: ${SPRITE_USAGE_COMMAND} --art-style pixel-art --prompt \"A retro fireball projectile\" --sheet 2x2\n Match a reference: ${SPRITE_USAGE_COMMAND} --reference https://example.com/hero.png --action attack --prompt \"Attack animation for this hero\"\n Pipe prompt: cat brief.txt | ${SPRITE_USAGE_COMMAND}\n Show choices: ${SPRITE_USAGE_COMMAND}\n\nOutput:\n Prints a sprite source-selection packet for the current agent: the resolved\n plan, the recommended image model, the upstream sprite skill to resolve, and\n the hard containment rules for grids, identity, and FX.\n With no --prompt and no piped input, prints the generation choices instead.\n\nNotes:\n - The agent generates each raw sheet with built-in image generation\n (gpt-image-2 recommended) on a solid magenta background, then runs the\n sprite skill's local processor for chroma-key cleanup, frame extraction,\n alignment, QC, and transparent/GIF export.\n - Raw sprite art must originate from image generation, never from code-drawn\n primitives (Three.js/Canvas/SVG/HTML/PIL).\n - Unset flags resolve to \"agent decides\"; the agent infers them from the\n prompt and the skill's modes reference.`,\n )\n .action(\n withErrorHandler(async (options: SpriteOptions) => {\n validateEnum(\"--asset-type\", options.assetType, ASSET_TYPES);\n validateEnum(\"--action\", options.action, ACTIONS);\n validateEnum(\"--view\", options.view, VIEWS);\n validateEnum(\"--sheet\", options.sheet, SHEETS);\n validateEnum(\"--bundle\", options.bundle, BUNDLES);\n validateEnum(\"--art-style\", options.artStyle, ART_STYLES);\n validateEnum(\"--anchor\", options.anchor, ANCHORS);\n validateEnum(\"--margin\", options.margin, MARGINS);\n validateEnum(\"--effect-policy\", options.effectPolicy, EFFECT_POLICIES);\n const frames = resolveFrames(options.frames);\n\n const dispatch = await dispatchGenerate({\n generationType: \"sprite\",\n prompt: options.prompt,\n });\n if (dispatch.outcome === \"handled\") return;\n const prompt = dispatch.prompt;\n\n const plan: SpritePlan = {\n assetType: options.assetType ?? AGENT_DECIDES,\n action: options.action ?? AGENT_DECIDES,\n view: options.view ?? AGENT_DECIDES,\n sheet: options.sheet ?? \"auto\",\n frames,\n bundle: options.bundle ?? AGENT_DECIDES,\n artStyle: options.artStyle ?? AGENT_DECIDES,\n anchor: options.anchor ?? AGENT_DECIDES,\n margin: options.margin ?? AGENT_DECIDES,\n effectPolicy: options.effectPolicy ?? AGENT_DECIDES,\n reference: options.reference ?? \"none\",\n model: options.model,\n name: slugify(options.name ?? prompt),\n };\n\n const packet = createSpriteAuthoringPacket({ prompt, plan });\n console.log(packet.instructions);\n }),\n );\n","/**\n * Sprite generation source-selection packet.\n *\n * `zero generate sprite` does not run a server-side pipeline. Like the website\n * and styled-image commands, it \"bounces\" a structured authoring packet back to\n * the calling agent: the resolved sprite plan, the recommended image model, the\n * upstream sprite skill to resolve, and the hard containment rules the agent\n * must honor when it drives built-in image generation plus local postprocessing.\n */\n\nexport interface SpritePlan {\n readonly assetType: string;\n readonly action: string;\n readonly view: string;\n readonly sheet: string;\n readonly frames: string;\n readonly bundle: string;\n readonly artStyle: string;\n readonly anchor: string;\n readonly margin: string;\n readonly effectPolicy: string;\n readonly reference: string;\n readonly model: string;\n readonly name: string;\n}\n\ninterface SpriteAuthoringOptions {\n readonly prompt: string;\n readonly plan: SpritePlan;\n}\n\ninterface SpriteAuthoringPacket {\n readonly type: \"generation-source-selection\";\n readonly kind: \"sprite\";\n readonly prompt: string;\n readonly plan: SpritePlan;\n readonly model: string;\n readonly outputDir: string;\n readonly skill: {\n readonly repo: string;\n readonly ref: string;\n readonly skillPath: string;\n readonly references: readonly string[];\n readonly script: string;\n };\n readonly instructions: string;\n}\n\nconst SPRITE_SKILL = {\n repo: \"0x0funky/agent-sprite-forge\",\n ref: \"main\",\n skillPath: \"skills/generate2dsprite/SKILL.md\",\n references: [\n \"skills/generate2dsprite/references/prompt-rules.md\",\n \"skills/generate2dsprite/references/modes.md\",\n ],\n script: \"skills/generate2dsprite/scripts/generate2dsprite.py\",\n} as const;\n\nconst CORE_INVARIANTS = [\n \"Every raw sprite image must come from built-in image generation. Never draw raw sprite art with Three.js, Canvas, SVG, HTML/CSS, PIL shapes, procedural geometry, placeholder primitives, or code-rendered screenshots. Code may only assemble layout guides, postprocess generated images, or display finished assets at runtime.\",\n \"Background is 100% solid flat magenta `#FF00FF` with no gradient, so the local processor can chroma-key it to transparency. Keep this rule unless the user explicitly wants a different processing workflow.\",\n \"No text, labels, UI, speech bubbles, borders, or frames between cells. Generate the exact requested grid count only.\",\n \"Keep the same asset identity, the same bounding box, and the same pixel scale across every frame.\",\n \"Containment: the entire subject fits fully inside each cell with magenta margin on all four sides. No limb, weapon, tail, wing tip, orb, spark, or trail may cross a cell edge.\",\n \"Do not use raw single-row sheets (1x4, 1x6, 1x8, 1xN) for any body subject — players, heroes, creatures, NPCs, enemies, summons, or animated props. Use centered multi-row grids: 4 frames -> 2x2, 6 -> 2x3, 8 -> 2x4, 9 -> 3x3, 12 -> 3x4 or 4x3, 16 -> 4x4.\",\n \"For controllable heroes and main characters, attack/shoot/cast body sheets are body-only by default and must preserve idle/run body scale and the feet/bottom anchor. Generate slash arcs, weapon trails, muzzle flashes, projectiles, dust, and impacts as separate fx/projectile/impact sheets unless the runtime explicitly supports wider per-action cells plus per-action origins.\",\n \"For map prop packs, classify props first. Square 2x2/3x3/4x4 packs are only for compact props. Floors, platforms, bridges, walls, ladders, gates, doors, long hazards, wide/tall props, collision-bearing objects, and tileset/strip pieces use one-by-one generation, 1x3/1x4 strips, custom wide cells, or a tileset-like atlas instead.\",\n \"Mixed-action atlases (4x4, 5x5, custom) are a deterministic delivery step assembled from separate per-action sheets after each passes QC — never one raw mixed-action image. Raw multi-cell grids are valid only for one coherent action family, canonical directional locomotion, prop packs, or tileset-like atlases.\",\n] as const;\n\nconst WORKFLOW = [\n \"1. Resolve the upstream skill below, then infer or confirm the asset plan. Pick the smallest useful output and do not pad unrelated actions into one raw sheet.\",\n \"2. Write the art prompt by hand using the skill's prompt-rules. Lock the art style, the exact sheet shape, the solid magenta background, the identity, and the containment rules. Do not delegate prompt writing to a script.\",\n \"3. Generate each raw sheet with built-in image generation using the recommended model below. If a reference is involved, make it visible to the model first (view a local file before generating); never pass a bare filesystem path as the visual reference.\",\n \"4. Postprocess each raw sheet locally with the skill's processor script: magenta cleanup, frame extraction, alignment, shared-scale normalization, component filtering, QC metadata, transparent sheet export, and GIF export.\",\n \"5. QC each sheet: no frame touches a cell edge, scale is consistent, detached FX did not become noise, the sheet reads as one coherent animation, and hero/player body height matches the accepted idle/run scale within ~10-15%. Reprocess or regenerate if it fails.\",\n \"6. Return the bundle for the resolved plan (single sheet, unit/spell/combat bundle, line bundle, or hero action bundle with separate FX assets and an optional assembled engine atlas after per-action QC).\",\n] as const;\n\nconst EXPECTED_OUTPUTS = [\n \"`raw-sheet.png` (and one raw sheet per action for bundles)\",\n \"`raw-sheet-clean.png` (magenta cleaned)\",\n \"`sheet-transparent.png`\",\n \"per-frame PNGs\",\n \"`animation.gif` (per direction/action where applicable)\",\n \"`prompt-used.txt`\",\n \"`pipeline-meta.json`\",\n] as const;\n\nexport function createSpriteAuthoringPacket(\n options: SpriteAuthoringOptions,\n): SpriteAuthoringPacket {\n const { prompt, plan } = options;\n const outputDir = `./generated/sprites/${plan.name}`;\n\n const planEntries: ReadonlyArray<readonly [string, string]> = [\n [\"Asset type\", plan.assetType],\n [\"Action\", plan.action],\n [\"View\", plan.view],\n [\"Sheet / grid\", plan.sheet],\n [\"Frames\", plan.frames],\n [\"Bundle\", plan.bundle],\n [\"Art style\", plan.artStyle],\n [\"Anchor\", plan.anchor],\n [\"Margin\", plan.margin],\n [\"Effect policy\", plan.effectPolicy],\n [\"Reference\", plan.reference],\n ];\n\n const instructions = [\n \"# Zero generate sprite\",\n \"\",\n \"This is a federated generation source-selection packet for the current agent.\",\n \"Zero is not generating these sprites on the server. You resolve the sprite skill below, write the art prompt yourself, generate each raw sheet with built-in image generation, then run the skill's local processor for chroma-key cleanup, frame extraction, alignment, QC, and transparent/GIF export.\",\n \"\",\n \"## User Prompt\",\n prompt,\n \"\",\n \"## Sprite Plan\",\n \"These parameters were resolved from the command. `agent decides` means the flag was not set — infer the best value from the prompt and the skill's modes reference; do not force the user to spell it out.\",\n \"\",\n ...planEntries.map(([label, value]) => {\n return `- ${label}: ${value}`;\n }),\n `- Output name: ${plan.name}`,\n \"\",\n \"## Recommended Model\",\n `- Use \\`${plan.model}\\` for every raw sheet via built-in image generation (\\`zero generate image --provider built-in --model ${plan.model} --skip-style --prompt \"...\"\\`, or the in-context image tool).`,\n \"- gpt-image-2 is recommended for sprite sheets: it accepts flexible WIDTHxHEIGHT sizes and high quality for crisp, evenly-spaced grids. It does not emit transparent backgrounds, which is expected here — the solid magenta background is chroma-keyed by the local processor.\",\n \"- Pick a sheet-friendly square or grid-aligned size (for example 1024x1024 for 2x2/3x3/4x4) so each cell stays evenly spaced.\",\n \"\",\n \"## Workflow Skill\",\n \"Resolve this skill before authoring; it is the authority for sprite prompt patterns, sheet/bundle selection, and the postprocessing primitive.\",\n \"\",\n `- Repo: \\`${SPRITE_SKILL.repo}@${SPRITE_SKILL.ref}\\``,\n `- Skill: \\`${SPRITE_SKILL.skillPath}\\``,\n `- References: ${SPRITE_SKILL.references\n .map((ref) => {\n return `\\`${ref}\\``;\n })\n .join(\", \")}`,\n `- Processor script: \\`${SPRITE_SKILL.script}\\``,\n \"- For map props that must match a tile map, prefer the sibling `generate2dmap` skill in the same repo.\",\n \"- If a source file cannot be fetched, state that limitation and fall back to the core invariants below.\",\n \"\",\n \"## Core Invariants\",\n ...CORE_INVARIANTS.map((rule) => {\n return `- ${rule}`;\n }),\n \"\",\n \"## Workflow\",\n ...WORKFLOW,\n \"\",\n \"## Output Contract\",\n `- Write the bundle under \\`${outputDir}/\\`.`,\n \"- Keep the original generated images and produce, per sheet:\",\n ...EXPECTED_OUTPUTS.map((item) => {\n return ` - ${item}`;\n }),\n \"- For bundles, create one subfolder per asset and keep the per-action FX/projectile/impact sheets separate.\",\n \"\",\n \"## Verification\",\n \"- Confirm each transparent sheet and its frames are nonblank and free of magenta fringing.\",\n \"- Confirm no frame touches a cell edge and that scale and identity stay consistent across frames.\",\n \"- For hero/player body actions, confirm body height matches the accepted idle/run scale within ~10-15%.\",\n \"- Report the output directory, the final assets, and the resolved plan.\",\n ].join(\"\\n\");\n\n return {\n type: \"generation-source-selection\",\n kind: \"sprite\",\n prompt,\n plan,\n model: plan.model,\n outputDir,\n skill: SPRITE_SKILL,\n instructions,\n };\n}\n","import { createVideoGenerateCommand } from \"../shared/video-generate\";\n\nexport const videoCommand = createVideoGenerateCommand({\n name: \"video\",\n generationType: \"video\",\n usageCommand: \"zero generate video\",\n examples: ` Generate video: zero generate video --prompt \"A tracking shot through a neon market\"\n Pipe prompt: cat prompt.txt | zero generate video\n Use Dreamina 2.0: zero generate video --model dreamina-seedance-2.0 --prompt \"A cinematic product reveal\" --duration 6s --resolution 1080p\n Use Seedance 1.5 Pro: zero generate video --model seedance-1.5-pro --prompt \"A multi-shot chase scene\" --duration 8s --resolution 720p\n Add a first frame: zero generate video --first-frame-image-url https://example.com/frame.png --prompt \"Animate this frame\"\n List providers: zero generate video\n Use HeyGen: zero generate video --provider heygen`,\n});\n","import { Command, InvalidArgumentError } from \"commander\";\nimport chalk from \"chalk\";\nimport { generateWebVideo } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { dispatchGenerate } from \"../generate/lib/dispatch\";\nimport type { GenerationType } from \"../generate/lib/lister\";\n\ninterface VideoOptions {\n prompt?: string;\n provider?: string;\n model: string;\n aspectRatio: string;\n duration: string;\n resolution?: string;\n audio?: boolean;\n negativePrompt?: string;\n seed?: number;\n autoFix?: boolean;\n safetyTolerance: string;\n imageUrl?: string[];\n videoUrl?: string[];\n audioUrl?: string[];\n firstFrameImageUrl?: string;\n lastFrameImageUrl?: string;\n all?: boolean;\n}\n\ninterface VideoGenerateCommandConfig {\n name: string;\n generationType: GenerationType;\n usageCommand: string;\n examples: string;\n}\n\ninterface ImageDimensions {\n width: number;\n height: number;\n}\n\nconst FRAME_ASPECT_RATIO_TOLERANCE = 0.02;\nconst JPEG_START_OF_FRAME_MARKERS = new Set([\n 0xc0, 0xc1, 0xc2, 0xc3, 0xc5, 0xc6, 0xc7, 0xc9, 0xca, 0xcb, 0xcd, 0xce, 0xcf,\n]);\n\nfunction parseSeed(value: string): number {\n const seed = Number(value);\n if (!Number.isInteger(seed) || seed < 0 || !Number.isSafeInteger(seed)) {\n throw new InvalidArgumentError(\"seed must be a non-negative safe integer\");\n }\n return seed;\n}\n\nfunction collectUrl(value: string, previous: string[] = []): string[] {\n return [...previous, value];\n}\n\nfunction parseAspectRatio(value: string): ImageDimensions {\n const [widthText, heightText] = value.split(\":\");\n const width = Number(widthText);\n const height = Number(heightText);\n if (\n !Number.isFinite(width) ||\n !Number.isFinite(height) ||\n width <= 0 ||\n height <= 0\n ) {\n throw new Error(`Invalid --aspect-ratio \"${value}\"`);\n }\n return { width, height };\n}\n\nfunction readPngDimensions(buffer: Buffer): ImageDimensions | undefined {\n if (\n buffer.length < 24 ||\n buffer.toString(\"latin1\", 0, 8) !== \"\\x89PNG\\r\\n\\x1a\\n\"\n ) {\n return undefined;\n }\n return {\n width: buffer.readUInt32BE(16),\n height: buffer.readUInt32BE(20),\n };\n}\n\nfunction readGifDimensions(buffer: Buffer): ImageDimensions | undefined {\n if (\n buffer.length < 10 ||\n !buffer.toString(\"latin1\", 0, 6).startsWith(\"GIF\")\n ) {\n return undefined;\n }\n return {\n width: buffer.readUInt16LE(6),\n height: buffer.readUInt16LE(8),\n };\n}\n\nfunction readJpegDimensions(buffer: Buffer): ImageDimensions | undefined {\n if (buffer.length < 4 || buffer[0] !== 0xff || buffer[1] !== 0xd8) {\n return undefined;\n }\n\n let offset = 2;\n while (offset + 9 < buffer.length) {\n if (buffer[offset] !== 0xff) {\n offset += 1;\n continue;\n }\n\n const marker = buffer[offset + 1] as number;\n if (marker === 0xd9 || marker === 0xda) {\n break;\n }\n\n const segmentLength = buffer.readUInt16BE(offset + 2);\n if (segmentLength < 2 || offset + 2 + segmentLength > buffer.length) {\n break;\n }\n\n if (JPEG_START_OF_FRAME_MARKERS.has(marker)) {\n return {\n height: buffer.readUInt16BE(offset + 5),\n width: buffer.readUInt16BE(offset + 7),\n };\n }\n\n offset += 2 + segmentLength;\n }\n\n return undefined;\n}\n\nfunction readUnsigned24LE(buffer: Buffer, offset: number): number {\n return (\n buffer.readUInt8(offset) +\n (buffer.readUInt8(offset + 1) << 8) +\n (buffer.readUInt8(offset + 2) << 16)\n );\n}\n\nfunction readWebpDimensions(buffer: Buffer): ImageDimensions | undefined {\n if (\n buffer.length < 30 ||\n buffer.toString(\"ascii\", 0, 4) !== \"RIFF\" ||\n buffer.toString(\"ascii\", 8, 12) !== \"WEBP\"\n ) {\n return undefined;\n }\n\n let offset = 12;\n while (offset + 8 <= buffer.length) {\n const chunkType = buffer.toString(\"ascii\", offset, offset + 4);\n const chunkSize = buffer.readUInt32LE(offset + 4);\n const payloadOffset = offset + 8;\n if (payloadOffset + chunkSize > buffer.length) {\n break;\n }\n\n if (chunkType === \"VP8X\" && chunkSize >= 10) {\n return {\n width: readUnsigned24LE(buffer, payloadOffset + 4) + 1,\n height: readUnsigned24LE(buffer, payloadOffset + 7) + 1,\n };\n }\n\n if (\n chunkType === \"VP8L\" &&\n chunkSize >= 5 &&\n buffer[payloadOffset] === 0x2f\n ) {\n const byte1 = buffer.readUInt8(payloadOffset + 1);\n const byte2 = buffer.readUInt8(payloadOffset + 2);\n const byte3 = buffer.readUInt8(payloadOffset + 3);\n const byte4 = buffer.readUInt8(payloadOffset + 4);\n return {\n width: 1 + byte1 + ((byte2 & 0x3f) << 8),\n height:\n 1 + ((byte2 & 0xc0) >> 6) + (byte3 << 2) + ((byte4 & 0x0f) << 10),\n };\n }\n\n if (\n chunkType === \"VP8 \" &&\n chunkSize >= 10 &&\n buffer[payloadOffset + 3] === 0x9d &&\n buffer[payloadOffset + 4] === 0x01 &&\n buffer[payloadOffset + 5] === 0x2a\n ) {\n return {\n width: buffer.readUInt16LE(payloadOffset + 6) & 0x3fff,\n height: buffer.readUInt16LE(payloadOffset + 8) & 0x3fff,\n };\n }\n\n offset = payloadOffset + chunkSize + (chunkSize % 2);\n }\n\n return undefined;\n}\n\nfunction readImageDimensions(buffer: Buffer): ImageDimensions | undefined {\n return (\n readPngDimensions(buffer) ??\n readJpegDimensions(buffer) ??\n readWebpDimensions(buffer) ??\n readGifDimensions(buffer)\n );\n}\n\nfunction formatDimensionsAsRatio({ width, height }: ImageDimensions): string {\n const divisor = greatestCommonDivisor(width, height);\n return `${width / divisor}:${height / divisor}`;\n}\n\nfunction greatestCommonDivisor(left: number, right: number): number {\n let a = Math.abs(left);\n let b = Math.abs(right);\n while (b !== 0) {\n const remainder = a % b;\n a = b;\n b = remainder;\n }\n return a || 1;\n}\n\nfunction hasMatchingAspectRatio(\n actual: ImageDimensions,\n expected: ImageDimensions,\n): boolean {\n const actualRatio = actual.width / actual.height;\n const expectedRatio = expected.width / expected.height;\n return (\n Math.abs(actualRatio - expectedRatio) / expectedRatio <=\n FRAME_ASPECT_RATIO_TOLERANCE\n );\n}\n\nasync function fetchImageDimensions(\n optionName: string,\n imageUrl: string,\n): Promise<ImageDimensions> {\n let url: URL;\n try {\n url = new URL(imageUrl);\n } catch {\n throw new Error(`${optionName} must be an absolute URL`);\n }\n\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(\n `Could not validate ${optionName}: failed to fetch image (HTTP ${response.status})`,\n );\n }\n\n const buffer = Buffer.from(await response.arrayBuffer());\n const dimensions = readImageDimensions(buffer);\n if (!dimensions) {\n throw new Error(\n `Could not validate ${optionName}: unsupported image format or missing dimensions`,\n );\n }\n return dimensions;\n}\n\nasync function validateFrameImageAspectRatio(\n optionName: string,\n imageUrl: string | undefined,\n aspectRatio: string,\n): Promise<void> {\n if (!imageUrl) {\n return;\n }\n\n const expected = parseAspectRatio(aspectRatio);\n const actual = await fetchImageDimensions(optionName, imageUrl);\n if (hasMatchingAspectRatio(actual, expected)) {\n return;\n }\n\n throw new Error(\n `${optionName} has aspect ratio ${formatDimensionsAsRatio(actual)} (${actual.width}x${actual.height}), but --aspect-ratio is ${aspectRatio}. Use --aspect-ratio ${formatDimensionsAsRatio(actual)} or provide a frame image with ${aspectRatio} dimensions.`,\n );\n}\n\nasync function validateVideoOptions(options: VideoOptions): Promise<void> {\n await Promise.all([\n validateFrameImageAspectRatio(\n \"--first-frame-image-url\",\n options.firstFrameImageUrl,\n options.aspectRatio,\n ),\n validateFrameImageAspectRatio(\n \"--last-frame-image-url\",\n options.lastFrameImageUrl,\n options.aspectRatio,\n ),\n ]);\n}\n\nexport function createVideoGenerateCommand(\n config: VideoGenerateCommandConfig,\n): Command {\n return new Command()\n .name(config.name)\n .description(\"Generate a billed video file from a prompt\")\n .option(\"--prompt <text>\", \"Video prompt; can also be piped via stdin\")\n .option(\n \"--provider <name>\",\n \"Provider: 'built-in' to run vm0's pipeline, or a connector name to get its skill-invocation guidance\",\n )\n .option(\n \"--all\",\n \"When listing providers (no --prompt given), include unavailable or not-yet-authorized connectors\",\n )\n .option(\n \"--model <model>\",\n \"Model: dreamina-seedance-2.0-fast, dreamina-seedance-2.0, seedance-1.5-pro, veo3.1-fast, or kling-v3-4k\",\n \"dreamina-seedance-2.0-fast\",\n )\n .option(\n \"--aspect-ratio <ratio>\",\n \"Aspect ratio: 21:9, 16:9, 4:3, 1:1, 3:4, or 9:16\",\n \"16:9\",\n )\n .option(\n \"--duration <duration>\",\n \"Duration: 2s-15s depending on model\",\n \"8s\",\n )\n .option(\"--resolution <resolution>\", \"Resolution: 480p, 720p, or 1080p\")\n .option(\"--no-audio\", \"Generate a silent video\")\n .option(\"--negative-prompt <text>\", \"Negative prompt\")\n .option(\"--seed <integer>\", \"Deterministic seed\", parseSeed)\n .option(\"--no-auto-fix\", \"Disable prompt auto-fix\")\n .option(\"--safety-tolerance <level>\", \"Safety tolerance\", \"4\")\n .option(\n \"--image-url <url>\",\n \"Reference image URL; repeat for multiple Dreamina Seedance 2.0 references\",\n collectUrl,\n [],\n )\n .option(\n \"--video-url <url>\",\n \"Reference video URL; repeat up to 3 times for Dreamina Seedance 2.0\",\n collectUrl,\n [],\n )\n .option(\n \"--audio-url <url>\",\n \"Reference audio URL for Dreamina Seedance 2.0\",\n collectUrl,\n [],\n )\n .option(\"--first-frame-image-url <url>\", \"First frame image URL\")\n .option(\"--last-frame-image-url <url>\", \"Last frame image URL\")\n .addHelpText(\n \"after\",\n `\nExamples:\n${config.examples}\n\nOutput:\n Prints the generated /f/ video file URL and metadata\n\nNotes:\n - Authenticates via ZERO_TOKEN (requires file:write capability)\n - Charges org credits after successful video generation\n - Uses BytePlus ModelArk and fal.ai video models with configured usage pricing\n\nModels:\n - Dreamina Seedance 2.0: dreamina-seedance-2.0,\n dreamina-seedance-2.0-fast (default). Supports 4s-15s,\n 480p/720p, seed, optional audio, image references, and first/last\n frames. The non-fast model also supports 1080p and video/audio references.\n - Seedance 1.5 Pro: seedance-1.5-pro. Supports 4s-12s,\n 480p/720p/1080p, seed, optional audio, image references, and\n first/last frames.\n - fal.ai: veo3.1-fast and kling-v3-4k. veo3.1-fast supports\n 4s/6s/8s, 720p/1080p/4k, negative prompts, seed, auto-fix,\n safety tolerance, and optional audio. kling-v3-4k supports 3s-15s,\n 4k output, negative prompts, and optional audio.`,\n )\n .action(\n withErrorHandler(async (options: VideoOptions) => {\n const dispatch = await dispatchGenerate({\n generationType: config.generationType,\n provider: options.provider,\n prompt: options.prompt,\n all: options.all,\n });\n if (dispatch.outcome === \"handled\") return;\n const prompt = dispatch.prompt;\n\n await validateVideoOptions(options);\n const result = await generateWebVideo({\n prompt,\n model: options.model,\n aspectRatio: options.aspectRatio,\n duration: options.duration,\n resolution: options.resolution,\n generateAudio: options.audio !== false,\n negativePrompt: options.negativePrompt,\n seed: options.seed,\n autoFix: options.autoFix !== false,\n safetyTolerance: options.safetyTolerance,\n imageUrls: options.imageUrl,\n videoUrls: options.videoUrl,\n audioUrls: options.audioUrl,\n firstFrameImageUrl: options.firstFrameImageUrl,\n lastFrameImageUrl: options.lastFrameImageUrl,\n });\n\n console.log(chalk.green(`✓ Video generated: ${result.url}`));\n console.log(chalk.dim(` File: ${result.filename}`));\n console.log(chalk.dim(` Duration: ${result.duration}`));\n console.log(chalk.dim(` Resolution: ${result.resolution}`));\n console.log(chalk.dim(` Aspect ratio: ${result.aspectRatio}`));\n console.log(\n chalk.dim(` Audio: ${result.generateAudio ? \"on\" : \"off\"}`),\n );\n console.log(chalk.dim(` Credits charged: ${result.creditsCharged}`));\n console.log(chalk.dim(` Model: ${result.model}`));\n }),\n );\n}\n","import { Command } from \"commander\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { createHtmlArtifactAuthoringPacket } from \"../shared/html-artifact-authoring\";\nimport {\n findDesignSystem,\n findTemplate,\n listDesignSystems,\n listTemplates,\n} from \"../shared/resource-registry\";\nimport {\n canonicalizeRegistryId,\n formatRegistryListing,\n} from \"../shared/resource-listing\";\nimport { dispatchGenerate } from \"./lib/dispatch\";\n\nconst WEBSITE_TARGET = \"website\";\nconst WEBSITE_USAGE_COMMAND = \"zero generate website\";\n\ninterface WebsiteOptions {\n readonly prompt?: string;\n readonly template?: string;\n readonly designSystem?: string;\n readonly siteSlug?: string;\n readonly title?: string;\n}\n\nfunction unknownDesignSystemError(id: string): Error {\n const designSystems = listDesignSystems();\n const message = [\n `Unknown design system: ${id}`,\n \"\",\n \"Available design systems:\",\n formatRegistryListing(designSystems, \"design systems\"),\n \"\",\n `Example:`,\n ` ${WEBSITE_USAGE_COMMAND} --design-system ${\n designSystems[0]?.id ?? \"<design-system-id>\"\n } --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nfunction unknownTemplateError(id: string): Error {\n const templates = listTemplates(WEBSITE_TARGET);\n const message = [\n `Unknown template for ${WEBSITE_TARGET}: ${id}`,\n \"\",\n `Available templates for ${WEBSITE_TARGET}:`,\n formatRegistryListing(templates, `${WEBSITE_TARGET} templates`),\n \"\",\n `Example:`,\n ` ${WEBSITE_USAGE_COMMAND} --template ${\n templates[0]?.id ?? \"<template-id>\"\n } --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nexport const websiteCommand = new Command()\n .name(\"website\")\n .description(\"Prepare website authoring instructions from a prompt\")\n .option(\"--prompt <text>\", \"Website prompt; can also be piped via stdin\")\n .option(\"--site-slug <slug>\", \"Hosted site slug override\")\n .option(\"--title <text>\", \"Requested site title or name\")\n .option(\n \"--design-system <id>\",\n \"Design system id from the registry (see Design Systems below). Accepts either 'apple' or 'design-system:apple'.\",\n )\n .option(\n \"--template <id>\",\n \"Template id from the registry, scoped to website (see Templates below). Accepts either short id or full 'template:<id>'.\",\n )\n .addHelpText(\"after\", () => {\n const designSystems = listDesignSystems();\n const templates = listTemplates(WEBSITE_TARGET);\n return `\nExamples:\n Generate site: zero generate website --prompt \"A launch site for a developer observability tool\"\n Pick template: zero generate website --template saas-landing --prompt \"Launch site for a billing API\"\n Pick design system: zero generate website --design-system stripe --prompt \"Pricing page for a SaaS\"\n Custom site slug: zero generate website --site-slug api-migration-demo --prompt \"An internal migration microsite\"\n Pipe prompt: cat brief.txt | zero generate website\n Show choices: zero generate website\n\nOutput:\n Prints a source-selection packet for the current agent.\n With no --prompt and no piped input, prints the generation choices instead.\n\nNotes:\n - Authenticates via ZERO_TOKEN\n - The agent authors the HTML artifact and hosts it with zero host\n\nDesign Systems:\n${formatRegistryListing(designSystems, \"design systems\")}\n\nTemplates (website):\n${formatRegistryListing(templates, \"website templates\")}`;\n })\n .action(\n withErrorHandler(async (options: WebsiteOptions) => {\n const dispatch = await dispatchGenerate({\n generationType: \"website\",\n prompt: options.prompt,\n });\n if (dispatch.outcome === \"handled\") return;\n const prompt = dispatch.prompt;\n\n let resolvedDesignSystem;\n if (options.designSystem !== undefined) {\n const canonical = canonicalizeRegistryId(\n \"design-system\",\n options.designSystem,\n );\n const entry = findDesignSystem(canonical);\n if (!entry) {\n throw unknownDesignSystemError(options.designSystem);\n }\n resolvedDesignSystem = entry;\n }\n\n let resolvedTemplate;\n if (options.template !== undefined) {\n const canonical = canonicalizeRegistryId(\"template\", options.template);\n const entry = findTemplate(canonical);\n if (!entry || !entry.targets?.includes(WEBSITE_TARGET)) {\n throw unknownTemplateError(options.template);\n }\n resolvedTemplate = entry;\n }\n\n const packet = createHtmlArtifactAuthoringPacket({\n kind: \"website\",\n prompt,\n slugSource: options.title,\n siteSlug: options.siteSlug,\n details: [\n `Requested title/site name: ${options.title ?? \"not specified\"}`,\n `Selected design system: ${\n resolvedDesignSystem\n ? `${resolvedDesignSystem.id} (${resolvedDesignSystem.name})`\n : \"agent decides\"\n }`,\n `Selected template: ${\n resolvedTemplate\n ? `${resolvedTemplate.id} (${resolvedTemplate.name})`\n : \"agent decides\"\n }`,\n ],\n artifactRules: [\n \"Build the usable website as the first screen; do not output a landing-page plan.\",\n \"If it is a marketing site, make the product or offer visible in the first viewport.\",\n \"For app or tool surfaces, prioritize dense, scannable, task-focused UI over decorative sections.\",\n \"Use responsive HTML/CSS and verify the page works at mobile and desktop widths.\",\n ],\n });\n\n console.log(packet.instructions);\n }),\n );\n","import { createVoiceGenerateCommand } from \"../shared/voice-generate\";\n\nexport const voiceCommand = createVoiceGenerateCommand({\n name: \"voice\",\n generationType: \"voice\",\n usageCommand: \"zero generate voice\",\n examples: ` Generate speech: zero generate voice --prompt \"Hello from vm0\"\n Pipe prompt: cat script.txt | zero generate voice\n Pick a voice: zero generate voice --prompt \"Ship it\" --voice cedar\n List providers: zero generate voice\n Use ElevenLabs: zero generate voice --provider elevenlabs`,\n});\n","import { Command, Option } from \"commander\";\nimport chalk from \"chalk\";\nimport { generateWebVoice } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { dispatchGenerate } from \"../generate/lib/dispatch\";\nimport type { GenerationType } from \"../generate/lib/lister\";\n\ninterface VoiceOptions {\n prompt?: string;\n text?: string;\n provider?: string;\n voice: string;\n instructions?: string;\n all?: boolean;\n}\n\ninterface VoiceGenerateCommandConfig {\n name: string;\n generationType: GenerationType;\n usageCommand: string;\n examples: string;\n}\n\nexport function createVoiceGenerateCommand(\n config: VoiceGenerateCommandConfig,\n): Command {\n return new Command()\n .name(config.name)\n .description(\"Generate a billed speech audio file from text\")\n .option(\"--prompt <text>\", \"Text to speak; can also be piped via stdin\")\n .addOption(new Option(\"--text <text>\", \"Alias for --prompt\").hideHelp())\n .option(\n \"--provider <name>\",\n \"Provider: 'built-in' to run vm0's pipeline, or a connector name (heygen, elevenlabs, ...) to get its skill-invocation guidance\",\n )\n .option(\n \"--all\",\n \"When listing providers (no --prompt given), include unavailable or not-yet-authorized connectors\",\n )\n .option(\"--voice <voice>\", \"OpenAI voice to use\", \"marin\")\n .option(\"--instructions <text>\", \"Voice style instructions\")\n .addHelpText(\n \"after\",\n `\nExamples:\n${config.examples}\n\nOutput:\n Prints the generated /f/ audio file URL and metadata. With no --prompt\n and no piped input, prints the provider menu instead.\n\nNotes:\n - Authenticates via ZERO_TOKEN (requires file:write capability)\n - Charges org credits after successful audio generation\n - Uses gpt-4o-mini-tts with WAV output`,\n )\n .action(\n withErrorHandler(async (options: VoiceOptions) => {\n const dispatch = await dispatchGenerate({\n generationType: config.generationType,\n provider: options.provider,\n prompt: options.prompt ?? options.text,\n all: options.all,\n });\n if (dispatch.outcome === \"handled\") return;\n const text = dispatch.prompt;\n\n const result = await generateWebVoice({\n text,\n voice: options.voice,\n instructions: options.instructions,\n });\n\n console.log(chalk.green(`✓ Voice generated: ${result.url}`));\n console.log(chalk.dim(` File: ${result.filename}`));\n console.log(chalk.dim(` Duration: ${result.durationSeconds}s`));\n console.log(chalk.dim(` Credits charged: ${result.creditsCharged}`));\n console.log(chalk.dim(` Model: ${result.model}`));\n console.log(chalk.dim(` Voice: ${result.voice}`));\n }),\n );\n}\n","import { Command } from \"commander\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { printConnectorGuidance } from \"./lib/connector-guidance\";\nimport { runLister, type GenerationType } from \"./lib/lister\";\n\ninterface ListerOnlyOptions {\n readonly provider?: string;\n readonly all?: boolean;\n}\n\ninterface ListerOnlyConfig {\n readonly name: string;\n readonly generationType: GenerationType;\n readonly description: string;\n}\n\n/**\n * Build a generate subcommand for a type that has no vm0 built-in pipeline.\n * The command lists available connector providers and prints skill-invocation\n * guidance when a --provider is named, but cannot execute on its own.\n */\nexport function createListerOnlyCommand(config: ListerOnlyConfig): Command {\n return new Command()\n .name(config.name)\n .description(config.description)\n .option(\n \"--provider <name>\",\n \"Connector name; prints that connector's skill-invocation guidance\",\n )\n .option(\"--all\", \"Include unavailable or not-yet-authorized connectors\")\n .addHelpText(\n \"after\",\n `\nNotes:\n - vm0 does not provide a built-in ${config.generationType} pipeline.\n - Use --provider <connector-name> to get skill-invocation guidance for a\n specific connector, or run with no flags to see every available provider.`,\n )\n .action(\n withErrorHandler(async (options: ListerOnlyOptions) => {\n const provider = options.provider?.trim();\n if (provider && provider !== \"built-in\") {\n printConnectorGuidance(config.generationType, provider);\n return;\n }\n if (provider === \"built-in\") {\n console.log(\n `vm0 has no built-in ${config.generationType} generation pipeline.`,\n );\n console.log(\"\");\n console.log(\n `Run \"zero generate ${config.generationType}\" to see every connector-backed provider.`,\n );\n return;\n }\n await runLister(config.generationType, {\n all: options.all,\n });\n }),\n );\n}\n","import { Command } from \"commander\";\nimport { downloadFileCommand } from \"./download-file\";\nimport { uploadFileCommand } from \"./upload-file\";\n\nexport const zeroWebCommand = new Command()\n .name(\"web\")\n .description(\"Upload and download files via the web chat endpoint\")\n .addCommand(downloadFileCommand)\n .addCommand(uploadFileCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload a file: zero web upload-file -f /tmp/report.pdf\n Download a file: zero web download-file <file-id> -o /tmp/out.pdf`,\n );\n","import { basename, join } from \"path\";\nimport { tmpdir } from \"os\";\nimport { Command } from \"commander\";\nimport { downloadWebFile } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\n/**\n * Derive a local output path for a web-uploaded file id.\n * Uses the system temp directory.\n *\n * `basename` strips any path separators from `fileId` so a hostile id like\n * `../etc/passwd` cannot escape `tmpdir()`.\n */\nfunction defaultOutPath(fileId: string): string {\n return join(tmpdir(), `web-${basename(fileId)}`);\n}\n\nexport const downloadFileCommand = new Command()\n .name(\"download-file\")\n .description(\"Download a web-uploaded file by id\")\n .argument(\"<file-id>\", \"File id (UUID returned by the upload API)\")\n .option(\n \"-o, --out <path>\",\n \"Output path for the downloaded file (default: /tmp/web-<file-id>)\",\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n Download to default temp path: zero web download-file abc-123-def\n Download to explicit path: zero web download-file abc-123-def -o /tmp/report.pdf\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"path\":\"/tmp/web-abc-123-def\",\"mimetype\":\"application/pdf\",\"size\":12345}\n\nHow to read the downloaded file:\n - Images (png/jpg/gif/webp/svg): open the file path with your image viewing tool\n - Videos (mp4/mov/webm): extract frames first with\n ffmpeg -i <path> -vf \"fps=1\" -q:v 2 /tmp/<file-id>_frame_%03d.jpg\n then view the extracted frames\n - PDF/text/csv/json/markdown: read the file directly\n\nNotes:\n - Authenticates via ZERO_TOKEN\n - Streams the file bytes directly to disk`,\n )\n .action(\n withErrorHandler(async (fileId: string, options: { out?: string }) => {\n const outPath = options.out ?? defaultOutPath(fileId);\n const result = await downloadWebFile(fileId, outPath);\n console.log(JSON.stringify(result));\n }),\n );\n","import { Command } from \"commander\";\nimport { uploadWebFile } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const uploadFileCommand = new Command()\n .name(\"upload-file\")\n .description(\"Upload a local file and print a permanent URL\")\n .requiredOption(\"-f, --file <path>\", \"Local file path to upload\")\n .option(\"--content-type <mime>\", \"Override inferred content type\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload a file: zero web upload-file -f /tmp/report.pdf\n Override content-type: zero web upload-file -f /tmp/data --content-type text/csv\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"id\":\"...\",\"filename\":\"...\",\"contentType\":\"...\",\"size\":N,\"url\":\"https://...\"}\n\nNotes:\n - Authenticates via ZERO_TOKEN (requires file:write capability)\n - Returned URL is permanent (serves a short-lived signed redirect on access)\n - Safe to persist in chat messages or share over external channels\n - Max file size: 1 GB\n - Allowed image types: png / jpeg / gif / webp / avif / svg / bmp / heic / heif / tiff / psd\n - Allowed video types: mp4 / webm / mov\n - Allowed audio types: aac / flac / m4a / mp3 / mp4 / mpga / ogg / opus / wav / webm\n - Allowed document/text types: pdf / txt / csv / tsv / md / html / json / xml / yaml / doc(x/m) / xls(x/m/b) / ppt(x/m) / odt / ods / odp / rtf\n - Allowed archive/data/design types: zip / rar / 7z / tar / gz / tgz / bz2 / xz / pages / numbers / key / parquet / sqlite / epub / ai\n - Use --content-type for ambiguous extensions like .mp4 or .webm when needed`,\n )\n .action(\n withErrorHandler(\n async (options: { file: string; contentType?: string }) => {\n const result = await uploadWebFile(options.file, {\n contentType: options.contentType,\n });\n console.log(JSON.stringify(result));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { publishStaticSite } from \"../../../lib/host/publish-static-site\";\n\ninterface HostOptions {\n readonly site: string;\n readonly slugSuffix?: string;\n readonly spa?: boolean;\n readonly json?: boolean;\n}\n\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\nexport const zeroHostCommand = new Command()\n .name(\"host\")\n .description(\"Publish a built static site and print its public URL\")\n .argument(\"<dir>\", \"Static build directory, for example ./dist\")\n .requiredOption(\"--site <slug>\", \"Public site slug, e.g. my-product-demo\")\n .option(\"--slug-suffix <suffix>\", \"Reuse a generated site URL suffix\")\n .option(\"--spa\", \"Serve unknown HTML navigation paths from index.html\")\n .option(\"--json\", \"Output only the final result as JSON\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Publish a Vite build: zero host ./dist --site my-product-demo --spa\n Redeploy a URL: zero host ./dist --site my-product-demo --slug-suffix a1b2c3d4 --spa\n Machine readable: zero host ./dist --site my-product-demo --spa --json\n\nNotes:\n - Authenticates via ZERO_TOKEN (requires host:write capability)\n - Reusing both --site and --slug-suffix keeps the same URL\n - The directory must include index.html\n - Local HTML/CSS asset references must point at files inside the directory`,\n )\n .action(\n withErrorHandler(async (dir: string, options: HostOptions) => {\n const result = await publishStaticSite({\n dir,\n site: options.site,\n slugSuffix: options.slugSuffix,\n spaFallback: Boolean(options.spa),\n onProgress: options.json\n ? undefined\n : (progress) => {\n if (progress.phase === \"preparing\") {\n console.log(\n chalk.dim(`Preparing ${progress.fileCount} files...`),\n );\n return;\n }\n console.log(chalk.dim(`Uploading ${progress.path}`));\n },\n });\n\n if (options.json) {\n console.log(JSON.stringify(result));\n return;\n }\n\n console.log(chalk.green(\"✓ Hosted site ready\"));\n console.log(chalk.dim(` Site: ${result.publicSlug}`));\n console.log(chalk.dim(` Deployment: ${result.deploymentId}`));\n console.log(chalk.dim(` Files: ${result.fileCount.toLocaleString()}`));\n console.log(chalk.dim(` Size: ${formatBytes(result.size)}`));\n console.log(` URL: ${result.url}`);\n }),\n );\n","import { readFile } from \"node:fs/promises\";\n\nimport { completeHostedSite, prepareHostedSite } from \"../api\";\nimport { scanStaticSite } from \"./static-site\";\n\ninterface PublishStaticSiteProgress {\n readonly phase: \"preparing\" | \"uploading\";\n readonly fileCount?: number;\n readonly path?: string;\n}\n\ninterface PublishStaticSiteResult {\n readonly siteId: string;\n readonly deploymentId: string;\n readonly publicSlug: string;\n readonly url: string;\n readonly fileCount: number;\n readonly size: number;\n}\n\ninterface PublishStaticSiteOptions {\n readonly dir: string;\n readonly site: string;\n readonly slugSuffix?: string;\n readonly spaFallback?: boolean;\n readonly onProgress?: (progress: PublishStaticSiteProgress) => void;\n}\n\nexport async function publishStaticSite(\n options: PublishStaticSiteOptions,\n): Promise<PublishStaticSiteResult> {\n const scan = await scanStaticSite(options.dir);\n const totalSize = scan.files.reduce((sum, file) => {\n return sum + file.size;\n }, 0);\n\n options.onProgress?.({\n phase: \"preparing\",\n fileCount: scan.files.length,\n });\n\n const prepared = await prepareHostedSite({\n site: options.site,\n ...(options.slugSuffix !== undefined && { slugSuffix: options.slugSuffix }),\n spaFallback: Boolean(options.spaFallback),\n files: scan.files.map((file) => {\n return {\n path: file.path,\n size: file.size,\n sha256: file.sha256,\n contentType: file.contentType,\n immutable: file.immutable,\n };\n }),\n });\n\n const uploadByPath = new Map(\n prepared.uploads.map((upload) => {\n return [upload.path, upload.uploadUrl];\n }),\n );\n\n for (const file of scan.files) {\n const uploadUrl = uploadByPath.get(file.path);\n if (!uploadUrl) {\n throw new Error(`Missing upload URL for ${file.path}`);\n }\n options.onProgress?.({ phase: \"uploading\", path: file.path });\n const bytes = await readFile(file.absolutePath);\n const response = await fetch(uploadUrl, {\n method: \"PUT\",\n headers: { \"Content-Type\": file.contentType },\n body: new Uint8Array(bytes),\n });\n if (!response.ok) {\n throw new Error(\n `Failed to upload ${file.path} (HTTP ${response.status})`,\n );\n }\n }\n\n const completed = await completeHostedSite(prepared.deploymentId);\n\n return {\n siteId: completed.siteId,\n deploymentId: completed.deploymentId,\n publicSlug: completed.publicSlug,\n url: completed.url,\n fileCount: scan.files.length,\n size: totalSize,\n };\n}\n","import { createHash } from \"node:crypto\";\nimport { readdir, readFile, stat } from \"node:fs/promises\";\nimport { extname, relative, resolve, sep, dirname, posix } from \"node:path\";\n\ninterface StaticSiteFile {\n readonly absolutePath: string;\n readonly path: string;\n readonly size: number;\n readonly sha256: string;\n readonly contentType: string;\n readonly immutable?: boolean;\n}\n\ninterface StaticSiteScanResult {\n readonly root: string;\n readonly files: readonly StaticSiteFile[];\n}\n\nconst MIME_BY_EXTENSION: Record<string, string> = {\n \".html\": \"text/html; charset=utf-8\",\n \".htm\": \"text/html; charset=utf-8\",\n \".css\": \"text/css; charset=utf-8\",\n \".js\": \"application/javascript; charset=utf-8\",\n \".mjs\": \"application/javascript; charset=utf-8\",\n \".json\": \"application/json; charset=utf-8\",\n \".map\": \"application/json; charset=utf-8\",\n \".txt\": \"text/plain; charset=utf-8\",\n \".xml\": \"application/xml; charset=utf-8\",\n \".svg\": \"image/svg+xml; charset=utf-8\",\n \".png\": \"image/png\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".gif\": \"image/gif\",\n \".webp\": \"image/webp\",\n \".avif\": \"image/avif\",\n \".ico\": \"image/x-icon\",\n \".wasm\": \"application/wasm\",\n \".woff\": \"font/woff\",\n \".woff2\": \"font/woff2\",\n \".ttf\": \"font/ttf\",\n \".otf\": \"font/otf\",\n \".eot\": \"application/vnd.ms-fontobject\",\n \".mp4\": \"video/mp4\",\n \".webm\": \"video/webm\",\n \".mp3\": \"audio/mpeg\",\n \".wav\": \"audio/wav\",\n};\n\nconst HTML_REFERENCE_RE =\n /<(?:script|link|img|source|video|audio|embed|object)\\b[^>]*\\s(?:src|href|poster|data)=[\"']([^\"']+)[\"'][^>]*>/giu;\nconst SRCSET_RE = /\\s(?:srcset)=[\"']([^\"']+)[\"']/giu;\nconst CSS_URL_RE = /url\\(\\s*[\"']?([^\"')]+)[\"']?\\s*\\)/giu;\nconst CSS_IMPORT_RE = /@import\\s+(?:url\\()?[\"']([^\"']+)[\"']\\)?/giu;\n\nfunction inferContentType(path: string): string {\n return (\n MIME_BY_EXTENSION[extname(path).toLowerCase()] ?? \"application/octet-stream\"\n );\n}\n\nfunction looksImmutable(path: string): boolean {\n if (path.startsWith(\"/assets/\")) {\n return true;\n }\n return /(?:[-.])[A-Za-z0-9_-]{8,}\\.[A-Za-z0-9]+$/u.test(path);\n}\n\nfunction toSitePath(root: string, absolutePath: string): string {\n const rel = relative(root, absolutePath).split(sep).join(\"/\");\n return `/${rel}`;\n}\n\nfunction isSafeSitePath(path: string): boolean {\n if (!path.startsWith(\"/\") || path.startsWith(\"//\")) {\n return false;\n }\n if (path.includes(\"\\\\\") || path.includes(\"\\0\")) {\n return false;\n }\n const segments = path.split(\"/\").filter(Boolean);\n return !segments.some((segment) => {\n return segment === \".\" || segment === \"..\";\n });\n}\n\nfunction isExternalReference(value: string): boolean {\n return /^(?:[a-z][a-z0-9+.-]*:|\\/\\/|#)/iu.test(value);\n}\n\nfunction stripQueryAndHash(value: string): string {\n const hashIndex = value.indexOf(\"#\");\n const withoutHash = hashIndex >= 0 ? value.slice(0, hashIndex) : value;\n const queryIndex = withoutHash.indexOf(\"?\");\n return queryIndex >= 0 ? withoutHash.slice(0, queryIndex) : withoutHash;\n}\n\nfunction normalizeReference(fromPath: string, raw: string): string | null {\n const trimmed = raw.trim();\n if (!trimmed || isExternalReference(trimmed)) {\n return null;\n }\n const stripped = stripQueryAndHash(trimmed);\n if (!stripped || stripped.endsWith(\"/\")) {\n return null;\n }\n const resolved = stripped.startsWith(\"/\")\n ? posix.normalize(stripped)\n : posix.normalize(posix.join(dirname(fromPath), stripped));\n const path = resolved.startsWith(\"/\") ? resolved : `/${resolved}`;\n if (!isSafeSitePath(path)) {\n throw new Error(`Invalid asset reference in ${fromPath}: ${raw}`);\n }\n return path;\n}\n\nfunction shouldRequireHtmlReference(path: string): boolean {\n return extname(path).length > 0 || path.startsWith(\"/assets/\");\n}\n\nfunction isHtmlExtension(ext: string): boolean {\n return ext === \".html\" || ext === \".htm\";\n}\n\nfunction shouldValidateReferences(ext: string): boolean {\n return isHtmlExtension(ext) || ext === \".css\";\n}\n\nfunction collectSrcsetReferences(value: string): string[] {\n return value\n .split(\",\")\n .map((entry) => {\n return entry.trim().split(/\\s+/u)[0] ?? \"\";\n })\n .filter(Boolean);\n}\n\nfunction collectHtmlReferences(text: string): string[] {\n const references: string[] = [];\n for (const match of text.matchAll(HTML_REFERENCE_RE)) {\n if (match[1]) references.push(match[1]);\n }\n for (const match of text.matchAll(SRCSET_RE)) {\n if (!match[1]) continue;\n references.push(...collectSrcsetReferences(match[1]));\n }\n return references;\n}\n\nfunction collectCssReferences(text: string): string[] {\n const references: string[] = [];\n for (const match of text.matchAll(CSS_URL_RE)) {\n if (match[1]) references.push(match[1]);\n }\n for (const match of text.matchAll(CSS_IMPORT_RE)) {\n if (match[1]) references.push(match[1]);\n }\n return references;\n}\n\nfunction collectReferences(ext: string, text: string): string[] {\n return isHtmlExtension(ext)\n ? collectHtmlReferences(text)\n : collectCssReferences(text);\n}\n\nasync function hashFile(path: string): Promise<string> {\n const bytes = await readFile(path);\n return createHash(\"sha256\").update(bytes).digest(\"hex\");\n}\n\nasync function walk(\n root: string,\n dir: string,\n files: StaticSiteFile[],\n): Promise<void> {\n const entries = await readdir(dir, { withFileTypes: true });\n for (const entry of entries) {\n const fullPath = resolve(dir, entry.name);\n if (entry.isDirectory()) {\n await walk(root, fullPath, files);\n continue;\n }\n if (!entry.isFile()) {\n throw new Error(`Unsupported file type in hosted site: ${fullPath}`);\n }\n\n const fileStat = await stat(fullPath);\n const path = toSitePath(root, fullPath);\n if (!isSafeSitePath(path)) {\n throw new Error(`Invalid hosted-site path: ${path}`);\n }\n files.push({\n absolutePath: fullPath,\n path,\n size: fileStat.size,\n sha256: await hashFile(fullPath),\n contentType: inferContentType(path),\n immutable: looksImmutable(path) || undefined,\n });\n }\n}\n\nasync function assertReferencesExist(\n files: readonly StaticSiteFile[],\n): Promise<void> {\n const byPath = new Map(\n files.map((file) => {\n return [file.path, file];\n }),\n );\n\n for (const file of files) {\n const ext = extname(file.path).toLowerCase();\n if (!shouldValidateReferences(ext)) {\n continue;\n }\n const text = await readFile(file.absolutePath, \"utf8\");\n const references = collectReferences(ext, text);\n\n for (const reference of references) {\n const normalized = normalizeReference(file.path, reference);\n if (!normalized) {\n continue;\n }\n if (isHtmlExtension(ext) && !shouldRequireHtmlReference(normalized)) {\n continue;\n }\n if (!byPath.has(normalized)) {\n throw new Error(\n `Missing asset referenced by ${file.path}: ${reference}`,\n );\n }\n }\n }\n}\n\nexport async function scanStaticSite(\n rootPath: string,\n): Promise<StaticSiteScanResult> {\n const root = resolve(rootPath);\n const rootStat = await stat(root);\n if (!rootStat.isDirectory()) {\n throw new Error(`Hosted site path must be a directory: ${rootPath}`);\n }\n\n const files: StaticSiteFile[] = [];\n await walk(root, root, files);\n\n if (\n !files.some((file) => {\n return file.path === \"/index.html\";\n })\n ) {\n throw new Error(\"Hosted site directory must include index.html\");\n }\n\n await assertReferencesExist(files);\n\n return {\n root,\n files: files.sort((a, b) => {\n return a.path.localeCompare(b.path);\n }),\n };\n}\n","import { Command, InvalidArgumentError } from \"commander\";\nimport chalk from \"chalk\";\nimport { callZeroMaps, type ZeroMapsResponse } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nconst TRAVEL_MODES = [\"driving\", \"walking\", \"bicycling\", \"transit\"] as const;\nconst PLACE_DETAIL_FIELDSETS = [\"essentials\", \"pro\"] as const;\n\ntype TravelMode = (typeof TRAVEL_MODES)[number];\ntype PlaceDetailFieldset = (typeof PLACE_DETAIL_FIELDSETS)[number];\n\ninterface JsonOption {\n json?: boolean;\n}\n\ninterface GeocodeOptions extends JsonOption {\n address: string;\n region?: string;\n}\n\ninterface ReverseGeocodeOptions extends JsonOption {\n lat: number;\n lng: number;\n}\n\ninterface DirectionsOptions extends JsonOption {\n origin: string;\n destination: string;\n mode: TravelMode;\n departureTime?: string;\n}\n\ninterface PlacesSearchOptions extends JsonOption {\n query: string;\n location?: string;\n radius?: number;\n limit: number;\n region?: string;\n}\n\ninterface PlacesDetailsOptions extends JsonOption {\n placeId: string;\n fields: PlaceDetailFieldset;\n}\n\nfunction parseLatitude(value: string): number {\n const latitude = Number(value);\n if (!Number.isFinite(latitude) || latitude < -90 || latitude > 90) {\n throw new InvalidArgumentError(\"latitude must be a number from -90 to 90\");\n }\n return latitude;\n}\n\nfunction parseLongitude(value: string): number {\n const longitude = Number(value);\n if (!Number.isFinite(longitude) || longitude < -180 || longitude > 180) {\n throw new InvalidArgumentError(\n \"longitude must be a number from -180 to 180\",\n );\n }\n return longitude;\n}\n\nfunction parsePositiveInteger(value: string): number {\n const parsed = Number(value);\n if (!Number.isInteger(parsed) || parsed < 1) {\n throw new InvalidArgumentError(\"value must be a positive integer\");\n }\n return parsed;\n}\n\nfunction parseLimit(value: string): number {\n const limit = parsePositiveInteger(value);\n if (limit > 20) {\n throw new InvalidArgumentError(\"limit must be between 1 and 20\");\n }\n return limit;\n}\n\nfunction parseTravelMode(value: string): TravelMode {\n if (TRAVEL_MODES.includes(value as TravelMode)) {\n return value as TravelMode;\n }\n throw new InvalidArgumentError(\n `mode must be one of: ${TRAVEL_MODES.join(\", \")}`,\n );\n}\n\nfunction parsePlaceDetailFields(value: string): PlaceDetailFieldset {\n if (PLACE_DETAIL_FIELDSETS.includes(value as PlaceDetailFieldset)) {\n return value as PlaceDetailFieldset;\n }\n throw new InvalidArgumentError(\n `fields must be one of: ${PLACE_DETAIL_FIELDSETS.join(\", \")}`,\n );\n}\n\nfunction renderMapsResponse(label: string, response: ZeroMapsResponse): void {\n console.log(chalk.green(`✓ ${label}`));\n if (response.provider) {\n console.log(chalk.dim(` Provider: ${response.provider}`));\n }\n if (response.billingCategory) {\n console.log(chalk.dim(` Billing category: ${response.billingCategory}`));\n }\n if (response.billingQuantity !== undefined) {\n console.log(chalk.dim(` Billing quantity: ${response.billingQuantity}`));\n }\n if (response.creditsCharged !== undefined) {\n console.log(chalk.dim(` Credits charged: ${response.creditsCharged}`));\n }\n\n const result = response.result ?? response;\n console.log(JSON.stringify(result, null, 2));\n}\n\nasync function runMapsRequest(\n label: string,\n endpoint:\n | \"geocode\"\n | \"reverse-geocode\"\n | \"directions\"\n | \"places/search\"\n | \"places/details\",\n payload: Record<string, unknown>,\n options: JsonOption,\n): Promise<void> {\n const response = await callZeroMaps(endpoint, payload);\n\n if (options.json) {\n console.log(JSON.stringify(response));\n return;\n }\n\n renderMapsResponse(label, response);\n}\n\nconst geocodeCommand = new Command()\n .name(\"geocode\")\n .description(\"Convert an address into coordinates\")\n .requiredOption(\"--address <address>\", \"Address to geocode\")\n .option(\"--region <code>\", \"Optional region bias, such as US or CN\")\n .option(\"--json\", \"Print the raw maps response as JSON\")\n .action(\n withErrorHandler(async (options: GeocodeOptions) => {\n await runMapsRequest(\n \"Geocode completed\",\n \"geocode\",\n { address: options.address, region: options.region },\n options,\n );\n }),\n );\n\nconst reverseGeocodeCommand = new Command()\n .name(\"reverse-geocode\")\n .description(\"Convert coordinates into an address\")\n .requiredOption(\"--lat <number>\", \"Latitude\", parseLatitude)\n .requiredOption(\"--lng <number>\", \"Longitude\", parseLongitude)\n .option(\"--json\", \"Print the raw maps response as JSON\")\n .action(\n withErrorHandler(async (options: ReverseGeocodeOptions) => {\n await runMapsRequest(\n \"Reverse geocode completed\",\n \"reverse-geocode\",\n { lat: options.lat, lng: options.lng },\n options,\n );\n }),\n );\n\nconst directionsCommand = new Command()\n .name(\"directions\")\n .description(\"Get a route between two places\")\n .requiredOption(\n \"--origin <place>\",\n \"Origin address, coordinates, or place ID\",\n )\n .requiredOption(\n \"--destination <place>\",\n \"Destination address, coordinates, or place ID\",\n )\n .option(\n \"--mode <mode>\",\n \"Travel mode: driving, walking, bicycling, or transit\",\n parseTravelMode,\n \"driving\",\n )\n .option(\"--departure-time <time>\", \"ISO departure time or provider keyword\")\n .option(\"--json\", \"Print the raw maps response as JSON\")\n .action(\n withErrorHandler(async (options: DirectionsOptions) => {\n await runMapsRequest(\n \"Directions completed\",\n \"directions\",\n {\n origin: options.origin,\n destination: options.destination,\n mode: options.mode,\n departureTime: options.departureTime,\n },\n options,\n );\n }),\n );\n\nconst placesSearchCommand = new Command()\n .name(\"search\")\n .description(\"Search for places\")\n .requiredOption(\"--query <query>\", \"Place search query\")\n .option(\"--location <lat,lng>\", \"Optional location bias\")\n .option(\n \"--radius <meters>\",\n \"Optional search radius in meters\",\n parsePositiveInteger,\n )\n .option(\n \"--limit <n>\",\n \"Maximum places to return, from 1 to 20\",\n parseLimit,\n 5,\n )\n .option(\"--region <code>\", \"Optional region bias, such as US or CN\")\n .option(\"--json\", \"Print the raw maps response as JSON\")\n .action(\n withErrorHandler(async (options: PlacesSearchOptions) => {\n await runMapsRequest(\n \"Places search completed\",\n \"places/search\",\n {\n query: options.query,\n location: options.location,\n radius: options.radius,\n limit: options.limit,\n region: options.region,\n },\n options,\n );\n }),\n );\n\nconst placesDetailsCommand = new Command()\n .name(\"details\")\n .description(\"Get details for a place\")\n .requiredOption(\"--place-id <id>\", \"Provider place ID\")\n .option(\n \"--fields <fields>\",\n \"Field set: essentials or pro\",\n parsePlaceDetailFields,\n \"essentials\",\n )\n .option(\"--json\", \"Print the raw maps response as JSON\")\n .action(\n withErrorHandler(async (options: PlacesDetailsOptions) => {\n await runMapsRequest(\n \"Place details completed\",\n \"places/details\",\n { placeId: options.placeId, fields: options.fields },\n options,\n );\n }),\n );\n\nconst placesCommand = new Command()\n .name(\"places\")\n .description(\"Search places and fetch place details\")\n .addCommand(placesSearchCommand)\n .addCommand(placesDetailsCommand);\n\nexport const zeroMapsCommand = new Command()\n .name(\"maps\")\n .description(\"Use managed zero maps services\")\n .addCommand(geocodeCommand)\n .addCommand(reverseGeocodeCommand)\n .addCommand(directionsCommand)\n .addCommand(placesCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Geocode address: zero maps geocode --address \"1 Infinite Loop, Cupertino\" --json\n Get route: zero maps directions --origin \"SFO\" --destination \"Mountain View\" --mode driving --json\n Search places: zero maps places search --query \"coffee near Union Square SF\" --limit 5 --json\n Place details: zero maps places details --place-id <id> --fields essentials --json\n\nNotes:\n - Authenticates via ZERO_TOKEN (requires maps:read capability) or a CLI token\n - Google Maps calls and credit billing happen on the vm0 API server\n - Use --fields essentials for place details unless pro fields are required`,\n );\n","import { Command, InvalidArgumentError } from \"commander\";\nimport chalk from \"chalk\";\n\nimport { callZeroBanking, type ZeroBankingResponse } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\ninterface JsonOption {\n readonly json?: boolean;\n}\n\ninterface BalancesOptions extends JsonOption {\n readonly accountId: string;\n}\n\ninterface TransactionsOptions extends JsonOption {\n readonly accountId: string;\n readonly from: string;\n readonly to: string;\n readonly limit: number;\n}\n\nfunction parseLimit(value: string): number {\n const parsed = Number(value);\n if (!Number.isInteger(parsed) || parsed < 1 || parsed > 1000) {\n throw new InvalidArgumentError(\"limit must be between 1 and 1000\");\n }\n return parsed;\n}\n\nfunction parseDateOnly(value: string): string {\n if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n throw new InvalidArgumentError(\"date must be formatted as YYYY-MM-DD\");\n }\n return value;\n}\n\nfunction renderBankingResponse(\n label: string,\n response: ZeroBankingResponse,\n): void {\n console.log(chalk.green(`✓ ${label}`));\n console.log(chalk.dim(` Provider: ${response.provider}`));\n\n if (response.accounts) {\n console.log(JSON.stringify(response.accounts, null, 2));\n return;\n }\n if (response.balance) {\n console.log(JSON.stringify(response.balance, null, 2));\n return;\n }\n console.log(JSON.stringify(response.transactions ?? [], null, 2));\n}\n\nasync function runBankingRequest(\n label: string,\n operation: \"accounts\" | \"balances\" | \"transactions\",\n payload: Record<string, unknown>,\n options: JsonOption,\n): Promise<void> {\n const response = await callZeroBanking(operation, payload);\n if (options.json) {\n console.log(JSON.stringify(response));\n return;\n }\n renderBankingResponse(label, response);\n}\n\nconst accountsCommand = new Command()\n .name(\"accounts\")\n .description(\"List enabled banking accounts\")\n .option(\"--json\", \"Print the raw banking response as JSON\")\n .action(\n withErrorHandler(async (options: JsonOption) => {\n await runBankingRequest(\n \"Banking accounts loaded\",\n \"accounts\",\n {},\n options,\n );\n }),\n );\n\nconst balancesCommand = new Command()\n .name(\"balances\")\n .description(\"Read an enabled account balance\")\n .requiredOption(\"--account-id <id>\", \"Enabled provider account ID\")\n .option(\"--json\", \"Print the raw banking response as JSON\")\n .action(\n withErrorHandler(async (options: BalancesOptions) => {\n await runBankingRequest(\n \"Banking balance loaded\",\n \"balances\",\n { accountId: options.accountId },\n options,\n );\n }),\n );\n\nconst transactionsCommand = new Command()\n .name(\"transactions\")\n .description(\"Read transactions for an enabled account\")\n .requiredOption(\"--account-id <id>\", \"Enabled provider account ID\")\n .requiredOption(\n \"--from <date>\",\n \"Start date, formatted as YYYY-MM-DD\",\n parseDateOnly,\n )\n .requiredOption(\n \"--to <date>\",\n \"End date, formatted as YYYY-MM-DD\",\n parseDateOnly,\n )\n .option(\"--limit <n>\", \"Maximum transactions to return\", parseLimit, 100)\n .option(\"--json\", \"Print the raw banking response as JSON\")\n .action(\n withErrorHandler(async (options: TransactionsOptions) => {\n await runBankingRequest(\n \"Banking transactions loaded\",\n \"transactions\",\n {\n accountId: options.accountId,\n from: options.from,\n to: options.to,\n limit: options.limit,\n },\n options,\n );\n }),\n );\n\nexport const zeroBankingCommand = new Command()\n .name(\"banking\")\n .description(\"Use managed zero banking services\")\n .addCommand(accountsCommand)\n .addCommand(balancesCommand)\n .addCommand(transactionsCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n List accounts: zero banking accounts --json\n Get balance: zero banking balances --account-id <id> --json\n Get transactions: zero banking transactions --account-id <id> --from 2026-01-01 --to 2026-01-31 --json\n\nNotes:\n - Authenticates via ZERO_TOKEN (requires banking:read capability)\n - Finicity credentials and app tokens stay on the vm0 API server\n - Access is limited to accounts enabled for the current agent`,\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getVm0ModelMultiplier } from \"@vm0/api-contracts/contracts/model-providers\";\nimport { listZeroModelPolicies } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport {\n formatModelPolicyStatus,\n formatModelProviderRoute,\n getModelProviderRouteKind,\n} from \"../../../lib/domain/model-policy-display\";\n\nfunction formatCreditMultiplier(multiplier: number | undefined): string {\n return multiplier === undefined ? \"unknown\" : `x${multiplier}`;\n}\n\nfunction getCurrentIntegration(): string | null {\n const prompt = process.env.VM0_APPEND_SYSTEM_PROMPT;\n if (!prompt) {\n return null;\n }\n\n const match = prompt.match(/You are currently running inside:\\s*([^\\n]+)/i);\n return match?.[1]?.trim().toLowerCase() ?? null;\n}\n\nexport function getModelSwitchGuidance(integration = getCurrentIntegration()) {\n const normalizedIntegration = integration?.toLowerCase();\n\n if (normalizedIntegration === \"web\") {\n return \"Switch models from the model selector next to the input box in the web chat.\";\n }\n\n if (normalizedIntegration === \"telegram\") {\n return \"Use /model in Telegram to switch models.\";\n }\n\n return \"Open https://app.vm0.ai and switch models from the model selector next to the input box.\";\n}\n\nconst listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List models allowed by the current organization\")\n .action(\n withErrorHandler(async () => {\n const result = await listZeroModelPolicies();\n\n if (result.policies.length === 0) {\n console.log(chalk.dim(\"No models are allowed for this organization\"));\n return;\n }\n\n console.log(chalk.bold(\"Allowed Models:\"));\n console.log();\n\n for (const policy of result.policies) {\n const defaultMarker = policy.isDefault ? chalk.dim(\" (default)\") : \"\";\n console.log(\n ` - ${policy.modelLabel} ${chalk.dim(`(${policy.model})`)}${defaultMarker}`,\n );\n console.log(` provider: ${formatModelProviderRoute(policy)}`);\n\n if (getModelProviderRouteKind(policy) === \"built-in\") {\n console.log(\n ` price coefficient: ${formatCreditMultiplier(getVm0ModelMultiplier(policy.model))}`,\n );\n }\n\n const status = formatModelPolicyStatus(policy);\n if (status) {\n console.log(chalk.yellow(` status: ${status}`));\n }\n }\n\n console.log();\n console.log(\n chalk.dim(\n \"Use `zero model-provider set --help` to see how to switch each model between built-in and BYOK.\",\n ),\n );\n }),\n );\n\nexport const switchCommand = new Command()\n .name(\"switch\")\n .description(\"Show how to switch models in the current environment\")\n .action(() => {\n console.log(getModelSwitchGuidance());\n });\n\nexport const zeroModelCommand = new Command()\n .name(\"model\")\n .description(\"List available models and model-switching guidance\")\n .addCommand(listCommand)\n .addCommand(switchCommand);\n","import {\n MODEL_PROVIDER_TYPES,\n type ModelProviderType,\n type OrgModelPolicy,\n} from \"@vm0/api-contracts/contracts/model-providers\";\n\ntype ModelProviderRouteKind = \"built-in\" | \"api key\" | \"subscription\";\n\nexport function getModelProviderRouteKind(\n policy: Pick<OrgModelPolicy, \"credentialScope\" | \"defaultProviderType\">,\n): ModelProviderRouteKind {\n if (policy.defaultProviderType === \"vm0\") {\n return \"built-in\";\n }\n\n if (policy.credentialScope === \"member\") {\n return \"subscription\";\n }\n\n return \"api key\";\n}\n\nexport function getModelProviderTypeLabel(type: ModelProviderType): string {\n return MODEL_PROVIDER_TYPES[type].label;\n}\n\nexport function formatModelProviderRoute(policy: OrgModelPolicy): string {\n const kind = getModelProviderRouteKind(policy);\n const label = getModelProviderTypeLabel(policy.defaultProviderType);\n return `${kind} (${label}; ${policy.defaultProviderType})`;\n}\n\nexport function formatModelPolicyStatus(policy: OrgModelPolicy): string | null {\n if (policy.routeStatus === \"valid\") {\n return null;\n }\n\n return policy.routeStatusReason\n ? `${policy.routeStatus}: ${policy.routeStatusReason}`\n : policy.routeStatus;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroModelPolicies } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport {\n formatModelPolicyStatus,\n getModelProviderRouteKind,\n getModelProviderTypeLabel,\n} from \"../../../lib/domain/model-policy-display\";\n\nexport const MODEL_PROVIDER_SET_GUIDANCE = [\n \"Model provider routing is configured in the web app.\",\n \"\",\n \"Organization admins: open https://app.vm0.ai, use the top-left organization menu, choose Manage, then add, delete, or adjust model providers.\",\n \"\",\n \"If an organization admin sets a model provider to subscription, members must use the bottom-left user menu, choose Preferences / Personal Models, and connect their personal subscription.\",\n].join(\"\\n\");\n\nconst listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\n \"List provider routing for each model allowed by the organization\",\n )\n .action(\n withErrorHandler(async () => {\n const result = await listZeroModelPolicies();\n\n if (result.policies.length === 0) {\n console.log(\n chalk.dim(\n \"No model provider routes are allowed for this organization\",\n ),\n );\n return;\n }\n\n console.log(chalk.bold(\"Model Provider Routes:\"));\n console.log();\n\n for (const policy of result.policies) {\n const defaultMarker = policy.isDefault ? chalk.dim(\" (default)\") : \"\";\n console.log(\n ` - ${policy.modelLabel} ${chalk.dim(`(${policy.model})`)}${defaultMarker}`,\n );\n console.log(` provider: ${getModelProviderRouteKind(policy)}`);\n console.log(\n ` provider type: ${policy.defaultProviderType} (${getModelProviderTypeLabel(policy.defaultProviderType)})`,\n );\n\n const status = formatModelPolicyStatus(policy);\n if (status) {\n console.log(chalk.yellow(` status: ${status}`));\n }\n }\n }),\n );\n\nexport const setCommand = new Command()\n .name(\"set\")\n .description(\"Show where to adjust model provider routing\")\n .addHelpText(\"after\", `\\n${MODEL_PROVIDER_SET_GUIDANCE}`)\n .action(() => {\n console.log(MODEL_PROVIDER_SET_GUIDANCE);\n });\n\nexport const zeroModelProviderCommand = new Command()\n .name(\"model-provider\")\n .description(\"Inspect model provider routing\")\n .addCommand(listCommand)\n .addCommand(setCommand);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;;;ACAA;AAMO,IAAM,gBAAgB,IAAI,QAAQ,EACtC,KAAK,QAAQ,EACb,YAAY,kCAAkC,EAC9C;AAAA,EACC,iBAAiB,YAAY;AAC3B,QAAI;AACF,YAAM,MAAM,MAAM,WAAW;AAE7B,cAAQ,IAAI,eAAM,KAAK,2BAA2B,CAAC;AACnD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,kBAAkB;AAC3B,CAAC;AAIH,IACE,QAAQ,KAAK,CAAC,GAAG,SAAS,SAAS,KACnC,QAAQ,KAAK,CAAC,GAAG,SAAS,SAAS,KACnC,QAAQ,KAAK,CAAC,GAAG,SAAS,MAAM,GAChC;AACA,8BAA4B;AAC5B,uBAAqB,OAAO;AAC5B,UAAQ,MAAM;AAChB;","names":["listCommand","setCommand","removeCommand","listCommand","setCommand","removeCommand","listCommand","setCommand","removeCommand","listCommand","setCommand","removeCommand","setupCommand","listCommand","import_prompts","prompts","type","config","prompts","options","removeCommand","readFileSync","readFileSync","listCommand","deleteCommand","listCommand","deleteCommand","authMethod","listCommand","isConnectorType","relative","isConnectorType","statusCommand","available","listCommand","statusCommand","isConnectorType","detectTimezone","resolve","readFileSync","day","readFileSync","setupCommand","listCommand","statusCommand","deleteCommand","setupCommand","listCommand","statusCommand","deleteCommand","listCommand","setCommand","deleteCommand","listCommand","setCommand","deleteCommand","readFileSync","readFileSync","listCommand","createCommand","deleteCommand","readFileSync","basename","stat","basename","readFileSync","readFileSync","sendCommand","readFileSync","sendCommand","statSync","readFileSync","basename","uploadFileCommand","stat","statSync","basename","readFileSync","basename","join","tmpdir","defaultOutPath","join","tmpdir","basename","downloadFileCommand","uploadFileCommand","downloadFileCommand","listCommand","listCommand","basename","join","tmpdir","defaultOutPath","join","tmpdir","basename","downloadFileCommand","readFileSync","sendCommand","readFileSync","sendCommand","readFileSync","statSync","basename","extname","MIME_BY_EXTENSION","inferContentType","extname","uploadFileCommand","stat","statSync","basename","readFileSync","downloadFileCommand","uploadFileCommand","basename","join","tmpdir","defaultOutPath","join","tmpdir","basename","downloadFileCommand","readFileSync","readFileSync","readFileSync","statSync","basename","extname","MIME_BY_EXTENSION","inferContentType","extname","uploadFileCommand","stat","statSync","basename","readFileSync","downloadFileCommand","uploadFileCommand","truncateValue","listCommand","setCommand","deleteCommand","listCommand","setCommand","deleteCommand","formatConnectorIdentity","unknownIcon","readFileSync","join","walk","createCommand","editCommand","viewCommand","listCommand","deleteCommand","createCommand","editCommand","viewCommand","listCommand","deleteCommand","listCommand","parseLimit","searchCommand","listCommand","searchCommand","SEVEN_DAYS_MS","parseContextOptions","parseLimit","join","sleep","resolve","parsePositiveInteger","join","readFileSync","isConnectorType","isConnectorType","readFileSync","outputDir","unknownDesignSystemError","unknownTemplateError","outputDir","slugify","parseSeed","unknownDesignSystemError","unknownTemplateError","basename","join","tmpdir","defaultOutPath","join","tmpdir","basename","downloadFileCommand","uploadFileCommand","downloadFileCommand","uploadFileCommand","readFile","extname","MIME_BY_EXTENSION","inferContentType","readFile","parsePositiveInteger","parseLimit","parseLimit","listCommand","listCommand","setCommand"]}
|
|
1
|
+
{"version":3,"sources":["../src/zero.ts","../src/commands/zero/org/index.ts","../src/commands/zero/org/status.ts","../src/commands/zero/org/set.ts","../src/commands/zero/org/list.ts","../src/commands/zero/org/use.ts","../src/commands/zero/org/members.ts","../src/commands/zero/org/invite.ts","../src/commands/zero/org/remove.ts","../src/commands/zero/org/leave.ts","../src/commands/zero/org/delete.ts","../src/commands/zero/org/secret/index.ts","../src/commands/zero/org/secret/list.ts","../src/commands/zero/org/secret/set.ts","../src/commands/zero/org/secret/remove.ts","../src/commands/zero/org/variable/index.ts","../src/commands/zero/org/variable/list.ts","../src/commands/zero/org/variable/set.ts","../src/commands/zero/org/variable/remove.ts","../src/commands/zero/org/model-provider/index.ts","../src/commands/zero/org/model-provider/list.ts","../src/commands/zero/org/model-provider/setup.ts","../src/lib/domain/model-provider/shared.ts","../src/commands/zero/org/model-provider/remove.ts","../src/commands/zero/agent/index.ts","../src/commands/zero/agent/create.ts","../src/commands/zero/agent/avatar.ts","../src/commands/zero/agent/edit.ts","../src/commands/zero/agent/view.ts","../src/lib/utils/format-utils.ts","../src/commands/zero/agent/list.ts","../src/commands/zero/agent/delete.ts","../src/commands/zero/connector/index.ts","../src/commands/zero/connector/connect.ts","../src/commands/zero/connector/list.ts","../src/commands/zero/connector/agent-context.ts","../src/commands/zero/connector/connected-as.ts","../src/commands/zero/connector/search.ts","../../../packages/connectors/src/connector-search.ts","../src/commands/zero/connector/status.ts","../src/lib/domain/schedule-utils.ts","../src/commands/zero/doctor/platform-url.ts","../src/commands/zero/credit.ts","../src/commands/zero/doctor/index.ts","../src/commands/zero/doctor/check-connector.ts","../src/commands/zero/doctor/permission-deny.ts","../src/commands/zero/doctor/permission-context.ts","../src/commands/zero/doctor/permission-change.ts","../src/commands/zero/doctor/credit.ts","../src/commands/zero/preference/index.ts","../src/commands/zero/run/index.ts","../src/commands/zero/run/run.ts","../src/commands/zero/run/shared.ts","../src/commands/zero/run/continue.ts","../src/commands/zero/schedule/index.ts","../src/commands/zero/schedule/setup.ts","../src/commands/zero/schedule/list.ts","../src/commands/zero/schedule/status.ts","../src/commands/zero/schedule/delete.ts","../src/commands/zero/schedule/enable.ts","../src/commands/zero/schedule/disable.ts","../src/commands/zero/secret/index.ts","../src/commands/zero/secret/list.ts","../src/commands/zero/secret/set.ts","../src/commands/zero/secret/delete.ts","../src/commands/zero/chat/index.ts","../src/commands/zero/chat/message/index.ts","../src/commands/zero/chat/message/send.ts","../src/commands/zero/github/index.ts","../src/commands/zero/github/download-file.ts","../src/commands/zero/github/label-listener/index.ts","../src/commands/zero/github/upload-file.ts","../src/commands/zero/slack/index.ts","../src/commands/zero/slack/message/index.ts","../src/commands/zero/slack/message/send.ts","../src/commands/zero/slack/upload-file.ts","../src/commands/zero/slack/download-file.ts","../src/commands/zero/telegram/index.ts","../src/commands/zero/telegram/bot/index.ts","../src/commands/zero/telegram/bot/list.ts","../src/commands/zero/telegram/download-file.ts","../src/commands/zero/telegram/message/index.ts","../src/commands/zero/telegram/message/send.ts","../src/commands/zero/telegram/upload-file.ts","../src/commands/zero/phone/index.ts","../src/commands/zero/phone/download-file.ts","../src/commands/zero/phone/message.ts","../src/commands/zero/phone/upload-file.ts","../src/commands/zero/variable/index.ts","../src/commands/zero/variable/list.ts","../src/commands/zero/variable/set.ts","../src/commands/zero/variable/delete.ts","../src/commands/zero/whoami.ts","../src/commands/zero/skill/index.ts","../src/commands/zero/skill/create.ts","../src/lib/skill-directory.ts","../src/commands/zero/skill/edit.ts","../src/commands/zero/skill/view.ts","../src/commands/zero/skill/list.ts","../src/commands/zero/skill/delete.ts","../src/commands/zero/logs/index.ts","../src/commands/zero/logs/list.ts","../src/commands/zero/logs/search.ts","../src/commands/zero/search/index.ts","../src/commands/zero/developer-support.ts","../src/commands/zero/computer-use/index.ts","../src/commands/zero/generate/index.ts","../src/commands/zero/generate/image.ts","../src/commands/zero/shared/image-generate.ts","../src/commands/zero/shared/image-style-authoring.ts","../src/commands/zero/shared/resource-registry.ts","../../../packages/core/src/resource-registry.ts","../src/commands/zero/shared/resource-listing.ts","../src/commands/zero/generate/lib/dispatch.ts","../src/commands/zero/generate/lib/connector-guidance.ts","../src/commands/zero/generate/lib/lister.ts","../src/commands/zero/generate/artifacts.ts","../src/commands/zero/shared/artifact-generate.ts","../src/commands/zero/shared/html-artifact-authoring.ts","../src/commands/zero/generate/presentation.ts","../src/commands/zero/shared/presentation-generate.ts","../src/commands/zero/generate/sprite.ts","../src/commands/zero/shared/sprite-authoring.ts","../src/commands/zero/generate/video.ts","../src/commands/zero/shared/video-generate.ts","../src/commands/zero/generate/website.ts","../src/commands/zero/generate/voice.ts","../src/commands/zero/shared/voice-generate.ts","../src/commands/zero/generate/lister-only.ts","../src/commands/zero/web/index.ts","../src/commands/zero/web/download-file.ts","../src/commands/zero/web/upload-file.ts","../src/commands/zero/host/index.ts","../src/lib/host/publish-static-site.ts","../src/lib/host/static-site.ts","../src/commands/zero/maps/index.ts","../src/commands/zero/banking/index.ts","../src/commands/zero/model/index.ts","../src/lib/domain/model-policy-display.ts","../src/commands/zero/model-provider/index.ts"],"sourcesContent":["// Zero CLI entry point - standalone binary for zero platform commands\n// Sentry must be initialized before any other imports\nimport \"./instrument.js\";\nimport { Command } from \"commander\";\nimport { configureGlobalProxyFromEnv } from \"./lib/network/proxy.js\";\nimport { zeroOrgCommand } from \"./commands/zero/org\";\nimport { zeroAgentCommand } from \"./commands/zero/agent\";\nimport { zeroConnectorCommand } from \"./commands/zero/connector\";\nimport { zeroCreditCommand } from \"./commands/zero/credit\";\nimport { zeroDoctorCommand } from \"./commands/zero/doctor\";\nimport { zeroPreferenceCommand } from \"./commands/zero/preference\";\nimport { zeroRunCommand } from \"./commands/zero/run\";\nimport { zeroScheduleCommand } from \"./commands/zero/schedule\";\nimport { zeroSecretCommand } from \"./commands/zero/secret\";\nimport { zeroChatCommand } from \"./commands/zero/chat\";\nimport { zeroGithubCommand } from \"./commands/zero/github\";\nimport { zeroSlackCommand } from \"./commands/zero/slack\";\nimport { zeroTelegramCommand } from \"./commands/zero/telegram\";\nimport { zeroPhoneCommand } from \"./commands/zero/phone\";\nimport { zeroVariableCommand } from \"./commands/zero/variable\";\nimport { zeroWhoamiCommand } from \"./commands/zero/whoami\";\nimport { zeroSkillCommand } from \"./commands/zero/skill\";\nimport { zeroLogsCommand } from \"./commands/zero/logs\";\nimport { zeroSearchCommand } from \"./commands/zero/search\";\nimport { zeroDeveloperSupportCommand } from \"./commands/zero/developer-support\";\nimport { zeroComputerUseCommand } from \"./commands/zero/computer-use\";\nimport { generateCommand } from \"./commands/zero/generate\";\nimport { zeroWebCommand } from \"./commands/zero/web\";\nimport { zeroHostCommand } from \"./commands/zero/host\";\nimport { zeroMapsCommand } from \"./commands/zero/maps\";\nimport { zeroBankingCommand } from \"./commands/zero/banking\";\nimport { zeroModelCommand } from \"./commands/zero/model\";\nimport { zeroModelProviderCommand } from \"./commands/zero/model-provider\";\nimport {\n decodeZeroTokenPayload,\n type ZeroTokenPayload,\n} from \"./lib/api/zero-token.js\";\n\n/**\n * Map of command names to the capability required to see them.\n * Commands not in this map are hidden when ZERO_TOKEN is active.\n * Use an array when a top-level command has subcommands with different\n * capability gates and any one of them should make the command visible.\n * Use `null` for commands that should always be visible in sandbox.\n */\nconst COMMAND_CAPABILITY_MAP: Record<\n string,\n string | readonly string[] | null\n> = {\n agent: \"agent:read\",\n skill: \"agent:read\",\n connector: \"connector:read\",\n run: \"agent-run:write\",\n schedule: \"schedule:read\",\n doctor: null,\n credit: \"billing:write\",\n model: null,\n \"model-provider\": null,\n logs: \"agent-run:read\",\n search: \"chat-message:read\",\n chat: \"chat-message:write\",\n github: [\"github:read\", \"github:write\"],\n slack: \"slack:write\",\n telegram: [\"telegram:read\", \"telegram:write\"],\n phone: [\"phone:read\", \"phone:write\"],\n whoami: null,\n \"developer-support\": null,\n \"computer-use\": \"computer-use:write\",\n generate: null,\n web: null,\n host: \"host:write\",\n maps: \"maps:read\",\n banking: \"banking:read\",\n};\n\nconst DEFAULT_COMMANDS: Command[] = [\n zeroOrgCommand,\n zeroModelCommand,\n zeroModelProviderCommand,\n zeroAgentCommand,\n zeroConnectorCommand,\n zeroCreditCommand,\n zeroDoctorCommand,\n zeroPreferenceCommand,\n zeroRunCommand,\n zeroScheduleCommand,\n zeroSecretCommand,\n zeroChatCommand,\n zeroGithubCommand,\n zeroSlackCommand,\n zeroTelegramCommand,\n zeroPhoneCommand,\n zeroVariableCommand,\n zeroLogsCommand,\n zeroSearchCommand,\n zeroWhoamiCommand,\n zeroSkillCommand,\n zeroDeveloperSupportCommand,\n zeroComputerUseCommand,\n generateCommand,\n zeroWebCommand,\n zeroHostCommand,\n zeroMapsCommand,\n zeroBankingCommand,\n];\n\nfunction shouldHideCommand(\n name: string,\n payload: ZeroTokenPayload | undefined,\n): boolean {\n if (!payload) return false;\n const requiredCap = COMMAND_CAPABILITY_MAP[name];\n if (requiredCap === undefined) return true;\n if (requiredCap === null) return false;\n if (typeof requiredCap !== \"string\") {\n return !requiredCap.some((capability) => {\n return payload.capabilities.includes(capability);\n });\n }\n return !payload.capabilities.includes(requiredCap);\n}\n\nexport function buildZeroHelpText(\n payload: ZeroTokenPayload | undefined = decodeZeroTokenPayload(),\n): string {\n const examples = [\n \" Check a connector? zero doctor check-connector --env-name <ENV_NAME>\",\n ...(payload && !payload.capabilities.includes(\"billing:read\")\n ? []\n : [\" Check credits? zero doctor credit\"]),\n ...(shouldHideCommand(\"credit\", payload)\n ? []\n : [\" Buy credits? zero credit 20000\"]),\n \" Send a Slack message? zero slack message send --help\",\n \" Upload GitHub? zero github upload-file --help\",\n \" Download GitHub? zero github download-file --help\",\n \" List Telegram bots? zero telegram bot list\",\n \" Send Telegram? zero telegram message send --help\",\n \" Upload Telegram? zero telegram upload-file --help\",\n \" Download Telegram? zero telegram download-file --help\",\n \" Send AgentPhone? zero phone message --help\",\n \" Upload AgentPhone? zero phone upload-file --help\",\n \" Download AgentPhone? zero phone download-file --help\",\n \" Set up a schedule? zero schedule setup --help\",\n \" List models? zero model ls\",\n \" Model routing? zero model-provider ls\",\n \" Update yourself? zero agent --help\",\n \" Manage custom skills? zero skill --help\",\n \" List generators? zero generate --help\",\n ' Generate image? zero generate image --prompt \"...\"',\n ' Generate website? zero generate website --prompt \"...\"',\n ' Generate voice? zero generate voice --prompt \"...\"',\n ...(shouldHideCommand(\"host\", payload)\n ? []\n : [\" Host a static site? zero host ./dist --site my-site --spa\"]),\n ...(shouldHideCommand(\"maps\", payload)\n ? []\n : [\n ' Get directions? zero maps directions --origin \"SFO\" --destination \"Mountain View\" --json',\n ]),\n ...(shouldHideCommand(\"banking\", payload)\n ? []\n : [\" Read bank data? zero banking accounts --json\"]),\n \" Check your identity? zero whoami\",\n ];\n\n return `\\nExamples:\\n${examples.join(\"\\n\")}`;\n}\n\n/**\n * Register commands with visibility based on ZERO_TOKEN capabilities.\n * Commands not granted by the token are registered as hidden via\n * Commander's public `addCommand(cmd, { hidden: true })` API.\n * When no ZERO_TOKEN is present, all commands remain visible.\n *\n * @param commands - override default commands (used in tests)\n */\nexport function registerZeroCommands(\n prog: Command,\n commands?: Command[],\n): void {\n const token = process.env.ZERO_TOKEN;\n const payload = token ? decodeZeroTokenPayload(token) : undefined;\n\n for (const cmd of commands ?? DEFAULT_COMMANDS) {\n const hidden = shouldHideCommand(cmd.name(), payload);\n prog.addCommand(cmd, hidden ? { hidden: true } : {});\n }\n}\n\nconst program = new Command();\n\ndeclare const __CLI_VERSION__: string;\n\nprogram\n .name(\"zero\")\n .description(\n \"Zero CLI — interact with the zero platform from inside the sandbox\",\n )\n .version(__CLI_VERSION__)\n .addHelpText(\"after\", () => {\n return buildZeroHelpText();\n });\n\nexport { program };\n\nif (\n process.argv[1]?.endsWith(\"zero.js\") ||\n process.argv[1]?.endsWith(\"zero.ts\") ||\n process.argv[1]?.endsWith(\"zero\")\n) {\n configureGlobalProxyFromEnv();\n registerZeroCommands(program);\n program.parse();\n}\n","import { Command } from \"commander\";\nimport { statusCommand } from \"./status\";\nimport { setCommand } from \"./set\";\nimport { listCommand } from \"./list\";\nimport { useCommand } from \"./use\";\nimport { membersCommand } from \"./members\";\nimport { inviteCommand } from \"./invite\";\nimport { removeCommand } from \"./remove\";\nimport { leaveCommand } from \"./leave\";\nimport { deleteCommand } from \"./delete\";\nimport { zeroOrgSecretCommand } from \"./secret\";\nimport { zeroOrgVariableCommand } from \"./variable\";\nimport { zeroOrgModelProviderCommand } from \"./model-provider\";\n\nexport const zeroOrgCommand = new Command()\n .name(\"org\")\n .description(\"Manage organization settings, members, and providers\")\n .addCommand(statusCommand)\n .addCommand(setCommand)\n .addCommand(listCommand)\n .addCommand(useCommand)\n .addCommand(membersCommand)\n .addCommand(inviteCommand)\n .addCommand(removeCommand)\n .addCommand(leaveCommand)\n .addCommand(deleteCommand)\n .addCommand(zeroOrgSecretCommand)\n .addCommand(zeroOrgVariableCommand)\n .addCommand(zeroOrgModelProviderCommand);\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getZeroOrg } from \"../../../lib/api\";\nimport { ApiRequestError } from \"../../../lib/api/core/client-factory\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const statusCommand = new Command()\n .name(\"status\")\n .description(\"View current organization status\")\n .action(\n withErrorHandler(async () => {\n try {\n const org = await getZeroOrg();\n\n console.log(chalk.bold(\"Organization Information:\"));\n console.log(` Slug: ${chalk.green(org.slug)}`);\n } catch (error) {\n if (error instanceof ApiRequestError && error.status === 404) {\n throw new Error(\"No organization configured\", {\n cause: new Error(\"Set your organization with: zero org set <slug>\"),\n });\n }\n throw error;\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getZeroOrg, updateZeroOrg, switchZeroOrg } from \"../../../lib/api\";\nimport { saveConfig } from \"../../../lib/api/config\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const setCommand = new Command()\n .name(\"set\")\n .description(\"Rename your organization slug\")\n .argument(\"<slug>\", \"The new organization slug\")\n .option(\n \"--force\",\n \"Force change existing organization (may break references)\",\n )\n .action(\n withErrorHandler(async (slug: string, options: { force?: boolean }) => {\n try {\n const existingOrg = await getZeroOrg();\n\n if (!options.force) {\n throw new Error(\n `You already have an organization: ${existingOrg.slug}`,\n {\n cause: new Error(`To change, use: zero org set ${slug} --force`),\n },\n );\n }\n\n const org = await updateZeroOrg({ slug, force: true });\n\n const result = await switchZeroOrg(org.slug);\n await saveConfig({\n token: result.access_token,\n });\n\n console.log(chalk.green(`✓ Organization updated to ${org.slug}`));\n console.log();\n console.log(\"Your agents will now be namespaced as:\");\n console.log(chalk.cyan(` ${org.slug}/<agent-name>`));\n } catch (error) {\n if (\n error instanceof Error &&\n error.message.includes(\"already exists\")\n ) {\n throw new Error(\n `Organization \"${slug}\" is already taken. Please choose a different slug.`,\n );\n }\n throw error;\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroOrgs } from \"../../../lib/api\";\nimport { getActiveOrg } from \"../../../lib/api/config\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const listCommand = new Command()\n .name(\"list\")\n .description(\"List all accessible organizations\")\n .action(\n withErrorHandler(async () => {\n const result = await listZeroOrgs();\n const activeOrg = await getActiveOrg();\n\n console.log(chalk.bold(\"Available organizations:\"));\n for (const org of result.orgs) {\n const isCurrent = org.slug === activeOrg;\n const marker = isCurrent ? chalk.green(\"* \") : \" \";\n const roleLabel = org.role ? ` (${org.role})` : \"\";\n const currentLabel = isCurrent ? chalk.dim(\" ← current\") : \"\";\n console.log(`${marker}${org.slug}${roleLabel}${currentLabel}`);\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroOrgs, switchZeroOrg } from \"../../../lib/api\";\nimport { saveConfig } from \"../../../lib/api/config\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const useCommand = new Command()\n .name(\"use\")\n .description(\"Switch to a different organization\")\n .argument(\"<slug>\", \"Organization slug to switch to\")\n .action(\n withErrorHandler(async (slug: string) => {\n const orgList = await listZeroOrgs();\n const target = orgList.orgs.find((s) => {\n return s.slug === slug;\n });\n if (!target) {\n throw new Error(`Organization '${slug}' not found or not accessible.`);\n }\n\n const result = await switchZeroOrg(slug);\n await saveConfig({\n token: result.access_token,\n });\n console.log(chalk.green(`✓ Switched to organization: ${slug}`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getZeroOrgMembers } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const membersCommand = new Command()\n .name(\"members\")\n .description(\"View organization members\")\n .action(\n withErrorHandler(async () => {\n const status = await getZeroOrgMembers();\n\n console.log(chalk.bold(`Organization: ${status.slug}`));\n console.log(` Role: ${status.role}`);\n console.log(\n ` Created: ${new Date(status.createdAt).toLocaleDateString()}`,\n );\n console.log();\n console.log(chalk.bold(\"Members:\"));\n for (const member of status.members) {\n const roleTag =\n member.role === \"admin\"\n ? chalk.yellow(` (${member.role})`)\n : chalk.dim(` (${member.role})`);\n console.log(` ${member.email}${roleTag}`);\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { inviteZeroOrgMember } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const inviteCommand = new Command()\n .name(\"invite\")\n .description(\"Invite a member to the current organization\")\n .requiredOption(\"--email <email>\", \"Email address of the member to invite\")\n .option(\n \"--role <role>\",\n \"Role for the invited member (member or admin)\",\n \"member\",\n )\n .action(\n withErrorHandler(async (options: { email: string; role: string }) => {\n if (options.role !== \"member\" && options.role !== \"admin\") {\n throw new Error(\n `Invalid role \"${options.role}\". Must be \"member\" or \"admin\".`,\n );\n }\n await inviteZeroOrgMember(options.email, options.role);\n console.log(\n chalk.green(`✓ Invitation sent to ${options.email} as ${options.role}`),\n );\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { removeZeroOrgMember } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const removeCommand = new Command()\n .name(\"remove\")\n .description(\"Remove a member from the current organization\")\n .argument(\"<email>\", \"Email address of the member to remove\")\n .action(\n withErrorHandler(async (email: string) => {\n await removeZeroOrgMember(email);\n console.log(chalk.green(`✓ Removed ${email} from organization`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { leaveZeroOrg, listZeroOrgs, switchZeroOrg } from \"../../../lib/api\";\nimport { saveConfig } from \"../../../lib/api/config\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const leaveCommand = new Command()\n .name(\"leave\")\n .description(\"Leave the current organization\")\n .action(\n withErrorHandler(async () => {\n await leaveZeroOrg();\n\n const { orgs } = await listZeroOrgs();\n if (orgs.length === 0) {\n await saveConfig({ token: undefined });\n console.log(chalk.green(\"✓ Left organization.\"));\n console.log(\n chalk.yellow(\"No remaining organizations. Run: vm0 auth login\"),\n );\n return;\n }\n\n const nextOrg = orgs[0]!.slug;\n const result = await switchZeroOrg(nextOrg);\n await saveConfig({\n token: result.access_token,\n });\n console.log(chalk.green(`✓ Left organization. Switched to: ${nextOrg}`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { deleteZeroOrg } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const deleteCommand = new Command()\n .name(\"delete\")\n .description(\"Delete the current organization (admin only)\")\n .argument(\"<slug>\", \"Organization slug to confirm deletion\")\n .action(\n withErrorHandler(async (slug: string) => {\n await deleteZeroOrg(slug);\n console.log(chalk.green(`✓ Organization '${slug}' has been deleted.`));\n }),\n );\n","import { Command } from \"commander\";\nimport { listCommand } from \"./list\";\nimport { setCommand } from \"./set\";\nimport { removeCommand } from \"./remove\";\n\nexport const zeroOrgSecretCommand = new Command()\n .name(\"secret\")\n .description(\"Manage org-level secrets (admin)\")\n .addCommand(listCommand)\n .addCommand(setCommand)\n .addCommand(removeCommand);\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroOrgSecrets } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List all org-level secrets\")\n .action(\n withErrorHandler(async () => {\n const result = await listZeroOrgSecrets();\n\n if (result.secrets.length === 0) {\n console.log(chalk.dim(\"No org secrets found\"));\n console.log();\n console.log(\"To add an org secret:\");\n console.log(\n chalk.cyan(\" zero org secret set MY_API_KEY --body <value>\"),\n );\n return;\n }\n\n console.log(chalk.bold(\"Org Secrets:\"));\n console.log();\n\n for (const secret of result.secrets) {\n console.log(` ${chalk.cyan(secret.name)}`);\n if (secret.description) {\n console.log(` ${chalk.dim(secret.description)}`);\n }\n console.log(\n ` ${chalk.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`,\n );\n console.log();\n }\n\n console.log(chalk.dim(`Total: ${result.secrets.length} secret(s)`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { setZeroOrgSecret } from \"../../../../lib/api\";\nimport {\n isInteractive,\n promptPassword,\n} from \"../../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nexport const setCommand = new Command()\n .name(\"set\")\n .description(\"Create or update an org-level secret (admin only)\")\n .argument(\"<name>\", \"Secret name (uppercase, e.g., MY_API_KEY)\")\n .option(\n \"-b, --body <value>\",\n \"Secret value (required in non-interactive mode)\",\n )\n .option(\"-d, --description <description>\", \"Optional description\")\n .action(\n withErrorHandler(\n async (\n name: string,\n options: { body?: string; description?: string },\n ) => {\n let value: string;\n\n if (options.body !== undefined) {\n value = options.body;\n } else if (isInteractive()) {\n const prompted = await promptPassword(\"Enter secret value:\");\n if (prompted === undefined) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n value = prompted;\n } else {\n throw new Error(\"--body is required in non-interactive mode\", {\n cause: new Error(\n `Usage: zero org secret set ${name} --body \"your-secret-value\"`,\n ),\n });\n }\n\n let secret;\n try {\n secret = await setZeroOrgSecret({\n name,\n value,\n description: options.description,\n });\n } catch (error) {\n if (\n error instanceof Error &&\n error.message.includes(\"must contain only uppercase\")\n ) {\n throw new Error(error.message, {\n cause: new Error(\n \"Examples of valid secret names: MY_API_KEY, GITHUB_TOKEN, AWS_ACCESS_KEY_ID\",\n ),\n });\n }\n throw error;\n }\n\n console.log(chalk.green(`✓ Org secret \"${secret.name}\" saved`));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { deleteZeroOrgSecret } from \"../../../../lib/api\";\nimport {\n isInteractive,\n promptConfirm,\n} from \"../../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nexport const removeCommand = new Command()\n .name(\"remove\")\n .description(\"Delete an org-level secret (admin only)\")\n .argument(\"<name>\", \"Secret name to delete\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .action(\n withErrorHandler(async (name: string, options: { yes?: boolean }) => {\n if (!options.yes) {\n if (!isInteractive()) {\n throw new Error(\"--yes flag is required in non-interactive mode\");\n }\n\n const confirmed = await promptConfirm(\n `Are you sure you want to delete org secret \"${name}\"?`,\n false,\n );\n\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteZeroOrgSecret(name);\n console.log(chalk.green(`✓ Org secret \"${name}\" deleted`));\n }),\n );\n","import { Command } from \"commander\";\nimport { listCommand } from \"./list\";\nimport { setCommand } from \"./set\";\nimport { removeCommand } from \"./remove\";\n\nexport const zeroOrgVariableCommand = new Command()\n .name(\"variable\")\n .description(\"Manage org-level variables (admin)\")\n .addCommand(listCommand)\n .addCommand(setCommand)\n .addCommand(removeCommand);\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroOrgVariables } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\n/**\n * Truncate value for display if too long\n */\nfunction truncateValue(value: string, maxLength: number = 60): string {\n if (value.length <= maxLength) {\n return value;\n }\n return value.slice(0, maxLength - 15) + \"... [truncated]\";\n}\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List all org-level variables\")\n .action(\n withErrorHandler(async () => {\n const result = await listZeroOrgVariables();\n\n if (result.variables.length === 0) {\n console.log(chalk.dim(\"No org variables found\"));\n console.log();\n console.log(\"To add an org variable:\");\n console.log(chalk.cyan(\" zero org variable set MY_VAR <value>\"));\n return;\n }\n\n console.log(chalk.bold(\"Org Variables:\"));\n console.log();\n\n for (const variable of result.variables) {\n const displayValue = truncateValue(variable.value);\n console.log(` ${chalk.cyan(variable.name)} = ${displayValue}`);\n if (variable.description) {\n console.log(` ${chalk.dim(variable.description)}`);\n }\n console.log(\n ` ${chalk.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`,\n );\n console.log();\n }\n\n console.log(chalk.dim(`Total: ${result.variables.length} variable(s)`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { setZeroOrgVariable } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nexport const setCommand = new Command()\n .name(\"set\")\n .description(\"Create or update an org-level variable (admin only)\")\n .argument(\"<name>\", \"Variable name (uppercase, e.g., MY_VAR)\")\n .argument(\"<value>\", \"Variable value\")\n .option(\"-d, --description <description>\", \"Optional description\")\n .action(\n withErrorHandler(\n async (\n name: string,\n value: string,\n options: { description?: string },\n ) => {\n let variable;\n try {\n variable = await setZeroOrgVariable({\n name,\n value,\n description: options.description,\n });\n } catch (error) {\n if (\n error instanceof Error &&\n error.message.includes(\"must contain only uppercase\")\n ) {\n throw new Error(error.message, {\n cause: new Error(\n \"Examples of valid variable names: MY_VAR, API_URL, DEBUG_MODE\",\n ),\n });\n }\n throw error;\n }\n\n console.log(chalk.green(`✓ Org variable \"${variable.name}\" saved`));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { deleteZeroOrgVariable } from \"../../../../lib/api\";\nimport {\n isInteractive,\n promptConfirm,\n} from \"../../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nexport const removeCommand = new Command()\n .name(\"remove\")\n .description(\"Delete an org-level variable (admin only)\")\n .argument(\"<name>\", \"Variable name to delete\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .action(\n withErrorHandler(async (name: string, options: { yes?: boolean }) => {\n if (!options.yes) {\n if (!isInteractive()) {\n throw new Error(\"--yes flag is required in non-interactive mode\");\n }\n\n const confirmed = await promptConfirm(\n `Are you sure you want to delete org variable \"${name}\"?`,\n false,\n );\n\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteZeroOrgVariable(name);\n console.log(chalk.green(`✓ Org variable \"${name}\" deleted`));\n }),\n );\n","import { Command } from \"commander\";\nimport { createListCommand } from \"./list\";\nimport { createSetupCommand } from \"./setup\";\nimport { createRemoveCommand } from \"./remove\";\n\nexport const zeroOrgModelProviderCommand = new Command()\n .name(\"model-provider\")\n .description(\"Manage org-level model providers\")\n .addCommand(\n createListCommand({\n scopeLabel: \"org-level\",\n title: \"Org Model Providers\",\n setupCommand: \"zero org model-provider setup\",\n }),\n )\n .addCommand(\n createSetupCommand({\n commandPrefix: \"zero org model-provider setup\",\n description: \"Configure an org-level model provider\",\n scopeLabel: \"Org\",\n }),\n )\n .addCommand(createRemoveCommand({ scopeLabel: \"Org\" }));\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroOrgModelProviders } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\ninterface CreateListCommandOptions {\n scopeLabel?: string;\n title?: string;\n setupCommand?: string;\n}\n\nexport function createListCommand(\n options: CreateListCommandOptions = {},\n): Command {\n const scopeLabel = options.scopeLabel ?? \"org-level\";\n const title = options.title ?? \"Org Model Providers\";\n const setupCommand = options.setupCommand ?? \"zero org model-provider setup\";\n\n return new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(`List all ${scopeLabel} model providers`)\n .action(\n withErrorHandler(async () => {\n const result = await listZeroOrgModelProviders();\n\n if (result.modelProviders.length === 0) {\n console.log(chalk.dim(`No ${scopeLabel} model providers configured`));\n console.log();\n console.log(`To add a ${scopeLabel} model provider:`);\n console.log(chalk.cyan(` ${setupCommand}`));\n return;\n }\n\n // Group by framework\n const byFramework = result.modelProviders.reduce(\n (acc, p) => {\n const fw = p.framework;\n if (!acc[fw]) {\n acc[fw] = [];\n }\n acc[fw].push(p);\n return acc;\n },\n {} as Record<string, typeof result.modelProviders>,\n );\n\n console.log(chalk.bold(`${title}:`));\n console.log();\n\n for (const [framework, providers] of Object.entries(byFramework)) {\n console.log(` ${chalk.cyan(framework)}:`);\n for (const provider of providers) {\n console.log(` ${provider.type}`);\n console.log(chalk.dim(` ID: ${provider.id}`));\n console.log(\n chalk.dim(\n ` Updated: ${new Date(provider.updatedAt).toLocaleString()}`,\n ),\n );\n }\n console.log();\n }\n\n console.log(\n chalk.dim(`Total: ${result.modelProviders.length} provider(s)`),\n );\n }),\n );\n}\n\nexport const listCommand = createListCommand();\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport prompts from \"prompts\";\nimport {\n listZeroOrgModelProviders,\n upsertZeroOrgModelProvider,\n} from \"../../../../lib/api\";\nimport {\n MODEL_PROVIDER_TYPES,\n hasAuthMethods,\n getSelectableProviderTypes,\n type ModelProviderType,\n} from \"@vm0/api-contracts/contracts/model-providers\";\nimport { isInteractive } from \"../../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../../lib/command\";\nimport {\n type SetupInput,\n handleNonInteractiveMode,\n promptForAuthMethod,\n promptForSecrets,\n collectSecrets,\n} from \"../../../../lib/domain/model-provider/shared\";\n\ninterface CreateSetupCommandOptions {\n commandPrefix?: string;\n description?: string;\n scopeLabel?: string;\n}\n\nasync function handleInteractiveMode(\n commandPrefix: string,\n): Promise<SetupInput | null> {\n if (!isInteractive()) {\n throw new Error(\"Interactive mode requires a TTY\", {\n cause: new Error(\n `Use non-interactive mode: ${commandPrefix} --type <type> --secret \"<value>\"`,\n ),\n });\n }\n\n let cancelled = false;\n const onCancel = () => {\n cancelled = true;\n return false;\n };\n\n // Fetch configured org providers to annotate choices\n const { modelProviders: configuredProviders } =\n await listZeroOrgModelProviders();\n const configuredTypes = new Set(\n configuredProviders.map((p) => {\n return p.type;\n }),\n );\n\n // Build provider choices with configuration status (only selectable providers)\n const annotatedChoices = getSelectableProviderTypes().map((type) => {\n const config = MODEL_PROVIDER_TYPES[type];\n const isConfigured = configuredTypes.has(type);\n const isExperimental = hasAuthMethods(type);\n let title: string = config.label;\n if (isConfigured) {\n title = `${title} ✓`;\n }\n if (isExperimental) {\n title = `${title} ${chalk.dim(\"(experimental)\")}`;\n }\n return {\n title,\n value: type,\n };\n });\n\n const typeResponse = await prompts(\n {\n type: \"select\",\n name: \"type\",\n message: \"Select provider type:\",\n choices: annotatedChoices,\n },\n { onCancel },\n );\n\n if (cancelled) {\n console.log(chalk.dim(\"Cancelled\"));\n return null;\n }\n\n const type = typeResponse.type as ModelProviderType;\n\n // Check if provider is already configured using the list we already fetched\n const existingProvider = configuredProviders.find((p) => {\n return p.type === type;\n });\n\n if (existingProvider) {\n console.log();\n console.log(`\"${type}\" is already configured`);\n console.log();\n\n const actionResponse = await prompts(\n {\n type: \"select\",\n name: \"action\",\n message: \"\",\n choices: [\n { title: \"Keep existing secret\", value: \"keep\" },\n { title: \"Update secret\", value: \"update\" },\n ],\n },\n { onCancel },\n );\n\n if (cancelled) {\n console.log(chalk.dim(\"Cancelled\"));\n return null;\n }\n\n if (actionResponse.action === \"keep\") {\n return {\n type,\n keepExistingSecret: true,\n isInteractiveMode: true,\n };\n }\n // Fall through to secret prompt for \"update\"\n }\n\n const config = MODEL_PROVIDER_TYPES[type];\n\n console.log();\n if (\"helpText\" in config) {\n console.log(chalk.dim(config.helpText));\n }\n console.log();\n\n // Handle multi-auth providers\n if (hasAuthMethods(type)) {\n const authMethod = await promptForAuthMethod(type);\n const secrets = await promptForSecrets(type, authMethod);\n\n return {\n type,\n authMethod,\n secrets,\n isInteractiveMode: true,\n };\n }\n\n // Single-secret provider (legacy)\n const secretLabel = \"secretLabel\" in config ? config.secretLabel : \"secret\";\n\n const secretResponse = await prompts(\n {\n type: \"password\",\n name: \"secret\",\n message: `Enter your ${secretLabel}:`,\n validate: (value: string) => {\n return value.length > 0 || `${secretLabel} is required`;\n },\n },\n { onCancel },\n );\n\n if (cancelled) {\n console.log(chalk.dim(\"Cancelled\"));\n return null;\n }\n\n const secret = secretResponse.secret as string;\n\n return { type, secret, isInteractiveMode: true };\n}\n\nexport function createSetupCommand(\n options: CreateSetupCommandOptions = {},\n): Command {\n const commandPrefix =\n options.commandPrefix ?? \"zero org model-provider setup\";\n const description =\n options.description ?? \"Configure an org-level model provider\";\n const scopeLabel = options.scopeLabel ?? \"Org\";\n\n return new Command()\n .name(\"setup\")\n .description(description)\n .option(\"-t, --type <type>\", \"Provider type (for non-interactive mode)\")\n .option(\n \"-s, --secret <value>\",\n \"Secret value (can be used multiple times, supports VALUE or KEY=VALUE format)\",\n collectSecrets,\n [],\n )\n .option(\n \"-a, --auth-method <method>\",\n \"Auth method (required for multi-auth providers like aws-bedrock)\",\n )\n .action(\n withErrorHandler(\n async (options: {\n type?: string;\n secret?: string[];\n authMethod?: string;\n }) => {\n let input: SetupInput;\n const secretArgs = options.secret ?? [];\n\n if (options.type && secretArgs.length > 0) {\n input = handleNonInteractiveMode({\n type: options.type,\n secret: secretArgs,\n authMethod: options.authMethod,\n commandPrefix,\n });\n } else if (options.type || secretArgs.length > 0) {\n throw new Error(\"Both --type and --secret are required\");\n } else {\n const result = await handleInteractiveMode(commandPrefix);\n if (result === null) {\n return;\n }\n input = result;\n }\n\n // Handle \"keep existing secret\" flow\n if (input.keepExistingSecret) {\n console.log(\n chalk.green(\n `✓ ${scopeLabel} model provider \"${input.type}\" unchanged`,\n ),\n );\n return;\n }\n\n // Standard upsert flow with secret\n const { created } = await upsertZeroOrgModelProvider({\n type: input.type,\n secret: input.secret,\n authMethod: input.authMethod,\n secrets: input.secrets,\n });\n\n const action = created ? \"created\" : \"updated\";\n console.log(\n chalk.green(\n `✓ ${scopeLabel} model provider \"${input.type}\" ${action}`,\n ),\n );\n },\n ),\n );\n}\n\nexport const setupCommand = createSetupCommand();\n","import chalk from \"chalk\";\nimport prompts from \"prompts\";\nimport {\n MODEL_PROVIDER_TYPES,\n hasAuthMethods,\n getAuthMethodsForType,\n getDefaultAuthMethod,\n getSecretsForAuthMethod,\n type ModelProviderType,\n} from \"@vm0/api-contracts/contracts/model-providers\";\n\nexport interface SetupInput {\n type: ModelProviderType;\n secret?: string;\n // Multi-auth support\n authMethod?: string;\n secrets?: Record<string, string>;\n keepExistingSecret?: boolean;\n isInteractiveMode?: boolean;\n}\n\nfunction validateProviderType(typeStr: string): ModelProviderType {\n if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {\n const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(\", \");\n throw new Error(`Invalid type \"${typeStr}\"`, {\n cause: new Error(`Valid types: ${validTypes}`),\n });\n }\n return typeStr as ModelProviderType;\n}\n\nfunction validateAuthMethod(\n type: ModelProviderType,\n authMethodStr: string,\n): string | never {\n const authMethods = getAuthMethodsForType(type);\n if (!authMethods || !(authMethodStr in authMethods)) {\n const validMethods = authMethods\n ? Object.keys(authMethods).join(\", \")\n : \"none\";\n throw new Error(`Invalid auth method \"${authMethodStr}\"`, {\n cause: new Error(`Valid auth methods: ${validMethods}`),\n });\n }\n return authMethodStr;\n}\n\n/**\n * Parse secret arguments into a secrets object.\n * Supports two formats:\n * - Single value (e.g., \"sk-xxx\") - auto-mapped to the provider's secret name\n * - KEY=VALUE format (e.g., \"AWS_REGION=us-east-1\") - explicit mapping\n */\nfunction parseSecrets(\n type: ModelProviderType,\n authMethod: string,\n secretArgs: string[],\n): Record<string, string> {\n const secretsConfig = getSecretsForAuthMethod(type, authMethod);\n if (!secretsConfig) {\n throw new Error(`Invalid auth method \"${authMethod}\"`);\n }\n\n const secretNames = Object.keys(secretsConfig);\n\n // Single value without = sign: only allowed for single-secret auth methods\n const firstArg = secretArgs[0];\n if (secretArgs.length === 1 && firstArg && !firstArg.includes(\"=\")) {\n if (secretNames.length !== 1) {\n throw new Error(\n \"Must use KEY=VALUE format for multi-secret auth methods\",\n { cause: new Error(`Required secrets: ${secretNames.join(\", \")}`) },\n );\n }\n const firstSecretName = secretNames[0];\n if (!firstSecretName) {\n throw new Error(\"No secrets defined for this auth method\");\n }\n return { [firstSecretName]: firstArg };\n }\n\n // KEY=VALUE format\n const secrets: Record<string, string> = {};\n for (const arg of secretArgs) {\n const eqIndex = arg.indexOf(\"=\");\n if (eqIndex === -1) {\n throw new Error(`Invalid secret format \"${arg}\"`, {\n cause: new Error(\"Use KEY=VALUE format (e.g., AWS_REGION=us-east-1)\"),\n });\n }\n const key = arg.slice(0, eqIndex);\n const value = arg.slice(eqIndex + 1);\n secrets[key] = value;\n }\n return secrets;\n}\n\n/**\n * Validate secrets against the auth method config.\n */\nfunction validateSecrets(\n type: ModelProviderType,\n authMethod: string,\n secrets: Record<string, string>,\n): void {\n const secretsConfig = getSecretsForAuthMethod(type, authMethod);\n if (!secretsConfig) {\n throw new Error(`Invalid auth method \"${authMethod}\"`);\n }\n\n // Check required fields\n for (const [name, fieldConfig] of Object.entries(secretsConfig)) {\n if (fieldConfig.required && !secrets[name]) {\n const requiredNames = Object.entries(secretsConfig)\n .filter(([, fc]) => {\n return fc.required;\n })\n .map(([n]) => {\n return n;\n })\n .join(\", \");\n throw new Error(`Missing required secret: ${name}`, {\n cause: new Error(`Required secrets: ${requiredNames}`),\n });\n }\n }\n\n // Check for unknown fields\n for (const name of Object.keys(secrets)) {\n if (!(name in secretsConfig)) {\n const validNames = Object.keys(secretsConfig).join(\", \");\n throw new Error(`Unknown secret: ${name}`, {\n cause: new Error(`Valid secrets: ${validNames}`),\n });\n }\n }\n}\n\nexport function handleNonInteractiveMode(options: {\n type: string;\n secret: string[];\n authMethod?: string;\n commandPrefix?: string;\n}): SetupInput {\n const type = validateProviderType(options.type);\n const cmdPrefix = options.commandPrefix ?? \"zero org model-provider setup\";\n\n // Handle multi-auth providers\n if (hasAuthMethods(type)) {\n // Determine auth method\n let authMethod: string;\n if (options.authMethod) {\n authMethod = validateAuthMethod(type, options.authMethod);\n } else {\n const defaultAuthMethod = getDefaultAuthMethod(type);\n const authMethods = getAuthMethodsForType(type);\n if (!defaultAuthMethod || !authMethods) {\n throw new Error(`Provider \"${type}\" requires --auth-method`);\n }\n // If there's only one auth method, use it; otherwise require explicit selection\n const authMethodNames = Object.keys(authMethods);\n if (authMethodNames.length === 1) {\n authMethod = authMethodNames[0]!;\n } else {\n const methods = authMethodNames.join(\", \");\n throw new Error(\n `--auth-method is required for \"${type}\" (multiple auth methods available)`,\n {\n cause: new Error(\n `Available: ${methods}. Example: ${cmdPrefix} --type ${type} --auth-method ${authMethodNames[0]} --secret KEY=VALUE`,\n ),\n },\n );\n }\n }\n\n // Parse and validate secrets\n const secrets = parseSecrets(type, authMethod, options.secret);\n validateSecrets(type, authMethod, secrets);\n\n return {\n type,\n authMethod,\n secrets,\n isInteractiveMode: false,\n };\n }\n\n // Single-secret provider (legacy)\n // Accept single value or KEY=VALUE format\n const secretArgs = options.secret;\n const firstArg = secretArgs[0];\n if (!firstArg) {\n throw new Error(\"Secret is required\");\n }\n\n // If KEY=VALUE format, extract the value\n let secret: string;\n if (firstArg.includes(\"=\")) {\n secret = firstArg.slice(firstArg.indexOf(\"=\") + 1);\n } else {\n secret = firstArg;\n }\n\n return {\n type,\n secret,\n isInteractiveMode: false,\n };\n}\n\n/**\n * Prompt for auth method selection (only for multi-auth providers)\n */\nexport async function promptForAuthMethod(\n type: ModelProviderType,\n): Promise<string> {\n const authMethods = getAuthMethodsForType(type);\n const defaultAuthMethod = getDefaultAuthMethod(type);\n\n if (!authMethods) {\n return \"default\";\n }\n\n const choices = Object.entries(authMethods).map(([method, config]) => {\n return {\n title:\n method === defaultAuthMethod\n ? `${config.label} (Recommended)`\n : config.label,\n value: method,\n };\n });\n\n const response = await prompts(\n {\n type: \"select\",\n name: \"authMethod\",\n message: \"Select authentication method:\",\n choices,\n },\n {\n onCancel: () => {\n return process.exit(0);\n },\n },\n );\n\n return response.authMethod as string;\n}\n\n/**\n * Determine if a secret should be masked (password type)\n * Non-secret values like region should be visible\n */\nfunction isSensitiveSecret(name: string): boolean {\n const nonSecretPatterns = [\"REGION\", \"ENDPOINT\", \"URL\"];\n return !nonSecretPatterns.some((pattern) => {\n return name.toUpperCase().includes(pattern);\n });\n}\n\nexport async function promptForSecrets(\n type: ModelProviderType,\n authMethod: string,\n): Promise<Record<string, string>> {\n const secretsConfig = getSecretsForAuthMethod(type, authMethod);\n\n if (!secretsConfig) {\n throw new Error(`Invalid auth method \"${authMethod}\"`);\n }\n\n const secrets: Record<string, string> = {};\n\n for (const [name, fieldConfig] of Object.entries(secretsConfig)) {\n if (fieldConfig.helpText) {\n console.log(chalk.dim(fieldConfig.helpText));\n }\n\n const isSensitive = isSensitiveSecret(name);\n const placeholder =\n \"placeholder\" in fieldConfig ? (fieldConfig.placeholder as string) : \"\";\n\n if (fieldConfig.required) {\n const response = await prompts(\n {\n type: isSensitive ? \"password\" : \"text\",\n name: \"value\",\n message: `${fieldConfig.label}:`,\n initial: placeholder ? \"\" : undefined,\n validate: (value: string) => {\n return value.length > 0 || `${fieldConfig.label} is required`;\n },\n },\n {\n onCancel: () => {\n return process.exit(0);\n },\n },\n );\n secrets[name] = response.value as string;\n } else {\n // Optional field\n const response = await prompts(\n {\n type: isSensitive ? \"password\" : \"text\",\n name: \"value\",\n message: `${fieldConfig.label} (optional):`,\n },\n {\n onCancel: () => {\n return process.exit(0);\n },\n },\n );\n const value = response.value as string;\n if (value && value.trim()) {\n secrets[name] = value.trim();\n }\n }\n }\n\n return secrets;\n}\n\n/**\n * Collect secret values from repeatable --secret option\n */\nexport function collectSecrets(value: string, previous: string[]): string[] {\n return previous.concat([value]);\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { deleteZeroOrgModelProvider } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\nimport {\n MODEL_PROVIDER_TYPES,\n type ModelProviderType,\n} from \"@vm0/api-contracts/contracts/model-providers\";\n\ninterface CreateRemoveCommandOptions {\n scopeLabel?: string;\n}\n\nexport function createRemoveCommand(\n options: CreateRemoveCommandOptions = {},\n): Command {\n const scopeLabel = options.scopeLabel ?? \"Org\";\n\n return new Command()\n .name(\"remove\")\n .description(`Remove a ${scopeLabel.toLowerCase()} model provider`)\n .argument(\"<type>\", \"Model provider type to remove\")\n .action(\n withErrorHandler(async (type: string) => {\n if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {\n const validTypes = Object.keys(MODEL_PROVIDER_TYPES).join(\", \");\n throw new Error(`Invalid type \"${type}\"`, {\n cause: new Error(`Valid types: ${validTypes}`),\n });\n }\n\n await deleteZeroOrgModelProvider(type as ModelProviderType);\n console.log(\n chalk.green(`✓ ${scopeLabel} model provider \"${type}\" removed`),\n );\n }),\n );\n}\n\nexport const removeCommand = createRemoveCommand();\n","import { Command } from \"commander\";\nimport { createCommand } from \"./create\";\nimport { editCommand } from \"./edit\";\nimport { viewCommand } from \"./view\";\nimport { listCommand } from \"./list\";\nimport { deleteCommand } from \"./delete\";\n\nexport const zeroAgentCommand = new Command(\"agent\")\n .description(\"View or manage zero agents\")\n .addCommand(createCommand)\n .addCommand(editCommand)\n .addCommand(viewCommand)\n .addCommand(listCommand)\n .addCommand(deleteCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Your agent ID is in $ZERO_AGENT_ID (or run: zero whoami)\n View your config: zero agent view $ZERO_AGENT_ID --instructions\n Update description: zero agent edit $ZERO_AGENT_ID --description \"new role\"\n Update tone: zero agent edit $ZERO_AGENT_ID --sound friendly\n Update instructions: zero agent edit $ZERO_AGENT_ID --instructions-file <path>\n Add a custom skill: zero agent edit $ZERO_AGENT_ID --add-skill my-skill\n Remove a skill: zero agent edit $ZERO_AGENT_ID --remove-skill my-skill\n\nNotes:\n Manage custom skills with 'zero skill --help'`,\n );\n","import { Command } from \"commander\";\nimport { readFileSync } from \"node:fs\";\nimport chalk from \"chalk\";\nimport { zeroAgentCustomSkillNameSchema } from \"@vm0/api-contracts/contracts/zero-agents\";\nimport { createZeroAgent, updateZeroAgentInstructions } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolveAvatarUrl } from \"./avatar\";\n\nexport const createCommand = new Command()\n .name(\"create\")\n .description(\"Create a new zero agent\")\n .option(\n \"--skills <items>\",\n \"Comma-separated custom skill names to attach (e.g. my-skill,other-skill)\",\n )\n .option(\"--display-name <name>\", \"Agent display name\")\n .option(\"--description <text>\", \"Agent description\")\n .option(\n \"--sound <tone>\",\n \"Agent tone: professional, friendly, direct, supportive\",\n )\n .option(\"--avatar <preset>\", \"Avatar preset: preset:0 through preset:4\")\n .option(\n \"--avatar-rotation <1-5>\",\n \"Head angle: 1=far-left 3=center 5=far-right\",\n )\n .option(\n \"--avatar-skin <tone>\",\n \"Skin tone: light | light-medium | medium | medium-dark | dark\",\n )\n .option(\"--avatar-hair-style <1-5>\", \"Hair style: 1–5\")\n .option(\n \"--avatar-hair-color <color>\",\n \"Hair color: blonde | teal | grey | pink | brown\",\n )\n .option(\n \"--avatar-expression <expr>\",\n \"Expression: calm | content | neutral | pleasant | excited\",\n )\n .option(\"--avatar-intensity <level>\", \"Intensity: chill | normal | hyped\")\n .option(\"--instructions-file <path>\", \"Path to instructions file\")\n .addHelpText(\n \"after\",\n `\nAvatar:\n Quick presets (--avatar):\n preset:0 light skin, brown hair, calm, hyped\n preset:1 light-medium skin, grey hair, calm, normal\n preset:2 medium skin, pink hair, neutral, chill\n preset:3 medium-dark skin, blonde hair, pleasant, hyped\n preset:4 dark skin, teal hair, excited, normal\n\n Custom attributes (--avatar-* flags, omitted fields use defaults):\n --avatar-rotation 1=far-left 3=center(default) 5=far-right\n --avatar-skin light / light-medium / medium(default) / medium-dark / dark\n --avatar-hair-style 1–5 (default: 1)\n --avatar-hair-color blonde / teal / grey / pink / brown(default)\n --avatar-expression calm(default) / content / neutral / pleasant / excited\n --avatar-intensity chill / normal(default) / hyped\n\n Note: --avatar and --avatar-* cannot be used together.\n\nExamples:\n Minimal: zero agent create --display-name \"My Agent\"\n Quick preset: zero agent create --display-name \"My Agent\" --avatar preset:2\n Custom avatar: zero agent create --display-name \"My Agent\" --avatar-skin dark --avatar-hair-color teal --avatar-intensity hyped\n With skills: zero agent create --skills my-skill,other-skill --display-name \"My Agent\"\n With instructions: zero agent create --display-name \"My Agent\" --instructions-file ./instructions.md`,\n )\n .action(\n withErrorHandler(\n async (options: {\n skills?: string;\n displayName?: string;\n description?: string;\n sound?: string;\n avatar?: string;\n avatarRotation?: string;\n avatarSkin?: string;\n avatarHairStyle?: string;\n avatarHairColor?: string;\n avatarExpression?: string;\n avatarIntensity?: string;\n instructionsFile?: string;\n }) => {\n const customSkills = options.skills\n ? options.skills.split(\",\").map((s) => {\n return s.trim();\n })\n : undefined;\n\n if (customSkills) {\n for (const name of customSkills) {\n const result = zeroAgentCustomSkillNameSchema.safeParse(name);\n if (!result.success) {\n throw new Error(\n `Invalid skill name \"${name}\": must be 2-64 characters, lowercase alphanumeric and hyphens only (e.g. my-skill)`,\n );\n }\n }\n }\n\n const avatarUrl = resolveAvatarUrl(options);\n\n const agent = await createZeroAgent({\n displayName: options.displayName,\n description: options.description,\n sound: options.sound,\n avatarUrl,\n customSkills,\n });\n\n if (options.instructionsFile) {\n const content = readFileSync(options.instructionsFile, \"utf-8\");\n await updateZeroAgentInstructions(agent.agentId, content);\n }\n\n console.log(chalk.green(`✓ Agent \"${agent.agentId}\" created`));\n console.log(` Agent ID: ${agent.agentId}`);\n if (customSkills?.length) {\n console.log(` Skills: ${customSkills.join(\", \")}`);\n }\n if (agent.displayName) {\n console.log(` Display Name: ${agent.displayName}`);\n }\n\n console.log();\n console.log(\"Next steps to authorize connectors for this agent:\");\n console.log(\" - Search connectors this agent needs:\");\n console.log(\n ` zero connector search <keyword> --agent ${agent.agentId}`,\n );\n console.log(\n \" - Check authorization status (prints an authorize URL if not authorized):\",\n );\n console.log(\n ` zero connector status <type> --agent ${agent.agentId}`,\n );\n },\n ),\n );\n","const SKIN_MAP: Record<string, number> = {\n light: 0,\n \"light-medium\": 1,\n medium: 2,\n \"medium-dark\": 3,\n dark: 4,\n};\n\nconst HAIR_COLOR_MAP: Record<string, number> = {\n blonde: 1,\n teal: 2,\n grey: 3,\n pink: 4,\n brown: 5,\n};\n\nconst EXPRESSION_MAP: Record<string, number> = {\n calm: 1,\n content: 2,\n neutral: 3,\n pleasant: 4,\n excited: 5,\n};\n\nconst INTENSITY_MAP: Record<string, \"d\" | \"m\" | \"h\"> = {\n chill: \"d\",\n normal: \"m\",\n hyped: \"h\",\n};\n\nfunction lookupRequired<T>(\n value: string,\n map: Readonly<Record<string, T>>,\n flag: string,\n): T {\n if (!(value in map)) {\n throw new Error(\n `Invalid ${flag} \"${value}\". Must be one of: ${Object.keys(map).join(\", \")}`,\n );\n }\n return map[value]!;\n}\n\nfunction parseIntRange(\n value: string,\n flag: string,\n min: number,\n max: number,\n): number {\n const n = Number(value);\n if (!Number.isInteger(n) || n < min || n > max) {\n throw new Error(`Invalid ${flag} \"${value}\". Must be ${min}–${max}`);\n }\n return n;\n}\n\nfunction buildCustomSvgAvatar(opts: AvatarOptions): string {\n const r =\n opts.avatarRotation !== undefined\n ? parseIntRange(opts.avatarRotation, \"--avatar-rotation\", 1, 5)\n : 3;\n const h =\n opts.avatarHairStyle !== undefined\n ? parseIntRange(opts.avatarHairStyle, \"--avatar-hair-style\", 1, 5)\n : 1;\n const s =\n opts.avatarSkin !== undefined\n ? lookupRequired(opts.avatarSkin, SKIN_MAP, \"--avatar-skin\")\n : 2;\n const c =\n opts.avatarHairColor !== undefined\n ? lookupRequired(\n opts.avatarHairColor,\n HAIR_COLOR_MAP,\n \"--avatar-hair-color\",\n )\n : 5;\n const f =\n opts.avatarExpression !== undefined\n ? lookupRequired(\n opts.avatarExpression,\n EXPRESSION_MAP,\n \"--avatar-expression\",\n )\n : 1;\n const i =\n opts.avatarIntensity !== undefined\n ? lookupRequired(\n opts.avatarIntensity,\n INTENSITY_MAP,\n \"--avatar-intensity\",\n )\n : \"m\";\n return `svg:r${r}s${s}h${h}c${c}f${f}${i}`;\n}\n\nexport interface AvatarOptions {\n avatar?: string;\n avatarRotation?: string;\n avatarSkin?: string;\n avatarHairStyle?: string;\n avatarHairColor?: string;\n avatarExpression?: string;\n avatarIntensity?: string;\n}\n\nexport function resolveAvatarUrl(opts: AvatarOptions): string | undefined {\n const hasPreset = opts.avatar !== undefined;\n const hasCustom =\n opts.avatarRotation !== undefined ||\n opts.avatarSkin !== undefined ||\n opts.avatarHairStyle !== undefined ||\n opts.avatarHairColor !== undefined ||\n opts.avatarExpression !== undefined ||\n opts.avatarIntensity !== undefined;\n\n if (!hasPreset && !hasCustom) return undefined;\n\n if (hasPreset && hasCustom) {\n throw new Error(\n \"--avatar cannot be combined with --avatar-* attribute options\",\n );\n }\n\n if (hasPreset) {\n if (!/^preset:[0-4]$/.test(opts.avatar!)) {\n throw new Error(\n `Invalid --avatar \"${opts.avatar}\". Use preset:0 through preset:4`,\n );\n }\n return opts.avatar;\n }\n\n return buildCustomSvgAvatar(opts);\n}\n\nconst REVERSE_SKIN_MAP: Record<number, string> = {\n 0: \"light\",\n 1: \"light-medium\",\n 2: \"medium\",\n 3: \"medium-dark\",\n 4: \"dark\",\n};\n\nconst REVERSE_HAIR_COLOR_MAP: Record<number, string> = {\n 1: \"blonde\",\n 2: \"teal\",\n 3: \"grey\",\n 4: \"pink\",\n 5: \"brown\",\n};\n\nconst REVERSE_EXPRESSION_MAP: Record<number, string> = {\n 1: \"calm\",\n 2: \"content\",\n 3: \"neutral\",\n 4: \"pleasant\",\n 5: \"excited\",\n};\n\nconst REVERSE_INTENSITY_MAP: Record<string, string> = {\n d: \"chill\",\n m: \"normal\",\n h: \"hyped\",\n};\n\nconst PRESET_DESCRIPTIONS: Record<string, string> = {\n \"preset:0\": \"light skin, brown hair, calm, hyped\",\n \"preset:1\": \"light-medium skin, grey hair, calm, normal\",\n \"preset:2\": \"medium skin, pink hair, neutral, chill\",\n \"preset:3\": \"medium-dark skin, blonde hair, pleasant, hyped\",\n \"preset:4\": \"dark skin, teal hair, excited, normal\",\n};\n\nfunction parseSvgAvatar(svg: string): string | undefined {\n const match = svg.match(/^svg:r(\\d)s(\\d)h(\\d)c(\\d)f(\\d)([dmh])$/);\n if (!match) return undefined;\n\n const [, r, s, h, c, f, i] = match as RegExpExecArray;\n const parts: string[] = [];\n\n const skin = REVERSE_SKIN_MAP[Number(s)];\n if (skin) parts.push(`${skin} skin`);\n\n const hairColor = REVERSE_HAIR_COLOR_MAP[Number(c)];\n if (hairColor) parts.push(`${hairColor} hair`);\n\n const expression = REVERSE_EXPRESSION_MAP[Number(f)];\n if (expression) parts.push(expression);\n\n const intensity = REVERSE_INTENSITY_MAP[i!];\n if (intensity) parts.push(intensity);\n\n if (parts.length === 0) return undefined;\n\n let desc = parts.join(\", \");\n if (r !== \"3\") {\n const rotationLabels: Record<string, string> = {\n \"1\": \"far-left\",\n \"2\": \"left\",\n \"4\": \"right\",\n \"5\": \"far-right\",\n };\n const rot = rotationLabels[r!];\n if (rot) desc += `, ${rot}`;\n }\n if (h !== \"1\") {\n desc += `, hair style ${h}`;\n }\n\n return desc;\n}\n\nexport function formatAvatar(\n avatarUrl: string | null | undefined,\n): string | undefined {\n if (!avatarUrl) return undefined;\n\n if (avatarUrl.startsWith(\"preset:\")) {\n const desc = PRESET_DESCRIPTIONS[avatarUrl];\n return desc ? `${avatarUrl} (${desc})` : avatarUrl;\n }\n\n if (avatarUrl.startsWith(\"svg:\")) {\n const desc = parseSvgAvatar(avatarUrl);\n return desc ? `custom (${desc})` : avatarUrl;\n }\n\n return avatarUrl;\n}\n","import { Command } from \"commander\";\nimport { readFileSync } from \"node:fs\";\nimport chalk from \"chalk\";\nimport { zeroAgentCustomSkillNameSchema } from \"@vm0/api-contracts/contracts/zero-agents\";\nimport {\n getZeroAgent,\n updateZeroAgent,\n updateZeroAgentInstructions,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { type AvatarOptions, resolveAvatarUrl } from \"./avatar\";\n\ninterface AgentEditOptions extends AvatarOptions {\n displayName?: string;\n description?: string;\n sound?: string;\n skills?: string;\n addSkill?: string;\n removeSkill?: string;\n instructionsFile?: string;\n}\n\nfunction hasAvatarUpdate(options: AvatarOptions): boolean {\n return (\n options.avatar !== undefined ||\n options.avatarRotation !== undefined ||\n options.avatarSkin !== undefined ||\n options.avatarHairStyle !== undefined ||\n options.avatarHairColor !== undefined ||\n options.avatarExpression !== undefined ||\n options.avatarIntensity !== undefined\n );\n}\n\nfunction hasAgentFieldUpdate(options: AgentEditOptions): boolean {\n return (\n options.displayName !== undefined ||\n options.description !== undefined ||\n options.sound !== undefined ||\n hasAvatarUpdate(options) ||\n options.skills !== undefined ||\n options.addSkill !== undefined ||\n options.removeSkill !== undefined\n );\n}\n\nasync function applyAgentUpdate(\n agentId: string,\n options: AgentEditOptions,\n): Promise<void> {\n const hasAvatar = hasAvatarUpdate(options);\n const resolvedAvatarUrl = hasAvatar ? resolveAvatarUrl(options) : undefined;\n\n const current = await getZeroAgent(agentId);\n const customSkills = resolveCustomSkills(options, current.customSkills ?? []);\n\n const avatarUrl = hasAvatar\n ? resolvedAvatarUrl\n : (current.avatarUrl ?? undefined);\n\n await updateZeroAgent(agentId, {\n displayName:\n options.displayName !== undefined\n ? options.displayName\n : (current.displayName ?? undefined),\n description:\n options.description !== undefined\n ? options.description\n : (current.description ?? undefined),\n sound:\n options.sound !== undefined\n ? options.sound\n : (current.sound ?? undefined),\n avatarUrl,\n customSkills,\n });\n}\n\nfunction validateSkillName(name: string): void {\n const result = zeroAgentCustomSkillNameSchema.safeParse(name);\n if (!result.success) {\n throw new Error(\n `Invalid skill name \"${name}\": must be 2-64 characters, lowercase alphanumeric and hyphens only (e.g. my-skill)`,\n );\n }\n}\n\nfunction resolveCustomSkills(\n options: { skills?: string; addSkill?: string; removeSkill?: string },\n existing: string[],\n): string[] | undefined {\n if (options.skills && (options.addSkill || options.removeSkill)) {\n throw new Error(\"Cannot use --skills with --add-skill or --remove-skill\");\n }\n\n if (options.skills) {\n const names = options.skills.split(\",\").map((s) => {\n return s.trim();\n });\n for (const name of names) {\n validateSkillName(name);\n }\n return names;\n }\n\n if (options.addSkill) {\n validateSkillName(options.addSkill);\n if (existing.includes(options.addSkill)) {\n throw new Error(\n `Skill \"${options.addSkill}\" is already attached to this agent`,\n );\n }\n return [...existing, options.addSkill];\n }\n\n if (options.removeSkill) {\n if (!existing.includes(options.removeSkill)) {\n throw new Error(\n `Skill \"${options.removeSkill}\" is not attached to this agent`,\n );\n }\n return existing.filter((s) => {\n return s !== options.removeSkill;\n });\n }\n\n return undefined;\n}\n\nexport const editCommand = new Command()\n .name(\"edit\")\n .description(\"Edit a zero agent\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\"--display-name <name>\", \"New display name\")\n .option(\"--description <text>\", \"New description\")\n .option(\n \"--sound <tone>\",\n \"New tone: professional, friendly, direct, supportive\",\n )\n .option(\"--avatar <preset>\", \"Avatar preset: preset:0 through preset:4\")\n .option(\n \"--avatar-rotation <1-5>\",\n \"Head angle: 1=far-left 3=center 5=far-right\",\n )\n .option(\n \"--avatar-skin <tone>\",\n \"Skin tone: light | light-medium | medium | medium-dark | dark\",\n )\n .option(\"--avatar-hair-style <1-5>\", \"Hair style: 1–5\")\n .option(\n \"--avatar-hair-color <color>\",\n \"Hair color: blonde | teal | grey | pink | brown\",\n )\n .option(\n \"--avatar-expression <expr>\",\n \"Expression: calm | content | neutral | pleasant | excited\",\n )\n .option(\"--avatar-intensity <level>\", \"Intensity: chill | normal | hyped\")\n .option(\n \"--skills <items>\",\n \"Comma-separated custom skill names to attach (replaces existing)\",\n )\n .option(\"--add-skill <name>\", \"Add a custom skill to the agent\")\n .option(\"--remove-skill <name>\", \"Remove a custom skill from the agent\")\n .option(\"--instructions-file <path>\", \"Path to new instructions file\")\n .addHelpText(\n \"after\",\n `\nAvatar:\n Quick presets (--avatar):\n preset:0 light skin, brown hair, calm, hyped\n preset:1 light-medium skin, grey hair, calm, normal\n preset:2 medium skin, pink hair, neutral, chill\n preset:3 medium-dark skin, blonde hair, pleasant, hyped\n preset:4 dark skin, teal hair, excited, normal\n\n Custom attributes (--avatar-* flags, replace the entire avatar):\n --avatar-rotation 1=far-left 3=center(default) 5=far-right\n --avatar-skin light / light-medium / medium(default) / medium-dark / dark\n --avatar-hair-style 1–5 (default: 1)\n --avatar-hair-color blonde / teal / grey / pink / brown(default)\n --avatar-expression calm(default) / content / neutral / pleasant / excited\n --avatar-intensity chill / normal(default) / hyped\n\n Note: --avatar and --avatar-* cannot be used together.\n\nExamples:\n Update description: zero agent edit <agent-id> --description \"new role\"\n Update tone: zero agent edit <agent-id> --sound friendly\n Quick preset avatar: zero agent edit <agent-id> --avatar preset:2\n Custom avatar: zero agent edit <agent-id> --avatar-skin dark --avatar-hair-color teal --avatar-intensity hyped\n Replace all skills: zero agent edit <agent-id> --skills my-skill,other-skill\n Add a skill: zero agent edit <agent-id> --add-skill my-skill\n Remove a skill: zero agent edit <agent-id> --remove-skill my-skill\n Update instructions: zero agent edit <agent-id> --instructions-file ./instructions.md\n Update yourself: zero agent edit $ZERO_AGENT_ID --description \"new role\"\n\nNotes:\n - At least one option is required\n - Unspecified fields are preserved (not cleared)\n - --skills replaces the entire skill list; --add-skill/--remove-skill modify incrementally\n - --skills cannot be combined with --add-skill or --remove-skill\n - To create or edit skill content, use: zero skill --help`,\n )\n .action(\n withErrorHandler(async (agentId: string, options: AgentEditOptions) => {\n const hasAgentUpdate = hasAgentFieldUpdate(options);\n\n if (!hasAgentUpdate && !options.instructionsFile) {\n throw new Error(\n \"At least one option is required (--display-name, --description, --sound, --avatar, --avatar-*, --skills, --add-skill, --remove-skill, --instructions-file)\",\n );\n }\n\n if (hasAgentUpdate) {\n await applyAgentUpdate(agentId, options);\n }\n\n if (options.instructionsFile) {\n const content = readFileSync(options.instructionsFile, \"utf-8\");\n await updateZeroAgentInstructions(agentId, content);\n }\n\n console.log(chalk.green(`✓ Agent \"${agentId}\" updated`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n getZeroAgent,\n getZeroAgentInstructions,\n getZeroAgentUserConnectors,\n listZeroConnectors,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport {\n isFirewallConnectorType,\n getConnectorFirewall,\n resolveFirewallPolicies,\n} from \"@vm0/connectors/firewalls\";\nimport type {\n FirewallPolicies,\n FirewallPolicyValue,\n} from \"@vm0/connectors/firewall-types\";\nimport type { ConnectorResponse } from \"@vm0/api-contracts/contracts/connector-schemas\";\nimport { policyIcon } from \"../../../lib/utils/format-utils\";\nimport { formatAvatar } from \"./avatar\";\n\ninterface ConnectorPermissionInfo {\n type: string;\n hasPermissions: boolean;\n permissions: Array<{ name: string; description?: string }>;\n policies: Record<string, FirewallPolicyValue> | null;\n unknownPolicy: FirewallPolicyValue;\n allowed: number;\n total: number;\n}\n\nfunction getConnectorPermissionInfo(\n type: string,\n resolvedPolicies: FirewallPolicies | null,\n): ConnectorPermissionInfo {\n if (!isFirewallConnectorType(type)) {\n return {\n type,\n hasPermissions: false,\n permissions: [],\n policies: null,\n unknownPolicy: \"allow\",\n allowed: 0,\n total: 0,\n };\n }\n\n const refPolicy = resolvedPolicies?.[type];\n const policies =\n refPolicy && Object.keys(refPolicy.policies).length > 0\n ? refPolicy.policies\n : null;\n const config = getConnectorFirewall(type);\n const permissions = config.apis.flatMap((a) => {\n return a.permissions ?? [];\n });\n const total = permissions.length;\n const allowed = policies\n ? permissions.filter((p) => {\n return policies[p.name] === \"allow\";\n }).length\n : 0;\n\n const unknownPolicy = refPolicy?.unknownPolicy ?? \"allow\";\n return {\n type,\n hasPermissions: true,\n permissions,\n policies,\n unknownPolicy,\n allowed,\n total,\n };\n}\n\nfunction printDetailedPermissions(info: ConnectorPermissionInfo): void {\n if (!info.policies) {\n const icon = policyIcon(info.unknownPolicy);\n console.log(` ${icon} unknown endpoints`);\n return;\n }\n\n const nameWidth = Math.max(\n \"unknown endpoints\".length,\n ...info.permissions.map((p) => {\n return p.name.length;\n }),\n );\n\n for (const perm of info.permissions) {\n const policy = info.policies[perm.name] ?? \"deny\";\n const desc = perm.description ?? \"\";\n console.log(\n ` ${policyIcon(policy)} ${perm.name.padEnd(nameWidth)} ${desc}`,\n );\n }\n\n const unknownIcon = policyIcon(info.unknownPolicy);\n console.log(\n ` ${unknownIcon} ${\"unknown endpoints\".padEnd(nameWidth)} Endpoints not matching any rule`,\n );\n}\n\nfunction formatConnectorIdentity(\n connector: ConnectorResponse | undefined,\n): string {\n if (!connector) return \"\";\n if (connector.externalUsername) return `@${connector.externalUsername}`;\n if (connector.externalEmail) return connector.externalEmail;\n return \"\";\n}\n\nfunction formatConnectorSummary(\n info: ConnectorPermissionInfo,\n identity?: ConnectorResponse,\n): string {\n const id = formatConnectorIdentity(identity);\n const idStr = id ? ` ${id}` : \"\";\n if (!info.hasPermissions) return `${info.type}${idStr}`;\n if (!info.policies) return `${info.type}${idStr} (full access)`;\n return `${info.type}${idStr} (${info.allowed}/${info.total} allowed)`;\n}\n\nfunction formatDetailIdentity(\n connector: ConnectorResponse | undefined,\n): string {\n if (!connector) return \"\";\n let identity = \"\";\n if (connector.externalUsername && connector.externalEmail) {\n identity = `@${connector.externalUsername} (${connector.externalEmail})`;\n } else if (connector.externalUsername) {\n identity = `@${connector.externalUsername}`;\n } else if (connector.externalEmail) {\n identity = connector.externalEmail;\n }\n if (!identity) return \"\";\n if (connector.needsReconnect) {\n identity += ` ${chalk.yellow(\"(needs reconnect)\")}`;\n }\n return identity;\n}\n\nexport const viewCommand = new Command()\n .name(\"view\")\n .description(\"View a zero agent\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\"--instructions\", \"Also show instructions content\")\n .option(\"--permissions\", \"Show full permission details for each connector\")\n .addHelpText(\n \"after\",\n `\nExamples:\n View basic info: zero agent view <agent-id>\n Include instructions: zero agent view <agent-id> --instructions\n Show permissions: zero agent view <agent-id> --permissions\n View yourself: zero agent view $ZERO_AGENT_ID --instructions`,\n )\n .action(\n withErrorHandler(\n async (\n agentId: string,\n options: { instructions?: boolean; permissions?: boolean },\n ) => {\n const [agent, connectorTypes, connectorIdentities] = await Promise.all([\n getZeroAgent(agentId),\n getZeroAgentUserConnectors(agentId),\n listZeroConnectors().catch(() => {\n return { connectors: [] as ConnectorResponse[] };\n }),\n ]);\n\n const identityMap = new Map<string, ConnectorResponse>(\n connectorIdentities.connectors.map((c) => {\n return [c.type, c];\n }),\n );\n\n console.log(chalk.bold(agent.agentId));\n if (agent.displayName) console.log(chalk.dim(agent.displayName));\n console.log();\n console.log(`Agent ID: ${agent.agentId}`);\n\n const resolvedPolicies = resolveFirewallPolicies(\n agent.permissionPolicies,\n connectorTypes,\n );\n\n const connectorInfos = connectorTypes.map((type) => {\n return getConnectorPermissionInfo(type, resolvedPolicies);\n });\n\n if (connectorInfos.length > 0) {\n const summaries = connectorInfos.map((info) => {\n return formatConnectorSummary(info, identityMap.get(info.type));\n });\n console.log(`Connectors: ${summaries.join(\", \")}`);\n }\n\n if (agent.customSkills?.length > 0) {\n console.log(`Skills: ${agent.customSkills.join(\", \")}`);\n }\n if (agent.description)\n console.log(`Description: ${agent.description}`);\n if (agent.sound) console.log(`Sound: ${agent.sound}`);\n const avatar = formatAvatar(agent.avatarUrl);\n if (avatar) console.log(`Avatar: ${avatar}`);\n\n if (options.permissions && connectorInfos.length > 0) {\n console.log();\n console.log(chalk.bold(\"Connectors:\"));\n for (const info of connectorInfos) {\n const identity = formatDetailIdentity(identityMap.get(info.type));\n console.log(` ${info.type.padEnd(14)}${identity}`);\n if (info.hasPermissions) {\n printDetailedPermissions(info);\n }\n }\n }\n\n if (options.instructions) {\n console.log();\n const result = await getZeroAgentInstructions(agentId);\n if (result.content) {\n console.log(chalk.dim(\"── Instructions ──\"));\n console.log(result.content);\n } else {\n console.log(chalk.dim(\"No instructions set\"));\n }\n }\n },\n ),\n );\n","import chalk from \"chalk\";\nimport type { FirewallPolicyValue } from \"@vm0/connectors/firewall-types\";\n\nexport function policyIcon(policy: FirewallPolicyValue): string {\n if (policy === \"allow\") return chalk.green(\"✓\");\n if (policy === \"ask\") return chalk.yellow(\"?\");\n return chalk.dim(\"✗\");\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroAgents } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List all zero agents\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero agent list\n\nNotes:\n - Use this to discover teammate agent IDs before delegating with \"zero run\"`,\n )\n .action(\n withErrorHandler(async () => {\n const agents = await listZeroAgents();\n\n if (agents.length === 0) {\n console.log(chalk.dim(\"No zero agents found\"));\n console.log(\n chalk.dim(\n ' Create one with: zero agent create --display-name \"My Agent\"',\n ),\n );\n return;\n }\n\n const idWidth = Math.max(\n 8,\n ...agents.map((a) => {\n return a.agentId.length;\n }),\n );\n const displayWidth = Math.max(\n 12,\n ...agents.map((a) => {\n return (a.displayName ?? \"\").length;\n }),\n );\n\n const header = [\n \"AGENT ID\".padEnd(idWidth),\n \"DISPLAY NAME\".padEnd(displayWidth),\n ].join(\" \");\n console.log(chalk.dim(header));\n\n for (const agent of agents) {\n const row = [\n agent.agentId.padEnd(idWidth),\n (agent.displayName ?? \"-\").padEnd(displayWidth),\n ].join(\" \");\n console.log(row);\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getZeroAgent, deleteZeroAgent } from \"../../../lib/api\";\nimport { isInteractive, promptConfirm } from \"../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const deleteCommand = new Command()\n .name(\"delete\")\n .alias(\"rm\")\n .description(\"Delete a zero agent\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero agent delete <agent-id>\n zero agent delete <agent-id> -y\n\nNotes:\n - Use -y to skip confirmation in non-interactive mode`,\n )\n .action(\n withErrorHandler(async (agentId: string, options: { yes?: boolean }) => {\n await getZeroAgent(agentId);\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 zero agent '${agentId}'?`,\n false,\n );\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteZeroAgent(agentId);\n console.log(chalk.green(`✓ Agent \"${agentId}\" deleted`));\n }),\n );\n","import { Command } from \"commander\";\nimport { connectCommand } from \"./connect\";\nimport { listCommand } from \"./list\";\nimport { searchCommand } from \"./search\";\nimport { statusCommand } from \"./status\";\n\nexport const zeroConnectorCommand = new Command()\n .name(\"connector\")\n .description(\"Check third-party service connections (GitHub, Slack, etc.)\")\n .addCommand(connectCommand)\n .addCommand(listCommand)\n .addCommand(searchCommand)\n .addCommand(statusCommand);\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n CONNECTOR_TYPE_KEYS,\n CONNECTOR_TYPES,\n connectorTypeSchema,\n type ConnectorAuthMethodId,\n type ConnectorType,\n} from \"@vm0/connectors/connectors\";\nimport {\n getConfiguredConnectorAuthMethods,\n getConnectorAuthMethod,\n} from \"@vm0/connectors/connector-utils\";\nimport { connectZeroConnectorManualGrant } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\ninterface ConnectOptions {\n readonly authMethod?: string;\n readonly value?: readonly string[];\n readonly json?: boolean;\n}\n\nfunction collectValue(value: string, previous: string[]): string[] {\n return [...previous, value];\n}\n\nfunction parseConnectorValues(rawValues: readonly string[] | undefined) {\n if (!rawValues || rawValues.length === 0) {\n throw new Error(\"At least one --value NAME=VALUE is required\", {\n cause: new Error(\n \"Example: zero connector connect zendesk --value ZENDESK_API_TOKEN=token\",\n ),\n });\n }\n\n const values: Record<string, string> = {};\n for (const rawValue of rawValues) {\n const separatorIndex = rawValue.indexOf(\"=\");\n if (separatorIndex <= 0) {\n throw new Error(\"Invalid --value format\", {\n cause: new Error(\"Use --value NAME=VALUE\"),\n });\n }\n\n const name = rawValue.slice(0, separatorIndex);\n if (!name.trim()) {\n throw new Error(\"Invalid --value format\", {\n cause: new Error(\"Field name cannot be empty\"),\n });\n }\n\n values[name] = rawValue.slice(separatorIndex + 1);\n }\n\n return values;\n}\n\nfunction parseConnectorType(type: string): ConnectorType {\n const parsed = connectorTypeSchema.safeParse(type);\n if (parsed.success) {\n return parsed.data;\n }\n\n throw new Error(`Unknown connector type: ${type}`, {\n cause: new Error(`Available connectors: ${CONNECTOR_TYPE_KEYS.join(\", \")}`),\n });\n}\n\nfunction parseConfiguredAuthMethod(\n type: ConnectorType,\n rawAuthMethod: string,\n): ConnectorAuthMethodId {\n const configuredAuthMethods = getConfiguredConnectorAuthMethods(type);\n const authMethod = configuredAuthMethods.find((method) => {\n return method === rawAuthMethod;\n });\n if (authMethod) {\n return authMethod;\n }\n\n throw new Error(\n `${type} connector does not have ${rawAuthMethod} auth method`,\n {\n cause: new Error(\n `Available auth methods: ${configuredAuthMethods.join(\", \")}`,\n ),\n },\n );\n}\n\nfunction getManualGrantAuthMethods(\n type: ConnectorType,\n): ConnectorAuthMethodId[] {\n return getConfiguredConnectorAuthMethods(type).filter((authMethod) => {\n return getConnectorAuthMethod(type, authMethod)?.grant.kind === \"manual\";\n });\n}\n\nfunction parseManualGrantAuthMethod(\n type: ConnectorType,\n rawAuthMethod: string | undefined,\n): ConnectorAuthMethodId {\n if (rawAuthMethod) {\n const authMethod = parseConfiguredAuthMethod(type, rawAuthMethod);\n if (getConnectorAuthMethod(type, authMethod)?.grant.kind === \"manual\") {\n return authMethod;\n }\n\n throw new Error(\n `${type} ${authMethod} auth method does not use a manual grant`,\n );\n }\n\n const authMethods = getManualGrantAuthMethods(type);\n const authMethod = authMethods[0];\n if (authMethods.length === 1 && authMethod) {\n return authMethod;\n }\n\n if (authMethods.length === 0) {\n throw new Error(`${type} connector does not use a manual grant`);\n }\n\n throw new Error(`${type} connector has multiple manual grant auth methods`, {\n cause: new Error(`Pass --auth-method ${authMethods.join(\"|\")}`),\n });\n}\n\nexport const connectCommand = new Command()\n .name(\"connect\")\n .description(\"Connect a connector with manual grant values\")\n .argument(\"<type>\", \"Connector type (e.g., zendesk)\")\n .option(\"--auth-method <method>\", \"Connector auth method to use\")\n .option(\n \"--value <name=value>\",\n \"Connector field value; repeat for multiple fields\",\n collectValue,\n [],\n )\n .option(\"--json\", \"Print the connector response as JSON\")\n .action(\n withErrorHandler(async (type: string, options: ConnectOptions) => {\n const connectorType = parseConnectorType(type);\n const authMethod = parseManualGrantAuthMethod(\n connectorType,\n options.authMethod,\n );\n const connector = await connectZeroConnectorManualGrant(\n connectorType,\n authMethod,\n parseConnectorValues(options.value),\n );\n\n if (options.json) {\n console.log(JSON.stringify(connector, null, 2));\n return;\n }\n\n console.log(\n chalk.green(`✓ ${CONNECTOR_TYPES[connectorType].label} connected`),\n );\n console.log(chalk.dim(` Type: ${connector.type}`));\n console.log(chalk.dim(` Auth Method: ${connector.authMethod}`));\n console.log(chalk.dim(` Run: zero connector status ${connector.type}`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n CONNECTOR_TYPES,\n type ConnectorType,\n} from \"@vm0/connectors/connectors\";\nimport { listZeroConnectors, searchZeroConnectors } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolveAgentContext } from \"./agent-context\";\nimport { padEndAnsi, renderConnectedAsCell, stripAnsi } from \"./connected-as\";\n\nfunction isConnectorType(type: string): type is ConnectorType {\n return type in CONNECTOR_TYPES;\n}\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List all connectors and their status\")\n .option(\"--agent <id>\", \"Show per-agent authorization column\")\n .action(\n withErrorHandler(async (options: { agent?: string }) => {\n const [{ connectors }, availableCatalog, agentCtx] = await Promise.all([\n listZeroConnectors(),\n searchZeroConnectors(),\n resolveAgentContext(options.agent),\n ]);\n const connectedMap = new Map(\n connectors.map((c) => {\n return [c.type, c];\n }),\n );\n\n const allTypes = availableCatalog.connectors\n .map((connector) => {\n return connector.id;\n })\n .filter(isConnectorType);\n\n const typeWidth = Math.max(\n 4,\n ...allTypes.map((t) => {\n return t.length;\n }),\n );\n\n const connectedAsHeader = \"CONNECTED AS\";\n const connectedCells = allTypes.map((type) => {\n return renderConnectedAsCell(connectedMap.get(type));\n });\n const connectedAsWidth = Math.max(\n connectedAsHeader.length,\n ...connectedCells.map((c) => {\n return stripAnsi(c).length;\n }),\n );\n\n const authorizedHeader = agentCtx\n ? `AUTHORIZED FOR ${agentCtx.displayName}`\n : null;\n\n // Print header\n const headerParts = [\n \"TYPE\".padEnd(typeWidth),\n connectedAsHeader.padEnd(connectedAsWidth),\n ];\n if (authorizedHeader) headerParts.push(authorizedHeader);\n console.log(chalk.dim(headerParts.join(\" \")));\n\n // Print rows\n for (let i = 0; i < allTypes.length; i++) {\n const type = allTypes[i]!;\n const connectedCell = padEndAnsi(connectedCells[i]!, connectedAsWidth);\n const parts = [type.padEnd(typeWidth), connectedCell];\n if (agentCtx) {\n parts.push(\n agentCtx.authorizedTypes.has(type)\n ? chalk.green(\"✓\")\n : chalk.dim(\"-\"),\n );\n }\n console.log(parts.join(\" \"));\n }\n }),\n );\n","import { getZeroAgent, getZeroAgentUserConnectors } from \"../../../lib/api\";\n\ninterface AgentContext {\n agentId: string;\n displayName: string;\n authorizedTypes: Set<string>;\n}\n\nexport async function resolveAgentContext(\n flagAgentId: string | undefined,\n): Promise<AgentContext | null> {\n const agentId = flagAgentId ?? process.env.ZERO_AGENT_ID;\n if (!agentId) return null;\n\n const [agent, enabledTypes] = await Promise.all([\n getZeroAgent(agentId),\n getZeroAgentUserConnectors(agentId),\n ]);\n\n return {\n agentId: agent.agentId,\n displayName: agent.displayName ?? agent.agentId,\n authorizedTypes: new Set(enabledTypes),\n };\n}\n","import chalk from \"chalk\";\nimport { hasRequiredConnectorAuthMethodScopes } from \"@vm0/connectors/connector-utils\";\nimport type { ConnectorListResponse } from \"@vm0/api-contracts/contracts/connector-schemas\";\n\ntype Connector = ConnectorListResponse[\"connectors\"][number];\n\nfunction renderIdentity(connector: Connector): string {\n if (connector.externalUsername) return `@${connector.externalUsername}`;\n if (connector.externalEmail) return connector.externalEmail;\n return \"-\";\n}\n\nexport function renderConnectedAsCell(\n connector: Connector | undefined,\n): string {\n if (!connector) return chalk.dim(\"(not connected)\");\n const identity = renderIdentity(connector);\n if (connector.needsReconnect) {\n return chalk.yellow(`${identity} (reconnect needed)`);\n }\n const scopeMismatch = !hasRequiredConnectorAuthMethodScopes(\n connector.type,\n connector.authMethod,\n connector.oauthScopes,\n );\n if (scopeMismatch) {\n return chalk.yellow(`${identity} (permissions update available)`);\n }\n return identity;\n}\n\nconst ESC = \"\\u001b\";\nconst ANSI_PATTERN = new RegExp(`${ESC}\\\\[[0-9;]*m`, \"g\");\n\nexport function stripAnsi(s: string): string {\n return s.replace(ANSI_PATTERN, \"\");\n}\n\nexport function padEndAnsi(s: string, width: number): string {\n const visible = stripAnsi(s).length;\n return s + \" \".repeat(Math.max(0, width - visible));\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n CONNECTOR_TYPES,\n type ConnectorType,\n} from \"@vm0/connectors/connectors\";\nimport { searchConnectors } from \"@vm0/connectors/connector-search\";\nimport { listZeroConnectors, searchZeroConnectors } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolveAgentContext } from \"./agent-context\";\nimport { padEndAnsi, renderConnectedAsCell, stripAnsi } from \"./connected-as\";\n\nconst DEFAULT_LIMIT = 5;\nconst EXACT_MATCH_THRESHOLD = 80;\n\nfunction isConnectorType(type: string): type is ConnectorType {\n return type in CONNECTOR_TYPES;\n}\n\nfunction parseLimit(raw: string): number {\n const n = Number.parseInt(raw, 10);\n if (!Number.isFinite(n) || n <= 0) {\n throw new Error(`--limit must be a positive integer, got \"${raw}\".`);\n }\n return n;\n}\n\nexport const searchCommand = new Command()\n .name(\"search\")\n .description(\n \"Search connectors by type, label, environment name, secret, or tag\",\n )\n .argument(\"<keyword>\", \"Search keyword (case-insensitive)\")\n .option(\"--agent <id>\", \"Show per-agent authorization column\")\n .option(\n \"--limit <n>\",\n `Maximum number of results to display (default ${DEFAULT_LIMIT})`,\n parseLimit,\n DEFAULT_LIMIT,\n )\n .action(\n withErrorHandler(\n async (keyword: string, options: { agent?: string; limit: number }) => {\n const trimmed = keyword.trim();\n if (!trimmed) {\n throw new Error(\"Keyword cannot be empty.\");\n }\n\n const [{ connectors }, availableCatalog, agentCtx] = await Promise.all([\n listZeroConnectors(),\n searchZeroConnectors(),\n resolveAgentContext(options.agent),\n ]);\n const connectedMap = new Map(\n connectors.map((c) => {\n return [c.type, c];\n }),\n );\n\n const availableTypes = new Set(\n availableCatalog.connectors\n .map((connector) => {\n return connector.id;\n })\n .filter(isConnectorType),\n );\n\n const { results, total } = searchConnectors(\n trimmed,\n options.limit,\n (type) => {\n return availableTypes.has(type);\n },\n );\n\n if (results.length === 0) {\n console.log(\"No matches found.\");\n return;\n }\n\n const topScore = results[0]!.score;\n if (topScore < EXACT_MATCH_THRESHOLD) {\n console.log(\"No exact match. Showing closest:\");\n }\n if (total > options.limit) {\n console.log(`Too many results (top ${options.limit} of ${total}):`);\n }\n\n const typeHeader = \"TYPE\";\n const connectedAsHeader = \"CONNECTED AS\";\n\n const connectedCells = results.map((r) => {\n return renderConnectedAsCell(connectedMap.get(r.type));\n });\n\n const typeWidth = Math.max(\n typeHeader.length,\n ...results.map((r) => {\n return r.type.length;\n }),\n );\n const connectedAsWidth = Math.max(\n connectedAsHeader.length,\n ...connectedCells.map((c) => {\n return stripAnsi(c).length;\n }),\n );\n\n const headerParts = [\n typeHeader.padEnd(typeWidth),\n connectedAsHeader.padEnd(connectedAsWidth),\n ];\n if (agentCtx) {\n headerParts.push(`AUTHORIZED FOR ${agentCtx.displayName}`);\n }\n console.log(chalk.dim(headerParts.join(\" \")));\n\n for (let i = 0; i < results.length; i++) {\n const result = results[i]!;\n const parts = [\n result.type.padEnd(typeWidth),\n padEndAnsi(connectedCells[i]!, connectedAsWidth),\n ];\n if (agentCtx) {\n parts.push(\n agentCtx.authorizedTypes.has(result.type)\n ? chalk.green(\"✓\")\n : chalk.dim(\"-\"),\n );\n }\n console.log(parts.join(\" \"));\n }\n },\n ),\n );\n","import {\n CONNECTOR_TYPE_KEYS,\n CONNECTOR_TYPES,\n type ConnectorAccessConfig,\n type ConnectorAuthMethodConfig,\n type ConnectorConfig,\n type ConnectorType,\n} from \"./connectors\";\nimport { getConnectorEnvBindingEntries } from \"./connector-utils\";\n\n/**\n * Result of a connector search hit, one per matched connector type.\n */\nexport interface ConnectorSearchResult {\n readonly type: ConnectorType;\n readonly score: number;\n /** Short label describing the matched field (e.g. \"type\", \"env:GH_TOKEN\", \"tag:vcs\", \"token:gh\"). */\n readonly matchedField: string;\n}\n\nexport interface ConnectorSearchOutput {\n /** Results sorted by score desc then type asc, already capped at `limit`. */\n readonly results: readonly ConnectorSearchResult[];\n /** Total candidates above the minimum threshold, before applying `limit`. */\n readonly total: number;\n}\n\nconst TOKEN_BOUNDARY = /[_\\-\\s]+/;\nconst CASE_BOUNDARY = /(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/;\nconst MIN_SCORE = 10;\n\n/**\n * Split a string into lowercase tokens on `_`, `-`, whitespace, and\n * camel/Pascal case boundaries. Digits stay attached to the preceding letters\n * (e.g. `v2`). Empty tokens are dropped and duplicates deduped.\n */\nfunction tokenize(input: string): Set<string> {\n const tokens = new Set<string>();\n for (const chunk of input.split(TOKEN_BOUNDARY)) {\n if (!chunk) continue;\n for (const sub of chunk.split(CASE_BOUNDARY)) {\n const lower = sub.toLowerCase();\n if (lower) tokens.add(lower);\n }\n }\n return tokens;\n}\n\nfunction connectorAccessEnvBindings(\n access: ConnectorAccessConfig,\n): Record<string, string> {\n switch (access.kind) {\n case \"static\":\n case \"refresh-token\":\n return access.envBindings;\n case \"none\":\n return {};\n }\n}\n\nfunction getManualGrantFields(\n method: ConnectorAuthMethodConfig,\n): Record<string, unknown> | undefined {\n return method.grant.kind === \"manual\" ? method.grant.fields : undefined;\n}\n\nfunction listSecretNames(config: ConnectorConfig): string[] {\n const names: string[] = [];\n for (const method of Object.values(config.authMethods)) {\n for (const name of Object.keys(getManualGrantFields(method) ?? {})) {\n names.push(name);\n }\n for (const valueRef of Object.values(\n connectorAccessEnvBindings(method.access),\n )) {\n if (valueRef.startsWith(\"$secrets.\")) {\n names.push(valueRef.slice(\"$secrets.\".length));\n }\n }\n }\n return names;\n}\n\ntype ScoreHit = { score: number; matchedField: string };\n\nfunction listEnvNames(type: ConnectorType): string[] {\n return [\n ...new Set(\n getConnectorEnvBindingEntries(type).map(({ envName }) => {\n return envName;\n }),\n ),\n ];\n}\n\nfunction findExactMatch(\n keywordLower: string,\n type: ConnectorType,\n config: ConnectorConfig,\n): ScoreHit | null {\n if (type.toLowerCase() === keywordLower) {\n return { score: 100, matchedField: \"type\" };\n }\n for (const envName of listEnvNames(type)) {\n if (envName.toLowerCase() === keywordLower) {\n return { score: 90, matchedField: `env:${envName}` };\n }\n }\n if (config.label.toLowerCase() === keywordLower) {\n return { score: 80, matchedField: \"label\" };\n }\n const tags = config.tags ?? [];\n for (const tag of tags) {\n if (tag === keywordLower) {\n return { score: 70, matchedField: `tag:${tag}` };\n }\n }\n return null;\n}\n\nfunction findSubstringMatch(\n keywordLower: string,\n type: ConnectorType,\n config: ConnectorConfig,\n): ScoreHit | null {\n if (type.toLowerCase().includes(keywordLower)) {\n return { score: 50, matchedField: \"type\" };\n }\n if (config.label.toLowerCase().includes(keywordLower)) {\n return { score: 50, matchedField: \"label\" };\n }\n for (const envName of listEnvNames(type)) {\n if (envName.toLowerCase().includes(keywordLower)) {\n return { score: 40, matchedField: `env:${envName}` };\n }\n }\n for (const name of listSecretNames(config)) {\n if (name.toLowerCase().includes(keywordLower)) {\n return { score: 30, matchedField: `secret:${name}` };\n }\n }\n const tags = config.tags ?? [];\n for (const tag of tags) {\n if (tag.includes(keywordLower)) {\n return { score: 25, matchedField: `tag:${tag}` };\n }\n }\n return null;\n}\n\nfunction collectCandidateTokens(\n type: ConnectorType,\n config: ConnectorConfig,\n): Set<string> {\n const tokens = new Set<string>();\n const sources = [\n type,\n config.label,\n ...listEnvNames(type),\n ...listSecretNames(config),\n ...(config.tags ?? []),\n ];\n for (const source of sources) {\n for (const token of tokenize(source)) {\n tokens.add(token);\n }\n }\n return tokens;\n}\n\nfunction findTokenIntersection(\n keywordTokens: Set<string>,\n type: ConnectorType,\n config: ConnectorConfig,\n): ScoreHit | null {\n const candidateTokens = collectCandidateTokens(type, config);\n let intersection = 0;\n let firstCommon = \"\";\n for (const token of keywordTokens) {\n if (candidateTokens.has(token)) {\n intersection++;\n if (!firstCommon) firstCommon = token;\n }\n }\n if (intersection === 0) return null;\n return { score: 10 * intersection, matchedField: `token:${firstCommon}` };\n}\n\nfunction scoreConnector(\n keywordLower: string,\n keywordTokens: Set<string>,\n type: ConnectorType,\n config: ConnectorConfig,\n): ScoreHit | null {\n const exact = findExactMatch(keywordLower, type, config);\n if (exact) return exact;\n\n const candidates: ScoreHit[] = [];\n const substring = findSubstringMatch(keywordLower, type, config);\n if (substring) candidates.push(substring);\n const token = findTokenIntersection(keywordTokens, type, config);\n if (token) candidates.push(token);\n\n if (candidates.length === 0) return null;\n const best = candidates.reduce((a, b) => {\n return a.score >= b.score ? a : b;\n });\n if (best.score < MIN_SCORE) return null;\n return best;\n}\n\n/**\n * Search the connector catalog by weighted multi-field ranking.\n *\n * Matches the keyword against type keys, labels, environment names, secret names,\n * and `tags`. Score is the max over matched rules (never a sum). Results with\n * score below the minimum threshold are dropped. Sort order: score desc, then\n * type asc.\n */\nexport function searchConnectors(\n keyword: string,\n limit: number,\n filter?: (type: ConnectorType) => boolean,\n): ConnectorSearchOutput {\n const trimmed = keyword.trim();\n if (!trimmed) return { results: [], total: 0 };\n\n const keywordLower = trimmed.toLowerCase();\n const keywordTokens = tokenize(trimmed);\n\n const hits: ConnectorSearchResult[] = [];\n for (const type of CONNECTOR_TYPE_KEYS) {\n if (filter && !filter(type)) continue;\n const config = CONNECTOR_TYPES[type];\n const hit = scoreConnector(keywordLower, keywordTokens, type, config);\n if (!hit) continue;\n hits.push({ type, score: hit.score, matchedField: hit.matchedField });\n }\n\n hits.sort((a, b) => {\n if (b.score !== a.score) return b.score - a.score;\n return a.type.localeCompare(b.type);\n });\n\n const capped = limit > 0 ? hits.slice(0, limit) : hits;\n return { results: capped, total: hits.length };\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n CONNECTOR_TYPE_KEYS,\n CONNECTOR_TYPES,\n type ConnectorType,\n connectorTypeSchema,\n} from \"@vm0/connectors/connectors\";\nimport {\n getConnectorAuthMethodScopeDiff,\n hasRequiredConnectorAuthMethodScopes,\n} from \"@vm0/connectors/connector-utils\";\nimport { getZeroConnector, searchZeroConnectors } from \"../../../lib/api\";\nimport { formatDateTime } from \"../../../lib/domain/schedule-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolveAgentContext } from \"./agent-context\";\nimport { getPlatformOrigin } from \"../doctor/platform-url\";\n\nconst LABEL_WIDTH = 16;\n\ntype Connector = NonNullable<Awaited<ReturnType<typeof getZeroConnector>>>;\ntype AgentContext = NonNullable<\n Awaited<ReturnType<typeof resolveAgentContext>>\n>;\n\nfunction isConnectorType(type: string): type is ConnectorType {\n return type in CONNECTOR_TYPES;\n}\n\nasync function availableConnectorTypes(): Promise<Set<ConnectorType>> {\n const catalog = await searchZeroConnectors();\n return new Set(\n catalog.connectors\n .map((connector) => {\n return connector.id;\n })\n .filter(isConnectorType),\n );\n}\n\nfunction printConnectorDetails(\n type: ConnectorType,\n connector: Connector | null,\n): void {\n if (connector) {\n console.log(\n `${\"Status:\".padEnd(LABEL_WIDTH)}${\n connector.needsReconnect\n ? chalk.yellow(\"reconnect needed\")\n : chalk.green(\"connected\")\n }`,\n );\n console.log(\n `${\"Account:\".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`,\n );\n console.log(`${\"Auth Method:\".padEnd(LABEL_WIDTH)}${connector.authMethod}`);\n\n if (connector.oauthScopes && connector.oauthScopes.length > 0) {\n console.log(\n `${\"OAuth Scopes:\".padEnd(LABEL_WIDTH)}${connector.oauthScopes.join(\", \")}`,\n );\n }\n\n if (\n !hasRequiredConnectorAuthMethodScopes(\n type,\n connector.authMethod,\n connector.oauthScopes,\n )\n ) {\n const diff = getConnectorAuthMethodScopeDiff(\n type,\n connector.authMethod,\n connector.oauthScopes,\n );\n console.log(\n `${\"Permissions:\".padEnd(LABEL_WIDTH)}${chalk.yellow(\"update available\")}`,\n );\n if (diff.addedScopes.length > 0) {\n console.log(\n `${\" Added:\".padEnd(LABEL_WIDTH)}${diff.addedScopes.join(\", \")}`,\n );\n }\n if (diff.removedScopes.length > 0) {\n console.log(\n `${\" Removed:\".padEnd(LABEL_WIDTH)}${diff.removedScopes.join(\", \")}`,\n );\n }\n }\n\n console.log(\n `${\"Connected:\".padEnd(LABEL_WIDTH)}${formatDateTime(connector.createdAt)}`,\n );\n\n if (connector.updatedAt !== connector.createdAt) {\n console.log(\n `${\"Last Updated:\".padEnd(LABEL_WIDTH)}${formatDateTime(connector.updatedAt)}`,\n );\n }\n } else {\n console.log(\n `${\"Status:\".padEnd(LABEL_WIDTH)}${chalk.dim(\"not connected\")}`,\n );\n }\n}\n\nasync function printAgentAction(\n type: ConnectorType,\n connector: Connector | null,\n agentCtx: AgentContext,\n): Promise<void> {\n const authorized = agentCtx.authorizedTypes.has(type);\n const isConnected = connector !== null;\n const needsReconnect = connector?.needsReconnect === true;\n const agentLabel =\n agentCtx.displayName === agentCtx.agentId\n ? agentCtx.agentId\n : `${agentCtx.displayName} (${agentCtx.agentId})`;\n\n console.log();\n if (needsReconnect) {\n const origin = await getPlatformOrigin();\n const url = `${origin}/connectors`;\n console.log(\n `The ${type} connector is connected but needs to be reconnected before agent ${agentLabel} can use it.`,\n );\n console.log(`Reconnect it at: [Reconnect ${type}](${url})`);\n } else if (authorized && !isConnected) {\n const origin = await getPlatformOrigin();\n const url = `${origin}/connectors/${type}/connect?agentId=${agentCtx.agentId}`;\n console.log(\n `The ${type} connector is authorized for agent ${agentLabel}, but it is not connected.`,\n );\n console.log(`Connect it at: [Connect ${type}](${url})`);\n } else if (authorized) {\n console.log(`The ${type} connector is authorized for agent ${agentLabel}.`);\n } else if (!isConnected) {\n const origin = await getPlatformOrigin();\n const url = `${origin}/connectors/${type}/connect?agentId=${agentCtx.agentId}`;\n console.log(\n `The ${type} connector is not connected. Once connected, it will be authorized for agent ${agentLabel}.`,\n );\n console.log(`Connect and authorize it at: [Connect ${type}](${url})`);\n } else {\n const origin = await getPlatformOrigin();\n const url = `${origin}/connectors/${type}/authorize?agentId=${agentCtx.agentId}`;\n console.log(\n `The ${type} connector is not authorized for agent ${agentLabel}.`,\n );\n console.log(`Authorize it at: [Authorize ${type}](${url})`);\n }\n}\n\nasync function printStandaloneAction(\n type: ConnectorType,\n connector: Connector | null,\n): Promise<void> {\n if (connector && !connector.needsReconnect) return;\n\n const origin = await getPlatformOrigin();\n console.log();\n if (connector?.needsReconnect) {\n const url = `${origin}/connectors`;\n console.log(\n `The ${type} connector is connected but needs to be reconnected.`,\n );\n console.log(`Reconnect it at: [Reconnect ${type}](${url})`);\n } else {\n const url = `${origin}/connectors/${type}/connect`;\n console.log(`Connect it at: [Connect ${type}](${url})`);\n }\n}\n\nexport const statusCommand = new Command()\n .name(\"status\")\n .description(\"Show detailed status of a connector\")\n .argument(\"<type>\", \"Connector type (e.g., github)\")\n .option(\"--agent <id>\", \"Show authorization state for the given agent\")\n .action(\n withErrorHandler(async (type: string, options: { agent?: string }) => {\n const parseResult = connectorTypeSchema.safeParse(type);\n if (!parseResult.success) {\n const available = CONNECTOR_TYPE_KEYS.join(\", \");\n throw new Error(`Unknown connector type: ${type}`, {\n cause: new Error(`Available connectors: ${available}`),\n });\n }\n\n const [connector, availableTypes, agentCtx] = await Promise.all([\n getZeroConnector(parseResult.data),\n availableConnectorTypes(),\n resolveAgentContext(options.agent),\n ]);\n const available = availableTypes.has(parseResult.data);\n\n console.log(`Connector: ${chalk.cyan(type)}`);\n console.log();\n\n printConnectorDetails(parseResult.data, connector);\n if (!available) {\n console.log();\n console.log(`The ${type} connector is not available for this account.`);\n return;\n }\n\n if (agentCtx) {\n await printAgentAction(parseResult.data, connector, agentCtx);\n } else {\n await printStandaloneAction(parseResult.data, connector);\n }\n }),\n );\n","/**\n * Format a date string as relative time (e.g., \"in 2h\", \"3d ago\")\n */\nexport function formatRelativeTime(dateStr: string | null): string {\n if (!dateStr) return \"-\";\n\n const date = new Date(dateStr);\n const now = new Date();\n const diffMs = date.getTime() - now.getTime();\n const diffAbs = Math.abs(diffMs);\n\n const minutes = Math.floor(diffAbs / (1000 * 60));\n const hours = Math.floor(diffAbs / (1000 * 60 * 60));\n const days = Math.floor(diffAbs / (1000 * 60 * 60 * 24));\n\n const isPast = diffMs < 0;\n\n if (days > 0) {\n return isPast ? `${days}d ago` : `in ${days}d`;\n } else if (hours > 0) {\n return isPast ? `${hours}h ago` : `in ${hours}h`;\n } else if (minutes > 0) {\n return isPast ? `${minutes}m ago` : `in ${minutes}m`;\n } else {\n return isPast ? \"just now\" : \"soon\";\n }\n}\n\n/**\n * Format a date string with both absolute and relative time\n * e.g., \"2025-01-14 09:00 (in 2h)\"\n * Uses local timezone, but doesn't include timezone in output (shown separately)\n */\nexport function formatDateTime(dateStr: string | null): string {\n if (!dateStr) return \"-\";\n\n const date = new Date(dateStr);\n\n // Format: YYYY-MM-DD HH:MM (no seconds, no timezone - shown separately)\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n const hours = String(date.getHours()).padStart(2, \"0\");\n const minutes = String(date.getMinutes()).padStart(2, \"0\");\n\n const formatted = `${year}-${month}-${day} ${hours}:${minutes}`;\n const relative = formatRelativeTime(dateStr);\n\n return `${formatted} (${relative})`;\n}\n\n/**\n * Frequency type for schedule wizard\n */\nexport type ScheduleFrequency =\n | \"daily\"\n | \"weekly\"\n | \"monthly\"\n | \"once\"\n | \"loop\";\n\n/**\n * Generate cron expression from user-friendly inputs\n * @param frequency - Schedule frequency type\n * @param time - Time in HH:MM format (24-hour)\n * @param day - Day of week (0-6, Sun=0) for weekly, or day of month (1-31) for monthly\n * @returns Cron expression string\n */\nexport function generateCronExpression(\n frequency: Exclude<ScheduleFrequency, \"once\" | \"loop\">,\n time: string,\n day?: number,\n): string {\n const [hourStr, minuteStr] = time.split(\":\");\n const hour = parseInt(hourStr ?? \"0\", 10);\n const minute = parseInt(minuteStr ?? \"0\", 10);\n\n switch (frequency) {\n case \"daily\":\n return `${minute} ${hour} * * *`;\n case \"weekly\":\n return `${minute} ${hour} * * ${day ?? 1}`;\n case \"monthly\":\n return `${minute} ${hour} ${day ?? 1} * *`;\n }\n}\n\n/**\n * Detect system timezone using Intl API\n * @returns IANA timezone identifier (e.g., \"America/New_York\")\n */\nexport function detectTimezone(): string {\n return Intl.DateTimeFormat().resolvedOptions().timeZone;\n}\n\n/**\n * Validate time format (HH:MM, 24-hour)\n * @param time - Time string to validate\n * @returns true if valid, error message if invalid\n */\nexport function validateTimeFormat(time: string): boolean | string {\n const match = time.match(/^(\\d{1,2}):(\\d{2})$/);\n if (!match) {\n return \"Invalid format. Use HH:MM (e.g., 09:00)\";\n }\n\n const hour = parseInt(match[1]!, 10);\n const minute = parseInt(match[2]!, 10);\n\n if (hour < 0 || hour > 23) {\n return \"Hour must be 0-23\";\n }\n if (minute < 0 || minute > 59) {\n return \"Minute must be 0-59\";\n }\n if (minute % 5 !== 0) {\n return \"Minute must be a multiple of 5 (0, 5, 10, ..., 55)\";\n }\n\n return true;\n}\n\n/**\n * Validate date format (YYYY-MM-DD)\n * @param date - Date string to validate\n * @returns true if valid, error message if invalid\n */\nexport function validateDateFormat(date: string): boolean | string {\n const match = date.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/);\n if (!match) {\n return \"Invalid format. Use YYYY-MM-DD (e.g., 2025-01-15)\";\n }\n\n const year = parseInt(match[1]!, 10);\n const month = parseInt(match[2]!, 10);\n const day = parseInt(match[3]!, 10);\n\n if (year < 2000 || year > 2100) {\n return \"Year must be between 2000 and 2100\";\n }\n if (month < 1 || month > 12) {\n return \"Month must be 1-12\";\n }\n if (day < 1 || day > 31) {\n return \"Day must be 1-31\";\n }\n\n // Validate the date is actually valid (e.g., not Feb 30)\n const testDate = new Date(year, month - 1, day);\n if (\n testDate.getFullYear() !== year ||\n testDate.getMonth() !== month - 1 ||\n testDate.getDate() !== day\n ) {\n return \"Invalid date\";\n }\n\n return true;\n}\n\n/**\n * Get tomorrow's date in local timezone as YYYY-MM-DD\n * @returns Date string in YYYY-MM-DD format\n */\nexport function getTomorrowDateLocal(): string {\n const tomorrow = new Date();\n tomorrow.setDate(tomorrow.getDate() + 1);\n const year = tomorrow.getFullYear();\n const month = String(tomorrow.getMonth() + 1).padStart(2, \"0\");\n const day = String(tomorrow.getDate()).padStart(2, \"0\");\n return `${year}-${month}-${day}`;\n}\n\n/**\n * Get current time in local timezone as HH:MM\n * @returns Time string in HH:MM format\n */\nexport function getCurrentTimeLocal(): string {\n const now = new Date();\n const hours = String(now.getHours()).padStart(2, \"0\");\n const minutes = String(now.getMinutes()).padStart(2, \"0\");\n return `${hours}:${minutes}`;\n}\n\n/**\n * Convert a human-readable datetime string to ISO format\n * Supports formats: \"YYYY-MM-DD HH:MM\" or full ISO string\n * @param dateTimeStr - DateTime string (e.g., \"2025-01-15 14:30\")\n * @returns ISO format string (e.g., \"2025-01-15T14:30:00.000Z\")\n */\nexport function toISODateTime(dateTimeStr: string): string {\n // If already in ISO format, return as-is\n if (dateTimeStr.includes(\"T\") && dateTimeStr.endsWith(\"Z\")) {\n return dateTimeStr;\n }\n\n // Convert \"YYYY-MM-DD HH:MM\" to ISO\n const isoStr = dateTimeStr.replace(\" \", \"T\") + \":00\";\n const date = new Date(isoStr);\n return date.toISOString();\n}\n","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","import { Command, Option } from \"commander\";\nimport chalk from \"chalk\";\n\nimport { createZeroCreditCheckout, getZeroOrgMembers } from \"../../lib/api\";\nimport { withErrorHandler } from \"../../lib/command\";\nimport { getPlatformOrigin } from \"./doctor/platform-url\";\n\nfunction parseCredits(value: string): number {\n const credits = Number(value.replaceAll(\",\", \"\"));\n if (!Number.isInteger(credits) || credits <= 0) {\n throw new Error(\"credits must be a positive integer\");\n }\n return credits;\n}\n\nexport const zeroCreditCommand = new Command()\n .name(\"credit\")\n .description(\"Create a Stripe checkout link to buy credits\")\n .argument(\"<credits>\", \"Number of credits to buy\", parseCredits)\n .addOption(\n new Option(\"--auto-recharge\", \"Enable auto-recharge after checkout\"),\n )\n .option(\n \"--auto-recharge-threshold <credits>\",\n \"Recharge when balance is at or below this number of credits\",\n parseCredits,\n )\n .option(\n \"--auto-recharge-amount <credits>\",\n \"Credits to buy for each auto-recharge\",\n parseCredits,\n )\n .action(\n withErrorHandler(\n async (\n credits: number,\n options: {\n readonly autoRecharge?: boolean;\n readonly autoRechargeThreshold?: number;\n readonly autoRechargeAmount?: number;\n },\n ) => {\n const members = await getZeroOrgMembers();\n if (members.role !== \"admin\") {\n console.log(\n chalk.yellow(\n \"Only organization admins can buy credits. Run `zero doctor credit` to see the current credit status and org admins.\",\n ),\n );\n return;\n }\n\n const origin = await getPlatformOrigin();\n const successUrl = `${origin}/?settings=usage&credit=success`;\n const cancelUrl = `${origin}/?settings=usage&credit=canceled`;\n if (\n options.autoRecharge !== true &&\n (options.autoRechargeThreshold !== undefined ||\n options.autoRechargeAmount !== undefined)\n ) {\n throw new Error(\n \"--auto-recharge-threshold and --auto-recharge-amount require --auto-recharge\",\n );\n }\n\n if (\n options.autoRecharge === true &&\n (options.autoRechargeThreshold === undefined ||\n options.autoRechargeAmount === undefined)\n ) {\n throw new Error(\n \"--auto-recharge requires --auto-recharge-threshold and --auto-recharge-amount\",\n );\n }\n\n const autoRecharge =\n options.autoRecharge === true\n ? {\n enabled: true,\n threshold: options.autoRechargeThreshold,\n amount: options.autoRechargeAmount,\n }\n : undefined;\n\n const result = await createZeroCreditCheckout({\n credits,\n successUrl,\n cancelUrl,\n ...(autoRecharge ? { autoRecharge } : {}),\n });\n console.log(chalk.bold(\"Credit checkout link:\"));\n console.log(result.url);\n },\n ),\n );\n","import { Command } from \"commander\";\nimport { checkConnectorCommand } from \"./check-connector\";\nimport { permissionDenyCommand } from \"./permission-deny\";\nimport { permissionChangeCommand } from \"./permission-change\";\nimport { creditCommand } from \"./credit\";\n\nexport const zeroDoctorCommand = new Command()\n .name(\"doctor\")\n .description(\"Diagnose runtime issues (connector health, permission denials)\")\n .addCommand(checkConnectorCommand)\n .addCommand(creditCommand)\n .addCommand(permissionDenyCommand)\n .addCommand(permissionChangeCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Check a connector? zero doctor check-connector --env-name GITHUB_TOKEN\n Check a URL? zero doctor check-connector --url https://api.github.com/repos/owner/repo\n Check credits? zero doctor credit\n Check with permission? zero doctor check-connector --env-name SLACK_TOKEN --check-permission chat:write\n Permission denied? zero doctor permission-deny github --method GET --path /repos/owner/repo\n Change a permission? zero doctor permission-change github --permission contents:read --enable\n\nNotes:\n - Use zero doctor credit when a run or generation fails because the org has insufficient credits, when a user asks how to recharge, or before trying to buy credits\n - Use this when your task fails due to a missing connector environment name or permission denial\n - Use zero generate <type> (no --prompt) to see every provider available for a given generation type\n - The doctor will identify the issue and give the user a link to resolve it`,\n );\n","import { Command, Option } from \"commander\";\nimport {\n CONNECTOR_TYPE_KEYS,\n CONNECTOR_TYPES,\n type ConnectorType,\n} from \"@vm0/connectors/connectors\";\nimport {\n getConnectorEnvBindingEntries,\n getDiagnosticConnectorTypeForRuntimeEnvName,\n} from \"@vm0/connectors/connector-utils\";\nimport {\n type FirewallBaseUrlMatch,\n findMatchingPermissions,\n matchFirewallBaseUrl,\n} from \"@vm0/connectors/firewall-rule-matcher\";\nimport { extractSecretNamesFromApis } from \"@vm0/connectors/firewall-types\";\nimport {\n getConnectorFirewall,\n isFirewallConnectorType,\n} from \"@vm0/connectors/firewalls\";\nimport type { NetworkPolicies } from \"@vm0/connectors/firewall-types\";\nimport type { RunContextResponse } from \"@vm0/api-contracts/contracts/zero-runs\";\nimport { getApiUrl } from \"../../../lib/api/config\";\nimport {\n getZeroConnector,\n searchZeroConnectors,\n} from \"../../../lib/api/domains/zero-connectors\";\nimport { getZeroAgentUserConnectors } from \"../../../lib/api/domains/zero-agents\";\nimport { getZeroRunContext } from \"../../../lib/api/domains/zero-runs\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { toPlatformUrl } from \"./platform-url\";\nimport { decodeZeroTokenPayload } from \"../../../lib/api/zero-token\";\n\ninterface CheckConnectorOptions {\n envName?: string;\n url?: string;\n method: string;\n checkPermission?: string;\n}\n\ninterface DiagContext {\n envName: string;\n connectorType: string;\n label: string;\n connectorAvailable: boolean;\n platformOrigin: string;\n agentId: string | undefined;\n}\n\ninterface UrlLookupResult {\n connectorType: string;\n envName: string;\n matchedBase: string;\n relativePath: string;\n}\n\nfunction isConnectorType(type: string): type is ConnectorType {\n return type in CONNECTOR_TYPES;\n}\n\nasync function connectorTypeIsAvailable(type: string): Promise<boolean> {\n if (!isConnectorType(type)) {\n return false;\n }\n const catalog = await searchZeroConnectors();\n return catalog.connectors.some((connector) => {\n return connector.id === type;\n });\n}\n\n/**\n * Reverse-lookup a full URL to find which connector handles it.\n * Iterates all connector firewall configs and checks if the URL\n * starts with any registered base URL (scheme + host + optional path prefix).\n */\nfunction resolveConnectorFromUrl(url: string): UrlLookupResult | null {\n const allTypes = CONNECTOR_TYPE_KEYS;\n\n let bestMatch: {\n connectorType: string;\n match: FirewallBaseUrlMatch;\n } | null = null;\n\n for (const type of allTypes) {\n if (!isFirewallConnectorType(type)) continue;\n const config = getConnectorFirewall(type);\n for (const api of config.apis) {\n const match = matchFirewallBaseUrl(url, api.base);\n if (match !== null) {\n // Pick the longest (most specific) base URL match\n if (!bestMatch || match.score > bestMatch.match.score) {\n bestMatch = { connectorType: type, match };\n }\n }\n }\n }\n\n if (!bestMatch) return null;\n\n // Derive the environment name from the connector's configured env bindings.\n const envBindingEntries = getConnectorEnvBindingEntries(\n bestMatch.connectorType as ConnectorType,\n );\n const envName = envBindingEntries[0]?.envName;\n if (!envName) return null;\n\n return {\n connectorType: bestMatch.connectorType,\n envName,\n matchedBase: bestMatch.match.displayBase,\n relativePath: bestMatch.match.relativePath,\n };\n}\n\nfunction checkEnvName(ctx: DiagContext): boolean {\n console.log(\"## Step 1: Sandbox environment name\");\n console.log(\"\");\n const envPresent = Boolean(process.env[ctx.envName]);\n console.log(\n `Checking process.env.${ctx.envName}: ${envPresent ? \"present\" : \"not present\"}`,\n );\n if (envPresent) {\n console.log(\n \"A placeholder value is present in the sandbox environment. This value is not the real credential — it is a stand-in that gets replaced at the network boundary when requests are sent to registered base URLs.\",\n );\n } else {\n console.log(\n \"No value found for this environment name. Note: credential replacement at the network boundary is independent of this name — the proxy injects auth headers based on the destination URL.\",\n );\n }\n console.log(\"\");\n return envPresent;\n}\n\nasync function checkConnectorStatus(ctx: DiagContext): Promise<{\n isConnected: boolean;\n isExpired: boolean;\n hasPermission: boolean;\n}> {\n console.log(\"## Step 2: Connector configuration\");\n console.log(\"\");\n console.log(\n \"A Connector holds the real credentials (OAuth tokens or API keys) for an external service. These credentials are never injected into the sandbox. Instead, when the sandbox sends an HTTP request to a base URL registered by the Connector, the network boundary intercepts the request and replaces the auth headers with real credentials. For this to work, three conditions must be met:\",\n );\n console.log(\"\");\n\n const [connector, enabledTypes] = await Promise.all([\n getZeroConnector(ctx.connectorType as ConnectorType),\n ctx.agentId\n ? getZeroAgentUserConnectors(ctx.agentId)\n : Promise.resolve(null),\n ]);\n\n const isConnected = connector !== null;\n const isExpired = connector?.needsReconnect === true;\n const hasPermission =\n enabledTypes !== null && enabledTypes.includes(ctx.connectorType);\n\n // 2a: Connector status — user must have configured the connector (OAuth or API token)\n console.log(\n `### 2a: Connector status (user must configure via OAuth login or API key)`,\n );\n console.log(\"\");\n if (!ctx.connectorAvailable) {\n console.log(\n `The ${ctx.label} connector is not available for this account.`,\n );\n } else if (!isConnected) {\n console.log(`The ${ctx.label} connector is not connected.`);\n if (ctx.agentId && hasPermission) {\n const connectUrl = `${ctx.platformOrigin}/connectors/${ctx.connectorType}/connect?agentId=${ctx.agentId}`;\n console.log(`Connect it at: [Connect ${ctx.label}](${connectUrl})`);\n } else if (!ctx.agentId) {\n // No agentId: can't scope the authorize page, so fall back to a plain\n // connect link. With agentId, 2b's Authorize link performs the initial\n // OAuth connect before granting permission — one link covers both steps.\n const connectUrl = `${ctx.platformOrigin}/connectors/${ctx.connectorType}/connect`;\n console.log(`Connect it at: [Connect ${ctx.label}](${connectUrl})`);\n }\n } else if (isExpired) {\n const url = `${ctx.platformOrigin}/connectors`;\n console.log(\n `The ${ctx.label} connector is connected but has expired and needs to be reconnected.`,\n );\n console.log(`Reconnect it at: [Reconnect ${ctx.label}](${url})`);\n } else {\n console.log(`The ${ctx.label} connector is connected and active.`);\n }\n console.log(\"\");\n\n // 2b: Agent authorization — user must authorize the agent to use this connector\n console.log(\n `### 2b: Agent authorization (user must authorize agent to use this connector)`,\n );\n console.log(\"\");\n if (!ctx.connectorAvailable) {\n console.log(\n `Skipped — the ${ctx.label} connector is not available for this account.`,\n );\n } else if (!ctx.agentId) {\n console.log(\"ZERO_AGENT_ID is not set — cannot check agent authorization.\");\n } else if (isExpired) {\n // The /authorize page treats an expired connector as \"already connected\"\n // and won't re-trigger OAuth. Defer to 2a's Reconnect link in that case.\n console.log(\n `Skipped — agent authorization can only be checked once the ${ctx.label} connector is reconnected (see 2a).`,\n );\n } else if (hasPermission) {\n console.log(\n isConnected\n ? `The ${ctx.label} connector is authorized for this agent.`\n : `The ${ctx.label} connector is authorized for this agent, but it is not connected.`,\n );\n } else {\n const url = `${ctx.platformOrigin}/connectors/${ctx.connectorType}/authorize?agentId=${ctx.agentId}`;\n console.log(\n isConnected\n ? `The ${ctx.label} connector is not authorized for this agent (${ctx.agentId}).`\n : `The ${ctx.label} connector needs to be connected and authorized for this agent (${ctx.agentId}).`,\n );\n console.log(`Authorize it at: [Authorize ${ctx.label}](${url})`);\n }\n console.log(\"\");\n\n return { isConnected, isExpired, hasPermission };\n}\n\nasync function checkConnectorDomains(\n ctx: DiagContext,\n): Promise<NetworkPolicies | null> {\n // 2c: Registered base URLs — connector defines which URL prefixes get credential replacement\n console.log(\n `### 2c: Registered base URLs (credential replacement only applies to URLs matching these prefixes)`,\n );\n console.log(\"\");\n\n const payload = decodeZeroTokenPayload();\n const runId = payload?.runId;\n\n if (!runId) {\n console.log(\n \"Cannot determine run ID from ZERO_TOKEN — skipping base URL check.\",\n );\n console.log(\"\");\n return null;\n }\n\n const runContext = await getZeroRunContext(runId);\n\n printConnectorDomains(ctx, runContext);\n console.log(\"\");\n return runContext.networkPolicies;\n}\n\nfunction printConnectorDomains(\n ctx: DiagContext,\n runContext: RunContextResponse,\n): void {\n const matchingEntry = runContext.firewalls.find((fw) => {\n return fw.name === ctx.connectorType;\n });\n\n if (!matchingEntry) {\n console.log(\n `No configuration found for the ${ctx.label} connector in this run.`,\n );\n console.log(\n \"This means no base URLs are registered for credential replacement for this connector.\",\n );\n return;\n }\n\n console.log(\n `The ${ctx.label} connector is configured for this run with the following base URLs:`,\n );\n for (const api of matchingEntry.apis) {\n console.log(` - ${api.base}`);\n }\n console.log(\"\");\n console.log(\n \"When the sandbox sends an HTTP request matching one of these URL prefixes, the network boundary intercepts the request and injects real credentials into the auth headers.\",\n );\n\n if (isFirewallConnectorType(ctx.connectorType)) {\n const firewallConfig = getConnectorFirewall(ctx.connectorType);\n const secretNames = extractSecretNamesFromApis(firewallConfig.apis);\n if (secretNames.length > 0) {\n console.log(`Credentials resolved from: ${secretNames.join(\", \")}`);\n }\n }\n}\n\nfunction checkPermissionPolicy(\n connectorType: string,\n label: string,\n permissionName: string,\n networkPolicies: NetworkPolicies | null,\n): void {\n console.log(\"## Step 3: Permission policy check\");\n console.log(\"\");\n console.log(\n `Checking permission: \"${permissionName}\" for the ${label} connector.`,\n );\n console.log(\n `Beyond credential replacement, the ${label} connector enforces permission policies on each API path. A request either matches a named permission or falls through to the unknown-endpoint policy.`,\n );\n console.log(\"\");\n\n if (!networkPolicies) {\n console.log(\n \"Network policies are not available for this run — cannot check permission status.\",\n );\n console.log(\"\");\n return;\n }\n\n const connectorPolicies = networkPolicies[connectorType];\n\n if (!connectorPolicies) {\n console.log(\n `No policy entry found for the ${label} connector in this run's network policies.`,\n );\n console.log(\n \"When a connector has no policy entry, all requests are fully permissive (allowed).\",\n );\n console.log(\"\");\n return;\n }\n\n console.log(`Permission policies for the ${label} connector:`);\n console.log(` allow list: [${connectorPolicies.allow.join(\", \")}]`);\n console.log(` deny list: [${connectorPolicies.deny.join(\", \")}]`);\n console.log(` unknown endpoint policy: ${connectorPolicies.unknownPolicy}`);\n console.log(\"\");\n\n const isInAllow = connectorPolicies.allow.includes(permissionName);\n const isInDeny = connectorPolicies.deny.includes(permissionName);\n\n if (isInAllow) {\n console.log(\n `Result: \"${permissionName}\" is in the allow list. Requests matching this permission are allowed.`,\n );\n } else if (isInDeny) {\n console.log(\n `Result: \"${permissionName}\" is in the deny list. Requests matching this permission are denied.`,\n );\n } else {\n console.log(\n `Result: \"${permissionName}\" is not in any permission list. It will be handled by the unknown endpoint policy: ${connectorPolicies.unknownPolicy}.`,\n );\n }\n console.log(\"\");\n}\n\n/**\n * When --url is provided, auto-detect the matching permission by running\n * the URL's relative path against the connector's firewall rules.\n */\nfunction resolvePermissionFromUrl(\n connectorType: string,\n label: string,\n method: string,\n relativePath: string,\n matchedBase: string,\n networkPolicies: NetworkPolicies | null,\n): void {\n console.log(\"## Step 3: Permission policy check (auto-detected from URL)\");\n console.log(\"\");\n console.log(\n `Matching ${method} ${relativePath} (relative to base URL ${matchedBase}) against the ${label} connector's permission rules.`,\n );\n console.log(\"\");\n\n if (!isFirewallConnectorType(connectorType)) {\n console.log(\n `The ${label} connector does not have permission rules defined.`,\n );\n console.log(\"\");\n return;\n }\n\n const config = getConnectorFirewall(connectorType);\n const matchedPermissions = findMatchingPermissions(\n method,\n relativePath,\n config,\n { apiBase: matchedBase },\n );\n\n if (matchedPermissions.length === 0) {\n console.log(\n `No named permission matches ${method} ${relativePath}. This request falls through to the unknown-endpoint policy.`,\n );\n } else {\n console.log(`Matched permissions: [${matchedPermissions.join(\", \")}]`);\n }\n console.log(\"\");\n\n if (!networkPolicies) {\n console.log(\n \"Network policies are not available for this run — cannot check allow/deny status.\",\n );\n console.log(\"\");\n return;\n }\n\n const connectorPolicies = networkPolicies[connectorType];\n\n if (!connectorPolicies) {\n console.log(\n `No policy entry found for the ${label} connector. All requests are fully permissive (allowed).`,\n );\n console.log(\"\");\n return;\n }\n\n console.log(`Permission policies for the ${label} connector:`);\n console.log(` allow list: [${connectorPolicies.allow.join(\", \")}]`);\n console.log(` deny list: [${connectorPolicies.deny.join(\", \")}]`);\n console.log(` unknown endpoint policy: ${connectorPolicies.unknownPolicy}`);\n console.log(\"\");\n\n if (matchedPermissions.length === 0) {\n console.log(\n `Result: No permission matched. The unknown endpoint policy applies: ${connectorPolicies.unknownPolicy}.`,\n );\n } else {\n for (const perm of matchedPermissions) {\n const isInAllow = connectorPolicies.allow.includes(perm);\n const isInDeny = connectorPolicies.deny.includes(perm);\n if (isInAllow) {\n console.log(`Result: \"${perm}\" is in the allow list — allowed.`);\n } else if (isInDeny) {\n console.log(`Result: \"${perm}\" is in the deny list — denied.`);\n } else {\n console.log(\n `Result: \"${perm}\" is not in any list — falls through to unknown endpoint policy: ${connectorPolicies.unknownPolicy}.`,\n );\n }\n }\n }\n console.log(\"\");\n}\n\nexport const checkConnectorCommand = new Command()\n .name(\"check-connector\")\n .description(\n \"Diagnose connector health: environment name, connector configuration, and permission policies\",\n )\n .addOption(\n new Option(\n \"--env-name <ENV_NAME>\",\n \"The connector environment name to check (e.g. GITHUB_TOKEN)\",\n ),\n )\n .addOption(\n new Option(\n \"--url <URL>\",\n \"A full URL to diagnose — auto-detects the connector, environment name, and permission (e.g. https://api.github.com/repos/owner/repo)\",\n ),\n )\n .addOption(\n new Option(\n \"--method <METHOD>\",\n \"HTTP method to use when matching permissions with --url (default: GET)\",\n ).default(\"GET\"),\n )\n .addOption(\n new Option(\n \"--check-permission <name>\",\n \"Check whether a specific permission is allowed or denied (e.g. contents:read)\",\n ),\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n zero doctor check-connector --env-name GITHUB_TOKEN\n zero doctor check-connector --url https://api.github.com/repos/owner/repo\n zero doctor check-connector --url https://slack.com/api/chat.postMessage --method POST\n zero doctor check-connector --env-name SLACK_TOKEN --check-permission chat:write\n\nHow connectors work:\n A Connector holds the real credentials for an external service. These credentials\n are never injected into the sandbox. Instead, when the sandbox sends an HTTP\n request to a base URL registered by the Connector, the network boundary intercepts\n the request and replaces the auth headers with real credentials.\n\n This command checks each part of that pipeline and reports what it finds.`,\n )\n .action(\n withErrorHandler(async (opts: CheckConnectorOptions) => {\n if (!opts.envName && !opts.url) {\n throw new Error(\n \"Either --env-name or --url is required. Use --help for usage.\",\n );\n }\n\n let envName: string;\n let connectorType: string;\n let urlLookup: UrlLookupResult | null = null;\n\n if (opts.url) {\n urlLookup = resolveConnectorFromUrl(opts.url);\n if (!urlLookup) {\n throw new Error(\n `No connector found for URL: ${opts.url} — no registered base URL matches this URL`,\n );\n }\n connectorType = urlLookup.connectorType;\n envName = opts.envName ?? urlLookup.envName;\n console.log(\n `URL ${opts.url} matches the ${CONNECTOR_TYPES[connectorType as ConnectorType].label} connector (type: ${connectorType}).`,\n );\n console.log(` Matched base URL: ${urlLookup.matchedBase}`);\n console.log(` Relative path: ${urlLookup.relativePath}`);\n console.log(` Environment name: ${envName}`);\n } else {\n envName = opts.envName!;\n const resolvedConnectorType =\n getDiagnosticConnectorTypeForRuntimeEnvName(envName);\n if (!resolvedConnectorType) {\n throw new Error(\n `Unknown environment name: ${envName} — not managed by any connector`,\n );\n }\n connectorType = resolvedConnectorType;\n console.log(\n `${envName} is managed by the ${CONNECTOR_TYPES[connectorType as ConnectorType].label} connector (type: ${connectorType}).`,\n );\n }\n console.log(\"\");\n\n const { label } = CONNECTOR_TYPES[connectorType as ConnectorType];\n const [apiUrl, connectorAvailable] = await Promise.all([\n getApiUrl(),\n connectorTypeIsAvailable(connectorType),\n ]);\n const platformUrl = toPlatformUrl(apiUrl);\n\n const ctx: DiagContext = {\n envName,\n connectorType,\n label,\n connectorAvailable,\n platformOrigin: platformUrl.origin,\n agentId: process.env.ZERO_AGENT_ID || undefined,\n };\n\n checkEnvName(ctx);\n const { isConnected, isExpired, hasPermission } =\n await checkConnectorStatus(ctx);\n const networkPolicies = await checkConnectorDomains(ctx);\n\n // Summary for Step 2\n if (isConnected && !isExpired && hasPermission) {\n console.log(\n `Steps 1-2 summary: The ${label} connector is connected, active, and authorized. Outbound requests to the registered base URLs will have credentials injected at the network boundary.`,\n );\n }\n console.log(\"\");\n\n // Step 3: Permission policy check\n if (urlLookup) {\n // --url mode: auto-detect permission from URL path\n resolvePermissionFromUrl(\n connectorType,\n label,\n opts.method,\n urlLookup.relativePath,\n urlLookup.matchedBase,\n networkPolicies,\n );\n } else if (opts.checkPermission) {\n // --env-name mode with explicit --check-permission\n checkPermissionPolicy(\n connectorType,\n label,\n opts.checkPermission,\n networkPolicies,\n );\n }\n\n // Re-diagnose hint\n const args: string[] = [];\n if (opts.url) {\n args.push(`--url ${opts.url}`);\n if (opts.method !== \"GET\") {\n args.push(`--method ${opts.method}`);\n }\n } else {\n args.push(`--env-name ${envName}`);\n }\n if (opts.checkPermission) {\n args.push(`--check-permission ${opts.checkPermission}`);\n }\n console.log(\n `To re-diagnose after changes, run: zero doctor check-connector ${args.join(\" \")}`,\n );\n }),\n );\n","import { Command, Option } from \"commander\";\nimport { CONNECTOR_TYPES } from \"@vm0/connectors/connectors\";\nimport { findMatchingPermissions } from \"@vm0/connectors/firewall-rule-matcher\";\nimport {\n getConnectorFirewall,\n isFirewallConnectorType,\n} from \"@vm0/connectors/firewalls\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolvePermissionGrantMode } from \"./permission-context\";\n\nexport const permissionDenyCommand = new Command()\n .name(\"permission-deny\")\n .description(\n \"Diagnose a permission denial and find the permission that covers it\",\n )\n .argument(\"<connector-ref>\", \"The connector type (e.g. github)\")\n .addOption(\n new Option(\n \"--method <method>\",\n \"The denied HTTP method\",\n ).makeOptionMandatory(),\n )\n .addOption(\n new Option(\"--path <path>\", \"The denied path\").makeOptionMandatory(),\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n zero doctor permission-deny github --method GET --path /repos/owner/repo/pulls\n zero doctor permission-deny slack --method POST --path /chat.postMessage\n\nNotes:\n - Identifies which named permission covers a denied request\n - Use permission-change to request or enable the permission`,\n )\n .action(\n withErrorHandler(\n async (connectorRef: string, opts: { method: string; path: string }) => {\n if (!isFirewallConnectorType(connectorRef)) {\n throw new Error(`Unknown connector type: ${connectorRef}`);\n }\n\n const { label } = CONNECTOR_TYPES[connectorRef];\n const config = getConnectorFirewall(connectorRef);\n const permissions = findMatchingPermissions(\n opts.method,\n opts.path,\n config,\n );\n\n console.log(\n `The ${label} permission filtered ${opts.method} ${opts.path}.`,\n );\n\n if (permissions.length === 0) {\n console.log(\"No named permission was found covering this request.\");\n return;\n }\n\n // Count total rules per permission name across all APIs\n const ruleCount = new Map<string, number>();\n for (const api of config.apis) {\n if (!api.permissions) continue;\n for (const perm of api.permissions) {\n ruleCount.set(\n perm.name,\n (ruleCount.get(perm.name) ?? 0) + perm.rules.length,\n );\n }\n }\n\n // Pick the permission with the fewest rules (most specific)\n const permission = permissions.reduce((narrowest, current) => {\n return (ruleCount.get(current) ?? Infinity) <\n (ruleCount.get(narrowest) ?? Infinity)\n ? current\n : narrowest;\n });\n console.log(`This is covered by the \"${permission}\" permission.`);\n const permissionGrantMode = await resolvePermissionGrantMode();\n const reasonArg =\n permissionGrantMode === \"user-grants\"\n ? \"\"\n : ' --reason \"why this is needed\"';\n const actionVerb =\n permissionGrantMode === \"user-grants\" ? \"allow\" : \"request\";\n console.log(\n `To ${actionVerb} this permission, run: zero doctor permission-change ${connectorRef} --permission ${permission} --enable${reasonArg}`,\n );\n },\n ),\n );\n","import { getZeroOrg } from \"../../../lib/api/domains/zero-orgs\";\nimport { getZeroAgent } from \"../../../lib/api/domains/zero-agents\";\nimport { decodeZeroTokenPayload } from \"../../../lib/api/zero-token\";\nimport { decodeCliTokenPayload } from \"../../../lib/api/cli-token\";\nimport { getToken } from \"../../../lib/api/config\";\nimport type { OrgResponse } from \"@vm0/api-contracts/contracts/orgs\";\n\ntype AgentRole = \"admin\" | \"owner\" | \"member\" | \"unknown\";\ntype PermissionGrantMode = NonNullable<OrgResponse[\"permissionGrantMode\"]>;\n\ninterface PermissionChangeContext {\n readonly role: AgentRole;\n readonly permissionGrantMode: PermissionGrantMode;\n}\n\nconst LEGACY_PERMISSION_GRANT_MODE: PermissionGrantMode = \"legacy\";\n\nfunction roleFromOrg(org: OrgResponse): AgentRole {\n if (org.role === \"admin\") return \"admin\";\n if (org.role === \"member\") return \"member\";\n return \"unknown\";\n}\n\nfunction permissionGrantModeFromOrg(org: OrgResponse): PermissionGrantMode {\n return org.permissionGrantMode ?? LEGACY_PERMISSION_GRANT_MODE;\n}\n\n/**\n * Resolve the current user's userId from the available token.\n * Tries ZERO_TOKEN (sandbox) first, then CLI token.\n */\nasync function resolveUserId(): Promise<string | undefined> {\n const zeroPayload = decodeZeroTokenPayload();\n if (zeroPayload?.userId) return zeroPayload.userId;\n\n const token = await getToken();\n const cliPayload = decodeCliTokenPayload(token);\n return cliPayload?.userId;\n}\n\nexport async function resolvePermissionGrantMode(): Promise<PermissionGrantMode> {\n try {\n const org = await getZeroOrg();\n return permissionGrantModeFromOrg(org);\n } catch {\n return LEGACY_PERMISSION_GRANT_MODE;\n }\n}\n\nexport async function resolvePermissionChangeContext(\n agentId: string | undefined,\n): Promise<PermissionChangeContext> {\n try {\n const org = await getZeroOrg();\n const permissionGrantMode = permissionGrantModeFromOrg(org);\n\n if (!agentId || permissionGrantMode === \"user-grants\") {\n return {\n role: roleFromOrg(org),\n permissionGrantMode,\n };\n }\n\n if (org.role === \"admin\") {\n return { role: \"admin\", permissionGrantMode };\n }\n\n if (org.role === \"member\") {\n const userId = await resolveUserId();\n if (userId) {\n const agent = await getZeroAgent(agentId);\n if (agent.ownerId === userId) {\n return { role: \"owner\", permissionGrantMode };\n }\n }\n return { role: \"member\", permissionGrantMode };\n }\n\n return { role: \"unknown\", permissionGrantMode };\n } catch {\n return {\n role: \"unknown\",\n permissionGrantMode: LEGACY_PERMISSION_GRANT_MODE,\n };\n }\n}\n","import { Command, Option } from \"commander\";\nimport { CONNECTOR_TYPES } from \"@vm0/connectors/connectors\";\nimport {\n getConnectorFirewall,\n isFirewallConnectorType,\n} from \"@vm0/connectors/firewalls\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolvePermissionChangeContext } from \"./permission-context\";\nimport { getPlatformOrigin } from \"./platform-url\";\n\nfunction findPermissionInConfig(ref: string, permissionName: string): boolean {\n if (!isFirewallConnectorType(ref)) return false;\n const config = getConnectorFirewall(ref);\n for (const api of config.apis) {\n if (!api.permissions) continue;\n for (const p of api.permissions) {\n if (p.name === permissionName) return true;\n }\n }\n return false;\n}\n\n// Keep legacy approval request reasons short enough for permission-page URLs.\nconst REASON_MAX_LENGTH = 500;\ntype PermissionAction = \"enable\" | \"disable\";\ntype PermissionChangeRole = Awaited<\n ReturnType<typeof resolvePermissionChangeContext>\n>[\"role\"];\n\nfunction addReasonParam(\n urlParams: URLSearchParams,\n role: PermissionChangeRole,\n usesUserGrants: boolean,\n reason?: string,\n): void {\n if (usesUserGrants || role !== \"member\" || !reason) return;\n\n const truncated =\n reason.length > REASON_MAX_LENGTH\n ? reason.slice(0, REASON_MAX_LENGTH)\n : reason;\n urlParams.set(\"reason\", truncated);\n}\n\nfunction printSensitivePermissionGuidance(\n connectorRef: string,\n permission: string,\n action: PermissionAction,\n usesUserGrants: boolean,\n): void {\n if (action !== \"enable\") return;\n\n const approvalWording = usesUserGrants\n ? \"Only allow this permission below\"\n : \"Only request user approval below\";\n\n // Slack chat:write: strongly recommend bot-based messaging over user identity\n if (connectorRef === \"slack\" && permission === \"chat:write\") {\n console.log(\"\");\n console.log(\n \"IMPORTANT: Granting chat:write allows sending messages AS THE USER's identity, not as a bot.\",\n );\n console.log(\n \"Use `zero slack message send -c <channel> -t <text>` to send messages as the bot instead — this is the recommended approach for most use cases.\",\n );\n console.log(\n `${approvalWording} if acting as the user is specifically required.`,\n );\n console.log(\"\");\n }\n\n // Gmail gmail.send: strongly recommend draft-based workflow over direct send\n if (connectorRef === \"gmail\" && permission === \"gmail.send\") {\n console.log(\"\");\n console.log(\n \"IMPORTANT: Granting gmail.send allows the agent to send emails directly as the user.\",\n );\n console.log(\n \"Consider keeping gmail.send disabled and using gmail.compose instead — the agent can create drafts for the user to review and send manually.\",\n );\n console.log(\n `${approvalWording} if direct sending is specifically required.`,\n );\n console.log(\"\");\n }\n}\n\nfunction printPermissionActionMessage(args: {\n readonly usesUserGrants: boolean;\n readonly action: PermissionAction;\n readonly role: PermissionChangeRole;\n readonly permission: string;\n readonly label: string;\n readonly url: string;\n readonly reason?: string;\n}): void {\n if (args.usesUserGrants) {\n const grantAction = args.action === \"enable\" ? \"allow\" : \"deny\";\n console.log(\n `You can ${grantAction} the \"${args.permission}\" permission for your connector access: [Manage ${args.label} permissions](${args.url})`,\n );\n return;\n }\n\n if (args.role === \"admin\" || args.role === \"owner\") {\n console.log(\n `You can ${args.action} the \"${args.permission}\" permission directly: [Manage ${args.label} permissions](${args.url})`,\n );\n return;\n }\n\n if (args.role !== \"member\") {\n console.log(\n `To ${args.action} the \"${args.permission}\" permission for ${args.label}: [Manage ${args.label} permissions](${args.url})`,\n );\n return;\n }\n\n if (!args.reason) {\n console.log(\n `IMPORTANT: Re-run with \\`--reason \"one sentence why this is needed\"\\` so the admin can review your request faster.`,\n );\n return;\n }\n\n if (args.action === \"enable\") {\n console.log(\n `Permission changes require admin approval. Request access at: [Request ${args.label} access](${args.url})`,\n );\n return;\n }\n\n console.log(\n `Permission changes require admin approval. Contact an org admin to disable this permission: [View ${args.label} permissions](${args.url})`,\n );\n}\n\nasync function outputPermissionChangeMessage(\n connectorRef: string,\n permission: string,\n action: PermissionAction,\n reason?: string,\n): Promise<void> {\n const { label } =\n CONNECTOR_TYPES[connectorRef as keyof typeof CONNECTOR_TYPES];\n\n const platformOrigin = await getPlatformOrigin();\n const agentId = process.env.ZERO_AGENT_ID;\n const context = await resolvePermissionChangeContext(agentId || undefined);\n const role = context.role;\n const permissionGrantMode = context.permissionGrantMode;\n const usesUserGrants = permissionGrantMode === \"user-grants\";\n\n const urlParams = new URLSearchParams({\n ref: connectorRef,\n permission,\n action: action === \"enable\" ? \"allow\" : \"deny\",\n });\n addReasonParam(urlParams, role, usesUserGrants, reason);\n\n const pagePath = agentId ? `/agents/${agentId}/permissions` : \"/agents\";\n const url = `${platformOrigin}${pagePath}?${urlParams.toString()}`;\n\n printSensitivePermissionGuidance(\n connectorRef,\n permission,\n action,\n usesUserGrants,\n );\n printPermissionActionMessage({\n usesUserGrants,\n action,\n role,\n permission,\n label,\n url,\n reason,\n });\n}\n\nexport const permissionChangeCommand = new Command()\n .name(\"permission-change\")\n .description(\"Change or request a permission (enable or disable)\")\n .argument(\"<connector-ref>\", \"The connector type (e.g. github)\")\n .addOption(\n new Option(\n \"--permission <name>\",\n \"The permission name to change\",\n ).makeOptionMandatory(),\n )\n .addOption(\n new Option(\n \"--enable\",\n \"Enable or request enabling the permission\",\n ).conflicts(\"disable\"),\n )\n .addOption(\n new Option(\n \"--disable\",\n \"Disable or request disabling the permission\",\n ).conflicts(\"enable\"),\n )\n .addOption(\n new Option(\n \"--reason <text>\",\n \"Brief reason for admin approval requests (max 500 chars)\",\n ),\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n zero doctor permission-change github --permission contents:read --enable\n zero doctor permission-change slack --permission chat:write --disable\n\nNotes:\n - Outputs a platform URL for the user to adjust the permission\n - Depending on rollout state, members either request approval or manage their own permission grants`,\n )\n .action(\n withErrorHandler(\n async (\n connectorRef: string,\n opts: {\n permission: string;\n enable?: boolean;\n disable?: boolean;\n reason?: string;\n },\n ) => {\n if (!opts.enable && !opts.disable) {\n throw new Error(\"Either --enable or --disable is required\");\n }\n\n if (!isFirewallConnectorType(connectorRef)) {\n throw new Error(`Unknown connector type: ${connectorRef}`);\n }\n\n if (!findPermissionInConfig(connectorRef, opts.permission)) {\n throw new Error(\n `Unknown permission \"${opts.permission}\" for ${connectorRef}`,\n );\n }\n\n const action = opts.enable ? \"enable\" : \"disable\";\n await outputPermissionChangeMessage(\n connectorRef,\n opts.permission,\n action,\n opts.reason,\n );\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\n\nimport {\n getZeroBillingStatus,\n getZeroOrg,\n getZeroOrgMembers,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nfunction memberName(member: {\n readonly email: string;\n readonly firstName: string | null;\n readonly lastName: string | null;\n}): string {\n const name = [member.firstName, member.lastName].filter(Boolean).join(\" \");\n return name ? `${name} <${member.email}>` : member.email;\n}\n\nexport const creditCommand = new Command()\n .name(\"credit\")\n .description(\"Diagnose current organization credit and purchase access\")\n .action(\n withErrorHandler(async () => {\n const [org, billing, members] = await Promise.all([\n getZeroOrg(),\n getZeroBillingStatus(),\n getZeroOrgMembers(),\n ]);\n const admins = members.members.filter((member) => {\n return member.role === \"admin\";\n });\n const isAdmin = members.role === \"admin\";\n const canPurchaseCredits = isAdmin;\n\n console.log(chalk.bold(\"Credit diagnostics:\"));\n console.log(` Org: ${chalk.green(org.slug)}`);\n console.log(` Tier: ${chalk.cyan(billing.tier)}`);\n console.log(\n ` Available credits: ${chalk.cyan(billing.credits.toLocaleString())}`,\n );\n console.log(` Current user role: ${chalk.cyan(members.role)}`);\n console.log(\n ` Can purchase credits: ${\n canPurchaseCredits ? chalk.green(\"yes\") : chalk.yellow(\"no\")\n }`,\n );\n console.log(\n ` Auto-recharge: ${\n billing.autoRecharge.enabled ? chalk.green(\"enabled\") : \"disabled\"\n }`,\n );\n if (billing.autoRecharge.enabled) {\n console.log(\n ` Threshold: ${billing.autoRecharge.threshold?.toLocaleString() ?? \"not set\"}`,\n );\n console.log(\n ` Amount: ${billing.autoRecharge.amount?.toLocaleString() ?? \"not set\"}`,\n );\n }\n\n if (!isAdmin) {\n console.log(chalk.bold(\"\\nOrganization admins:\"));\n for (const admin of admins) {\n console.log(` - ${memberName(admin)}`);\n }\n console.log(\n chalk.yellow(\n \"\\nAsk an organization admin to buy credits or upgrade the plan.\",\n ),\n );\n } else if (billing.tier === \"free\") {\n console.log(\n \"\\nFree-tier admins can upgrade to Pro from billing or buy credits with `zero credit <credits>`.\",\n );\n } else {\n console.log(\"\\nUse `zero credit <credits>` to buy more credits.\");\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n getZeroUserPreferences,\n updateZeroUserPreferences,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { isInteractive, promptText } from \"../../../lib/utils/prompt-utils\";\n\n/**\n * Detect system timezone using Intl API\n */\nfunction detectTimezone(): string {\n return Intl.DateTimeFormat().resolvedOptions().timeZone;\n}\n\n/**\n * Validate timezone using Intl.DateTimeFormat\n */\nfunction isValidTimezone(timezone: string): boolean {\n try {\n Intl.DateTimeFormat(undefined, { timeZone: timezone });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Display current preferences\n */\nfunction displayPreferences(prefs: { timezone: string | null }): void {\n console.log(chalk.bold(\"Current preferences:\"));\n console.log(\n ` Timezone: ${prefs.timezone ? chalk.cyan(prefs.timezone) : chalk.dim(\"not set\")}`,\n );\n}\n\ninterface PreferenceOpts {\n timezone?: string;\n}\n\n/**\n * Build updates from CLI flags, exiting on invalid input\n */\nfunction buildUpdates(opts: PreferenceOpts): { timezone?: string } | null {\n if (opts.timezone === undefined) return null;\n\n if (!isValidTimezone(opts.timezone)) {\n throw new Error(`Invalid timezone: ${opts.timezone}`, {\n cause: new Error(\n \"Use an IANA timezone identifier (e.g., America/New_York, Asia/Shanghai)\",\n ),\n });\n }\n\n return { timezone: opts.timezone };\n}\n\n/**\n * Print confirmation after a successful update\n */\nfunction printUpdateResult(\n updates: { timezone?: string },\n result: { timezone: string | null },\n): void {\n if (updates.timezone !== undefined) {\n console.log(\n chalk.green(\n `Timezone set to ${chalk.cyan(result.timezone ?? updates.timezone)}`,\n ),\n );\n }\n}\n\n/**\n * Interactive prompts when no flags provided\n */\nasync function interactiveSetup(prefs: {\n timezone: string | null;\n}): Promise<void> {\n if (!prefs.timezone) {\n const detectedTz = detectTimezone();\n console.log(chalk.dim(`\\nSystem timezone detected: ${detectedTz}`));\n const tz = await promptText(\n \"Set timezone? (enter timezone or leave empty to skip)\",\n detectedTz,\n );\n if (tz?.trim()) {\n if (!isValidTimezone(tz.trim())) {\n throw new Error(`Invalid timezone: ${tz.trim()}`);\n }\n await updateZeroUserPreferences({ timezone: tz.trim() });\n console.log(chalk.green(`Timezone set to ${chalk.cyan(tz.trim())}`));\n }\n }\n}\n\n/**\n * zero preference\n *\n * View or update user preferences (timezone).\n */\nexport const zeroPreferenceCommand = new Command()\n .name(\"preference\")\n .description(\"View or update user preferences (timezone, notifications)\")\n .option(\"--timezone <timezone>\", \"IANA timezone (e.g., America/New_York)\")\n .action(\n withErrorHandler(async (opts: PreferenceOpts) => {\n const updates = buildUpdates(opts);\n\n if (updates) {\n const result = await updateZeroUserPreferences(updates);\n printUpdateResult(updates, result);\n return;\n }\n\n // No flags: display current preferences\n const prefs = await getZeroUserPreferences();\n displayPreferences(prefs);\n\n if (isInteractive()) {\n await interactiveSetup(prefs);\n } else if (!prefs.timezone) {\n console.log();\n console.log(\n `To set timezone: ${chalk.cyan(\"zero preference --timezone <timezone>\")}`,\n );\n console.log(\n chalk.dim(\"Example: zero preference --timezone America/New_York\"),\n );\n }\n }),\n );\n","import { mainRunCommand } from \"./run\";\nimport { continueCommand } from \"./continue\";\n\nmainRunCommand.addCommand(continueCommand);\n\nmainRunCommand.addHelpText(\n \"after\",\n `\nExamples:\n Discover teammates: zero agent list\n Delegate a task: zero run <agent-id> \"your task\"\n Continue delegation: zero run continue <session-id> \"follow up\"`,\n);\n\nexport const zeroRunCommand = mainRunCommand;\n","import { Command, Option } from \"commander\";\nimport { createZeroRun } from \"../../../lib/api\";\nimport { isUUID, renderRunCreated } from \"../../run/shared\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { pollZeroEvents, showZeroNextSteps } from \"./shared\";\n\nexport const mainRunCommand = new Command()\n .name(\"run\")\n .description(\"Delegate a task to a teammate agent\")\n .argument(\"<agent-id>\", \"Agent UUID (from `zero agent list`)\")\n .argument(\"<prompt>\", \"Task prompt for the agent\")\n .option(\n \"--model-provider <type>\",\n \"Override model provider (e.g., anthropic-api-key)\",\n )\n .option(\"--verbose\", \"Show full tool inputs and outputs\")\n .addOption(new Option(\"--debug-no-mock-claude\").hideHelp())\n .addOption(new Option(\"--debug-no-mock-codex\").hideHelp())\n .addHelpText(\n \"after\",\n `\nExamples:\n Delegate a task: zero run <agent-id> \"summarize the latest issues\"\n With verbose output: zero run <agent-id> \"fix the bug\" --verbose\n\nNotes:\n - Get agent IDs from \"zero agent list\"\n - The command streams events until the delegated run completes\n - On success, a session ID is printed for follow-up with \"zero run continue\"`,\n )\n .action(\n withErrorHandler(\n async (\n agentId: string,\n prompt: string,\n options: {\n modelProvider?: string;\n verbose?: boolean;\n debugNoMockClaude?: boolean;\n debugNoMockCodex?: boolean;\n },\n ) => {\n // 1. Validate agent-id is a UUID\n if (!isUUID(agentId)) {\n throw new Error(`Invalid agent ID format: ${agentId}`, {\n cause: new Error(\n \"Agent ID must be a valid UUID. Use `zero agent list` to find agent IDs.\",\n ),\n });\n }\n\n // 2. Create zero run\n const response = await createZeroRun({\n agentId,\n prompt,\n modelProvider: options.modelProvider,\n debugNoMockClaude: options.debugNoMockClaude,\n debugNoMockCodex: options.debugNoMockCodex,\n });\n\n // 3. Check for immediate failure\n if (response.status === \"failed\") {\n throw new Error(\n \"Run preparation failed\",\n response.error ? { cause: new Error(response.error) } : undefined,\n );\n }\n\n // 4. Display run started/queued info\n renderRunCreated(response);\n\n // 5. Poll for events\n const result = await pollZeroEvents(response.runId, {\n verbose: options.verbose,\n });\n if (!result.succeeded) {\n throw new Error(\"Run failed\");\n }\n\n // 6. Show next steps\n showZeroNextSteps(result);\n },\n ),\n );\n","import chalk from \"chalk\";\nimport { getZeroRunAgentEvents, getZeroRun } from \"../../../lib/api\";\nimport type { RunResult } from \"../../../lib/api\";\nimport { EventStreamNormalizer } from \"../../../lib/events/event-stream-normalizer\";\nimport { EventRenderer } from \"../../../lib/events/event-renderer\";\nimport type { PollResult, EventRenderingOptions } from \"../../run/shared\";\n\ninterface SequencedEvent {\n sequenceNumber: number;\n}\n\ntype ZeroRunResponse = Awaited<ReturnType<typeof getZeroRun>>;\ntype TerminalRunStatus = \"completed\" | \"failed\" | \"timeout\" | \"cancelled\";\ntype TerminalRunResponse = ZeroRunResponse & { status: TerminalRunStatus };\n\nconst TERMINAL_RUN_STATUSES: readonly TerminalRunStatus[] = [\n \"completed\",\n \"failed\",\n \"timeout\",\n \"cancelled\",\n];\n\n/**\n * Safely narrow GetRunResponse.result to RunResult.\n * GetRunResponse.result has all fields optional (due to .passthrough()),\n * but RunResult requires checkpointId, agentSessionId, conversationId.\n * Extra fields (artifact, volumes) are preserved at runtime via passthrough.\n */\nfunction toRunResult(result: {\n output?: string;\n executionTimeMs?: number;\n agentSessionId?: string;\n checkpointId?: string;\n conversationId?: string;\n}): RunResult | undefined {\n const { checkpointId, agentSessionId, conversationId } = result;\n if (!checkpointId || !agentSessionId || !conversationId) {\n return undefined;\n }\n return { checkpointId, agentSessionId, conversationId };\n}\n\nfunction filterContiguousEvents<T extends SequencedEvent>(\n events: T[],\n lastSequence: number,\n): T[] {\n const contiguousEvents: T[] = [];\n let expectedSequence = lastSequence + 1;\n\n for (const event of events) {\n if (event.sequenceNumber < expectedSequence) {\n continue;\n }\n if (event.sequenceNumber !== expectedSequence) {\n break;\n }\n contiguousEvents.push(event);\n expectedSequence++;\n }\n\n return contiguousEvents;\n}\n\nconst POLL_INTERVAL_MS = 1000;\nconst TERMINAL_DRAIN_POLL_INTERVAL_MS = 500;\nconst TERMINAL_DRAIN_IDLE_MS = 1000;\nconst TERMINAL_DRAIN_MAX_MS = 3000;\n\nfunction isTerminalRunResponse(\n runResponse: ZeroRunResponse,\n): runResponse is TerminalRunResponse {\n return TERMINAL_RUN_STATUSES.includes(\n runResponse.status as TerminalRunStatus,\n );\n}\n\nfunction shouldDrainNextEventPage<T>(\n eventsResponse: { hasMore: boolean; events: T[] },\n contiguousEvents: T[],\n): boolean {\n return (\n eventsResponse.hasMore &&\n contiguousEvents.length > 0 &&\n contiguousEvents.length === eventsResponse.events.length\n );\n}\n\nfunction hasSequenceGap<T>(\n eventsResponse: { events: T[] },\n contiguousEvents: T[],\n): boolean {\n return (\n eventsResponse.events.length > 0 &&\n contiguousEvents.length < eventsResponse.events.length\n );\n}\n\nfunction shouldCompleteTerminalDrain(\n terminalSeenAt: number,\n lastTerminalProgressAt: number,\n blockedByGap: boolean,\n): boolean {\n const now = Date.now();\n const terminalElapsedMs = now - terminalSeenAt;\n const terminalIdleMs = now - lastTerminalProgressAt;\n return (\n terminalElapsedMs >= TERMINAL_DRAIN_MAX_MS ||\n (!blockedByGap && terminalIdleMs >= TERMINAL_DRAIN_IDLE_MS)\n );\n}\n\nfunction renderTerminalRunResult(\n runId: string,\n runResponse: TerminalRunResponse,\n): PollResult {\n if (runResponse.status === \"completed\") {\n EventRenderer.renderRunCompleted(\n runResponse.result ? toRunResult(runResponse.result) : undefined,\n );\n return {\n succeeded: true,\n runId,\n sessionId: runResponse.result?.agentSessionId,\n checkpointId: runResponse.result?.checkpointId,\n };\n }\n\n if (runResponse.status === \"failed\") {\n EventRenderer.renderRunFailed(runResponse.error, runId);\n return { succeeded: false, runId };\n }\n\n if (runResponse.status === \"timeout\") {\n console.error(chalk.red(\"\\n✗ Run timed out\"));\n return { succeeded: false, runId };\n }\n\n console.error(chalk.yellow(\"\\n✗ Run cancelled\"));\n return { succeeded: false, runId };\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => {\n return setTimeout(resolve, ms);\n });\n}\n\n/**\n * Poll for zero run events until run completes.\n * Uses dual-poll approach: telemetry endpoint for events, getById for status.\n */\nexport async function pollZeroEvents(\n runId: string,\n options?: EventRenderingOptions,\n): Promise<PollResult> {\n const renderer = new EventRenderer({ verbose: options?.verbose });\n const normalizer = new EventStreamNormalizer();\n\n let lastSequence = -1;\n let complete = false;\n let result: PollResult = { succeeded: true, runId };\n let terminalRunResponse: TerminalRunResponse | undefined;\n let terminalSeenAt = 0;\n let lastTerminalProgressAt = 0;\n const flushPendingEvents = (): void => {\n for (const parsed of normalizer.flush()) {\n renderer.render(parsed);\n }\n };\n\n while (!complete) {\n // 1. Fetch events from telemetry endpoint\n const eventsResponse = await getZeroRunAgentEvents(runId, {\n since: lastSequence,\n limit: 100,\n order: \"asc\",\n });\n\n const contiguousEvents = filterContiguousEvents(\n eventsResponse.events,\n lastSequence,\n );\n\n // 2. Parse and render each event\n for (const event of contiguousEvents) {\n const parsedEvents = normalizer.process(\n event.eventData,\n eventsResponse.framework,\n );\n for (const parsed of parsedEvents) {\n renderer.render(parsed);\n }\n }\n\n // 3. Track last sequence number for pagination\n if (contiguousEvents.length > 0) {\n lastSequence =\n contiguousEvents[contiguousEvents.length - 1]!.sequenceNumber;\n if (terminalRunResponse) {\n lastTerminalProgressAt = Date.now();\n }\n }\n\n const blockedByGap = hasSequenceGap(eventsResponse, contiguousEvents);\n\n // If this page is fully contiguous and the server says more are already\n // queryable, drain the next page before checking terminal status. Otherwise\n // a completed run with >100 unseen events would render only the final page's\n // first batch and then exit.\n if (shouldDrainNextEventPage(eventsResponse, contiguousEvents)) {\n continue;\n }\n\n // 4. Fetch run status separately. During terminal drain, keep the latest\n // terminal state because timeout runs can still be upgraded to completed.\n const runResponse = await getZeroRun(runId);\n if (isTerminalRunResponse(runResponse)) {\n if (!terminalRunResponse) {\n terminalSeenAt = Date.now();\n lastTerminalProgressAt = terminalSeenAt;\n }\n terminalRunResponse = runResponse;\n }\n\n if (terminalRunResponse) {\n if (\n shouldCompleteTerminalDrain(\n terminalSeenAt,\n lastTerminalProgressAt,\n blockedByGap,\n )\n ) {\n flushPendingEvents();\n result = renderTerminalRunResult(runId, terminalRunResponse);\n complete = true;\n }\n }\n\n if (!complete) {\n await sleep(\n terminalRunResponse\n ? TERMINAL_DRAIN_POLL_INTERVAL_MS\n : POLL_INTERVAL_MS,\n );\n }\n }\n\n return result;\n}\n\n/**\n * Display next steps after successful zero run\n */\nexport function showZeroNextSteps(result: PollResult): void {\n const { sessionId } = result;\n\n console.log();\n\n if (sessionId) {\n console.log(\" Continue delegation:\");\n console.log(\n chalk.cyan(` zero run continue ${sessionId} \"your next prompt\"`),\n );\n }\n}\n","import { Command } from \"commander\";\nimport { createZeroRun } from \"../../../lib/api\";\nimport { isUUID, renderRunCreated } from \"../../run/shared\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { pollZeroEvents, showZeroNextSteps } from \"./shared\";\n\nexport const continueCommand = new Command()\n .name(\"continue\")\n .description(\"Continue a previous delegation from a session\")\n .argument(\"<session-id>\", \"Session ID from a previous run\")\n .argument(\"<prompt>\", \"Follow-up prompt for the agent\")\n .option(\n \"--model-provider <type>\",\n \"Override model provider (e.g., anthropic-api-key)\",\n )\n .option(\"--verbose\", \"Show full tool inputs and outputs\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero run continue <session-id> \"now deploy it\"\n zero run continue <session-id> \"add tests\" --verbose\n\nNotes:\n - The session ID is printed after a successful \"zero run\" delegation\n - Continues the same agent session with full prior context`,\n )\n .action(\n withErrorHandler(\n async (\n sessionId: string,\n prompt: string,\n options: {\n modelProvider?: string;\n verbose?: boolean;\n },\n ) => {\n // 1. Validate session-id is a UUID\n if (!isUUID(sessionId)) {\n throw new Error(`Invalid session ID format: ${sessionId}`, {\n cause: new Error(\"Session ID must be a valid UUID\"),\n });\n }\n\n // 2. Create zero run with sessionId (no agentId needed)\n const response = await createZeroRun({\n sessionId,\n prompt,\n modelProvider: options.modelProvider,\n });\n\n // 3. Check for immediate failure\n if (response.status === \"failed\") {\n throw new Error(\n \"Run preparation failed\",\n response.error ? { cause: new Error(response.error) } : undefined,\n );\n }\n\n // 4. Display run started/queued info\n renderRunCreated(response);\n\n // 5. Poll for events\n const result = await pollZeroEvents(response.runId, {\n verbose: options.verbose,\n });\n if (!result.succeeded) {\n throw new Error(\"Run failed\");\n }\n\n // 6. Show next steps\n showZeroNextSteps(result);\n },\n ),\n );\n","import { Command } from \"commander\";\nimport { setupCommand } from \"./setup\";\nimport { listCommand } from \"./list\";\nimport { statusCommand } from \"./status\";\nimport { deleteCommand } from \"./delete\";\nimport { enableCommand } from \"./enable\";\nimport { disableCommand } from \"./disable\";\n\nexport const zeroScheduleCommand = new Command()\n .name(\"schedule\")\n .description(\"Create or manage recurring scheduled tasks\")\n .addCommand(setupCommand)\n .addCommand(listCommand)\n .addCommand(statusCommand)\n .addCommand(deleteCommand)\n .addCommand(enableCommand)\n .addCommand(disableCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Create a schedule: zero schedule setup --help\n Check all schedules: zero schedule list\n Check schedule status: zero schedule status <agent-id>\n Pause a schedule: zero schedule disable <agent-id>\n Resume a schedule: zero schedule enable <agent-id>\n Delete a schedule: zero schedule delete <agent-id>`,\n );\n","import { Command } from \"commander\";\nimport { readFileSync } from \"node:fs\";\nimport chalk from \"chalk\";\nimport {\n isInteractive,\n promptText,\n promptSelect,\n promptConfirm,\n} from \"../../../lib/utils/prompt-utils\";\nimport {\n generateCronExpression,\n detectTimezone,\n validateTimeFormat,\n validateDateFormat,\n getTomorrowDateLocal,\n getCurrentTimeLocal,\n toISODateTime,\n type ScheduleFrequency,\n} from \"../../../lib/domain/schedule-utils\";\nimport {\n resolveCompose,\n deployZeroSchedule,\n listZeroSchedules,\n enableZeroSchedule,\n getZeroUserPreferences,\n ApiRequestError,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nconst FREQUENCY_CHOICES = [\n { title: \"Daily\", value: \"daily\" as const, description: \"Run every day\" },\n {\n title: \"Weekly\",\n value: \"weekly\" as const,\n description: \"Run once per week\",\n },\n {\n title: \"Monthly\",\n value: \"monthly\" as const,\n description: \"Run once per month\",\n },\n {\n title: \"One-time\",\n value: \"once\" as const,\n description: \"Run once at specific time\",\n },\n {\n title: \"Loop\",\n value: \"loop\" as const,\n description: \"Run repeatedly at fixed intervals\",\n },\n];\n\nconst DAY_OF_WEEK_CHOICES = [\n { title: \"Monday\", value: 1 },\n { title: \"Tuesday\", value: 2 },\n { title: \"Wednesday\", value: 3 },\n { title: \"Thursday\", value: 4 },\n { title: \"Friday\", value: 5 },\n { title: \"Saturday\", value: 6 },\n { title: \"Sunday\", value: 0 },\n];\n\nfunction parseDayOption(\n day: string,\n frequency: ScheduleFrequency,\n): number | undefined {\n if (frequency === \"weekly\") {\n const dayMap: Record<string, number> = {\n sun: 0,\n mon: 1,\n tue: 2,\n wed: 3,\n thu: 4,\n fri: 5,\n sat: 6,\n };\n return dayMap[day.toLowerCase()];\n } else if (frequency === \"monthly\") {\n const num = parseInt(day, 10);\n if (num >= 1 && num <= 31) {\n return num;\n }\n }\n return undefined;\n}\n\nfunction formatInTimezone(isoDate: string, timezone: string): string {\n const date = new Date(isoDate);\n const parts = new Intl.DateTimeFormat(\"en-CA\", {\n timeZone: timezone,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n }).formatToParts(date);\n\n const get = (type: string) => {\n return (\n parts.find((p) => {\n return p.type === type;\n })?.value ?? \"\"\n );\n };\n return `${get(\"year\")}-${get(\"month\")}-${get(\"day\")} ${get(\"hour\")}:${get(\"minute\")}`;\n}\n\nfunction parseFrequencyFromCron(\n cron: string,\n): { frequency: ScheduleFrequency; day?: number; time: string } | null {\n const parts = cron.split(\" \");\n if (parts.length !== 5) return null;\n\n const [minute, hour, dayOfMonth, , dayOfWeek] = parts;\n const time = `${hour!.padStart(2, \"0\")}:${minute!.padStart(2, \"0\")}`;\n\n if (dayOfMonth === \"*\" && dayOfWeek === \"*\") {\n return { frequency: \"daily\", time };\n } else if (dayOfMonth === \"*\" && dayOfWeek !== \"*\") {\n return { frequency: \"weekly\", day: parseInt(dayOfWeek!, 10), time };\n } else if (dayOfMonth !== \"*\" && dayOfWeek === \"*\") {\n return { frequency: \"monthly\", day: parseInt(dayOfMonth!, 10), time };\n }\n\n return null;\n}\n\ninterface SetupOptions {\n name?: string;\n frequency?: string;\n time?: string;\n day?: string;\n interval?: string;\n timezone?: string;\n prompt?: string;\n promptFile?: string;\n enable?: boolean;\n}\n\ninterface ExistingScheduleDefaults {\n frequency?: ScheduleFrequency;\n day?: number;\n time?: string;\n intervalSeconds?: number;\n}\n\ninterface ScheduleListItem {\n name: string;\n agentId: string;\n triggerType?: \"cron\" | \"once\" | \"loop\";\n cronExpression?: string | null;\n atTime?: string | null;\n intervalSeconds?: number | null;\n timezone: string;\n prompt: string;\n enabled?: boolean;\n}\n\nfunction getExistingDefaults(\n existingSchedule: ScheduleListItem | undefined,\n): ExistingScheduleDefaults {\n const defaults: ExistingScheduleDefaults = {};\n\n if (existingSchedule?.triggerType === \"loop\") {\n defaults.frequency = \"loop\";\n defaults.intervalSeconds = existingSchedule.intervalSeconds ?? undefined;\n } else if (existingSchedule?.cronExpression) {\n const parsed = parseFrequencyFromCron(existingSchedule.cronExpression);\n if (parsed) {\n defaults.frequency = parsed.frequency;\n defaults.day = parsed.day;\n defaults.time = parsed.time;\n }\n } else if (existingSchedule?.atTime) {\n defaults.frequency = \"once\";\n }\n\n return defaults;\n}\n\nasync function gatherFrequency(\n optionFrequency: string | undefined,\n existingFrequency: ScheduleFrequency | undefined,\n): Promise<ScheduleFrequency | null> {\n let frequency = optionFrequency as ScheduleFrequency | undefined;\n\n if (\n frequency &&\n [\"daily\", \"weekly\", \"monthly\", \"once\", \"loop\"].includes(frequency)\n ) {\n return frequency;\n }\n\n if (!isInteractive()) {\n throw new Error(\"--frequency is required (daily|weekly|monthly|once|loop)\");\n }\n\n const defaultIndex = existingFrequency\n ? FREQUENCY_CHOICES.findIndex((c) => {\n return c.value === existingFrequency;\n })\n : 0;\n\n frequency = await promptSelect<ScheduleFrequency>(\n \"Schedule frequency\",\n FREQUENCY_CHOICES,\n defaultIndex >= 0 ? defaultIndex : 0,\n );\n\n return frequency || null;\n}\n\nasync function gatherDay(\n frequency: ScheduleFrequency,\n optionDay: string | undefined,\n existingDay: number | undefined,\n): Promise<number | null> {\n if (frequency !== \"weekly\" && frequency !== \"monthly\") {\n return null;\n }\n\n if (optionDay) {\n const day = parseDayOption(optionDay, frequency);\n if (day === undefined) {\n throw new Error(\n `Invalid day: ${optionDay}. Use mon-sun for weekly or 1-31 for monthly.`,\n );\n }\n return day;\n }\n\n if (!isInteractive()) {\n throw new Error(\"--day is required for weekly/monthly\");\n }\n\n if (frequency === \"weekly\") {\n const defaultDayIndex =\n existingDay !== undefined\n ? DAY_OF_WEEK_CHOICES.findIndex((c) => {\n return c.value === existingDay;\n })\n : 0;\n const day = await promptSelect(\n \"Day of week\",\n DAY_OF_WEEK_CHOICES,\n defaultDayIndex >= 0 ? defaultDayIndex : 0,\n );\n return day ?? null;\n }\n\n const dayStr = await promptText(\n \"Day of month (1-31)\",\n existingDay?.toString() || \"1\",\n );\n if (!dayStr) return null;\n\n const day = parseInt(dayStr, 10);\n if (isNaN(day) || day < 1 || day > 31) {\n throw new Error(\"Day must be between 1 and 31\");\n }\n return day;\n}\n\nasync function gatherRecurringTime(\n optionTime: string | undefined,\n existingTime: string | undefined,\n): Promise<string | undefined> {\n if (optionTime) {\n const validation = validateTimeFormat(optionTime);\n if (validation !== true) {\n throw new Error(`Invalid time: ${validation}`);\n }\n return optionTime;\n }\n\n if (!isInteractive()) {\n throw new Error(\"--time is required (HH:MM format)\");\n }\n\n return await promptText(\n \"Time (HH:MM)\",\n existingTime || \"09:00\",\n validateTimeFormat,\n );\n}\n\nasync function gatherOneTimeSchedule(\n optionDay: string | undefined,\n optionTime: string | undefined,\n existingTime: string | undefined,\n): Promise<string | null> {\n if (optionDay && optionTime) {\n if (!validateDateFormat(optionDay)) {\n throw new Error(\n `Invalid date format: ${optionDay}. Use YYYY-MM-DD format.`,\n );\n }\n if (!validateTimeFormat(optionTime)) {\n throw new Error(`Invalid time format: ${optionTime}. Use HH:MM format.`);\n }\n return `${optionDay} ${optionTime}`;\n }\n\n if (!isInteractive()) {\n throw new Error(\"One-time schedules require interactive mode\", {\n cause: new Error(\n \"Or provide --day (YYYY-MM-DD) and --time (HH:MM) flags\",\n ),\n });\n }\n\n const tomorrowDate = getTomorrowDateLocal();\n const date = await promptText(\n \"Date (YYYY-MM-DD, default tomorrow)\",\n tomorrowDate,\n validateDateFormat,\n );\n if (!date) return null;\n\n const currentTime = getCurrentTimeLocal();\n const time = await promptText(\n \"Time (HH:MM)\",\n existingTime || currentTime,\n validateTimeFormat,\n );\n if (!time) return null;\n\n return `${date} ${time}`;\n}\n\nasync function gatherTimezone(\n optionTimezone: string | undefined,\n existingTimezone: string | undefined | null,\n): Promise<string | undefined> {\n if (optionTimezone) return optionTimezone;\n\n let userTimezone: string | null = null;\n try {\n const prefs = await getZeroUserPreferences();\n userTimezone = prefs.timezone;\n } catch {\n console.log(\n chalk.dim(\"Could not fetch timezone preference, using detected timezone\"),\n );\n }\n\n const defaultTimezone = userTimezone || detectTimezone();\n\n if (!isInteractive()) {\n return defaultTimezone;\n }\n\n return await promptText(\"Timezone\", existingTimezone || defaultTimezone);\n}\n\nasync function gatherPromptText(\n optionPrompt: string | undefined,\n optionPromptFile: string | undefined,\n existingPrompt: string | undefined | null,\n): Promise<string | undefined> {\n if (optionPrompt && optionPromptFile) {\n throw new Error(\"Cannot use --prompt and --prompt-file together\");\n }\n\n if (optionPromptFile) {\n return readFileSync(optionPromptFile, \"utf-8\");\n }\n\n if (optionPrompt) return optionPrompt;\n\n if (!isInteractive()) {\n throw new Error(\"--prompt or --prompt-file is required\");\n }\n\n return await promptText(\n \"Prompt to run\",\n existingPrompt || \"let's start working.\",\n );\n}\n\nasync function gatherInterval(\n optionInterval: string | undefined,\n existingInterval: number | undefined,\n): Promise<number | null> {\n if (optionInterval) {\n const val = parseInt(optionInterval, 10);\n if (isNaN(val) || val < 0) {\n throw new Error(\n \"Invalid interval. Must be a non-negative integer (seconds)\",\n );\n }\n return val;\n }\n\n if (!isInteractive()) {\n throw new Error(\"--interval is required for loop schedules (seconds)\");\n }\n\n const defaultVal =\n existingInterval !== undefined ? String(existingInterval) : \"300\";\n const result = await promptText(\n \"Interval in seconds (time between runs)\",\n defaultVal,\n (v: string) => {\n const n = parseInt(v, 10);\n if (isNaN(n) || n < 0) return \"Must be a non-negative integer\";\n return true;\n },\n );\n if (!result) return null;\n return parseInt(result, 10);\n}\n\nasync function gatherTiming(\n frequency: ScheduleFrequency,\n options: SetupOptions,\n defaults: ExistingScheduleDefaults,\n): Promise<{\n day: number | undefined;\n time: string | undefined;\n atTime: string | undefined;\n intervalSeconds: number | undefined;\n} | null> {\n if (frequency === \"loop\") {\n const intervalSeconds = await gatherInterval(\n options.interval,\n defaults.intervalSeconds,\n );\n if (intervalSeconds === null) return null;\n return {\n day: undefined,\n time: undefined,\n atTime: undefined,\n intervalSeconds,\n };\n }\n\n if (frequency === \"once\") {\n const result = await gatherOneTimeSchedule(\n options.day,\n options.time,\n defaults.time,\n );\n if (!result) return null;\n return {\n day: undefined,\n time: undefined,\n atTime: result,\n intervalSeconds: undefined,\n };\n }\n\n const day =\n (await gatherDay(frequency, options.day, defaults.day)) ?? undefined;\n if (day === null && (frequency === \"weekly\" || frequency === \"monthly\")) {\n return null;\n }\n\n const time = await gatherRecurringTime(options.time, defaults.time);\n if (!time) return null;\n\n return { day, time, atTime: undefined, intervalSeconds: undefined };\n}\n\nasync function findExistingSchedule(\n agentId: string,\n scheduleName: string,\n): Promise<ScheduleListItem | undefined> {\n const { schedules } = await listZeroSchedules();\n return schedules.find((s) => {\n return s.agentId === agentId && s.name === scheduleName;\n });\n}\n\ninterface DeployResult {\n created: boolean;\n schedule: {\n triggerType?: \"cron\" | \"once\" | \"loop\";\n timezone: string;\n cronExpression?: string | null;\n nextRunAt?: string | null;\n atTime?: string | null;\n intervalSeconds?: number | null;\n };\n}\n\nasync function buildAndDeploy(params: {\n scheduleName: string;\n agentId: string;\n agentName: string;\n frequency: ScheduleFrequency;\n time: string | undefined;\n day: number | undefined;\n atTime: string | undefined;\n intervalSeconds: number | undefined;\n timezone: string;\n prompt: string;\n existingEnabled: boolean | undefined;\n}): Promise<DeployResult> {\n let cronExpression: string | undefined;\n let atTimeISO: string | undefined;\n\n if (params.frequency === \"loop\") {\n // Loop mode: intervalSeconds is passed directly\n } else if (params.atTime) {\n atTimeISO = toISODateTime(params.atTime);\n } else if (params.time && params.frequency !== \"once\") {\n cronExpression = generateCronExpression(\n params.frequency,\n params.time,\n params.day,\n );\n }\n\n console.log(\n `\\nDeploying schedule for agent ${chalk.cyan(params.agentName)}...`,\n );\n\n // Preserve enabled state on update so loop schedules don't lose nextRunAt.\n // On create, existingEnabled is undefined → omit the field so the server\n // applies its default (disabled; enable happens later via the enable flow).\n const deployResult = await deployZeroSchedule({\n name: params.scheduleName,\n agentId: params.agentId,\n cronExpression,\n atTime: atTimeISO,\n intervalSeconds: params.intervalSeconds,\n timezone: params.timezone,\n prompt: params.prompt,\n ...(params.existingEnabled !== undefined && {\n enabled: params.existingEnabled,\n }),\n });\n\n return deployResult;\n}\n\nfunction displayDeployResult(\n scheduleName: string,\n deployResult: DeployResult,\n): void {\n if (deployResult.created) {\n console.log(chalk.green(`✓ Schedule \"${scheduleName}\" created`));\n } else {\n console.log(chalk.green(`✓ Schedule \"${scheduleName}\" updated`));\n }\n\n console.log(chalk.dim(` Timezone: ${deployResult.schedule.timezone}`));\n\n if (\n deployResult.schedule.triggerType === \"loop\" &&\n deployResult.schedule.intervalSeconds != null\n ) {\n console.log(\n chalk.dim(\n ` Mode: Loop (interval ${deployResult.schedule.intervalSeconds}s)`,\n ),\n );\n } else if (deployResult.schedule.cronExpression) {\n console.log(chalk.dim(` Cron: ${deployResult.schedule.cronExpression}`));\n if (deployResult.schedule.nextRunAt) {\n const nextRun = formatInTimezone(\n deployResult.schedule.nextRunAt,\n deployResult.schedule.timezone,\n );\n console.log(chalk.dim(` Next run: ${nextRun}`));\n }\n } else if (deployResult.schedule.atTime) {\n const atTimeFormatted = formatInTimezone(\n deployResult.schedule.atTime,\n deployResult.schedule.timezone,\n );\n console.log(chalk.dim(` At: ${atTimeFormatted}`));\n }\n}\n\nasync function tryEnableSchedule(\n scheduleName: string,\n agentId: string,\n agentName: string,\n): Promise<void> {\n try {\n await enableZeroSchedule({ name: scheduleName, agentId });\n console.log(chalk.green(`✓ Schedule \"${scheduleName}\" enabled`));\n } catch (error) {\n console.error(chalk.yellow(\"⚠ Failed to enable schedule\"));\n if (error instanceof ApiRequestError) {\n if (error.code === \"SCHEDULE_PAST\") {\n console.error(chalk.dim(\" Scheduled time has already passed\"));\n } else {\n console.error(chalk.dim(` ${error.message}`));\n }\n } else if (error instanceof Error) {\n console.error(chalk.dim(` ${error.message}`));\n }\n console.log(\n ` To enable manually: ${chalk.cyan(`zero schedule enable ${agentName}`)}`,\n );\n }\n}\n\nfunction showEnableHint(agentName: string): void {\n console.log();\n console.log(\n ` To enable: ${chalk.cyan(`zero schedule enable ${agentName}`)}`,\n );\n}\n\nasync function handleScheduleEnabling(params: {\n scheduleName: string;\n agentId: string;\n agentName: string;\n enableFlag: boolean;\n shouldPromptEnable: boolean;\n}): Promise<void> {\n const { scheduleName, agentId, agentName, enableFlag, shouldPromptEnable } =\n params;\n\n if (enableFlag) {\n await tryEnableSchedule(scheduleName, agentId, agentName);\n return;\n }\n\n if (shouldPromptEnable && isInteractive()) {\n const enableNow = await promptConfirm(\"Enable this schedule?\", true);\n if (enableNow) {\n await tryEnableSchedule(scheduleName, agentId, agentName);\n } else {\n showEnableHint(agentName);\n }\n return;\n }\n\n if (shouldPromptEnable) {\n showEnableHint(agentName);\n }\n}\n\nexport const setupCommand = new Command()\n .name(\"setup\")\n .description(\"Create or edit a schedule for a zero agent\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\"-n, --name <schedule-name>\", 'Schedule name (default: \"default\")')\n .option(\"-f, --frequency <type>\", \"Frequency: daily|weekly|monthly|once|loop\")\n .option(\"-t, --time <HH:MM>\", \"Time to run (24-hour format)\")\n .option(\"-d, --day <day>\", \"Day of week (mon-sun) or day of month (1-31)\")\n .option(\"-i, --interval <seconds>\", \"Interval in seconds for loop mode\")\n .option(\"-z, --timezone <tz>\", \"IANA timezone\")\n .option(\"-p, --prompt <text>\", \"Prompt to run\")\n .option(\n \"--prompt-file <path>\",\n \"Read prompt from file (cannot be used with --prompt)\",\n )\n .option(\"-e, --enable\", \"Enable schedule immediately after creation\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Daily at 9am: zero schedule setup <agent-id> -f daily -t 09:00 -p \"run report\"\n Weekly on Monday: zero schedule setup <agent-id> -f weekly -d mon -t 10:00 -p \"weekly sync\"\n Monthly on the 1st: zero schedule setup <agent-id> -f monthly -d 1 -t 08:00 -p \"monthly review\"\n One-time: zero schedule setup <agent-id> -f once -d 2026-04-01 -t 14:00 -p \"one-off task\"\n Loop every 5 minutes: zero schedule setup <agent-id> -f loop -i 300 -p \"poll for updates\"\n Prompt from file: zero schedule setup <agent-id> -f daily -t 09:00 --prompt-file ./prompt.md\n Create and enable: zero schedule setup <agent-id> -f daily -t 09:00 -p \"run report\" --enable\n\nNotes:\n - Re-running setup with the same agent updates the existing \"default\" schedule\n - Use -n to manage multiple named schedules for the same agent\n - All flags are required in non-interactive mode; interactive mode prompts for missing values\n - If the user wants to be notified when a schedule completes, ask them where they want to receive the notification: web chat or Slack, then include it in the prompt`,\n )\n .action(\n withErrorHandler(async (agentIdentifier: string, options: SetupOptions) => {\n // 1. Resolve agent identifier (UUID or name) to compose ID\n const compose = await resolveCompose(agentIdentifier);\n if (!compose) {\n throw new Error(`Agent not found: ${agentIdentifier}`);\n }\n const agentId = compose.id;\n const scheduleName = options.name || \"default\";\n\n // 2. Check for existing schedule\n const existingSchedule = await findExistingSchedule(\n agentId,\n scheduleName,\n );\n\n const agentName = compose.name;\n console.log(\n chalk.dim(\n existingSchedule\n ? `Editing existing schedule for agent ${agentName}`\n : `Creating new schedule for agent ${agentName}`,\n ),\n );\n\n const defaults = getExistingDefaults(existingSchedule);\n\n // 3. Gather frequency\n const frequency = await gatherFrequency(\n options.frequency,\n defaults.frequency,\n );\n if (!frequency) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n\n // 4. Gather day and time\n const timing = await gatherTiming(frequency, options, defaults);\n if (!timing) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n const { day, time, atTime, intervalSeconds } = timing;\n\n // 5. Gather timezone\n const timezone = await gatherTimezone(\n options.timezone,\n existingSchedule?.timezone,\n );\n if (!timezone) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n\n // 6. Gather prompt\n const promptText_ = await gatherPromptText(\n options.prompt,\n options.promptFile,\n existingSchedule?.prompt,\n );\n if (!promptText_) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n\n // 7. Build trigger and deploy\n const deployResult = await buildAndDeploy({\n scheduleName,\n agentId,\n agentName,\n frequency,\n time,\n day,\n atTime,\n intervalSeconds,\n timezone,\n prompt: promptText_,\n existingEnabled: existingSchedule?.enabled,\n });\n\n // 8. Display deployment result\n displayDeployResult(scheduleName, deployResult);\n\n // 9. Handle schedule enabling\n const shouldPromptEnable =\n deployResult.created ||\n (existingSchedule !== undefined && !existingSchedule.enabled);\n\n await handleScheduleEnabling({\n scheduleName,\n agentId,\n agentName,\n enableFlag: options.enable ?? false,\n shouldPromptEnable,\n });\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroSchedules } from \"../../../lib/api\";\nimport { formatRelativeTime } from \"../../../lib/domain/schedule-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List all zero schedules\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero schedule list`,\n )\n .action(\n withErrorHandler(async () => {\n const result = await listZeroSchedules();\n\n if (result.schedules.length === 0) {\n console.log(chalk.dim(\"No schedules found\"));\n console.log(\n chalk.dim(\" Create one with: zero schedule setup <agent-id>\"),\n );\n return;\n }\n\n const agentWidth = Math.max(\n 5,\n ...result.schedules.map((s) => {\n return s.agentId.length;\n }),\n );\n const scheduleWidth = Math.max(\n 8,\n ...result.schedules.map((s) => {\n return s.name.length;\n }),\n );\n const triggerWidth = Math.max(\n 7,\n ...result.schedules.map((s) => {\n return s.cronExpression\n ? s.cronExpression.length + s.timezone.length + 3\n : s.atTime?.length || 0;\n }),\n );\n\n const header = [\n \"AGENT\".padEnd(agentWidth),\n \"SCHEDULE\".padEnd(scheduleWidth),\n \"TRIGGER\".padEnd(triggerWidth),\n \"STATUS\".padEnd(8),\n \"NEXT RUN\",\n ].join(\" \");\n console.log(chalk.dim(header));\n\n for (const schedule of result.schedules) {\n const trigger = schedule.cronExpression\n ? `${schedule.cronExpression} (${schedule.timezone})`\n : schedule.atTime || \"-\";\n\n const status = schedule.enabled\n ? chalk.green(\"enabled\")\n : chalk.yellow(\"disabled\");\n\n const nextRun = schedule.enabled\n ? formatRelativeTime(schedule.nextRunAt)\n : \"-\";\n\n const row = [\n schedule.agentId.padEnd(agentWidth),\n schedule.name.padEnd(scheduleWidth),\n trigger.padEnd(triggerWidth),\n status.padEnd(8 + (schedule.enabled ? 0 : 2)),\n nextRun,\n ].join(\" \");\n console.log(row);\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { resolveZeroScheduleByAgent } from \"../../../lib/api\";\nimport {\n formatDateTime,\n detectTimezone,\n} from \"../../../lib/domain/schedule-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport type { ScheduleResponse } from \"@vm0/api-contracts/contracts/zero-schedules\";\n\n/**\n * Format date with styled relative time (adds chalk formatting)\n */\nfunction formatDateTimeStyled(dateStr: string | null): string {\n if (!dateStr) return chalk.dim(\"-\");\n const formatted = formatDateTime(dateStr);\n return formatted.replace(/\\(([^)]+)\\)$/, chalk.dim(\"($1)\"));\n}\n\n/**\n * Format trigger (cron or at) - timezone shown separately\n */\nfunction formatTrigger(schedule: ScheduleResponse): string {\n if (schedule.triggerType === \"loop\" && schedule.intervalSeconds !== null) {\n return `interval ${schedule.intervalSeconds}s ${chalk.dim(\"(loop)\")}`;\n }\n if (schedule.cronExpression) {\n return schedule.cronExpression;\n }\n if (schedule.atTime) {\n return `${schedule.atTime} ${chalk.dim(\"(one-time)\")}`;\n }\n return chalk.dim(\"-\");\n}\n\n/**\n * Print run configuration section\n */\nfunction printRunConfiguration(\n schedule: ScheduleResponse,\n showFullPrompt: boolean,\n): void {\n const statusText = schedule.enabled\n ? chalk.green(\"enabled\")\n : chalk.yellow(\"disabled\");\n console.log(`${\"Status:\".padEnd(16)}${statusText}`);\n\n console.log(`${\"Agent:\".padEnd(16)}${schedule.agentId}`);\n\n if (showFullPrompt) {\n console.log(`${\"Prompt:\".padEnd(16)}${chalk.dim(schedule.prompt)}`);\n } else {\n const truncated = schedule.prompt.length > 60;\n const promptPreview = truncated\n ? schedule.prompt.slice(0, 57) + \"...\"\n : schedule.prompt;\n console.log(`${\"Prompt:\".padEnd(16)}${chalk.dim(promptPreview)}`);\n if (truncated) {\n console.log(\n chalk.dim(\" Run with --prompt (-p) to see full prompt\"),\n );\n }\n }\n\n if (schedule.vars && Object.keys(schedule.vars).length > 0) {\n console.log(\n `${\"Variables:\".padEnd(16)}${Object.keys(schedule.vars).join(\", \")}`,\n );\n }\n\n if (schedule.secretNames && schedule.secretNames.length > 0) {\n console.log(`${\"Secrets:\".padEnd(16)}${schedule.secretNames.join(\", \")}`);\n }\n\n if (\n schedule.volumeVersions &&\n Object.keys(schedule.volumeVersions).length > 0\n ) {\n console.log(\n `${\"Volumes:\".padEnd(16)}${Object.keys(schedule.volumeVersions).join(\", \")}`,\n );\n }\n}\n\n/**\n * Print time schedule section\n */\nfunction printTimeSchedule(schedule: ScheduleResponse): void {\n console.log();\n console.log(`${\"Trigger:\".padEnd(16)}${formatTrigger(schedule)}`);\n console.log(`${\"Timezone:\".padEnd(16)}${detectTimezone()}`);\n\n if (schedule.enabled) {\n console.log(\n `${\"Next Run:\".padEnd(16)}${formatDateTimeStyled(schedule.nextRunAt)}`,\n );\n }\n\n if (schedule.triggerType === \"loop\" || schedule.triggerType === \"cron\") {\n const failureText =\n schedule.consecutiveFailures > 0\n ? chalk.yellow(`${schedule.consecutiveFailures}/3`)\n : chalk.dim(\"0/3\");\n console.log(`${\"Failures:\".padEnd(16)}${failureText}`);\n }\n}\n\nexport const statusCommand = new Command()\n .name(\"status\")\n .description(\"Show detailed status of a zero schedule\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\n \"-n, --name <schedule-name>\",\n \"Schedule name (required when agent has multiple schedules)\",\n )\n .option(\"-p, --prompt\", \"Show full prompt content without truncation\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero schedule status <agent-id>\n zero schedule status <agent-id> -n my-schedule\n zero schedule status <agent-id> --prompt`,\n )\n .action(\n withErrorHandler(\n async (\n agentName: string,\n options: { name?: string; prompt?: boolean },\n ) => {\n const schedule = await resolveZeroScheduleByAgent(\n agentName,\n options.name,\n );\n\n console.log();\n console.log(`Schedule for agent: ${chalk.cyan(agentName)}`);\n console.log(chalk.dim(\"━\".repeat(50)));\n\n printRunConfiguration(schedule, options.prompt ?? false);\n printTimeSchedule(schedule);\n\n console.log();\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n deleteZeroSchedule,\n resolveZeroScheduleByAgent,\n} from \"../../../lib/api\";\nimport { isInteractive, promptConfirm } from \"../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const deleteCommand = new Command()\n .name(\"delete\")\n .alias(\"rm\")\n .description(\"Delete a zero schedule\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\n \"-n, --name <schedule-name>\",\n \"Schedule name (required when agent has multiple schedules)\",\n )\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero schedule delete <agent-id>\n zero schedule delete <agent-id> -n my-schedule -y\n\nNotes:\n - Use -y to skip confirmation in non-interactive mode`,\n )\n .action(\n withErrorHandler(\n async (agentName: string, options: { name?: string; yes?: boolean }) => {\n const resolved = await resolveZeroScheduleByAgent(\n agentName,\n options.name,\n );\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 schedule for agent ${chalk.cyan(agentName)}?`,\n false,\n );\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteZeroSchedule({\n name: resolved.name,\n agentId: resolved.agentId,\n });\n\n console.log(chalk.green(`✓ Schedule \"${resolved.name}\" deleted`));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n enableZeroSchedule,\n resolveZeroScheduleByAgent,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const enableCommand = new Command()\n .name(\"enable\")\n .description(\"Enable a zero schedule\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\n \"-n, --name <schedule-name>\",\n \"Schedule name (required when agent has multiple schedules)\",\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n zero schedule enable <agent-id>\n zero schedule enable <agent-id> -n my-schedule`,\n )\n .action(\n withErrorHandler(async (agentName: string, options: { name?: string }) => {\n const resolved = await resolveZeroScheduleByAgent(\n agentName,\n options.name,\n );\n\n await enableZeroSchedule({\n name: resolved.name,\n agentId: resolved.agentId,\n });\n\n console.log(chalk.green(`✓ Schedule \"${resolved.name}\" enabled`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n disableZeroSchedule,\n resolveZeroScheduleByAgent,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const disableCommand = new Command()\n .name(\"disable\")\n .description(\"Disable a zero schedule\")\n .argument(\"<agent-id>\", \"Agent ID\")\n .option(\n \"-n, --name <schedule-name>\",\n \"Schedule name (required when agent has multiple schedules)\",\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n zero schedule disable <agent-id>\n zero schedule disable <agent-id> -n my-schedule`,\n )\n .action(\n withErrorHandler(async (agentName: string, options: { name?: string }) => {\n const resolved = await resolveZeroScheduleByAgent(\n agentName,\n options.name,\n );\n\n await disableZeroSchedule({\n name: resolved.name,\n agentId: resolved.agentId,\n });\n\n console.log(chalk.green(`✓ Schedule \"${resolved.name}\" disabled`));\n }),\n );\n","import { Command } from \"commander\";\nimport { listCommand } from \"./list\";\nimport { setCommand } from \"./set\";\nimport { deleteCommand } from \"./delete\";\n\nexport const zeroSecretCommand = new Command()\n .name(\"secret\")\n .description(\"Read or write secrets (API keys, tokens)\")\n .addCommand(listCommand)\n .addCommand(setCommand)\n .addCommand(deleteCommand);\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getConnectorStoredSecretDisplayInfo } from \"@vm0/connectors/connector-utils\";\nimport { listZeroSecrets } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List all secrets\")\n .action(\n withErrorHandler(async () => {\n const result = await listZeroSecrets();\n\n if (result.secrets.length === 0) {\n console.log(chalk.dim(\"No secrets found\"));\n console.log();\n console.log(\"To add a secret:\");\n console.log(chalk.cyan(\" zero secret set MY_API_KEY --body <value>\"));\n return;\n }\n\n console.log(chalk.bold(\"Secrets:\"));\n console.log();\n\n for (const secret of result.secrets) {\n let typeIndicator = \"\";\n let derivedLine: string | null = null;\n\n if (secret.type === \"model-provider\") {\n typeIndicator = chalk.dim(\" [model-provider]\");\n } else if (secret.type === \"connector\") {\n const derived = getConnectorStoredSecretDisplayInfo(secret.name);\n if (derived) {\n typeIndicator = chalk.dim(` [${derived.connectorLabel} connector]`);\n derivedLine = chalk.dim(\n `Available as: ${derived.envNames.join(\", \")}`,\n );\n } else {\n typeIndicator = chalk.dim(\" [connector]\");\n }\n } else if (secret.type === \"user\") {\n const derived = getConnectorStoredSecretDisplayInfo(secret.name);\n if (derived) {\n typeIndicator = chalk.dim(` [${derived.connectorLabel} connector]`);\n derivedLine = chalk.dim(\n `Available as: ${derived.envNames.join(\", \")}`,\n );\n }\n }\n\n console.log(` ${chalk.cyan(secret.name)}${typeIndicator}`);\n if (derivedLine) {\n console.log(` ${derivedLine}`);\n }\n if (secret.description) {\n console.log(` ${chalk.dim(secret.description)}`);\n }\n console.log(\n ` ${chalk.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`,\n );\n console.log();\n }\n\n console.log(chalk.dim(`Total: ${result.secrets.length} secret(s)`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { setZeroSecret } from \"../../../lib/api\";\nimport { isInteractive, promptPassword } from \"../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const setCommand = new Command()\n .name(\"set\")\n .description(\"Create or update a secret\")\n .argument(\"<name>\", \"Secret name (uppercase, e.g., MY_API_KEY)\")\n .option(\n \"-b, --body <value>\",\n \"Secret value (required in non-interactive mode)\",\n )\n .option(\"-d, --description <description>\", \"Optional description\")\n .action(\n withErrorHandler(\n async (\n name: string,\n options: { body?: string; description?: string },\n ) => {\n let value: string;\n\n if (options.body !== undefined) {\n value = options.body;\n } else if (isInteractive()) {\n const prompted = await promptPassword(\"Enter secret value:\");\n if (prompted === undefined) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n value = prompted;\n } else {\n throw new Error(\"--body is required in non-interactive mode\", {\n cause: new Error(\n `Usage: zero secret set ${name} --body \"your-secret-value\"`,\n ),\n });\n }\n\n let secret;\n try {\n secret = await setZeroSecret({\n name,\n value,\n description: options.description,\n });\n } catch (error) {\n if (\n error instanceof Error &&\n error.message.includes(\"must contain only uppercase\")\n ) {\n throw new Error(error.message, {\n cause: new Error(\n \"Examples of valid secret names: MY_API_KEY, GITHUB_TOKEN, AWS_ACCESS_KEY_ID\",\n ),\n });\n }\n throw error;\n }\n\n console.log(chalk.green(`✓ Secret \"${secret.name}\" saved`));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { deleteZeroSecret } from \"../../../lib/api\";\nimport { isInteractive, promptConfirm } from \"../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const deleteCommand = new Command()\n .name(\"delete\")\n .description(\"Delete a secret\")\n .argument(\"<name>\", \"Secret name to delete\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .action(\n withErrorHandler(async (name: string, options: { yes?: boolean }) => {\n if (!options.yes) {\n if (!isInteractive()) {\n throw new Error(\"--yes flag is required in non-interactive mode\");\n }\n\n const confirmed = await promptConfirm(\n `Are you sure you want to delete secret \"${name}\"?`,\n false,\n );\n\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteZeroSecret(name);\n console.log(chalk.green(`✓ Secret \"${name}\" deleted`));\n }),\n );\n","import { Command } from \"commander\";\nimport { zeroChatMessageCommand } from \"./message\";\n\nexport const zeroChatCommand = new Command()\n .name(\"chat\")\n .description(\"Send messages to web chat threads\")\n .addCommand(zeroChatMessageCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Send to thread: zero chat message send -t <thread-id> --text \"Hello!\"\n Send to agent: zero chat message send -a <agent-id> --text \"Hello!\"`,\n );\n","import { Command } from \"commander\";\nimport { sendCommand } from \"./send\";\n\nexport const zeroChatMessageCommand = new Command()\n .name(\"message\")\n .description(\"Manage chat messages\")\n .addCommand(sendCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n zero chat message send -t <thread-id> --text \"Hello!\"`,\n );\n","import { readFileSync } from \"fs\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { sendChatMessage } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nexport const sendCommand = new Command()\n .name(\"send\")\n .description(\"Send a message to a web chat thread\")\n .option(\"-t, --thread <id>\", \"Existing chat thread ID\")\n .option(\"-a, --agent <agentId>\", \"Agent ID (creates a new thread)\")\n .option(\"--text <message>\", \"Message text\")\n .option(\"--title <title>\", \"Thread title (only with --agent)\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Send to existing thread: zero chat message send -t <thread-id> --text \"Hello!\"\n Send to agent (new thread): zero chat message send -a <agent-id> --text \"Hello!\"\n\nNotes:\n - Either --thread or --agent is required; they are mutually exclusive\n - --text is required (or pipe via stdin)`,\n )\n .action(\n withErrorHandler(\n async (options: {\n thread?: string;\n agent?: string;\n text?: string;\n title?: string;\n }) => {\n let text = options.text;\n const { thread, agent, title } = options;\n\n // Validate mutual exclusion: exactly one of --thread or --agent\n if (!thread && !agent) {\n throw new Error(\"Either --thread or --agent must be provided\", {\n cause: new Error(\n 'Usage: zero chat message send -t THREAD_ID --text \"your message\"\\n zero chat message send -a AGENT_ID --text \"your message\"',\n ),\n });\n }\n if (thread && agent) {\n throw new Error(\"--thread and --agent are mutually exclusive\", {\n cause: new Error(\n \"Provide either --thread to send to an existing thread or --agent to create a new thread, not both\",\n ),\n });\n }\n\n // Read from stdin if text not provided and stdin is explicitly piped\n if (!text && process.stdin.isTTY === false) {\n text = readFileSync(\"/dev/stdin\", \"utf8\").trim();\n }\n\n if (!text) {\n throw new Error(\"--text is required\", {\n cause: new Error(\n 'Usage: zero chat message send -t THREAD_ID --text \"your message\"',\n ),\n });\n }\n\n const result = await sendChatMessage({\n thread: thread || undefined,\n agent: agent || undefined,\n text,\n title: title || undefined,\n });\n\n console.log(\n chalk.green(\n `✓ Message sent (id: ${result.messageId}, thread: ${result.threadId})`,\n ),\n );\n },\n ),\n );\n","import { Command } from \"commander\";\nimport { downloadFileCommand } from \"./download-file\";\nimport { labelListenerCommand } from \"./label-listener\";\nimport { uploadFileCommand } from \"./upload-file\";\n\nexport const zeroGithubCommand = new Command()\n .name(\"github\")\n .description(\"Manage GitHub integration files and label listeners\")\n .addCommand(downloadFileCommand)\n .addCommand(labelListenerCommand)\n .addCommand(uploadFileCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload a file: zero github upload-file -f /tmp/report.pdf -r vm0-ai/vm0 -i 42\n Download a file: zero github download-file https://github.com/user-attachments/assets/abc123 -o /tmp/out.png\n List labels: zero github label-listener list`,\n );\n","import { basename, join } from \"path\";\nimport { tmpdir } from \"os\";\nimport { Command } from \"commander\";\nimport { downloadGithubFile } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nfunction filenameFromUrl(fileUrl: string): string {\n if (URL.canParse(fileUrl)) {\n const segment = new URL(fileUrl).pathname.split(\"/\").filter(Boolean).pop();\n if (!segment) {\n return \"file\";\n }\n try {\n return decodeURIComponent(segment);\n } catch {\n return segment;\n }\n }\n return basename(fileUrl) || \"file\";\n}\n\nfunction defaultOutPath(fileUrl: string, filename?: string): string {\n return join(tmpdir(), `github-${filename || filenameFromUrl(fileUrl)}`);\n}\n\nexport const downloadFileCommand = new Command()\n .name(\"download-file\")\n .description(\"Download a file from a GitHub context block\")\n .argument(\"<url>\", \"URL from a [GitHub file] block\")\n .option(\n \"-o, --out <path>\",\n \"Output path for the downloaded file (default: /tmp/github-<filename-or-url-basename>)\",\n )\n .option(\"--filename <name>\", \"Filename hint from the [GitHub file] block\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Download to default temp path: zero github download-file https://github.com/user-attachments/assets/abc123 --filename screenshot.png\n Download to explicit path: zero github download-file https://github.com/user-attachments/assets/abc123 -o /tmp/screenshot.png\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"path\":\"/tmp/github-screenshot.png\",\"mimetype\":\"image/png\",\"size\":12345}\n\nHow to read the downloaded file:\n - Images (png/jpg/gif/webp/svg): open the file path with your image viewing tool\n - Videos (mp4/mov/webm): extract frames first with\n ffmpeg -i <path> -vf \"fps=1\" -q:v 2 /tmp/github_frame_%03d.jpg\n then view the extracted frames\n - PDF/text/csv/json/markdown: read the file directly\n\nNotes:\n - The URL comes from a [GitHub file] block\n - Streams the GitHub file bytes through VM0 directly to disk`,\n )\n .action(\n withErrorHandler(\n async (fileUrl: string, options: { out?: string; filename?: string }) => {\n const outPath =\n options.out ?? defaultOutPath(fileUrl, options.filename);\n const result = await downloadGithubFile(\n fileUrl,\n outPath,\n options.filename,\n );\n console.log(JSON.stringify(result));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type {\n GithubLabelListener,\n GithubLabelTriggerMode,\n UpdateGithubLabelListenerBody,\n} from \"@vm0/api-contracts/contracts/integrations-github\";\nimport {\n createGithubLabelListener,\n deleteGithubLabelListener,\n getGithubInstallation,\n updateGithubLabelListener,\n} from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nfunction parseTriggerMode(value: string): GithubLabelTriggerMode {\n if (value === \"created_by_me\" || value === \"anyone\") {\n return value;\n }\n throw new Error(\"trigger-mode must be one of: created_by_me, anyone\");\n}\n\nfunction enabledLabel(listener: GithubLabelListener): string {\n return listener.enabled ? chalk.green(\"yes\") : chalk.dim(\"no\");\n}\n\nfunction manageableLabel(listener: GithubLabelListener): string {\n return listener.canManage ? chalk.green(\"yes\") : chalk.dim(\"no\");\n}\n\nfunction printListeners(listeners: readonly GithubLabelListener[]): void {\n if (listeners.length === 0) {\n console.log(chalk.dim(\"No GitHub label listeners found\"));\n return;\n }\n\n const idWidth = Math.max(\n 2,\n ...listeners.map((listener) => {\n return listener.id.length;\n }),\n );\n const labelWidth = Math.max(\n 5,\n ...listeners.map((listener) => {\n return listener.labelName.length;\n }),\n );\n const agentWidth = Math.max(\n 5,\n ...listeners.map((listener) => {\n return (listener.agent?.name ?? \"-\").length;\n }),\n );\n\n console.log(\n chalk.dim(\n [\n \"ID\".padEnd(idWidth),\n \"LABEL\".padEnd(labelWidth),\n \"AGENT\".padEnd(agentWidth),\n \"TRIGGER\".padEnd(13),\n \"ENABLED\",\n \"CAN MANAGE\",\n ].join(\" \"),\n ),\n );\n\n for (const listener of listeners) {\n console.log(\n [\n listener.id.padEnd(idWidth),\n listener.labelName.padEnd(labelWidth),\n (listener.agent?.name ?? \"-\").padEnd(agentWidth),\n listener.triggerMode.padEnd(13),\n enabledLabel(listener).padEnd(7),\n manageableLabel(listener),\n ].join(\" \"),\n );\n }\n}\n\nconst listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List GitHub label listeners for the active organization\")\n .option(\"--json\", \"Print raw JSON\")\n .action(\n withErrorHandler(async (options: { json?: boolean }) => {\n const installation = await getGithubInstallation();\n if (options.json) {\n console.log(JSON.stringify(installation.labelListeners));\n return;\n }\n printListeners(installation.labelListeners);\n }),\n );\n\nconst createCommand = new Command()\n .name(\"create\")\n .description(\"Create a GitHub label listener\")\n .requiredOption(\"--label <name>\", \"GitHub label name to watch\")\n .requiredOption(\n \"--agent-id <id>\",\n \"Agent ID to run when the label is applied\",\n )\n .requiredOption(\"--prompt <text>\", \"Prompt to pass to the agent\")\n .option(\n \"--trigger-mode <mode>\",\n \"Who can trigger the listener: anyone | created_by_me\",\n \"anyone\",\n )\n .option(\"--disabled\", \"Create the listener disabled\")\n .option(\"--json\", \"Print raw JSON\")\n .action(\n withErrorHandler(\n async (options: {\n label: string;\n agentId: string;\n prompt: string;\n triggerMode: string;\n disabled?: boolean;\n json?: boolean;\n }) => {\n const result = await createGithubLabelListener({\n labelName: options.label,\n agentId: options.agentId,\n prompt: options.prompt,\n triggerMode: parseTriggerMode(options.triggerMode),\n enabled: options.disabled ? false : undefined,\n });\n\n if (options.json) {\n console.log(JSON.stringify(result.listener));\n return;\n }\n console.log(`Created GitHub label listener ${result.listener.id}`);\n },\n ),\n );\n\nconst updateCommand = new Command()\n .name(\"update\")\n .alias(\"edit\")\n .description(\"Update a GitHub label listener\")\n .argument(\"<listener-id>\", \"GitHub label listener ID\")\n .option(\"--label <name>\", \"New GitHub label name\")\n .option(\"--agent-id <id>\", \"New agent ID\")\n .option(\"--prompt <text>\", \"New prompt\")\n .option(\n \"--trigger-mode <mode>\",\n \"Who can trigger the listener: anyone | created_by_me\",\n )\n .option(\"--enable\", \"Enable the listener\")\n .option(\"--disable\", \"Disable the listener\")\n .option(\"--json\", \"Print raw JSON\")\n .action(\n withErrorHandler(\n async (\n listenerId: string,\n options: {\n label?: string;\n agentId?: string;\n prompt?: string;\n triggerMode?: string;\n enable?: boolean;\n disable?: boolean;\n json?: boolean;\n },\n ) => {\n if (options.enable && options.disable) {\n throw new Error(\"Use only one of --enable or --disable\");\n }\n\n const body: UpdateGithubLabelListenerBody = {};\n if (options.label !== undefined) body.labelName = options.label;\n if (options.agentId !== undefined) body.agentId = options.agentId;\n if (options.prompt !== undefined) body.prompt = options.prompt;\n if (options.triggerMode !== undefined) {\n body.triggerMode = parseTriggerMode(options.triggerMode);\n }\n if (options.enable) body.enabled = true;\n if (options.disable) body.enabled = false;\n\n if (Object.keys(body).length === 0) {\n throw new Error(\n \"Provide at least one change: --label, --agent-id, --prompt, --trigger-mode, --enable, or --disable\",\n );\n }\n\n const result = await updateGithubLabelListener(listenerId, body);\n if (options.json) {\n console.log(JSON.stringify(result.listener));\n return;\n }\n console.log(`Updated GitHub label listener ${result.listener.id}`);\n },\n ),\n );\n\nconst deleteCommand = new Command()\n .name(\"delete\")\n .alias(\"rm\")\n .description(\"Delete a GitHub label listener\")\n .argument(\"<listener-id>\", \"GitHub label listener ID\")\n .option(\"--json\", \"Print raw JSON\")\n .action(\n withErrorHandler(\n async (listenerId: string, options: { json?: boolean }) => {\n const result = await deleteGithubLabelListener(listenerId);\n if (options.json) {\n console.log(JSON.stringify(result));\n return;\n }\n console.log(`Deleted GitHub label listener ${listenerId}`);\n },\n ),\n );\n\nexport const labelListenerCommand = new Command()\n .name(\"label-listener\")\n .alias(\"label-listeners\")\n .alias(\"labels\")\n .description(\"Manage GitHub label listeners\")\n .addCommand(listCommand)\n .addCommand(createCommand)\n .addCommand(updateCommand)\n .addCommand(deleteCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n List listeners: zero github label-listener list\n Create listener: zero github label-listener create --label zero --agent-id <agent-id> --prompt \"Handle this issue\"\n Edit listener: zero github label-listener update <listener-id> --disable\n Delete listener: zero github label-listener delete <listener-id>\n\nNotes:\n - Updating or deleting a listener is allowed only for the listener owner or an org admin.`,\n );\n","import { readFileSync, statSync } from \"fs\";\nimport { basename, extname } from \"path\";\nimport { Command } from \"commander\";\nimport {\n completeGithubFileUpload,\n initGithubFileUpload,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nconst MIME_BY_EXTENSION: Record<string, string> = {\n \".png\": \"image/png\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".gif\": \"image/gif\",\n \".webp\": \"image/webp\",\n \".svg\": \"image/svg+xml\",\n \".mp4\": \"video/mp4\",\n \".webm\": \"video/webm\",\n \".mov\": \"video/quicktime\",\n \".pdf\": \"application/pdf\",\n \".txt\": \"text/plain\",\n \".csv\": \"text/csv\",\n \".md\": \"text/markdown\",\n \".json\": \"application/json\",\n};\n\nfunction inferContentType(localPath: string): string {\n const ext = extname(localPath).toLowerCase();\n return MIME_BY_EXTENSION[ext] ?? \"application/octet-stream\";\n}\n\nfunction parseIssueNumber(value: string): number {\n const parsed = Number(value);\n if (!Number.isSafeInteger(parsed) || parsed <= 0) {\n throw new Error(\"issue-number must be a positive integer\");\n }\n return parsed;\n}\n\nexport const uploadFileCommand = new Command()\n .name(\"upload-file\")\n .description(\"Upload a local file to a GitHub issue or pull request comment\")\n .requiredOption(\"-f, --file <path>\", \"Local file path to upload\")\n .requiredOption(\"-r, --repo <owner/name>\", \"GitHub repository\")\n .requiredOption(\n \"-i, --issue-number <number>\",\n \"GitHub issue or pull request number\",\n )\n .option(\"--caption <text>\", \"Text to include before the file link\")\n .option(\"--content-type <mime>\", \"Override inferred content type\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload a file: zero github upload-file -f /tmp/report.pdf -r vm0-ai/vm0 -i 42\n With a caption: zero github upload-file -f /tmp/data.csv -r vm0-ai/vm0 -i 42 --caption \"Daily report\"\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"commentId\":\"123\",\"repo\":\"vm0-ai/vm0\",\"issueNumber\":42,\"filename\":\"report.pdf\",\"mimetype\":\"application/pdf\",\"size\":12345,\"url\":\"https://...\"}\n\nNotes:\n - Uses the GitHub App installation on the server side\n - Uploads through VM0 storage first, then posts a GitHub comment containing the file URL`,\n )\n .action(\n withErrorHandler(\n async (options: {\n file: string;\n repo: string;\n issueNumber: string;\n caption?: string;\n contentType?: string;\n }) => {\n let fileSize: number;\n try {\n const stat = statSync(options.file);\n if (!stat.isFile()) {\n throw new Error(`Not a regular file: ${options.file}`);\n }\n fileSize = stat.size;\n } catch (error) {\n if (error instanceof Error && error.message.startsWith(\"Not \")) {\n throw error;\n }\n throw new Error(`File not found: ${options.file}`);\n }\n\n if (fileSize === 0) {\n throw new Error(\"File is empty\");\n }\n\n const filename = basename(options.file);\n const contentType =\n options.contentType ?? inferContentType(options.file);\n const issueNumber = parseIssueNumber(options.issueNumber);\n\n const prepared = await initGithubFileUpload({\n filename,\n contentType,\n length: fileSize,\n });\n\n const fileContent = readFileSync(options.file);\n const uploadResponse = await fetch(prepared.uploadUrl, {\n method: \"PUT\",\n headers: { \"Content-Type\": prepared.contentType },\n body: new Uint8Array(fileContent),\n });\n\n if (!uploadResponse.ok) {\n throw new Error(\n `File upload failed: ${uploadResponse.status} ${uploadResponse.statusText}`,\n );\n }\n\n const result = await completeGithubFileUpload({\n uploadId: prepared.uploadId,\n repo: options.repo,\n issueNumber,\n contentType: prepared.contentType,\n caption: options.caption,\n });\n\n console.log(JSON.stringify(result));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport { zeroSlackMessageCommand } from \"./message\";\nimport { uploadFileCommand } from \"./upload-file\";\nimport { downloadFileCommand } from \"./download-file\";\n\nexport const zeroSlackCommand = new Command()\n .name(\"slack\")\n .description(\n \"Send messages, upload files, and download files from Slack as the bot\",\n )\n .addCommand(zeroSlackMessageCommand)\n .addCommand(uploadFileCommand)\n .addCommand(downloadFileCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Send a message: zero slack message send -c <channel-id> -t \"Hello!\"\n Reply in a thread: zero slack message send -c <channel-id> --thread <ts> -t \"reply\"\n Upload a file: zero slack upload-file -f /tmp/report.pdf -c <channel-id>\n Download a file: zero slack download-file <file-id> -o /tmp/out.png`,\n );\n","import { Command } from \"commander\";\nimport { sendCommand } from \"./send\";\n\nexport const zeroSlackMessageCommand = new Command()\n .name(\"message\")\n .description(\"Manage Slack messages\")\n .addCommand(sendCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n zero slack message send -c <channel-id> -t \"Hello!\"`,\n );\n","import { readFileSync } from \"fs\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { sendSlackMessage } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nexport const sendCommand = new Command()\n .name(\"send\")\n .description(\"Send a message to a Slack channel or DM a user\")\n .option(\"-c, --channel <id>\", \"Channel ID\")\n .option(\"-u, --user <id>\", 'Slack user ID for DM (use \"me\" for yourself)')\n .option(\"-t, --text <message>\", \"Message text\")\n .option(\"--thread <ts>\", \"Thread timestamp for replies\")\n .option(\"--blocks <json>\", \"Block Kit JSON string\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Simple message: zero slack message send -c C01234 -t \"Hello!\"\n DM a user: zero slack message send -u U0A8V9X98QJ -t \"Hello!\"\n DM yourself: zero slack message send -u me -t \"Hello!\"\n Reply in thread: zero slack message send -c C01234 --thread 1234567890.123456 -t \"reply\"\n Rich blocks: zero slack message send -c C01234 --blocks '[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"*Bold*\"}}]'\n\nNotes:\n - Either --channel or --user is required; they are mutually exclusive\n - Either --text or --blocks is required; both can be used together`,\n )\n .action(\n withErrorHandler(\n async (options: {\n channel?: string;\n user?: string;\n text?: string;\n thread?: string;\n blocks?: string;\n }) => {\n let text = options.text;\n const { channel, user, thread, blocks: blocksStr } = options;\n\n // Validate mutual exclusion: exactly one of --channel or --user\n if (!channel && !user) {\n throw new Error(\"Either --channel or --user must be provided\", {\n cause: new Error(\n 'Usage: zero slack message send -c CHANNEL_ID -t \"your message\"\\n zero slack message send -u USER_ID -t \"your message\"',\n ),\n });\n }\n if (channel && user) {\n throw new Error(\"--channel and --user are mutually exclusive\", {\n cause: new Error(\n \"Provide either --channel to send to a channel or --user to DM a user, not both\",\n ),\n });\n }\n\n // Read from stdin if text not provided and stdin is explicitly piped\n // (isTTY is false when piped, undefined when no TTY context e.g. tests)\n if (!text && process.stdin.isTTY === false) {\n text = readFileSync(\"/dev/stdin\", \"utf8\").trim();\n }\n\n // Parse blocks JSON if provided\n let blocks: Array<{ type: string; [key: string]: unknown }> | undefined;\n if (blocksStr) {\n try {\n blocks = JSON.parse(blocksStr) as Array<{\n type: string;\n [key: string]: unknown;\n }>;\n } catch {\n throw new Error(\"Invalid JSON for --blocks flag\", {\n cause: new Error(\n \"Provide a valid JSON array of Block Kit blocks\",\n ),\n });\n }\n }\n\n // Validate at least one of text or blocks\n if (!text && !blocks) {\n throw new Error(\"Either --text or --blocks must be provided\", {\n cause: new Error(\n 'Usage: zero slack message send -c CHANNEL_ID -t \"your message\"',\n ),\n });\n }\n\n const result = await sendSlackMessage({\n channel: channel || undefined,\n user: user || undefined,\n text: text || undefined,\n threadTs: thread,\n blocks,\n });\n\n const tsInfo = result.ts ? ` (ts: ${result.ts})` : \"\";\n console.log(chalk.green(`✓ Message sent${tsInfo}`));\n },\n ),\n );\n","import { statSync, readFileSync } from \"fs\";\nimport { basename } from \"path\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { initSlackFileUpload, completeSlackFileUpload } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const uploadFileCommand = new Command()\n .name(\"upload-file\")\n .description(\"Upload a file to a Slack channel as the bot\")\n .requiredOption(\"-f, --file <path>\", \"Local file path to upload\")\n .requiredOption(\"-c, --channel <id>\", \"Slack channel ID\")\n .option(\"--thread <ts>\", \"Thread timestamp to post as a reply\")\n .option(\"--title <title>\", \"Display title for the file\")\n .option(\"--comment <text>\", \"Initial comment to accompany the file\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload a file: zero slack upload-file -f /tmp/report.pdf -c C01234\n Upload to thread: zero slack upload-file -f /tmp/log.txt -c C01234 --thread 1234567890.123456\n With title and comment: zero slack upload-file -f /tmp/data.csv -c C01234 --title \"Daily Report\" --comment \"Here's the report\"\n\nNotes:\n - Uses the bot token (not user SLACK_TOKEN), so no files:write permission is needed\n - Returns file_id and permalink for reference`,\n )\n .action(\n withErrorHandler(\n async (options: {\n file: string;\n channel: string;\n thread?: string;\n title?: string;\n comment?: string;\n }) => {\n // Validate file exists and get size\n let fileSize: number;\n try {\n const stat = statSync(options.file);\n fileSize = stat.size;\n } catch {\n throw new Error(`File not found: ${options.file}`);\n }\n\n if (fileSize === 0) {\n throw new Error(\"File is empty\");\n }\n\n const filename = basename(options.file);\n\n // Step 1: Get pre-signed upload URL from server\n const { uploadUrl, fileId } = await initSlackFileUpload({\n filename,\n length: fileSize,\n });\n\n // Step 2: Upload file directly to Slack's pre-signed URL\n const fileContent = readFileSync(options.file);\n const uploadResponse = await fetch(uploadUrl, {\n method: \"POST\",\n body: fileContent,\n });\n\n if (!uploadResponse.ok) {\n throw new Error(\n `File upload failed: ${uploadResponse.status} ${uploadResponse.statusText}`,\n );\n }\n\n // Step 3: Complete the upload and share to channel/thread\n const result = await completeSlackFileUpload({\n fileId,\n channel: options.channel,\n threadTs: options.thread,\n title: options.title,\n initialComment: options.comment,\n });\n\n console.log(chalk.green(`✓ File uploaded (file_id: ${result.fileId})`));\n console.log(chalk.dim(` permalink: ${result.permalink}`));\n },\n ),\n );\n","import { basename, join } from \"path\";\nimport { tmpdir } from \"os\";\nimport { Command } from \"commander\";\nimport { downloadSlackFile } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\n/**\n * Derive a local output path for a Slack file id.\n * Uses the system temp directory; extension is appended later once the\n * mimetype is known.\n *\n * `basename` strips any path separators from `fileId` so a hostile id like\n * `../etc/passwd` cannot escape `tmpdir()`.\n */\nfunction defaultOutPath(fileId: string): string {\n return join(tmpdir(), `slack-${basename(fileId)}`);\n}\n\nexport const downloadFileCommand = new Command()\n .name(\"download-file\")\n .description(\"Download a Slack file by id using the bot token\")\n .argument(\"<file-id>\", \"Slack file id (e.g. F01234ABCD)\")\n .option(\n \"-o, --out <path>\",\n \"Output path for the downloaded file (default: /tmp/slack-<file-id>)\",\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n Download to default temp path: zero slack download-file F01234ABCD\n Download to explicit path: zero slack download-file F01234ABCD -o /tmp/image.png\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"path\":\"/tmp/slack-F01234ABCD\",\"mimetype\":\"image/png\",\"size\":12345}\n\nHow to read the downloaded file:\n - Images (png/jpg/gif/webp/svg): open the file path with your image viewing tool\n - Videos (mp4/mov/webm): extract frames first with\n ffmpeg -i <path> -vf \"fps=1\" -q:v 2 /tmp/<file-id>_frame_%03d.jpg\n then view the extracted frames\n - PDF/text/csv/json/markdown: read the file directly\n\nNotes:\n - Uses the bot token on the server side; no user Slack token is needed\n - Streams the file bytes directly to disk`,\n )\n .action(\n withErrorHandler(async (fileId: string, options: { out?: string }) => {\n const outPath = options.out ?? defaultOutPath(fileId);\n const result = await downloadSlackFile(fileId, outPath);\n console.log(JSON.stringify(result));\n }),\n );\n","import { Command } from \"commander\";\nimport { zeroTelegramBotCommand } from \"./bot\";\nimport { downloadFileCommand } from \"./download-file\";\nimport { zeroTelegramMessageCommand } from \"./message\";\nimport { uploadFileCommand } from \"./upload-file\";\n\nexport const zeroTelegramCommand = new Command()\n .name(\"telegram\")\n .description(\n \"Inspect bots, send messages, upload files, and download files from Telegram\",\n )\n .addCommand(zeroTelegramBotCommand)\n .addCommand(zeroTelegramMessageCommand)\n .addCommand(downloadFileCommand)\n .addCommand(uploadFileCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n List bots: zero telegram bot list\n Send a message: zero telegram message send --bot-id <bot-id> -c <chat-id> -t \"Hello!\"\n Upload a file: zero telegram upload-file -f /tmp/report.pdf --bot-id <bot-id> -c <chat-id>\n Download a file: zero telegram download-file <file-id> --bot-id <bot-id> -o /tmp/out.jpg`,\n );\n","import { Command } from \"commander\";\nimport { listCommand } from \"./list\";\n\nexport const zeroTelegramBotCommand = new Command()\n .name(\"bot\")\n .description(\"Inspect Telegram bots\")\n .addCommand(listCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n zero telegram bot list`,\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listTelegramBots } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\nimport type { TelegramBotListItem } from \"@vm0/api-contracts/contracts/integrations\";\n\nfunction usernameLabel(bot: TelegramBotListItem): string {\n if (!bot.username) return \"-\";\n return bot.username.startsWith(\"@\") ? bot.username : `@${bot.username}`;\n}\n\nfunction statusLabel(bot: TelegramBotListItem): string {\n if (bot.tokenStatus === \"valid\") return chalk.green(\"valid\");\n if (bot.tokenStatus === \"invalid\") return chalk.red(\"invalid\");\n return chalk.yellow(\"unknown\");\n}\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List Telegram bots available in the active organization\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero telegram bot list\n\nNotes:\n - Use this to find the --bot-id value before sending Telegram messages.`,\n )\n .action(\n withErrorHandler(async () => {\n const result = await listTelegramBots();\n const { bots } = result;\n\n if (bots.length === 0) {\n console.log(chalk.dim(\"No Telegram bots found\"));\n console.log(\n chalk.dim(\" Add one from Settings > Integrations > Telegram\"),\n );\n return;\n }\n\n const botIdWidth = Math.max(\n 6,\n ...bots.map((bot) => {\n return bot.id.length;\n }),\n );\n const usernameWidth = Math.max(\n 8,\n ...bots.map((bot) => {\n return usernameLabel(bot).length;\n }),\n );\n const agentWidth = Math.max(\n 5,\n ...bots.map((bot) => {\n return (bot.agent?.name ?? \"-\").length;\n }),\n );\n\n const header = [\n \"BOT ID\".padEnd(botIdWidth),\n \"USERNAME\".padEnd(usernameWidth),\n \"AGENT\".padEnd(agentWidth),\n \"CONNECTED\",\n \"TOKEN\",\n ].join(\" \");\n console.log(chalk.dim(header));\n\n for (const bot of bots) {\n const row = [\n bot.id.padEnd(botIdWidth),\n usernameLabel(bot).padEnd(usernameWidth),\n (bot.agent?.name ?? \"-\").padEnd(agentWidth),\n (bot.isConnected ? \"yes\" : \"no\").padEnd(9),\n statusLabel(bot),\n ].join(\" \");\n console.log(row);\n }\n }),\n );\n","import { basename, join } from \"path\";\nimport { tmpdir } from \"os\";\nimport { Command } from \"commander\";\nimport { downloadTelegramFile } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\n/**\n * Derive a local output path for a Telegram file id.\n * Uses the system temp directory.\n *\n * `basename` strips any path separators from `fileId` so a hostile id like\n * `../etc/passwd` cannot escape `tmpdir()`.\n */\nfunction defaultOutPath(fileId: string): string {\n return join(tmpdir(), `telegram-${basename(fileId)}`);\n}\n\nexport const downloadFileCommand = new Command()\n .name(\"download-file\")\n .description(\"Download a Telegram file by id using the bot token\")\n .argument(\"<file-id>\", \"Telegram file id from a [Telegram file] block\")\n .option(\n \"-o, --out <path>\",\n \"Output path for the downloaded file (default: /tmp/telegram-<file-id>)\",\n )\n .requiredOption(\n \"--bot-id <bot-id>\",\n \"Telegram bot id from the [Telegram file] block\",\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n Download to default temp path: zero telegram download-file AgACAgUAAxkBAA --bot-id 123456789\n Download to explicit path: zero telegram download-file AgACAgUAAxkBAA --bot-id 123456789 -o /tmp/photo.jpg\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"path\":\"/tmp/telegram-AgACAgUAAxkBAA\",\"mimetype\":\"image/jpeg\",\"size\":12345}\n\nHow to read the downloaded file:\n - Images (png/jpg/gif/webp/svg): open the file path with your image viewing tool\n - Videos (mp4/mov/webm): extract frames first with\n ffmpeg -i <path> -vf \"fps=1\" -q:v 2 /tmp/<file-id>_frame_%03d.jpg\n then view the extracted frames\n - PDF/text/csv/json/markdown: read the file directly\n\nNotes:\n - Uses the Telegram bot token on the server side\n - Streams the file bytes directly to disk`,\n )\n .action(\n withErrorHandler(\n async (fileId: string, options: { out?: string; botId: string }) => {\n const outPath = options.out ?? defaultOutPath(fileId);\n const result = await downloadTelegramFile(\n fileId,\n options.botId,\n outPath,\n );\n console.log(JSON.stringify(result));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport { sendCommand } from \"./send\";\n\nexport const zeroTelegramMessageCommand = new Command()\n .name(\"message\")\n .description(\"Manage Telegram messages\")\n .addCommand(sendCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n zero telegram message send --bot-id <bot-id> -c <chat-id> -t \"Hello!\"`,\n );\n","import { readFileSync } from \"fs\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { sendTelegramMessage } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nfunction parsePositiveInteger(value: string, flag: string): number {\n const parsed = Number(value);\n if (!Number.isInteger(parsed) || parsed <= 0) {\n throw new Error(`${flag} must be a positive integer`);\n }\n return parsed;\n}\n\nexport const sendCommand = new Command()\n .name(\"send\")\n .description(\"Send a message to a Telegram chat as the bot\")\n .requiredOption(\"--bot-id <id>\", \"Telegram bot ID\")\n .requiredOption(\"-c, --chat-id <id>\", \"Telegram chat ID\")\n .option(\"-t, --text <message>\", \"Message text\")\n .option(\"--reply-to-message-id <id>\", \"Message ID to reply to\")\n .option(\"--message-thread-id <id>\", \"Telegram forum topic thread ID\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Simple message: zero telegram message send --bot-id 123456789 -c -1001234567890 -t \"Hello!\"\n Reply to message: zero telegram message send --bot-id 123456789 -c -1001234567890 --reply-to-message-id 42 -t \"reply\"\n Forum topic message: zero telegram message send --bot-id 123456789 -c -1001234567890 --message-thread-id 7 -t \"topic update\"\n\nNotes:\n - Message text can be provided with --text or piped on stdin\n - Choose an explicit --bot-id. Run \"zero telegram bot list\" to inspect available bots.`,\n )\n .action(\n withErrorHandler(\n async (options: {\n botId: string;\n chatId: string;\n text?: string;\n replyToMessageId?: string;\n messageThreadId?: string;\n }) => {\n let text = options.text;\n if (!text && process.stdin.isTTY === false) {\n text = readFileSync(\"/dev/stdin\", \"utf8\").trim();\n }\n\n if (!text) {\n throw new Error(\"Either --text or piped stdin must be provided\", {\n cause: new Error(\n 'Usage: zero telegram message send --bot-id BOT_ID -c CHAT_ID -t \"your message\"',\n ),\n });\n }\n\n const result = await sendTelegramMessage({\n botId: options.botId,\n chatId: options.chatId,\n text,\n replyToMessageId: options.replyToMessageId\n ? parsePositiveInteger(\n options.replyToMessageId,\n \"reply-to-message-id\",\n )\n : undefined,\n messageThreadId: options.messageThreadId\n ? parsePositiveInteger(options.messageThreadId, \"message-thread-id\")\n : undefined,\n });\n\n console.log(\n chalk.green(`✓ Message sent (message_id: ${result.messageId})`),\n );\n },\n ),\n );\n","import { readFileSync, statSync } from \"fs\";\nimport { basename, extname } from \"path\";\nimport { Command } from \"commander\";\nimport {\n completeTelegramFileUpload,\n initTelegramFileUpload,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nconst MIME_BY_EXTENSION: Record<string, string> = {\n \".png\": \"image/png\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".gif\": \"image/gif\",\n \".webp\": \"image/webp\",\n \".svg\": \"image/svg+xml\",\n \".mp4\": \"video/mp4\",\n \".webm\": \"video/webm\",\n \".mov\": \"video/quicktime\",\n \".pdf\": \"application/pdf\",\n \".txt\": \"text/plain\",\n \".csv\": \"text/csv\",\n \".md\": \"text/markdown\",\n \".json\": \"application/json\",\n};\n\nfunction inferContentType(localPath: string): string {\n const ext = extname(localPath).toLowerCase();\n return MIME_BY_EXTENSION[ext] ?? \"application/octet-stream\";\n}\n\nfunction parseMessageThreadId(value: string | undefined): number | undefined {\n if (!value) return undefined;\n const parsed = Number(value);\n if (!Number.isSafeInteger(parsed) || parsed <= 0) {\n throw new Error(\"message-thread-id must be a positive integer\");\n }\n return parsed;\n}\n\nexport const uploadFileCommand = new Command()\n .name(\"upload-file\")\n .description(\"Upload a local file to a Telegram chat as the bot\")\n .requiredOption(\"-f, --file <path>\", \"Local file path to upload\")\n .requiredOption(\"--bot-id <bot-id>\", \"Telegram bot id to send through\")\n .requiredOption(\"-c, --chat-id <chat-id>\", \"Telegram chat id or @channel\")\n .option(\"--caption <text>\", \"Caption to accompany the file\")\n .option(\"--message-thread-id <id>\", \"Forum topic message thread id\")\n .option(\"--content-type <mime>\", \"Override inferred content type\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload a file: zero telegram upload-file -f /tmp/report.pdf --bot-id 123456789 -c -1001234567890\n Upload to a topic: zero telegram upload-file -f /tmp/log.txt --bot-id 123456789 -c -1001234567890 --message-thread-id 42\n With a caption: zero telegram upload-file -f /tmp/data.csv --bot-id 123456789 -c @channel --caption \"Daily report\"\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"messageId\":123,\"chatId\":\"-1001234567890\",\"fileId\":\"...\",\"filename\":\"report.pdf\",\"mimetype\":\"application/pdf\",\"size\":12345,\"url\":\"https://...\"}\n\nNotes:\n - Uses the Telegram bot token on the server side\n - Uploads through VM0 storage first, then asks Telegram to fetch the file URL\n - VM0 does not apply file type or size restrictions before calling Telegram`,\n )\n .action(\n withErrorHandler(\n async (options: {\n file: string;\n botId: string;\n chatId: string;\n caption?: string;\n messageThreadId?: string;\n contentType?: string;\n }) => {\n let fileSize: number;\n try {\n const stat = statSync(options.file);\n if (!stat.isFile()) {\n throw new Error(`Not a regular file: ${options.file}`);\n }\n fileSize = stat.size;\n } catch (error) {\n if (error instanceof Error && error.message.startsWith(\"Not \")) {\n throw error;\n }\n throw new Error(`File not found: ${options.file}`);\n }\n\n if (fileSize === 0) {\n throw new Error(\"File is empty\");\n }\n const filename = basename(options.file);\n const contentType =\n options.contentType ?? inferContentType(options.file);\n const messageThreadId = parseMessageThreadId(options.messageThreadId);\n\n const prepared = await initTelegramFileUpload({\n filename,\n contentType,\n length: fileSize,\n });\n\n const fileContent = readFileSync(options.file);\n const uploadResponse = await fetch(prepared.uploadUrl, {\n method: \"PUT\",\n headers: { \"Content-Type\": prepared.contentType },\n body: new Uint8Array(fileContent),\n });\n\n if (!uploadResponse.ok) {\n throw new Error(\n `File upload failed: ${uploadResponse.status} ${uploadResponse.statusText}`,\n );\n }\n\n const result = await completeTelegramFileUpload({\n uploadId: prepared.uploadId,\n botId: options.botId,\n chatId: options.chatId,\n contentType: prepared.contentType,\n caption: options.caption,\n messageThreadId,\n });\n\n console.log(JSON.stringify(result));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport { downloadFileCommand } from \"./download-file\";\nimport { messageCommand } from \"./message\";\nimport { uploadFileCommand } from \"./upload-file\";\n\nexport const zeroPhoneCommand = new Command()\n .name(\"phone\")\n .description(\"Send AgentPhone messages, upload files, and download media\")\n .addCommand(messageCommand)\n .addCommand(downloadFileCommand)\n .addCommand(uploadFileCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Send a message: zero phone message --to +15551234567 -t \"Hello!\"\n Upload a file: zero phone upload-file -f /tmp/report.pdf --to +15551234567\n Download a file: zero phone download-file <file-id> -o /tmp/out.jpg`,\n );\n","import { basename, join } from \"path\";\nimport { tmpdir } from \"os\";\nimport { Command } from \"commander\";\nimport { downloadPhoneFile } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nfunction defaultOutPath(fileId: string): string {\n return join(tmpdir(), `phone-${basename(fileId)}`);\n}\n\nexport const downloadFileCommand = new Command()\n .name(\"download-file\")\n .description(\"Download an AgentPhone media file by id\")\n .argument(\n \"<file-id>\",\n \"AgentPhone message id from an [AgentPhone file] block\",\n )\n .option(\n \"-o, --out <path>\",\n \"Output path for the downloaded file (default: /tmp/phone-<file-id>)\",\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n Download to default temp path: zero phone download-file msg_123\n Download to explicit path: zero phone download-file msg_123 -o /tmp/photo.jpg\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"path\":\"/tmp/phone-msg_123\",\"mimetype\":\"image/jpeg\",\"size\":12345}\n\nHow to read the downloaded file:\n - Images (png/jpg/gif/webp/svg): open the file path with your image viewing tool\n - Videos (mp4/mov/webm): extract frames first with\n ffmpeg -i <path> -vf \"fps=1\" -q:v 2 /tmp/<file-id>_frame_%03d.jpg\n then view the extracted frames\n - PDF/text/csv/json/markdown: read the file directly`,\n )\n .action(\n withErrorHandler(async (fileId: string, options: { out?: string }) => {\n const outPath = options.out ?? defaultOutPath(fileId);\n const result = await downloadPhoneFile(fileId, outPath);\n console.log(JSON.stringify(result));\n }),\n );\n","import { readFileSync } from \"fs\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { sendPhoneMessage } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const messageCommand = new Command()\n .name(\"message\")\n .description(\"Send an AgentPhone text message\")\n .requiredOption(\"--to <phone>\", \"Connected phone handle to message\")\n .option(\"--agent-id <id>\", \"AgentPhone agent ID (inferred when omitted)\")\n .option(\"-t, --text <message>\", \"Message text\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Send a message: zero phone message --to +15551234567 -t \"Hello!\"\n From stdin: printf \"Hello!\" | zero phone message --to +15551234567\n\nNotes:\n - The phone handle must already be connected to the authenticated VM0 user\n - AgentPhone agent ID is inferred from the conversation when omitted`,\n )\n .action(\n withErrorHandler(\n async (options: { to: string; agentId?: string; text?: string }) => {\n let text = options.text;\n if (!text && process.stdin.isTTY === false) {\n text = readFileSync(\"/dev/stdin\", \"utf8\").trim();\n }\n\n if (!text) {\n throw new Error(\"Either --text or piped stdin must be provided\", {\n cause: new Error(\n 'Usage: zero phone message --to +15551234567 -t \"your message\"',\n ),\n });\n }\n\n const result = await sendPhoneMessage({\n toNumber: options.to,\n text,\n agentphoneAgentId: options.agentId,\n });\n\n console.log(\n chalk.green(`✓ Message sent (message_id: ${result.messageId})`),\n );\n },\n ),\n );\n","import { readFileSync, statSync } from \"fs\";\nimport { basename, extname } from \"path\";\nimport { Command } from \"commander\";\nimport { completePhoneFileUpload, initPhoneFileUpload } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nconst MIME_BY_EXTENSION: Record<string, string> = {\n \".png\": \"image/png\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".gif\": \"image/gif\",\n \".webp\": \"image/webp\",\n \".svg\": \"image/svg+xml\",\n \".mp4\": \"video/mp4\",\n \".webm\": \"video/webm\",\n \".mov\": \"video/quicktime\",\n \".pdf\": \"application/pdf\",\n \".txt\": \"text/plain\",\n \".csv\": \"text/csv\",\n \".md\": \"text/markdown\",\n \".json\": \"application/json\",\n};\n\nfunction inferContentType(localPath: string): string {\n const ext = extname(localPath).toLowerCase();\n return MIME_BY_EXTENSION[ext] ?? \"application/octet-stream\";\n}\n\nexport const uploadFileCommand = new Command()\n .name(\"upload-file\")\n .description(\"Upload a local file to an AgentPhone conversation\")\n .requiredOption(\"-f, --file <path>\", \"Local file path to upload\")\n .requiredOption(\"--to <phone>\", \"Connected phone handle to message\")\n .option(\"--agent-id <id>\", \"AgentPhone agent ID (inferred when omitted)\")\n .option(\"--caption <text>\", \"Caption to accompany the file\")\n .option(\"--content-type <mime>\", \"Override inferred content type\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload a file: zero phone upload-file -f /tmp/report.pdf --to +15551234567\n With a caption: zero phone upload-file -f /tmp/photo.jpg --to +15551234567 --caption \"Here it is\"\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"messageId\":\"msg_123\",\"toNumber\":\"+15551234567\",\"filename\":\"report.pdf\",\"mimetype\":\"application/pdf\",\"size\":12345,\"url\":\"https://...\"}`,\n )\n .action(\n withErrorHandler(\n async (options: {\n file: string;\n to: string;\n agentId?: string;\n caption?: string;\n contentType?: string;\n }) => {\n let fileSize: number;\n try {\n const stat = statSync(options.file);\n if (!stat.isFile()) {\n throw new Error(`Not a regular file: ${options.file}`);\n }\n fileSize = stat.size;\n } catch (error) {\n if (error instanceof Error && error.message.startsWith(\"Not \")) {\n throw error;\n }\n throw new Error(`File not found: ${options.file}`);\n }\n\n if (fileSize === 0) {\n throw new Error(\"File is empty\");\n }\n\n const filename = basename(options.file);\n const contentType =\n options.contentType ?? inferContentType(options.file);\n\n const prepared = await initPhoneFileUpload({\n filename,\n contentType,\n length: fileSize,\n });\n\n const fileContent = readFileSync(options.file);\n const uploadResponse = await fetch(prepared.uploadUrl, {\n method: \"PUT\",\n headers: { \"Content-Type\": prepared.contentType },\n body: new Uint8Array(fileContent),\n });\n\n if (!uploadResponse.ok) {\n throw new Error(\n `File upload failed: ${uploadResponse.status} ${uploadResponse.statusText}`,\n );\n }\n\n const result = await completePhoneFileUpload({\n uploadId: prepared.uploadId,\n toNumber: options.to,\n agentphoneAgentId: options.agentId,\n contentType: prepared.contentType,\n caption: options.caption,\n });\n\n console.log(JSON.stringify(result));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport { listCommand } from \"./list\";\nimport { setCommand } from \"./set\";\nimport { deleteCommand } from \"./delete\";\n\nexport const zeroVariableCommand = new Command()\n .name(\"variable\")\n .description(\"Read or write non-sensitive configuration values\")\n .addCommand(listCommand)\n .addCommand(setCommand)\n .addCommand(deleteCommand);\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroVariables } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\n/**\n * Truncate value for display if too long\n */\nfunction truncateValue(value: string, maxLength: number = 60): string {\n if (value.length <= maxLength) {\n return value;\n }\n return value.slice(0, maxLength - 15) + \"... [truncated]\";\n}\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List all variables\")\n .action(\n withErrorHandler(async () => {\n const result = await listZeroVariables();\n\n if (result.variables.length === 0) {\n console.log(chalk.dim(\"No variables found\"));\n console.log();\n console.log(\"To add a variable:\");\n console.log(chalk.cyan(\" zero variable set MY_VAR <value>\"));\n return;\n }\n\n console.log(chalk.bold(\"Variables:\"));\n console.log();\n\n for (const variable of result.variables) {\n const displayValue = truncateValue(variable.value);\n console.log(` ${chalk.cyan(variable.name)} = ${displayValue}`);\n if (variable.description) {\n console.log(` ${chalk.dim(variable.description)}`);\n }\n console.log(\n ` ${chalk.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`,\n );\n console.log();\n }\n\n console.log(chalk.dim(`Total: ${result.variables.length} variable(s)`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { setZeroVariable } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const setCommand = new Command()\n .name(\"set\")\n .description(\"Create or update a variable\")\n .argument(\"<name>\", \"Variable name (uppercase, e.g., MY_VAR)\")\n .argument(\"<value>\", \"Variable value\")\n .option(\"-d, --description <description>\", \"Optional description\")\n .action(\n withErrorHandler(\n async (\n name: string,\n value: string,\n options: { description?: string },\n ) => {\n let variable;\n try {\n variable = await setZeroVariable({\n name,\n value,\n description: options.description,\n });\n } catch (error) {\n if (\n error instanceof Error &&\n error.message.includes(\"must contain only uppercase\")\n ) {\n throw new Error(error.message, {\n cause: new Error(\n \"Examples of valid variable names: MY_VAR, API_URL, DEBUG_MODE\",\n ),\n });\n }\n throw error;\n }\n\n console.log(chalk.green(`✓ Variable \"${variable.name}\" saved`));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { deleteZeroVariable } from \"../../../lib/api\";\nimport { isInteractive, promptConfirm } from \"../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const deleteCommand = new Command()\n .name(\"delete\")\n .description(\"Delete a variable\")\n .argument(\"<name>\", \"Variable name to delete\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .action(\n withErrorHandler(async (name: string, options: { yes?: boolean }) => {\n if (!options.yes) {\n if (!isInteractive()) {\n throw new Error(\"--yes flag is required in non-interactive mode\");\n }\n\n const confirmed = await promptConfirm(\n `Are you sure you want to delete variable \"${name}\"?`,\n false,\n );\n\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteZeroVariable(name);\n console.log(chalk.green(`✓ Variable \"${name}\" deleted`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n getApiUrl,\n getActiveOrg,\n getToken,\n decodeZeroTokenPayload,\n} from \"../../lib/api/config\";\nimport {\n listZeroConnectors,\n getZeroAgent,\n getZeroAgentUserConnectors,\n} from \"../../lib/api\";\nimport { withErrorHandler } from \"../../lib/command\";\nimport {\n isFirewallConnectorType,\n getConnectorFirewall,\n resolveFirewallPolicies,\n} from \"@vm0/connectors/firewalls\";\nimport type { FirewallPolicies } from \"@vm0/connectors/firewall-types\";\nimport { policyIcon } from \"../../lib/utils/format-utils\";\n\n/**\n * Detect if running inside a zero sandbox (agent runtime).\n * Uses ZERO_AGENT_ID (not VM0_RUN_ID) because the zero CLI operates in the\n * zero agent context where ZERO_AGENT_ID is the canonical sandbox indicator.\n */\nfunction isInsideSandbox(): boolean {\n return !!process.env.ZERO_AGENT_ID;\n}\n\nfunction formatConnectorIdentity(connector: {\n externalUsername: string | null;\n externalEmail: string | null;\n needsReconnect: boolean;\n}): string {\n let identity = \"\";\n if (connector.externalUsername && connector.externalEmail) {\n identity = `@${connector.externalUsername} (${connector.externalEmail})`;\n } else if (connector.externalUsername) {\n identity = `@${connector.externalUsername}`;\n } else if (connector.externalEmail) {\n identity = connector.externalEmail;\n }\n if (connector.needsReconnect) {\n identity += ` ${chalk.yellow(\"(needs reconnect)\")}`;\n }\n return identity;\n}\n\nfunction printConnectorPermissions(\n type: string,\n resolvedPolicies: FirewallPolicies | null,\n): void {\n if (!isFirewallConnectorType(type)) return;\n\n const refPolicy = resolvedPolicies?.[type];\n if (!refPolicy) {\n console.log(chalk.dim(\" full access — no permission rules configured\"));\n return;\n }\n\n const config = getConnectorFirewall(type);\n const permissions = config.apis.flatMap((a) => {\n return a.permissions ?? [];\n });\n\n if (\n permissions.length === 0 &&\n Object.keys(refPolicy.policies).length === 0\n ) {\n const unknownIcon = policyIcon(refPolicy.unknownPolicy ?? \"allow\");\n console.log(` ${unknownIcon} unknown endpoints`);\n return;\n }\n\n const nameWidth = Math.max(\n \"unknown endpoints\".length,\n ...permissions.map((p) => {\n return p.name.length;\n }),\n );\n\n for (const perm of permissions) {\n const policy = refPolicy.policies[perm.name] ?? \"deny\";\n const icon = policyIcon(policy);\n const desc = perm.description ?? \"\";\n console.log(` ${icon} ${perm.name.padEnd(nameWidth)} ${desc}`);\n }\n\n const unknownIcon = policyIcon(refPolicy.unknownPolicy ?? \"allow\");\n console.log(\n ` ${unknownIcon} ${\"unknown endpoints\".padEnd(nameWidth)} Endpoints not matching any rule`,\n );\n}\n\nasync function showSandboxInfo(showPermissions: boolean): Promise<void> {\n const agentId = process.env.ZERO_AGENT_ID;\n const payload = decodeZeroTokenPayload();\n\n console.log(`Agent ID: ${agentId}`);\n console.log(`Run ID: ${payload?.runId ?? chalk.dim(\"unavailable\")}`);\n console.log(`Org ID: ${payload?.orgId ?? chalk.dim(\"unavailable\")}`);\n\n // Capabilities section\n if (payload?.capabilities?.length) {\n console.log();\n console.log(chalk.bold(\"Capabilities:\"));\n console.log(` ${payload.capabilities.join(\", \")}`);\n }\n\n // Connected Services section\n try {\n if (showPermissions) {\n // Full mode: fetch all 3 APIs for permission details\n const [connectorsResult, agentResult, enabledResult] =\n await Promise.allSettled([\n listZeroConnectors(),\n getZeroAgent(agentId!),\n getZeroAgentUserConnectors(agentId!),\n ]);\n\n if (connectorsResult.status === \"rejected\") return;\n\n const identities = connectorsResult.value.connectors.filter((c) => {\n return c.externalUsername !== null || c.externalEmail !== null;\n });\n\n if (identities.length === 0) return;\n\n let resolvedPolicies: FirewallPolicies | null = null;\n const permissionDataAvailable =\n agentResult.status === \"fulfilled\" &&\n enabledResult.status === \"fulfilled\";\n if (permissionDataAvailable) {\n resolvedPolicies = resolveFirewallPolicies(\n agentResult.value.permissionPolicies,\n enabledResult.value,\n );\n }\n\n console.log();\n console.log(chalk.bold(\"Connectors:\"));\n for (const connector of identities) {\n const identity = formatConnectorIdentity(connector);\n console.log(` ${connector.type.padEnd(14)}${identity}`);\n\n if (permissionDataAvailable) {\n printConnectorPermissions(connector.type, resolvedPolicies);\n }\n }\n } else {\n // Default mode: only fetch connector identities (1 API call)\n const connectors = await listZeroConnectors();\n const identities = connectors.connectors.filter((c) => {\n return c.externalUsername !== null || c.externalEmail !== null;\n });\n\n if (identities.length === 0) return;\n\n console.log();\n console.log(chalk.bold(\"Connectors:\"));\n for (const connector of identities) {\n const identity = formatConnectorIdentity(connector);\n console.log(` ${connector.type.padEnd(14)}${identity}`);\n }\n }\n } catch {\n // Silently skip — connector info is supplementary\n }\n}\n\nasync function showLocalInfo(): Promise<void> {\n const token = await getToken();\n const apiUrl = await getApiUrl();\n const activeOrg = await getActiveOrg();\n\n // Auth section\n console.log(chalk.bold(\"Auth:\"));\n if (token) {\n const tokenSource = process.env.ZERO_TOKEN\n ? \"ZERO_TOKEN env var\"\n : process.env.VM0_TOKEN\n ? \"VM0_TOKEN env var\"\n : \"config file\";\n console.log(\n ` Status: ${chalk.green(\"Authenticated\")} (via ${tokenSource})`,\n );\n } else {\n console.log(` Status: ${chalk.dim(\"Not authenticated\")}`);\n }\n console.log(` API: ${apiUrl}`);\n console.log();\n\n // Org section\n if (activeOrg) {\n console.log(chalk.bold(\"Org:\"));\n console.log(` Active: ${activeOrg}`);\n }\n}\n\nexport const zeroWhoamiCommand = new Command()\n .name(\"whoami\")\n .description(\"Show agent identity, run ID, and capabilities\")\n .option(\"--permissions\", \"Show full permission details for each connector\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero whoami\n zero whoami --permissions\n\nNotes:\n - Inside sandbox: shows agent ID, run ID, org ID, and granted capabilities\n - Use --permissions to see detailed permission breakdown per connector\n - Your agent ID is also available as $ZERO_AGENT_ID`,\n )\n .action(\n withErrorHandler(async (options: { permissions?: boolean }) => {\n if (isInsideSandbox()) {\n await showSandboxInfo(options.permissions ?? false);\n } else {\n await showLocalInfo();\n }\n }),\n );\n","import { Command } from \"commander\";\nimport { createCommand } from \"./create\";\nimport { editCommand } from \"./edit\";\nimport { viewCommand } from \"./view\";\nimport { listCommand } from \"./list\";\nimport { deleteCommand } from \"./delete\";\n\nexport const zeroSkillCommand = new Command(\"skill\")\n .description(\"Manage custom skills\")\n .addCommand(createCommand)\n .addCommand(editCommand)\n .addCommand(viewCommand)\n .addCommand(listCommand)\n .addCommand(deleteCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Create from directory: zero skill create my-skill --dir ./skills/my-skill/\n List all skills: zero skill list\n View skill content: zero skill view my-skill\n Update skill content: zero skill edit my-skill --dir ./skills/my-skill/\n Delete a skill: zero skill delete my-skill -y\n\nSkill Binding:\n Bind to agent: zero agent edit <id> --add-skill my-skill\n Unbind from agent: zero agent edit <id> --remove-skill my-skill\n Replace all skills: zero agent edit <id> --skills a,b,c`,\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { createSkill } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { readSkillDirectory } from \"../../../lib/skill-directory\";\n\nexport const createCommand = new Command()\n .name(\"create\")\n .description(\"Create a custom skill in the organization\")\n .argument(\"<name>\", \"Skill name (lowercase alphanumeric with hyphens)\")\n .requiredOption(\"--dir <path>\", \"Path to directory containing SKILL.md\")\n .option(\"--display-name <name>\", \"Skill display name\")\n .option(\"--description <text>\", \"Skill description\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero skill create my-skill --dir ./skills/my-skill/\n zero skill create my-skill --dir ./skills/my-skill/ --display-name \"My Skill\" --description \"Does things\"\n\nNotes:\n - The directory must contain a SKILL.md file\n - All files in the directory are uploaded (hidden files and node_modules excluded)\n - The skill is created in the organization but not bound to any agent\n - Use 'zero agent edit <id> --add-skill <name>' to bind a skill to an agent`,\n )\n .action(\n withErrorHandler(\n async (\n name: string,\n options: {\n dir: string;\n displayName?: string;\n description?: string;\n },\n ) => {\n const files = readSkillDirectory(options.dir);\n\n const skill = await createSkill({\n name,\n files,\n displayName: options.displayName,\n description: options.description,\n });\n\n console.log(chalk.green(`✓ Skill \"${skill.name}\" created`));\n console.log(` Name: ${skill.name}`);\n console.log(` Files: ${files.length} file(s)`);\n if (skill.displayName) {\n console.log(` Display Name: ${skill.displayName}`);\n }\n if (skill.description) {\n console.log(` Description: ${skill.description}`);\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 files from a skill directory.\n *\n * Skips hidden files (starting with .), node_modules, and .git.\n * Throws if SKILL.md is not found at the root.\n */\nexport function readSkillDirectory(\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 files.push({\n path: relPath,\n content: readFileSync(join(dir, entry.name), \"utf-8\"),\n });\n }\n }\n }\n\n walk(dirPath, \"\");\n\n if (\n !files.some((f) => {\n return f.path === \"SKILL.md\";\n })\n ) {\n throw new Error(`SKILL.md not found in ${dirPath}`);\n }\n\n return files;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { updateSkill } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { readSkillDirectory } from \"../../../lib/skill-directory\";\n\nexport const editCommand = new Command()\n .name(\"edit\")\n .description(\"Update a custom skill's content\")\n .argument(\"<name>\", \"Skill name\")\n .requiredOption(\n \"--dir <path>\",\n \"Path to directory containing updated skill files\",\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n zero skill edit my-skill --dir ./skills/my-skill/`,\n )\n .action(\n withErrorHandler(async (name: string, options: { dir: string }) => {\n const files = readSkillDirectory(options.dir);\n await updateSkill(name, { files });\n\n console.log(\n chalk.green(`✓ Skill \"${name}\" updated (${files.length} file(s))`),\n );\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getSkill } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const viewCommand = new Command()\n .name(\"view\")\n .description(\"View a custom skill\")\n .argument(\"<name>\", \"Skill name\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero skill view my-skill`,\n )\n .action(\n withErrorHandler(async (name: string) => {\n const skill = await getSkill(name);\n\n console.log(chalk.bold(skill.name));\n if (skill.displayName) console.log(chalk.dim(skill.displayName));\n console.log();\n console.log(`Name: ${skill.name}`);\n if (skill.displayName) console.log(`Display Name: ${skill.displayName}`);\n if (skill.description) console.log(`Description: ${skill.description}`);\n\n if (skill.files && skill.files.length > 0) {\n console.log();\n console.log(chalk.dim(\"── Files ──\"));\n for (const f of skill.files) {\n console.log(` ${f.path} (${f.size} bytes)`);\n }\n }\n\n console.log();\n if (skill.content) {\n console.log(chalk.dim(\"── SKILL.md ──\"));\n console.log(skill.content);\n } else {\n console.log(chalk.dim(\"No content\"));\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listSkills } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List custom skills in the organization\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero skill list`,\n )\n .action(\n withErrorHandler(async () => {\n const skills = await listSkills();\n\n if (skills.length === 0) {\n console.log(chalk.dim(\"No custom skills found\"));\n console.log(\n chalk.dim(\" Create one with: zero skill create <name> --dir <path>\"),\n );\n return;\n }\n\n const nameWidth = Math.max(\n 4,\n ...skills.map((s) => {\n return s.name.length;\n }),\n );\n const displayWidth = Math.max(\n 12,\n ...skills.map((s) => {\n return (s.displayName ?? \"\").length;\n }),\n );\n\n const header = [\n \"NAME\".padEnd(nameWidth),\n \"DISPLAY NAME\".padEnd(displayWidth),\n \"DESCRIPTION\",\n ].join(\" \");\n console.log(chalk.dim(header));\n\n for (const skill of skills) {\n const row = [\n skill.name.padEnd(nameWidth),\n (skill.displayName ?? \"-\").padEnd(displayWidth),\n skill.description ?? \"-\",\n ].join(\" \");\n console.log(row);\n }\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getSkill, deleteSkill } from \"../../../lib/api\";\nimport { isInteractive, promptConfirm } from \"../../../lib/utils/prompt-utils\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const deleteCommand = new Command()\n .name(\"delete\")\n .alias(\"rm\")\n .description(\"Delete a custom skill from the organization\")\n .argument(\"<name>\", \"Skill name\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero skill delete my-skill\n zero skill delete my-skill -y\n\nNotes:\n - This removes the skill from the organization and unbinds it from all agents\n - Use -y to skip confirmation in non-interactive mode`,\n )\n .action(\n withErrorHandler(async (name: string, options: { yes?: boolean }) => {\n await getSkill(name);\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 skill '${name}'? This will unbind it from all agents.`,\n false,\n );\n if (!confirmed) {\n console.log(chalk.dim(\"Cancelled\"));\n return;\n }\n }\n\n await deleteSkill(name);\n console.log(chalk.green(`✓ Skill \"${name}\" deleted`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getZeroRunAgentEvents, type RunEvent } from \"../../../lib/api\";\nimport { parseTime } from \"../../../lib/utils/time-parser\";\nimport { EventStreamNormalizer } from \"../../../lib/events/event-stream-normalizer\";\nimport { EventRenderer } from \"../../../lib/events/event-renderer\";\nimport { paginate } from \"../../../lib/utils/paginate\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { isUUID } from \"../../run/shared\";\nimport { listCommand } from \"./list\";\nimport { searchCommand } from \"./search\";\n\nconst PAGE_LIMIT = 100;\n\nfunction renderAgentEvent(\n event: RunEvent,\n renderer: EventRenderer,\n normalizer: EventStreamNormalizer,\n framework: string,\n): void {\n const parsedEvents = normalizer.process(\n event.eventData,\n framework,\n new Date(event.createdAt),\n );\n for (const parsed of parsedEvents) {\n renderer.render(parsed);\n }\n}\n\nasync function showAgentEvents(\n runId: string,\n options: {\n since?: number;\n targetCount: number | \"all\";\n order: \"asc\" | \"desc\";\n },\n): Promise<void> {\n const firstResponse = await getZeroRunAgentEvents(runId, {\n since: options.since,\n limit: PAGE_LIMIT,\n order: options.order,\n });\n\n if (firstResponse.events.length === 0) {\n console.log(chalk.yellow(\"No agent events found for this run\"));\n return;\n }\n\n let allEvents: RunEvent[];\n\n if (\n !firstResponse.hasMore ||\n (options.targetCount !== \"all\" &&\n firstResponse.events.length >= options.targetCount)\n ) {\n allEvents =\n options.targetCount === \"all\"\n ? firstResponse.events\n : firstResponse.events.slice(0, options.targetCount);\n } else {\n const lastEvent = firstResponse.events[firstResponse.events.length - 1];\n const firstPageTimestamp = lastEvent\n ? new Date(lastEvent.createdAt).getTime()\n : undefined;\n\n const remainingEvents = await paginate<RunEvent>({\n fetchPage: async (since) => {\n const response = await getZeroRunAgentEvents(runId, {\n since,\n limit: PAGE_LIMIT,\n order: options.order,\n });\n return { items: response.events, hasMore: response.hasMore };\n },\n getTimestamp: (event) => {\n return new Date(event.createdAt).getTime();\n },\n targetCount:\n options.targetCount === \"all\"\n ? \"all\"\n : options.targetCount - firstResponse.events.length,\n initialSince: firstPageTimestamp,\n });\n\n allEvents = [...firstResponse.events, ...remainingEvents];\n\n if (\n options.targetCount !== \"all\" &&\n allEvents.length > options.targetCount\n ) {\n allEvents = allEvents.slice(0, options.targetCount);\n }\n }\n\n const events =\n options.order === \"desc\" ? [...allEvents].reverse() : allEvents;\n\n const renderer = new EventRenderer({\n showTimestamp: true,\n verbose: true,\n });\n const normalizer = new EventStreamNormalizer();\n const framework = firstResponse.framework;\n\n for (const event of events) {\n renderAgentEvent(event, renderer, normalizer, framework);\n }\n for (const parsed of normalizer.flush()) {\n renderer.render(parsed);\n }\n}\n\nexport const zeroLogsCommand = new Command()\n .name(\"logs\")\n .description(\"View and search agent run logs\")\n .argument(\"[runId]\", \"Run ID to view agent events for\")\n .addCommand(listCommand)\n .addCommand(searchCommand)\n .option(\n \"--since <time>\",\n \"Show logs since timestamp (e.g., 5m, 2h, 1d, 2024-01-15T10:30:00Z)\",\n )\n .option(\"--tail <n>\", \"Show last N entries (default: 5)\")\n .option(\"--head <n>\", \"Show first N entries\")\n .option(\"--all\", \"Fetch all log entries\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero logs list\n zero logs <runId>\n zero logs <runId> --tail 10\n zero logs <runId> --all\n zero logs search \"error\"`,\n )\n .action(\n withErrorHandler(\n async (\n runId: string | undefined,\n options: {\n since?: string;\n tail?: string;\n head?: string;\n all?: boolean;\n },\n ) => {\n if (!runId) {\n zeroLogsCommand.help();\n return;\n }\n\n if (!isUUID(runId)) {\n console.error(\n chalk.red(`✗ Invalid run ID \"${runId}\" — expected a UUID`),\n );\n console.error(chalk.dim(\" Run: zero logs list to find run IDs\"));\n process.exit(1);\n }\n\n const countModes = [\n options.tail !== undefined,\n options.head !== undefined,\n options.all === true,\n ].filter(Boolean).length;\n if (countModes > 1) {\n throw new Error(\n \"Options --tail, --head, and --all are mutually exclusive\",\n );\n }\n\n let since: number | undefined;\n if (options.since) {\n since = parseTime(options.since);\n }\n\n const isAll = options.all === true;\n const isHead = options.head !== undefined;\n const isTail = options.tail !== undefined;\n\n let targetCount: number | \"all\";\n if (isAll) {\n targetCount = \"all\";\n } else if (isHead) {\n targetCount = Math.max(1, parseInt(options.head!, 10));\n } else if (isTail) {\n targetCount = Math.max(1, parseInt(options.tail!, 10));\n } else {\n targetCount = 5;\n }\n\n const order: \"asc\" | \"desc\" = isHead ? \"asc\" : \"desc\";\n\n await showAgentEvents(runId, { since, targetCount, order });\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroLogs } from \"../../../lib/api\";\nimport { parseTime } from \"../../../lib/utils/time-parser\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nfunction formatStatus(status: string): string {\n switch (status) {\n case \"completed\":\n return chalk.green(status);\n case \"failed\":\n case \"timeout\":\n return chalk.red(status);\n case \"running\":\n case \"pending\":\n case \"queued\":\n return chalk.yellow(status);\n case \"cancelled\":\n return chalk.dim(status);\n default:\n return status;\n }\n}\n\nfunction formatTime(iso: string): string {\n return new Date(iso).toISOString().replace(/\\.\\d{3}Z$/, \"Z\");\n}\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List agent run logs\")\n .option(\"--agent <id>\", \"Filter by Zero agent ID\")\n .option(\n \"--status <status>\",\n \"Filter by status (queued|pending|running|completed|failed|timeout|cancelled)\",\n )\n .option(\n \"--since <time>\",\n \"Filter runs created since (e.g., 5m, 2h, 1d, 2024-01-15T10:30:00Z)\",\n )\n .option(\"--limit <n>\", \"Maximum number of results (default: 20)\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero logs list\n zero logs list --agent 123e4567-e89b-12d3-a456-426614174000\n zero logs list --status completed --limit 10\n zero logs list --since 1h\n zero logs list --since 1d --status completed`,\n )\n .action(\n withErrorHandler(\n async (options: {\n agent?: string;\n status?: string;\n since?: string;\n limit?: string;\n }) => {\n const limit = options.limit ? parseInt(options.limit, 10) : undefined;\n const since = options.since ? parseTime(options.since) : undefined;\n\n const result = await listZeroLogs({\n agentId: options.agent,\n status: options.status,\n since,\n limit,\n });\n\n if (result.data.length === 0) {\n console.log(chalk.dim(\"No logs found\"));\n return;\n }\n\n const nameCol = Math.max(\n 5,\n ...result.data.map((r) => {\n return (r.displayName || r.agentId || \"-\").length;\n }),\n );\n const statusCol = Math.max(\n 6,\n ...result.data.map((r) => {\n return r.status.length;\n }),\n );\n\n const header = [\n \"RUN ID\".padEnd(38),\n \"AGENT\".padEnd(nameCol),\n \"STATUS\".padEnd(statusCol),\n \"CREATED\",\n ].join(\" \");\n console.log(chalk.dim(header));\n\n for (const entry of result.data) {\n const runId = entry.id;\n const name = entry.displayName || entry.agentId || \"-\";\n const row = [\n runId.padEnd(38),\n name.padEnd(nameCol),\n formatStatus(entry.status).padEnd(statusCol),\n formatTime(entry.createdAt),\n ].join(\" \");\n console.log(row);\n }\n\n if (result.pagination.hasMore) {\n console.log();\n console.log(\n chalk.dim(\n ` Showing ${result.data.length} of more results. Use --limit to adjust.`,\n ),\n );\n }\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n searchZeroLogs,\n type RunEvent,\n type LogsSearchResponse,\n} from \"../../../lib/api\";\nimport { parseTime } from \"../../../lib/utils/time-parser\";\nimport { parseEvent } from \"../../../lib/events/event-parser-factory\";\nimport { EventRenderer } from \"../../../lib/events/event-renderer\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { isUUID } from \"../../run/shared\";\n\nconst SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1000;\n\nexport interface LogsSearchCliOptions {\n afterContext?: string;\n beforeContext?: string;\n context?: string;\n agentId?: string;\n run?: string;\n since?: string;\n limit?: string;\n}\n\ninterface LogsSearchCommandOptions extends Omit<\n LogsSearchCliOptions,\n \"agentId\"\n> {\n agent?: string;\n}\n\nfunction renderEvent(event: RunEvent, renderer: EventRenderer): void {\n const eventData = event.eventData as Record<string, unknown>;\n const parsed = parseEvent(eventData);\n if (parsed) {\n parsed.timestamp = new Date(event.createdAt);\n renderer.render(parsed);\n }\n}\n\nfunction formatRunHeader(\n runId: string,\n agentName: string,\n timestamp: string,\n): string {\n const time = new Date(timestamp).toISOString().replace(/\\.\\d{3}Z$/, \"Z\");\n return `── Run ${runId} (${agentName}, ${time}) ──────────`;\n}\n\nfunction parseContextOptions(options: LogsSearchCliOptions): {\n before: number;\n after: number;\n} {\n const contextN = options.context ? parseInt(options.context, 10) : 0;\n const before = options.beforeContext\n ? parseInt(options.beforeContext, 10)\n : contextN;\n const after = options.afterContext\n ? parseInt(options.afterContext, 10)\n : contextN;\n\n if (isNaN(before) || before < 0 || before > 10) {\n throw new Error(\"--before-context must be between 0 and 10\");\n }\n if (isNaN(after) || after < 0 || after > 10) {\n throw new Error(\"--after-context must be between 0 and 10\");\n }\n\n return { before, after };\n}\n\nfunction parseLimit(value: string | undefined): number | undefined {\n if (!value) return undefined;\n const limit = parseInt(value, 10);\n if (isNaN(limit) || limit < 1 || limit > 50) {\n throw new Error(\"--limit must be between 1 and 50\");\n }\n return limit;\n}\n\nfunction renderResults(response: LogsSearchResponse): void {\n const grouped = new Map<\n string,\n { agentName: string; results: LogsSearchResponse[\"results\"] }\n >();\n for (const result of response.results) {\n const existing = grouped.get(result.runId);\n if (existing) {\n existing.results.push(result);\n } else {\n grouped.set(result.runId, {\n agentName: result.agentName,\n results: [result],\n });\n }\n }\n\n let isFirstGroup = true;\n for (const [runId, group] of grouped) {\n if (!isFirstGroup) {\n console.log();\n }\n isFirstGroup = false;\n\n const firstTimestamp = group.results[0]!.matchedEvent.createdAt;\n console.log(\n chalk.bold(formatRunHeader(runId, group.agentName, firstTimestamp)),\n );\n\n for (const result of group.results) {\n const renderer = new EventRenderer({\n showTimestamp: true,\n verbose: false,\n buffered: false,\n });\n\n for (const event of result.contextBefore) {\n renderEvent(event, renderer);\n }\n renderEvent(result.matchedEvent, renderer);\n for (const event of result.contextAfter) {\n renderEvent(event, renderer);\n }\n }\n }\n\n if (response.hasMore) {\n console.log();\n console.log(\n chalk.dim(\n ` Showing first ${response.results.length} matches. Use --limit to see more.`,\n ),\n );\n }\n}\n\nexport async function runLogsSearch(\n keyword: string,\n options: LogsSearchCliOptions,\n): Promise<void> {\n const { before, after } = parseContextOptions(options);\n\n if (options.run && !isUUID(options.run)) {\n console.error(\n chalk.red(`✗ Invalid run ID \"${options.run}\" — expected a UUID`),\n );\n console.error(chalk.dim(\" Run: zero logs list to find run IDs\"));\n process.exit(1);\n }\n\n const since = options.since\n ? parseTime(options.since)\n : Date.now() - SEVEN_DAYS_MS;\n const limit = parseLimit(options.limit);\n\n const response = await searchZeroLogs({\n keyword,\n agentId: options.agentId,\n runId: options.run,\n since,\n limit,\n before,\n after,\n });\n\n if (response.results.length === 0) {\n console.log(chalk.dim(\"No matches found\"));\n console.log(\n chalk.dim(\n \" Try a broader search with --since 30d or a different keyword\",\n ),\n );\n return;\n }\n\n renderResults(response);\n}\n\nexport const searchCommand = new Command()\n .name(\"search\")\n .description(\"Search agent events across runs\")\n .argument(\"<keyword>\", \"Search keyword\")\n .option(\"-A, --after-context <n>\", \"Show n events after each match\")\n .option(\"-B, --before-context <n>\", \"Show n events before each match\")\n .option(\"-C, --context <n>\", \"Show n events before and after each match\")\n .option(\"--agent <id>\", \"Filter by Zero agent ID\")\n .option(\"--run <id>\", \"Filter by specific run ID\")\n .option(\"--since <time>\", \"Search logs since (default: 7d)\")\n .option(\"--limit <n>\", \"Maximum number of matches (default: 20)\")\n .addHelpText(\n \"after\",\n `\nExamples:\n zero logs search \"error\"\n zero logs search \"timeout\" --agent 123e4567-e89b-12d3-a456-426614174000 -C 2\n zero logs search \"failed\" --since 30d --limit 50`,\n )\n .action(\n withErrorHandler(\n async (keyword: string, options: LogsSearchCommandOptions) => {\n const { agent, ...searchOptions } = options;\n await runLogsSearch(keyword, { ...searchOptions, agentId: agent });\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { runLogsSearch, type LogsSearchCliOptions } from \"../logs/search\";\nimport { searchZeroChat } from \"../../../lib/api\";\nimport type {\n ChatSearchMessage,\n ChatSearchResponse,\n} from \"@vm0/api-contracts/contracts/chat-threads\";\nimport { parseTime } from \"../../../lib/utils/time-parser\";\n\nconst SUPPORTED_SOURCES = [\"logs\", \"chat\", \"slack\"] as const;\ntype Source = (typeof SUPPORTED_SOURCES)[number];\n\nconst SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1000;\n\nexport const SEARCH_EXPLAINER = `\nAvailable sources:\n logs full agent event stream (tool calls, tokens, system events) from agent runs\n chat user/assistant text messages as shown in the web chat UI\n slack returns a recipe for calling the Slack API directly; requires the Slack connector\n\nUsage: zero search <query> --source <logs|chat|slack> [flags]\nRun 'zero search --help' for all flags.`;\n\nexport function buildSlackRecipe(query: string): string {\n const encoded = encodeURIComponent(query);\n return `The \\`slack\\` source does not call Slack from this CLI. Run the\nfollowing inside an agent sandbox that has $SLACK_TOKEN available:\n\n curl -H \"Authorization: Bearer $SLACK_TOKEN\" \\\\\n \"https://slack.com/api/search.messages?query=${encoded}\"\n\nIf you don't have $SLACK_TOKEN, check the connector status:\n zero connector status slack\n\nTo verify the token and network policy end-to-end:\n zero doctor check-connector --env-name SLACK_TOKEN\n\nSlack API docs: https://api.slack.com/methods/search.messages\n\nNote: CLI-local flags (--limit, --since, -A/-B/-C) are ignored for the\nslack source. Pass equivalents to Slack's API via count= / highlight=\nquery parameters instead.`;\n}\n\ninterface SearchOptions {\n source: string[];\n agent?: string;\n run?: string;\n since?: string;\n limit?: string;\n afterContext?: string;\n beforeContext?: string;\n context?: string;\n}\n\nfunction collectSource(value: string, previous: string[]): string[] {\n return [...previous, value];\n}\n\nfunction parseContextOptions(options: SearchOptions): {\n before: number;\n after: number;\n} {\n const contextN = options.context ? parseInt(options.context, 10) : 0;\n const before = options.beforeContext\n ? parseInt(options.beforeContext, 10)\n : contextN;\n const after = options.afterContext\n ? parseInt(options.afterContext, 10)\n : contextN;\n\n if (isNaN(before) || before < 0 || before > 10) {\n throw new Error(\"--before-context must be between 0 and 10\");\n }\n if (isNaN(after) || after < 0 || after > 10) {\n throw new Error(\"--after-context must be between 0 and 10\");\n }\n\n return { before, after };\n}\n\nfunction parseLimit(value: string | undefined): number | undefined {\n if (!value) return undefined;\n const limit = parseInt(value, 10);\n if (isNaN(limit) || limit < 1 || limit > 50) {\n throw new Error(\"--limit must be between 1 and 50\");\n }\n return limit;\n}\n\nasync function runLogsSource(\n query: string,\n options: SearchOptions,\n): Promise<void> {\n const logsOptions: LogsSearchCliOptions = {\n afterContext: options.afterContext,\n beforeContext: options.beforeContext,\n context: options.context,\n agentId: options.agent,\n run: options.run,\n since: options.since,\n limit: options.limit,\n };\n await runLogsSearch(query, logsOptions);\n}\n\nfunction formatTimestamp(iso: string): string {\n return new Date(iso).toISOString().replace(/\\.\\d{3}Z$/, \"Z\");\n}\n\nfunction renderChatMessage(msg: ChatSearchMessage, isMatch: boolean): void {\n const marker = isMatch ? chalk.yellow(\"▸\") : chalk.dim(\"·\");\n const header = `${marker} ${chalk.dim(msg.role)} ${chalk.dim(formatTimestamp(msg.createdAt))}`;\n console.log(header);\n console.log(isMatch ? msg.content : chalk.dim(msg.content));\n}\n\nfunction renderChatResults(response: ChatSearchResponse): void {\n let isFirst = true;\n for (const result of response.results) {\n if (!isFirst) console.log();\n isFirst = false;\n\n console.log(\n chalk.bold(\n `── Thread ${result.chatThreadId} (${result.agentName}) ──────────`,\n ),\n );\n for (const msg of result.contextBefore) {\n renderChatMessage(msg, false);\n }\n renderChatMessage(result.matchedMessage, true);\n for (const msg of result.contextAfter) {\n renderChatMessage(msg, false);\n }\n }\n\n if (response.hasMore) {\n console.log();\n console.log(\n chalk.dim(\n ` Showing first ${response.results.length} matches. Use --limit to see more.`,\n ),\n );\n }\n}\n\nasync function runChatSource(\n query: string,\n options: SearchOptions,\n): Promise<void> {\n if (options.run) {\n throw new Error(\"--run is not supported with --source chat\");\n }\n\n const { before, after } = parseContextOptions(options);\n const limit = parseLimit(options.limit);\n const since = options.since\n ? parseTime(options.since)\n : Date.now() - SEVEN_DAYS_MS;\n\n const response = await searchZeroChat({\n keyword: query,\n agentId: options.agent,\n since,\n limit,\n before,\n after,\n });\n\n if (response.results.length === 0) {\n console.log(chalk.dim(\"No matches found\"));\n console.log(\n chalk.dim(\n \" Try a broader search with --since 30d or a different keyword\",\n ),\n );\n return;\n }\n\n renderChatResults(response);\n}\n\nasync function runSlackSource(\n query: string,\n _options: SearchOptions,\n): Promise<void> {\n console.log(buildSlackRecipe(query));\n}\n\nexport const zeroSearchCommand = new Command()\n .name(\"search\")\n .description(\"Search logs, chat, or get a recipe for external sources\")\n .argument(\"<query>\", \"Search query\")\n .option(\n \"--source <type>\",\n \"Source to search: logs | chat | slack (pass once)\",\n collectSource,\n [] as string[],\n )\n .option(\"--agent <id>\", \"Filter by Zero agent ID\")\n .option(\"--run <id>\", \"Filter by run ID\")\n .option(\"--since <time>\", \"Time window (e.g., 7d, 2h)\")\n .option(\"--limit <n>\", \"Maximum number of matches\")\n .option(\"-A, --after-context <n>\", \"Show n items after each match\")\n .option(\"-B, --before-context <n>\", \"Show n items before each match\")\n .option(\"-C, --context <n>\", \"Show n items before and after each match\")\n .addHelpText(\"after\", SEARCH_EXPLAINER)\n .action(\n withErrorHandler(async (query: string, options: SearchOptions) => {\n const sources = options.source;\n\n if (sources.length === 0) {\n console.log(SEARCH_EXPLAINER);\n return;\n }\n\n if (sources.length > 1) {\n throw new Error(\"Only one --source is allowed.\");\n }\n\n const source = sources[0]!;\n if (!SUPPORTED_SOURCES.includes(source as Source)) {\n throw new Error(\n `Unknown --source \"${source}\". Expected one of: ${SUPPORTED_SOURCES.join(\", \")}`,\n );\n }\n\n switch (source as Source) {\n case \"logs\":\n await runLogsSource(query, options);\n return;\n case \"chat\":\n await runChatSource(query, options);\n return;\n case \"slack\":\n await runSlackSource(query, options);\n return;\n }\n }),\n );\n","import { Command } from \"commander\";\nimport { withErrorHandler } from \"../../lib/command\";\nimport {\n requestDeveloperSupportConsent,\n submitDeveloperSupport,\n} from \"../../lib/api\";\n\nexport const zeroDeveloperSupportCommand = new Command()\n .name(\"developer-support\")\n .description(\"Submit a diagnostic report to the dev team\")\n .requiredOption(\"--title <text>\", \"Issue title\")\n .requiredOption(\"--description <text>\", \"Diagnostic description\")\n .option(\"--consent-code <code>\", \"User-provided verification code\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Step 1 — Get consent code:\n zero developer-support --title \"GitHub 403 error\" --description \"Connector connected but API returns 403\"\n\n Step 2 — Submit with code:\n zero developer-support --title \"GitHub 403 error\" --description \"Connector connected but API returns 403\" --consent-code A7X3\n\nNotes:\n - The consent code must be provided by the user to confirm sharing their conversation\n - The dev team will receive a diagnostic bundle with conversation, environment, and connector info`,\n )\n .action(\n withErrorHandler(\n async (options: {\n title: string;\n description: string;\n consentCode?: string;\n }) => {\n if (!options.consentCode) {\n const { consentCode } = await requestDeveloperSupportConsent({\n title: options.title,\n description: options.description,\n });\n console.log(\n \"Consent required to share chat history with developers.\",\n );\n console.log(`Code: ${consentCode}`);\n console.log(\"Ask the user to confirm by providing this code.\");\n } else {\n const { reference } = await submitDeveloperSupport({\n title: options.title,\n description: options.description,\n consentCode: options.consentCode,\n });\n console.log(\"Developer support request submitted successfully.\");\n console.log(`Reference: ${reference}`);\n }\n },\n ),\n );\n","import { mkdir, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { Command } from \"commander\";\nimport type {\n ComputerUseCommandResponse,\n ComputerUseReadCommandKind,\n ComputerUseWriteCommandKind,\n} from \"@vm0/api-contracts/contracts/zero-computer-use\";\nimport {\n createComputerUseReadCommand,\n createComputerUseWriteCommand,\n fetchComputerUseScreenshot,\n getComputerUseCommand,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command/with-error-handler\";\n\ninterface ComputerUseCommandOptions {\n readonly timeout?: string;\n}\n\ninterface ComputerUseAppOptions extends ComputerUseCommandOptions {\n readonly app: string;\n}\n\ninterface ComputerUseClickOptions extends ComputerUseAppOptions {\n readonly snapshotId?: string;\n readonly element?: string;\n readonly elementIndex?: string;\n readonly x?: string;\n readonly y?: string;\n readonly button?: \"left\" | \"right\" | \"middle\";\n readonly clickCount?: string;\n}\n\ninterface ComputerUseScrollOptions extends ComputerUseAppOptions {\n readonly snapshotId?: string;\n readonly element?: string;\n readonly elementIndex?: string;\n readonly direction: \"up\" | \"down\" | \"left\" | \"right\";\n readonly pages?: string;\n}\n\ninterface ComputerUseSetValueOptions extends ComputerUseAppOptions {\n readonly snapshotId?: string;\n readonly element?: string;\n readonly elementIndex?: string;\n readonly value: string;\n}\n\ninterface ComputerUsePerformActionOptions extends ComputerUseAppOptions {\n readonly snapshotId?: string;\n readonly element?: string;\n readonly elementIndex?: string;\n readonly action: string;\n}\n\ninterface ComputerUseTypeTextOptions extends ComputerUseAppOptions {\n readonly snapshotId?: string;\n readonly text: string;\n}\n\ninterface ComputerUsePressKeyOptions extends ComputerUseAppOptions {\n readonly snapshotId?: string;\n readonly key: string;\n}\n\nconst COMPUTER_USE_OUTPUT_DIR = \"/tmp/vm0/computer-use\";\nconst DATA_URL_PATTERN = /^data:([^;,]+);base64,(.*)$/s;\nconst COMPUTER_USE_HELP_TEXT = `\nWorkflow:\n 1. Start the Zero Desktop app and make sure Computer Use is online.\n 2. Run \"zero computer-use list-apps\" to find the target app's bundleId.\n --app accepts a bundle id only (e.g. com.google.Chrome); the name is for\n display. Apps listed without a bundleId cannot be targeted.\n 3. Run \"zero computer-use get-app-state --app <bundleId>\" to get a screenshot,\n snapshotId, visible element indexes, and accessibility state.\n 4. Prefer element actions with --snapshot-id and --element-index. Use --x/--y\n only when the target is visible in the returned screenshot but has no useful\n accessibility element.\n 5. Read the JSON result. Screenshot and App State data are saved under\n /tmp/vm0/computer-use and replaced with local file paths in CLI output.\n Files are named from app and snapshotId; rerunning the same snapshot\n overwrites the same files.\n\nNotes:\n Write commands are sent to the connected Desktop host and may wait for local\n approval before they run. Coordinate fallbacks use screenshot coordinates from\n get-app-state; pass the matching --snapshot-id when acting on a prior snapshot.\n type-text sends literal keyboard input to the target app's current focus. It\n first verifies the focused element is editable and fails with\n element_not_editable when it is not (for example a focused table or list), so\n click into a text field before typing. Use set-value when you need\n deterministic accessibility value assignment.\n press-key accepts xdotool-style names such as shift+semicolon, Control_L+J,\n ctrl+alt+n, and BackSpace, plus existing macOS-style forms such as Command+L.\n type-text and press-key accept the same --snapshot-id as the element actions:\n pass it to deliver keyboard input to that snapshot's window. Without it, the\n most relevant window for the app is picked, which is ambiguous for multi-window\n apps.\n\nExamples:\n List available apps:\n zero computer-use list-apps\n\n Inspect Safari state:\n zero computer-use get-app-state --app com.apple.Safari\n\n Click element index 7 from snapshot desktop_abc:\n zero computer-use click --app com.apple.Safari --snapshot-id desktop_abc --element-index 7\n\n Click screenshot coordinate (320, 240) from snapshot desktop_abc:\n zero computer-use click --app com.apple.Safari --snapshot-id desktop_abc --x 320 --y 240\n\n Type text into the snapshot desktop_abc window in Safari:\n zero computer-use type-text --app com.apple.Safari --snapshot-id desktop_abc --text \"Hello\"\n\n Press a keyboard shortcut in the snapshot desktop_abc window:\n zero computer-use press-key --app com.apple.Safari --snapshot-id desktop_abc --key shift+semicolon\n\n Open an app without activating the current foreground app:\n zero computer-use open-app --app com.culturedcode.ThingsMac`;\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n\nfunction parseTimeoutSeconds(value: string | undefined): number {\n if (!value) return 30;\n const seconds = Number.parseInt(value, 10);\n if (!Number.isFinite(seconds) || seconds <= 0) {\n throw new Error(\"Timeout must be a positive number of seconds\");\n }\n return seconds;\n}\n\nfunction parseOptionalNonNegativeInteger(\n value: string | undefined,\n label: string,\n): number | undefined {\n if (value === undefined) return undefined;\n const parsed = Number.parseInt(value, 10);\n if (!Number.isFinite(parsed) || parsed < 0) {\n throw new Error(`${label} must be a non-negative integer`);\n }\n return parsed;\n}\n\nfunction parsePositiveInteger(\n value: string | undefined,\n label: string,\n): number {\n if (value === undefined) {\n throw new Error(`${label} is required`);\n }\n const parsed = Number.parseInt(value, 10);\n if (!Number.isFinite(parsed) || parsed <= 0) {\n throw new Error(`${label} must be a positive integer`);\n }\n return parsed;\n}\n\nfunction parsePositiveNumber(\n value: string | undefined,\n label: string,\n): number | undefined {\n if (value === undefined) return undefined;\n const parsed = Number.parseFloat(value);\n if (!Number.isFinite(parsed) || parsed <= 0) {\n throw new Error(`${label} must be a positive number`);\n }\n return parsed;\n}\n\nfunction parseMouseButton(\n value: string | undefined,\n): \"left\" | \"right\" | \"middle\" {\n if (value === \"left\" || value === \"right\" || value === \"middle\") {\n return value;\n }\n throw new Error(\"button must be left, right, or middle\");\n}\n\nfunction elementTargetPayload(options: {\n readonly element?: string;\n readonly elementIndex?: string;\n}): { readonly elementId?: string; readonly elementIndex?: number } {\n const elementIndex = parseOptionalNonNegativeInteger(\n options.elementIndex,\n \"element-index\",\n );\n if (!options.element && elementIndex === undefined) {\n throw new Error(\"element or element-index is required\");\n }\n return {\n ...(options.element ? { elementId: options.element } : {}),\n ...(elementIndex !== undefined ? { elementIndex } : {}),\n };\n}\n\nfunction sanitizeFilenamePart(value: unknown, fallback: string): string {\n if (typeof value !== \"string\") {\n return fallback;\n }\n const sanitized = value\n .trim()\n .replace(/[^A-Za-z0-9._-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 80);\n return sanitized.length > 0 ? sanitized : fallback;\n}\n\nfunction extensionForMimeType(mimeType: string): string {\n if (mimeType === \"image/png\") {\n return \"png\";\n }\n if (mimeType === \"image/jpeg\") {\n return \"jpg\";\n }\n if (mimeType === \"image/webp\") {\n return \"webp\";\n }\n const suffix = mimeType.startsWith(\"image/\") ? mimeType.slice(6) : \"bin\";\n return sanitizeFilenamePart(suffix, \"bin\").toLowerCase();\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction stringField(\n value: Record<string, unknown>,\n key: string,\n): string | undefined {\n const field = value[key];\n return typeof field === \"string\" ? field : undefined;\n}\n\nasync function writeScreenshotDataUrl(\n result: Record<string, unknown>,\n dataUrl: string,\n): Promise<string | null> {\n const match = DATA_URL_PATTERN.exec(dataUrl);\n if (!match) {\n return null;\n }\n\n const mimeType = match[1] ?? \"\";\n if (!mimeType.startsWith(\"image/\")) {\n throw new Error(`Unsupported screenshot MIME type: ${mimeType}`);\n }\n\n const base64Data = match[2] ?? \"\";\n const appName = sanitizeFilenamePart(result.app, \"app\");\n const snapshotId = sanitizeFilenamePart(result.snapshotId, \"snapshot\");\n const outputPath = join(\n COMPUTER_USE_OUTPUT_DIR,\n `${appName}-${snapshotId}.${extensionForMimeType(mimeType)}`,\n );\n\n await mkdir(COMPUTER_USE_OUTPUT_DIR, { recursive: true });\n await writeFile(outputPath, Buffer.from(base64Data, \"base64\"));\n return outputPath;\n}\n\nfunction screenshotPointerType(value: unknown): \"s3\" | \"expired\" | null {\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n const type = (value as { readonly type?: unknown }).type;\n return type === \"s3\" || type === \"expired\" ? type : null;\n}\n\nasync function writeScreenshotBytes(\n result: Record<string, unknown>,\n buffer: Buffer,\n mimeType: string,\n): Promise<string> {\n const appName = sanitizeFilenamePart(result.app, \"app\");\n const snapshotId = sanitizeFilenamePart(result.snapshotId, \"snapshot\");\n const outputPath = join(\n COMPUTER_USE_OUTPUT_DIR,\n `${appName}-${snapshotId}.${extensionForMimeType(mimeType)}`,\n );\n\n await mkdir(COMPUTER_USE_OUTPUT_DIR, { recursive: true });\n await writeFile(outputPath, buffer);\n return outputPath;\n}\n\nasync function writeAppStateText(\n result: Record<string, unknown>,\n appState: string,\n): Promise<string> {\n const appName = sanitizeFilenamePart(result.app, \"app\");\n const snapshotId = sanitizeFilenamePart(result.snapshotId, \"snapshot\");\n const outputPath = join(\n COMPUTER_USE_OUTPUT_DIR,\n `${appName}-${snapshotId}.appState.txt`,\n );\n\n await mkdir(COMPUTER_USE_OUTPUT_DIR, { recursive: true });\n await writeFile(outputPath, appState, \"utf8\");\n return outputPath;\n}\n\nfunction compactActionResult(\n action: Record<string, unknown>,\n): Record<string, unknown> {\n const compact: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(action)) {\n if (\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\"\n ) {\n compact[key] = value;\n }\n }\n return compact;\n}\n\nexport async function formatComputerUseResultForConsole(\n result: Record<string, unknown>,\n commandId: string,\n): Promise<string> {\n const printable: Record<string, unknown> = { status: \"succeeded\" };\n const apps = result.apps;\n if (Array.isArray(apps)) {\n printable.apps = apps;\n }\n const snapshotId = stringField(result, \"snapshotId\");\n if (snapshotId) {\n printable.snapshotId = snapshotId;\n }\n const appState = stringField(result, \"appState\");\n if (appState) {\n printable.appState = await writeAppStateText(result, appState);\n }\n const screenshot = result.screenshot;\n if (typeof screenshot === \"string\") {\n const screenshotPath = await writeScreenshotDataUrl(result, screenshot);\n printable.screenshot = screenshotPath ?? screenshot;\n } else {\n const pointerType = screenshotPointerType(screenshot);\n if (pointerType === \"s3\") {\n const { buffer, mimeType } = await fetchComputerUseScreenshot(commandId);\n printable.screenshot = await writeScreenshotBytes(\n result,\n buffer,\n mimeType,\n );\n } else if (pointerType === \"expired\") {\n printable.screenshot = \"[screenshot expired]\";\n }\n }\n const action = result.action;\n if (isRecord(action)) {\n printable.action = compactActionResult(action);\n }\n return JSON.stringify(printable, null, 2);\n}\n\nasync function commandOutputText(\n command: ComputerUseCommandResponse,\n): Promise<string> {\n if (!command.result) {\n return \"\";\n }\n return await formatComputerUseResultForConsole(command.result, command.id);\n}\n\nasync function waitForCommand(\n commandId: string,\n timeoutSeconds: number,\n): Promise<void> {\n const deadline = Date.now() + timeoutSeconds * 1000;\n while (Date.now() <= deadline) {\n const command = await getComputerUseCommand(commandId);\n if (\n command.status === \"pending_approval\" ||\n command.status === \"queued\" ||\n command.status === \"running\"\n ) {\n if (process.stdout.isTTY) {\n process.stdout.write(\".\");\n }\n await sleep(1_000);\n continue;\n }\n\n if (process.stdout.isTTY) {\n process.stdout.write(\"\\n\");\n }\n\n if (command.status === \"failed\") {\n throw new Error(\n command.error\n ? `${command.error.code}: ${command.error.message}`\n : \"Computer-use command failed\",\n );\n }\n\n const text = await commandOutputText(command);\n if (text) {\n console.log(text);\n }\n return;\n }\n\n throw new Error(`Computer-use command timed out: ${commandId}`);\n}\n\nasync function runReadCommand(\n kind: ComputerUseReadCommandKind,\n options: ComputerUseCommandOptions,\n payload: { readonly app?: string } = {},\n): Promise<void> {\n const timeoutSeconds = parseTimeoutSeconds(options.timeout);\n const created = await createComputerUseReadCommand({\n kind,\n timeoutMs: timeoutSeconds * 1000,\n ...payload,\n });\n await waitForCommand(created.commandId, timeoutSeconds);\n}\n\nasync function runWriteCommand(\n kind: ComputerUseWriteCommandKind,\n options: ComputerUseCommandOptions,\n payload: {\n readonly app: string;\n readonly snapshotId?: string;\n readonly elementId?: string;\n readonly elementIndex?: number;\n readonly x?: number;\n readonly y?: number;\n readonly button?: \"left\" | \"right\" | \"middle\";\n readonly clickCount?: number;\n readonly direction?: \"up\" | \"down\" | \"left\" | \"right\";\n readonly pages?: number;\n readonly value?: string;\n readonly text?: string;\n readonly key?: string;\n readonly action?: string;\n },\n): Promise<void> {\n const timeoutSeconds = parseTimeoutSeconds(options.timeout);\n const created = await createComputerUseWriteCommand({\n kind,\n timeoutMs: timeoutSeconds * 1000,\n ...payload,\n });\n await waitForCommand(created.commandId, timeoutSeconds);\n}\n\nfunction addTargetOptions(command: Command): Command {\n return command.option(\"--timeout <seconds>\", \"Maximum time to wait\", \"30\");\n}\n\nfunction appOption(command: Command): Command {\n return command.requiredOption(\n \"--app <bundleId>\",\n \"Target app bundle id (e.g. com.google.Chrome); run list-apps to find it\",\n );\n}\n\nconst listAppsCommand = addTargetOptions(\n new Command()\n .name(\"list-apps\")\n .description(\"List apps available to the Desktop Computer Use host\")\n .action(\n withErrorHandler(async (options: ComputerUseCommandOptions) => {\n await runReadCommand(\"apps.list\", options);\n }),\n ),\n);\n\nconst getAppStateCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"get-app-state\")\n .description(\n \"Get screenshot and accessibility state without activating an app\",\n )\n .action(\n withErrorHandler(async (options: ComputerUseAppOptions) => {\n await runReadCommand(\"app.state\", options, { app: options.app });\n }),\n ),\n ),\n);\n\nconst clickCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"click\")\n .description(\n \"Click an accessibility element or background screenshot coordinate\",\n )\n .option(\"--snapshot-id <id>\", \"Snapshot id returned by get-app-state\")\n .option(\"--element <id>\", \"Element id from get-app-state\")\n .option(\"--element-index <index>\", \"Element index from get-app-state\")\n .option(\"--x <points>\", \"Screenshot x coordinate fallback\")\n .option(\"--y <points>\", \"Screenshot y coordinate fallback\")\n .option(\"--button <button>\", \"Mouse button\", \"left\")\n .option(\"--click-count <count>\", \"Number of clicks\", \"1\")\n .action(\n withErrorHandler(async (options: ComputerUseClickOptions) => {\n const x = parseOptionalNonNegativeInteger(options.x, \"x\");\n const y = parseOptionalNonNegativeInteger(options.y, \"y\");\n const elementIndex = parseOptionalNonNegativeInteger(\n options.elementIndex,\n \"element-index\",\n );\n await runWriteCommand(\"element.click\", options, {\n app: options.app,\n ...(options.snapshotId ? { snapshotId: options.snapshotId } : {}),\n ...(options.element ? { elementId: options.element } : {}),\n ...(elementIndex !== undefined ? { elementIndex } : {}),\n ...(x !== undefined ? { x } : {}),\n ...(y !== undefined ? { y } : {}),\n button: parseMouseButton(options.button),\n clickCount: parsePositiveInteger(options.clickCount, \"click-count\"),\n });\n }),\n ),\n ),\n);\n\nconst scrollCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"scroll\")\n .description(\"Scroll an accessibility element\")\n .option(\"--snapshot-id <id>\", \"Snapshot id returned by get-app-state\")\n .option(\"--element <id>\", \"Element id from get-app-state\")\n .option(\"--element-index <index>\", \"Element index from get-app-state\")\n .requiredOption(\n \"--direction <direction>\",\n \"Scroll direction: up, down, left, or right\",\n )\n .option(\"--pages <count>\", \"Number of pages to scroll\", \"1\")\n .action(\n withErrorHandler(async (options: ComputerUseScrollOptions) => {\n await runWriteCommand(\"element.scroll\", options, {\n app: options.app,\n ...(options.snapshotId ? { snapshotId: options.snapshotId } : {}),\n ...elementTargetPayload(options),\n direction: options.direction,\n pages: parsePositiveNumber(options.pages, \"pages\"),\n });\n }),\n ),\n ),\n);\n\nconst setValueCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"set-value\")\n .description(\"Set the value of a settable accessibility element\")\n .option(\"--snapshot-id <id>\", \"Snapshot id returned by get-app-state\")\n .option(\"--element <id>\", \"Element id from get-app-state\")\n .option(\"--element-index <index>\", \"Element index from get-app-state\")\n .requiredOption(\"--value <text>\", \"Value to assign\")\n .action(\n withErrorHandler(async (options: ComputerUseSetValueOptions) => {\n await runWriteCommand(\"element.set_value\", options, {\n app: options.app,\n ...(options.snapshotId ? { snapshotId: options.snapshotId } : {}),\n ...elementTargetPayload(options),\n value: options.value,\n });\n }),\n ),\n ),\n);\n\nconst typeTextCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"type-text\")\n .description(\"Type literal keyboard input into the target app\")\n .option(\"--snapshot-id <id>\", \"Snapshot id returned by get-app-state\")\n .requiredOption(\"--text <text>\", \"Text to type\")\n .action(\n withErrorHandler(async (options: ComputerUseTypeTextOptions) => {\n await runWriteCommand(\"keyboard.type_text\", options, {\n app: options.app,\n ...(options.snapshotId ? { snapshotId: options.snapshotId } : {}),\n text: options.text,\n });\n }),\n ),\n ),\n);\n\nconst pressKeyCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"press-key\")\n .description(\"Send a background key or key combination to the target app\")\n .option(\"--snapshot-id <id>\", \"Snapshot id returned by get-app-state\")\n .requiredOption(\n \"--key <key>\",\n \"Key or xdotool-style combination, for example Command+K, shift+semicolon, or Control_L+J\",\n )\n .action(\n withErrorHandler(async (options: ComputerUsePressKeyOptions) => {\n await runWriteCommand(\"keyboard.press_key\", options, {\n app: options.app,\n ...(options.snapshotId ? { snapshotId: options.snapshotId } : {}),\n key: options.key,\n });\n }),\n ),\n ),\n);\n\nconst performActionCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"perform-action\")\n .description(\"Invoke a secondary accessibility action\")\n .option(\"--snapshot-id <id>\", \"Snapshot id returned by get-app-state\")\n .option(\"--element <id>\", \"Element id from get-app-state\")\n .option(\"--element-index <index>\", \"Element index from get-app-state\")\n .requiredOption(\"--action <name>\", \"Accessibility action name\")\n .action(\n withErrorHandler(async (options: ComputerUsePerformActionOptions) => {\n await runWriteCommand(\"element.perform_action\", options, {\n app: options.app,\n ...(options.snapshotId ? { snapshotId: options.snapshotId } : {}),\n ...elementTargetPayload(options),\n action: options.action,\n });\n }),\n ),\n ),\n);\n\nconst openAppCommand = appOption(\n addTargetOptions(\n new Command()\n .name(\"open-app\")\n .description(\"Open an app on the Desktop host without activating it\")\n .action(\n withErrorHandler(async (options: ComputerUseAppOptions) => {\n await runWriteCommand(\"app.open\", options, { app: options.app });\n }),\n ),\n ),\n);\n\nexport const zeroComputerUseCommand = new Command()\n .name(\"computer-use\")\n .description(\"Desktop app computer use through Zero CLI\")\n .addHelpText(\"after\", COMPUTER_USE_HELP_TEXT)\n .addCommand(listAppsCommand)\n .addCommand(getAppStateCommand)\n .addCommand(clickCommand)\n .addCommand(scrollCommand)\n .addCommand(setValueCommand)\n .addCommand(typeTextCommand)\n .addCommand(pressKeyCommand)\n .addCommand(performActionCommand)\n .addCommand(openAppCommand);\n","import { Command } from \"commander\";\nimport { imageCommand } from \"./image\";\nimport {\n dashboardDesignCommand,\n docsDesignCommand,\n mobileAppDesignCommand,\n posterCommand,\n reportCommand,\n} from \"./artifacts\";\nimport { presentationCommand } from \"./presentation\";\nimport { spriteCommand } from \"./sprite\";\nimport { videoCommand } from \"./video\";\nimport { websiteCommand } from \"./website\";\nimport { voiceCommand } from \"./voice\";\nimport { createListerOnlyCommand } from \"./lister-only\";\n\nconst musicCommand = createListerOnlyCommand({\n name: \"music\",\n generationType: \"music\",\n description: \"List connectors that provide music generation\",\n});\n\nconst textCommand = createListerOnlyCommand({\n name: \"text\",\n generationType: \"text\",\n description: \"List connectors that provide text generation\",\n});\n\nconst codeCommand = createListerOnlyCommand({\n name: \"code\",\n generationType: \"code\",\n description: \"List connectors that provide code generation\",\n});\n\nconst documentCommand = createListerOnlyCommand({\n name: \"document\",\n generationType: \"document\",\n description: \"List connectors that provide document generation\",\n});\n\nfunction buildGenerateHelpText(): string {\n const examples = [\n ' Generate image: zero generate image --prompt \"A watercolor fox\"',\n ' Generate deck: zero generate presentation --prompt \"A product roadmap\"',\n ' Generate report: zero generate report --prompt \"A Q2 usage report\"',\n ' Generate docs: zero generate docs-design --prompt \"A setup guide\"',\n ' Generate video: zero generate video --prompt \"A cinematic city shot\"',\n ' Generate site: zero generate website --prompt \"A launch site\"',\n ' Generate sprite: zero generate sprite --prompt \"A slime monster idle loop\"',\n ' Generate speech: zero generate voice --prompt \"Hello\"',\n \" Show music choices: zero generate music\",\n \"\",\n \" Show image choices: zero generate image\",\n \" Show report choices: zero generate report\",\n \" Use a connector: zero generate video --provider heygen\",\n \" Force built-in: zero generate image --provider built-in --model gpt-image-1.5 --prompt ...\",\n ];\n\n return `\\nExamples:\\n${examples.join(\"\\n\")}\\n\\nNotes:\\n - Run \"zero generate <type>\" with no --prompt to list generation choices for that type.\n - Media and connector-backed generation types may expose --provider for vm0 or connector execution guidance.\n - HTML artifact types use registry-backed --design-system and --template selection.`;\n}\n\nexport const generateCommand = new Command()\n .name(\"generate\")\n .description(\n \"Generate assets via vm0's built-in pipelines or get connector skill-invocation guidance\",\n )\n .addCommand(imageCommand)\n .addCommand(presentationCommand)\n .addCommand(reportCommand)\n .addCommand(docsDesignCommand)\n .addCommand(posterCommand)\n .addCommand(dashboardDesignCommand)\n .addCommand(mobileAppDesignCommand)\n .addCommand(videoCommand)\n .addCommand(websiteCommand)\n .addCommand(spriteCommand)\n .addCommand(voiceCommand)\n .addCommand(musicCommand)\n .addCommand(textCommand)\n .addCommand(codeCommand)\n .addCommand(documentCommand)\n .addHelpText(\"after\", buildGenerateHelpText);\n","import { createImageGenerateCommand } from \"../shared/image-generate\";\n\nexport const imageCommand = createImageGenerateCommand({\n name: \"image\",\n generationType: \"image\",\n usageCommand: \"zero generate image\",\n examples: ` Styled image: zero generate image --style vm0:image-style:notion-illustration --prompt \"A product manager mapping a launch plan\"\n Skip style: zero generate image --skip-style --prompt \"A watercolor fox\"\n Pipe prompt: cat prompt.txt | zero generate image --skip-style\n GPT Image model: zero generate image --skip-style --model gpt-image-1.5 --prompt \"A poster\" --size 1024x1536 --quality high\n Flux model: zero generate image --skip-style --model flux-pro-1.1 --prompt \"A product hero shot\" --seed 42\n Nano Banana 2: zero generate image --skip-style --model nano-banana-2 --prompt \"A crisp launch poster with readable typography\"\n Image-to-image: zero generate image --skip-style --model flux-pro-1.1 --image-url https://example.com/mockup.png --prompt \"Turn this mockup into a polished product shot\"\n List providers: zero generate image\n Use a connector: zero generate image --provider replicate`,\n});\n","import { Command, InvalidArgumentError } from \"commander\";\nimport chalk from \"chalk\";\nimport { generateWebImage } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { createStyledImageAuthoringPacket } from \"./image-style-authoring\";\nimport { findImageStyle, listImageStyles } from \"./resource-registry\";\nimport { formatRegistryListing } from \"./resource-listing\";\nimport { dispatchGenerate } from \"../generate/lib/dispatch\";\nimport type { GenerationType } from \"../generate/lib/lister\";\n\ninterface ImageOptions {\n prompt?: string;\n provider?: string;\n model: string;\n size: string;\n quality: string;\n background: string;\n format: string;\n compression?: string;\n moderation: string;\n seed?: number;\n safetyTolerance: string;\n enhancePrompt?: boolean;\n imageUrl: string[];\n maskImageUrl?: string;\n inputFidelity?: string;\n imagePromptStrength?: string;\n style?: string;\n skipStyle?: boolean;\n all?: boolean;\n}\n\ninterface ImageGenerateCommandConfig {\n name: string;\n generationType: GenerationType;\n usageCommand: string;\n examples: string;\n}\n\nfunction requireStyleError(usageCommand: string): Error {\n const styles = listImageStyles();\n const message = [\n \"--style <id> or --skip-style is required\",\n \"\",\n \"Available styles:\",\n formatRegistryListing(styles, \"image styles\"),\n \"\",\n `Examples:`,\n ` ${usageCommand} --style ${styles[0]?.id ?? \"<style-id>\"} --prompt \"...\"`,\n ` ${usageCommand} --skip-style --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nfunction unknownStyleError(id: string, usageCommand: string): Error {\n const styles = listImageStyles();\n const message = [\n `Unknown image style: ${id}`,\n \"\",\n \"Available styles:\",\n formatRegistryListing(styles, \"image styles\"),\n \"\",\n `Example:`,\n ` ${usageCommand} --style ${styles[0]?.id ?? \"<style-id>\"} --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nfunction parseCompression(value: string | undefined): number | undefined {\n if (value === undefined) {\n return undefined;\n }\n\n const compression = Number(value);\n if (!Number.isInteger(compression) || compression < 0 || compression > 100) {\n throw new Error(\"--compression must be an integer from 0 to 100\");\n }\n\n return compression;\n}\n\nfunction parseSeed(value: string): number {\n const seed = Number(value);\n if (!Number.isInteger(seed) || seed < 0 || !Number.isSafeInteger(seed)) {\n throw new InvalidArgumentError(\"seed must be a non-negative safe integer\");\n }\n return seed;\n}\n\nfunction collectString(value: string, previous: string[]): string[] {\n return [...previous, value];\n}\n\nfunction parseInputFidelity(value: string | undefined): string | undefined {\n if (value === undefined) {\n return undefined;\n }\n if (value !== \"low\" && value !== \"high\") {\n throw new Error(\"--input-fidelity must be low or high\");\n }\n return value;\n}\n\nfunction parseImagePromptStrength(\n value: string | undefined,\n): number | undefined {\n if (value === undefined) {\n return undefined;\n }\n const strength = Number(value);\n if (!Number.isFinite(strength) || strength < 0 || strength > 1) {\n throw new Error(\"--image-prompt-strength must be a number from 0 to 1\");\n }\n return strength;\n}\n\nexport function createImageGenerateCommand(\n config: ImageGenerateCommandConfig,\n): Command {\n return new Command()\n .name(config.name)\n .description(\"Generate a billed image file from a prompt\")\n .option(\"--prompt <text>\", \"Image prompt; can also be piped via stdin\")\n .option(\n \"--provider <name>\",\n \"Provider: 'built-in' to run vm0's pipeline, or a connector name to get its skill-invocation guidance\",\n )\n .option(\n \"--all\",\n \"When listing providers (no --prompt given), include unavailable or not-yet-authorized connectors\",\n )\n .option(\n \"--model <model>\",\n \"Model: gpt-image-1 (default), gpt-image-2, gpt-image-1.5, gpt-image-1-mini, flux-pro-1.1, flux-pro-1.1-ultra, qwen-image, seedream4, or nano-banana-2\",\n \"gpt-image-1\",\n )\n .option(\n \"--size <size>\",\n \"Image size: auto or WIDTHxHEIGHT; support varies by model\",\n \"1024x1024\",\n )\n .option(\n \"--quality <quality>\",\n \"Image quality: low, medium, high, or auto\",\n \"medium\",\n )\n .option(\n \"--background <background>\",\n \"Background: auto, opaque, or transparent when supported\",\n \"auto\",\n )\n .option(\"--format <format>\", \"Output format: png, webp, or jpeg\", \"png\")\n .option(\"--compression <0-100>\", \"Output compression for jpeg/webp only\")\n .option(\n \"--moderation <moderation>\",\n \"Moderation strictness: auto or low\",\n \"auto\",\n )\n .option(\"--seed <integer>\", \"Deterministic seed for fal models\", parseSeed)\n .option(\"--safety-tolerance <level>\", \"fal safety tolerance: 1-6\", \"4\")\n .option(\"--enhance-prompt\", \"Enable fal prompt enhancement when supported\")\n .option(\n \"--image-url <url>\",\n \"Source/mockup image URL for image-to-image; repeat for multi-image edit models\",\n collectString,\n [],\n )\n .option(\n \"--mask-image-url <url>\",\n \"Mask image URL for supported edit models\",\n )\n .option(\n \"--input-fidelity <low|high>\",\n \"Source-image fidelity for GPT edit models\",\n )\n .option(\n \"--image-prompt-strength <0-1>\",\n \"Reference strength override for Flux Redux\",\n )\n .option(\n \"--style <id>\",\n \"Image style id from the registry (see Image Styles below)\",\n )\n .option(\n \"--skip-style\",\n \"Opt out of styled image generation for this invocation\",\n )\n .addHelpText(\"after\", () => {\n const styles = listImageStyles();\n return `\nExamples:\n${config.examples}\n\nOutput:\n Prints the generated /f/ image file URL and metadata. With --style <id>,\n prints a source-selection packet for the current agent\n with the selected style locked in.\n\nNotes:\n - Authenticates via ZERO_TOKEN (requires file:write capability)\n - Charges org credits after successful image generation\n - Uses fal.ai for all image model execution\n\nModels:\n - fal.ai: gpt-image-1 (default), gpt-image-2, gpt-image-1.5,\n gpt-image-1-mini, flux-pro-1.1, flux-pro-1.1-ultra, qwen-image,\n seedream4, nano-banana-2.\n GPT Image models bill by fal output image quality and size.\n Other fal generations bill by output image or rounded-up output\n megapixel, depending on the model.\n\nOptions:\n - Prompt: required, up to 32,000 characters; stdin is supported.\n - Style: required. Pass --style <id> to generate in a registered style\n or --skip-style to bypass styled generation entirely.\n - Size: gpt-image-2 accepts auto or WIDTHxHEIGHT. Popular sizes include\n 1024x1024,\n 1536x1024, 1024x1536, 2048x2048, 2048x1152, 3840x2160,\n and 2160x3840. Custom sizes must have edges <= 3840px, both\n edges divisible by 16, long:short ratio <= 3:1, and total pixels\n between 655,360 and 8,294,400. gpt-image-1.5, gpt-image-1, and\n gpt-image-1-mini use auto, 1024x1024, 1536x1024, or 1024x1536.\n - Quality: low, medium, high, or auto. Low is fastest for drafts.\n - Background: auto, opaque, or transparent when supported. gpt-image-2,\n Flux, Qwen, and Seedream do not support transparent backgrounds.\n - Format: png, jpeg, or webp for GPT Image and Nano Banana 2 models; png or\n jpeg for the other fal models.\n - fal-only controls: --seed and --safety-tolerance for supported fal models;\n --enhance-prompt for flux-pro-1.1. --compression and --moderation low are\n not supported on the fal-backed image path.\n - Image-to-image: pass --image-url to use the model's fal edit/redux endpoint.\n Nano Banana 2 accepts up to 14 source images. Flux Redux accepts\n --image-prompt-strength to override the provider default; GPT edit models\n accept --input-fidelity and supported models accept --mask-image-url.\n\nImage Styles:\n${formatRegistryListing(styles, \"image styles\")}`;\n })\n .action(\n withErrorHandler(async (options: ImageOptions, command: Command) => {\n const dispatch = await dispatchGenerate({\n generationType: config.generationType,\n provider: options.provider,\n prompt: options.prompt,\n all: options.all,\n });\n if (dispatch.outcome === \"handled\") return;\n const prompt = dispatch.prompt;\n\n if (options.style && options.skipStyle) {\n throw new Error(\"--style and --skip-style cannot be combined\");\n }\n if (!options.style && !options.skipStyle) {\n throw requireStyleError(config.usageCommand);\n }\n if (options.style) {\n const style = findImageStyle(options.style);\n if (!style) {\n throw unknownStyleError(options.style, config.usageCommand);\n }\n\n const packet = createStyledImageAuthoringPacket({\n prompt,\n style,\n details: [\n `Model preference if direct image generation is used: ${options.model}`,\n `Requested size: ${options.size}`,\n `Requested quality: ${options.quality}`,\n `Requested background: ${options.background}`,\n `Requested format: ${options.format}`,\n `Source image URLs: ${\n options.imageUrl.length > 0\n ? options.imageUrl.join(\", \")\n : \"none\"\n }`,\n `Mask image URL: ${options.maskImageUrl ?? \"none\"}`,\n ],\n });\n\n console.log(packet.instructions);\n return;\n }\n\n const compression = parseCompression(options.compression);\n const inputFidelity = parseInputFidelity(options.inputFidelity);\n const imagePromptStrength = parseImagePromptStrength(\n options.imagePromptStrength,\n );\n const hasSourceImage = options.imageUrl.length > 0;\n const size =\n hasSourceImage && command.getOptionValueSource(\"size\") === \"default\"\n ? \"auto\"\n : options.size;\n const result = await generateWebImage({\n prompt,\n model: options.model,\n size,\n quality: options.quality,\n background: options.background,\n outputFormat: options.format,\n outputCompression: compression,\n moderation: options.moderation,\n seed: options.seed,\n safetyTolerance: options.safetyTolerance,\n enhancePrompt: options.enhancePrompt,\n imageUrls: options.imageUrl,\n maskImageUrl: options.maskImageUrl,\n inputFidelity,\n imagePromptStrength,\n });\n\n console.log(chalk.green(`✓ Image generated: ${result.url}`));\n console.log(chalk.dim(` File: ${result.filename}`));\n console.log(chalk.dim(` Size: ${result.imageSize}`));\n console.log(chalk.dim(` Quality: ${result.quality}`));\n console.log(chalk.dim(` Format: ${result.outputFormat}`));\n if (result.outputCompression !== undefined) {\n console.log(chalk.dim(` Compression: ${result.outputCompression}`));\n }\n if (result.moderation) {\n console.log(chalk.dim(` Moderation: ${result.moderation}`));\n }\n if (result.safetyTolerance) {\n console.log(\n chalk.dim(` Safety tolerance: ${result.safetyTolerance}`),\n );\n }\n if (result.seed !== undefined) {\n console.log(chalk.dim(` Seed: ${result.seed}`));\n }\n console.log(chalk.dim(` Credits charged: ${result.creditsCharged}`));\n console.log(chalk.dim(` Model: ${result.model}`));\n console.log(chalk.dim(` Provider: ${result.provider}`));\n }),\n );\n}\n","import {\n type GenerationOutputKind,\n type ResourceCandidateSlice,\n type RegistryEntry,\n selectResourceCandidates,\n} from \"./resource-registry\";\n\ninterface StyledImageAuthoringOptions {\n readonly prompt: string;\n readonly details: readonly string[];\n readonly style: RegistryEntry;\n}\n\ninterface StyledImageAuthoringPacket {\n readonly type: \"generation-source-selection\";\n readonly kind: \"image\";\n readonly prompt: string;\n readonly registryVersion: string;\n readonly artifact: {\n readonly outputMode: \"primary-image\";\n readonly primaryArtifact: {\n readonly kind: GenerationOutputKind;\n readonly path: string;\n };\n readonly supportingAssets: readonly {\n readonly kind: GenerationOutputKind | \"metadata\";\n readonly path: string;\n readonly optional: boolean;\n }[];\n readonly previewKind: \"image\";\n readonly outputDir: string;\n };\n readonly selection: {\n readonly candidates: ResourceCandidateSlice[\"candidates\"];\n readonly outputSchema: {\n readonly imageStyle: \"string\";\n readonly skills: \"string[]\";\n readonly rationale: \"string\";\n };\n };\n readonly authoring: {\n readonly details: readonly string[];\n readonly artifactRules: readonly string[];\n };\n readonly outputDir: string;\n readonly instructions: string;\n}\n\nconst outputDir = \"./generated/images\";\nconst artifactRules = [\n \"Resolve the selected style source before generating the image.\",\n \"Use the style skill's referenced assets and generation path when it provides one.\",\n \"Produce a single final image file and keep any temporary metadata under the output directory.\",\n] as const;\n\nexport function createStyledImageAuthoringPacket(\n options: StyledImageAuthoringOptions,\n): StyledImageAuthoringPacket {\n const baseSlice = selectResourceCandidates();\n const candidateSlice: ResourceCandidateSlice = {\n ...baseSlice,\n candidates: {\n ...baseSlice.candidates,\n imageStyles: [options.style],\n },\n };\n const selectionSchema = {\n imageStyle: \"string\",\n skills: \"string[]\",\n rationale: \"string\",\n } as const;\n const artifact = {\n outputMode: \"primary-image\",\n primaryArtifact: {\n kind: \"image\",\n path: `${outputDir}/`,\n },\n supportingAssets: [\n {\n kind: \"metadata\",\n path: `${outputDir}/metadata.json`,\n optional: true,\n },\n ],\n previewKind: \"image\",\n outputDir,\n } as const;\n const instructions = [\n `# Zero generate image --style ${options.style.id}`,\n \"\",\n \"This is a federated generation source-selection packet for the current agent.\",\n \"Zero is not generating this image on the server yet. The image style has already been selected by the caller — resolve it and generate the styled image.\",\n \"\",\n \"## User Prompt\",\n options.prompt,\n \"\",\n \"## Selected Image Style\",\n `- \\`${options.style.id}\\` — ${options.style.name}`,\n \"\",\n \"## Stage 1: Supporting Resource Selection\",\n \"- The image style is locked. Optionally pick supporting skills/templates from the candidate slice below.\",\n \"- Choose only IDs present in this packet; do not invent registry IDs.\",\n \"- Treat the selection JSON as internal working state, then continue to generation.\",\n \"\",\n \"## Selection Output Schema\",\n \"```json\",\n JSON.stringify(selectionSchema, null, 2),\n \"```\",\n \"\",\n \"## Candidate Registry Slice\",\n `Registry: \\`${candidateSlice.registryVersion}\\``,\n \"Sources:\",\n ...candidateSlice.sources.map((src) => {\n return `- \\`${src.repo}@${src.ref}\\``;\n }),\n \"\",\n \"```json\",\n JSON.stringify(candidateSlice.candidates, null, 2),\n \"```\",\n \"\",\n \"## Stage 2: Resolve Selected Resources\",\n \"- Fetch or read the selected resource source before generation.\",\n \"- Each candidate carries a `source` object with `path` and optional `repo`/`ref`; when `repo`/`ref` are omitted, fall back to the registry-level source above.\",\n \"- For directory refs, inspect the most relevant files such as `SKILL.md`, references, examples, and templates.\",\n \"- If a source file cannot be fetched, state that limitation and fall back to the registry metadata for that resource.\",\n \"\",\n \"## Stage 3: Generate Image\",\n \"- Generate one production-quality image using the selected style.\",\n \"- Follow the selected style skill's generation path when it defines one.\",\n \"- If the style skill delegates to a model or connector, use that flow directly instead of restating the style text manually.\",\n \"\",\n \"## Artifact Output Model\",\n `- Primary artifact: \\`${artifact.primaryArtifact.kind}\\` under \\`${artifact.primaryArtifact.path}\\`.`,\n `- Output mode: \\`${artifact.outputMode}\\`.`,\n \"- Supporting metadata may live inside the same output directory when useful.\",\n \"\",\n \"## Requested Parameters\",\n ...options.details.map((detail) => {\n return `- ${detail}`;\n }),\n \"\",\n \"## Image Authoring Rules\",\n ...artifactRules.map((rule) => {\n return `- ${rule}`;\n }),\n \"\",\n \"## Verification\",\n \"- Verify the final image exists and is nonblank.\",\n \"- Check that the selected style's required reference anchors or source assets were used when applicable.\",\n \"- Report the final image URL or path and the selected registry resource ID.\",\n ].join(\"\\n\");\n\n return {\n type: \"generation-source-selection\",\n kind: \"image\",\n prompt: options.prompt,\n registryVersion: candidateSlice.registryVersion,\n artifact,\n selection: {\n candidates: candidateSlice.candidates,\n outputSchema: selectionSchema,\n },\n authoring: {\n details: options.details,\n artifactRules,\n },\n outputDir,\n instructions,\n };\n}\n","// Thin re-export shim. The resource registry now lives in `@vm0/core` as the\n// single source of truth. Keep importing from this path within the CLI.\nexport * from \"@vm0/core/resource-registry\";\n","export type GenerationTarget =\n | \"image\"\n | \"presentation\"\n | \"website\"\n | \"dashboard-design\"\n | \"mobile-app-design\"\n | \"poster\"\n | \"intro-video\"\n | \"report\"\n | \"docs-design\";\n\nexport type GenerationOutputKind =\n | \"website\"\n | \"image\"\n | \"audio\"\n | \"video\"\n | \"presentation\"\n | \"report\"\n | \"poster\"\n | \"dashboard-design\"\n | \"mobile-app-design\"\n | \"docs-design\"\n | \"bundle\";\n\ntype ResourceKind =\n | \"skill\"\n | \"template\"\n | \"design-system\"\n | \"image-style\"\n | \"audio-style\"\n | \"video-template\"\n | \"bundle-template\";\n\ninterface ResourceSourceRef {\n readonly path: string;\n readonly repo?: string;\n readonly ref?: string;\n}\n\nexport interface RegistryEntry {\n readonly id: string;\n readonly kind: ResourceKind;\n readonly name: string;\n readonly description: string;\n readonly desc?: string;\n readonly source: ResourceSourceRef;\n /**\n * Generation targets this entry applies to. Mandatory for `kind: \"template\"`\n * so we can filter templates per `generate` subcommand. Optional and unused\n * for other kinds — design systems apply to all HTML targets, image styles\n * apply only to image generation, and so on.\n */\n readonly targets?: readonly GenerationTarget[];\n}\n\nexport interface ResourceCandidateSlice {\n readonly registryVersion: string;\n readonly source: {\n readonly repo: string;\n readonly ref: string;\n };\n readonly sources: readonly {\n readonly repo: string;\n readonly ref: string;\n }[];\n readonly candidates: {\n readonly skills: readonly RegistryEntry[];\n readonly templates: readonly RegistryEntry[];\n readonly designSystems: readonly RegistryEntry[];\n readonly imageStyles: readonly RegistryEntry[];\n readonly audioStyles: readonly RegistryEntry[];\n readonly videoTemplates: readonly RegistryEntry[];\n readonly bundleTemplates: readonly RegistryEntry[];\n };\n}\n\nconst RESOURCE_REGISTRY_REPO = \"nexu-io/open-design\";\nconst RESOURCE_REGISTRY_COMMIT = \"3fb620af423534643677c7c6fae76be088fa770a\";\nconst VM0_SKILLS_REPO = \"vm0-ai/vm0-skills\";\nconst VM0_SKILLS_REF = \"main\";\n\nconst RESOURCE_REGISTRY_VERSION = \"v1\";\n\nconst RESOURCE_REGISTRY: readonly RegistryEntry[] = [\n {\n id: \"skill:article-magazine\",\n kind: \"skill\",\n name: \"Article Magazine\",\n description:\n \"Shapes research or editorial material into a magazine-like narrative with strong hierarchy.\",\n source: { path: \"skills/article-magazine/SKILL.md\" },\n },\n {\n id: \"skill:design-brief\",\n kind: \"skill\",\n name: \"Design Brief\",\n description:\n \"Converts a product, brand, or feature request into a structured design brief.\",\n source: { path: \"skills/design-brief/SKILL.md\" },\n },\n {\n id: \"skill:8-bit-orbit-video-template\",\n kind: \"skill\",\n name: \"8 Bit Orbit Video Template\",\n description:\n \"HyperFrames-based video template for retro pixel deck motion design — multi-scene HTML-to-video composition with advanced transitions and ready-to-render default style.\",\n source: { path: \"skills/8-bit-orbit-video-template/SKILL.md\" },\n },\n {\n id: \"skill:after-hours-editorial-template\",\n kind: \"skill\",\n name: \"After Hours Editorial Template\",\n description:\n \"Luxury dark-editorial HyperFrames template for three-page cinematic storyboards — haute couture title cards and magazine chapter spreads with moody serif-led storytelling.\",\n source: { path: \"skills/after-hours-editorial-template/SKILL.md\" },\n },\n {\n id: \"skill:algorithmic-art\",\n kind: \"skill\",\n name: \"Algorithmic Art\",\n description:\n \"Create generative art using p5.js with seeded randomness so every render is reproducible. Useful for procedural posters, motion-style stills, and artistic frame studies.\",\n source: { path: \"skills/algorithmic-art/SKILL.md\" },\n },\n {\n id: \"skill:apple-hig\",\n kind: \"skill\",\n name: \"Apple HIG\",\n description:\n \"Apple Human Interface Guidelines as 14 agent skills covering platforms, foundations, components, patterns, inputs, and technologies for iOS, macOS, visionOS, watchOS, and tvOS.\",\n source: { path: \"skills/apple-hig/SKILL.md\" },\n },\n {\n id: \"skill:brainstorming\",\n kind: \"skill\",\n name: \"Brainstorming\",\n description:\n \"Transform rough ideas into fully-formed designs through structured questioning and alternative exploration. Useful early in concept work.\",\n source: { path: \"skills/brainstorming/SKILL.md\" },\n },\n {\n id: \"skill:brand-guidelines\",\n kind: \"skill\",\n name: \"Brand Guidelines\",\n description:\n \"Apply Anthropic's official brand colors and typography to artifacts for consistent visual identity and professional design standards. A reference for shaping your own.\",\n source: { path: \"skills/brand-guidelines/SKILL.md\" },\n },\n {\n id: \"skill:canvas-design\",\n kind: \"skill\",\n name: \"Canvas Design\",\n description:\n \"Create beautiful visual art in PNG and PDF documents using design philosophy and aesthetic principles for posters, illustrations, and static pieces.\",\n source: { path: \"skills/canvas-design/SKILL.md\" },\n },\n {\n id: \"skill:card-twitter\",\n kind: \"skill\",\n name: \"Card Twitter\",\n description: \"Twitter quote or data card designed to pair with a post.\",\n source: { path: \"skills/card-twitter/SKILL.md\" },\n },\n {\n id: \"skill:card-xiaohongshu\",\n kind: \"skill\",\n name: \"Card Xiaohongshu\",\n description:\n \"Xiaohongshu-style knowledge cards, arranged as a swipeable multi-card carousel.\",\n source: { path: \"skills/card-xiaohongshu/SKILL.md\" },\n },\n {\n id: \"skill:color-expert\",\n kind: \"skill\",\n name: \"Color Expert\",\n description:\n \"Color science expert skill with 286K words of reference material covering OKLCH/OKLAB, palette generation, accessibility/contrast, color naming, pigment mixing, and historical color theory.\",\n source: { path: \"skills/color-expert/SKILL.md\" },\n },\n {\n id: \"skill:creative-director\",\n kind: \"skill\",\n name: \"Creative Director\",\n description:\n \"AI creative director with recursive self-assessment: 20+ methodologies (SIT, TRIZ, Bisociation, SCAMPER, Synectics), 3-axis evaluation calibrated against Cannes/D&AD/HumanKind, 5-phase process from brief to presentation.\",\n source: { path: \"skills/creative-director/SKILL.md\" },\n },\n {\n id: \"skill:d3-visualization\",\n kind: \"skill\",\n name: \"D3 Visualization\",\n description:\n \"Teaches the agent to produce D3 charts and interactive data visualizations. Useful for editorial dashboards, reports, and explanatory graphics.\",\n source: { path: \"skills/d3-visualization/SKILL.md\" },\n },\n {\n id: \"skill:deck-guizang-editorial\",\n kind: \"skill\",\n name: \"Deck Guizang Editorial\",\n description:\n \"Editorial magazine meets e-ink: 10 layouts and 5 palettes (Ink, Indigo Porcelain, Forest Ink, Kraft Paper, Dune).\",\n source: { path: \"skills/deck-guizang-editorial/SKILL.md\" },\n },\n {\n id: \"skill:deck-open-slide-canvas\",\n kind: \"skill\",\n name: \"Deck Open Slide Canvas\",\n description:\n \"Locked 1920x1080 canvas deck with React component-level free composition, not bound to a fixed template.\",\n source: { path: \"skills/deck-open-slide-canvas/SKILL.md\" },\n },\n {\n id: \"skill:deck-swiss-international\",\n kind: \"skill\",\n name: \"Deck Swiss International\",\n description:\n \"16-column grid, one saturated accent, and 22 locked layouts (Klein Blue, Lemon, Mint, Safety Orange).\",\n source: { path: \"skills/deck-swiss-international/SKILL.md\" },\n },\n {\n id: \"skill:design-consultation\",\n kind: \"skill\",\n name: \"Design Consultation\",\n description:\n \"Build a complete design system from scratch with creative risks and realistic product mockups. Useful for kickoff workshops and brand-from-zero work.\",\n source: { path: \"skills/design-consultation/SKILL.md\" },\n },\n {\n id: \"skill:design-md\",\n kind: \"skill\",\n name: \"Design MD\",\n description:\n \"Create and manage DESIGN.md files. Useful for capturing design direction, tokens, and visual rules in a single source of truth.\",\n source: { path: \"skills/design-md/SKILL.md\" },\n },\n {\n id: \"skill:design-review\",\n kind: \"skill\",\n name: \"Design Review\",\n description:\n \"Designer Who Codes: visual audit then fixes with atomic commits and before/after screenshots. Useful for tightening shipped UI before launch.\",\n source: { path: \"skills/design-review/SKILL.md\" },\n },\n {\n id: \"skill:digits-fintech-swiss-template\",\n kind: \"skill\",\n name: \"Digits Fintech Swiss Template\",\n description:\n \"Swiss-grid fintech deck template in black / warm paper / neon-lime — strict modular layout, bold numeric cards, restrained motion, keyboard/click navigation.\",\n source: { path: \"skills/digits-fintech-swiss-template/SKILL.md\" },\n },\n {\n id: \"skill:doc-kami-parchment\",\n kind: \"skill\",\n name: \"DOC Kami Parchment\",\n description:\n \"Warm parchment canvas (#f5f4ed), monochrome ink-blue accent (#1B365D), one serif family, and editorial-grade typography.\",\n source: { path: \"skills/doc-kami-parchment/SKILL.md\" },\n },\n {\n id: \"skill:editorial-burgundy-principles-template\",\n kind: \"skill\",\n name: \"Editorial Burgundy Principles Template\",\n description:\n \"Editorial studio deck template in burgundy / blush / muted-gold — pill tags, large typographic statements, principle cards, guided keyboard/click navigation.\",\n source: { path: \"skills/editorial-burgundy-principles-template/SKILL.md\" },\n },\n {\n id: \"skill:enhance-prompt\",\n kind: \"skill\",\n name: \"Enhance Prompt\",\n description:\n \"Improve prompts with design specs and UI/UX vocabulary. Useful for design-to-code workflows and clarifying requests for visual output.\",\n source: { path: \"skills/enhance-prompt/SKILL.md\" },\n },\n {\n id: \"skill:faq-page\",\n kind: \"skill\",\n name: \"FAQ Page\",\n description:\n \"A Frequently Asked Questions (FAQ) page with collapsible accordion sections, search functionality, and category filtering.\",\n source: { path: \"skills/faq-page/SKILL.md\" },\n },\n {\n id: \"skill:field-notes-editorial-template\",\n kind: \"skill\",\n name: \"Field Notes Editorial Template\",\n description:\n \"Editorial Field Notes report template — soft paper background, serif hero typography, rounded pastel insight cards, retention chart panel. Premium magazine-style.\",\n source: { path: \"skills/field-notes-editorial-template/SKILL.md\" },\n },\n {\n id: \"skill:figma-create-design-system-rules\",\n kind: \"skill\",\n name: \"Figma Create Design System Rules\",\n description:\n \"Generate project-specific design system rules for Figma-to-code workflows. Useful for capturing tokens, naming, and lint rules in one source.\",\n source: { path: \"skills/figma-create-design-system-rules/SKILL.md\" },\n },\n {\n id: \"skill:figma-generate-design\",\n kind: \"skill\",\n name: \"Figma Generate Design\",\n description:\n \"Build or update screens in Figma from code or description using design system components. Translate app pages into Figma using design tokens.\",\n source: { path: \"skills/figma-generate-design/SKILL.md\" },\n },\n {\n id: \"skill:figma-generate-library\",\n kind: \"skill\",\n name: \"Figma Generate Library\",\n description:\n \"Build or update a professional-grade design system library in Figma from a codebase. Useful for keeping the Figma source of truth in sync with shipped components.\",\n source: { path: \"skills/figma-generate-library/SKILL.md\" },\n },\n {\n id: \"skill:figma-implement-design\",\n kind: \"skill\",\n name: \"Figma Implement Design\",\n description:\n \"Translate Figma designs into production-ready code with 1:1 visual fidelity. Useful for handing off Figma frames straight to a frontend agent.\",\n source: { path: \"skills/figma-implement-design/SKILL.md\" },\n },\n {\n id: \"skill:flutter-animating-apps\",\n kind: \"skill\",\n name: \"Flutter Animating Apps\",\n description:\n \"Implement animated effects, transitions, and motion in Flutter apps. Useful for native iOS/Android motion design.\",\n source: { path: \"skills/flutter-animating-apps/SKILL.md\" },\n },\n {\n id: \"skill:frame-data-chart-nyt\",\n kind: \"skill\",\n name: \"Frame Data Chart Nyt\",\n description:\n \"NYT-newsroom typography, staggered reveal animation, and editorial-grade charts (line, bar, or range band).\",\n source: { path: \"skills/frame-data-chart-nyt/SKILL.md\" },\n },\n {\n id: \"skill:frame-flowchart-sticky\",\n kind: \"skill\",\n name: \"Frame Flowchart Sticky\",\n description:\n \"SVG curve connectors, sticky-note nodes, and cursor interaction with a whiteboard-brainstorm feel.\",\n source: { path: \"skills/frame-flowchart-sticky/SKILL.md\" },\n },\n {\n id: \"skill:frame-glitch-title\",\n kind: \"skill\",\n name: \"Frame Glitch Title\",\n description:\n \"Digital glitch, chromatic offset, and data-corruption title frame for video transitions or cyberpunk heroes.\",\n source: { path: \"skills/frame-glitch-title/SKILL.md\" },\n },\n {\n id: \"skill:frame-light-leak-cinema\",\n kind: \"skill\",\n name: \"Frame Light Leak Cinema\",\n description:\n \"Film light leaks, grain, 16:9 letterbox, and large serif type for cinematic openings or chapter cards.\",\n source: { path: \"skills/frame-light-leak-cinema/SKILL.md\" },\n },\n {\n id: \"skill:frame-liquid-bg-hero\",\n kind: \"skill\",\n name: \"Frame Liquid Bg Hero\",\n description:\n \"WebGL-style fluid displacement background with a quote overlay, suited to video intros, landing heroes, or posters.\",\n source: { path: \"skills/frame-liquid-bg-hero/SKILL.md\" },\n },\n {\n id: \"skill:frame-logo-outro\",\n kind: \"skill\",\n name: \"Frame Logo Outro\",\n description:\n \"Segmented logo assembly, glow bloom, and tagline reveal for video outros or brand closing frames.\",\n source: { path: \"skills/frame-logo-outro/SKILL.md\" },\n },\n {\n id: \"skill:frame-macos-notification\",\n kind: \"skill\",\n name: \"Frame Macos Notification\",\n description:\n \"Realistic macOS notification banner with app icon, title, and body, suited to video overlays or product teasers.\",\n source: { path: \"skills/frame-macos-notification/SKILL.md\" },\n },\n {\n id: \"skill:frontend-design\",\n kind: \"skill\",\n name: \"Frontend Design\",\n description:\n \"Frontend design and UI/UX development tools for shipping production-ready interfaces with strong typographic and layout discipline.\",\n source: { path: \"skills/frontend-design/SKILL.md\" },\n },\n {\n id: \"skill:frontend-dev\",\n kind: \"skill\",\n name: \"Frontend Dev\",\n description:\n \"Full-stack frontend with cinematic animations, AI-generated media via MiniMax API, and generative art. Useful for hero pages and showcase sites.\",\n source: { path: \"skills/frontend-dev/SKILL.md\" },\n },\n {\n id: \"skill:frontend-skill\",\n kind: \"skill\",\n name: \"Frontend Skill\",\n description:\n \"Create visually strong landing pages, websites, and app UIs with restrained composition. OpenAI's production frontend playbook.\",\n source: { path: \"skills/frontend-skill/SKILL.md\" },\n },\n {\n id: \"skill:frontend-slides\",\n kind: \"skill\",\n name: \"Frontend Slides\",\n description:\n \"Generate animation-rich HTML presentations with visual style previews. Useful for online keynotes, embedded talks, and interactive briefs.\",\n source: { path: \"skills/frontend-slides/SKILL.md\" },\n },\n {\n id: \"skill:gsap-core\",\n kind: \"skill\",\n name: \"GSAP Core\",\n description:\n \"Core GSAP API with gsap.to(), from(), fromTo(), easing, duration, stagger, and defaults. Production-grade web animation primitives.\",\n source: { path: \"skills/gsap-core/SKILL.md\" },\n },\n {\n id: \"skill:gsap-react\",\n kind: \"skill\",\n name: \"GSAP React\",\n description:\n \"GSAP React integration with useGSAP hook, refs, gsap.context(), cleanup, and SSR. Ships safe motion in React + Next.js apps.\",\n source: { path: \"skills/gsap-react/SKILL.md\" },\n },\n {\n id: \"skill:gsap-scrolltrigger\",\n kind: \"skill\",\n name: \"GSAP Scrolltrigger\",\n description:\n \"GSAP ScrollTrigger for scroll-linked animations, pinning, scrub, and refresh handling. Useful for editorial sites and product pages.\",\n source: { path: \"skills/gsap-scrolltrigger/SKILL.md\" },\n },\n {\n id: \"skill:gsap-timeline\",\n kind: \"skill\",\n name: \"GSAP Timeline\",\n description:\n \"GSAP Timelines with sequencing, position parameter, labels, nesting, and playback control. Useful for orchestrating multi-step motion sequences.\",\n source: { path: \"skills/gsap-timeline/SKILL.md\" },\n },\n {\n id: \"skill:hand-drawn-diagrams\",\n kind: \"skill\",\n name: \"Hand Drawn Diagrams\",\n description:\n \"Generate hand-drawn Excalidraw diagrams from a prompt - animated SVG, hosted edit link, and PNG export. Works with Claude Code, Codex, Gemini CLI, and any agent supporting standard skill paths.\",\n source: { path: \"skills/hand-drawn-diagrams/SKILL.md\" },\n },\n {\n id: \"skill:hatch-pet\",\n kind: \"skill\",\n name: \"Hatch Pet\",\n description:\n \"Create, repair, validate, preview, and package Codex-compatible animated pet spritesheets with an 8x9 atlas, QA contact sheets, preview videos, and pet.json packaging.\",\n source: { path: \"skills/hatch-pet/SKILL.md\" },\n },\n {\n id: \"skill:html-ppt-retro-quarterly-review\",\n kind: \"skill\",\n name: \"HTML PPT Retro Quarterly Review\",\n description:\n \"Retro Quarterly Review template — bold blue + orange editorial with slab headlines, cream paper sections, structured grids, fast premium motion pacing in video mode.\",\n source: { path: \"skills/html-ppt-retro-quarterly-review/SKILL.md\" },\n },\n {\n id: \"skill:login-flow\",\n kind: \"skill\",\n name: \"Login Flow\",\n description: \"Mobile login and authentication flow screens.\",\n source: { path: \"skills/login-flow/SKILL.md\" },\n },\n {\n id: \"skill:mockup-device-3d\",\n kind: \"skill\",\n name: \"Mockup Device 3D\",\n description:\n \"Static iPhone and MacBook 3D-style showcase with real HTML embedded on screens, glass-lens refraction, and 360-degree turntable composition.\",\n source: { path: \"skills/mockup-device-3d/SKILL.md\" },\n },\n {\n id: \"skill:paywall-upgrade-cro\",\n kind: \"skill\",\n name: \"Paywall Upgrade Cro\",\n description:\n \"Design and optimize upgrade screens, paywalls, and upsell modals. Useful for SaaS conversion design and pricing-page experiments.\",\n source: { path: \"skills/paywall-upgrade-cro/SKILL.md\" },\n },\n {\n id: \"skill:plan-design-review\",\n kind: \"skill\",\n name: \"Plan Design Review\",\n description:\n \"Senior Designer review: rates each design dimension 0-10, explains what a 10 looks like, and flags AI Slop signals. Useful as a gate before merging UI work.\",\n source: { path: \"skills/plan-design-review/SKILL.md\" },\n },\n {\n id: \"skill:platform-design\",\n kind: \"skill\",\n name: \"Platform Design\",\n description:\n \"300+ design rules from Apple HIG, Material Design 3, and WCAG 2.2 for cross-platform apps. Useful when shipping a single design across iOS, Android, and the web.\",\n source: { path: \"skills/platform-design/SKILL.md\" },\n },\n {\n id: \"skill:poster-hero\",\n kind: \"skill\",\n name: \"Poster Hero\",\n description:\n \"Vertical poster or Moments-style share image with strong visual impact.\",\n source: { path: \"skills/poster-hero/SKILL.md\" },\n },\n {\n id: \"skill:ppt-keynote\",\n kind: \"skill\",\n name: \"PPT Keynote\",\n description:\n \"Apple Keynote-quality slides, one card per screen, with keyboard left/right navigation.\",\n source: { path: \"skills/ppt-keynote/SKILL.md\" },\n },\n {\n id: \"skill:release-notes-one-pager\",\n kind: \"skill\",\n name: \"Release Notes One Pager\",\n description:\n 'Release notes one-page HTML with highlights, Added, Fixed, Breaking changes, Known issues, and Upgrade note. Writes explicit \"None\" style sections whenever the user does not provide details.',\n source: { path: \"skills/release-notes-one-pager/SKILL.md\" },\n },\n {\n id: \"skill:resume-modern\",\n kind: \"skill\",\n name: \"Resume Modern\",\n description:\n \"Modern minimal resume, single A4 page, ready for print or PDF export.\",\n source: { path: \"skills/resume-modern/SKILL.md\" },\n },\n {\n id: \"skill:screenshots-marketing\",\n kind: \"skill\",\n name: \"Screenshots Marketing\",\n description:\n \"Generate marketing screenshots with Playwright. Useful for landing-page hero shots, App Store screenshots, and changelog visuals.\",\n source: { path: \"skills/screenshots-marketing/SKILL.md\" },\n },\n {\n id: \"skill:shadcn-ui\",\n kind: \"skill\",\n name: \"Shadcn UI\",\n description:\n \"Build UI components with shadcn/ui. Pairs with the Stitch design loop to ship structured, accessible components quickly.\",\n source: { path: \"skills/shadcn-ui/SKILL.md\" },\n },\n {\n id: \"skill:shader-dev\",\n kind: \"skill\",\n name: \"Shader Dev\",\n description:\n \"GLSL shader techniques for ray marching, fluid simulation, particle systems, and procedural generation. Useful for hero visuals and motion stills.\",\n source: { path: \"skills/shader-dev/SKILL.md\" },\n },\n {\n id: \"skill:slack-gif-creator\",\n kind: \"skill\",\n name: \"Slack GIF Creator\",\n description:\n \"Create animated GIFs optimized for Slack with validators for size constraints and composable animation primitives.\",\n source: { path: \"skills/slack-gif-creator/SKILL.md\" },\n },\n {\n id: \"skill:slides\",\n kind: \"skill\",\n name: \"Slides\",\n description:\n \"Create and edit .pptx presentation decks with PptxGenJS. Useful for sales decks, kickoff briefs, and design-system showcases.\",\n source: { path: \"skills/slides/SKILL.md\" },\n },\n {\n id: \"skill:social-reddit-card\",\n kind: \"skill\",\n name: \"Social Reddit Card\",\n description:\n \"Realistic Reddit post card with vote rail and comment count, suited to video overlays or story sharing.\",\n source: { path: \"skills/social-reddit-card/SKILL.md\" },\n },\n {\n id: \"skill:social-spotify-card\",\n kind: \"skill\",\n name: \"Social Spotify Card\",\n description:\n \"Spotify Now Playing-style card with album art, progress bar, and playback controls, suited to video overlays or personal homepages.\",\n source: { path: \"skills/social-spotify-card/SKILL.md\" },\n },\n {\n id: \"skill:social-x-post-card\",\n kind: \"skill\",\n name: \"Social X Post Card\",\n description:\n \"Realistic X post card with engagement metrics (likes, reposts, views), suited to video overlays or shareable image cards.\",\n source: { path: \"skills/social-x-post-card/SKILL.md\" },\n },\n {\n id: \"skill:stitch-loop\",\n kind: \"skill\",\n name: \"Stitch Loop\",\n description:\n \"Iterative design-to-code feedback loop. Critique adjust ship cycle for tightening visual fidelity between brief and built UI.\",\n source: { path: \"skills/stitch-loop/SKILL.md\" },\n },\n {\n id: \"skill:swiftui-design\",\n kind: \"skill\",\n name: \"Swiftui Design\",\n description:\n \"SwiftUI skill - anti AI-slop rules, design direction advisor, brand asset protocol, and five-dimension review. Works with Claude Code, Cursor, Codex, and OpenCode.\",\n source: { path: \"skills/swiftui-design/SKILL.md\" },\n },\n {\n id: \"skill:swiss-creative-mode-template\",\n kind: \"skill\",\n name: \"Swiss Creative Mode Template\",\n description:\n \"Swiss-inspired creative-mode presentation template — bold editorial typography, high-contrast geometric cards, interactive slide navigation, theme switching, hotspot overlays.\",\n source: { path: \"skills/swiss-creative-mode-template/SKILL.md\" },\n },\n {\n id: \"skill:swiss-user-research-video-template\",\n kind: \"skill\",\n name: \"Swiss User Research Video Template\",\n description:\n \"Swiss-style user-research narrative template in warm-paper editorial aesthetics — minimalist typography, donut breakdowns, keyboard/click navigation, single-file HTML.\",\n source: { path: \"skills/swiss-user-research-video-template/SKILL.md\" },\n },\n {\n id: \"skill:taste-skill\",\n kind: \"skill\",\n name: \"Taste Skill\",\n description:\n \"High-agency frontend skill that gives AI good taste with tunable design variance, motion intensity, and visual density to stop generic UI slop.\",\n source: { path: \"skills/taste-skill/SKILL.md\" },\n },\n {\n id: \"skill:theme-factory\",\n kind: \"skill\",\n name: \"Theme Factory\",\n description:\n \"Apply professional font and color themes to artifacts including slides, docs, reports, and HTML landing pages. Ships 10 pre-set themes.\",\n source: { path: \"skills/theme-factory/SKILL.md\" },\n },\n {\n id: \"skill:threejs\",\n kind: \"skill\",\n name: \"Threejs\",\n description:\n \"Three.js skills for creating 3D elements and interactive experiences in the browser - scenes, materials, controls, and post-processing.\",\n source: { path: \"skills/threejs/SKILL.md\" },\n },\n {\n id: \"skill:ui-skills\",\n kind: \"skill\",\n name: \"UI Skills\",\n description:\n \"Opinionated, evolving constraints to guide agents when building interfaces. Useful for keeping output coherent across many small UI pieces.\",\n source: { path: \"skills/ui-skills/SKILL.md\" },\n },\n {\n id: \"skill:ui-ux-pro-max\",\n kind: \"skill\",\n name: \"UI UX Pro Max\",\n description:\n \"Catalog-only UI/UX Pro Max entry. The full upstream templates, data, and search workflow are not bundled in this registry.\",\n source: { path: \"skills/ui-ux-pro-max/SKILL.md\" },\n },\n {\n id: \"skill:vfx-text-cursor\",\n kind: \"skill\",\n name: \"VFX Text Cursor\",\n description:\n \"Cursor light trail, chromatic rays, and directional flares for word-by-word quote reveals in video intros.\",\n source: { path: \"skills/vfx-text-cursor/SKILL.md\" },\n },\n {\n id: \"skill:video-hyperframes\",\n kind: \"skill\",\n name: \"Video Hyperframes\",\n description:\n \"Hyperframes / Remotion-compatible continuous frame animation with autoplay support.\",\n source: { path: \"skills/video-hyperframes/SKILL.md\" },\n },\n {\n id: \"skill:web-design-guidelines\",\n kind: \"skill\",\n name: \"Web Design Guidelines\",\n description:\n \"Web design guidelines and standards by the Vercel engineering team. Covers layout, typography, color, motion, and accessibility for product UI.\",\n source: { path: \"skills/web-design-guidelines/SKILL.md\" },\n },\n {\n id: \"skill:weread-year-in-review-video-template\",\n kind: \"skill\",\n name: \"Weread Year In Review Video Template\",\n description:\n \"WeRead-inspired HyperFrames video template for vertical annual reading reports — warm paper texture, editorial Chinese typography, book-page metaphors, deterministic motion.\",\n source: { path: \"skills/weread-year-in-review-video-template/SKILL.md\" },\n },\n {\n id: \"skill:wpds\",\n kind: \"skill\",\n name: \"WPDS\",\n description:\n \"WordPress Design System. Apply WordPress's official design tokens, typography, and component patterns to themes and sites.\",\n source: { path: \"skills/wpds/SKILL.md\" },\n },\n {\n id: \"template:dashboard\",\n kind: \"template\",\n name: \"Dashboard\",\n description:\n \"Admin or analytics dashboard in a single HTML file with fixed sidebar, top bar, KPI cards, and one or two charts.\",\n source: { path: \"design-templates/dashboard\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:finance-report\",\n kind: \"template\",\n name: \"Finance Report\",\n description:\n \"Quarterly or monthly financial report with masthead KPIs, revenue and burn charts, P&L summary, highlights, and outlook.\",\n source: { path: \"design-templates/finance-report\" },\n targets: [\"report\"],\n },\n {\n id: \"template:docs-page\",\n kind: \"template\",\n name: \"Docs Page\",\n description:\n \"Documentation page with inline-start navigation, scrollable article body, and inline-end table of contents.\",\n source: { path: \"design-templates/docs-page\" },\n targets: [\"docs-design\"],\n },\n {\n id: \"template:mobile-app\",\n kind: \"template\",\n name: \"Mobile App Design\",\n description:\n \"Mobile app screen rendered inside a pixel-accurate iPhone 15 Pro frame using reusable screen archetypes.\",\n source: { path: \"design-templates/mobile-app\" },\n targets: [\"mobile-app-design\"],\n },\n {\n id: \"template:html-ppt-graphify-dark-graph\",\n kind: \"template\",\n name: \"Graphify Dark Graph\",\n description:\n \"Dark knowledge-graph deck with midnight gradients, force-graph cover visuals, command-line highlights, and glass-morphism cards.\",\n source: { path: \"design-templates/html-ppt-graphify-dark-graph\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-retro-zine\",\n kind: \"template\",\n name: \"Zhangzara Retro Zine\",\n description:\n \"Retro editorial zine presentation template with expressive composition, tactile paper energy, and bold magazine-like rhythm.\",\n source: { path: \"design-templates/html-ppt-zhangzara-retro-zine\" },\n targets: [\"presentation\", \"poster\"],\n },\n {\n id: \"template:weekly-update\",\n kind: \"template\",\n name: \"Weekly Update\",\n description:\n \"Single-file horizontal-swipe weekly team update deck for shipped work, in-flight work, blockers, metrics, and asks.\",\n source: { path: \"design-templates/weekly-update\" },\n targets: [\"report\", \"presentation\"],\n },\n {\n id: \"template:web-prototype-taste-editorial\",\n kind: \"template\",\n name: \"Taste Editorial Web Prototype\",\n description:\n \"Editorial-minimalist web prototype with warm monochrome canvas, serif display type, hairline borders, pastel chips, and ambient micro-motion.\",\n source: { path: \"design-templates/web-prototype-taste-editorial\" },\n targets: [\"website\"],\n },\n {\n id: \"template:audio-jingle\",\n kind: \"template\",\n name: \"Audio Jingle\",\n description:\n \"Audio generation skill — jingles, beds, voiceover, and sound effects. Routes music requests to Suno V5 / Udio / Lyria, speech to MiniMax TTS / FishAudio / ElevenLabs V3, and SFX to ElevenLabs SFX or AudioCraft. Output is one MP3/WAV file…\",\n source: { path: \"design-templates/audio-jingle\" },\n targets: [\"intro-video\"],\n },\n {\n id: \"template:blog-post\",\n kind: \"template\",\n name: \"Blog Post\",\n description:\n \"A long-form article / blog post — masthead, hero image placeholder, article body with figures and pull quotes, author byline, related posts.\",\n source: { path: \"design-templates/blog-post\" },\n targets: [\"website\"],\n },\n {\n id: \"template:clinical-case-report\",\n kind: \"template\",\n name: \"Clinical Case Report\",\n description:\n \"Structured medical case presentation for clinical rounds, conferences, and documentation. Generates SOAP-format or narrative case reports with physiologically accurate vitals, labs, and evidence-based plans.\",\n source: { path: \"design-templates/clinical-case-report\" },\n targets: [\"report\"],\n },\n {\n id: \"template:critique\",\n kind: \"template\",\n name: \"Critique\",\n description:\n \"Run a 5-dimension expert design review on any HTML artifact in the project — Philosophy / Visual hierarchy / Detail / Functionality / Innovation, each scored 0–10. Outputs a single self-contained HTML report with a radar chart, evidence…\",\n source: { path: \"design-templates/critique\" },\n targets: [\n \"website\",\n \"dashboard-design\",\n \"presentation\",\n \"report\",\n \"docs-design\",\n \"poster\",\n \"mobile-app-design\",\n ],\n },\n {\n id: \"template:dating-web\",\n kind: \"template\",\n name: \"Dating Web\",\n description:\n \"A consumer-feeling dating / matchmaking dashboard — left rail navigation, ticker bar of community signals, headline KPIs, a 30-day mutual-matches bar chart, and a match-rate trend block. Editorial typography, restrained accent.\",\n source: { path: \"design-templates/dating-web\" },\n targets: [\"website\"],\n },\n {\n id: \"template:dcf-valuation\",\n kind: \"template\",\n name: \"Dcf Valuation\",\n description:\n \"Discounted cash flow valuation and intrinsic value analysis for public companies.\",\n source: { path: \"design-templates/dcf-valuation\" },\n targets: [\"report\"],\n },\n {\n id: \"template:digital-eguide\",\n kind: \"template\",\n name: \"Digital Eguide\",\n description:\n 'A two-spread digital e-guide preview — page 1 is a cover (display title, author, \"What\\'s inside\" stats, table of contents teaser); page 2 is a spread (lesson body with pull-quote and a step list). Lifestyle / creator brand tone.',\n source: { path: \"design-templates/digital-eguide\" },\n targets: [\"website\", \"docs-design\"],\n },\n {\n id: \"template:email-marketing\",\n kind: \"template\",\n name: \"Email Marketing\",\n description:\n \"A brand product-launch email — masthead with wordmark, hero image block, headline lockup with skewed-italic accent, body copy, primary CTA, and a specifications grid. Pure HTML email layout (centered single column, table fallback).\",\n source: { path: \"design-templates/email-marketing\" },\n targets: [\"website\"],\n },\n {\n id: \"template:eng-runbook\",\n kind: \"template\",\n name: \"Eng Runbook\",\n description:\n \"An engineering runbook — service overview, alerts table, dashboards links, common procedures with copy-pasteable commands, on-call rotation, and an incident-response checklist.\",\n source: { path: \"design-templates/eng-runbook\" },\n targets: [\"docs-design\"],\n },\n {\n id: \"template:flowai-live-dashboard-template\",\n kind: \"template\",\n name: \"Flowai Live Dashboard Template\",\n description:\n \"FlowAI team-management dashboard — three tabs (Members, Details, Activity Log), KPI row, role chart, presence sparklines, contributor panel, light/dark, CSV export, single HTML.\",\n source: { path: \"design-templates/flowai-live-dashboard-template\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:gamified-app\",\n kind: \"template\",\n name: \"Gamified App\",\n description:\n \"A multi-frame gamified mobile-app prototype — three phone frames on a dark showcase stage. Frame 1: cover / poster, Frame 2: today's quests with XP ribbons and a level bar, Frame 3: quest detail. Vivid quest tiles, level ribbon, bottom t…\",\n source: { path: \"design-templates/gamified-app\" },\n targets: [\"website\", \"mobile-app-design\"],\n },\n {\n id: \"template:github-dashboard\",\n kind: \"template\",\n name: \"Github Dashboard\",\n description:\n \"GitHub repository analytics dashboard — stars, forks, contributors, issues, pull requests, recent activity, and top contributors.\",\n source: { path: \"design-templates/github-dashboard\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:guizang-ppt\",\n kind: \"template\",\n name: \"Guizang PPT\",\n description:\n \"电子杂志 × 电子墨水风格的横向翻页网页 PPT — WebGL 流体背景、衬线标题、章节幕封、数据大字报、图片网格。适合分享 / 演讲 / 发布会 / 杂志风 PPT。\",\n source: { path: \"design-templates/guizang-ppt\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:hr-onboarding\",\n kind: \"template\",\n name: \"Hr Onboarding\",\n description:\n 'A new-hire onboarding plan as a single page — first week schedule, buddy + manager intro, learning track, equipment checklist, and \"you\\'re set when…\" outcomes.',\n source: { path: \"design-templates/hr-onboarding\" },\n targets: [\"docs-design\"],\n },\n {\n id: \"template:html-ppt\",\n kind: \"template\",\n name: \"HTML PPT\",\n description:\n \"HTML PPT Studio — static HTML presentations driven by templates. Many styles, layouts, animations, and keyboard navigation for talks, pitches, reports, and 小红书图文.\",\n source: { path: \"design-templates/html-ppt\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-course-module\",\n kind: \"template\",\n name: \"HTML PPT Course Module\",\n description:\n \"Online-course / workshop module deck — warm paper background + Playfair serif, persistent left sidebar of learning objectives, MCQ self-check page. Use for teaching modules, training materials, workshop slides.\",\n source: { path: \"design-templates/html-ppt-course-module\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-dir-key-nav-minimal\",\n kind: \"template\",\n name: \"HTML PPT Dir Key Nav Minimal\",\n description:\n \"极简方向键 keynote — 每页独立单色背景、160px display 标题、4px accent 线、箭头 → 前缀 Mono 列表、← → kbd 提示。适合 keynote、launch、公开演讲。\",\n source: { path: \"design-templates/html-ppt-dir-key-nav-minimal\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-hermes-cyber-terminal\",\n kind: \"template\",\n name: \"HTML PPT Hermes Cyber Terminal\",\n description:\n \"暗终端 honest-review deck — 黑底 + 赛博网格 + CRT 暗角 + 扫描线、`$ prompt` 命令行标题、薄荷绿大字、JetBrains Mono、stroke-only 柱状图。适合 CLI/agent/dev tool 测评。\",\n source: { path: \"design-templates/html-ppt-hermes-cyber-terminal\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-knowledge-arch-blueprint\",\n kind: \"template\",\n name: \"HTML PPT Knowledge Arch Blueprint\",\n description:\n \"奶油蓝图架构 deck — 奶油纸底色 + 单一锈红高亮、48px 蓝图网格、2px 黑边硬卡片、pipeline 步骤盒、右侧 insight callout、Playfair 衬线大字。零渐变零软阴影。\",\n source: { path: \"design-templates/html-ppt-knowledge-arch-blueprint\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-obsidian-claude-gradient\",\n kind: \"template\",\n name: \"HTML PPT Obsidian Claude Gradient\",\n description:\n \"GitHub 暗紫渐变 deck — GitHub-dark + 紫蓝 radial 环境光 + 60px 网格、紫色 pill 标签、三色渐变标题、GitHub 风代码 palette。适合开发者工作流 / MCP / Agent 教程。\",\n source: { path: \"design-templates/html-ppt-obsidian-claude-gradient\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-pitch-deck\",\n kind: \"template\",\n name: \"HTML PPT Pitch Deck\",\n description:\n \"Investor-ready 10-slide HTML pitch deck — white + blue→purple gradient hero, big numbers, traction bar chart, $4.5M-style ask page.\",\n source: { path: \"design-templates/html-ppt-pitch-deck\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-presenter-mode-reveal\",\n kind: \"template\",\n name: \"HTML PPT Presenter Mode Reveal\",\n description:\n \"演讲者模式 deck — tokyo-night 默认主题,5 套主题 T 键切换,每页带 150-300 字逐字稿示例,按 S 打开 CURRENT/NEXT/SCRIPT/TIMER 四张磁吸卡片。适合提词器场景。\",\n source: { path: \"design-templates/html-ppt-presenter-mode-reveal\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-product-launch\",\n kind: \"template\",\n name: \"HTML PPT Product Launch\",\n description:\n \"Launch keynote deck — dark hero + light content, warm orange→peach accent, feature cards, pricing tiers, CTA.\",\n source: { path: \"design-templates/html-ppt-product-launch\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-taste-brutalist\",\n kind: \"template\",\n name: \"HTML PPT Taste Brutalist\",\n description:\n \"16:9 HTML deck in tactical-telemetry / CRT-terminal taste. Deactivated-CRT charcoal slides, white-phosphor monospace, hazard-red accent, scanline overlay, ASCII syntax, density over decoration. Distilled from Leonxlnx/taste-skill `brutal…\",\n source: { path: \"design-templates/html-ppt-taste-brutalist\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-taste-editorial\",\n kind: \"template\",\n name: \"HTML PPT Taste Editorial\",\n description:\n \"16:9 HTML deck in editorial-minimalist taste. Warm cream slides, serif display + grotesque body, hairline rules, monospace meta, generous macro-whitespace, one accent. Distilled from Leonxlnx/taste-skill `minimalist-skill`.\",\n source: { path: \"design-templates/html-ppt-taste-editorial\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-tech-sharing\",\n kind: \"template\",\n name: \"HTML PPT Tech Sharing\",\n description:\n \"Conference / internal tech-talk deck — GitHub-dark, JetBrains Mono, terminal code blocks, agenda + Q&A pages. Use for engineering presentations, internal sharing sessions, conference talks, and code-heavy walkthroughs.\",\n source: { path: \"design-templates/html-ppt-tech-sharing\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-testing-safety-alert\",\n kind: \"template\",\n name: \"HTML PPT Testing Safety Alert\",\n description:\n \"红琥珀警示 deck — 顶/底 45° 红黑 hazard 条纹、红色否定标题、L1/L2/L3 三档卡片、policy-yaml 代码块、红绿 checklist、事故堆叠柱状图。适合安全 / 风险 / 复盘 / 红队。\",\n source: { path: \"design-templates/html-ppt-testing-safety-alert\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-weekly-report\",\n kind: \"template\",\n name: \"HTML PPT Weekly Report\",\n description:\n \"Team weekly / status-update deck — corporate clarity, 8-cell KPI grid, shipped list, 8-week bar chart, next-week table. Use for 周报, business reviews, team status updates, and exec dashboards.\",\n source: { path: \"design-templates/html-ppt-weekly-report\" },\n targets: [\"presentation\", \"report\"],\n },\n {\n id: \"template:html-ppt-xhs-pastel-card\",\n kind: \"template\",\n name: \"HTML PPT Xhs Pastel Card\",\n description:\n \"柔和马卡龙慢生活 deck — 奶油底 + 柔光 blob、Playfair 斜体 + sans 正文、28px 圆角马卡龙卡片、SVG donut 图、chip+page 顶栏。适合生活方式 / 个人成长 / 慢生活内容。\",\n source: { path: \"design-templates/html-ppt-xhs-pastel-card\" },\n targets: [\"presentation\", \"poster\"],\n },\n {\n id: \"template:html-ppt-xhs-post\",\n kind: \"template\",\n name: \"HTML PPT Xhs Post\",\n description:\n \"小红书 / Instagram 风 9 页 3:4 竖版图文(810×1080)— 暖色 pastel、虚线 sticker 卡片、底部页码点点。\",\n source: { path: \"design-templates/html-ppt-xhs-post\" },\n targets: [\"presentation\", \"poster\"],\n },\n {\n id: \"template:html-ppt-xhs-white-editorial\",\n kind: \"template\",\n name: \"HTML PPT Xhs White Editorial\",\n description:\n \"白底杂志风 deck — 纯白 + 顶部 10 色彩虹 bar、80-110px display 标题、紫→蓝→绿→橙→粉渐变文字、马卡龙软卡片组、黑底白字 .focus pill。小红书图文 + 横版 PPT 双用。\",\n source: { path: \"design-templates/html-ppt-xhs-white-editorial\" },\n targets: [\"presentation\", \"poster\"],\n },\n {\n id: \"template:html-ppt-zhangzara-8-bit-orbit\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara 8 Bit Orbit\",\n description:\n \"8-Bit Orbit — pixel-art neon arcade aesthetic on a deep navy void. For cyberpunk, gaming, web3, indie dev tools, hackathon demos that should feel like a CRT screen at 2am.\",\n source: { path: \"design-templates/html-ppt-zhangzara-8-bit-orbit\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-biennale-yellow\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Biennale Yellow\",\n description:\n \"Biennale Yellow — solar yellow on warm parchment with deep indigo serif and sun-glow gradients. For art-biennale posters, museum programmes, curatorial pitches, literary publications.\",\n source: { path: \"design-templates/html-ppt-zhangzara-biennale-yellow\" },\n targets: [\"presentation\", \"poster\"],\n },\n {\n id: \"template:html-ppt-zhangzara-block-frame\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Block Frame\",\n description:\n \"BlockFrame — neobrutalist deck with pastel-neon color blocks and chunky black borders. Pop-graphic and design-led for indie SaaS launches, agency credentials, brand redesigns.\",\n source: { path: \"design-templates/html-ppt-zhangzara-block-frame\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-blue-professional\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Blue Professional\",\n description:\n \"Blue Professional — cream paper background with electric cobalt blue accents; clean modern professional. For B2B SaaS pitches, consulting deliverables, advisory updates, investor reports.\",\n source: { path: \"design-templates/html-ppt-zhangzara-blue-professional\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-bold-poster\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Bold Poster\",\n description:\n \"Bold Poster — editorial poster aesthetic with massive Shrikhand display and a single fire-engine red accent. For magazine-cover brand manifestos and editorial / cultural pitches.\",\n source: { path: \"design-templates/html-ppt-zhangzara-bold-poster\" },\n targets: [\"presentation\", \"poster\"],\n },\n {\n id: \"template:html-ppt-zhangzara-broadside\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Broadside\",\n description:\n \"Broadside — dark editorial canvas with a single fire orange accent and bilingual Latin/Chinese type stack. For manifestos, magazine pitches, design talks, bilingual EN/CN decks.\",\n source: { path: \"design-templates/html-ppt-zhangzara-broadside\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-capsule\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Capsule\",\n description:\n \"Capsule — modular pill-shaped cards on warm bone with a full pastel-pop palette. For lifestyle brands, creator portfolios, DTC launches, beauty / wellness, agency credentials.\",\n source: { path: \"design-templates/html-ppt-zhangzara-capsule\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-cartesian\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Cartesian\",\n description:\n \"Cartesian — quiet warm-neutral palette with classical Playfair serifs; tasteful and unhurried. For investment theses, white papers, advisory work, longform research, gallery decks.\",\n source: { path: \"design-templates/html-ppt-zhangzara-cartesian\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-cobalt-grid\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Cobalt Grid\",\n description:\n \"Cobalt Grid — electric cobalt italic serifs on a graph-paper canvas with stair-stepped pixel-glitch decorations. For design / research bulletins, art publications, curated trend reports.\",\n source: { path: \"design-templates/html-ppt-zhangzara-cobalt-grid\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-coral\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Coral\",\n description:\n \"Coral — cream and coral on near-black, set in oversized Bebas Neue. Warm-graphic editorial for fashion, beauty, fitness, F&B, lifestyle brands, agency credentials.\",\n source: { path: \"design-templates/html-ppt-zhangzara-coral\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-creative-mode\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Creative Mode\",\n description:\n \"Creative Mode — cream paper canvas with confident multi-color accents and Archivo Black display. For creative agency pitches, design studio decks, ad credentials, brand creative reviews.\",\n source: { path: \"design-templates/html-ppt-zhangzara-creative-mode\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-daisy-days\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Daisy Days\",\n description:\n \"Daisy Days — cheerful pastel deck with hand-drawn daisies, stars, and rainbows. Friendly, soft, and warm for educational content, kids and family, wellness, community workshops.\",\n source: { path: \"design-templates/html-ppt-zhangzara-daisy-days\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-editorial-tri-tone\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Editorial Tri Tone\",\n description:\n \"Editorial Tri-Tone — three-color editorial: dusty pink, mustard cream, deep burgundy; Bricolage + Instrument Serif. For fashion-magazine spreads, brand decks, lifestyle media.\",\n source: { path: \"design-templates/html-ppt-zhangzara-editorial-tri-tone\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-grove\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Grove\",\n description:\n \"Grove — forest-green canvas with cream type, classical Playfair serifs, single rust accent. For sustainability and wellness brands, outdoor products, wineries, advisory deliverables.\",\n source: { path: \"design-templates/html-ppt-zhangzara-grove\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-long-table\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Long Table\",\n description:\n \"Long Table — warm cream and rust-red supper-club aesthetic with bold uppercase grotesk headlines and italic Fraunces. For supper clubs, dinner series, lifestyle and wine brands.\",\n source: { path: \"design-templates/html-ppt-zhangzara-long-table\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-mat\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Mat\",\n description:\n \"Mat — dark sage canvas with bone paper and burnt-orange accent; mid-century modern with wood undertones. For architecture/interior brands, ceramics, craft, furniture, advisory decks.\",\n source: { path: \"design-templates/html-ppt-zhangzara-mat\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-monochrome\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Monochrome\",\n description:\n \"Monochrome — ivory ledger paper with all-black type; Lora serif headlines, Jost body, no color. For research synthesis, white papers, longform reports, bilingual EN/CN deliverables.\",\n source: { path: \"design-templates/html-ppt-zhangzara-monochrome\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-neo-grid-bold\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Neo Grid Bold\",\n description:\n \"Neo-Grid Bold — editorial neo-brutalism with a single neon yellow accent on off-white paper. For design-led pitches, brand work, founder talks, conference keynotes.\",\n source: { path: \"design-templates/html-ppt-zhangzara-neo-grid-bold\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-peoples-platform\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Peoples Platform\",\n description:\n \"People's Platform (Block & Bold) — activist poster energy: blue, orange, red on cream, with Alfa Slab + Caveat Brush. For cultural commentary, manifestos, civic decks, campaign pitches.\",\n source: { path: \"design-templates/html-ppt-zhangzara-peoples-platform\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-pin-and-paper\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Pin And Paper\",\n description:\n \"Pin & Paper — yellow paper with safety-pin illustrations, ink-blue handwritten Caveat, paper-grain texture. For qualitative research, founder reflections, longform brand stories.\",\n source: { path: \"design-templates/html-ppt-zhangzara-pin-and-paper\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-pink-script\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Pink Script\",\n description:\n \"Pink Script (After Hours) — black canvas, hot pink accent, pearl-cream paper, Instrument Serif. Late-night editorial luxury for fashion, creator brands, nightlife, and luxury reveals.\",\n source: { path: \"design-templates/html-ppt-zhangzara-pink-script\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-playful\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Playful\",\n description:\n \"Playful — sun-warm peach background with Syne display: a friendly indie launch deck. For creator portfolios, indie product launches, lifestyle brands, small-business pitches.\",\n source: { path: \"design-templates/html-ppt-zhangzara-playful\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-raw-grid\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Raw Grid\",\n description:\n \"Raw Grid — neo-brutalist deck with thick borders, offset shadows, and a pink/sage/ink palette. For founder pitches, accelerator demos, brand decks, indie launches, creator portfolios.\",\n source: { path: \"design-templates/html-ppt-zhangzara-raw-grid\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-retro-windows\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Retro Windows\",\n description:\n \"Retro Windows — Windows 95 chrome: gray title bars, MS Sans Serif, pixel typography, full nostalgia. For retro gaming, Y2K-aesthetic brands, creator portfolios, tech-history talks.\",\n source: { path: \"design-templates/html-ppt-zhangzara-retro-windows\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-sakura-chroma\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Sakura Chroma\",\n description:\n \"Sakura Chroma — vintage Japanese cassette-package aesthetic: cream paper, diagonal rainbow ribbons, condensed bold type, JIS-style spec checkboxes. For analog / kawaii-tech decks.\",\n source: { path: \"design-templates/html-ppt-zhangzara-sakura-chroma\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-scatterbrain\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Scatterbrain\",\n description:\n \"Scatterbrain — Post-it inspired: pastel sticky notes, Caveat handwriting, Shrikhand + Zilla Slab. For brainstorms, workshops, creative-agency credentials, ideation pitches.\",\n source: { path: \"design-templates/html-ppt-zhangzara-scatterbrain\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-signal\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Signal\",\n description:\n \"Signal — deep navy canvas with bone paper and a single muted-gold accent; institutional with quiet weight. For investor decks, board presentations, consulting deliverables, legal briefs.\",\n source: { path: \"design-templates/html-ppt-zhangzara-signal\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-soft-editorial\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Soft Editorial\",\n description:\n \"Soft Editorial — Cormorant Garamond serif on warm paper with sage, blush, and lemon accents. For literary brand stories, gallery decks, advisory deliverables, lifestyle media.\",\n source: { path: \"design-templates/html-ppt-zhangzara-soft-editorial\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-stencil-tablet\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Stencil Tablet\",\n description:\n \"Stencil & Tablet — bone paper with stencil-cut headlines and a six-color earth palette. Archaeology meets brand: museum decks, art/architecture brands, heritage and craft work.\",\n source: { path: \"design-templates/html-ppt-zhangzara-stencil-tablet\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-studio\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Studio\",\n description:\n \"Studio — black canvas with electric-yellow type; high-voltage design studio aesthetic. For studio credentials, creative agency pitches, brand showcases, fashion / sneaker work.\",\n source: { path: \"design-templates/html-ppt-zhangzara-studio\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:html-ppt-zhangzara-vellum\",\n kind: \"template\",\n name: \"HTML PPT Zhangzara Vellum\",\n description:\n \"Vellum — deep navy canvas with warm-yellow italic Cormorant serifs and a single dusty teal accent. Quiet, scholarly aesthetic for research synthesis, white papers, advisory work.\",\n source: { path: \"design-templates/html-ppt-zhangzara-vellum\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:hyperframes\",\n kind: \"template\",\n name: \"Hyperframes\",\n description:\n \"HTML video composition skill — captions, voiceover, audio-reactive animation, scene transitions, and timing in HyperFrames HTML. For CLI commands see hyperframes-cli.\",\n source: { path: \"design-templates/hyperframes\" },\n targets: [\"intro-video\"],\n },\n {\n id: \"template:ib-pitch-book\",\n kind: \"template\",\n name: \"Ib Pitch Book\",\n description:\n \"Investment-banking pitch book — trading comps, precedent transactions, valuation football field, DCF sensitivity, strategic-options matrix. For Board / sell-side discussion materials.\",\n source: { path: \"design-templates/ib-pitch-book\" },\n targets: [\"report\", \"presentation\"],\n },\n {\n id: \"template:image-poster\",\n kind: \"template\",\n name: \"Image Poster\",\n description:\n \"Single-image generation skill for posters, key art, and editorial illustrations. Defaults to gpt-image-2 but is provider-agnostic — the same workflow drives Flux, Imagen, or Midjourney via the active upstream tooling. Output is one or mo…\",\n source: { path: \"design-templates/image-poster\" },\n targets: [\"poster\"],\n },\n {\n id: \"template:invoice\",\n kind: \"template\",\n name: \"Invoice\",\n description:\n \"A printable invoice page — sender + recipient block, line items table, tax breakdown, totals, and payment instructions.\",\n source: { path: \"design-templates/invoice\" },\n targets: [\"report\"],\n },\n {\n id: \"template:kami-deck\",\n kind: \"template\",\n name: \"Kami Deck\",\n description:\n \"Produce a print-grade slide deck in the kami (紙 / 纸) design system — warm parchment background (or ink-blue for cover / chapter slides), serif at one weight, ink-blue accent ≤ 5% per slide, no italic. Horizontal magazine swipe pagination…\",\n source: { path: \"design-templates/kami-deck\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:kami-landing\",\n kind: \"template\",\n name: \"Kami Landing\",\n description:\n \"Produce a print-grade single-page kami (紙 / 纸) document — warm parchment canvas, ink-blue accent, serif at one weight, no italic, no cool grays. The output reads like a professional white paper or studio one-pager, not an app UI. Multili…\",\n source: { path: \"design-templates/kami-landing\" },\n targets: [\"website\"],\n },\n {\n id: \"template:kanban-board\",\n kind: \"template\",\n name: \"Kanban Board\",\n description:\n \"Kanban / task board with columns (To do / In progress / In review / Done), draggable-looking cards, assignee avatars, swimlanes, and a top filter bar.\",\n source: { path: \"design-templates/kanban-board\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:last30days\",\n kind: \"template\",\n name: \"Last30days\",\n description:\n \"Recent community and social trend research over the last 30 days.\",\n source: { path: \"design-templates/last30days\" },\n targets: [\"dashboard-design\", \"report\"],\n },\n {\n id: \"template:live-artifact\",\n kind: \"template\",\n name: \"Live Artifact\",\n description:\n \"Create refreshable, auditable artifacts backed by connector or local data. Trigger when the user asks for live dashboards, refreshable reports, synced views, or reusable data-backed artifacts.\",\n source: { path: \"design-templates/live-artifact\" },\n targets: [\"dashboard-design\", \"report\", \"website\"],\n },\n {\n id: \"template:live-dashboard\",\n kind: \"template\",\n name: \"Live Dashboard\",\n description:\n \"Notion-style team dashboard as a Live Artifact — KPIs, 7-day sparkline, activity feed, and a linked-database task table wired to Notion via Composio. Refreshable, with mock fallback.\",\n source: { path: \"design-templates/live-dashboard\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:magazine-poster\",\n kind: \"template\",\n name: \"Magazine Poster\",\n description:\n \"An editorial-style poster — newsprint paper, dateline, oversized serif headline with a struck-through word and italic accent, a 2-column body block, and 6 numbered sections with annotated pull-quote captions. Reads like a Sunday-paper fu…\",\n source: { path: \"design-templates/magazine-poster\" },\n targets: [\"poster\"],\n },\n {\n id: \"template:meeting-notes\",\n kind: \"template\",\n name: \"Meeting Notes\",\n description:\n 'Meeting notes page — title bar with attendees, agenda checklist, decisions block, action items table with owners + dates, and a \"next meeting\" footer.',\n source: { path: \"design-templates/meeting-notes\" },\n targets: [\"docs-design\"],\n },\n {\n id: \"template:mobile-onboarding\",\n kind: \"template\",\n name: \"Mobile Onboarding\",\n description:\n \"A multi-screen mobile onboarding flow rendered as three phone frames side by side — splash, value-prop, sign-in. Status bar, swipe dots, primary CTA.\",\n source: { path: \"design-templates/mobile-onboarding\" },\n targets: [\"mobile-app-design\"],\n },\n {\n id: \"template:motion-frames\",\n kind: \"template\",\n name: \"Motion Frames\",\n description:\n \"A single-frame motion-design composition with looping CSS animations — rotating type ring, animated globe, ticking timer, parallax labels. Renders as a hero video poster you can hand straight to HyperFrames or any keyframe-based exporter.\",\n source: { path: \"design-templates/motion-frames\" },\n targets: [\"intro-video\"],\n },\n {\n id: \"template:open-design-landing\",\n kind: \"template\",\n name: \"Editorial Landing\",\n description:\n \"Single-page editorial landing site in the Atelier Zero visual language (Monocle / Apartamento / Études collage). Composes from a typed inputs.json with optional gpt-image-2 assets.\",\n source: { path: \"design-templates/open-design-landing\" },\n targets: [\"website\"],\n },\n {\n id: \"template:open-design-landing-deck\",\n kind: \"template\",\n name: \"Editorial Landing Deck\",\n description:\n \"Single-file slide deck in the Atelier Zero visual language — warm-paper, italic-serif emphasis, coral terminating dots, surreal collage. Horizontal swipe + ESC overview grid.\",\n source: { path: \"design-templates/open-design-landing-deck\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:orbit-general\",\n kind: \"template\",\n name: \"Orbit General\",\n description:\n \"Open Orbit daily digest — pulls 24h activity from every connected connector (GitHub, Linear, Notion, Slack, …) into a bento-grid dashboard. Invoked by the Orbit scheduler.\",\n source: { path: \"design-templates/orbit-general\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:orbit-github\",\n kind: \"template\",\n name: \"Orbit Github\",\n description:\n \"Open Orbit GitHub digest — 24h of PRs, reviews, issues, CI, and merges rendered in GitHub's native Notifications + PR-diff visual language. Invoked by the Orbit scheduler.\",\n source: { path: \"design-templates/orbit-github\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:orbit-gmail\",\n kind: \"template\",\n name: \"Orbit Gmail\",\n description:\n \"Open Orbit Gmail digest — 24h of inbox activity (replies, mentions, cc, bulk) rendered as the Orbit Daily Digest email inside Gmail's reading view. Invoked by the Orbit scheduler.\",\n source: { path: \"design-templates/orbit-gmail\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:orbit-linear\",\n kind: \"template\",\n name: \"Orbit Linear\",\n description:\n \"Open Orbit Linear digest — 24h of issue movement, status changes, assignments, and cycle progress in Linear's native Inbox + cycle visual language. Invoked by the Orbit scheduler.\",\n source: { path: \"design-templates/orbit-linear\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:orbit-notion\",\n kind: \"template\",\n name: \"Orbit Notion\",\n description:\n \"Open Orbit Notion digest — 24h of doc edits, comments, mentions, and database row changes rendered as a native Notion page. Invoked by the Orbit scheduler.\",\n source: { path: \"design-templates/orbit-notion\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:pm-spec\",\n kind: \"template\",\n name: \"Pm Spec\",\n description:\n \"Product spec / PRD as a single page — problem, success metrics, scope, user stories, design notes, rollout plan, open questions.\",\n source: { path: \"design-templates/pm-spec\" },\n targets: [\"docs-design\"],\n },\n {\n id: \"template:pricing-page\",\n kind: \"template\",\n name: \"Pricing Page\",\n description:\n \"A standalone pricing page — header, plan tiers, feature comparison table, and an FAQ.\",\n source: { path: \"design-templates/pricing-page\" },\n targets: [\"website\"],\n },\n {\n id: \"template:replit-deck\",\n kind: \"template\",\n name: \"Replit Deck\",\n description:\n \"Single-file horizontal-swipe HTML deck in the style of Replit Slides's landing-page template gallery. Eight distinct themes (helix, holm, vance, bevel, world-dark, world-mint, atlas, bluehouse) — each a complete visual system (palette +…\",\n source: { path: \"design-templates/replit-deck\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:saas-landing\",\n kind: \"template\",\n name: \"Saas Landing\",\n description:\n \"Single-page SaaS landing with hero, features, social proof, pricing, and CTA. Respects the active DESIGN.md color/typography/layout tokens.\",\n source: { path: \"design-templates/saas-landing\" },\n targets: [\"website\"],\n },\n {\n id: \"template:simple-deck\",\n kind: \"template\",\n name: \"Simple Deck\",\n description:\n \"Single-file horizontal-swipe HTML deck. Built by copying the seed `assets/template.html` (which carries the proven 5-rule iframe nav script) and pasting slide layouts from `references/layouts.md`. Pitch decks, product overviews, study ma…\",\n source: { path: \"design-templates/simple-deck\" },\n targets: [\"presentation\"],\n },\n {\n id: \"template:social-carousel\",\n kind: \"template\",\n name: \"Social Carousel\",\n description:\n 'A three-card social-media carousel laid out as 1080×1080 squares — three cinematic, on-brand panels with display headlines that connect across the series (\"onwards.\" → \"to the next one.\" → \"looking ahead.\"). Each card has a brand mark, a…',\n source: { path: \"design-templates/social-carousel\" },\n targets: [\"poster\"],\n },\n {\n id: \"template:social-media-dashboard\",\n kind: \"template\",\n name: \"Social Media Dashboard\",\n description:\n 'Creator-facing social media analytics dashboard in a single HTML file. A platform switcher (X / LinkedIn / YouTube / Instagram), a row of KPI cards (followers, engagement rate, likes, reposts), a follower-growth chart, a \"top post this w…',\n source: { path: \"design-templates/social-media-dashboard\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:social-media-matrix-tracker-template\",\n kind: \"template\",\n name: \"Social Media Matrix Tracker Template\",\n description: \"社媒矩阵数据追踪面板模板(Social Media Matrix Tracker)。\",\n source: { path: \"design-templates/social-media-matrix-tracker-template\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:sprite-animation\",\n kind: \"template\",\n name: \"Sprite Animation\",\n description:\n \"A pixel / sprite-style animated explainer slide — full-bleed cream stage, bold display year, animated pixel-art mascot (e.g. Hanafuda card, mushroom, or 8-bit console), kinetic Japanese display type, ticking timeline ribbon. Reads like a…\",\n source: { path: \"design-templates/sprite-animation\" },\n targets: [\"intro-video\"],\n },\n {\n id: \"template:team-okrs\",\n kind: \"template\",\n name: \"Team Okrs\",\n description:\n 'OKR tracker page — quarter banner, three objectives with their key results as progress bars, owner avatars, status pills, and a \"this quarter at a glance\" sidebar.',\n source: { path: \"design-templates/team-okrs\" },\n targets: [\"docs-design\", \"dashboard-design\"],\n },\n {\n id: \"template:trading-analysis-dashboard-template\",\n kind: \"template\",\n name: \"Trading Analysis Dashboard Template\",\n description:\n \"Professional trading analysis dashboard template (single-file HTML) with light/dark theme switch, dense market panels, chart interactions, demo/live playback, and command palette behavior.\",\n source: { path: \"design-templates/trading-analysis-dashboard-template\" },\n targets: [\"dashboard-design\"],\n },\n {\n id: \"template:tweaks\",\n kind: \"template\",\n name: \"Tweaks\",\n description:\n \"Wrap any HTML artifact with a side panel of live, parameterized controls — accent color, type scale, density, motion, theme — that rewrite CSS custom properties in real time and persist to localStorage. Lets the user explore variants of…\",\n source: { path: \"design-templates/tweaks\" },\n targets: [\n \"website\",\n \"dashboard-design\",\n \"presentation\",\n \"report\",\n \"docs-design\",\n \"poster\",\n \"mobile-app-design\",\n ],\n },\n {\n id: \"template:video-shortform\",\n kind: \"template\",\n name: \"Video Shortform\",\n description:\n \"Short-form video generation skill — 3-10 second clips for product reveals, motion teasers, ambient loops. Defaults to Seedance 2 but works the same with Kling 3 / 4, Veo 3 or Sora 2. Output is one MP4 saved to the project folder. When th…\",\n source: { path: \"design-templates/video-shortform\" },\n targets: [\"intro-video\"],\n },\n {\n id: \"template:waitlist-page\",\n kind: \"template\",\n name: \"Waitlist Page\",\n description:\n \"Minimal pre-launch landing with email capture, brand logo, and optional decorative layer. Reads DESIGN.md for colors, typography, and layout rules.\",\n source: { path: \"design-templates/waitlist-page\" },\n targets: [\"website\"],\n },\n {\n id: \"template:web-prototype\",\n kind: \"template\",\n name: \"Web Prototype\",\n description:\n \"General-purpose desktop web prototype. Single self-contained HTML file built by copying the seed `assets/template.html` and pasting section layouts from `references/layouts.md`. Default for any landing / marketing / docs / SaaS page when…\",\n source: { path: \"design-templates/web-prototype\" },\n targets: [\"website\"],\n },\n {\n id: \"template:web-prototype-taste-brutalist\",\n kind: \"template\",\n name: \"Web Prototype Taste Brutalist\",\n description:\n \"Swiss industrial-print web prototype. Newsprint canvas, monolithic black grotesque, viewport-bleeding numerals, hairline grid dividers, hazard-red accent, ASCII syntax decoration. Distilled from Leonxlnx/taste-skill `brutalist-skill` (Sw…\",\n source: { path: \"design-templates/web-prototype-taste-brutalist\" },\n targets: [\"website\"],\n },\n {\n id: \"template:web-prototype-taste-soft\",\n kind: \"template\",\n name: \"Web Prototype Taste Soft\",\n description:\n \"Apple-tier soft web prototype. Silver/cream canvas, double-bezel cards, button-in-button CTAs, generous squircle radii, spring motion, ambient mesh. Distilled from Leonxlnx/taste-skill `soft-skill` + sections 4–8 of `taste-skill`.\",\n source: { path: \"design-templates/web-prototype-taste-soft\" },\n targets: [\"website\"],\n },\n {\n id: \"template:wireframe-sketch\",\n kind: \"template\",\n name: \"Wireframe Sketch\",\n description:\n \"A hand-drawn wireframe exploration — graph-paper background, marker / pencil tone, multiple tab labels for variants, sticky-note annotations, scribbled chart placeholders, hatched fills. Reads like a designer's whiteboard before any pixe…\",\n source: { path: \"design-templates/wireframe-sketch\" },\n targets: [\"website\", \"mobile-app-design\", \"dashboard-design\"],\n },\n {\n id: \"template:x-research\",\n kind: \"template\",\n name: \"X Research\",\n description:\n \"X/Twitter public sentiment research for recent market, company, product, or community discourse.\",\n source: { path: \"design-templates/x-research\" },\n targets: [\"report\"],\n },\n {\n id: \"design-system:dashboard\",\n kind: \"design-system\",\n name: \"Dashboard\",\n description:\n \"Dark cloud-platform aesthetic with modular grids, glass-like panels, and strong data hierarchy for productivity dashboards.\",\n source: { path: \"design-systems/dashboard\" },\n },\n {\n id: \"design-system:trading-terminal\",\n kind: \"design-system\",\n name: \"Trading Terminal\",\n description:\n \"Bloomberg-style financial trading terminal: dark-only, data-dense, with cyan and coral buy/sell signals readable at a glance.\",\n source: { path: \"design-systems/trading-terminal\" },\n },\n {\n id: \"design-system:warm-editorial\",\n kind: \"design-system\",\n name: \"Warm Editorial\",\n description:\n \"Serif-led magazine aesthetic with terracotta accents on warm off-white paper for readable narrative pages, zines, and reports.\",\n source: { path: \"design-systems/warm-editorial\" },\n },\n {\n id: \"design-system:editorial\",\n kind: \"design-system\",\n name: \"Editorial\",\n description:\n \"Magazine-inspired editorial layout with refined serif typography, structured grids, and elegant reading experiences.\",\n source: { path: \"design-systems/editorial\" },\n },\n {\n id: \"design-system:mono\",\n kind: \"design-system\",\n name: \"Mono\",\n description:\n \"Monospace-driven, matrix-inspired design with high-contrast elements, compact density, and a hacker-chic aesthetic.\",\n source: { path: \"design-systems/mono\" },\n },\n {\n id: \"design-system:apple\",\n kind: \"design-system\",\n name: \"Apple\",\n description:\n \"Consumer electronics design system with premium white space, SF Pro-style typography, and cinematic imagery.\",\n source: { path: \"design-systems/apple\" },\n },\n {\n id: \"design-system:agentic\",\n kind: \"design-system\",\n name: \"Agentic\",\n description:\n \"Conversational AI-first interface with minimal controls, clear outcomes, and delegated task flows for agentic workflows.\",\n source: { path: \"design-systems/agentic\" },\n },\n {\n id: \"design-system:airbnb\",\n kind: \"design-system\",\n name: \"Airbnb\",\n description:\n \"Travel marketplace. Warm coral accent, photography-driven, rounded UI.\",\n source: { path: \"design-systems/airbnb\" },\n },\n {\n id: \"design-system:airtable\",\n kind: \"design-system\",\n name: \"Airtable\",\n description:\n \"Spreadsheet-database hybrid. Colorful, friendly, structured data aesthetic.\",\n source: { path: \"design-systems/airtable\" },\n },\n {\n id: \"design-system:ant\",\n kind: \"design-system\",\n name: \"Ant\",\n description:\n \"Structured, enterprise-focused design system emphasizing clarity, consistency, and efficiency for data-dense web applications.\",\n source: { path: \"design-systems/ant\" },\n },\n {\n id: \"design-system:application\",\n kind: \"design-system\",\n name: \"Application\",\n description:\n \"App dashboard with purple-themed aesthetic, top-bar navigation, card-based layouts, and developer-first workflows.\",\n source: { path: \"design-systems/application\" },\n },\n {\n id: \"design-system:arc\",\n kind: \"design-system\",\n name: \"Arc\",\n description:\n '\"The browser that browses for you.\" Translucent surfaces, gradient warmth, sidebar-first layout.',\n source: { path: \"design-systems/arc\" },\n },\n {\n id: \"design-system:artistic\",\n kind: \"design-system\",\n name: \"Artistic\",\n description:\n \"High-contrast, expressive style with creative typography and bold color choices for visually striking interfaces.\",\n source: { path: \"design-systems/artistic\" },\n },\n {\n id: \"design-system:atelier-zero\",\n kind: \"design-system\",\n name: \"Atelier Zero\",\n description:\n \"A magazine-grade, collage-driven visual system: warm paper canvas, surreal.\",\n source: { path: \"design-systems/atelier-zero\" },\n },\n {\n id: \"design-system:bento\",\n kind: \"design-system\",\n name: \"Bento\",\n description:\n \"Modular grid layout with card-like blocks, clear hierarchy, soft spacing, and subtle visual contrast for organized, scannable interfaces.\",\n source: { path: \"design-systems/bento\" },\n },\n {\n id: \"design-system:binance\",\n kind: \"design-system\",\n name: \"Binance\",\n description:\n \"Crypto exchange. Bold yellow accent on monochrome, trading-floor urgency.\",\n source: { path: \"design-systems/binance\" },\n },\n {\n id: \"design-system:bmw\",\n kind: \"design-system\",\n name: \"Bmw\",\n description:\n \"Luxury automotive. Dark premium surfaces, precise German engineering aesthetic.\",\n source: { path: \"design-systems/bmw\" },\n },\n {\n id: \"design-system:bmw-m\",\n kind: \"design-system\",\n name: \"Bmw M\",\n description:\n \"Motorsport performance sub-brand. Near-black cockpit surfaces, BMW M tricolor accents, sharp engineering geometry.\",\n source: { path: \"design-systems/bmw-m\" },\n },\n {\n id: \"design-system:bold\",\n kind: \"design-system\",\n name: \"Bold\",\n description:\n \"Strong visual presence with heavyweight typography, high-contrast colors, and commanding layouts.\",\n source: { path: \"design-systems/bold\" },\n },\n {\n id: \"design-system:brutalism\",\n kind: \"design-system\",\n name: \"Brutalism\",\n description:\n \"Raw, anti-design aesthetic inspired by concrete architecture with unadorned elements, jarring layouts, and functional minimalism.\",\n source: { path: \"design-systems/brutalism\" },\n },\n {\n id: \"design-system:bugatti\",\n kind: \"design-system\",\n name: \"Bugatti\",\n description:\n \"Hypercar brand. Cinema-black canvas, monochrome austerity, monumental display type.\",\n source: { path: \"design-systems/bugatti\" },\n },\n {\n id: \"design-system:cafe\",\n kind: \"design-system\",\n name: \"Cafe\",\n description:\n \"Cozy cafe-inspired interface with warm tones, soft typography, and clean layouts for a relaxed browsing experience.\",\n source: { path: \"design-systems/cafe\" },\n },\n {\n id: \"design-system:cal\",\n kind: \"design-system\",\n name: \"Cal\",\n description:\n \"Open-source scheduling. Clean neutral UI, developer-oriented simplicity.\",\n source: { path: \"design-systems/cal\" },\n },\n {\n id: \"design-system:canva\",\n kind: \"design-system\",\n name: \"Canva\",\n description:\n \"Visual creation platform. Vivid purple-blue gradient, generous spacing, friendly geometry.\",\n source: { path: \"design-systems/canva\" },\n },\n {\n id: \"design-system:cisco\",\n kind: \"design-system\",\n name: \"Cisco\",\n description:\n \"Enterprise infrastructure brand. Dark trust surfaces, Cisco Blue signal, technical clarity.\",\n source: { path: \"design-systems/cisco\" },\n },\n {\n id: \"design-system:claude\",\n kind: \"design-system\",\n name: \"Claude\",\n description:\n \"Anthropic's AI assistant. Warm terracotta accent, clean editorial layout.\",\n source: { path: \"design-systems/claude\" },\n },\n {\n id: \"design-system:clay\",\n kind: \"design-system\",\n name: \"Clay\",\n description:\n \"Creative agency. Organic shapes, soft gradients, art-directed layout.\",\n source: { path: \"design-systems/clay\" },\n },\n {\n id: \"design-system:claymorphism\",\n kind: \"design-system\",\n name: \"Claymorphism\",\n description:\n \"Soft, rounded 3D-like shapes mimicking malleable clay with playful, puffy elements and colorful surfaces.\",\n source: { path: \"design-systems/claymorphism\" },\n },\n {\n id: \"design-system:clean\",\n kind: \"design-system\",\n name: \"Clean\",\n description:\n \"Simplicity-focused design with ample whitespace, legible typography, and a limited color palette to reduce visual clutter.\",\n source: { path: \"design-systems/clean\" },\n },\n {\n id: \"design-system:clickhouse\",\n kind: \"design-system\",\n name: \"Clickhouse\",\n description:\n \"Fast analytics database. Yellow-accented, technical documentation style.\",\n source: { path: \"design-systems/clickhouse\" },\n },\n {\n id: \"design-system:cohere\",\n kind: \"design-system\",\n name: \"Cohere\",\n description:\n \"Enterprise AI platform. Vibrant gradients, data-rich dashboard aesthetic.\",\n source: { path: \"design-systems/cohere\" },\n },\n {\n id: \"design-system:coinbase\",\n kind: \"design-system\",\n name: \"Coinbase\",\n description:\n \"Crypto exchange. Clean blue identity, trust-focused, institutional feel.\",\n source: { path: \"design-systems/coinbase\" },\n },\n {\n id: \"design-system:colorful\",\n kind: \"design-system\",\n name: \"Colorful\",\n description:\n \"Vibrant, high-contrast palettes and gradients for engaging, memorable, and modern user experiences.\",\n source: { path: \"design-systems/colorful\" },\n },\n {\n id: \"design-system:composio\",\n kind: \"design-system\",\n name: \"Composio\",\n description:\n \"Tool integration platform. Modern dark with colorful integration icons.\",\n source: { path: \"design-systems/composio\" },\n },\n {\n id: \"design-system:contemporary\",\n kind: \"design-system\",\n name: \"Contemporary\",\n description:\n \"Current-era minimalist design with bento grids, dark mode support, and high-performance accessible layouts.\",\n source: { path: \"design-systems/contemporary\" },\n },\n {\n id: \"design-system:corporate\",\n kind: \"design-system\",\n name: \"Corporate\",\n description:\n \"Professional, brand-aligned design with structured grids, minimalist layouts, and consistent enterprise patterns.\",\n source: { path: \"design-systems/corporate\" },\n },\n {\n id: \"design-system:cosmic\",\n kind: \"design-system\",\n name: \"Cosmic\",\n description:\n \"Futuristic sci-fi aesthetic with dark themes, vibrant neon accents, and immersive spatial elements.\",\n source: { path: \"design-systems/cosmic\" },\n },\n {\n id: \"design-system:creative\",\n kind: \"design-system\",\n name: \"Creative\",\n description:\n \"Playful, character-driven design with expressive typography and bold graphics for landing pages and creative projects.\",\n source: { path: \"design-systems/creative\" },\n },\n {\n id: \"design-system:cursor\",\n kind: \"design-system\",\n name: \"Cursor\",\n description:\n \"AI-first code editor. Sleek dark interface, gradient accents.\",\n source: { path: \"design-systems/cursor\" },\n },\n {\n id: \"design-system:default\",\n kind: \"design-system\",\n name: \"Default\",\n description: \"A clean, product-oriented default.\",\n source: { path: \"design-systems/default\" },\n },\n {\n id: \"design-system:discord\",\n kind: \"design-system\",\n name: \"Discord\",\n description:\n \"Voice / chat platform. Deep blurple, dark-first surfaces, playful accent moments.\",\n source: { path: \"design-systems/discord\" },\n },\n {\n id: \"design-system:dithered\",\n kind: \"design-system\",\n name: \"Dithered\",\n description:\n \"Dot-pattern rendering technique that simulates shades with a limited palette for nostalgic, retro, high-contrast visuals.\",\n source: { path: \"design-systems/dithered\" },\n },\n {\n id: \"design-system:doodle\",\n kind: \"design-system\",\n name: \"Doodle\",\n description:\n \"Hand-drawn, sketch-like style with doodles, handwritten fonts, and imperfect lines for a playful, informal feel.\",\n source: { path: \"design-systems/doodle\" },\n },\n {\n id: \"design-system:dramatic\",\n kind: \"design-system\",\n name: \"Dramatic\",\n description:\n \"High-contrast, theatrical design with bold layouts, immersive visuals, and unconventional compositions that command attention.\",\n source: { path: \"design-systems/dramatic\" },\n },\n {\n id: \"design-system:duolingo\",\n kind: \"design-system\",\n name: \"Duolingo\",\n description:\n \"Language-learning platform. Bright owl green, chunky shadows, gamified joy.\",\n source: { path: \"design-systems/duolingo\" },\n },\n {\n id: \"design-system:elegant\",\n kind: \"design-system\",\n name: \"Elegant\",\n description:\n \"Graceful, refined aesthetic with delicate typography, minimal palettes, and polished layouts that exude sophistication.\",\n source: { path: \"design-systems/elegant\" },\n },\n {\n id: \"design-system:elevenlabs\",\n kind: \"design-system\",\n name: \"Elevenlabs\",\n description:\n \"AI voice platform. Dark cinematic UI, audio-waveform aesthetics.\",\n source: { path: \"design-systems/elevenlabs\" },\n },\n {\n id: \"design-system:energetic\",\n kind: \"design-system\",\n name: \"Energetic\",\n description:\n \"Dynamic, vibrant style with thick borders, geometric shapes, high-contrast colors, and expressive typography conveying motion and vitality.\",\n source: { path: \"design-systems/energetic\" },\n },\n {\n id: \"design-system:enterprise\",\n kind: \"design-system\",\n name: \"Enterprise\",\n description:\n \"Clean, high-contrast enterprise design for data-driven workflows with intuitive drag-and-drop patterns and structured layouts.\",\n source: { path: \"design-systems/enterprise\" },\n },\n {\n id: \"design-system:expo\",\n kind: \"design-system\",\n name: \"Expo\",\n description:\n \"React Native platform. Dark theme, tight letter-spacing, code-centric.\",\n source: { path: \"design-systems/expo\" },\n },\n {\n id: \"design-system:expressive\",\n kind: \"design-system\",\n name: \"Expressive\",\n description:\n \"Vibrant, personality-driven design with bold colors, playful graphics, and dynamic layouts that balance creativity with structure.\",\n source: { path: \"design-systems/expressive\" },\n },\n {\n id: \"design-system:fantasy\",\n kind: \"design-system\",\n name: \"Fantasy\",\n description:\n \"Game-inspired fantasy aesthetic with bold, premium visuals, rich color palettes, and immersive thematic elements.\",\n source: { path: \"design-systems/fantasy\" },\n },\n {\n id: \"design-system:ferrari\",\n kind: \"design-system\",\n name: \"Ferrari\",\n description:\n \"Luxury automotive. Chiaroscuro editorial, Ferrari Red accents, cinematic black.\",\n source: { path: \"design-systems/ferrari\" },\n },\n {\n id: \"design-system:figma\",\n kind: \"design-system\",\n name: \"Figma\",\n description:\n \"Collaborative design tool. Vibrant multi-color, playful yet professional.\",\n source: { path: \"design-systems/figma\" },\n },\n {\n id: \"design-system:flat\",\n kind: \"design-system\",\n name: \"Flat\",\n description:\n \"Two-dimensional minimalist style with vibrant colors, clean typography, and no 3D effects for fast, user-friendly interfaces.\",\n source: { path: \"design-systems/flat\" },\n },\n {\n id: \"design-system:framer\",\n kind: \"design-system\",\n name: \"Framer\",\n description:\n \"Website builder. Bold black and blue, motion-first, design-forward.\",\n source: { path: \"design-systems/framer\" },\n },\n {\n id: \"design-system:friendly\",\n kind: \"design-system\",\n name: \"Friendly\",\n description:\n \"Approachable, intuitive design with rounded elements, ample whitespace, and soft pastel color palettes.\",\n source: { path: \"design-systems/friendly\" },\n },\n {\n id: \"design-system:futuristic\",\n kind: \"design-system\",\n name: \"Futuristic\",\n description:\n \"Forward-looking design with tech-inspired typography, modern layouts, and a sleek, innovation-driven aesthetic.\",\n source: { path: \"design-systems/futuristic\" },\n },\n {\n id: \"design-system:github\",\n kind: \"design-system\",\n name: \"Github\",\n description:\n \"Code-forward platform. Functional density, blue-on-white precision, Primer foundations.\",\n source: { path: \"design-systems/github\" },\n },\n {\n id: \"design-system:glassmorphism\",\n kind: \"design-system\",\n name: \"Glassmorphism\",\n description:\n \"Frosted glass effect with translucent layers, subtle blur, and luminous borders for depth and modern elegance.\",\n source: { path: \"design-systems/glassmorphism\" },\n },\n {\n id: \"design-system:gradient\",\n kind: \"design-system\",\n name: \"Gradient\",\n description:\n \"Smooth color transitions and gradient-rich surfaces for modern, playful interfaces with visual depth.\",\n source: { path: \"design-systems/gradient\" },\n },\n {\n id: \"design-system:hashicorp\",\n kind: \"design-system\",\n name: \"Hashicorp\",\n description:\n \"Infrastructure automation. Enterprise-clean, black and white.\",\n source: { path: \"design-systems/hashicorp\" },\n },\n {\n id: \"design-system:hud\",\n kind: \"design-system\",\n name: \"Hud\",\n description:\n \"Fighter jet / helicopter head-up display. Phosphor green on near-black, all-caps data overlays, angular geometry. Zero ambiguity at speed and altitude.\",\n source: { path: \"design-systems/hud\" },\n },\n {\n id: \"design-system:huggingface\",\n kind: \"design-system\",\n name: \"Huggingface\",\n description:\n \"ML community hub. Sunny yellow accent, monospace identity, cheerful and dense.\",\n source: { path: \"design-systems/huggingface\" },\n },\n {\n id: \"design-system:ibm\",\n kind: \"design-system\",\n name: \"Ibm\",\n description:\n \"Enterprise technology. Carbon design system, structured blue palette.\",\n source: { path: \"design-systems/ibm\" },\n },\n {\n id: \"design-system:intercom\",\n kind: \"design-system\",\n name: \"Intercom\",\n description:\n \"Customer messaging. Friendly blue palette, conversational UI patterns.\",\n source: { path: \"design-systems/intercom\" },\n },\n {\n id: \"design-system:kami\",\n kind: \"design-system\",\n name: \"Kami\",\n description:\n \"Editorial paper system: warm parchment canvas, ink-blue accent, serif-led hierarchy. Built for resumes, one-pagers, white papers, portfolios, slide decks — anything that should feel like high-quality print rather than UI. Multilingual by…\",\n source: { path: \"design-systems/kami\" },\n },\n {\n id: \"design-system:kraken\",\n kind: \"design-system\",\n name: \"Kraken\",\n description:\n \"Crypto trading. Purple-accented dark UI, data-dense dashboards.\",\n source: { path: \"design-systems/kraken\" },\n },\n {\n id: \"design-system:lamborghini\",\n kind: \"design-system\",\n name: \"Lamborghini\",\n description:\n \"Supercar brand. True black surfaces, gold accents, dramatic uppercase typography.\",\n source: { path: \"design-systems/lamborghini\" },\n },\n {\n id: \"design-system:levels\",\n kind: \"design-system\",\n name: \"Levels\",\n description:\n \"Conversion-focused design that removes friction and guides users toward action through clarity, trust, and speed.\",\n source: { path: \"design-systems/levels\" },\n },\n {\n id: \"design-system:linear-app\",\n kind: \"design-system\",\n name: \"Linear App\",\n description: \"Project management. Ultra-minimal, precise, purple accent.\",\n source: { path: \"design-systems/linear-app\" },\n },\n {\n id: \"design-system:lingo\",\n kind: \"design-system\",\n name: \"Lingo\",\n description:\n \"Playful, minimal design with bright colors, rounded shapes, tactile 3D borders, and friendly illustrations for approachable interfaces.\",\n source: { path: \"design-systems/lingo\" },\n },\n {\n id: \"design-system:loom\",\n kind: \"design-system\",\n name: \"Loom\",\n description:\n \"Loom async video. Purple primary, friendly surfaces, video-first layout. Clean and professional without being corporate.\",\n source: { path: \"design-systems/loom\" },\n },\n {\n id: \"design-system:lovable\",\n kind: \"design-system\",\n name: \"Lovable\",\n description:\n \"AI full-stack builder. Playful gradients, friendly dev aesthetic.\",\n source: { path: \"design-systems/lovable\" },\n },\n {\n id: \"design-system:luxury\",\n kind: \"design-system\",\n name: \"Luxury\",\n description:\n \"High-end dark aesthetic with bold headings, monochromatic palette, and premium feel for luxury brand experiences.\",\n source: { path: \"design-systems/luxury\" },\n },\n {\n id: \"design-system:mastercard\",\n kind: \"design-system\",\n name: \"Mastercard\",\n description:\n \"Global payments network. Warm cream canvas, orbital pill shapes, editorial warmth.\",\n source: { path: \"design-systems/mastercard\" },\n },\n {\n id: \"design-system:material\",\n kind: \"design-system\",\n name: \"Material\",\n description:\n \"Google's Material Design with layered surfaces, dynamic theming, built-in motion, and responsive cross-platform patterns.\",\n source: { path: \"design-systems/material\" },\n },\n {\n id: \"design-system:meta\",\n kind: \"design-system\",\n name: \"Meta\",\n description:\n \"Tech retail store. Photography-first, binary light/dark surfaces, Meta Blue CTAs.\",\n source: { path: \"design-systems/meta\" },\n },\n {\n id: \"design-system:minimal\",\n kind: \"design-system\",\n name: \"Minimal\",\n description:\n \"Stripped-back design emphasizing whitespace, clean typography, and restrained color for maximum clarity and focus.\",\n source: { path: \"design-systems/minimal\" },\n },\n {\n id: \"design-system:minimax\",\n kind: \"design-system\",\n name: \"Minimax\",\n description: \"AI model provider. Bold dark interface with neon accents.\",\n source: { path: \"design-systems/minimax\" },\n },\n {\n id: \"design-system:mintlify\",\n kind: \"design-system\",\n name: \"Mintlify\",\n description:\n \"Documentation platform. Clean, green-accented, reading-optimized.\",\n source: { path: \"design-systems/mintlify\" },\n },\n {\n id: \"design-system:miro\",\n kind: \"design-system\",\n name: \"Miro\",\n description:\n \"Visual collaboration. Bright yellow accent, infinite canvas aesthetic.\",\n source: { path: \"design-systems/miro\" },\n },\n {\n id: \"design-system:mission-control\",\n kind: \"design-system\",\n name: \"Mission Control\",\n description:\n \"Space/aerospace mission monitoring. Dark command center, amber telemetry, monospace precision. Functional clarity above all else.\",\n source: { path: \"design-systems/mission-control\" },\n },\n {\n id: \"design-system:mistral-ai\",\n kind: \"design-system\",\n name: \"Mistral AI\",\n description:\n \"Open-weight LLM provider. French-engineered minimalism, purple-toned.\",\n source: { path: \"design-systems/mistral-ai\" },\n },\n {\n id: \"design-system:modern\",\n kind: \"design-system\",\n name: \"Modern\",\n description:\n \"Contemporary editorial style with serif typography, minimal palettes, and clean layouts for polished digital products.\",\n source: { path: \"design-systems/modern\" },\n },\n {\n id: \"design-system:mongodb\",\n kind: \"design-system\",\n name: \"Mongodb\",\n description:\n \"Document database. Green leaf branding, developer documentation focus.\",\n source: { path: \"design-systems/mongodb\" },\n },\n {\n id: \"design-system:neobrutalism\",\n kind: \"design-system\",\n name: \"Neobrutalism\",\n description:\n \"Modern take on brutalism with bold borders, vivid accent colors, and raw, high-contrast layouts on warm surfaces.\",\n source: { path: \"design-systems/neobrutalism\" },\n },\n {\n id: \"design-system:neon\",\n kind: \"design-system\",\n name: \"Neon\",\n description:\n \"Electric neon glow effects with high-contrast color pairings for bold, attention-grabbing interfaces.\",\n source: { path: \"design-systems/neon\" },\n },\n {\n id: \"design-system:neumorphism\",\n kind: \"design-system\",\n name: \"Neumorphism\",\n description:\n \"Soft, extruded UI elements with inner and outer shadows on monochromatic surfaces for a tactile, embedded look.\",\n source: { path: \"design-systems/neumorphism\" },\n },\n {\n id: \"design-system:nike\",\n kind: \"design-system\",\n name: \"Nike\",\n description:\n \"Athletic retail. Monochrome UI, massive uppercase type, full-bleed photography.\",\n source: { path: \"design-systems/nike\" },\n },\n {\n id: \"design-system:notion\",\n kind: \"design-system\",\n name: \"Notion\",\n description:\n \"All-in-one workspace. Warm minimalism, serif headings, soft surfaces.\",\n source: { path: \"design-systems/notion\" },\n },\n {\n id: \"design-system:nvidia\",\n kind: \"design-system\",\n name: \"Nvidia\",\n description:\n \"GPU computing. Green-black energy, technical power aesthetic.\",\n source: { path: \"design-systems/nvidia\" },\n },\n {\n id: \"design-system:ollama\",\n kind: \"design-system\",\n name: \"Ollama\",\n description: \"Run LLMs locally. Terminal-first, monochrome simplicity.\",\n source: { path: \"design-systems/ollama\" },\n },\n {\n id: \"design-system:openai\",\n kind: \"design-system\",\n name: \"Openai\",\n description:\n \"Calm, near-monochrome system anchored in deep teal-black with generous white space and editorial typography.\",\n source: { path: \"design-systems/openai\" },\n },\n {\n id: \"design-system:opencode-ai\",\n kind: \"design-system\",\n name: \"Opencode AI\",\n description: \"AI coding platform. Developer-centric dark theme.\",\n source: { path: \"design-systems/opencode-ai\" },\n },\n {\n id: \"design-system:pacman\",\n kind: \"design-system\",\n name: \"Pacman\",\n description:\n \"Retro arcade-inspired design with pixel fonts, dotted borders, playful high-contrast colors, and 8-bit game aesthetics.\",\n source: { path: \"design-systems/pacman\" },\n },\n {\n id: \"design-system:paper\",\n kind: \"design-system\",\n name: \"Paper\",\n description:\n \"Paper-textured, print-inspired design with minimal colors, clean serif/sans typography, and tactile surface qualities.\",\n source: { path: \"design-systems/paper\" },\n },\n {\n id: \"design-system:perplexity\",\n kind: \"design-system\",\n name: \"Perplexity\",\n description:\n \"Conversational AI search engine. Deep-dark canvas, sharp typography, single violet accent, dense information hierarchy.\",\n source: { path: \"design-systems/perplexity\" },\n },\n {\n id: \"design-system:perspective\",\n kind: \"design-system\",\n name: \"Perspective\",\n description:\n \"Spatial depth design with isometric views, vanishing points, and layered elements that guide attention through 3D-like realism.\",\n source: { path: \"design-systems/perspective\" },\n },\n {\n id: \"design-system:pinterest\",\n kind: \"design-system\",\n name: \"Pinterest\",\n description: \"Visual discovery. Red accent, masonry grid, image-first.\",\n source: { path: \"design-systems/pinterest\" },\n },\n {\n id: \"design-system:playstation\",\n kind: \"design-system\",\n name: \"Playstation\",\n description:\n \"Gaming console retail. Three-surface channel layout, quiet-authority display type, cyan hover-scale.\",\n source: { path: \"design-systems/playstation\" },\n },\n {\n id: \"design-system:posthog\",\n kind: \"design-system\",\n name: \"Posthog\",\n description:\n \"Product analytics. Playful hedgehog branding, developer-friendly dark UI.\",\n source: { path: \"design-systems/posthog\" },\n },\n {\n id: \"design-system:premium\",\n kind: \"design-system\",\n name: \"Premium\",\n description:\n \"Apple-inspired premium aesthetic with precise spacing, modern typography, and a refined, polished visual language.\",\n source: { path: \"design-systems/premium\" },\n },\n {\n id: \"design-system:professional\",\n kind: \"design-system\",\n name: \"Professional\",\n description:\n \"Polished, business-ready design with modern typography, structured layouts, and a trustworthy visual identity.\",\n source: { path: \"design-systems/professional\" },\n },\n {\n id: \"design-system:publication\",\n kind: \"design-system\",\n name: \"Publication\",\n description:\n \"Print-inspired visual language for books, magazines, and reports with editorial grids and expressive typography.\",\n source: { path: \"design-systems/publication\" },\n },\n {\n id: \"design-system:raycast\",\n kind: \"design-system\",\n name: \"Raycast\",\n description:\n \"Productivity launcher. Sleek dark chrome, vibrant gradient accents.\",\n source: { path: \"design-systems/raycast\" },\n },\n {\n id: \"design-system:refined\",\n kind: \"design-system\",\n name: \"Refined\",\n description:\n \"Carefully curated, modern minimal style with elegant serif typography and understated, sophisticated palettes.\",\n source: { path: \"design-systems/refined\" },\n },\n {\n id: \"design-system:renault\",\n kind: \"design-system\",\n name: \"Renault\",\n description:\n \"French automotive. Vibrant aurora gradients, NouvelR typography, bold energy.\",\n source: { path: \"design-systems/renault\" },\n },\n {\n id: \"design-system:replicate\",\n kind: \"design-system\",\n name: \"Replicate\",\n description: \"Run ML models via API. Clean white canvas, code-forward.\",\n source: { path: \"design-systems/replicate\" },\n },\n {\n id: \"design-system:resend\",\n kind: \"design-system\",\n name: \"Resend\",\n description: \"Email API. Minimal dark theme, monospace accents.\",\n source: { path: \"design-systems/resend\" },\n },\n {\n id: \"design-system:retro\",\n kind: \"design-system\",\n name: \"Retro\",\n description:\n \"Throwback design with vintage-inspired typography, high-contrast retro palettes, and nostalgic visual elements.\",\n source: { path: \"design-systems/retro\" },\n },\n {\n id: \"design-system:revolut\",\n kind: \"design-system\",\n name: \"Revolut\",\n description:\n \"Digital banking. Sleek dark interface, gradient cards, fintech precision.\",\n source: { path: \"design-systems/revolut\" },\n },\n {\n id: \"design-system:runwayml\",\n kind: \"design-system\",\n name: \"Runwayml\",\n description: \"AI video generation. Cinematic dark UI, media-rich layout.\",\n source: { path: \"design-systems/runwayml\" },\n },\n {\n id: \"design-system:sanity\",\n kind: \"design-system\",\n name: \"Sanity\",\n description: \"Headless CMS. Red accent, content-first editorial layout.\",\n source: { path: \"design-systems/sanity\" },\n },\n {\n id: \"design-system:sentry\",\n kind: \"design-system\",\n name: \"Sentry\",\n description:\n \"Error monitoring. Dark dashboard, data-dense, pink-purple accent.\",\n source: { path: \"design-systems/sentry\" },\n },\n {\n id: \"design-system:shadcn\",\n kind: \"design-system\",\n name: \"Shadcn\",\n description:\n \"Shadcn/ui-inspired design with minimal, clean components, monochrome palette, and utility-first patterns.\",\n source: { path: \"design-systems/shadcn\" },\n },\n {\n id: \"design-system:shopify\",\n kind: \"design-system\",\n name: \"Shopify\",\n description:\n \"E-commerce platform. Dark-first cinematic, neon green accent, ultra-light type.\",\n source: { path: \"design-systems/shopify\" },\n },\n {\n id: \"design-system:simple\",\n kind: \"design-system\",\n name: \"Simple\",\n description:\n \"Straightforward, no-frills design with clean typography, neutral colors, and intuitive layouts that stay out of the way.\",\n source: { path: \"design-systems/simple\" },\n },\n {\n id: \"design-system:skeumorphism\",\n kind: \"design-system\",\n name: \"Skeumorphism\",\n description:\n \"Real-world mimicry with textured surfaces, 3D effects, and familiar physical metaphors for intuitive digital interfaces.\",\n source: { path: \"design-systems/skeumorphism\" },\n },\n {\n id: \"design-system:slack\",\n kind: \"design-system\",\n name: \"Slack\",\n description:\n \"Workplace communication platform. Aubergine-primary, multi-accent logo palette, light surfaces with dark sidebar, warm and approachable.\",\n source: { path: \"design-systems/slack\" },\n },\n {\n id: \"design-system:sleek\",\n kind: \"design-system\",\n name: \"Sleek\",\n description:\n \"Modern minimalist aesthetic with clean lines, intentional color palette, subtle interactions, and consistent spacing.\",\n source: { path: \"design-systems/sleek\" },\n },\n {\n id: \"design-system:spacex\",\n kind: \"design-system\",\n name: \"Spacex\",\n description:\n \"Space technology. Stark black and white, full-bleed imagery, futuristic.\",\n source: { path: \"design-systems/spacex\" },\n },\n {\n id: \"design-system:spacious\",\n kind: \"design-system\",\n name: \"Spacious\",\n description:\n \"Generous whitespace, consistent padding, and grid-based layouts for clean, readable, and breathing interfaces.\",\n source: { path: \"design-systems/spacious\" },\n },\n {\n id: \"design-system:spotify\",\n kind: \"design-system\",\n name: \"Spotify\",\n description:\n \"Music streaming. Vibrant green on dark, bold type, album-art-driven.\",\n source: { path: \"design-systems/spotify\" },\n },\n {\n id: \"design-system:starbucks\",\n kind: \"design-system\",\n name: \"Starbucks\",\n description:\n \"Global coffee retail brand. Four-tier green system, warm cream canvas, full-pill buttons.\",\n source: { path: \"design-systems/starbucks\" },\n },\n {\n id: \"design-system:storytelling\",\n kind: \"design-system\",\n name: \"Storytelling\",\n description:\n \"Narrative-driven design using visuals, copy, and interaction to guide users through engaging, emotionally resonant journeys.\",\n source: { path: \"design-systems/storytelling\" },\n },\n {\n id: \"design-system:stripe\",\n kind: \"design-system\",\n name: \"Stripe\",\n description:\n \"Payment infrastructure. Signature purple gradients, weight-300 elegance.\",\n source: { path: \"design-systems/stripe\" },\n },\n {\n id: \"design-system:supabase\",\n kind: \"design-system\",\n name: \"Supabase\",\n description:\n \"Open-source Firebase alternative. Dark emerald theme, code-first.\",\n source: { path: \"design-systems/supabase\" },\n },\n {\n id: \"design-system:superhuman\",\n kind: \"design-system\",\n name: \"Superhuman\",\n description:\n \"Fast email client. Premium dark UI, keyboard-first, purple glow.\",\n source: { path: \"design-systems/superhuman\" },\n },\n {\n id: \"design-system:tesla\",\n kind: \"design-system\",\n name: \"Tesla\",\n description:\n \"Electric automotive. Radical subtraction, full-viewport photography, near-zero UI.\",\n source: { path: \"design-systems/tesla\" },\n },\n {\n id: \"design-system:tetris\",\n kind: \"design-system\",\n name: \"Tetris\",\n description:\n \"Classic block-game inspired design with playful colors, bold display fonts, and compact, high-energy layouts.\",\n source: { path: \"design-systems/tetris\" },\n },\n {\n id: \"design-system:theverge\",\n kind: \"design-system\",\n name: \"Theverge\",\n description:\n \"Tech editorial media. Acid-mint and ultraviolet accents, Manuka display, rave-flyer story tiles.\",\n source: { path: \"design-systems/theverge\" },\n },\n {\n id: \"design-system:together-ai\",\n kind: \"design-system\",\n name: \"Together AI\",\n description:\n \"Open-source AI infrastructure. Technical, blueprint-style design.\",\n source: { path: \"design-systems/together-ai\" },\n },\n {\n id: \"design-system:totality-festival\",\n kind: \"design-system\",\n name: \"Totality Festival\",\n description:\n 'A cosmic-premium, glassmorphic dark system that captures the visceral awe of a solar eclipse — obsidian surfaces, amber \"corona\" highlights, and cyan atmospheric accents.',\n source: { path: \"design-systems/totality-festival\" },\n },\n {\n id: \"design-system:uber\",\n kind: \"design-system\",\n name: \"Uber\",\n description:\n \"Mobility platform. Bold black and white, tight type, urban energy.\",\n source: { path: \"design-systems/uber\" },\n },\n {\n id: \"design-system:urdu\",\n kind: \"design-system\",\n name: \"Urdu\",\n description:\n \"Urdu-first digital experiences with native RTL support,Nastaliq typography, and bilingual harmony.\",\n source: { path: \"design-systems/urdu\" },\n },\n {\n id: \"design-system:vercel\",\n kind: \"design-system\",\n name: \"Vercel\",\n description: \"Frontend deployment. Black and white precision, Geist font.\",\n source: { path: \"design-systems/vercel\" },\n },\n {\n id: \"design-system:vibrant\",\n kind: \"design-system\",\n name: \"Vibrant\",\n description:\n \"Lively, colorful design with bold playful typography, warm accents, and dynamic visual energy.\",\n source: { path: \"design-systems/vibrant\" },\n },\n {\n id: \"design-system:vintage\",\n kind: \"design-system\",\n name: \"Vintage\",\n description:\n \"1950s-1990s nostalgia with skeuomorphic touches, grainy textures, retro color palettes, and pixel-style typography.\",\n source: { path: \"design-systems/vintage\" },\n },\n {\n id: \"design-system:vodafone\",\n kind: \"design-system\",\n name: \"Vodafone\",\n description:\n \"Global telecom brand. Monumental uppercase display, Vodafone Red chapter bands.\",\n source: { path: \"design-systems/vodafone\" },\n },\n {\n id: \"design-system:voltagent\",\n kind: \"design-system\",\n name: \"Voltagent\",\n description:\n \"AI agent framework. Void-black canvas, emerald accent, terminal-native.\",\n source: { path: \"design-systems/voltagent\" },\n },\n {\n id: \"design-system:warp\",\n kind: \"design-system\",\n name: \"Warp\",\n description:\n \"Modern terminal. Dark IDE-like interface, block-based command UI.\",\n source: { path: \"design-systems/warp\" },\n },\n {\n id: \"design-system:webex\",\n kind: \"design-system\",\n name: \"Webex\",\n description:\n \"Collaboration platform. Momentum typography, blue action system, multi-user accent spectrum.\",\n source: { path: \"design-systems/webex\" },\n },\n {\n id: \"design-system:webflow\",\n kind: \"design-system\",\n name: \"Webflow\",\n description:\n \"Visual web builder. Blue-accented, polished marketing site aesthetic.\",\n source: { path: \"design-systems/webflow\" },\n },\n {\n id: \"design-system:wechat\",\n kind: \"design-system\",\n name: \"Wechat\",\n description:\n \"Brand visual language for WeChat Mini Programs, official accounts, and open ecosystem extensions.\",\n source: { path: \"design-systems/wechat\" },\n },\n {\n id: \"design-system:wired\",\n kind: \"design-system\",\n name: \"Wired\",\n description:\n \"Tech magazine. Paper-white broadsheet density, custom serif display, mono kickers, ink-blue links.\",\n source: { path: \"design-systems/wired\" },\n },\n {\n id: \"design-system:wise\",\n kind: \"design-system\",\n name: \"Wise\",\n description: \"Money transfer. Bright green accent, friendly and clear.\",\n source: { path: \"design-systems/wise\" },\n },\n {\n id: \"design-system:x-ai\",\n kind: \"design-system\",\n name: \"X AI\",\n description: \"Elon Musk's AI lab. Stark monochrome, futuristic minimalism.\",\n source: { path: \"design-systems/x-ai\" },\n },\n {\n id: \"design-system:xiaohongshu\",\n kind: \"design-system\",\n name: \"Xiaohongshu\",\n description:\n \"Lifestyle UGC social platform. Singular brand red, generous radius, content-first.\",\n source: { path: \"design-systems/xiaohongshu\" },\n },\n {\n id: \"design-system:zapier\",\n kind: \"design-system\",\n name: \"Zapier\",\n description:\n \"Automation platform. Warm orange, friendly illustration-driven.\",\n source: { path: \"design-systems/zapier\" },\n },\n {\n id: \"image-style:notion-illustration\",\n kind: \"image-style\",\n name: \"Notion Illustration\",\n description:\n \"Zero-native illustration style for hand-drawn product spot illustrations with simple ink contours and soft backgrounds.\",\n desc: 'Notion-editorial-style hand-drawn spot illustration. Black brush-pen ink on white, tapered confident strokes, solid-black curly hair, solid-black pants/shoes, 3/4 face turned toward viewer with closed-eye smile and soft nose hint, open breathing body outlines, and 1-3 supporting scene props + ambient marks that frame the moment. Trigger when user says /notion-illustration, asks for a \"Notion-style illustration\", \"Notion spot illustration\", or a new piece in this hand-drawn brush-pen Notion editorial style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/notion-illustration\",\n },\n },\n {\n id: \"image-style:vm0-illustration\",\n kind: \"image-style\",\n name: \"vm0 Illustration\",\n description:\n \"vm0 in-app spot illustration style with bold hand-drawn ink line art, white-filled interiors, and a soft rounded color backdrop.\",\n desc: \"Generate vm0-style vm0 in-app spot illustrations: bold hand-drawn ink line art with white-filled interiors, a soft rounded color backdrop, transparent output, and simple iconic metaphors for product states.\",\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/vm0-illustration\",\n },\n },\n {\n id: \"image-style:postcard-illustration\",\n kind: \"image-style\",\n name: \"Postcard Illustration\",\n description:\n \"Hand-drawn editorial postcard / travel-journal illustration with fine black ink linework, flat saturated gouache fills, sharp edges, dense small repeated ink patterns, paper-grain texture, sparse white speckles, and a tall portrait composition.\",\n desc: 'Hand-drawn editorial postcard illustration style. Fine black marker/pen ink linework over flat saturated gouache color fills with sharp edges, dense small repeated ink patterns on surfaces (rows of windows, shingle curves, hatching, stippling), subtle paper-grain background texture, tiny scattered white speckles (snow / petals / sparkle), and a tall portrait composition with a layered foreground-midground-background. Travel-journal / urban-sketcher aesthetic. Trigger when the user says /postcard-illustration, asks for a \"postcard illustration\", \"travel illustration\", \"urban sketcher style\", or briefs a palette + scene archetype + complexity.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/postcard-illustration\",\n },\n },\n {\n id: \"image-style:folk-storybook\",\n kind: \"image-style\",\n name: \"Folk Storybook Illustration\",\n description:\n \"Folk-art children's picture-book illustration — hand-painted gouache and watercolor scenes with anthropomorphic animal characters, closed-crescent-eye smiles, dusty muted folk palette, and decorative pattern surfaces.\",\n desc: \"Folk-art children's picture-book illustration style — hand-painted gouache/watercolor scene on aged paper, anthropomorphic animal characters with closed-crescent-eye smiles, dusty muted folk palette, decorative pattern surfaces (wallpaper, rugs, textiles), and a hushed lullaby mood. Trigger when users ask for a folk-art illustration, storybook scene, cozy animal illustration, or any new piece in this Eastern European picture-book style.\",\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/folk-storybook\",\n },\n },\n {\n id: \"image-style:papernook\",\n kind: \"image-style\",\n name: \"Papernook\",\n description:\n \"Hand-drawn editorial illustration set in a cozy cluttered personal-studio scene with warm cream paper, scratchy ink, painterly gouache fills, dot-eye character face, and dense edge-to-edge thematic props.\",\n desc: 'Hand-drawn editorial illustration in the spirit of a cluttered personal-studio scene. Loose scratchy black ink outlines that wobble, textured gouache fills with visible brush marks, warm cream paper background, simplified dot-eye character face, and a DENSE edge-to-edge composition where a centered character is orbited by thematic props that visually act out the scene metaphor. Default palette: dusty cornflower blue, soft coral pink, fresh sage green, charcoal, warm cream — no mustard, no burnt-orange. Trigger when user says /papernook, asks for a \"papernook illustration\", a \"cozy cluttered editorial scene\", a \"warm-cream desk scene\", or a new piece in this hand-drawn studio-clutter editorial style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/papernook\",\n },\n },\n {\n id: \"image-style:painterly-botanical\",\n kind: \"image-style\",\n name: \"Painterly Botanical\",\n description:\n \"Painterly watercolor + gouache portrait illustration with a single figure embraced by lush botanicals, closed-eye introspective expression, and a softly tinted paper-wash background.\",\n desc: 'Painterly watercolor + gouache portrait illustration. Single figure (closed eyes, contemplative) embraced by botanicals — leaves, blossoms, grasses. Translucent washes with visible pigment bleeds, sparse crisp ink line accents on key edges, tiny handwritten cursive signature in an upper corner, and a tinted paper-wash background (never pure white). Eight user axes drive composition: subject, hair, pose, botanicals, palette, background wash, complexity (L1/L2/L3), and format. Trigger when a brief describes a contemplative figure with foliage, a \"watercolor portrait\", a \"botanical embrace\", or asks for a piece in this painterly editorial style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/painterly-botanical\",\n },\n },\n {\n id: \"image-style:iso-scene\",\n kind: \"image-style\",\n name: \"Isometric Editorial Scene\",\n description:\n \"Isometric editorial-magazine scene illustration with ultra-fine hairline outlines, flat fills, a saturated monochromatic background, and a scene-as-metaphor composition built from theme-native props.\",\n desc: 'Isometric editorial-magazine scene illustration in a locked flat-vector style — ultra-fine hairline outlines, monochromatic saturated background filling the canvas, and a single composed scene whose props themselves embody the theme. Trigger when users say /iso-scene, ask for an \"isometric editorial illustration\", a \"scene illustration in the editorial machine style\", or brief with palette + scene archetype + complexity.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/iso-scene\",\n },\n },\n {\n id: \"image-style:inkdab\",\n kind: \"image-style\",\n name: \"Inkdab Illustration\",\n description:\n \"Brush-pen editorial illustration where a free-floating color dab is painted first, then loose black ink linework is drawn freely on top — never as an outline around the color. Scribbled hatched hair, open-outline bodies, pure white background.\",\n desc: 'Brush-pen editorial illustration style — a flat accent-color \"dab\" painted first, then loose black ink drawn freely on top. ONE flat accent-color shape per prop (painted-first, never outlined in black), black hand-wobbled ink on pure white background, scribbled hatched hair, open-outline bodies with zero fill, and one small solid-accent triangle floating freely as a recurring motif. Trigger when user says /inkdab, asks for an \"inkdab illustration\", a \"brush-pen illustration with a single accent color\", a \"free-floating color block illustration\", or briefs in the style of the included reference images.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/inkdab\",\n },\n },\n {\n id: \"image-style:riso-relic\",\n kind: \"image-style\",\n name: \"Riso Relic\",\n description:\n 'Pop-art retro risograph poster of a single nostalgic everyday object on a saturated single-hue field — bold black ink outlines, halftone grain, hand-drawn doodle accents, tiny \"SMALL OBJECTS IN TIME\" banner up top, chunky retro headline with offset drop-shadow at the bottom.',\n desc: 'Pop-art retro risograph poster of a single nostalgic everyday object — saturated single-color background, bold black ink outlines, halftone/riso grain, hand-drawn doodle accents (sparkles, squiggles, dots, music notes, lightning), tiny white \"SMALL OBJECTS IN TIME\" banner at top, chunky retro display headline at bottom with offset black drop-shadow. Trigger when user says /riso-relic, asks for a \"riso poster\", a \"small objects in time\" illustration, or any new piece in this nostalgic pop-art relic-object style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/riso-relic\",\n },\n },\n {\n id: \"image-style:inkstomp\",\n kind: \"image-style\",\n name: \"Inkstomp\",\n description:\n \"Loud indie-packaging poster style — full-bleed saturated flat color, a two-line hand-lettered headline, and one weird-cute black brush-ink character.\",\n desc: 'Inkstomp — a loud, hand-screened indie-packaging poster style. Full-bleed saturated flat color filling the entire canvas, a two-line hand-lettered headline (thin arched caps over chunky drop-shadowed display), and one weird-cute character drawn in thick uniform black brush ink. Trigger when the user says /inkstomp, asks for an \"inkstomp poster\", a \"Ray Fenwick / Hattie Stewart packaging poster\", an \"indie brush-ink flavor card\", or briefs in a \"palette + headline + character\" shape.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/inkstomp\",\n },\n },\n {\n id: \"image-style:folk-muse\",\n kind: \"image-style\",\n name: \"Folk Muse\",\n description:\n \"Flat folk-art gouache portrait style — a single contemplative chest-up figure framed by an asymmetric botanical surround, with painted irises, smooth flat hair, a hand against the cheek, and a patterned robe.\",\n desc: 'Flat folk-art gouache portrait illustration in the contemporary editorial style of Carson Ellis, Maja Tomljanovic, and Bodil Jane. A single chest-up figure with an elongated mannerist oval face, tiny almond half-lidded eyes, smooth flat hair, one hand pressed against the face, a patterned robe filling the lower frame, and an asymmetric botanical surround filling the background edge-to-edge. Hand-painted matte gouache texture, flat color blocks, no harsh outlines, no photorealism. Calm, slightly melancholic, contemplative mood. Trigger when the user says /folk-muse, asks for a \"folk-art portrait\", \"gouache portrait\", \"Carson Ellis style portrait\", or any new piece in this contemplative folk-portrait style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/folk-muse\",\n },\n },\n {\n id: \"image-style:sunlit-gouache\",\n kind: \"image-style\",\n name: \"Sunlit Gouache\",\n description:\n \"Bright pastel travel-painting illustration in opaque gouache on textured paper with chunky flat brushstrokes, vertical one-point perspective, and figures walking into warm sunlight.\",\n desc: 'Sunlit Gouache travel-painting illustration. Opaque gouache on textured paper, visible chunky flat brushstrokes with dry-brush highlights, locked six-color palette (cream, butter-yellow, sky-blue, sage-green, terracotta, one small red accent), vertical 2:3 one-point-perspective composition drawing the eye into a bright sunlit focal point, figures seen from behind walking into the scene, an overhead band of hanging elements (awning, prayer flags, catenary, bunting, lanterns) creating depth, dappled painterly reflections on the ground, airy optimistic warm mood. Trigger when user says /sunlit-gouache, asks for a \"sunlit gouache illustration\", \"painterly travel scene\", \"gouache café/market/temple/station scene\", or a new piece in this bright pastel painted-light style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/sunlit-gouache\",\n },\n },\n {\n id: \"image-style:mosaic-still-life\",\n kind: \"image-style\",\n name: \"Mosaic Still Life\",\n description:\n \"Editorial still-life illustration in a mosaic-tile + painterly hybrid style — tessellated ground/sky/wall surfaces with crisp painterly objects, an animal companion, and a patterned textile peeking through.\",\n desc: 'Mosaic-tile + painterly hybrid editorial illustration. Tessellated/pointillist mosaic surfaces (grass, sky, sand, walls, floors) anchor the scene, with crisp painterly still-life objects rendered ON TOP. Always features a still-life centerpiece on a table, an animal companion at the heart of the scene, and at least one patterned textile peeking through. Cozy, nostalgic, bucolic mood. Trigger when user says /mosaic-still-life, asks for a \"mosaic illustration\", \"mosaic-tile editorial illustration\", \"tessellated still life\", or briefs with a palette + scene + animal in this style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/mosaic-still-life\",\n },\n },\n {\n id: \"image-style:ink-mascot\",\n kind: \"image-style\",\n name: \"Ink Mascot\",\n description:\n \"Vintage editorial marketing card. Bold serif headline and short serif descriptor over a hand-drawn black-ink anthropomorphic mascot (stick limbs, chunky white sneakers) on a single solid saturated flat color background.\",\n desc: 'Generate a 3:5 portrait editorial marketing card in a locked vintage-textbook style. Bold serif headline plus an optional short serif descriptor sit on a single solid saturated flat color background (no gradient, no divider, no ground line). A hand-drawn black-ink anthropomorphic hero object — paint bucket, magnifying glass, envelope, notebook, funnel, megaphone, rocket, seedling, gift box, compass, etc. — stands with two thin stick arms, two stick legs, and chunky white sneakers with black laces (the signature detail). Crosshatch and stipple shading on rounded surfaces; floating ink doodles (sparkles, arrows, hearts, percent or dollar signs, motion lines) at the requested density. Dialable along six axes: concept, palette, hero object, action, doodle density (L1 minimal, L2 balanced, L3 packed), and type layout (A title-top, B headline-bottom, C headline-only, D big-word + tiny-descriptor). Trigger when user says /ink-mascot, asks for a \"marketing card illustration\", a \"retro editorial mascot poster\", or briefs with a marketing concept plus palette plus character.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/ink-mascot\",\n },\n },\n {\n id: \"image-style:sticker-sheet\",\n kind: \"image-style\",\n name: \"Sticker Sheet\",\n description:\n \"Hand-painted gouache sticker-sheet illustration with ~20 themed objects floating on white, punchy saturated palette, wobbly hand-drawn ink overlay, and tiny decorative marks on every item.\",\n desc: 'Sticker Sheet — hand-painted gouache sticker-sheet illustration. ~20 small floating themed objects on pure white, punchy saturated palette (coral, mustard, sage, dusty pink, navy, cream, warm brown), flat brushy gouache fills with wobbly hand-drawn ink linework and tiny decorative marks (dots, hatches, squiggles) on every object. Each object slightly tilted, no drop shadows, cheerful cozy lifestyle journal mood. Trigger when user says /sticker-sheet, asks for a \"sticker sheet illustration\", \"hand-painted gouache sticker pack\", \"themed object sheet\", or briefs with a scene theme + object count in this house style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/sticker-sheet\",\n },\n },\n {\n id: \"image-style:flat-poster\",\n kind: \"image-style\",\n name: \"Flat Poster\",\n description:\n \"Vertical flat-color editorial poster style — saturated solid background, one centered hand-drawn vector subject in bold deep-navy outlines with strict two-tone fill, headline pinned top-left, wordmark pinned bottom-right.\",\n desc: 'Flat Poster — a vertical flat-color editorial poster style for brand benefit cards, marketing posters, and in-app campaign visuals. Portrait 2:3 canvas filled edge-to-edge with one saturated hue; a single centered hand-drawn vector subject in deep-navy outlines with strict two-tone fill (pure white plus one darker bg-tint accent); a bold rounded sans-serif headline pinned top-left; a short wordmark (default VM0) pinned bottom-right; small floating accent marks around the subject; no body copy. Six creative dials: palette, subject archetype, composition preset, accent marks, headline voice, mood. Trigger when the user says /flat-poster, asks for a \"flat-color editorial poster\", a \"brand benefit card\", a \"marketing card in the bold outline + flat color style\", or briefs with a palette + subject + headline shape.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/flat-poster\",\n },\n },\n {\n id: \"image-style:mellow-pop\",\n kind: \"image-style\",\n name: \"Mellow Pop\",\n description:\n \"Chill flat-vector editorial poster of a serene recurring character on a fully saturated solid color background, with a signature pop of bright leaf-green and a scene-as-metaphor composition.\",\n desc: 'Mellow-pop flat-vector editorial illustration: a recurring chill character with closed-eye smile, tiny nose hint, and short dark bobbed hair, posed inside a scene-as-metaphor composition on a single fully saturated solid color background, with a signature pop of bright leaf-green woven into every piece (hero prop, plants, motifs, or sweater). Thin uniform black outlines, flat solid fills only, no gradients or texture. Five dials per brief: palette, scene metaphor, complexity (L1/L2/L3), pose, outfit accent. Trigger when user says /mellow-pop, asks for a \"mellow-pop illustration\", \"chill flat-vector poster\", or briefs with a scene metaphor + palette + complexity.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/mellow-pop\",\n },\n },\n {\n id: \"image-style:grainy-duotone\",\n kind: \"image-style\",\n name: \"Grainy Duotone\",\n description:\n \"Editorial spot illustration on a warm cream background — grainy charcoal-stippled hands, outline-free flat two-tone color blocks with internal patterns, and scattered ambient marks.\",\n desc: 'Grainy-duotone editorial spot illustration: warm cream off-white background, grainy charcoal-stippled hands (and occasional faces) drawn in textured black ink, paired with free-floating flat two-tone color blocks that carry NO outlines and are filled with internal patterns (grid, dots, spiral, hatching, squiggles, wavy lines), surrounded by scattered ambient marks (zigzags, triangles, x marks, circles, dashes). Square 1:1 scene-as-metaphor compositions. Five creative dials per brief: palette (two flat hues, e.g. teal+yellow / coral+sage / lavender+mustard / navy+peach / burgundy+dusty pink), elements (hand(s) + 1-3 props like flag, sprout, magnifier, balloons, ladder), scene archetype (Launch / Grow / Connect / Discover / Communicate / Reflect / Navigate / Care / Transform / Build), complexity (L1 minimal / L2 balanced / L3 rich), and mood (celebratory / calm / curious / reflective / determined / warm / quiet). Trigger when user says /grainy-duotone, asks for a \"grainy two-tone editorial illustration\", \"charcoal-stippled hand illustration\", \"duotone editorial spot\", or briefs with a scene metaphor + two-color palette + complexity.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/grainy-duotone\",\n },\n },\n {\n id: \"image-style:op-ed-cover\",\n kind: \"image-style\",\n name: \"Op-Ed Cover\",\n description:\n \"Editorial magazine op-ed cover — flat-vector scene with paper grain, elongated ink-line characters, muted retro palette, and a serif headline block in the lower-right.\",\n desc: 'Editorial magazine op-ed cover illustration. Flat-vector + paper-grain scene with expressive elongated ink-line characters, gentle painterly shading, 1950s-60s editorial mood, and a serif headline overlay block in the lower-right corner carrying a witty contrarian or declarative title with two short lines of italic body copy. 5-axis framework: palette (background + accent + ink), complexity (L1 single hero / L2 small ensemble / L3 busy crowd), scene metaphor (specific cultural microcosm), headline voice (declarative / pun / appreciative / contrarian), and headline block style (solid vs. translucent). Trigger when user says /op-ed-cover, asks for an \"editorial magazine illustration\", an \"op-ed cover\", a \"magazine essay illustration\", or a scene with a headline overlay in this style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/op-ed-cover\",\n },\n },\n {\n id: \"image-style:grain-poster\",\n kind: \"image-style\",\n name: \"Grain Poster\",\n description:\n \"Flat-vector editorial poster of a serene full-body figure with one hero prop — riso grain on a single textile, closed-eye smile + red cheek blush, muted limited palette.\",\n desc: 'Grain Poster — flat-vector editorial illustration of a serene full-body figure interacting with one hero prop (bicycle, bouquet, cat, book, skateboard, sun hat, guitar, dog leash). Closed-eye smile + single round red cheek blush + dark nose mark + solid black hair, silhouette-first (no inked outlines). Riso/halftone grain confined to exactly ONE textile element (skirt or trousers); every other surface is flat color. Muted single-hue background, generous negative space, no headlines or wordmarks. Six tunable dials: palette (cool-dawn · sunset-coral · twilight · forest-green · custom), mood, scene, cast, complexity (L1/L2/L3), framing. Strongest at L1 + side-profile + solo. Trigger when user says /grain-poster, asks for a \"flat-vector editorial poster\", \"riso-grain figure poster\", \"grainy editorial illustration\", or briefs with a scene + palette + cast in this house style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/grain-poster\",\n },\n },\n {\n id: \"image-style:light-pop-portrait\",\n kind: \"image-style\",\n name: \"Light Pop Portrait\",\n description:\n \"Light hand-drawn flat-vector single-character portrait on a fully saturated color block — chunky black hair, big shiny eyes, tiny red nose, pink five-point-star sparkle blush.\",\n desc: 'Light Pop Portrait — a hand-drawn flat-vector single-character portrait style for playful avatars, mood pieces, and editorial character cards. Square 1:1 canvas filled with one fully saturated background hue; a single child–tween character with chunky glossy-black hair (with one or two flyaway strands), big round shiny eyes (single white glint each, thin lashes above), tiny round red nose, expressive small mouth, and pink FIVE-POINT STAR sparkle blush on the cheeks (never solid dots). Thin delicate slightly-wavy hand-drawn contour lines, flat solid fills only, no gradients or texture, ~5-color palette per piece. Eight creative dials: expression, hairstyle, gender register, pose, palette, headwear, prop, outfit. Trigger when user says /light-pop-portrait, asks for a \"light pop portrait\", \"flat-vector character portrait\", \"saturated color-block character\", or briefs with expression + hairstyle + palette + prop.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/light-pop-portrait\",\n },\n },\n {\n id: \"image-style:endpaper\",\n kind: \"image-style\",\n name: \"Endpaper\",\n description:\n \"Riso-grain flat-vector collection of chill characters or objects scattered across a saturated solid color field, with two-tone interior shading and closed-eye sleepy faces.\",\n desc: 'Riso-grain flat-vector editorial collection illustration. Many small animals or objects scattered across a fully saturated solid color background — like the inside endpaper of a children\\'s picture book. Subtle riso/screenprint grain inside every fill, two-tone interior shading on every character (darker top + lighter belly), closed crescent-eye sleepy smiles with tiny dot noses, NO outlines on character bodies, loose hand-drawn line details on props (yarn spirals, leaf veins, pot stripes), scattered curated composition where characters overlap and touch the canvas edges. Five dials: background hue, cast (cats/dogs/foxes/birds/sea-creatures/houseplants/kitchen-objects/etc.), character palette (3–5 curated fills), density (L1 sparse / L2 balanced / L3 packed), prop vocabulary matched to cast. Trigger when user says /endpaper, asks for an \"endpaper illustration\", a \"scattered animal or object collection on saturated color\", a \"children\\'s-book endpaper scene\", or briefs with a cast + background hue + density + palette.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/endpaper\",\n },\n },\n {\n id: \"image-style:editorial-flatfolk\",\n kind: \"image-style\",\n name: \"Editorial Flatfolk\",\n description:\n \"Editorial hand-drawn naive book-illustration style — flat saturated color blocks, loose ink line overlay, paper grain, and a strong sense of place.\",\n desc: 'Editorial hand-drawn naive book-illustration style. Flat saturated color blocks with loose hand-drawn ink line work sitting ON TOP of the color, subtle paper grain across the canvas, simple ink hatching for sky / sun rays / rain / snow, and a strong sense of place built from tall narrow architecture and a one-point depth axis. Five dials per brief: palette (warm-primary, coastal-peach, jewel-night, winter-cool, autumn-rust, monsoon-twilight), scene metaphor (street, harbor, market, transit, park, square, interior, alpine-village), perspective (one-point street, frontal facade, low-angle hero, isometric, top-down), cast (solo wanderer, paired, small crowd, none), and light/weather (midday sun, golden hour, rain, snow, blue hour). Trigger when user says /editorial-flatfolk, asks for an \"editorial flat-folk illustration\", a \"saturated naive book-illustration scene\", a \"tall narrow row-house illustration\", or briefs a palette + scene metaphor + season.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/editorial-flatfolk\",\n },\n },\n {\n id: \"image-style:soft-vector\",\n kind: \"image-style\",\n name: \"Soft Vector\",\n description:\n \"Airy flat-vector spot illustration — square pale-blue canvas, thin ~1.5-2px dark-navy linework with intentionally open / unclosed outlines, flat fills, one muted accent hue, centered subject with breathing room.\",\n desc: 'Soft Vector — an airy flat-vector spot illustration style for in-app onboarding art, empty states, billing cards, and friendly UI moments. Square 1:1 canvas on a single flat pale-blue field #EEF1F5; thin uniform dark-navy outlines (~1.5-2px, rounded caps, NOT chunky); the signature lift comes from several intentionally OPEN / unclosed outlines per piece (mug rim gap, handle that doesn\\'t close, ground line ending in mid-air, cloud silhouette break, lamp arm fade, pot rim gap); strictly flat colour fills with no gradients or shading; one muted lead accent (mustard / lime-sage / warm-orange / violet) plus neutrals; subject centered at ~60-75% of canvas with generous breathing room; scattered thin-navy micro-marks (dots, plus signs, sparkles, or motion ticks). Six dials per brief: palette accent, scene metaphor, complexity (L1/L2/L3), cast, accent marks, action/mood. Trigger when user says /soft-vector, asks for a \"soft-vector illustration\", a \"friendly UI onboarding illustration\", a \"thin-line flat spot illustration\", or briefs a scene metaphor + palette + complexity in this house style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/soft-vector\",\n },\n },\n {\n id: \"image-style:loose-contour\",\n kind: \"image-style\",\n name: \"Loose Contour\",\n description:\n \"Flat editorial spot illustration — open teal contour lines, offset color blobs (printing-misregistration look), one ribbon line on warm cream paper.\",\n desc: 'Loose-contour flat editorial spot illustration: confident open-contour ink drawings in dark teal-green (#1e4d4a) over flat offset color blobs (printing-misregistration look) on warm cream paper (#f0ebdc), with exactly one continuous looping ribbon line of the same teal weaving through the scene. Tight 5-color palette: cream + teal + mustard + soft blue + coral. Lines are deliberately broken at joints and edges. Five dials per brief: scene metaphor, cast, complexity (L1/L2/L3), accent lead, ribbon path. Trigger when user says /loose-contour, asks for a \"loose-contour illustration\", \"offset-blob editorial illustration\", or \"cream paper ribbon-line scene\".',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/loose-contour\",\n },\n },\n {\n id: \"image-style:jade-blockprint\",\n kind: \"image-style\",\n name: \"Jade Blockprint\",\n description:\n \"Two-tone hand-drawn block-print spot illustration — accent color painted as free-floating shapes on white, with chunky black ink layered on top. Eight palettes.\",\n desc: 'Jade-blockprint two-pass hand-drawn block-print spot illustration: one accent color painted FIRST as free-floating shapes on pure white, then chunky black ink line art layered ON TOP. Color blobs have no perimeter outline — ink draws detail, hatching, and motion marks, never traces the colored shape. Wobbly variable-weight linework with occasional flooded black masses; tiny linocut speckle grain inside color fills. Eight named palettes (jade, coral, cobalt, plum, sage, rose, slate, terracotta) plus custom-hex override. Resolves vague briefs (growth, trust, freedom, fairness) into concrete scene metaphors via an internal synthesizer table before generating. Five dials per piece: palette, scene metaphor, complexity (L1 single object / L2 mini-scene / L3 vignette), motion marks, speckle density. Trigger when the user says /jade-blockprint, asks for a \"block-print illustration\", \"linocut spot illustration\", \"two-tone screen-print\", or briefs a metaphor for a blog cover or marketing card in this style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/jade-blockprint\",\n },\n },\n {\n id: \"image-style:shadow-pop\",\n kind: \"image-style\",\n name: \"Shadow Pop\",\n description:\n \"Bright flat-vector illustration with offset black shape shadows, white dashed stitching, palette confetti, and transparent PNG output.\",\n desc: 'Bright flat-vector editorial illustration style — every colored shape sits in front of an offset black silhouette of itself (the signature depth trick, no outlines on the fills), with white hand-drawn dashed stitching, scattered palette-colored sparkle confetti, and a fully transparent PNG background so the piece drops cleanly onto any surface. Five dials per brief — palette (default / berry-pop / tropical / citrus-cobalt), scene metaphor, complexity (L1 / L2 / L3), confetti density, and subject domain. Trigger when user says /shadow-pop, asks for a \"shadow-pop illustration\", a \"bright flat-vector illustration with offset shadow\", an \"in-app illustration with offset shadow trick\", or briefs in the style of the included reference images.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/shadow-pop\",\n },\n },\n {\n id: \"image-style:tiny-wanderer\",\n kind: \"image-style\",\n name: \"Tiny Wanderer\",\n description:\n \"Contemplative bande-dessinée landscape illustration — tiny human dwarfed by vast nature, ink hatching + flat color, vertical portrait canvas.\",\n desc: 'Contemplative bande-dessinée landscape illustration in a locked house style — a tiny human (or 2–3 figures) is dwarfed by a vast natural panorama, hand-drawn black ink contour + parallel/cross-hatching for clouds, rock walls, foliage, grass, and water texture, sitting on flat color blocks beneath the ink (no gradients, no airbrush). Restrained 3–5 color palette per piece including black ink, vertical portrait canvas (1024x1536, reads ~3:5). Always outdoor/wilderness. Moebius / Christophe Chabouté travel-sketchbook lineage, quiet wonder mood. Six dials per brief: palette family (sage-plains / sunset-warm / coastal-teal / cool-mist / autumn-rust / winter-pale / custom), landscape archetype (plains+clouds / mountain valley / river vista / rocky ridge / coastal cliffs / misty gorge / forest clearing / alpine pass / desert mesa / lakeshore), activity (walking / cycling / hiking / standing-and-gazing), solitude count (1 / 2 / 3), complexity (L1 single plane / L2 fore+mid / L3 full multi-plane vista), and weather/time (midday / golden hour / sunset / overcast / mist / blue hour). Trigger when user says /tiny-wanderer, asks for a \"tiny wanderer illustration\", \"bande-dessinée landscape\", \"Moebius-style travel illustration\", \"ink-hatched vertical landscape\", or briefs with a palette + landscape archetype + complexity in this house style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/tiny-wanderer\",\n },\n },\n {\n id: \"image-style:iberian-vignette\",\n kind: \"image-style\",\n name: \"Iberian Vignette\",\n description:\n \"Hand-drawn editorial vignette style — loose wobble ink, flat muted cream + burgundy + one accent (sage / mustard / dusty blue / terracotta), minimal abstract faces, observed Mediterranean composition with a serif Spanish wordmark at the bottom.\",\n desc: 'Iberian-vignette hand-drawn editorial illustration: loose hand-drawn ink linework with visible wobble and varied weight, flat muted color fills (no gradients, no shading, no texture) on a warm cream off-white background, burgundy/wine always present as the anchor color somewhere in the scene, exactly one secondary accent per piece (sage green / mustard yellow / dusty muted blue / terracotta-rust), minimal abstract faces (tiny dot or short-mark eyes, soft nose hint, almost no mouth), hair as flat color masses, warm sand skin tones, casually-observed body language (leaning, holding, mid-action, never stiffly posed), and a short Spanish serif lowercase wordmark anchored at the bottom center of the canvas. Always grounded by an architectural / scenic prop (stone arched doorway, tall arched window, balcony, sunlit courtyard, wooden counter, archway, stoop, open terrace). Six dials per brief: scene metaphor (trade shop, domestic moment, leisure ritual), cast (solo L1 / pair L2 / 3-4 figures L3), architectural prop, secondary accent (one only), wordmark (Spanish noun), complexity (L1/L2/L3). Trained on nano-banana-2 image-to-image with one of three locked anchor references (mañana / ritmo / familia). Trigger when user says /iberian-vignette, asks for an \"Iberian vignette illustration\", a \"Spanish editorial illustration\", a \"Mediterranean observed-moment scene\", or briefs a scene metaphor + cast + complexity in this hand-drawn editorial style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/iberian-vignette\",\n },\n },\n {\n id: \"image-style:cozy-parlor\",\n kind: \"image-style\",\n name: \"Cozy Parlor\",\n description:\n \"Hand-painted watercolor + ink-line scene — one anthropomorphic animal in a quiet domestic interior, clean cool-white paper, neutral palette with one hot accent pop.\",\n desc: \"Hand-painted watercolor + brushy black ink line on clean cool-white paper (no amber tint). ONE anthropomorphic animal mid-quiet-activity in a domestic interior. Closed-crescent-eye smile, minimal facial features, expression through posture. At least two patterned surfaces per piece. Cool/neutral palette lead (sage, slate-blue, cornflower, lavender, mint, dove-gray) with a single hot accent pop (cherry-red, mustard, magenta-pink) on one object. Six dials per brief — cast, activity, palette family, pattern motif stack, hot accent object, and complexity (L1/L2/L3). Trigger when user says /cozy-parlor, asks for a 'cozy parlor illustration', a 'watercolor animal scene', a 'picture-book interior', or a new piece in this neutral-palette watercolor style.\",\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/cozy-parlor\",\n },\n },\n {\n id: \"image-style:crowd-ink\",\n kind: \"image-style\",\n name: \"Crowd Ink\",\n description:\n \"Hand-drawn editorial crowd illustration — sketchy black ink contours over flat 3-color spot fills on pure white, scene-as-metaphor composition.\",\n desc: 'Hand-drawn editorial crowd illustration style — confident sketchy black ink contour lines with slightly irregular weight, flat 3-color spot fills sitting under or beside the ink lines (edges allowed to misregister slightly), on a PURE WHITE background (never cream). Fine-line backdrop drawn lighter than the foreground figures, scattered atmospheric marks in negative space (birds / leaves / steam / confetti / dots), and a scene-as-metaphor composition with a cast that varies per piece. Six dials per brief — palette (tested families: urban editorial / cool transit / warm natural / cozy interior), scene metaphor, complexity (L2 small group of 3–5 / L3 full crowd of 8–10), cast, backdrop, atmospheric motif. Trigger when the user says /crowd-ink, asks for a \"crowd-ink illustration\", \"editorial crowd scene\", \"hand-drawn ink-and-spot-color illustration\", \"New-Yorker-style crowd vignette\", or briefs with palette + scene metaphor + complexity level.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/crowd-ink\",\n },\n },\n {\n id: \"image-style:ink-storefront\",\n kind: \"image-style\",\n name: \"Ink Storefront\",\n description:\n \"Single-color hand-drawn ink fineliner illustration of a small storefront on warm cream paper — hand-lettered shop sign, foliage, and street props.\",\n desc: 'Boutique-poster illustration style — a single-color hand-drawn ink line drawing of a small storefront (café, boulangerie, florist, bookshop, ramen, wine bar, barber, record store, etc.) seen from street level on warm cream paper #f4ecd8. Locked frame: portrait 1024x1536, monochromatic ink with occasional double-stroke shadow under awnings and signs, a hand-lettered shop sign baked into the building, foliage and at least one small street prop (bike, A-frame chalkboard, planters, lanterns, café tables, dog/cat at the door), and a faint horizontal sidewalk line across the bottom. No solid color fills, no shading, no gradients. Seven dials per brief — ink color, shop name + subtitle, archetype, perspective (flat facade vs 3/4 corner), foreground props, foliage density, and complexity (L1 single facade / L2 small scene / L3 full vignette). Trigger when user says /ink-storefront, asks for a \"shopfront illustration\", \"storefront poster\", \"boutique fineliner illustration\", \"café line drawing\", or briefs with a shop name + ink color + archetype in this house style.',\n source: {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n path: \"illustration-template/ink-storefront\",\n },\n },\n];\n\nfunction filterByKind(kind: ResourceKind): readonly RegistryEntry[] {\n return RESOURCE_REGISTRY.filter((entry) => {\n return entry.kind === kind;\n });\n}\n\nexport function listImageStyles(): readonly RegistryEntry[] {\n return filterByKind(\"image-style\");\n}\n\nexport function findImageStyle(id: string): RegistryEntry | undefined {\n return listImageStyles().find((entry) => {\n return entry.id === id;\n });\n}\n\nexport function listDesignSystems(): readonly RegistryEntry[] {\n return filterByKind(\"design-system\");\n}\n\nexport function findDesignSystem(id: string): RegistryEntry | undefined {\n return listDesignSystems().find((entry) => {\n return entry.id === id;\n });\n}\n\nexport function listTemplates(\n target?: GenerationTarget,\n): readonly RegistryEntry[] {\n const all = filterByKind(\"template\");\n if (target === undefined) {\n return all;\n }\n return all.filter((entry) => {\n return entry.targets?.includes(target) ?? false;\n });\n}\n\nexport function findTemplate(id: string): RegistryEntry | undefined {\n return filterByKind(\"template\").find((entry) => {\n return entry.id === id;\n });\n}\n\nexport function toGenerationTarget(value: string): GenerationTarget {\n if (value === \"dashboard\") {\n return \"dashboard-design\";\n }\n\n if (value === \"docs\") {\n return \"docs-design\";\n }\n\n if (value === \"mobile-app\") {\n return \"mobile-app-design\";\n }\n\n return value as GenerationTarget;\n}\n\nexport function selectResourceCandidates(\n target?: GenerationTarget,\n): ResourceCandidateSlice {\n return {\n registryVersion: RESOURCE_REGISTRY_VERSION,\n source: {\n repo: RESOURCE_REGISTRY_REPO,\n ref: RESOURCE_REGISTRY_COMMIT,\n },\n sources: [\n {\n repo: RESOURCE_REGISTRY_REPO,\n ref: RESOURCE_REGISTRY_COMMIT,\n },\n {\n repo: VM0_SKILLS_REPO,\n ref: VM0_SKILLS_REF,\n },\n ],\n candidates: {\n skills: filterByKind(\"skill\"),\n templates: listTemplates(target),\n designSystems: filterByKind(\"design-system\"),\n imageStyles: filterByKind(\"image-style\"),\n audioStyles: filterByKind(\"audio-style\"),\n videoTemplates: filterByKind(\"video-template\"),\n bundleTemplates: filterByKind(\"bundle-template\"),\n },\n };\n}\n","import type { RegistryEntry } from \"./resource-registry\";\n\n/**\n * Format a list of registry entries for help text or error messages.\n *\n * Each entry renders as a two-line block:\n *\n * ```\n * <id>\n * <desc or description>\n * ```\n *\n * Blank line between entries. Returns a single placeholder line when the\n * list is empty so callers can drop this directly into help output.\n */\nexport function formatRegistryListing(\n entries: readonly RegistryEntry[],\n emptyLabel: string,\n): string {\n if (entries.length === 0) {\n return ` (no ${emptyLabel} registered)`;\n }\n return entries\n .map((entry) => {\n const desc = entry.desc ?? entry.description;\n return ` ${entry.id}\\n ${desc}`;\n })\n .join(\"\\n\\n\");\n}\n\n/**\n * Canonicalize a user-supplied registry id by prepending the resource-kind\n * prefix when missing. Accepts either `apple` or `design-system:apple`,\n * `html-ppt-pitch-deck` or `template:html-ppt-pitch-deck`, etc.\n */\nexport function canonicalizeRegistryId(prefix: string, value: string): string {\n const fullPrefix = `${prefix}:`;\n if (value.startsWith(fullPrefix)) {\n return value;\n }\n return `${fullPrefix}${value}`;\n}\n","import { readFileSync } from \"node:fs\";\nimport { printConnectorGuidance } from \"./connector-guidance\";\nimport { runLister, type GenerationType } from \"./lister\";\n\ninterface DispatchOptions {\n readonly generationType: GenerationType;\n readonly provider?: string;\n readonly prompt?: string;\n readonly all?: boolean;\n}\n\n/**\n * Resolve the dispatch for `zero generate <type>`.\n *\n * Returns `\"execute\"` when the caller should run the built-in pipeline.\n * Otherwise prints the appropriate output (lister or connector guidance)\n * and returns `\"handled\"`.\n *\n * The dispatcher consumes any piped stdin used to satisfy the prompt and\n * places the resolved text on `options.prompt` for the caller to use.\n */\nexport async function dispatchGenerate(\n options: DispatchOptions,\n): Promise<{ outcome: \"handled\" } | { outcome: \"execute\"; prompt: string }> {\n const provider = options.provider?.trim();\n\n if (provider && provider !== \"built-in\") {\n printConnectorGuidance(options.generationType, provider);\n return { outcome: \"handled\" };\n }\n\n const resolvedPrompt = resolvePrompt(options.prompt);\n\n if (resolvedPrompt === null) {\n await runLister(options.generationType, {\n all: options.all,\n });\n return { outcome: \"handled\" };\n }\n\n return { outcome: \"execute\", prompt: resolvedPrompt };\n}\n\nfunction resolvePrompt(prompt: string | undefined): string | null {\n if (prompt?.trim()) {\n return prompt.trim();\n }\n\n if (process.stdin.isTTY === false) {\n try {\n const piped = readFileSync(\"/dev/stdin\", \"utf8\").trim();\n if (piped.length > 0) {\n return piped;\n }\n } catch {\n // stdin not readable (e.g. test runner with no piped input);\n // treat as no piped prompt and fall through to lister.\n }\n }\n\n return null;\n}\n","import {\n CONNECTOR_TYPES,\n type ConnectorConfig,\n type ConnectorType,\n} from \"@vm0/connectors/connectors\";\nimport { getConnectorGenerationTypes } from \"@vm0/connectors/connector-utils\";\nimport type { GenerationType } from \"./lister\";\n\nfunction toConnectorGenerationType(\n generationType: GenerationType,\n): string | null {\n switch (generationType) {\n case \"voice\":\n case \"music\":\n return \"audio\";\n case \"dashboard-design\":\n case \"docs-design\":\n case \"mobile-app-design\":\n case \"poster\":\n case \"report\":\n return null;\n default:\n return generationType;\n }\n}\n\nfunction isConnectorType(value: string): value is ConnectorType {\n return value in CONNECTOR_TYPES;\n}\n\ninterface ConnectorGuidance {\n readonly type: ConnectorType;\n readonly label: string;\n readonly supportsGenerationType: boolean;\n}\n\nfunction resolveConnector(\n provider: string,\n generationType: GenerationType,\n): ConnectorGuidance | null {\n if (!isConnectorType(provider)) return null;\n const config: ConnectorConfig = CONNECTOR_TYPES[provider];\n const connectorGenerationType = toConnectorGenerationType(generationType);\n const supports =\n connectorGenerationType !== null &&\n getConnectorGenerationTypes(provider).some((entry) => {\n return entry === connectorGenerationType;\n });\n return {\n type: provider,\n label: config.label,\n supportsGenerationType: supports,\n };\n}\n\nexport function printConnectorGuidance(\n generationType: GenerationType,\n provider: string,\n): void {\n const guidance = resolveConnector(provider, generationType);\n\n if (!guidance) {\n console.log(`Provider \"${provider}\" is not a known connector.`);\n console.log(\"\");\n console.log(\n `Run \"zero generate ${generationType}\" to see every provider available for this generation type.`,\n );\n return;\n }\n\n if (!guidance.supportsGenerationType) {\n console.log(\n `${guidance.label} (${guidance.type}) does not advertise ${generationType} generation.`,\n );\n console.log(\"\");\n console.log(\n `Run \"zero generate ${generationType}\" to see every provider that supports this generation type.`,\n );\n return;\n }\n\n console.log(\n `${guidance.label} (${guidance.type}) handles ${generationType} generation through its own connector skill, not through \"zero generate\".`,\n );\n console.log(\"\");\n console.log(`Next steps:`);\n console.log(` - Use the \"${guidance.type}\" skill in this session.`);\n console.log(\n ` - Or call the connector directly via its documented endpoints.`,\n );\n console.log(\"\");\n console.log(\n `Run \"zero connector status ${guidance.type}\" to verify the connector is connected and authorized for the current agent.`,\n );\n}\n","import chalk from \"chalk\";\nimport {\n CONNECTOR_TYPE_KEYS,\n CONNECTOR_TYPES,\n type ConnectorConfig,\n type ConnectorGenerationType,\n type ConnectorType,\n} from \"@vm0/connectors/connectors\";\nimport { getConnectorGenerationTypes } from \"@vm0/connectors/connector-utils\";\nimport type { ConnectorListResponse } from \"@vm0/api-contracts/contracts/connector-schemas\";\nimport { getZeroAgentUserConnectors } from \"../../../../lib/api/domains/zero-agents\";\nimport {\n listZeroConnectors,\n searchZeroConnectors,\n} from \"../../../../lib/api/domains/zero-connectors\";\nimport { getPlatformOrigin } from \"../../doctor/platform-url\";\n\ntype BuiltInGenerationType =\n | \"dashboard-design\"\n | \"docs-design\"\n | \"image\"\n | \"mobile-app-design\"\n | \"music\"\n | \"poster\"\n | \"presentation\"\n | \"report\"\n | \"sprite\"\n | \"video\"\n | \"voice\"\n | \"website\";\nexport type GenerationType = ConnectorGenerationType | BuiltInGenerationType;\n\ninterface BuiltInGenerationProvider {\n label: string;\n model: string;\n command: string;\n reason: string;\n}\n\ninterface BuiltInGenerationCommand {\n label: string;\n command: string;\n models: string;\n}\n\ninterface GenerationContext {\n readonly lines: readonly string[];\n}\n\nconst BUILT_IN_GENERATION_PROVIDERS: Partial<\n Record<GenerationType, readonly BuiltInGenerationProvider[]>\n> = {\n image: [\n {\n label: \"Built-in fal.ai\",\n model: \"gpt-image-1\",\n command: \"zero generate image --provider built-in --model gpt-image-1 -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"gpt-image-2\",\n command: \"zero generate image --provider built-in --model gpt-image-2 -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"gpt-image-1.5\",\n command:\n \"zero generate image --provider built-in --model gpt-image-1.5 -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"gpt-image-1-mini\",\n command:\n \"zero generate image --provider built-in --model gpt-image-1-mini -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"fal-ai/flux-pro/v1.1\",\n command:\n \"zero generate image --provider built-in --model flux-pro-1.1 -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"fal-ai/flux-pro/v1.1-ultra\",\n command:\n \"zero generate image --provider built-in --model flux-pro-1.1-ultra -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"fal-ai/qwen-image\",\n command: \"zero generate image --provider built-in --model qwen-image -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"fal-ai/bytedance/seedream/v4/text-to-image\",\n command: \"zero generate image --provider built-in --model seedream4 -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"fal-ai/nano-banana-2\",\n command:\n \"zero generate image --provider built-in --model nano-banana-2 -h\",\n reason: \"available without connector setup\",\n },\n ],\n video: [\n {\n label: \"Built-in\",\n model: \"dreamina-seedance-2-0-260128\",\n command:\n \"zero generate video --provider built-in --model dreamina-seedance-2.0 -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in\",\n model: \"dreamina-seedance-2-0-fast-260128\",\n command:\n \"zero generate video --provider built-in --model dreamina-seedance-2.0-fast -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in\",\n model: \"seedance-1-5-pro-251215\",\n command:\n \"zero generate video --provider built-in --model seedance-1.5-pro -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"fal-ai/veo3.1/fast\",\n command: \"zero generate video --provider built-in --model veo3.1-fast -h\",\n reason: \"available without connector setup\",\n },\n {\n label: \"Built-in fal.ai\",\n model: \"fal-ai/kling-video/v3/4k/text-to-video\",\n command: \"zero generate video --provider built-in --model kling-v3-4k -h\",\n reason: \"available without connector setup\",\n },\n ],\n voice: [\n {\n label: \"Built-in\",\n model: \"gpt-4o-mini-tts\",\n command: \"zero generate voice --provider built-in -h\",\n reason: \"available without connector setup\",\n },\n ],\n};\n\nconst BUILT_IN_GENERATION_COMMANDS: Partial<\n Record<GenerationType, BuiltInGenerationCommand>\n> = {\n image: {\n label: \"Built-in image generation\",\n command: \"zero generate image --provider built-in -h\",\n models:\n \"fal.ai: gpt-image-1 (default), gpt-image-2, gpt-image-1.5, gpt-image-1-mini, flux-pro-1.1, flux-pro-1.1-ultra, qwen-image, seedream4, nano-banana-2\",\n },\n video: {\n label: \"Built-in video generation\",\n command: \"zero generate video --provider built-in -h\",\n models:\n \"dreamina-seedance-2.0-fast (default), dreamina-seedance-2.0, seedance-1.5-pro, veo3.1-fast, kling-v3-4k\",\n },\n presentation: {\n label: \"Built-in presentation generation\",\n command: \"zero generate presentation -h\",\n models: \"gpt-5.5\",\n },\n report: {\n label: \"Built-in report generation\",\n command: \"zero generate report -h\",\n models: \"gpt-5.5\",\n },\n \"docs-design\": {\n label: \"Built-in docs design generation\",\n command: \"zero generate docs-design -h\",\n models: \"gpt-5.5\",\n },\n poster: {\n label: \"Built-in poster generation\",\n command: \"zero generate poster -h\",\n models: \"gpt-5.5\",\n },\n \"dashboard-design\": {\n label: \"Built-in dashboard design generation\",\n command: \"zero generate dashboard-design -h\",\n models: \"gpt-5.5\",\n },\n \"mobile-app-design\": {\n label: \"Built-in mobile app design generation\",\n command: \"zero generate mobile-app-design -h\",\n models: \"gpt-5.5\",\n },\n website: {\n label: \"Built-in website generation\",\n command: \"zero generate website -h\",\n models: \"gpt-5.5\",\n },\n sprite: {\n label: \"Built-in sprite asset generation\",\n command: \"zero generate sprite -h\",\n models: \"gpt-image-2 (recommended) via built-in image generation\",\n },\n voice: {\n label: \"Built-in voice generation\",\n command: \"zero generate voice --provider built-in -h\",\n models: \"gpt-4o-mini-tts\",\n },\n};\n\nconst GENERATION_CONTEXT: Partial<Record<GenerationType, GenerationContext>> = {\n website: {\n lines: [\n \"Standalone static website artifacts can be authored locally and published with zero host for a public URL.\",\n \"zero host is for static directories with index.html; it is not a general deploy system for apps that need a backend, database, worker, or long-running process.\",\n \"Existing web app changes should usually follow the project's own build, test, and deploy workflow.\",\n ],\n },\n};\n\nconst GENERATION_TYPE_LABELS: Record<GenerationType, string> = {\n audio: \"Audio\",\n code: \"Code\",\n \"dashboard-design\": \"Dashboard design\",\n document: \"Document\",\n \"docs-design\": \"Docs design\",\n image: \"Image\",\n \"mobile-app-design\": \"Mobile app design\",\n music: \"Music\",\n poster: \"Poster\",\n presentation: \"Presentation\",\n report: \"Report\",\n sprite: \"Sprite\",\n text: \"Text\",\n video: \"Video\",\n voice: \"Voice\",\n website: \"Website\",\n};\n\ntype ConnectedConnector = ConnectorListResponse[\"connectors\"][number];\n\ntype CandidateStatus =\n | \"ready\"\n | \"needs-reconnect\"\n | \"not-authorized\"\n | \"not-connected\"\n | \"not-available\";\n\ninterface ListerOptions {\n all?: boolean;\n}\n\ninterface GenerationCandidate {\n type: ConnectorType;\n label: string;\n status: CandidateStatus;\n reason: string;\n account?: string;\n authMethod?: string;\n actionLabel?: string;\n actionUrl?: string;\n}\n\nfunction getConnectorGenerationType(\n generationType: GenerationType,\n): ConnectorGenerationType | null {\n switch (generationType) {\n case \"voice\":\n case \"music\":\n return \"audio\";\n case \"dashboard-design\":\n case \"docs-design\":\n case \"mobile-app-design\":\n case \"poster\":\n case \"presentation\":\n case \"report\":\n case \"sprite\":\n case \"website\":\n return null;\n case \"audio\":\n case \"code\":\n case \"document\":\n case \"image\":\n case \"text\":\n case \"video\":\n return generationType;\n }\n}\n\nfunction getBuiltInProviders(\n generationType: GenerationType,\n): readonly BuiltInGenerationProvider[] {\n return BUILT_IN_GENERATION_PROVIDERS[generationType] ?? [];\n}\n\nfunction getBuiltInCommand(\n generationType: GenerationType,\n): BuiltInGenerationCommand | null {\n return BUILT_IN_GENERATION_COMMANDS[generationType] ?? null;\n}\n\nfunction getGenerationContext(\n generationType: GenerationType,\n): GenerationContext | null {\n return GENERATION_CONTEXT[generationType] ?? null;\n}\n\nfunction getGenerationConnectors(\n generationType: ConnectorGenerationType,\n): Array<[ConnectorType, ConnectorConfig]> {\n return CONNECTOR_TYPE_KEYS.map((type): [ConnectorType, ConnectorConfig] => {\n return [type, CONNECTOR_TYPES[type]];\n })\n .filter(([type]) => {\n return getConnectorGenerationTypes(type).includes(generationType);\n })\n .sort(([a], [b]) => {\n return a.localeCompare(b);\n });\n}\n\nfunction isConnectorType(type: string): type is ConnectorType {\n return type in CONNECTOR_TYPES;\n}\n\nasync function getFeatureAvailableConnectorTypes(): Promise<\n Set<ConnectorType>\n> {\n const catalog = await searchZeroConnectors();\n return new Set(\n catalog.connectors\n .map((connector) => {\n return connector.id;\n })\n .filter(isConnectorType),\n );\n}\n\nfunction formatAccount(connector: ConnectedConnector): string | undefined {\n if (connector.externalUsername) return `@${connector.externalUsername}`;\n if (connector.externalEmail) return connector.externalEmail;\n if (connector.externalId) return connector.externalId;\n return undefined;\n}\n\nfunction getAction(\n status: CandidateStatus,\n type: ConnectorType,\n label: string,\n agentId: string | undefined,\n platformOrigin: string,\n): { actionLabel?: string; actionUrl?: string } {\n if (status === \"needs-reconnect\") {\n return {\n actionLabel: `Reconnect ${label}`,\n actionUrl: `${platformOrigin}/connectors`,\n };\n }\n\n if (status === \"not-authorized\" && agentId) {\n return {\n actionLabel: `Authorize ${label}`,\n actionUrl: `${platformOrigin}/connectors/${type}/authorize?agentId=${agentId}`,\n };\n }\n\n if (status === \"not-connected\") {\n if (agentId) {\n return {\n actionLabel: `Connect and authorize ${label}`,\n actionUrl: `${platformOrigin}/connectors/${type}/connect?agentId=${agentId}`,\n };\n }\n\n return {\n actionLabel: `Connect ${label}`,\n actionUrl: `${platformOrigin}/connectors/${type}/connect`,\n };\n }\n\n return {};\n}\n\nfunction toCandidate(params: {\n type: ConnectorType;\n config: ConnectorConfig;\n connector: ConnectedConnector | undefined;\n configuredTypes: Set<ConnectorType>;\n availableTypes: Set<ConnectorType>;\n authorizedTypes: Set<string> | null;\n agentId: string | undefined;\n platformOrigin: string;\n}): GenerationCandidate {\n const {\n type,\n config,\n connector,\n configuredTypes,\n availableTypes,\n authorizedTypes,\n agentId,\n platformOrigin,\n } = params;\n\n let status: CandidateStatus;\n let reason: string;\n\n if (!availableTypes.has(type)) {\n status = \"not-available\";\n reason = \"not available for this account\";\n } else if (connector?.needsReconnect) {\n status = \"needs-reconnect\";\n reason = \"connected, reconnect required\";\n } else if (!connector) {\n status = configuredTypes.has(type) ? \"not-connected\" : \"not-available\";\n reason =\n status === \"not-connected\"\n ? agentId\n ? \"not connected or authorized for current agent\"\n : \"not connected\"\n : \"not available in this environment\";\n } else if (authorizedTypes && !authorizedTypes.has(type)) {\n status = \"not-authorized\";\n reason = \"connected, not authorized for current agent\";\n } else {\n status = \"ready\";\n reason = agentId\n ? \"connected and authorized for current agent\"\n : \"connected; agent authorization was not checked\";\n }\n\n return {\n type,\n label: config.label,\n status,\n reason,\n account: connector ? formatAccount(connector) : undefined,\n authMethod: connector?.authMethod,\n ...getAction(status, type, config.label, agentId, platformOrigin),\n };\n}\n\nfunction pad(value: string, width: number): string {\n return value.padEnd(width);\n}\n\nfunction renderRows(candidates: GenerationCandidate[]): void {\n const typeWidth = Math.max(\n 4,\n ...candidates.map((candidate) => {\n return candidate.type.length;\n }),\n );\n const labelWidth = Math.max(\n 5,\n ...candidates.map((candidate) => {\n return candidate.label.length;\n }),\n );\n\n for (const candidate of candidates) {\n const suffix =\n candidate.status === \"ready\"\n ? (candidate.account ?? candidate.authMethod ?? \"\")\n : candidate.reason;\n console.log(\n ` ${pad(candidate.type, typeWidth)} ${pad(candidate.label, labelWidth)} ${suffix}`,\n );\n }\n}\n\nfunction renderActions(candidates: GenerationCandidate[]): void {\n const actionable = candidates.filter((candidate) => {\n return candidate.actionLabel && candidate.actionUrl;\n });\n if (actionable.length === 0) return;\n\n console.log(\"\");\n console.log(\"Next actions:\");\n for (const candidate of actionable) {\n console.log(` [${candidate.actionLabel}](${candidate.actionUrl})`);\n }\n}\n\nfunction renderBuiltInProvider(generationType: GenerationType): void {\n const command = getBuiltInCommand(generationType);\n if (command) {\n console.log(\"\");\n console.log(\"Built-in command:\");\n console.log(` vm0 ${command.label}`);\n console.log(` Models: ${command.models}`);\n console.log(` Use: ${command.command}`);\n return;\n }\n\n const providers = getBuiltInProviders(generationType);\n if (providers.length === 0) return;\n\n console.log(\"\");\n console.log(\n providers.length === 1 ? \"Built-in provider:\" : \"Built-in providers:\",\n );\n for (const provider of providers) {\n console.log(` vm0 ${provider.label} Model: ${provider.model}`);\n console.log(` Use: ${provider.command}`);\n }\n}\n\nfunction renderGenerationContext(generationType: GenerationType): void {\n const context = getGenerationContext(generationType);\n if (!context) return;\n\n console.log(\"\");\n console.log(\"Context:\");\n for (const line of context.lines) {\n console.log(` - ${line}`);\n }\n}\n\nfunction renderText(params: {\n generationType: GenerationType;\n agentId: string | undefined;\n ready: GenerationCandidate[];\n other: GenerationCandidate[];\n showAll: boolean;\n}): void {\n const { generationType, agentId, ready, other, showAll } = params;\n const label = GENERATION_TYPE_LABELS[generationType];\n const scope = agentId ? \"for current agent\" : \"(connected connectors)\";\n\n console.log(`${label} generation choices ${scope}`);\n console.log(\"\");\n\n if (agentId) {\n console.log(`${\"Agent:\".padEnd(10)}${agentId}`);\n console.log(\"\");\n } else {\n console.log(\n \"ZERO_AGENT_ID is not set, so agent authorization could not be checked.\",\n );\n console.log(\"\");\n }\n\n const hasBuiltInCommand = getBuiltInCommand(generationType) !== null;\n const showConnectorSummary =\n ready.length > 0 || !hasBuiltInCommand || showAll;\n if (showConnectorSummary) {\n console.log(\"Connectors:\");\n if (ready.length > 0) {\n renderRows(ready);\n } else {\n console.log(` No ready ${generationType} generation connectors found.`);\n }\n }\n\n renderBuiltInProvider(generationType);\n renderGenerationContext(generationType);\n\n if (showAll && other.length > 0) {\n console.log(\"\");\n console.log(`Other ${generationType} generation connectors`);\n console.log(\"\");\n renderRows(other);\n }\n\n if (showAll) {\n renderActions(other);\n }\n}\n\nexport async function runLister(\n generationType: GenerationType,\n options: ListerOptions = {},\n): Promise<void> {\n const connectorGenerationType = getConnectorGenerationType(generationType);\n const agentId = process.env.ZERO_AGENT_ID;\n const [connectorList, availableTypes, enabledTypes, platformOrigin] =\n await Promise.all([\n listZeroConnectors(),\n getFeatureAvailableConnectorTypes(),\n agentId ? getZeroAgentUserConnectors(agentId) : Promise.resolve(null),\n getPlatformOrigin(),\n ]);\n const connectedMap = new Map(\n connectorList.connectors.map((connector) => {\n return [connector.type, connector];\n }),\n );\n const configuredTypes = new Set(connectorList.configuredTypes);\n const authorizedTypes = enabledTypes ? new Set(enabledTypes) : null;\n const candidates = connectorGenerationType\n ? getGenerationConnectors(connectorGenerationType).map(\n ([connectorType, config]) => {\n return toCandidate({\n type: connectorType,\n config,\n connector: connectedMap.get(connectorType),\n configuredTypes,\n availableTypes,\n authorizedTypes,\n agentId,\n platformOrigin,\n });\n },\n )\n : [];\n const ready = candidates.filter((candidate) => {\n return candidate.status === \"ready\";\n });\n const other = candidates.filter((candidate) => {\n return candidate.status !== \"ready\";\n });\n renderText({\n generationType,\n agentId,\n ready,\n other,\n showAll: options.all === true,\n });\n\n const shouldShowOtherHint =\n !options.all &&\n other.length > 0 &&\n (ready.length > 0 || getBuiltInCommand(generationType) === null);\n if (shouldShowOtherHint) {\n console.log(\"\");\n console.log(\n chalk.dim(\n `Use --all to see every ${generationType} generation candidate.`,\n ),\n );\n }\n}\n","import { createArtifactGenerateCommand } from \"../shared/artifact-generate\";\n\nfunction standardDetails(kind: string) {\n return (options: { title?: string }) => {\n return [\n `Artifact kind: ${kind}`,\n `Requested title/name: ${options.title ?? \"not specified\"}`,\n ];\n };\n}\n\nexport const reportCommand = createArtifactGenerateCommand({\n name: \"report\",\n generationType: \"report\",\n target: \"report\",\n description: \"Generate an HTML report from a prompt\",\n usageCommand: \"zero generate report\",\n examples: ` Generate report: zero generate report --prompt \"A Q2 usage report for the API team\"\n Custom site slug: zero generate report --site-slug api-usage-q2 --prompt \"A Q2 usage report\"\n Show choices: zero generate report`,\n details: standardDetails(\"report\"),\n artifactRules: [\n \"Produce an analytical report, not a marketing page.\",\n \"Use concrete metrics, tables, chart-like visuals, and a clear findings section.\",\n \"Keep source assumptions visible when the prompt does not provide real data.\",\n \"Verify the report is readable at desktop and mobile widths.\",\n ],\n});\n\nexport const docsDesignCommand = createArtifactGenerateCommand({\n name: \"docs-design\",\n generationType: \"docs-design\",\n target: \"docs-design\",\n description: \"Generate a documentation design from a prompt\",\n usageCommand: \"zero generate docs-design\",\n examples: ` Generate docs design: zero generate docs-design --prompt \"Docs for adding artifact targets\"\n Custom site slug: zero generate docs-design --site-slug artifact-target-docs --prompt \"Artifact target docs\"\n Show choices: zero generate docs-design`,\n details: standardDetails(\"docs-design\"),\n artifactRules: [\n \"Produce a documentation design mockup, not a production documentation system.\",\n \"Include navigation, article structure, code or command examples when relevant, and clear section anchors as static design content.\",\n \"Use restrained documentation styling optimized for long-form reading.\",\n \"Verify the page works at mobile and desktop widths.\",\n ],\n});\n\nexport const posterCommand = createArtifactGenerateCommand({\n name: \"poster\",\n generationType: \"poster\",\n target: \"poster\",\n description: \"Generate an HTML poster from a prompt\",\n usageCommand: \"zero generate poster\",\n examples: ` Generate poster: zero generate poster --prompt \"A launch poster for artifact targets\"\n Custom site slug: zero generate poster --site-slug artifact-poster --prompt \"A launch poster\"\n Show choices: zero generate poster`,\n details: standardDetails(\"poster\"),\n artifactRules: [\n \"Produce a poster-style HTML artifact with strong hierarchy and composition.\",\n \"Treat this as an HTML poster surface; do not imply a raster image was generated unless image assets are actually created.\",\n \"Make the poster responsive enough to inspect on mobile and desktop.\",\n \"Keep text deliberate and avoid placeholder copy.\",\n ],\n});\n\nexport const dashboardDesignCommand = createArtifactGenerateCommand({\n name: \"dashboard-design\",\n generationType: \"dashboard-design\",\n target: \"dashboard-design\",\n description: \"Generate a dashboard design from a prompt\",\n usageCommand: \"zero generate dashboard-design\",\n examples: ` Generate dash design: zero generate dashboard-design --prompt \"An ops dashboard for generation runs\"\n Custom site slug: zero generate dashboard-design --site-slug generation-ops --prompt \"A generation ops dashboard\"\n Show choices: zero generate dashboard-design`,\n details: standardDetails(\"dashboard-design\"),\n artifactRules: [\n \"Produce a dashboard design mockup, not a live operational dashboard.\",\n \"Include scannable KPIs, chart-like visuals, lists or tables, and realistic empty/loading/error states as static design content.\",\n \"Prioritize dense, repeat-use UI over decorative sections.\",\n \"Verify the dashboard does not overflow at desktop and mobile widths.\",\n ],\n});\n\nexport const mobileAppDesignCommand = createArtifactGenerateCommand({\n name: \"mobile-app-design\",\n generationType: \"mobile-app-design\",\n target: \"mobile-app-design\",\n description: \"Generate a mobile app design prototype from a prompt\",\n usageCommand: \"zero generate mobile-app-design\",\n examples: ` Generate mobile UI: zero generate mobile-app-design --prompt \"A mobile review screen for generation artifacts\"\n Custom site slug: zero generate mobile-app-design --site-slug generation-mobile-review --prompt \"A mobile review screen\"\n Show choices: zero generate mobile-app-design`,\n details: standardDetails(\"mobile-app-design\"),\n artifactRules: [\n \"Produce a design prototype, not a runnable or installable mobile app.\",\n \"Render the design inside a realistic phone frame with status bar, device chrome, and home indicator when possible.\",\n \"Focus on one mobile screen and one primary job.\",\n \"Use mobile-appropriate tap targets, type sizes, and spacing.\",\n ],\n});\n","import { Command } from \"commander\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport {\n findDesignSystem,\n findTemplate,\n listDesignSystems,\n listTemplates,\n type GenerationTarget,\n toGenerationTarget,\n} from \"./resource-registry\";\nimport {\n canonicalizeRegistryId,\n formatRegistryListing,\n} from \"./resource-listing\";\nimport { createHtmlArtifactAuthoringPacket } from \"./html-artifact-authoring\";\nimport { dispatchGenerate } from \"../generate/lib/dispatch\";\nimport type { GenerationType } from \"../generate/lib/lister\";\n\ninterface ArtifactOptions {\n prompt?: string;\n siteSlug?: string;\n title?: string;\n designSystem?: string;\n template?: string;\n}\n\ninterface ArtifactCommandConfig {\n name: string;\n generationType: GenerationType;\n target: GenerationTarget;\n description: string;\n usageCommand: string;\n examples: string;\n details: (options: ArtifactOptions) => readonly string[];\n artifactRules: readonly string[];\n}\n\nfunction unknownDesignSystemError(id: string, usageCommand: string): Error {\n const designSystems = listDesignSystems();\n const message = [\n `Unknown design system: ${id}`,\n \"\",\n \"Available design systems:\",\n formatRegistryListing(designSystems, \"design systems\"),\n \"\",\n `Example:`,\n ` ${usageCommand} --design-system ${\n designSystems[0]?.id ?? \"<design-system-id>\"\n } --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nfunction unknownTemplateError(\n id: string,\n usageCommand: string,\n target: GenerationTarget,\n): Error {\n const templates = listTemplates(target);\n const message = [\n `Unknown template for ${target}: ${id}`,\n \"\",\n `Available templates for ${target}:`,\n formatRegistryListing(templates, `${target} templates`),\n \"\",\n `Example:`,\n ` ${usageCommand} --template ${\n templates[0]?.id ?? \"<template-id>\"\n } --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nexport function createArtifactGenerateCommand(\n config: ArtifactCommandConfig,\n): Command {\n return new Command()\n .name(config.name)\n .description(config.description)\n .option(\"--prompt <text>\", \"Artifact prompt; can also be piped via stdin\")\n .option(\"--site-slug <slug>\", \"Hosted site slug override\")\n .option(\"--title <text>\", \"Requested artifact title or name\")\n .option(\n \"--design-system <id>\",\n \"Design system id from the registry (see Design Systems below). Accepts either 'apple' or 'design-system:apple'.\",\n )\n .option(\n \"--template <id>\",\n `Template id from the registry, scoped to ${config.target} (see Templates below). Accepts either short id or full 'template:<id>'.`,\n )\n .addHelpText(\"after\", () => {\n const designSystems = listDesignSystems();\n const templates = listTemplates(config.target);\n return `\nExamples:\n${config.examples}\n\nOutput:\n Prints a source-selection packet for the current agent. The\n agent authors a static HTML artifact and hosts it with zero host. With no\n --prompt and no piped input, prints the generation choices instead.\n\nNotes:\n - Authenticates via ZERO_TOKEN\n\nDesign Systems:\n${formatRegistryListing(designSystems, \"design systems\")}\n\nTemplates (${config.target}):\n${formatRegistryListing(templates, `${config.target} templates`)}`;\n })\n .action(\n withErrorHandler(async (options: ArtifactOptions) => {\n const dispatch = await dispatchGenerate({\n generationType: config.generationType,\n prompt: options.prompt,\n });\n if (dispatch.outcome === \"handled\") return;\n const prompt = dispatch.prompt;\n\n let resolvedDesignSystem;\n if (options.designSystem !== undefined) {\n const canonical = canonicalizeRegistryId(\n \"design-system\",\n options.designSystem,\n );\n const entry = findDesignSystem(canonical);\n if (!entry) {\n throw unknownDesignSystemError(\n options.designSystem,\n config.usageCommand,\n );\n }\n resolvedDesignSystem = entry;\n }\n\n let resolvedTemplate;\n if (options.template !== undefined) {\n const canonical = canonicalizeRegistryId(\n \"template\",\n options.template,\n );\n const entry = findTemplate(canonical);\n if (!entry || !entry.targets?.includes(config.target)) {\n throw unknownTemplateError(\n options.template,\n config.usageCommand,\n config.target,\n );\n }\n resolvedTemplate = entry;\n }\n\n const extraDetails = [\n `Selected design system: ${\n resolvedDesignSystem\n ? `${resolvedDesignSystem.id} (${resolvedDesignSystem.name})`\n : \"agent decides\"\n }`,\n `Selected template: ${\n resolvedTemplate\n ? `${resolvedTemplate.id} (${resolvedTemplate.name})`\n : \"agent decides\"\n }`,\n ];\n\n const packet = createHtmlArtifactAuthoringPacket({\n kind: toGenerationTarget(config.target),\n prompt,\n slugSource: options.title,\n siteSlug: options.siteSlug,\n details: [...config.details(options), ...extraDetails],\n artifactRules: config.artifactRules,\n });\n\n console.log(packet.instructions);\n }),\n );\n}\n","import {\n type GenerationOutputKind,\n type ResourceCandidateSlice,\n type GenerationTarget,\n selectResourceCandidates,\n} from \"./resource-registry\";\n\ntype HtmlArtifactKind = GenerationTarget;\n\ninterface HtmlArtifactAuthoringOptions {\n readonly kind: HtmlArtifactKind;\n readonly prompt: string;\n readonly slugSource?: string;\n readonly siteSlug?: string;\n readonly details: readonly string[];\n readonly artifactRules: readonly string[];\n}\n\ninterface HtmlArtifactAuthoringPacket {\n readonly type: \"generation-source-selection\";\n readonly kind: HtmlArtifactKind;\n readonly prompt: string;\n readonly registryVersion: string;\n readonly artifact: {\n readonly outputMode: \"primary-artifact-with-supporting-assets\";\n readonly primaryArtifact: {\n readonly kind: GenerationOutputKind;\n readonly path: string;\n };\n readonly supportingAssets: readonly {\n readonly kind: GenerationOutputKind | \"metadata\";\n readonly path: string;\n readonly optional: boolean;\n }[];\n readonly previewKind: \"hosted-url\";\n readonly outputDir: string;\n };\n readonly selection: {\n readonly candidates: ResourceCandidateSlice[\"candidates\"];\n readonly outputSchema: {\n readonly skills: \"string[]\";\n readonly template: \"string\";\n readonly designSystem: \"string | null\";\n readonly imageStyle: \"string | null\";\n readonly audioStyle: \"string | null\";\n readonly videoTemplate: \"string | null\";\n readonly bundleTemplate: \"string | null\";\n readonly rationale: \"string\";\n };\n };\n readonly authoring: {\n readonly details: readonly string[];\n readonly artifactRules: readonly string[];\n };\n readonly outputDir: string;\n readonly site: string;\n readonly hostCommand: string;\n readonly instructions: string;\n}\n\nfunction slugify(value: string): string {\n const slug = value\n .toLowerCase()\n .replace(/[^a-z0-9]+/gu, \"-\")\n .replace(/^-+|-+$/gu, \"\")\n .replace(/-{2,}/gu, \"-\")\n .slice(0, 48)\n .replace(/-+$/u, \"\");\n return slug.length >= 3 ? slug : \"html-artifact\";\n}\n\nfunction titleForKind(kind: HtmlArtifactKind): string {\n const titles: Record<HtmlArtifactKind, string> = {\n image: \"image\",\n presentation: \"HTML presentation\",\n website: \"hosted website\",\n \"dashboard-design\": \"dashboard design prototype\",\n \"mobile-app-design\": \"mobile app design prototype\",\n poster: \"poster\",\n \"intro-video\": \"intro video storyboard\",\n report: \"report\",\n \"docs-design\": \"documentation design prototype\",\n };\n\n return titles[kind];\n}\n\nfunction outputDirForSite(site: string): string {\n return `./generated/mockups/${site}`;\n}\n\nexport function createHtmlArtifactAuthoringPacket(\n options: HtmlArtifactAuthoringOptions,\n): HtmlArtifactAuthoringPacket {\n const site =\n options.siteSlug ?? slugify(options.slugSource ?? options.prompt);\n const outputDir = outputDirForSite(site);\n const hostCommand = `zero host ${outputDir} --site ${site}${\n options.kind === \"website\" ? \" --spa\" : \"\"\n }`;\n const title = titleForKind(options.kind);\n const candidateSlice = selectResourceCandidates(options.kind);\n const selectionSchema = {\n skills: \"string[]\",\n template: \"string\",\n designSystem: \"string | null\",\n imageStyle: \"string | null\",\n audioStyle: \"string | null\",\n videoTemplate: \"string | null\",\n bundleTemplate: \"string | null\",\n rationale: \"string\",\n } as const;\n const artifact = {\n outputMode: \"primary-artifact-with-supporting-assets\",\n primaryArtifact: {\n kind: options.kind as GenerationOutputKind,\n path: `${outputDir}/index.html`,\n },\n supportingAssets: [\n {\n kind: \"image\",\n path: `${outputDir}/assets/`,\n optional: true,\n },\n {\n kind: \"audio\",\n path: `${outputDir}/assets/`,\n optional: true,\n },\n {\n kind: \"video\",\n path: `${outputDir}/assets/`,\n optional: true,\n },\n {\n kind: \"metadata\",\n path: `${outputDir}/metadata.json`,\n optional: true,\n },\n ],\n previewKind: \"hosted-url\",\n outputDir,\n } as const;\n const instructions = [\n `# Zero generate ${options.kind}`,\n \"\",\n \"This is a federated generation source-selection packet for the current agent.\",\n `Zero is not generating this ${title} on the server. You select resources, resolve them, and author the artifact.`,\n \"\",\n \"## User Prompt\",\n options.prompt,\n \"\",\n \"## Stage 1: Resource Selection\",\n \"- Choose generation resources from the bundled federated registry slice below.\",\n \"- Select one template, one or more skills, zero or one design system, and optional media/style resources when relevant.\",\n \"- Choose only IDs present in this packet; do not invent registry IDs.\",\n \"- Prefer compatible resources, but the user prompt is the highest-priority signal.\",\n \"- Treat the selection JSON as internal working state, then continue to authoring.\",\n \"\",\n \"## Selection Output Schema\",\n \"```json\",\n JSON.stringify(selectionSchema, null, 2),\n \"```\",\n \"\",\n \"## Candidate Registry Slice\",\n `Registry: \\`${candidateSlice.registryVersion}\\``,\n \"Sources:\",\n ...candidateSlice.sources.map((src) => {\n return `- \\`${src.repo}@${src.ref}\\``;\n }),\n \"\",\n \"```json\",\n JSON.stringify(candidateSlice.candidates, null, 2),\n \"```\",\n \"\",\n \"## Stage 2: Resolve Selected Resources\",\n \"- For every selected resource, fetch or read the referenced source before authoring.\",\n \"- Each candidate carries a `source` object with `path` and optional `repo`/`ref`; when `repo`/`ref` are omitted, fall back to the registry-level source above.\",\n \"- For directory refs, inspect the most relevant files such as `SKILL.md`, `DESIGN.md`, `README.md`, tokens, examples, and templates.\",\n \"- If a source file cannot be fetched, state that limitation and fall back to the registry metadata for that resource.\",\n \"\",\n \"## Stage 3: Author Artifact\",\n `Author a production-quality ${title} as a static HTML artifact using the selected generation resources.`,\n \"\",\n \"## Artifact Output Model\",\n `- Primary artifact: \\`${artifact.primaryArtifact.kind}\\` at \\`${artifact.primaryArtifact.path}\\`.`,\n `- Output mode: \\`${artifact.outputMode}\\`.`,\n \"- Supporting images, audio, video, or metadata may live inside the same output directory when the result needs them.\",\n \"- Treat the output directory as a project bundle when multiple media types are generated, while keeping the HTML entry point primary.\",\n \"\",\n \"## Output Contract\",\n `- Write the artifact under \\`${outputDir}/\\`.`,\n `- The entry file must be \\`${outputDir}/index.html\\`.`,\n \"- Keep every local asset inside the same output directory.\",\n \"- Do not reference files from another project path.\",\n \"- Use descriptive filenames and canonical HTML: close non-void tags and double-quote attributes.\",\n \"- Prefer a single self-contained HTML file unless the artifact genuinely needs separate assets.\",\n \"\",\n \"## Requested Parameters\",\n ...options.details.map((detail) => {\n return `- ${detail}`;\n }),\n \"\",\n \"## Authoring Rules\",\n \"- Let the selected template define structure, the selected design system define visual language, and the selected skills define process.\",\n \"- Read the local codebase, brand assets, and existing design systems when the prompt depends on this repository.\",\n \"- Avoid generic AI design defaults: no stock SaaS gradients, no emoji-as-icons, no filler stats, no decorative chrome that does not help the artifact.\",\n \"- Build the actual artifact first, not a marketing explanation of the artifact.\",\n \"- Make controls and interactions real when they are visible.\",\n \"- Keep text readable at desktop and mobile preview sizes.\",\n ...options.artifactRules.map((rule) => {\n return `- ${rule}`;\n }),\n \"\",\n \"## Verification\",\n \"- Use `agent-browser` for browser verification when available. Start with `agent-browser skills get core` if you need command guidance.\",\n \"- Prefer `agent-browser` over Playwright, Puppeteer, or installing browser automation dependencies.\",\n \"- Open the HTML locally and verify it is nonblank.\",\n \"- Check that keyboard/click interactions work when present.\",\n \"- Check that text does not overflow or overlap at desktop and mobile viewport sizes.\",\n \"- Run the final hosting command only after the artifact looks correct.\",\n \"\",\n \"## Publish\",\n `When everything is OK, publish it with:`,\n \"\",\n \"```bash\",\n hostCommand,\n \"```\",\n ].join(\"\\n\");\n\n return {\n type: \"generation-source-selection\",\n kind: options.kind,\n prompt: options.prompt,\n registryVersion: candidateSlice.registryVersion,\n artifact,\n selection: {\n candidates: candidateSlice.candidates,\n outputSchema: selectionSchema,\n },\n authoring: {\n details: options.details,\n artifactRules: options.artifactRules,\n },\n outputDir,\n site,\n hostCommand,\n instructions,\n };\n}\n","import { createPresentationGenerateCommand } from \"../shared/presentation-generate\";\n\nexport const presentationCommand = createPresentationGenerateCommand({\n name: \"presentation\",\n generationType: \"presentation\",\n usageCommand: \"zero generate presentation\",\n examples: ` Generate deck: zero generate presentation --prompt \"A strategy deck for reducing support volume\"\n Pipe prompt: cat brief.txt | zero generate presentation\n Pick slide count: zero generate presentation --slides 10 --prompt \"A product launch narrative\"\n Custom site slug: zero generate presentation --site-slug api-migration-plan --prompt \"API migration plan\"\n Show choices: zero generate presentation`,\n});\n","import { Command, InvalidArgumentError } from \"commander\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { createHtmlArtifactAuthoringPacket } from \"./html-artifact-authoring\";\nimport {\n findDesignSystem,\n findTemplate,\n listDesignSystems,\n listTemplates,\n} from \"./resource-registry\";\nimport {\n canonicalizeRegistryId,\n formatRegistryListing,\n} from \"./resource-listing\";\nimport { dispatchGenerate } from \"../generate/lib/dispatch\";\nimport type { GenerationType } from \"../generate/lib/lister\";\n\nconst PRESENTATION_TARGET = \"presentation\";\n\ninterface PresentationOptions {\n prompt?: string;\n slides: number;\n title?: string;\n siteSlug?: string;\n designSystem?: string;\n template?: string;\n}\n\ninterface PresentationGenerateCommandConfig {\n name: string;\n generationType: GenerationType;\n usageCommand: string;\n examples: string;\n}\n\nfunction parseSlideCount(value: string): number {\n const slideCount = Number(value);\n if (!Number.isInteger(slideCount)) {\n throw new InvalidArgumentError(\"slides must be an integer\");\n }\n return slideCount;\n}\n\nfunction unknownDesignSystemError(id: string, usageCommand: string): Error {\n const designSystems = listDesignSystems();\n const message = [\n `Unknown design system: ${id}`,\n \"\",\n \"Available design systems:\",\n formatRegistryListing(designSystems, \"design systems\"),\n \"\",\n `Example:`,\n ` ${usageCommand} --design-system ${\n designSystems[0]?.id ?? \"<design-system-id>\"\n } --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nfunction unknownTemplateError(\n id: string,\n usageCommand: string,\n target: string,\n): Error {\n const templates = listTemplates(PRESENTATION_TARGET);\n const message = [\n `Unknown template for ${target}: ${id}`,\n \"\",\n `Available templates for ${target}:`,\n formatRegistryListing(templates, `${target} templates`),\n \"\",\n `Example:`,\n ` ${usageCommand} --template ${\n templates[0]?.id ?? \"<template-id>\"\n } --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nexport function createPresentationGenerateCommand(\n config: PresentationGenerateCommandConfig,\n): Command {\n return new Command()\n .name(config.name)\n .description(\"Generate an HTML presentation from a prompt\")\n .option(\n \"--prompt <text>\",\n \"Presentation prompt; can also be piped via stdin\",\n )\n .option(\"--site-slug <slug>\", \"Hosted site slug override\")\n .option(\"--title <text>\", \"Requested deck title\")\n .option(\n \"--design-system <id>\",\n \"Design system id from the registry (see Design Systems below). Accepts either 'apple' or 'design-system:apple'.\",\n )\n .option(\n \"--template <id>\",\n \"Template id from the registry, scoped to presentation (see Templates below). Accepts either 'html-ppt-pitch-deck' or 'template:html-ppt-pitch-deck'.\",\n )\n .option(\"--slides <count>\", \"Slide count: 4-20\", parseSlideCount, 8)\n .addHelpText(\"after\", () => {\n const designSystems = listDesignSystems();\n const templates = listTemplates(PRESENTATION_TARGET);\n return `\nExamples:\n${config.examples}\n\nOutput:\n Prints a source-selection packet for the current agent.\n\nNotes:\n - Authenticates via ZERO_TOKEN\n - The agent authors the HTML presentation artifact and hosts it with zero host\n\nDesign Systems:\n${formatRegistryListing(designSystems, \"design systems\")}\n\nTemplates (presentation):\n${formatRegistryListing(templates, \"presentation templates\")}`;\n })\n .action(\n withErrorHandler(async (options: PresentationOptions) => {\n const dispatch = await dispatchGenerate({\n generationType: config.generationType,\n prompt: options.prompt,\n });\n if (dispatch.outcome === \"handled\") return;\n const prompt = dispatch.prompt;\n\n let resolvedDesignSystem;\n if (options.designSystem !== undefined) {\n const canonical = canonicalizeRegistryId(\n \"design-system\",\n options.designSystem,\n );\n const entry = findDesignSystem(canonical);\n if (!entry) {\n throw unknownDesignSystemError(\n options.designSystem,\n config.usageCommand,\n );\n }\n resolvedDesignSystem = entry;\n }\n\n let resolvedTemplate;\n if (options.template !== undefined) {\n const canonical = canonicalizeRegistryId(\n \"template\",\n options.template,\n );\n const entry = findTemplate(canonical);\n if (!entry || !entry.targets?.includes(PRESENTATION_TARGET)) {\n throw unknownTemplateError(\n options.template,\n config.usageCommand,\n PRESENTATION_TARGET,\n );\n }\n resolvedTemplate = entry;\n }\n\n const packet = createHtmlArtifactAuthoringPacket({\n kind: \"presentation\",\n prompt,\n slugSource: options.title,\n siteSlug: options.siteSlug,\n details: [\n `Slide count: ${options.slides}`,\n `Requested deck title: ${options.title ?? \"not specified\"}`,\n `Selected design system: ${\n resolvedDesignSystem\n ? `${resolvedDesignSystem.id} (${resolvedDesignSystem.name})`\n : \"agent decides\"\n }`,\n `Selected template: ${\n resolvedTemplate\n ? `${resolvedTemplate.id} (${resolvedTemplate.name})`\n : \"agent decides\"\n }`,\n ],\n artifactRules: [\n \"Think like a presentation designer, not a web page designer.\",\n \"Use a fixed 1920x1080 slide canvas and scale it uniformly for smaller viewports.\",\n \"Use one section per slide and keep repeated elements in consistent positions.\",\n \"Make keyboard navigation work with ArrowLeft, ArrowRight, Home, and End.\",\n \"Keep slide text readable from across a room; avoid memo-like walls of text.\",\n \"Before laying out slides, establish the deck's arc: the opening problem or question, how it develops, and what conclusion lands; every slide should serve a clear narrative role in that arc.\",\n \"Vary slide forms across the deck — full-bleed statement, evidence with data, pull quote, section break, summary — and avoid defaulting every slide to title-plus-bullets.\",\n \"Each slide carries one idea; prefer a single strong statement over a list, and never exceed three bullets on any slide.\",\n ],\n });\n\n console.log(packet.instructions);\n }),\n );\n}\n","import { Command } from \"commander\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport {\n createSpriteAuthoringPacket,\n type SpritePlan,\n} from \"../shared/sprite-authoring\";\nimport { dispatchGenerate } from \"./lib/dispatch\";\n\nconst SPRITE_USAGE_COMMAND = \"zero generate sprite\";\nconst DEFAULT_MODEL = \"gpt-image-2\";\nconst AGENT_DECIDES = \"agent decides\";\n\nconst ASSET_TYPES = [\n \"player\",\n \"npc\",\n \"creature\",\n \"character\",\n \"spell\",\n \"projectile\",\n \"impact\",\n \"prop\",\n \"summon\",\n \"fx\",\n] as const;\n\nconst ACTIONS = [\n \"single\",\n \"idle\",\n \"cast\",\n \"attack\",\n \"shoot\",\n \"jump\",\n \"hurt\",\n \"combat\",\n \"walk\",\n \"run\",\n \"hover\",\n \"charge\",\n \"projectile\",\n \"impact\",\n \"explode\",\n \"death\",\n] as const;\n\nconst VIEWS = [\"topdown\", \"side\", \"3-4\"] as const;\n\nconst SHEETS = [\n \"auto\",\n \"2x2\",\n \"2x3\",\n \"2x4\",\n \"3x3\",\n \"3x4\",\n \"4x4\",\n \"5x5\",\n \"strip-1x3\",\n \"strip-1x4\",\n \"custom\",\n] as const;\n\nconst BUNDLES = [\n \"single\",\n \"unit\",\n \"spell\",\n \"combat\",\n \"line\",\n \"hero-action\",\n \"engine-atlas\",\n] as const;\n\nconst ART_STYLES = [\n \"pixel-art\",\n \"clean-hd\",\n \"pixel-inspired\",\n \"retro-pixel\",\n \"map-style\",\n \"project-native\",\n] as const;\n\nconst ANCHORS = [\"center\", \"bottom\", \"feet\"] as const;\nconst MARGINS = [\"tight\", \"normal\", \"safe\"] as const;\nconst EFFECT_POLICIES = [\"all\", \"largest\"] as const;\n\ninterface SpriteOptions {\n readonly prompt?: string;\n readonly assetType?: string;\n readonly action?: string;\n readonly view?: string;\n readonly sheet?: string;\n readonly frames?: string;\n readonly bundle?: string;\n readonly artStyle?: string;\n readonly anchor?: string;\n readonly margin?: string;\n readonly effectPolicy?: string;\n readonly reference?: string;\n readonly model: string;\n readonly name?: string;\n}\n\nfunction validateEnum(\n flag: string,\n value: string | undefined,\n allowed: readonly string[],\n): void {\n if (value !== undefined && !allowed.includes(value)) {\n throw new Error(\n `${flag} must be one of: ${allowed.join(\", \")} (got \"${value}\")`,\n );\n }\n}\n\nfunction resolveFrames(value: string | undefined): string {\n if (value === undefined) {\n return AGENT_DECIDES;\n }\n if (value === \"auto\") {\n return value;\n }\n const frames = Number(value);\n if (!Number.isInteger(frames) || frames < 1 || frames > 64) {\n throw new Error(\"--frames must be 'auto' or an integer from 1 to 64\");\n }\n return String(frames);\n}\n\nfunction slugify(value: string): string {\n const slug = value\n .toLowerCase()\n .replace(/[^a-z0-9]+/gu, \"-\")\n .replace(/^-+|-+$/gu, \"\")\n .replace(/-{2,}/gu, \"-\")\n .slice(0, 48)\n .replace(/-+$/u, \"\");\n return slug.length >= 3 ? slug : \"sprite\";\n}\n\nexport const spriteCommand = new Command()\n .name(\"sprite\")\n .description(\n \"Prepare 2D game sprite/asset authoring instructions from a prompt\",\n )\n .option(\"--prompt <text>\", \"Sprite prompt/theme; can also be piped via stdin\")\n .option(\"--asset-type <type>\", `Asset type: ${ASSET_TYPES.join(\", \")}`)\n .option(\"--action <action>\", `Animation/action: ${ACTIONS.join(\", \")}`)\n .option(\n \"--view <view>\",\n `Camera view: ${VIEWS.join(\", \")} (3-4 means 3/4 view)`,\n )\n .option(\"--sheet <grid>\", `Sheet/grid shape: ${SHEETS.join(\", \")}`, \"auto\")\n .option(\"--frames <count>\", \"Frame count: 'auto' or an integer (1-64)\")\n .option(\"--bundle <preset>\", `Bundle preset: ${BUNDLES.join(\", \")}`)\n .option(\n \"--art-style <style>\",\n `Sprite art style (the sprite analog of 'zero generate image --style'): ${ART_STYLES.join(\", \")}`,\n )\n .option(\"--anchor <anchor>\", `Frame anchor: ${ANCHORS.join(\", \")}`)\n .option(\"--margin <margin>\", `Safe-area margin: ${MARGINS.join(\", \")}`)\n .option(\n \"--effect-policy <policy>\",\n `Detached-FX component policy: ${EFFECT_POLICIES.join(\", \")}`,\n )\n .option(\n \"--reference <url>\",\n \"Reference image URL for identity/style consistency\",\n )\n .option(\n \"--model <model>\",\n \"Recommended image model for raw sheets\",\n DEFAULT_MODEL,\n )\n .option(\"--name <slug>\", \"Output bundle name/slug\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Generate sprite: ${SPRITE_USAGE_COMMAND} --prompt \"A green slime monster idle loop\"\n Pick asset + action: ${SPRITE_USAGE_COMMAND} --asset-type creature --action idle --sheet 3x3 --prompt \"A fire dragon boss\"\n Hero action bundle: ${SPRITE_USAGE_COMMAND} --asset-type player --bundle hero-action --view side --prompt \"A knight with idle, run, attack, jump\"\n 4-direction walk: ${SPRITE_USAGE_COMMAND} --asset-type player --action walk --view topdown --sheet 4x4 --prompt \"A 16-bit RPG villager\"\n Pixel art style: ${SPRITE_USAGE_COMMAND} --art-style pixel-art --prompt \"A retro fireball projectile\" --sheet 2x2\n Match a reference: ${SPRITE_USAGE_COMMAND} --reference https://example.com/hero.png --action attack --prompt \"Attack animation for this hero\"\n Pipe prompt: cat brief.txt | ${SPRITE_USAGE_COMMAND}\n Show choices: ${SPRITE_USAGE_COMMAND}\n\nOutput:\n Prints a sprite source-selection packet for the current agent: the resolved\n plan, the recommended image model, the upstream sprite skill to resolve, and\n the hard containment rules for grids, identity, and FX.\n With no --prompt and no piped input, prints the generation choices instead.\n\nNotes:\n - The agent generates each raw sheet with built-in image generation\n (gpt-image-2 recommended) on a solid magenta background, then runs the\n sprite skill's local processor for chroma-key cleanup, frame extraction,\n alignment, QC, and transparent/GIF export.\n - Raw sprite art must originate from image generation, never from code-drawn\n primitives (Three.js/Canvas/SVG/HTML/PIL).\n - Unset flags resolve to \"agent decides\"; the agent infers them from the\n prompt and the skill's modes reference.`,\n )\n .action(\n withErrorHandler(async (options: SpriteOptions) => {\n validateEnum(\"--asset-type\", options.assetType, ASSET_TYPES);\n validateEnum(\"--action\", options.action, ACTIONS);\n validateEnum(\"--view\", options.view, VIEWS);\n validateEnum(\"--sheet\", options.sheet, SHEETS);\n validateEnum(\"--bundle\", options.bundle, BUNDLES);\n validateEnum(\"--art-style\", options.artStyle, ART_STYLES);\n validateEnum(\"--anchor\", options.anchor, ANCHORS);\n validateEnum(\"--margin\", options.margin, MARGINS);\n validateEnum(\"--effect-policy\", options.effectPolicy, EFFECT_POLICIES);\n const frames = resolveFrames(options.frames);\n\n const dispatch = await dispatchGenerate({\n generationType: \"sprite\",\n prompt: options.prompt,\n });\n if (dispatch.outcome === \"handled\") return;\n const prompt = dispatch.prompt;\n\n const plan: SpritePlan = {\n assetType: options.assetType ?? AGENT_DECIDES,\n action: options.action ?? AGENT_DECIDES,\n view: options.view ?? AGENT_DECIDES,\n sheet: options.sheet ?? \"auto\",\n frames,\n bundle: options.bundle ?? AGENT_DECIDES,\n artStyle: options.artStyle ?? AGENT_DECIDES,\n anchor: options.anchor ?? AGENT_DECIDES,\n margin: options.margin ?? AGENT_DECIDES,\n effectPolicy: options.effectPolicy ?? AGENT_DECIDES,\n reference: options.reference ?? \"none\",\n model: options.model,\n name: slugify(options.name ?? prompt),\n };\n\n const packet = createSpriteAuthoringPacket({ prompt, plan });\n console.log(packet.instructions);\n }),\n );\n","/**\n * Sprite generation source-selection packet.\n *\n * `zero generate sprite` does not run a server-side pipeline. Like the website\n * and styled-image commands, it \"bounces\" a structured authoring packet back to\n * the calling agent: the resolved sprite plan, the recommended image model, the\n * upstream sprite skill to resolve, and the hard containment rules the agent\n * must honor when it drives built-in image generation plus local postprocessing.\n */\n\nexport interface SpritePlan {\n readonly assetType: string;\n readonly action: string;\n readonly view: string;\n readonly sheet: string;\n readonly frames: string;\n readonly bundle: string;\n readonly artStyle: string;\n readonly anchor: string;\n readonly margin: string;\n readonly effectPolicy: string;\n readonly reference: string;\n readonly model: string;\n readonly name: string;\n}\n\ninterface SpriteAuthoringOptions {\n readonly prompt: string;\n readonly plan: SpritePlan;\n}\n\ninterface SpriteAuthoringPacket {\n readonly type: \"generation-source-selection\";\n readonly kind: \"sprite\";\n readonly prompt: string;\n readonly plan: SpritePlan;\n readonly model: string;\n readonly outputDir: string;\n readonly skill: {\n readonly repo: string;\n readonly ref: string;\n readonly skillPath: string;\n readonly references: readonly string[];\n readonly script: string;\n };\n readonly instructions: string;\n}\n\nconst SPRITE_SKILL = {\n repo: \"0x0funky/agent-sprite-forge\",\n ref: \"main\",\n skillPath: \"skills/generate2dsprite/SKILL.md\",\n references: [\n \"skills/generate2dsprite/references/prompt-rules.md\",\n \"skills/generate2dsprite/references/modes.md\",\n ],\n script: \"skills/generate2dsprite/scripts/generate2dsprite.py\",\n} as const;\n\nconst CORE_INVARIANTS = [\n \"Every raw sprite image must come from built-in image generation. Never draw raw sprite art with Three.js, Canvas, SVG, HTML/CSS, PIL shapes, procedural geometry, placeholder primitives, or code-rendered screenshots. Code may only assemble layout guides, postprocess generated images, or display finished assets at runtime.\",\n \"Background is 100% solid flat magenta `#FF00FF` with no gradient, so the local processor can chroma-key it to transparency. Keep this rule unless the user explicitly wants a different processing workflow.\",\n \"No text, labels, UI, speech bubbles, borders, or frames between cells. Generate the exact requested grid count only.\",\n \"Keep the same asset identity, the same bounding box, and the same pixel scale across every frame.\",\n \"Containment: the entire subject fits fully inside each cell with magenta margin on all four sides. No limb, weapon, tail, wing tip, orb, spark, or trail may cross a cell edge.\",\n \"Do not use raw single-row sheets (1x4, 1x6, 1x8, 1xN) for any body subject — players, heroes, creatures, NPCs, enemies, summons, or animated props. Use centered multi-row grids: 4 frames -> 2x2, 6 -> 2x3, 8 -> 2x4, 9 -> 3x3, 12 -> 3x4 or 4x3, 16 -> 4x4.\",\n \"For controllable heroes and main characters, attack/shoot/cast body sheets are body-only by default and must preserve idle/run body scale and the feet/bottom anchor. Generate slash arcs, weapon trails, muzzle flashes, projectiles, dust, and impacts as separate fx/projectile/impact sheets unless the runtime explicitly supports wider per-action cells plus per-action origins.\",\n \"For map prop packs, classify props first. Square 2x2/3x3/4x4 packs are only for compact props. Floors, platforms, bridges, walls, ladders, gates, doors, long hazards, wide/tall props, collision-bearing objects, and tileset/strip pieces use one-by-one generation, 1x3/1x4 strips, custom wide cells, or a tileset-like atlas instead.\",\n \"Mixed-action atlases (4x4, 5x5, custom) are a deterministic delivery step assembled from separate per-action sheets after each passes QC — never one raw mixed-action image. Raw multi-cell grids are valid only for one coherent action family, canonical directional locomotion, prop packs, or tileset-like atlases.\",\n] as const;\n\nconst WORKFLOW = [\n \"1. Resolve the upstream skill below, then infer or confirm the asset plan. Pick the smallest useful output and do not pad unrelated actions into one raw sheet.\",\n \"2. Write the art prompt by hand using the skill's prompt-rules. Lock the art style, the exact sheet shape, the solid magenta background, the identity, and the containment rules. Do not delegate prompt writing to a script.\",\n \"3. Generate each raw sheet with built-in image generation using the recommended model below. If a reference is involved, make it visible to the model first (view a local file before generating); never pass a bare filesystem path as the visual reference.\",\n \"4. Postprocess each raw sheet locally with the skill's processor script: magenta cleanup, frame extraction, alignment, shared-scale normalization, component filtering, QC metadata, transparent sheet export, and GIF export.\",\n \"5. QC each sheet: no frame touches a cell edge, scale is consistent, detached FX did not become noise, the sheet reads as one coherent animation, and hero/player body height matches the accepted idle/run scale within ~10-15%. Reprocess or regenerate if it fails.\",\n \"6. Return the bundle for the resolved plan (single sheet, unit/spell/combat bundle, line bundle, or hero action bundle with separate FX assets and an optional assembled engine atlas after per-action QC).\",\n] as const;\n\nconst EXPECTED_OUTPUTS = [\n \"`raw-sheet.png` (and one raw sheet per action for bundles)\",\n \"`raw-sheet-clean.png` (magenta cleaned)\",\n \"`sheet-transparent.png`\",\n \"per-frame PNGs\",\n \"`animation.gif` (per direction/action where applicable)\",\n \"`prompt-used.txt`\",\n \"`pipeline-meta.json`\",\n] as const;\n\nexport function createSpriteAuthoringPacket(\n options: SpriteAuthoringOptions,\n): SpriteAuthoringPacket {\n const { prompt, plan } = options;\n const outputDir = `./generated/sprites/${plan.name}`;\n\n const planEntries: ReadonlyArray<readonly [string, string]> = [\n [\"Asset type\", plan.assetType],\n [\"Action\", plan.action],\n [\"View\", plan.view],\n [\"Sheet / grid\", plan.sheet],\n [\"Frames\", plan.frames],\n [\"Bundle\", plan.bundle],\n [\"Art style\", plan.artStyle],\n [\"Anchor\", plan.anchor],\n [\"Margin\", plan.margin],\n [\"Effect policy\", plan.effectPolicy],\n [\"Reference\", plan.reference],\n ];\n\n const instructions = [\n \"# Zero generate sprite\",\n \"\",\n \"This is a federated generation source-selection packet for the current agent.\",\n \"Zero is not generating these sprites on the server. You resolve the sprite skill below, write the art prompt yourself, generate each raw sheet with built-in image generation, then run the skill's local processor for chroma-key cleanup, frame extraction, alignment, QC, and transparent/GIF export.\",\n \"\",\n \"## User Prompt\",\n prompt,\n \"\",\n \"## Sprite Plan\",\n \"These parameters were resolved from the command. `agent decides` means the flag was not set — infer the best value from the prompt and the skill's modes reference; do not force the user to spell it out.\",\n \"\",\n ...planEntries.map(([label, value]) => {\n return `- ${label}: ${value}`;\n }),\n `- Output name: ${plan.name}`,\n \"\",\n \"## Recommended Model\",\n `- Use \\`${plan.model}\\` for every raw sheet via built-in image generation (\\`zero generate image --provider built-in --model ${plan.model} --skip-style --prompt \"...\"\\`, or the in-context image tool).`,\n \"- gpt-image-2 is recommended for sprite sheets: it accepts flexible WIDTHxHEIGHT sizes and high quality for crisp, evenly-spaced grids. It does not emit transparent backgrounds, which is expected here — the solid magenta background is chroma-keyed by the local processor.\",\n \"- Pick a sheet-friendly square or grid-aligned size (for example 1024x1024 for 2x2/3x3/4x4) so each cell stays evenly spaced.\",\n \"\",\n \"## Workflow Skill\",\n \"Resolve this skill before authoring; it is the authority for sprite prompt patterns, sheet/bundle selection, and the postprocessing primitive.\",\n \"\",\n `- Repo: \\`${SPRITE_SKILL.repo}@${SPRITE_SKILL.ref}\\``,\n `- Skill: \\`${SPRITE_SKILL.skillPath}\\``,\n `- References: ${SPRITE_SKILL.references\n .map((ref) => {\n return `\\`${ref}\\``;\n })\n .join(\", \")}`,\n `- Processor script: \\`${SPRITE_SKILL.script}\\``,\n \"- For map props that must match a tile map, prefer the sibling `generate2dmap` skill in the same repo.\",\n \"- If a source file cannot be fetched, state that limitation and fall back to the core invariants below.\",\n \"\",\n \"## Core Invariants\",\n ...CORE_INVARIANTS.map((rule) => {\n return `- ${rule}`;\n }),\n \"\",\n \"## Workflow\",\n ...WORKFLOW,\n \"\",\n \"## Output Contract\",\n `- Write the bundle under \\`${outputDir}/\\`.`,\n \"- Keep the original generated images and produce, per sheet:\",\n ...EXPECTED_OUTPUTS.map((item) => {\n return ` - ${item}`;\n }),\n \"- For bundles, create one subfolder per asset and keep the per-action FX/projectile/impact sheets separate.\",\n \"\",\n \"## Verification\",\n \"- Confirm each transparent sheet and its frames are nonblank and free of magenta fringing.\",\n \"- Confirm no frame touches a cell edge and that scale and identity stay consistent across frames.\",\n \"- For hero/player body actions, confirm body height matches the accepted idle/run scale within ~10-15%.\",\n \"- Report the output directory, the final assets, and the resolved plan.\",\n ].join(\"\\n\");\n\n return {\n type: \"generation-source-selection\",\n kind: \"sprite\",\n prompt,\n plan,\n model: plan.model,\n outputDir,\n skill: SPRITE_SKILL,\n instructions,\n };\n}\n","import { createVideoGenerateCommand } from \"../shared/video-generate\";\n\nexport const videoCommand = createVideoGenerateCommand({\n name: \"video\",\n generationType: \"video\",\n usageCommand: \"zero generate video\",\n examples: ` Generate video: zero generate video --prompt \"A tracking shot through a neon market\"\n Pipe prompt: cat prompt.txt | zero generate video\n Use Dreamina 2.0: zero generate video --model dreamina-seedance-2.0 --prompt \"A cinematic product reveal\" --duration 6s --resolution 1080p\n Use Seedance 1.5 Pro: zero generate video --model seedance-1.5-pro --prompt \"A multi-shot chase scene\" --duration 8s --resolution 720p\n Add a first frame: zero generate video --first-frame-image-url https://example.com/frame.png --prompt \"Animate this frame\"\n List providers: zero generate video\n Use HeyGen: zero generate video --provider heygen`,\n});\n","import { Command, InvalidArgumentError } from \"commander\";\nimport chalk from \"chalk\";\nimport { generateWebVideo } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { dispatchGenerate } from \"../generate/lib/dispatch\";\nimport type { GenerationType } from \"../generate/lib/lister\";\n\ninterface VideoOptions {\n prompt?: string;\n provider?: string;\n model: string;\n aspectRatio: string;\n duration: string;\n resolution?: string;\n audio?: boolean;\n negativePrompt?: string;\n seed?: number;\n autoFix?: boolean;\n safetyTolerance: string;\n imageUrl?: string[];\n videoUrl?: string[];\n audioUrl?: string[];\n firstFrameImageUrl?: string;\n lastFrameImageUrl?: string;\n all?: boolean;\n}\n\ninterface VideoGenerateCommandConfig {\n name: string;\n generationType: GenerationType;\n usageCommand: string;\n examples: string;\n}\n\ninterface ImageDimensions {\n width: number;\n height: number;\n}\n\nconst FRAME_ASPECT_RATIO_TOLERANCE = 0.02;\nconst JPEG_START_OF_FRAME_MARKERS = new Set([\n 0xc0, 0xc1, 0xc2, 0xc3, 0xc5, 0xc6, 0xc7, 0xc9, 0xca, 0xcb, 0xcd, 0xce, 0xcf,\n]);\n\nfunction parseSeed(value: string): number {\n const seed = Number(value);\n if (!Number.isInteger(seed) || seed < 0 || !Number.isSafeInteger(seed)) {\n throw new InvalidArgumentError(\"seed must be a non-negative safe integer\");\n }\n return seed;\n}\n\nfunction collectUrl(value: string, previous: string[] = []): string[] {\n return [...previous, value];\n}\n\nfunction parseAspectRatio(value: string): ImageDimensions {\n const [widthText, heightText] = value.split(\":\");\n const width = Number(widthText);\n const height = Number(heightText);\n if (\n !Number.isFinite(width) ||\n !Number.isFinite(height) ||\n width <= 0 ||\n height <= 0\n ) {\n throw new Error(`Invalid --aspect-ratio \"${value}\"`);\n }\n return { width, height };\n}\n\nfunction readPngDimensions(buffer: Buffer): ImageDimensions | undefined {\n if (\n buffer.length < 24 ||\n buffer.toString(\"latin1\", 0, 8) !== \"\\x89PNG\\r\\n\\x1a\\n\"\n ) {\n return undefined;\n }\n return {\n width: buffer.readUInt32BE(16),\n height: buffer.readUInt32BE(20),\n };\n}\n\nfunction readGifDimensions(buffer: Buffer): ImageDimensions | undefined {\n if (\n buffer.length < 10 ||\n !buffer.toString(\"latin1\", 0, 6).startsWith(\"GIF\")\n ) {\n return undefined;\n }\n return {\n width: buffer.readUInt16LE(6),\n height: buffer.readUInt16LE(8),\n };\n}\n\nfunction readJpegDimensions(buffer: Buffer): ImageDimensions | undefined {\n if (buffer.length < 4 || buffer[0] !== 0xff || buffer[1] !== 0xd8) {\n return undefined;\n }\n\n let offset = 2;\n while (offset + 9 < buffer.length) {\n if (buffer[offset] !== 0xff) {\n offset += 1;\n continue;\n }\n\n const marker = buffer[offset + 1] as number;\n if (marker === 0xd9 || marker === 0xda) {\n break;\n }\n\n const segmentLength = buffer.readUInt16BE(offset + 2);\n if (segmentLength < 2 || offset + 2 + segmentLength > buffer.length) {\n break;\n }\n\n if (JPEG_START_OF_FRAME_MARKERS.has(marker)) {\n return {\n height: buffer.readUInt16BE(offset + 5),\n width: buffer.readUInt16BE(offset + 7),\n };\n }\n\n offset += 2 + segmentLength;\n }\n\n return undefined;\n}\n\nfunction readUnsigned24LE(buffer: Buffer, offset: number): number {\n return (\n buffer.readUInt8(offset) +\n (buffer.readUInt8(offset + 1) << 8) +\n (buffer.readUInt8(offset + 2) << 16)\n );\n}\n\nfunction readWebpDimensions(buffer: Buffer): ImageDimensions | undefined {\n if (\n buffer.length < 30 ||\n buffer.toString(\"ascii\", 0, 4) !== \"RIFF\" ||\n buffer.toString(\"ascii\", 8, 12) !== \"WEBP\"\n ) {\n return undefined;\n }\n\n let offset = 12;\n while (offset + 8 <= buffer.length) {\n const chunkType = buffer.toString(\"ascii\", offset, offset + 4);\n const chunkSize = buffer.readUInt32LE(offset + 4);\n const payloadOffset = offset + 8;\n if (payloadOffset + chunkSize > buffer.length) {\n break;\n }\n\n if (chunkType === \"VP8X\" && chunkSize >= 10) {\n return {\n width: readUnsigned24LE(buffer, payloadOffset + 4) + 1,\n height: readUnsigned24LE(buffer, payloadOffset + 7) + 1,\n };\n }\n\n if (\n chunkType === \"VP8L\" &&\n chunkSize >= 5 &&\n buffer[payloadOffset] === 0x2f\n ) {\n const byte1 = buffer.readUInt8(payloadOffset + 1);\n const byte2 = buffer.readUInt8(payloadOffset + 2);\n const byte3 = buffer.readUInt8(payloadOffset + 3);\n const byte4 = buffer.readUInt8(payloadOffset + 4);\n return {\n width: 1 + byte1 + ((byte2 & 0x3f) << 8),\n height:\n 1 + ((byte2 & 0xc0) >> 6) + (byte3 << 2) + ((byte4 & 0x0f) << 10),\n };\n }\n\n if (\n chunkType === \"VP8 \" &&\n chunkSize >= 10 &&\n buffer[payloadOffset + 3] === 0x9d &&\n buffer[payloadOffset + 4] === 0x01 &&\n buffer[payloadOffset + 5] === 0x2a\n ) {\n return {\n width: buffer.readUInt16LE(payloadOffset + 6) & 0x3fff,\n height: buffer.readUInt16LE(payloadOffset + 8) & 0x3fff,\n };\n }\n\n offset = payloadOffset + chunkSize + (chunkSize % 2);\n }\n\n return undefined;\n}\n\nfunction readImageDimensions(buffer: Buffer): ImageDimensions | undefined {\n return (\n readPngDimensions(buffer) ??\n readJpegDimensions(buffer) ??\n readWebpDimensions(buffer) ??\n readGifDimensions(buffer)\n );\n}\n\nfunction formatDimensionsAsRatio({ width, height }: ImageDimensions): string {\n const divisor = greatestCommonDivisor(width, height);\n return `${width / divisor}:${height / divisor}`;\n}\n\nfunction greatestCommonDivisor(left: number, right: number): number {\n let a = Math.abs(left);\n let b = Math.abs(right);\n while (b !== 0) {\n const remainder = a % b;\n a = b;\n b = remainder;\n }\n return a || 1;\n}\n\nfunction hasMatchingAspectRatio(\n actual: ImageDimensions,\n expected: ImageDimensions,\n): boolean {\n const actualRatio = actual.width / actual.height;\n const expectedRatio = expected.width / expected.height;\n return (\n Math.abs(actualRatio - expectedRatio) / expectedRatio <=\n FRAME_ASPECT_RATIO_TOLERANCE\n );\n}\n\nasync function fetchImageDimensions(\n optionName: string,\n imageUrl: string,\n): Promise<ImageDimensions> {\n let url: URL;\n try {\n url = new URL(imageUrl);\n } catch {\n throw new Error(`${optionName} must be an absolute URL`);\n }\n\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(\n `Could not validate ${optionName}: failed to fetch image (HTTP ${response.status})`,\n );\n }\n\n const buffer = Buffer.from(await response.arrayBuffer());\n const dimensions = readImageDimensions(buffer);\n if (!dimensions) {\n throw new Error(\n `Could not validate ${optionName}: unsupported image format or missing dimensions`,\n );\n }\n return dimensions;\n}\n\nasync function validateFrameImageAspectRatio(\n optionName: string,\n imageUrl: string | undefined,\n aspectRatio: string,\n): Promise<void> {\n if (!imageUrl) {\n return;\n }\n\n const expected = parseAspectRatio(aspectRatio);\n const actual = await fetchImageDimensions(optionName, imageUrl);\n if (hasMatchingAspectRatio(actual, expected)) {\n return;\n }\n\n throw new Error(\n `${optionName} has aspect ratio ${formatDimensionsAsRatio(actual)} (${actual.width}x${actual.height}), but --aspect-ratio is ${aspectRatio}. Use --aspect-ratio ${formatDimensionsAsRatio(actual)} or provide a frame image with ${aspectRatio} dimensions.`,\n );\n}\n\nasync function validateVideoOptions(options: VideoOptions): Promise<void> {\n await Promise.all([\n validateFrameImageAspectRatio(\n \"--first-frame-image-url\",\n options.firstFrameImageUrl,\n options.aspectRatio,\n ),\n validateFrameImageAspectRatio(\n \"--last-frame-image-url\",\n options.lastFrameImageUrl,\n options.aspectRatio,\n ),\n ]);\n}\n\nexport function createVideoGenerateCommand(\n config: VideoGenerateCommandConfig,\n): Command {\n return new Command()\n .name(config.name)\n .description(\"Generate a billed video file from a prompt\")\n .option(\"--prompt <text>\", \"Video prompt; can also be piped via stdin\")\n .option(\n \"--provider <name>\",\n \"Provider: 'built-in' to run vm0's pipeline, or a connector name to get its skill-invocation guidance\",\n )\n .option(\n \"--all\",\n \"When listing providers (no --prompt given), include unavailable or not-yet-authorized connectors\",\n )\n .option(\n \"--model <model>\",\n \"Model: dreamina-seedance-2.0-fast, dreamina-seedance-2.0, seedance-1.5-pro, veo3.1-fast, or kling-v3-4k\",\n \"dreamina-seedance-2.0-fast\",\n )\n .option(\n \"--aspect-ratio <ratio>\",\n \"Aspect ratio: 21:9, 16:9, 4:3, 1:1, 3:4, or 9:16\",\n \"16:9\",\n )\n .option(\n \"--duration <duration>\",\n \"Duration: 2s-15s depending on model\",\n \"8s\",\n )\n .option(\"--resolution <resolution>\", \"Resolution: 480p, 720p, or 1080p\")\n .option(\"--no-audio\", \"Generate a silent video\")\n .option(\"--negative-prompt <text>\", \"Negative prompt\")\n .option(\"--seed <integer>\", \"Deterministic seed\", parseSeed)\n .option(\"--no-auto-fix\", \"Disable prompt auto-fix\")\n .option(\"--safety-tolerance <level>\", \"Safety tolerance\", \"4\")\n .option(\n \"--image-url <url>\",\n \"Reference image URL; repeat for multiple Dreamina Seedance 2.0 references\",\n collectUrl,\n [],\n )\n .option(\n \"--video-url <url>\",\n \"Reference video URL; repeat up to 3 times for Dreamina Seedance 2.0\",\n collectUrl,\n [],\n )\n .option(\n \"--audio-url <url>\",\n \"Reference audio URL for Dreamina Seedance 2.0\",\n collectUrl,\n [],\n )\n .option(\"--first-frame-image-url <url>\", \"First frame image URL\")\n .option(\"--last-frame-image-url <url>\", \"Last frame image URL\")\n .addHelpText(\n \"after\",\n `\nExamples:\n${config.examples}\n\nOutput:\n Prints the generated /f/ video file URL and metadata\n\nNotes:\n - Authenticates via ZERO_TOKEN (requires file:write capability)\n - Charges org credits after successful video generation\n - Uses BytePlus ModelArk and fal.ai video models with configured usage pricing\n\nModels:\n - Dreamina Seedance 2.0: dreamina-seedance-2.0,\n dreamina-seedance-2.0-fast (default). Supports 4s-15s,\n 480p/720p, seed, optional audio, image references, and first/last\n frames. The non-fast model also supports 1080p and video/audio references.\n - Seedance 1.5 Pro: seedance-1.5-pro. Supports 4s-12s,\n 480p/720p/1080p, seed, optional audio, image references, and\n first/last frames.\n - fal.ai: veo3.1-fast and kling-v3-4k. veo3.1-fast supports\n 4s/6s/8s, 720p/1080p/4k, negative prompts, seed, auto-fix,\n safety tolerance, and optional audio. kling-v3-4k supports 3s-15s,\n 4k output, negative prompts, and optional audio.`,\n )\n .action(\n withErrorHandler(async (options: VideoOptions) => {\n const dispatch = await dispatchGenerate({\n generationType: config.generationType,\n provider: options.provider,\n prompt: options.prompt,\n all: options.all,\n });\n if (dispatch.outcome === \"handled\") return;\n const prompt = dispatch.prompt;\n\n await validateVideoOptions(options);\n const result = await generateWebVideo({\n prompt,\n model: options.model,\n aspectRatio: options.aspectRatio,\n duration: options.duration,\n resolution: options.resolution,\n generateAudio: options.audio !== false,\n negativePrompt: options.negativePrompt,\n seed: options.seed,\n autoFix: options.autoFix !== false,\n safetyTolerance: options.safetyTolerance,\n imageUrls: options.imageUrl,\n videoUrls: options.videoUrl,\n audioUrls: options.audioUrl,\n firstFrameImageUrl: options.firstFrameImageUrl,\n lastFrameImageUrl: options.lastFrameImageUrl,\n });\n\n console.log(chalk.green(`✓ Video generated: ${result.url}`));\n console.log(chalk.dim(` File: ${result.filename}`));\n console.log(chalk.dim(` Duration: ${result.duration}`));\n console.log(chalk.dim(` Resolution: ${result.resolution}`));\n console.log(chalk.dim(` Aspect ratio: ${result.aspectRatio}`));\n console.log(\n chalk.dim(` Audio: ${result.generateAudio ? \"on\" : \"off\"}`),\n );\n console.log(chalk.dim(` Credits charged: ${result.creditsCharged}`));\n console.log(chalk.dim(` Model: ${result.model}`));\n }),\n );\n}\n","import { Command } from \"commander\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { createHtmlArtifactAuthoringPacket } from \"../shared/html-artifact-authoring\";\nimport {\n findDesignSystem,\n findTemplate,\n listDesignSystems,\n listTemplates,\n} from \"../shared/resource-registry\";\nimport {\n canonicalizeRegistryId,\n formatRegistryListing,\n} from \"../shared/resource-listing\";\nimport { dispatchGenerate } from \"./lib/dispatch\";\n\nconst WEBSITE_TARGET = \"website\";\nconst WEBSITE_USAGE_COMMAND = \"zero generate website\";\n\ninterface WebsiteOptions {\n readonly prompt?: string;\n readonly template?: string;\n readonly designSystem?: string;\n readonly siteSlug?: string;\n readonly title?: string;\n}\n\nfunction unknownDesignSystemError(id: string): Error {\n const designSystems = listDesignSystems();\n const message = [\n `Unknown design system: ${id}`,\n \"\",\n \"Available design systems:\",\n formatRegistryListing(designSystems, \"design systems\"),\n \"\",\n `Example:`,\n ` ${WEBSITE_USAGE_COMMAND} --design-system ${\n designSystems[0]?.id ?? \"<design-system-id>\"\n } --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nfunction unknownTemplateError(id: string): Error {\n const templates = listTemplates(WEBSITE_TARGET);\n const message = [\n `Unknown template for ${WEBSITE_TARGET}: ${id}`,\n \"\",\n `Available templates for ${WEBSITE_TARGET}:`,\n formatRegistryListing(templates, `${WEBSITE_TARGET} templates`),\n \"\",\n `Example:`,\n ` ${WEBSITE_USAGE_COMMAND} --template ${\n templates[0]?.id ?? \"<template-id>\"\n } --prompt \"...\"`,\n ].join(\"\\n\");\n return new Error(message);\n}\n\nexport const websiteCommand = new Command()\n .name(\"website\")\n .description(\"Prepare website authoring instructions from a prompt\")\n .option(\"--prompt <text>\", \"Website prompt; can also be piped via stdin\")\n .option(\"--site-slug <slug>\", \"Hosted site slug override\")\n .option(\"--title <text>\", \"Requested site title or name\")\n .option(\n \"--design-system <id>\",\n \"Design system id from the registry (see Design Systems below). Accepts either 'apple' or 'design-system:apple'.\",\n )\n .option(\n \"--template <id>\",\n \"Template id from the registry, scoped to website (see Templates below). Accepts either short id or full 'template:<id>'.\",\n )\n .addHelpText(\"after\", () => {\n const designSystems = listDesignSystems();\n const templates = listTemplates(WEBSITE_TARGET);\n return `\nExamples:\n Generate site: zero generate website --prompt \"A launch site for a developer observability tool\"\n Pick template: zero generate website --template saas-landing --prompt \"Launch site for a billing API\"\n Pick design system: zero generate website --design-system stripe --prompt \"Pricing page for a SaaS\"\n Custom site slug: zero generate website --site-slug api-migration-demo --prompt \"An internal migration microsite\"\n Pipe prompt: cat brief.txt | zero generate website\n Show choices: zero generate website\n\nOutput:\n Prints a source-selection packet for the current agent.\n With no --prompt and no piped input, prints the generation choices instead.\n\nNotes:\n - Authenticates via ZERO_TOKEN\n - The agent authors the HTML artifact and hosts it with zero host\n\nDesign Systems:\n${formatRegistryListing(designSystems, \"design systems\")}\n\nTemplates (website):\n${formatRegistryListing(templates, \"website templates\")}`;\n })\n .action(\n withErrorHandler(async (options: WebsiteOptions) => {\n const dispatch = await dispatchGenerate({\n generationType: \"website\",\n prompt: options.prompt,\n });\n if (dispatch.outcome === \"handled\") return;\n const prompt = dispatch.prompt;\n\n let resolvedDesignSystem;\n if (options.designSystem !== undefined) {\n const canonical = canonicalizeRegistryId(\n \"design-system\",\n options.designSystem,\n );\n const entry = findDesignSystem(canonical);\n if (!entry) {\n throw unknownDesignSystemError(options.designSystem);\n }\n resolvedDesignSystem = entry;\n }\n\n let resolvedTemplate;\n if (options.template !== undefined) {\n const canonical = canonicalizeRegistryId(\"template\", options.template);\n const entry = findTemplate(canonical);\n if (!entry || !entry.targets?.includes(WEBSITE_TARGET)) {\n throw unknownTemplateError(options.template);\n }\n resolvedTemplate = entry;\n }\n\n const packet = createHtmlArtifactAuthoringPacket({\n kind: \"website\",\n prompt,\n slugSource: options.title,\n siteSlug: options.siteSlug,\n details: [\n `Requested title/site name: ${options.title ?? \"not specified\"}`,\n `Selected design system: ${\n resolvedDesignSystem\n ? `${resolvedDesignSystem.id} (${resolvedDesignSystem.name})`\n : \"agent decides\"\n }`,\n `Selected template: ${\n resolvedTemplate\n ? `${resolvedTemplate.id} (${resolvedTemplate.name})`\n : \"agent decides\"\n }`,\n ],\n artifactRules: [\n \"Build the usable website as the first screen; do not output a landing-page plan.\",\n \"If it is a marketing site, make the product or offer visible in the first viewport.\",\n \"For app or tool surfaces, prioritize dense, scannable, task-focused UI over decorative sections.\",\n \"Use responsive HTML/CSS and verify the page works at mobile and desktop widths.\",\n ],\n });\n\n console.log(packet.instructions);\n }),\n );\n","import { createVoiceGenerateCommand } from \"../shared/voice-generate\";\n\nexport const voiceCommand = createVoiceGenerateCommand({\n name: \"voice\",\n generationType: \"voice\",\n usageCommand: \"zero generate voice\",\n examples: ` Generate speech: zero generate voice --prompt \"Hello from vm0\"\n Pipe prompt: cat script.txt | zero generate voice\n Pick a voice: zero generate voice --prompt \"Ship it\" --voice cedar\n List providers: zero generate voice\n Use ElevenLabs: zero generate voice --provider elevenlabs`,\n});\n","import { Command, Option } from \"commander\";\nimport chalk from \"chalk\";\nimport { generateWebVoice } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { dispatchGenerate } from \"../generate/lib/dispatch\";\nimport type { GenerationType } from \"../generate/lib/lister\";\n\ninterface VoiceOptions {\n prompt?: string;\n text?: string;\n provider?: string;\n voice: string;\n instructions?: string;\n all?: boolean;\n}\n\ninterface VoiceGenerateCommandConfig {\n name: string;\n generationType: GenerationType;\n usageCommand: string;\n examples: string;\n}\n\nexport function createVoiceGenerateCommand(\n config: VoiceGenerateCommandConfig,\n): Command {\n return new Command()\n .name(config.name)\n .description(\"Generate a billed speech audio file from text\")\n .option(\"--prompt <text>\", \"Text to speak; can also be piped via stdin\")\n .addOption(new Option(\"--text <text>\", \"Alias for --prompt\").hideHelp())\n .option(\n \"--provider <name>\",\n \"Provider: 'built-in' to run vm0's pipeline, or a connector name (heygen, elevenlabs, ...) to get its skill-invocation guidance\",\n )\n .option(\n \"--all\",\n \"When listing providers (no --prompt given), include unavailable or not-yet-authorized connectors\",\n )\n .option(\"--voice <voice>\", \"OpenAI voice to use\", \"marin\")\n .option(\"--instructions <text>\", \"Voice style instructions\")\n .addHelpText(\n \"after\",\n `\nExamples:\n${config.examples}\n\nOutput:\n Prints the generated /f/ audio file URL and metadata. With no --prompt\n and no piped input, prints the provider menu instead.\n\nNotes:\n - Authenticates via ZERO_TOKEN (requires file:write capability)\n - Charges org credits after successful audio generation\n - Uses gpt-4o-mini-tts with WAV output`,\n )\n .action(\n withErrorHandler(async (options: VoiceOptions) => {\n const dispatch = await dispatchGenerate({\n generationType: config.generationType,\n provider: options.provider,\n prompt: options.prompt ?? options.text,\n all: options.all,\n });\n if (dispatch.outcome === \"handled\") return;\n const text = dispatch.prompt;\n\n const result = await generateWebVoice({\n text,\n voice: options.voice,\n instructions: options.instructions,\n });\n\n console.log(chalk.green(`✓ Voice generated: ${result.url}`));\n console.log(chalk.dim(` File: ${result.filename}`));\n console.log(chalk.dim(` Duration: ${result.durationSeconds}s`));\n console.log(chalk.dim(` Credits charged: ${result.creditsCharged}`));\n console.log(chalk.dim(` Model: ${result.model}`));\n console.log(chalk.dim(` Voice: ${result.voice}`));\n }),\n );\n}\n","import { Command } from \"commander\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { printConnectorGuidance } from \"./lib/connector-guidance\";\nimport { runLister, type GenerationType } from \"./lib/lister\";\n\ninterface ListerOnlyOptions {\n readonly provider?: string;\n readonly all?: boolean;\n}\n\ninterface ListerOnlyConfig {\n readonly name: string;\n readonly generationType: GenerationType;\n readonly description: string;\n}\n\n/**\n * Build a generate subcommand for a type that has no vm0 built-in pipeline.\n * The command lists available connector providers and prints skill-invocation\n * guidance when a --provider is named, but cannot execute on its own.\n */\nexport function createListerOnlyCommand(config: ListerOnlyConfig): Command {\n return new Command()\n .name(config.name)\n .description(config.description)\n .option(\n \"--provider <name>\",\n \"Connector name; prints that connector's skill-invocation guidance\",\n )\n .option(\"--all\", \"Include unavailable or not-yet-authorized connectors\")\n .addHelpText(\n \"after\",\n `\nNotes:\n - vm0 does not provide a built-in ${config.generationType} pipeline.\n - Use --provider <connector-name> to get skill-invocation guidance for a\n specific connector, or run with no flags to see every available provider.`,\n )\n .action(\n withErrorHandler(async (options: ListerOnlyOptions) => {\n const provider = options.provider?.trim();\n if (provider && provider !== \"built-in\") {\n printConnectorGuidance(config.generationType, provider);\n return;\n }\n if (provider === \"built-in\") {\n console.log(\n `vm0 has no built-in ${config.generationType} generation pipeline.`,\n );\n console.log(\"\");\n console.log(\n `Run \"zero generate ${config.generationType}\" to see every connector-backed provider.`,\n );\n return;\n }\n await runLister(config.generationType, {\n all: options.all,\n });\n }),\n );\n}\n","import { Command } from \"commander\";\nimport { downloadFileCommand } from \"./download-file\";\nimport { uploadFileCommand } from \"./upload-file\";\n\nexport const zeroWebCommand = new Command()\n .name(\"web\")\n .description(\"Upload and download files via the web chat endpoint\")\n .addCommand(downloadFileCommand)\n .addCommand(uploadFileCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload a file: zero web upload-file -f /tmp/report.pdf\n Download a file: zero web download-file <file-id> -o /tmp/out.pdf`,\n );\n","import { basename, join } from \"path\";\nimport { tmpdir } from \"os\";\nimport { Command } from \"commander\";\nimport { downloadWebFile } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\n/**\n * Derive a local output path for a web-uploaded file id.\n * Uses the system temp directory.\n *\n * `basename` strips any path separators from `fileId` so a hostile id like\n * `../etc/passwd` cannot escape `tmpdir()`.\n */\nfunction defaultOutPath(fileId: string): string {\n return join(tmpdir(), `web-${basename(fileId)}`);\n}\n\nexport const downloadFileCommand = new Command()\n .name(\"download-file\")\n .description(\"Download a web-uploaded file by id\")\n .argument(\"<file-id>\", \"File id (UUID returned by the upload API)\")\n .option(\n \"-o, --out <path>\",\n \"Output path for the downloaded file (default: /tmp/web-<file-id>)\",\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n Download to default temp path: zero web download-file abc-123-def\n Download to explicit path: zero web download-file abc-123-def -o /tmp/report.pdf\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"path\":\"/tmp/web-abc-123-def\",\"mimetype\":\"application/pdf\",\"size\":12345}\n\nHow to read the downloaded file:\n - Images (png/jpg/gif/webp/svg): open the file path with your image viewing tool\n - Videos (mp4/mov/webm): extract frames first with\n ffmpeg -i <path> -vf \"fps=1\" -q:v 2 /tmp/<file-id>_frame_%03d.jpg\n then view the extracted frames\n - PDF/text/csv/json/markdown: read the file directly\n\nNotes:\n - Authenticates via ZERO_TOKEN\n - Streams the file bytes directly to disk`,\n )\n .action(\n withErrorHandler(async (fileId: string, options: { out?: string }) => {\n const outPath = options.out ?? defaultOutPath(fileId);\n const result = await downloadWebFile(fileId, outPath);\n console.log(JSON.stringify(result));\n }),\n );\n","import { Command } from \"commander\";\nimport { uploadWebFile } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nexport const uploadFileCommand = new Command()\n .name(\"upload-file\")\n .description(\"Upload a local file and print a permanent URL\")\n .requiredOption(\"-f, --file <path>\", \"Local file path to upload\")\n .option(\"--content-type <mime>\", \"Override inferred content type\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload a file: zero web upload-file -f /tmp/report.pdf\n Override content-type: zero web upload-file -f /tmp/data --content-type text/csv\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"id\":\"...\",\"filename\":\"...\",\"contentType\":\"...\",\"size\":N,\"url\":\"https://...\"}\n\nNotes:\n - Authenticates via ZERO_TOKEN (requires file:write capability)\n - Returned URL is permanent (serves a short-lived signed redirect on access)\n - Safe to persist in chat messages or share over external channels\n - Max file size: 1 GB\n - Allowed image types: png / jpeg / gif / webp / avif / svg / bmp / heic / heif / tiff / psd\n - Allowed video types: mp4 / webm / mov\n - Allowed audio types: aac / flac / m4a / mp3 / mp4 / mpga / ogg / opus / wav / webm\n - Allowed document/text types: pdf / txt / csv / tsv / md / html / json / xml / yaml / doc(x/m) / xls(x/m/b) / ppt(x/m) / odt / ods / odp / rtf\n - Allowed archive/data/design types: zip / rar / 7z / tar / gz / tgz / bz2 / xz / pages / numbers / key / parquet / sqlite / epub / ai\n - Use --content-type for ambiguous extensions like .mp4 or .webm when needed`,\n )\n .action(\n withErrorHandler(\n async (options: { file: string; contentType?: string }) => {\n const result = await uploadWebFile(options.file, {\n contentType: options.contentType,\n });\n console.log(JSON.stringify(result));\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { publishStaticSite } from \"../../../lib/host/publish-static-site\";\n\ninterface HostOptions {\n readonly site: string;\n readonly slugSuffix?: string;\n readonly spa?: boolean;\n readonly json?: boolean;\n}\n\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\nexport const zeroHostCommand = new Command()\n .name(\"host\")\n .description(\"Publish a built static site and print its public URL\")\n .argument(\"<dir>\", \"Static build directory, for example ./dist\")\n .requiredOption(\"--site <slug>\", \"Public site slug, e.g. my-product-demo\")\n .option(\"--slug-suffix <suffix>\", \"Reuse a generated site URL suffix\")\n .option(\"--spa\", \"Serve unknown HTML navigation paths from index.html\")\n .option(\"--json\", \"Output only the final result as JSON\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Publish a Vite build: zero host ./dist --site my-product-demo --spa\n Redeploy a URL: zero host ./dist --site my-product-demo --slug-suffix a1b2c3d4 --spa\n Machine readable: zero host ./dist --site my-product-demo --spa --json\n\nNotes:\n - Authenticates via ZERO_TOKEN (requires host:write capability)\n - Reusing both --site and --slug-suffix keeps the same URL\n - The directory must include index.html\n - Local HTML/CSS asset references must point at files inside the directory`,\n )\n .action(\n withErrorHandler(async (dir: string, options: HostOptions) => {\n const result = await publishStaticSite({\n dir,\n site: options.site,\n slugSuffix: options.slugSuffix,\n spaFallback: Boolean(options.spa),\n onProgress: options.json\n ? undefined\n : (progress) => {\n if (progress.phase === \"preparing\") {\n console.log(\n chalk.dim(`Preparing ${progress.fileCount} files...`),\n );\n return;\n }\n console.log(chalk.dim(`Uploading ${progress.path}`));\n },\n });\n\n if (options.json) {\n console.log(JSON.stringify(result));\n return;\n }\n\n console.log(chalk.green(\"✓ Hosted site ready\"));\n console.log(chalk.dim(` Site: ${result.publicSlug}`));\n console.log(chalk.dim(` Deployment: ${result.deploymentId}`));\n console.log(chalk.dim(` Files: ${result.fileCount.toLocaleString()}`));\n console.log(chalk.dim(` Size: ${formatBytes(result.size)}`));\n console.log(` URL: ${result.url}`);\n }),\n );\n","import { readFile } from \"node:fs/promises\";\n\nimport { completeHostedSite, prepareHostedSite } from \"../api\";\nimport { scanStaticSite } from \"./static-site\";\n\ninterface PublishStaticSiteProgress {\n readonly phase: \"preparing\" | \"uploading\";\n readonly fileCount?: number;\n readonly path?: string;\n}\n\ninterface PublishStaticSiteResult {\n readonly siteId: string;\n readonly deploymentId: string;\n readonly publicSlug: string;\n readonly url: string;\n readonly fileCount: number;\n readonly size: number;\n}\n\ninterface PublishStaticSiteOptions {\n readonly dir: string;\n readonly site: string;\n readonly slugSuffix?: string;\n readonly spaFallback?: boolean;\n readonly onProgress?: (progress: PublishStaticSiteProgress) => void;\n}\n\nexport async function publishStaticSite(\n options: PublishStaticSiteOptions,\n): Promise<PublishStaticSiteResult> {\n const scan = await scanStaticSite(options.dir);\n const totalSize = scan.files.reduce((sum, file) => {\n return sum + file.size;\n }, 0);\n\n options.onProgress?.({\n phase: \"preparing\",\n fileCount: scan.files.length,\n });\n\n const prepared = await prepareHostedSite({\n site: options.site,\n ...(options.slugSuffix !== undefined && { slugSuffix: options.slugSuffix }),\n spaFallback: Boolean(options.spaFallback),\n files: scan.files.map((file) => {\n return {\n path: file.path,\n size: file.size,\n sha256: file.sha256,\n contentType: file.contentType,\n immutable: file.immutable,\n };\n }),\n });\n\n const uploadByPath = new Map(\n prepared.uploads.map((upload) => {\n return [upload.path, upload.uploadUrl];\n }),\n );\n\n for (const file of scan.files) {\n const uploadUrl = uploadByPath.get(file.path);\n if (!uploadUrl) {\n throw new Error(`Missing upload URL for ${file.path}`);\n }\n options.onProgress?.({ phase: \"uploading\", path: file.path });\n const bytes = await readFile(file.absolutePath);\n const response = await fetch(uploadUrl, {\n method: \"PUT\",\n headers: { \"Content-Type\": file.contentType },\n body: new Uint8Array(bytes),\n });\n if (!response.ok) {\n throw new Error(\n `Failed to upload ${file.path} (HTTP ${response.status})`,\n );\n }\n }\n\n const completed = await completeHostedSite(prepared.deploymentId);\n\n return {\n siteId: completed.siteId,\n deploymentId: completed.deploymentId,\n publicSlug: completed.publicSlug,\n url: completed.url,\n fileCount: scan.files.length,\n size: totalSize,\n };\n}\n","import { createHash } from \"node:crypto\";\nimport { readdir, readFile, stat } from \"node:fs/promises\";\nimport { extname, relative, resolve, sep, dirname, posix } from \"node:path\";\n\ninterface StaticSiteFile {\n readonly absolutePath: string;\n readonly path: string;\n readonly size: number;\n readonly sha256: string;\n readonly contentType: string;\n readonly immutable?: boolean;\n}\n\ninterface StaticSiteScanResult {\n readonly root: string;\n readonly files: readonly StaticSiteFile[];\n}\n\nconst MIME_BY_EXTENSION: Record<string, string> = {\n \".html\": \"text/html; charset=utf-8\",\n \".htm\": \"text/html; charset=utf-8\",\n \".css\": \"text/css; charset=utf-8\",\n \".js\": \"application/javascript; charset=utf-8\",\n \".mjs\": \"application/javascript; charset=utf-8\",\n \".json\": \"application/json; charset=utf-8\",\n \".map\": \"application/json; charset=utf-8\",\n \".txt\": \"text/plain; charset=utf-8\",\n \".xml\": \"application/xml; charset=utf-8\",\n \".svg\": \"image/svg+xml; charset=utf-8\",\n \".png\": \"image/png\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".gif\": \"image/gif\",\n \".webp\": \"image/webp\",\n \".avif\": \"image/avif\",\n \".ico\": \"image/x-icon\",\n \".wasm\": \"application/wasm\",\n \".woff\": \"font/woff\",\n \".woff2\": \"font/woff2\",\n \".ttf\": \"font/ttf\",\n \".otf\": \"font/otf\",\n \".eot\": \"application/vnd.ms-fontobject\",\n \".mp4\": \"video/mp4\",\n \".webm\": \"video/webm\",\n \".mp3\": \"audio/mpeg\",\n \".wav\": \"audio/wav\",\n};\n\nconst HTML_REFERENCE_RE =\n /<(?:script|link|img|source|video|audio|embed|object)\\b[^>]*\\s(?:src|href|poster|data)=[\"']([^\"']+)[\"'][^>]*>/giu;\nconst SRCSET_RE = /\\s(?:srcset)=[\"']([^\"']+)[\"']/giu;\nconst CSS_URL_RE = /url\\(\\s*[\"']?([^\"')]+)[\"']?\\s*\\)/giu;\nconst CSS_IMPORT_RE = /@import\\s+(?:url\\()?[\"']([^\"']+)[\"']\\)?/giu;\n\nfunction inferContentType(path: string): string {\n return (\n MIME_BY_EXTENSION[extname(path).toLowerCase()] ?? \"application/octet-stream\"\n );\n}\n\nfunction looksImmutable(path: string): boolean {\n if (path.startsWith(\"/assets/\")) {\n return true;\n }\n return /(?:[-.])[A-Za-z0-9_-]{8,}\\.[A-Za-z0-9]+$/u.test(path);\n}\n\nfunction toSitePath(root: string, absolutePath: string): string {\n const rel = relative(root, absolutePath).split(sep).join(\"/\");\n return `/${rel}`;\n}\n\nfunction isSafeSitePath(path: string): boolean {\n if (!path.startsWith(\"/\") || path.startsWith(\"//\")) {\n return false;\n }\n if (path.includes(\"\\\\\") || path.includes(\"\\0\")) {\n return false;\n }\n const segments = path.split(\"/\").filter(Boolean);\n return !segments.some((segment) => {\n return segment === \".\" || segment === \"..\";\n });\n}\n\nfunction isExternalReference(value: string): boolean {\n return /^(?:[a-z][a-z0-9+.-]*:|\\/\\/|#)/iu.test(value);\n}\n\nfunction stripQueryAndHash(value: string): string {\n const hashIndex = value.indexOf(\"#\");\n const withoutHash = hashIndex >= 0 ? value.slice(0, hashIndex) : value;\n const queryIndex = withoutHash.indexOf(\"?\");\n return queryIndex >= 0 ? withoutHash.slice(0, queryIndex) : withoutHash;\n}\n\nfunction normalizeReference(fromPath: string, raw: string): string | null {\n const trimmed = raw.trim();\n if (!trimmed || isExternalReference(trimmed)) {\n return null;\n }\n const stripped = stripQueryAndHash(trimmed);\n if (!stripped || stripped.endsWith(\"/\")) {\n return null;\n }\n const resolved = stripped.startsWith(\"/\")\n ? posix.normalize(stripped)\n : posix.normalize(posix.join(dirname(fromPath), stripped));\n const path = resolved.startsWith(\"/\") ? resolved : `/${resolved}`;\n if (!isSafeSitePath(path)) {\n throw new Error(`Invalid asset reference in ${fromPath}: ${raw}`);\n }\n return path;\n}\n\nfunction shouldRequireHtmlReference(path: string): boolean {\n return extname(path).length > 0 || path.startsWith(\"/assets/\");\n}\n\nfunction isHtmlExtension(ext: string): boolean {\n return ext === \".html\" || ext === \".htm\";\n}\n\nfunction shouldValidateReferences(ext: string): boolean {\n return isHtmlExtension(ext) || ext === \".css\";\n}\n\nfunction collectSrcsetReferences(value: string): string[] {\n return value\n .split(\",\")\n .map((entry) => {\n return entry.trim().split(/\\s+/u)[0] ?? \"\";\n })\n .filter(Boolean);\n}\n\nfunction collectHtmlReferences(text: string): string[] {\n const references: string[] = [];\n for (const match of text.matchAll(HTML_REFERENCE_RE)) {\n if (match[1]) references.push(match[1]);\n }\n for (const match of text.matchAll(SRCSET_RE)) {\n if (!match[1]) continue;\n references.push(...collectSrcsetReferences(match[1]));\n }\n return references;\n}\n\nfunction collectCssReferences(text: string): string[] {\n const references: string[] = [];\n for (const match of text.matchAll(CSS_URL_RE)) {\n if (match[1]) references.push(match[1]);\n }\n for (const match of text.matchAll(CSS_IMPORT_RE)) {\n if (match[1]) references.push(match[1]);\n }\n return references;\n}\n\nfunction collectReferences(ext: string, text: string): string[] {\n return isHtmlExtension(ext)\n ? collectHtmlReferences(text)\n : collectCssReferences(text);\n}\n\nasync function hashFile(path: string): Promise<string> {\n const bytes = await readFile(path);\n return createHash(\"sha256\").update(bytes).digest(\"hex\");\n}\n\nasync function walk(\n root: string,\n dir: string,\n files: StaticSiteFile[],\n): Promise<void> {\n const entries = await readdir(dir, { withFileTypes: true });\n for (const entry of entries) {\n const fullPath = resolve(dir, entry.name);\n if (entry.isDirectory()) {\n await walk(root, fullPath, files);\n continue;\n }\n if (!entry.isFile()) {\n throw new Error(`Unsupported file type in hosted site: ${fullPath}`);\n }\n\n const fileStat = await stat(fullPath);\n const path = toSitePath(root, fullPath);\n if (!isSafeSitePath(path)) {\n throw new Error(`Invalid hosted-site path: ${path}`);\n }\n files.push({\n absolutePath: fullPath,\n path,\n size: fileStat.size,\n sha256: await hashFile(fullPath),\n contentType: inferContentType(path),\n immutable: looksImmutable(path) || undefined,\n });\n }\n}\n\nasync function assertReferencesExist(\n files: readonly StaticSiteFile[],\n): Promise<void> {\n const byPath = new Map(\n files.map((file) => {\n return [file.path, file];\n }),\n );\n\n for (const file of files) {\n const ext = extname(file.path).toLowerCase();\n if (!shouldValidateReferences(ext)) {\n continue;\n }\n const text = await readFile(file.absolutePath, \"utf8\");\n const references = collectReferences(ext, text);\n\n for (const reference of references) {\n const normalized = normalizeReference(file.path, reference);\n if (!normalized) {\n continue;\n }\n if (isHtmlExtension(ext) && !shouldRequireHtmlReference(normalized)) {\n continue;\n }\n if (!byPath.has(normalized)) {\n throw new Error(\n `Missing asset referenced by ${file.path}: ${reference}`,\n );\n }\n }\n }\n}\n\nexport async function scanStaticSite(\n rootPath: string,\n): Promise<StaticSiteScanResult> {\n const root = resolve(rootPath);\n const rootStat = await stat(root);\n if (!rootStat.isDirectory()) {\n throw new Error(`Hosted site path must be a directory: ${rootPath}`);\n }\n\n const files: StaticSiteFile[] = [];\n await walk(root, root, files);\n\n if (\n !files.some((file) => {\n return file.path === \"/index.html\";\n })\n ) {\n throw new Error(\"Hosted site directory must include index.html\");\n }\n\n await assertReferencesExist(files);\n\n return {\n root,\n files: files.sort((a, b) => {\n return a.path.localeCompare(b.path);\n }),\n };\n}\n","import { Command, InvalidArgumentError } from \"commander\";\nimport chalk from \"chalk\";\nimport { callZeroMaps, type ZeroMapsResponse } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nconst TRAVEL_MODES = [\"driving\", \"walking\", \"bicycling\", \"transit\"] as const;\nconst PLACE_DETAIL_FIELDSETS = [\"essentials\", \"pro\"] as const;\n\ntype TravelMode = (typeof TRAVEL_MODES)[number];\ntype PlaceDetailFieldset = (typeof PLACE_DETAIL_FIELDSETS)[number];\n\ninterface JsonOption {\n json?: boolean;\n}\n\ninterface GeocodeOptions extends JsonOption {\n address: string;\n region?: string;\n}\n\ninterface ReverseGeocodeOptions extends JsonOption {\n lat: number;\n lng: number;\n}\n\ninterface DirectionsOptions extends JsonOption {\n origin: string;\n destination: string;\n mode: TravelMode;\n departureTime?: string;\n}\n\ninterface PlacesSearchOptions extends JsonOption {\n query: string;\n location?: string;\n radius?: number;\n limit: number;\n region?: string;\n}\n\ninterface PlacesDetailsOptions extends JsonOption {\n placeId: string;\n fields: PlaceDetailFieldset;\n}\n\nfunction parseLatitude(value: string): number {\n const latitude = Number(value);\n if (!Number.isFinite(latitude) || latitude < -90 || latitude > 90) {\n throw new InvalidArgumentError(\"latitude must be a number from -90 to 90\");\n }\n return latitude;\n}\n\nfunction parseLongitude(value: string): number {\n const longitude = Number(value);\n if (!Number.isFinite(longitude) || longitude < -180 || longitude > 180) {\n throw new InvalidArgumentError(\n \"longitude must be a number from -180 to 180\",\n );\n }\n return longitude;\n}\n\nfunction parsePositiveInteger(value: string): number {\n const parsed = Number(value);\n if (!Number.isInteger(parsed) || parsed < 1) {\n throw new InvalidArgumentError(\"value must be a positive integer\");\n }\n return parsed;\n}\n\nfunction parseLimit(value: string): number {\n const limit = parsePositiveInteger(value);\n if (limit > 20) {\n throw new InvalidArgumentError(\"limit must be between 1 and 20\");\n }\n return limit;\n}\n\nfunction parseTravelMode(value: string): TravelMode {\n if (TRAVEL_MODES.includes(value as TravelMode)) {\n return value as TravelMode;\n }\n throw new InvalidArgumentError(\n `mode must be one of: ${TRAVEL_MODES.join(\", \")}`,\n );\n}\n\nfunction parsePlaceDetailFields(value: string): PlaceDetailFieldset {\n if (PLACE_DETAIL_FIELDSETS.includes(value as PlaceDetailFieldset)) {\n return value as PlaceDetailFieldset;\n }\n throw new InvalidArgumentError(\n `fields must be one of: ${PLACE_DETAIL_FIELDSETS.join(\", \")}`,\n );\n}\n\nfunction renderMapsResponse(label: string, response: ZeroMapsResponse): void {\n console.log(chalk.green(`✓ ${label}`));\n if (response.provider) {\n console.log(chalk.dim(` Provider: ${response.provider}`));\n }\n if (response.billingCategory) {\n console.log(chalk.dim(` Billing category: ${response.billingCategory}`));\n }\n if (response.billingQuantity !== undefined) {\n console.log(chalk.dim(` Billing quantity: ${response.billingQuantity}`));\n }\n if (response.creditsCharged !== undefined) {\n console.log(chalk.dim(` Credits charged: ${response.creditsCharged}`));\n }\n\n const result = response.result ?? response;\n console.log(JSON.stringify(result, null, 2));\n}\n\nasync function runMapsRequest(\n label: string,\n endpoint:\n | \"geocode\"\n | \"reverse-geocode\"\n | \"directions\"\n | \"places/search\"\n | \"places/details\",\n payload: Record<string, unknown>,\n options: JsonOption,\n): Promise<void> {\n const response = await callZeroMaps(endpoint, payload);\n\n if (options.json) {\n console.log(JSON.stringify(response));\n return;\n }\n\n renderMapsResponse(label, response);\n}\n\nconst geocodeCommand = new Command()\n .name(\"geocode\")\n .description(\"Convert an address into coordinates\")\n .requiredOption(\"--address <address>\", \"Address to geocode\")\n .option(\"--region <code>\", \"Optional region bias, such as US or CN\")\n .option(\"--json\", \"Print the raw maps response as JSON\")\n .action(\n withErrorHandler(async (options: GeocodeOptions) => {\n await runMapsRequest(\n \"Geocode completed\",\n \"geocode\",\n { address: options.address, region: options.region },\n options,\n );\n }),\n );\n\nconst reverseGeocodeCommand = new Command()\n .name(\"reverse-geocode\")\n .description(\"Convert coordinates into an address\")\n .requiredOption(\"--lat <number>\", \"Latitude\", parseLatitude)\n .requiredOption(\"--lng <number>\", \"Longitude\", parseLongitude)\n .option(\"--json\", \"Print the raw maps response as JSON\")\n .action(\n withErrorHandler(async (options: ReverseGeocodeOptions) => {\n await runMapsRequest(\n \"Reverse geocode completed\",\n \"reverse-geocode\",\n { lat: options.lat, lng: options.lng },\n options,\n );\n }),\n );\n\nconst directionsCommand = new Command()\n .name(\"directions\")\n .description(\"Get a route between two places\")\n .requiredOption(\n \"--origin <place>\",\n \"Origin address, coordinates, or place ID\",\n )\n .requiredOption(\n \"--destination <place>\",\n \"Destination address, coordinates, or place ID\",\n )\n .option(\n \"--mode <mode>\",\n \"Travel mode: driving, walking, bicycling, or transit\",\n parseTravelMode,\n \"driving\",\n )\n .option(\"--departure-time <time>\", \"ISO departure time or provider keyword\")\n .option(\"--json\", \"Print the raw maps response as JSON\")\n .action(\n withErrorHandler(async (options: DirectionsOptions) => {\n await runMapsRequest(\n \"Directions completed\",\n \"directions\",\n {\n origin: options.origin,\n destination: options.destination,\n mode: options.mode,\n departureTime: options.departureTime,\n },\n options,\n );\n }),\n );\n\nconst placesSearchCommand = new Command()\n .name(\"search\")\n .description(\"Search for places\")\n .requiredOption(\"--query <query>\", \"Place search query\")\n .option(\"--location <lat,lng>\", \"Optional location bias\")\n .option(\n \"--radius <meters>\",\n \"Optional search radius in meters\",\n parsePositiveInteger,\n )\n .option(\n \"--limit <n>\",\n \"Maximum places to return, from 1 to 20\",\n parseLimit,\n 5,\n )\n .option(\"--region <code>\", \"Optional region bias, such as US or CN\")\n .option(\"--json\", \"Print the raw maps response as JSON\")\n .action(\n withErrorHandler(async (options: PlacesSearchOptions) => {\n await runMapsRequest(\n \"Places search completed\",\n \"places/search\",\n {\n query: options.query,\n location: options.location,\n radius: options.radius,\n limit: options.limit,\n region: options.region,\n },\n options,\n );\n }),\n );\n\nconst placesDetailsCommand = new Command()\n .name(\"details\")\n .description(\"Get details for a place\")\n .requiredOption(\"--place-id <id>\", \"Provider place ID\")\n .option(\n \"--fields <fields>\",\n \"Field set: essentials or pro\",\n parsePlaceDetailFields,\n \"essentials\",\n )\n .option(\"--json\", \"Print the raw maps response as JSON\")\n .action(\n withErrorHandler(async (options: PlacesDetailsOptions) => {\n await runMapsRequest(\n \"Place details completed\",\n \"places/details\",\n { placeId: options.placeId, fields: options.fields },\n options,\n );\n }),\n );\n\nconst placesCommand = new Command()\n .name(\"places\")\n .description(\"Search places and fetch place details\")\n .addCommand(placesSearchCommand)\n .addCommand(placesDetailsCommand);\n\nexport const zeroMapsCommand = new Command()\n .name(\"maps\")\n .description(\"Use managed zero maps services\")\n .addCommand(geocodeCommand)\n .addCommand(reverseGeocodeCommand)\n .addCommand(directionsCommand)\n .addCommand(placesCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Geocode address: zero maps geocode --address \"1 Infinite Loop, Cupertino\" --json\n Get route: zero maps directions --origin \"SFO\" --destination \"Mountain View\" --mode driving --json\n Search places: zero maps places search --query \"coffee near Union Square SF\" --limit 5 --json\n Place details: zero maps places details --place-id <id> --fields essentials --json\n\nNotes:\n - Authenticates via ZERO_TOKEN (requires maps:read capability) or a CLI token\n - Google Maps calls and credit billing happen on the vm0 API server\n - Use --fields essentials for place details unless pro fields are required`,\n );\n","import { Command, InvalidArgumentError } from \"commander\";\nimport chalk from \"chalk\";\n\nimport { callZeroBanking, type ZeroBankingResponse } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\ninterface JsonOption {\n readonly json?: boolean;\n}\n\ninterface BalancesOptions extends JsonOption {\n readonly accountId: string;\n}\n\ninterface TransactionsOptions extends JsonOption {\n readonly accountId: string;\n readonly from: string;\n readonly to: string;\n readonly limit: number;\n}\n\nfunction parseLimit(value: string): number {\n const parsed = Number(value);\n if (!Number.isInteger(parsed) || parsed < 1 || parsed > 1000) {\n throw new InvalidArgumentError(\"limit must be between 1 and 1000\");\n }\n return parsed;\n}\n\nfunction parseDateOnly(value: string): string {\n if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n throw new InvalidArgumentError(\"date must be formatted as YYYY-MM-DD\");\n }\n return value;\n}\n\nfunction renderBankingResponse(\n label: string,\n response: ZeroBankingResponse,\n): void {\n console.log(chalk.green(`✓ ${label}`));\n console.log(chalk.dim(` Provider: ${response.provider}`));\n\n if (response.accounts) {\n console.log(JSON.stringify(response.accounts, null, 2));\n return;\n }\n if (response.balance) {\n console.log(JSON.stringify(response.balance, null, 2));\n return;\n }\n console.log(JSON.stringify(response.transactions ?? [], null, 2));\n}\n\nasync function runBankingRequest(\n label: string,\n operation: \"accounts\" | \"balances\" | \"transactions\",\n payload: Record<string, unknown>,\n options: JsonOption,\n): Promise<void> {\n const response = await callZeroBanking(operation, payload);\n if (options.json) {\n console.log(JSON.stringify(response));\n return;\n }\n renderBankingResponse(label, response);\n}\n\nconst accountsCommand = new Command()\n .name(\"accounts\")\n .description(\"List enabled banking accounts\")\n .option(\"--json\", \"Print the raw banking response as JSON\")\n .action(\n withErrorHandler(async (options: JsonOption) => {\n await runBankingRequest(\n \"Banking accounts loaded\",\n \"accounts\",\n {},\n options,\n );\n }),\n );\n\nconst balancesCommand = new Command()\n .name(\"balances\")\n .description(\"Read an enabled account balance\")\n .requiredOption(\"--account-id <id>\", \"Enabled provider account ID\")\n .option(\"--json\", \"Print the raw banking response as JSON\")\n .action(\n withErrorHandler(async (options: BalancesOptions) => {\n await runBankingRequest(\n \"Banking balance loaded\",\n \"balances\",\n { accountId: options.accountId },\n options,\n );\n }),\n );\n\nconst transactionsCommand = new Command()\n .name(\"transactions\")\n .description(\"Read transactions for an enabled account\")\n .requiredOption(\"--account-id <id>\", \"Enabled provider account ID\")\n .requiredOption(\n \"--from <date>\",\n \"Start date, formatted as YYYY-MM-DD\",\n parseDateOnly,\n )\n .requiredOption(\n \"--to <date>\",\n \"End date, formatted as YYYY-MM-DD\",\n parseDateOnly,\n )\n .option(\"--limit <n>\", \"Maximum transactions to return\", parseLimit, 100)\n .option(\"--json\", \"Print the raw banking response as JSON\")\n .action(\n withErrorHandler(async (options: TransactionsOptions) => {\n await runBankingRequest(\n \"Banking transactions loaded\",\n \"transactions\",\n {\n accountId: options.accountId,\n from: options.from,\n to: options.to,\n limit: options.limit,\n },\n options,\n );\n }),\n );\n\nexport const zeroBankingCommand = new Command()\n .name(\"banking\")\n .description(\"Use managed zero banking services\")\n .addCommand(accountsCommand)\n .addCommand(balancesCommand)\n .addCommand(transactionsCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n List accounts: zero banking accounts --json\n Get balance: zero banking balances --account-id <id> --json\n Get transactions: zero banking transactions --account-id <id> --from 2026-01-01 --to 2026-01-31 --json\n\nNotes:\n - Authenticates via ZERO_TOKEN (requires banking:read capability)\n - Finicity credentials and app tokens stay on the vm0 API server\n - Access is limited to accounts enabled for the current agent`,\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getVm0ModelMultiplier } from \"@vm0/api-contracts/contracts/model-providers\";\nimport { listZeroModelPolicies } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport {\n formatModelPolicyStatus,\n formatModelProviderRoute,\n getModelProviderRouteKind,\n} from \"../../../lib/domain/model-policy-display\";\n\nfunction formatCreditMultiplier(multiplier: number | undefined): string {\n return multiplier === undefined ? \"unknown\" : `x${multiplier}`;\n}\n\nfunction getCurrentIntegration(): string | null {\n const prompt = process.env.VM0_APPEND_SYSTEM_PROMPT;\n if (!prompt) {\n return null;\n }\n\n const match = prompt.match(/You are currently running inside:\\s*([^\\n]+)/i);\n return match?.[1]?.trim().toLowerCase() ?? null;\n}\n\nexport function getModelSwitchGuidance(integration = getCurrentIntegration()) {\n const normalizedIntegration = integration?.toLowerCase();\n\n if (normalizedIntegration === \"web\") {\n return \"Switch models from the model selector next to the input box in the web chat.\";\n }\n\n if (normalizedIntegration === \"telegram\") {\n return \"Use /model in Telegram to switch models.\";\n }\n\n return \"Open https://app.vm0.ai and switch models from the model selector next to the input box.\";\n}\n\nconst listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List models allowed by the current organization\")\n .action(\n withErrorHandler(async () => {\n const result = await listZeroModelPolicies();\n\n if (result.policies.length === 0) {\n console.log(chalk.dim(\"No models are allowed for this organization\"));\n return;\n }\n\n console.log(chalk.bold(\"Allowed Models:\"));\n console.log();\n\n for (const policy of result.policies) {\n const defaultMarker = policy.isDefault ? chalk.dim(\" (default)\") : \"\";\n console.log(\n ` - ${policy.modelLabel} ${chalk.dim(`(${policy.model})`)}${defaultMarker}`,\n );\n console.log(` provider: ${formatModelProviderRoute(policy)}`);\n\n if (getModelProviderRouteKind(policy) === \"built-in\") {\n console.log(\n ` price coefficient: ${formatCreditMultiplier(getVm0ModelMultiplier(policy.model))}`,\n );\n }\n\n const status = formatModelPolicyStatus(policy);\n if (status) {\n console.log(chalk.yellow(` status: ${status}`));\n }\n }\n\n console.log();\n console.log(\n chalk.dim(\n \"Use `zero model-provider set --help` to see how to switch each model between built-in and BYOK.\",\n ),\n );\n }),\n );\n\nexport const switchCommand = new Command()\n .name(\"switch\")\n .description(\"Show how to switch models in the current environment\")\n .action(() => {\n console.log(getModelSwitchGuidance());\n });\n\nexport const zeroModelCommand = new Command()\n .name(\"model\")\n .description(\"List available models and model-switching guidance\")\n .addCommand(listCommand)\n .addCommand(switchCommand);\n","import {\n MODEL_PROVIDER_TYPES,\n type ModelProviderType,\n type OrgModelPolicy,\n} from \"@vm0/api-contracts/contracts/model-providers\";\n\ntype ModelProviderRouteKind = \"built-in\" | \"api key\" | \"subscription\";\n\nexport function getModelProviderRouteKind(\n policy: Pick<OrgModelPolicy, \"credentialScope\" | \"defaultProviderType\">,\n): ModelProviderRouteKind {\n if (policy.defaultProviderType === \"vm0\") {\n return \"built-in\";\n }\n\n if (policy.credentialScope === \"member\") {\n return \"subscription\";\n }\n\n return \"api key\";\n}\n\nexport function getModelProviderTypeLabel(type: ModelProviderType): string {\n return MODEL_PROVIDER_TYPES[type].label;\n}\n\nexport function formatModelProviderRoute(policy: OrgModelPolicy): string {\n const kind = getModelProviderRouteKind(policy);\n const label = getModelProviderTypeLabel(policy.defaultProviderType);\n return `${kind} (${label}; ${policy.defaultProviderType})`;\n}\n\nexport function formatModelPolicyStatus(policy: OrgModelPolicy): string | null {\n if (policy.routeStatus === \"valid\") {\n return null;\n }\n\n return policy.routeStatusReason\n ? `${policy.routeStatus}: ${policy.routeStatusReason}`\n : policy.routeStatus;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroModelPolicies } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport {\n formatModelPolicyStatus,\n getModelProviderRouteKind,\n getModelProviderTypeLabel,\n} from \"../../../lib/domain/model-policy-display\";\n\nexport const MODEL_PROVIDER_SET_GUIDANCE = [\n \"Model provider routing is configured in the web app.\",\n \"\",\n \"Organization admins: open https://app.vm0.ai, use the top-left organization menu, choose Manage, then add, delete, or adjust model providers.\",\n \"\",\n \"If an organization admin sets a model provider to subscription, members must use the bottom-left user menu, choose Preferences / Personal Models, and connect their personal subscription.\",\n].join(\"\\n\");\n\nconst listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\n \"List provider routing for each model allowed by the organization\",\n )\n .action(\n withErrorHandler(async () => {\n const result = await listZeroModelPolicies();\n\n if (result.policies.length === 0) {\n console.log(\n chalk.dim(\n \"No model provider routes are allowed for this organization\",\n ),\n );\n return;\n }\n\n console.log(chalk.bold(\"Model Provider Routes:\"));\n console.log();\n\n for (const policy of result.policies) {\n const defaultMarker = policy.isDefault ? chalk.dim(\" (default)\") : \"\";\n console.log(\n ` - ${policy.modelLabel} ${chalk.dim(`(${policy.model})`)}${defaultMarker}`,\n );\n console.log(` provider: ${getModelProviderRouteKind(policy)}`);\n console.log(\n ` provider type: ${policy.defaultProviderType} (${getModelProviderTypeLabel(policy.defaultProviderType)})`,\n );\n\n const status = formatModelPolicyStatus(policy);\n if (status) {\n console.log(chalk.yellow(` status: ${status}`));\n }\n }\n }),\n );\n\nexport const setCommand = new Command()\n .name(\"set\")\n .description(\"Show where to adjust model provider routing\")\n .addHelpText(\"after\", `\\n${MODEL_PROVIDER_SET_GUIDANCE}`)\n .action(() => {\n console.log(MODEL_PROVIDER_SET_GUIDANCE);\n });\n\nexport const zeroModelProviderCommand = new Command()\n .name(\"model-provider\")\n .description(\"Inspect model provider routing\")\n .addCommand(listCommand)\n .addCommand(setCommand);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;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S,qBACd,MACA,UACM;AACN,QAAM,QAAQ,QAAQ,IAAI;AAC1B,QAAM,UAAU,QAAQ,uBAAuB,KAAK,IAAI;AAExD,aAAW,OAAO,YAAY,kBAAkB;AAC9C,UAAM,SAAS,kBAAkB,IAAI,KAAK,GAAG,OAAO;AACpD,SAAK,WAAW,KAAK,SAAS,EAAE,QAAQ,KAAK,IAAI,CAAC,CAAC;AAAA,EACrD;AACF;AAEA,IAAM,UAAU,IAAI,QAAQ;AAI5B,QACG,KAAK,MAAM,EACX;AAAA,EACC;AACF,EACC,QAAQ,SAAe,EACvB,YAAY,SAAS,MAAM;AAC1B,SAAO,kBAAkB;AAC3B,CAAC;AAIH,IACE,QAAQ,KAAK,CAAC,GAAG,SAAS,SAAS,KACnC,QAAQ,KAAK,CAAC,GAAG,SAAS,SAAS,KACnC,QAAQ,KAAK,CAAC,GAAG,SAAS,MAAM,GAChC;AACA,8BAA4B;AAC5B,uBAAqB,OAAO;AAC5B,UAAQ,MAAM;AAChB;","names":["listCommand","setCommand","removeCommand","listCommand","setCommand","removeCommand","listCommand","setCommand","removeCommand","listCommand","setCommand","removeCommand","setupCommand","listCommand","import_prompts","prompts","type","config","prompts","options","removeCommand","readFileSync","readFileSync","listCommand","deleteCommand","listCommand","deleteCommand","authMethod","listCommand","isConnectorType","relative","isConnectorType","statusCommand","available","listCommand","statusCommand","isConnectorType","detectTimezone","resolve","readFileSync","day","readFileSync","setupCommand","listCommand","statusCommand","deleteCommand","setupCommand","listCommand","statusCommand","deleteCommand","listCommand","setCommand","deleteCommand","listCommand","setCommand","deleteCommand","readFileSync","readFileSync","listCommand","createCommand","deleteCommand","readFileSync","basename","stat","basename","readFileSync","readFileSync","sendCommand","readFileSync","sendCommand","statSync","readFileSync","basename","uploadFileCommand","stat","statSync","basename","readFileSync","basename","join","tmpdir","defaultOutPath","join","tmpdir","basename","downloadFileCommand","uploadFileCommand","downloadFileCommand","listCommand","listCommand","basename","join","tmpdir","defaultOutPath","join","tmpdir","basename","downloadFileCommand","readFileSync","sendCommand","readFileSync","sendCommand","readFileSync","statSync","basename","extname","MIME_BY_EXTENSION","inferContentType","extname","uploadFileCommand","stat","statSync","basename","readFileSync","downloadFileCommand","uploadFileCommand","basename","join","tmpdir","defaultOutPath","join","tmpdir","basename","downloadFileCommand","readFileSync","readFileSync","readFileSync","statSync","basename","extname","MIME_BY_EXTENSION","inferContentType","extname","uploadFileCommand","stat","statSync","basename","readFileSync","downloadFileCommand","uploadFileCommand","truncateValue","listCommand","setCommand","deleteCommand","listCommand","setCommand","deleteCommand","formatConnectorIdentity","unknownIcon","readFileSync","join","walk","createCommand","editCommand","viewCommand","listCommand","deleteCommand","createCommand","editCommand","viewCommand","listCommand","deleteCommand","listCommand","parseLimit","searchCommand","listCommand","searchCommand","SEVEN_DAYS_MS","parseContextOptions","parseLimit","join","sleep","resolve","parsePositiveInteger","join","readFileSync","isConnectorType","isConnectorType","readFileSync","outputDir","unknownDesignSystemError","unknownTemplateError","outputDir","slugify","parseSeed","unknownDesignSystemError","unknownTemplateError","basename","join","tmpdir","defaultOutPath","join","tmpdir","basename","downloadFileCommand","uploadFileCommand","downloadFileCommand","uploadFileCommand","readFile","extname","MIME_BY_EXTENSION","inferContentType","readFile","parsePositiveInteger","parseLimit","parseLimit","listCommand","listCommand","setCommand"]}
|