@vm0/cli 9.270.1 → 9.271.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/{agent-KVO2AHTE.js → agent-O4PIZ7NO.js} +6 -6
  2. package/{banking-6JBGRQZ2.js → banking-K3T7FGVL.js} +4 -4
  3. package/{browser-6AAL6Z2G.js → browser-ZUXV2DZI.js} +4 -4
  4. package/{chat-PN7A2MC4.js → chat-FQ65YTRM.js} +5 -5
  5. package/{chunk-TRGD5ZVE.js → chunk-CCUKVMAH.js} +2 -2
  6. package/{chunk-LRNTCZW5.js → chunk-D7TEG7WN.js} +2 -2
  7. package/{chunk-XBAPAKU7.js → chunk-EINTZ5MX.js} +13 -5
  8. package/chunk-EINTZ5MX.js.map +1 -0
  9. package/{chunk-6APTUGDE.js → chunk-JXUQQIUP.js} +12 -4
  10. package/chunk-JXUQQIUP.js.map +1 -0
  11. package/{chunk-VD3OZARF.js → chunk-MOWAU52B.js} +2 -2
  12. package/{chunk-DVGDO4XK.js → chunk-RFTCX5UZ.js} +2 -2
  13. package/{chunk-TIFCWQ2H.js → chunk-TC7IZRA2.js} +2 -2
  14. package/{chunk-NZHREXMF.js → chunk-TM6A5MNI.js} +1 -11
  15. package/{chunk-NZHREXMF.js.map → chunk-TM6A5MNI.js.map} +1 -1
  16. package/{chunk-IRYWZDHD.js → chunk-TZDXFY6G.js} +289 -396
  17. package/chunk-TZDXFY6G.js.map +1 -0
  18. package/{chunk-ZAE7DA72.js → chunk-VSL4HRIA.js} +2 -2
  19. package/{chunk-XNBEOZ72.js → chunk-X7YXT2UE.js} +14 -9
  20. package/chunk-X7YXT2UE.js.map +1 -0
  21. package/{computer-use-RL4LFXTU.js → computer-use-LAD5XLHX.js} +4 -4
  22. package/{connector-65CXKHFD.js → connector-AVTEZ5M4.js} +7 -7
  23. package/{credit-BATZHIJM.js → credit-I45PC4IZ.js} +5 -5
  24. package/{developer-support-HC57MCE5.js → developer-support-HG2427DE.js} +4 -4
  25. package/{doctor-CZTLPLHN.js → doctor-NEF5PDLF.js} +5 -5
  26. package/{feishu-N4TRYP4I.js → feishu-C7TLUZNW.js} +10 -6
  27. package/{feishu-N4TRYP4I.js.map → feishu-C7TLUZNW.js.map} +1 -1
  28. package/{finance-AXTNCFO2.js → finance-QRINPXNY.js} +4 -4
  29. package/{generate-2WUDNC2R.js → generate-OR4TSIMU.js} +6 -6
  30. package/{github-Z3ZI2RYC.js → github-B6FLS3YK.js} +10 -6
  31. package/{github-Z3ZI2RYC.js.map → github-B6FLS3YK.js.map} +1 -1
  32. package/{goal-PZTLMPFS.js → goal-QXSEQGAT.js} +4 -4
  33. package/{host-7IU7PNIP.js → host-4TKBODTL.js} +4 -4
  34. package/{logs-DEQEA2ZP.js → logs-WBT4C34D.js} +7 -7
  35. package/{mail-VRSTZSXB.js → mail-GVDB4DW2.js} +6 -6
  36. package/{maps-AV5OEWNN.js → maps-7PWULA7U.js} +4 -4
  37. package/{model-GHSABQLU.js → model-54YGVJAR.js} +5 -5
  38. package/{model-provider-HJWYN6GP.js → model-provider-ZPDGFYK3.js} +5 -5
  39. package/{org-YKYRZPQI.js → org-4IZEIH7U.js} +4 -4
  40. package/package.json +1 -1
  41. package/{people-search-4OQEQRVD.js → people-search-3MYEUXPL.js} +4 -4
  42. package/{phone-6KIDS46N.js → phone-374WD72N.js} +10 -6
  43. package/{phone-6KIDS46N.js.map → phone-374WD72N.js.map} +1 -1
  44. package/{preference-BQVHQ6QD.js → preference-6MJRMHWU.js} +4 -4
  45. package/{resource-GB6GNOG4.js → resource-LHAF45BR.js} +5 -5
  46. package/{scrape-GG3RREIS.js → scrape-IWNRA5Y6.js} +4 -4
  47. package/{search-GHER6HN2.js → search-D65TMXEQ.js} +7 -7
  48. package/{secret-LCXB3H4Z.js → secret-HCD3ZCX2.js} +4 -4
  49. package/{slack-OIZNRNOX.js → slack-R4LKBTX6.js} +9 -5
  50. package/slack-R4LKBTX6.js.map +1 -0
  51. package/{teams-LGUWTNHC.js → teams-3JJJ2G3A.js} +10 -6
  52. package/{teams-LGUWTNHC.js.map → teams-3JJJ2G3A.js.map} +1 -1
  53. package/{telegram-TKRKSM3A.js → telegram-2E2UM67J.js} +10 -6
  54. package/{telegram-TKRKSM3A.js.map → telegram-2E2UM67J.js.map} +1 -1
  55. package/{upgrade-MJNLJUGT.js → upgrade-J6FYUUYV.js} +3 -3
  56. package/{variable-ET7USLRD.js → variable-YXJ6NH3N.js} +4 -4
  57. package/{video-AGASRAND.js → video-GYS2CSQF.js} +3 -3
  58. package/{weather-HHZJCP3Y.js → weather-N5IWRZPG.js} +4 -4
  59. package/{web-XUTUHLJZ.js → web-LPR6C2K7.js} +4 -4
  60. package/{web-search-UTGH6NH5.js → web-search-BT6BDI5E.js} +4 -4
  61. package/{whoami-EIGE5O6D.js → whoami-YV26HEXS.js} +6 -6
  62. package/{workflow-IC64RX7P.js → workflow-T2R3IE2A.js} +5 -5
  63. package/zero.js +43 -43
  64. package/chunk-6APTUGDE.js.map +0 -1
  65. package/chunk-IRYWZDHD.js.map +0 -1
  66. package/chunk-XBAPAKU7.js.map +0 -1
  67. package/chunk-XNBEOZ72.js.map +0 -1
  68. package/slack-OIZNRNOX.js.map +0 -1
  69. /package/{agent-KVO2AHTE.js.map → agent-O4PIZ7NO.js.map} +0 -0
  70. /package/{banking-6JBGRQZ2.js.map → banking-K3T7FGVL.js.map} +0 -0
  71. /package/{browser-6AAL6Z2G.js.map → browser-ZUXV2DZI.js.map} +0 -0
  72. /package/{chat-PN7A2MC4.js.map → chat-FQ65YTRM.js.map} +0 -0
  73. /package/{chunk-TRGD5ZVE.js.map → chunk-CCUKVMAH.js.map} +0 -0
  74. /package/{chunk-LRNTCZW5.js.map → chunk-D7TEG7WN.js.map} +0 -0
  75. /package/{chunk-VD3OZARF.js.map → chunk-MOWAU52B.js.map} +0 -0
  76. /package/{chunk-DVGDO4XK.js.map → chunk-RFTCX5UZ.js.map} +0 -0
  77. /package/{chunk-TIFCWQ2H.js.map → chunk-TC7IZRA2.js.map} +0 -0
  78. /package/{chunk-ZAE7DA72.js.map → chunk-VSL4HRIA.js.map} +0 -0
  79. /package/{computer-use-RL4LFXTU.js.map → computer-use-LAD5XLHX.js.map} +0 -0
  80. /package/{connector-65CXKHFD.js.map → connector-AVTEZ5M4.js.map} +0 -0
  81. /package/{credit-BATZHIJM.js.map → credit-I45PC4IZ.js.map} +0 -0
  82. /package/{developer-support-HC57MCE5.js.map → developer-support-HG2427DE.js.map} +0 -0
  83. /package/{doctor-CZTLPLHN.js.map → doctor-NEF5PDLF.js.map} +0 -0
  84. /package/{finance-AXTNCFO2.js.map → finance-QRINPXNY.js.map} +0 -0
  85. /package/{generate-2WUDNC2R.js.map → generate-OR4TSIMU.js.map} +0 -0
  86. /package/{goal-PZTLMPFS.js.map → goal-QXSEQGAT.js.map} +0 -0
  87. /package/{host-7IU7PNIP.js.map → host-4TKBODTL.js.map} +0 -0
  88. /package/{logs-DEQEA2ZP.js.map → logs-WBT4C34D.js.map} +0 -0
  89. /package/{mail-VRSTZSXB.js.map → mail-GVDB4DW2.js.map} +0 -0
  90. /package/{maps-AV5OEWNN.js.map → maps-7PWULA7U.js.map} +0 -0
  91. /package/{model-GHSABQLU.js.map → model-54YGVJAR.js.map} +0 -0
  92. /package/{model-provider-HJWYN6GP.js.map → model-provider-ZPDGFYK3.js.map} +0 -0
  93. /package/{org-YKYRZPQI.js.map → org-4IZEIH7U.js.map} +0 -0
  94. /package/{people-search-4OQEQRVD.js.map → people-search-3MYEUXPL.js.map} +0 -0
  95. /package/{preference-BQVHQ6QD.js.map → preference-6MJRMHWU.js.map} +0 -0
  96. /package/{resource-GB6GNOG4.js.map → resource-LHAF45BR.js.map} +0 -0
  97. /package/{scrape-GG3RREIS.js.map → scrape-IWNRA5Y6.js.map} +0 -0
  98. /package/{search-GHER6HN2.js.map → search-D65TMXEQ.js.map} +0 -0
  99. /package/{secret-LCXB3H4Z.js.map → secret-HCD3ZCX2.js.map} +0 -0
  100. /package/{upgrade-MJNLJUGT.js.map → upgrade-J6FYUUYV.js.map} +0 -0
  101. /package/{variable-ET7USLRD.js.map → variable-YXJ6NH3N.js.map} +0 -0
  102. /package/{video-AGASRAND.js.map → video-GYS2CSQF.js.map} +0 -0
  103. /package/{weather-HHZJCP3Y.js.map → weather-N5IWRZPG.js.map} +0 -0
  104. /package/{web-XUTUHLJZ.js.map → web-LPR6C2K7.js.map} +0 -0
  105. /package/{web-search-UTGH6NH5.js.map → web-search-BT6BDI5E.js.map} +0 -0
  106. /package/{whoami-EIGE5O6D.js.map → whoami-YV26HEXS.js.map} +0 -0
  107. /package/{workflow-IC64RX7P.js.map → workflow-T2R3IE2A.js.map} +0 -0
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  UNKNOWN_PERMISSION_GRANT,
6
6
  getZeroConnectorCatalogPermissions
7
- } from "./chunk-IRYWZDHD.js";
7
+ } from "./chunk-TZDXFY6G.js";
8
8
  import {
9
9
  init_esm_shims
10
10
  } from "./chunk-GPYQ24DR.js";
@@ -216,4 +216,4 @@ export {
216
216
  connectorPermissionGrantsToFirewallPolicies,
217
217
  hasConnectorFirewallMetadataPermission
218
218
  };
219
- //# sourceMappingURL=chunk-ZAE7DA72.js.map
219
+ //# sourceMappingURL=chunk-VSL4HRIA.js.map
@@ -342,6 +342,12 @@ var FEATURE_SWITCHES = {
342
342
  enabled: false,
343
343
  enabledOrgIdHashes: STAFF_ORG_ID_HASHES
344
344
  },
345
+ ["chatErrorRecovery" /* ChatErrorRecovery */]: {
346
+ maintainer: "ethan@vm0.ai",
347
+ description: "Replace supported Codex and Claude Code limit errors with recovery actions in chat.",
348
+ enabled: false,
349
+ enabledOrgIdHashes: STAFF_ORG_ID_HASHES
350
+ },
345
351
  ["chatThreadSidebarAutoOpen" /* ChatThreadSidebarAutoOpen */]: {
346
352
  maintainer: "ethan@vm0.ai",
347
353
  description: "Automatically open the latest sidebar-capable card from a running or successfully completed chat run when the utility sidebar is closed and split view is available.",
@@ -351,8 +357,7 @@ var FEATURE_SWITCHES = {
351
357
  ["composerSkillSubstringSearch" /* ComposerSkillSubstringSearch */]: {
352
358
  maintainer: "yuma@vm0.ai",
353
359
  description: "Match chat composer slash skill suggestions by any slug substring instead of only prefixes.",
354
- enabled: false,
355
- enabledOrgIdHashes: STAFF_ORG_ID_HASHES
360
+ enabled: true
356
361
  },
357
362
  ["threeColumnNav" /* ThreeColumnNav */]: {
358
363
  maintainer: "ming@vm0.ai",
@@ -370,8 +375,8 @@ var FEATURE_SWITCHES = {
370
375
  },
371
376
  ["slackDmSessionRouting" /* SlackDmSessionRouting */]: {
372
377
  maintainer: "yuma@vm0.ai",
373
- description: "Reuse agent/model-scoped sessions for top-level Slack direct messages after compatible callback readers are deployed.",
374
- enabled: false
378
+ description: "Reuse agent/model-scoped sessions for top-level Slack direct messages.",
379
+ enabled: true
375
380
  },
376
381
  ["teamsIntegration" /* TeamsIntegration */]: {
377
382
  maintainer: "linghan@vm0.ai",
@@ -392,10 +397,10 @@ var FEATURE_SWITCHES = {
392
397
  enabledOrgIdHashes: STAFF_ORG_ID_HASHES,
393
398
  userOverridable: false
394
399
  },
395
- ["artifacts" /* Artifacts */]: {
396
- maintainer: "bingjie@vm0.ai",
397
- description: "Show the Artifacts manage page for generated artifacts in the current organization.",
398
- enabled: true
400
+ ["artifactKeyV2" /* ArtifactKeyV2 */]: {
401
+ maintainer: "yuma@vm0.ai",
402
+ description: "Store new user artifacts under flat, ten-character hashed public keys.",
403
+ enabled: false
399
404
  },
400
405
  ["hostedArtifactVersions" /* HostedArtifactVersions */]: {
401
406
  maintainer: "yuma@vm0.ai",
@@ -484,4 +489,4 @@ function isFeatureEnabled(key, ctx) {
484
489
  export {
485
490
  isFeatureEnabled
486
491
  };
487
- //# sourceMappingURL=chunk-XNBEOZ72.js.map
492
+ //# sourceMappingURL=chunk-X7YXT2UE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../packages/core/src/feature-switch-key.ts","../../../packages/core/src/feature-switch.ts","../../../packages/core/src/identity-hash.ts"],"sourcesContent":["/**\n * Feature switch keys\n *\n * Defines all available feature switch identifiers.\n */\nexport enum FeatureSwitchKey {\n Dummy = \"dummy\",\n AhrefsConnector = \"ahrefsConnector\",\n BillConnector = \"billConnector\",\n BentomlConnector = \"bentomlConnector\",\n BoxConnector = \"boxConnector\",\n CanvaConnector = \"canvaConnector\",\n CalComConnector = \"calComConnector\",\n CopperConnector = \"copperConnector\",\n DatadogConnector = \"datadogConnector\",\n DeelConnector = \"deelConnector\",\n DocuSignConnector = \"docusignConnector\",\n DropboxConnector = \"dropboxConnector\",\n FigmaConnector = \"figmaConnector\",\n ExpensifyConnector = \"expensifyConnector\",\n GoogleContactsConnector = \"googleContactsConnector\",\n GoogleFormsConnector = \"googleFormsConnector\",\n JoggAiConnector = \"joggAiConnector\",\n MercuryConnector = \"mercuryConnector\",\n NeonConnector = \"neonConnector\",\n NetSuiteConnector = \"netSuiteConnector\",\n GarminConnectConnector = \"garminConnectConnector\",\n QuickBooksConnector = \"quickbooksConnector\",\n RedditConnector = \"redditConnector\",\n SupabaseConnector = \"supabaseConnector\",\n WebflowConnector = \"webflowConnector\",\n CloseConnector = \"closeConnector\",\n MetaAdsConnector = \"metaAdsConnector\",\n TikTokAdsConnector = \"tiktokAdsConnector\",\n AwsConnector = \"awsConnector\",\n PosthogConnector = \"posthogConnector\",\n PayPalConnector = \"payPalConnector\",\n RampConnector = \"rampConnector\",\n MailchimpConnector = \"mailchimpConnector\",\n ResendConnector = \"resendConnector\",\n PexelsConnector = \"pexelsConnector\",\n SpotifyConnector = \"spotifyConnector\",\n ZeroDebug = \"zeroDebug\",\n LanguagePreference = \"languagePreference\",\n BrazilianPortugueseLocale = \"brazilianPortugueseLocale\",\n JapaneseLocale = \"japaneseLocale\",\n ZeroBrowser = \"zeroBrowser\",\n ZeroChatMessaging = \"zeroChatMessaging\",\n ZeroMailReplyFollowUp = \"zeroMailReplyFollowUp\",\n Banking = \"banking\",\n Lab = \"lab\",\n NotionWorkflowAutomations = \"notionWorkflowAutomations\",\n GithubWebhookAutomations = \"githubWebhookAutomations\",\n MorningBrief = \"morningBrief\",\n ManualMorningBrief = \"manualMorningBrief\",\n TestOauthConnector = \"testOauthConnector\",\n FreshdeskConnector = \"freshdeskConnector\",\n StabilityAiConnector = \"stabilityAiConnector\",\n ZoomConnector = \"zoomConnector\",\n WorkdayConnector = \"workdayConnector\",\n CodexFastMode = \"codexFastMode\",\n ClaudeSessionPruning = \"claudeSessionPruning\",\n RealAgentInPreview = \"realAgentInPreview\",\n ComposerUploadPopover = \"composerUploadPopover\",\n StructuredPromptInlineTemplates = \"structuredPromptInlineTemplates\",\n\n ZapierConnector = \"zapierConnector\",\n ComputerUseDesktopPlugins = \"computerUseDesktopPlugins\",\n ChatThreadUnifiedSearch = \"chatThreadUnifiedSearch\",\n ChatErrorRecovery = \"chatErrorRecovery\",\n ComposerSkillSubstringSearch = \"composerSkillSubstringSearch\",\n SidebarSubscriptionUsage = \"sidebarSubscriptionUsage\",\n SlackDmSessionRouting = \"slackDmSessionRouting\",\n TeamsIntegration = \"teamsIntegration\",\n FeishuIntegration = \"feishuIntegration\",\n StrapiIntegration = \"strapiIntegration\",\n ArtifactKeyV2 = \"artifactKeyV2\",\n HostedArtifactVersions = \"hostedArtifactVersions\",\n VideoArtifactPosters = \"videoArtifactPosters\",\n ImageStyleR2 = \"imageStyleR2\",\n WorkflowConnectorReadiness = \"workflowConnectorReadiness\",\n ComposerConnectorPermissions = \"composerConnectorPermissions\",\n ThreeColumnNav = \"threeColumnNav\",\n ChatThreadSidebarAutoOpen = \"chatThreadSidebarAutoOpen\",\n CustomConnectorCliCreate = \"customConnectorCliCreate\",\n CustomConnectorOAuth2 = \"customConnectorOAuth2\",\n}\n","/**\n * Feature switch system\n *\n * Provides centralized feature flag management with user-identity based overrides.\n * User IDs are stored as FNV-1a hashes to avoid exposing plain-text identifiers in source code.\n *\n * NOT AN AUTHORIZATION BOUNDARY. User-overridable switches can be self-enabled\n * through `POST /api/zero/feature-switches`, and `userOverridable: false` only\n * excludes a switch from that API. For money-granting, credential, or\n * privilege-escalation endpoints, gate with a hard identity check (e.g.\n * `isStaffOrg()` from `./staff-org`) instead of this system.\n */\n\nimport { FeatureSwitchKey } from \"./feature-switch-key\";\nimport { STAFF_ORG_ID_HASHES, fnv1a } from \"./identity-hash\";\n\nexport interface FeatureSwitch {\n readonly maintainer: string;\n readonly description?: string;\n readonly enabled: boolean;\n readonly enabledUserHashes?: readonly string[];\n readonly enabledEmailHashes?: readonly string[];\n readonly enabledOrgIdHashes?: readonly string[];\n readonly userOverridable?: boolean;\n}\n\nexport interface FeatureSwitchMetadata {\n readonly maintainer: string;\n readonly description?: string;\n readonly userOverridable: boolean;\n}\n\nexport interface FeatureSwitchContext {\n readonly userId?: string;\n readonly email?: string;\n readonly orgId?: string;\n readonly overrides?: Partial<Record<FeatureSwitchKey, boolean>>;\n}\n\n/**\n * Registry of all feature switches\n */\nconst FEATURE_SWITCHES: Record<FeatureSwitchKey, FeatureSwitch> = {\n [FeatureSwitchKey.Dummy]: {\n maintainer: \"ethan@vm0.ai\",\n description: \"Test-only feature switch for flag system validation\",\n enabled: true,\n },\n [FeatureSwitchKey.AhrefsConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Ahrefs SEO connector\",\n enabled: false,\n },\n [FeatureSwitchKey.BillConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the BILL Spend & Expense connector\",\n enabled: false,\n },\n [FeatureSwitchKey.BentomlConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the BentoML model serving connector\",\n enabled: false,\n },\n [FeatureSwitchKey.BoxConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Box file storage connector\",\n enabled: false,\n },\n [FeatureSwitchKey.CanvaConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Canva design connector\",\n enabled: false,\n },\n [FeatureSwitchKey.CalComConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Cal.com scheduling connector\",\n enabled: false,\n },\n [FeatureSwitchKey.CopperConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Copper CRM connector\",\n enabled: false,\n },\n [FeatureSwitchKey.DatadogConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Datadog observability connector\",\n enabled: false,\n },\n [FeatureSwitchKey.DeelConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Deel HR connector\",\n enabled: false,\n },\n [FeatureSwitchKey.DocuSignConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the DocuSign e-signature connector\",\n enabled: false,\n },\n [FeatureSwitchKey.DropboxConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Dropbox file storage connector\",\n enabled: false,\n },\n [FeatureSwitchKey.FigmaConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Figma design connector\",\n enabled: false,\n },\n [FeatureSwitchKey.ExpensifyConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Expensify accounting connector\",\n enabled: false,\n },\n [FeatureSwitchKey.GoogleContactsConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Google Contacts connector\",\n enabled: false,\n },\n [FeatureSwitchKey.GoogleFormsConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Google Forms connector\",\n enabled: false,\n },\n [FeatureSwitchKey.JoggAiConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the JoggAI video generation connector\",\n enabled: false,\n },\n [FeatureSwitchKey.MercuryConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Mercury banking connector\",\n enabled: false,\n },\n [FeatureSwitchKey.NeonConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Neon serverless Postgres connector\",\n enabled: false,\n },\n [FeatureSwitchKey.NetSuiteConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Oracle NetSuite ERP connector\",\n enabled: false,\n },\n [FeatureSwitchKey.GarminConnectConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Garmin Connect wellness connector\",\n enabled: false,\n },\n [FeatureSwitchKey.QuickBooksConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the QuickBooks accounting connector\",\n enabled: false,\n },\n [FeatureSwitchKey.RedditConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Reddit connector integration\",\n enabled: false,\n },\n [FeatureSwitchKey.SupabaseConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Supabase database connector integration\",\n enabled: false,\n },\n [FeatureSwitchKey.CloseConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Close CRM connector\",\n enabled: false,\n },\n [FeatureSwitchKey.WebflowConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Webflow site management connector\",\n enabled: false,\n },\n [FeatureSwitchKey.MetaAdsConnector]: {\n maintainer: \"ethan@vm0.ai\",\n description: \"Enable the Meta Ads Manager connector\",\n enabled: false,\n },\n [FeatureSwitchKey.TikTokAdsConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the TikTok Ads Manager connector\",\n enabled: false,\n },\n [FeatureSwitchKey.AwsConnector]: {\n maintainer: \"liangyou@vm0.ai\",\n description: \"Enable the temporary AWS remote login connector\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.PosthogConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the PostHog analytics connector\",\n enabled: false,\n },\n [FeatureSwitchKey.PayPalConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the PayPal payments connector\",\n enabled: false,\n },\n [FeatureSwitchKey.RampConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Ramp spend management connector\",\n enabled: false,\n },\n [FeatureSwitchKey.MailchimpConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Mailchimp email marketing connector\",\n enabled: false,\n },\n [FeatureSwitchKey.ResendConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Resend email service connector\",\n enabled: false,\n },\n [FeatureSwitchKey.PexelsConnector]: {\n maintainer: \"bingjie@vm0.ai\",\n description: \"Enable the Pexels stock photo and video connector\",\n enabled: false,\n },\n [FeatureSwitchKey.SpotifyConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Spotify connector integration\",\n enabled: false,\n },\n [FeatureSwitchKey.ZeroDebug]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Reveal activity debug surfaces, activity log navigation, appended system prompts, and Debug preferences\",\n enabled: false,\n },\n [FeatureSwitchKey.LanguagePreference]: {\n maintainer: \"yuma@vm0.ai\",\n description:\n \"Enable workspace language bootstrap, persistence, and the Settings preference entry.\",\n enabled: true,\n },\n [FeatureSwitchKey.BrazilianPortugueseLocale]: {\n maintainer: \"yuma@vm0.ai\",\n description:\n \"Allow pt-BR preference writes after incompatible API readers and rollback candidates have drained.\",\n enabled: false,\n userOverridable: false,\n },\n [FeatureSwitchKey.JapaneseLocale]: {\n maintainer: \"yuma@vm0.ai\",\n description:\n \"Allow ja-JP preference writes after incompatible API readers and rollback candidates have drained.\",\n enabled: false,\n userOverridable: false,\n },\n [FeatureSwitchKey.Banking]: {\n maintainer: \"linghan@vm0.ai\",\n description:\n \"Enable the managed Zero Banking gateway and banking:read ZERO_TOKEN capability for Finicity-backed accounts, balances, and transactions.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.Lab]: {\n maintainer: \"ethan@vm0.ai\",\n description: \"Show the Lab page for toggling experimental features\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.MorningBrief]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Enable the daily 7:00 local-time Morning Brief email built from GitHub, Gmail, and Google Calendar.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n userOverridable: true,\n },\n [FeatureSwitchKey.ManualMorningBrief]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Show a Send now button in Settings that triggers a Morning Brief immediately for testing.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n userOverridable: true,\n },\n [FeatureSwitchKey.NotionWorkflowAutomations]: {\n maintainer: \"lancy@vm0.ai\",\n description:\n \"Enable Notion event workflow automations, starting with child pages created under a configured parent page.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.GithubWebhookAutomations]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Show creation entry points for GitHub workflow job, pull request review, deployment status, and issue comment automations.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n userOverridable: false,\n },\n [FeatureSwitchKey.TestOauthConnector]: {\n maintainer: \"liangyou@vm0.ai\",\n description:\n \"Enable the test-oauth connector, a synthetic OAuth 2.0 provider used only for automated tests. Off in prod.\",\n enabled: false,\n },\n [FeatureSwitchKey.FreshdeskConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Freshdesk helpdesk connector\",\n enabled: false,\n },\n [FeatureSwitchKey.StabilityAiConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Stability AI image generation connector\",\n enabled: false,\n },\n [FeatureSwitchKey.ZoomConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description:\n \"Enable the Zoom connector (OAuth 2.0) for meetings, past participants, and cloud recordings access\",\n enabled: false,\n },\n [FeatureSwitchKey.WorkdayConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description: \"Enable the Workday HCM and finance connector\",\n enabled: false,\n },\n\n [FeatureSwitchKey.CodexFastMode]: {\n maintainer: \"lancy@vm0.ai\",\n description:\n \"Enable Codex fast mode for ChatGPT subscription GPT 5.5 and GPT 5.6 web chat runs.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.ClaudeSessionPruning]: {\n maintainer: \"liangyou@vm0.ai\",\n description:\n \"Prune oversized Claude Code checkpoint histories to the latest native compact generation.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.RealAgentInPreview]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Send preview chat runs through real agent CLIs instead of preview mock runners.\",\n enabled: false,\n },\n [FeatureSwitchKey.ComposerUploadPopover]: {\n maintainer: \"bingjie@vm0.ai\",\n description:\n \"Use the Upload popover in the chat composer instead of the legacy paperclip attachment button.\",\n enabled: false,\n userOverridable: false,\n },\n [FeatureSwitchKey.StructuredPromptInlineTemplates]: {\n maintainer: \"bingjie@vm0.ai\",\n description:\n \"Enable multiple inline artifact templates in structured chat prompts.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n userOverridable: true,\n },\n [FeatureSwitchKey.ZapierConnector]: {\n maintainer: \"yuma@vm0.ai\",\n description:\n \"Enable the Zapier connector. When disabled, Zapier is hidden from the connectors list and cannot be connected.\",\n enabled: false,\n },\n [FeatureSwitchKey.ComputerUseDesktopPlugins]: {\n maintainer: \"lancy@vm0.ai\",\n description:\n \"Enable Zero Desktop Computer Use plugins for local resources, starting with the bundled filesystem plugin gateway.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.ChatThreadUnifiedSearch]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Show chat thread title results from the local event-driven thread cache in the command-shift-a conversation picker.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.ChatErrorRecovery]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Replace supported Codex and Claude Code limit errors with recovery actions in chat.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.ChatThreadSidebarAutoOpen]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Automatically open the latest sidebar-capable card from a running or successfully completed chat run when the utility sidebar is closed and split view is available.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.ComposerSkillSubstringSearch]: {\n maintainer: \"yuma@vm0.ai\",\n description:\n \"Match chat composer slash skill suggestions by any slug substring instead of only prefixes.\",\n enabled: true,\n },\n [FeatureSwitchKey.ThreeColumnNav]: {\n maintainer: \"ming@vm0.ai\",\n description:\n \"Slack-style three-column navigation: a labeled icon rail, a pinned-agents and chat-threads list column, and the conversation pane.\",\n enabled: false,\n // Ming only for the first pass; widen to staff once it settles.\n enabledEmailHashes: [\"54757055\"], // fnv1a(\"ming@vm0.ai\")\n },\n [FeatureSwitchKey.SidebarSubscriptionUsage]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Show Codex and Claude Code personal subscription usage in the Zero sidebar footer.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.SlackDmSessionRouting]: {\n maintainer: \"yuma@vm0.ai\",\n description:\n \"Reuse agent/model-scoped sessions for top-level Slack direct messages.\",\n enabled: true,\n },\n [FeatureSwitchKey.TeamsIntegration]: {\n maintainer: \"linghan@vm0.ai\",\n description:\n \"Show standalone Microsoft Teams integration settings, connect flows, and Works page entry points.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.FeishuIntegration]: {\n maintainer: \"linghan@vm0.ai\",\n description:\n \"Show the Feishu direct-message integration and Works page entry point.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.StrapiIntegration]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Enable Strapi integration settings and Strapi entry-published workflow automations.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n userOverridable: false,\n },\n [FeatureSwitchKey.ArtifactKeyV2]: {\n maintainer: \"yuma@vm0.ai\",\n description:\n \"Store new user artifacts under flat, ten-character hashed public keys.\",\n enabled: false,\n },\n [FeatureSwitchKey.HostedArtifactVersions]: {\n maintainer: \"yuma@vm0.ai\",\n description:\n \"Create immutable hosted artifact versions behind stable site aliases.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.VideoArtifactPosters]: {\n maintainer: \"bingjie@vm0.ai\",\n description:\n \"Generate poster images asynchronously when video artifacts are recorded.\",\n enabled: true,\n },\n [FeatureSwitchKey.ImageStyleR2]: {\n maintainer: \"bingjie@vm0.ai\",\n description:\n \"Resolve archive-enabled image styles from private R2 packages. When off, image style authoring continues reading vm0-skills from GitHub.\",\n enabled: true,\n },\n [FeatureSwitchKey.WorkflowConnectorReadiness]: {\n maintainer: \"lancy@vm0.ai\",\n description:\n \"Show the manual connector readiness check on workflow settings pages.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n userOverridable: false,\n },\n [FeatureSwitchKey.ZeroMailReplyFollowUp]: {\n maintainer: \"yuma@vm0.ai\",\n description:\n \"Enable Zero Mail reply follow-up after all API deployments can read Gmail event configurations with threadId.\",\n enabled: false,\n userOverridable: false,\n },\n [FeatureSwitchKey.ZeroBrowser]: {\n maintainer: \"liangyou@vm0.ai\",\n description:\n \"Enable thread-scoped Cloud browser access in chat and the Zero CLI.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.ZeroChatMessaging]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Advertise zero chat create, send, and cancel in the agent system prompt without gating the CLI commands or API.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.ComposerConnectorPermissions]: {\n maintainer: \"ming@vm0.ai\",\n description:\n \"Show the configure-permissions entry in the chat composer connector popover, opening the agent×connector firewall dialog inline.\",\n enabled: false,\n userOverridable: true,\n },\n [FeatureSwitchKey.CustomConnectorCliCreate]: {\n maintainer: \"liangyou@vm0.ai\",\n description:\n \"Allow Zero CLI agents to create and configure custom connectors directly.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.CustomConnectorOAuth2]: {\n maintainer: \"liangyou@vm0.ai\",\n description:\n \"Allow org admins to add OAuth 2.0 authentication to custom connectors.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n};\n\ninterface ResolvedHashes {\n readonly userHash?: string;\n readonly emailHash?: string;\n readonly orgIdHash?: string;\n}\n\nfunction evaluateSwitch(fs: FeatureSwitch, hashes: ResolvedHashes): boolean {\n if (fs.enabled) return true;\n if (hashes.userHash && fs.enabledUserHashes?.includes(hashes.userHash))\n return true;\n if (hashes.emailHash && fs.enabledEmailHashes?.includes(hashes.emailHash))\n return true;\n if (hashes.orgIdHash && fs.enabledOrgIdHashes?.includes(hashes.orgIdHash))\n return true;\n return false;\n}\n\n/**\n * Evaluate all feature switches at once for the given context.\n *\n * Computes identity hashes once and checks all switches synchronously.\n */\nexport function getAllFeatureStates(\n ctx?: FeatureSwitchContext,\n): Record<FeatureSwitchKey, boolean> {\n const switches = Object.values(FEATURE_SWITCHES);\n const hashes: ResolvedHashes = {\n userHash:\n ctx?.userId &&\n switches.some((s) => {\n return s.enabledUserHashes?.length;\n })\n ? fnv1a(ctx.userId)\n : undefined,\n emailHash:\n ctx?.email &&\n switches.some((s) => {\n return s.enabledEmailHashes?.length;\n })\n ? fnv1a(ctx.email.toLowerCase())\n : undefined,\n orgIdHash:\n ctx?.orgId &&\n switches.some((s) => {\n return s.enabledOrgIdHashes?.length;\n })\n ? fnv1a(ctx.orgId)\n : undefined,\n };\n\n const result = {} as Record<FeatureSwitchKey, boolean>;\n for (const key of Object.values(FeatureSwitchKey)) {\n result[key] = evaluateSwitch(FEATURE_SWITCHES[key], hashes);\n }\n\n if (ctx?.overrides) {\n for (const [key, value] of Object.entries(ctx.overrides)) {\n if (key in FEATURE_SWITCHES && value !== undefined) {\n result[key as FeatureSwitchKey] = value;\n }\n }\n }\n\n return result;\n}\n\n/**\n * Return the description for every feature switch.\n */\nexport function getFeatureSwitchDescriptions(): Record<\n FeatureSwitchKey,\n string | undefined\n> {\n const result = {} as Record<FeatureSwitchKey, string | undefined>;\n for (const key of Object.values(FeatureSwitchKey)) {\n result[key] = FEATURE_SWITCHES[key].description;\n }\n return result;\n}\n\n/**\n * Return display metadata for every feature switch.\n */\nexport function getFeatureSwitchMetadata(): Record<\n FeatureSwitchKey,\n FeatureSwitchMetadata\n> {\n const result = {} as Record<FeatureSwitchKey, FeatureSwitchMetadata>;\n for (const key of Object.values(FeatureSwitchKey)) {\n const featureSwitch = FEATURE_SWITCHES[key];\n result[key] = {\n maintainer: featureSwitch.maintainer,\n description: featureSwitch.description,\n userOverridable: featureSwitch.userOverridable !== false,\n };\n }\n return result;\n}\n\nexport function isUserOverridableFeatureSwitch(\n key: string,\n): key is FeatureSwitchKey {\n if (!(key in FEATURE_SWITCHES)) {\n return false;\n }\n return FEATURE_SWITCHES[key as FeatureSwitchKey].userOverridable !== false;\n}\n\nexport function getUserOverridableFeatureSwitchKeys(): readonly FeatureSwitchKey[] {\n return Object.values(FeatureSwitchKey).filter(isUserOverridableFeatureSwitch);\n}\n\nexport function filterUserOverridableFeatureSwitchOverrides(\n switches: Record<string, boolean>,\n): Record<string, boolean> {\n const filtered: Record<string, boolean> = {};\n for (const [key, value] of Object.entries(switches)) {\n if (isUserOverridableFeatureSwitch(key)) {\n filtered[key] = value;\n }\n }\n return filtered;\n}\n\n/**\n * Check if a feature is enabled for the given context.\n *\n * `ctx` is required so callers must pass identity (userId/orgId/email) or an\n * explicit `{}`. A switch gated by `enabledUserHashes` / `enabledOrgIdHashes`\n * silently returns `false` when ctx omits identity, which has caused bugs.\n * Client-side callers should usually read the platform `featureSwitch$` signal\n * instead — it also merges DB overrides on top of identity context.\n */\nexport function isFeatureEnabled(\n key: FeatureSwitchKey,\n ctx: FeatureSwitchContext,\n): boolean {\n const override = ctx.overrides?.[key];\n if (override !== undefined) {\n return override;\n }\n\n const featureSwitch = FEATURE_SWITCHES[key];\n if (featureSwitch.enabled) {\n return true;\n }\n if (ctx.userId && featureSwitch.enabledUserHashes?.length) {\n if (featureSwitch.enabledUserHashes.includes(fnv1a(ctx.userId)))\n return true;\n }\n if (ctx.email && featureSwitch.enabledEmailHashes?.length) {\n if (\n featureSwitch.enabledEmailHashes.includes(fnv1a(ctx.email.toLowerCase()))\n )\n return true;\n }\n if (ctx.orgId && featureSwitch.enabledOrgIdHashes?.length) {\n if (featureSwitch.enabledOrgIdHashes.includes(fnv1a(ctx.orgId)))\n return true;\n }\n return false;\n}\n","/**\n * Identity hashing — FNV-1a 32-bit hash used to reference users / orgs / emails\n * without embedding plain-text identifiers in source code.\n *\n * Shared between the feature-switch registry (UI rollout targeting) and\n * `staff-org.ts` (authorization primitive). The hash is deterministic and\n * synchronous; no crypto API needed.\n */\n\nexport function fnv1a(input: string): string {\n let h = 2166136261 >>> 0;\n for (let i = 0; i < input.length; i++) {\n h ^= input.charCodeAt(i);\n h = Math.imul(h, 16777619) >>> 0;\n }\n return h.toString(16).padStart(8, \"0\");\n}\n\n/**\n * Hashes of internal staff org IDs.\n *\n * This list is the source of truth for `isStaffOrg()` — adding an entry here\n * grants that org access to every endpoint that uses `isStaffOrg` as an\n * authorization check. Treat changes with the same care as role grants.\n */\nexport const STAFF_ORG_ID_HASHES: readonly string[] = [\n \"afce210e\", // org_3ANttyrbWYJk6JKRSTRLEsbsDLe\n];\n"],"mappings":";;;;;;;;AAAA;;;ACAA;;;ACAA;AASO,SAAS,MAAM,OAAuB;AAC3C,MAAI,IAAI,eAAe;AACvB,WAAS,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]}
@@ -12,12 +12,12 @@ import {
12
12
  fetchComputerUseScreenshot,
13
13
  getComputerUseCommand,
14
14
  listComputerUseHosts
15
- } from "./chunk-IRYWZDHD.js";
16
- import "./chunk-6APTUGDE.js";
15
+ } from "./chunk-TZDXFY6G.js";
16
+ import "./chunk-JXUQQIUP.js";
17
17
  import {
18
18
  ApiRequestError,
19
19
  withErrorHandler
20
- } from "./chunk-LRNTCZW5.js";
20
+ } from "./chunk-D7TEG7WN.js";
21
21
  import "./chunk-MD3YWUKO.js";
22
22
  import {
23
23
  Command
@@ -970,4 +970,4 @@ export {
970
970
  formatComputerUseResultForConsole,
971
971
  zeroComputerUseCommand
972
972
  };
973
- //# sourceMappingURL=computer-use-RL4LFXTU.js.map
973
+ //# sourceMappingURL=computer-use-LAD5XLHX.js.map
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from "node:module";
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  hasConnectorFirewallMetadataPermission
6
- } from "./chunk-ZAE7DA72.js";
6
+ } from "./chunk-VSL4HRIA.js";
7
7
  import {
8
8
  CALLBACK_PROMPT_PLACEHOLDER,
9
9
  addRequestedCallbackSearchParams,
@@ -18,7 +18,7 @@ import {
18
18
  resolveConnectorDiscoveryAgentContext,
19
19
  resolveManualGrantAuthMethod,
20
20
  searchConnectorCatalog
21
- } from "./chunk-DVGDO4XK.js";
21
+ } from "./chunk-RFTCX5UZ.js";
22
22
  import {
23
23
  UNKNOWN_PERMISSION_GRANT,
24
24
  addZeroAgentCustomConnector,
@@ -41,19 +41,19 @@ import {
41
41
  setZeroCustomConnectorValues,
42
42
  startZeroCustomConnectorOAuth2,
43
43
  updateCustomConnectorBodySchema
44
- } from "./chunk-IRYWZDHD.js";
45
- import "./chunk-6APTUGDE.js";
44
+ } from "./chunk-TZDXFY6G.js";
45
+ import "./chunk-JXUQQIUP.js";
46
46
  import {
47
47
  getPlatformOrigin,
48
48
  toPlatformUrl
49
- } from "./chunk-TRGD5ZVE.js";
49
+ } from "./chunk-CCUKVMAH.js";
50
50
  import "./chunk-MA22KQYU.js";
51
51
  import {
52
52
  ApiRequestError,
53
53
  getApiUrl,
54
54
  source_default,
55
55
  withErrorHandler
56
- } from "./chunk-LRNTCZW5.js";
56
+ } from "./chunk-D7TEG7WN.js";
57
57
  import {
58
58
  decodeZeroTokenPayload
59
59
  } from "./chunk-MD3YWUKO.js";
@@ -1845,4 +1845,4 @@ var zeroConnectorCommand = new Command().name("connector").description("Manage a
1845
1845
  export {
1846
1846
  zeroConnectorCommand
1847
1847
  };
1848
- //# sourceMappingURL=connector-65CXKHFD.js.map
1848
+ //# sourceMappingURL=connector-AVTEZ5M4.js.map
@@ -10,19 +10,19 @@ import {
10
10
  createZeroCreditCheckout,
11
11
  getZeroBillingStatus,
12
12
  getZeroOrgMembers
13
- } from "./chunk-IRYWZDHD.js";
14
- import "./chunk-6APTUGDE.js";
13
+ } from "./chunk-TZDXFY6G.js";
14
+ import "./chunk-JXUQQIUP.js";
15
15
  import {
16
16
  planUpgradeUrl
17
17
  } from "./chunk-2NW76WYJ.js";
18
18
  import {
19
19
  getPlatformOrigin
20
- } from "./chunk-TRGD5ZVE.js";
20
+ } from "./chunk-CCUKVMAH.js";
21
21
  import "./chunk-MA22KQYU.js";
22
22
  import {
23
23
  source_default,
24
24
  withErrorHandler
25
- } from "./chunk-LRNTCZW5.js";
25
+ } from "./chunk-D7TEG7WN.js";
26
26
  import {
27
27
  decodeZeroTokenPayload
28
28
  } from "./chunk-MD3YWUKO.js";
@@ -163,4 +163,4 @@ var zeroCreditCommand = new Command().name("credit").description("View credit ba
163
163
  export {
164
164
  zeroCreditCommand
165
165
  };
166
- //# sourceMappingURL=credit-BATZHIJM.js.map
166
+ //# sourceMappingURL=credit-I45PC4IZ.js.map
@@ -4,12 +4,12 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  requestDeveloperSupportConsent,
6
6
  submitDeveloperSupport
7
- } from "./chunk-IRYWZDHD.js";
8
- import "./chunk-6APTUGDE.js";
7
+ } from "./chunk-TZDXFY6G.js";
8
+ import "./chunk-JXUQQIUP.js";
9
9
  import "./chunk-MA22KQYU.js";
10
10
  import {
11
11
  withErrorHandler
12
- } from "./chunk-LRNTCZW5.js";
12
+ } from "./chunk-D7TEG7WN.js";
13
13
  import "./chunk-MD3YWUKO.js";
14
14
  import {
15
15
  Command
@@ -61,4 +61,4 @@ Notes:
61
61
  export {
62
62
  zeroDeveloperSupportCommand
63
63
  };
64
- //# sourceMappingURL=developer-support-HC57MCE5.js.map
64
+ //# sourceMappingURL=developer-support-HG2427DE.js.map
@@ -9,19 +9,19 @@ import {
9
9
  getZeroBillingStatus,
10
10
  getZeroOrg,
11
11
  getZeroOrgMembers
12
- } from "./chunk-IRYWZDHD.js";
13
- import "./chunk-6APTUGDE.js";
12
+ } from "./chunk-TZDXFY6G.js";
13
+ import "./chunk-JXUQQIUP.js";
14
14
  import {
15
15
  planUpgradeUrl
16
16
  } from "./chunk-2NW76WYJ.js";
17
17
  import {
18
18
  getPlatformOrigin
19
- } from "./chunk-TRGD5ZVE.js";
19
+ } from "./chunk-CCUKVMAH.js";
20
20
  import "./chunk-MA22KQYU.js";
21
21
  import {
22
22
  source_default,
23
23
  withErrorHandler
24
- } from "./chunk-LRNTCZW5.js";
24
+ } from "./chunk-D7TEG7WN.js";
25
25
  import "./chunk-MD3YWUKO.js";
26
26
  import {
27
27
  Command
@@ -122,4 +122,4 @@ Notes:
122
122
  export {
123
123
  zeroDoctorCommand
124
124
  };
125
- //# sourceMappingURL=doctor-CZTLPLHN.js.map
125
+ //# sourceMappingURL=doctor-NEF5PDLF.js.map
@@ -7,13 +7,13 @@ import {
7
7
  downloadFeishuFile,
8
8
  initFeishuFileUpload,
9
9
  sendFeishuMessage
10
- } from "./chunk-IRYWZDHD.js";
11
- import "./chunk-6APTUGDE.js";
10
+ } from "./chunk-TZDXFY6G.js";
11
+ import "./chunk-JXUQQIUP.js";
12
12
  import "./chunk-MA22KQYU.js";
13
13
  import {
14
14
  source_default,
15
15
  withErrorHandler
16
- } from "./chunk-LRNTCZW5.js";
16
+ } from "./chunk-D7TEG7WN.js";
17
17
  import "./chunk-MD3YWUKO.js";
18
18
  import {
19
19
  Command
@@ -235,11 +235,15 @@ Notes:
235
235
  const prepared = await initFeishuFileUpload({
236
236
  filename,
237
237
  contentType,
238
- length: fileSize
238
+ length: fileSize,
239
+ supportsUploadHeaders: true
239
240
  });
240
241
  const uploadResponse = await fetch(prepared.uploadUrl, {
241
242
  method: "PUT",
242
- headers: { "Content-Type": prepared.contentType },
243
+ headers: {
244
+ "Content-Type": prepared.contentType,
245
+ ...prepared.uploadHeaders
246
+ },
243
247
  body: new Uint8Array(readFileSync2(options.file))
244
248
  });
245
249
  if (!uploadResponse.ok) {
@@ -274,4 +278,4 @@ Examples:
274
278
  export {
275
279
  zeroFeishuCommand
276
280
  };
277
- //# sourceMappingURL=feishu-N4TRYP4I.js.map
281
+ //# sourceMappingURL=feishu-C7TLUZNW.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/commands/zero/feishu/index.ts","../src/commands/zero/feishu/download-file.ts","../src/commands/zero/feishu/message/index.ts","../src/commands/zero/feishu/message/send.ts","../src/commands/zero/feishu/upload-file.ts"],"sourcesContent":["import { Command } from \"commander\";\n\nimport { downloadFileCommand } from \"./download-file\";\nimport { zeroFeishuMessageCommand } from \"./message\";\nimport { uploadFileCommand } from \"./upload-file\";\n\nexport const zeroFeishuCommand = new Command()\n .name(\"feishu\")\n .description(\"Send messages and transfer files through Feishu\")\n .addCommand(zeroFeishuMessageCommand)\n .addCommand(downloadFileCommand)\n .addCommand(uploadFileCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Send to a chat: zero feishu message send -c <chat-id> -t \"Hello!\"\n Send a DM: zero feishu message send -u <open-id> -t \"Hello!\"\n Reply in a thread: zero feishu message send -r <message-id> --thread -t \"Reply\"\n Upload a file: zero feishu upload-file -f /tmp/report.pdf -c <chat-id>\n Download a file: zero feishu download-file <message-id> <file-key> --type file`,\n );\n","import { tmpdir } from \"node:os\";\nimport { basename, join } from \"node:path\";\n\nimport { Command } from \"commander\";\nimport type { FeishuResourceType } from \"@vm0/api-contracts/contracts/integrations\";\n\nimport { downloadFeishuFile } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nfunction defaultOutPath(fileKey: string): string {\n return join(tmpdir(), `feishu-${basename(fileKey).slice(0, 80)}`);\n}\n\nfunction parseResourceType(value: string): FeishuResourceType {\n if (value !== \"file\" && value !== \"image\") {\n throw new Error(\"--type must be either file or image\");\n }\n return value;\n}\n\nexport const downloadFileCommand = new Command()\n .name(\"download-file\")\n .description(\"Download a file from a Feishu message\")\n .argument(\"<message-id>\", \"Message ID from a [Feishu file] block\")\n .argument(\"<file-key>\", \"File key from a [Feishu file] block\")\n .requiredOption(\n \"--type <type>\",\n \"Resource type from the block: file or image\",\n )\n .option(\"-i, --installation <id>\", \"Feishu installation ID\")\n .option(\"-o, --out <path>\", \"Output path (default: /tmp/feishu-<file-key>)\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Download a file: zero feishu download-file om_xxx file_xxx --type file\n Download an image: zero feishu download-file om_xxx img_xxx --type image -o /tmp/image.png\n Select an app: zero feishu download-file om_xxx file_xxx --type file -i <installation-id>\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"path\":\"/tmp/feishu-file_xxx\",\"mimetype\":\"application/pdf\",\"size\":12345}\n\nNotes:\n - Use the message ID, file key, and type exactly as shown in a [Feishu file] block\n - Specify --installation when the organization has multiple Feishu bots\n - Streams the file bytes directly to disk`,\n )\n .action(\n withErrorHandler(\n async (\n messageId: string,\n fileKey: string,\n options: {\n readonly type: string;\n readonly installation?: string;\n readonly out?: string;\n },\n ) => {\n const outPath = options.out ?? defaultOutPath(fileKey);\n const result = await downloadFeishuFile(\n messageId,\n fileKey,\n parseResourceType(options.type),\n options.installation,\n outPath,\n );\n console.log(JSON.stringify(result));\n },\n ),\n );\n","import { Command } from \"commander\";\n\nimport { sendCommand } from \"./send\";\n\nexport const zeroFeishuMessageCommand = new Command()\n .name(\"message\")\n .description(\"Send Feishu messages\")\n .addCommand(sendCommand);\n","import { readFileSync } from \"node:fs\";\n\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\n\nimport { sendFeishuMessage } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\ninterface SendFeishuOptions {\n readonly installation?: string;\n readonly chat?: string;\n readonly user?: string;\n readonly reply?: string;\n readonly thread?: boolean;\n readonly text?: string;\n readonly card?: string;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction parseCard(\n input: string | undefined,\n): Record<string, unknown> | undefined {\n if (!input) {\n return undefined;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(input);\n } catch {\n throw new Error(\"Invalid JSON for --card flag\", {\n cause: new Error(\"Provide a valid Feishu card JSON object\"),\n });\n }\n if (!isRecord(parsed)) {\n throw new Error(\"Invalid JSON for --card\", {\n cause: new Error(\"Provide a Feishu card JSON object\"),\n });\n }\n return parsed;\n}\n\nexport const sendCommand = new Command()\n .name(\"send\")\n .description(\"Send a message to a Feishu chat or user\")\n .option(\"-i, --installation <id>\", \"Feishu installation ID\")\n .option(\"-c, --chat <id>\", \"Feishu chat ID\")\n .option(\"-u, --user <open-id>\", 'Feishu user open ID (use \"me\" for yourself)')\n .option(\"-r, --reply <message-id>\", \"Message ID to reply to\")\n .option(\"--thread\", \"Reply in a Feishu thread\")\n .option(\"-t, --text <message>\", \"Message text\")\n .option(\"--card <json>\", \"Feishu interactive card JSON\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Chat message: zero feishu message send -c oc_xxx -t \"Hello!\"\n Direct message: zero feishu message send -u ou_xxx -t \"Hello!\"\n DM yourself: zero feishu message send -u me -t \"Hello!\"\n Thread reply: zero feishu message send -r om_xxx --thread -t \"Reply\"\n Interactive card: zero feishu message send -c oc_xxx --card '{\"schema\":\"2.0\",\"body\":{\"elements\":[]}}'\n Select a custom app: zero feishu message send -i <installation-id> -c oc_xxx -t \"Hello!\"\n\nNotes:\n - Exactly one of --chat, --user, or --reply is required\n - Exactly one of --text or --card is required\n - --installation is required when the organization has multiple Feishu bots`,\n )\n .action(\n withErrorHandler(async (options: SendFeishuOptions) => {\n const targets = [options.chat, options.user, options.reply].filter(\n Boolean,\n );\n if (targets.length !== 1) {\n throw new Error(\n \"Exactly one of --chat, --user, or --reply must be provided\",\n );\n }\n if (options.thread && !options.reply) {\n throw new Error(\"--thread requires --reply\");\n }\n\n let text = options.text;\n if (!text && !options.card && !process.stdin.isTTY) {\n try {\n text = readFileSync(\"/dev/stdin\", \"utf8\").trim();\n } catch {\n // stdin is not readable; fall through to normal input validation.\n }\n }\n const card = parseCard(options.card);\n if (Boolean(text) === Boolean(card)) {\n throw new Error(\"Exactly one of --text or --card must be provided\");\n }\n\n const result = await sendFeishuMessage({\n installationId: options.installation,\n chat: options.chat,\n user: options.user,\n replyToMessageId: options.reply,\n replyInThread: options.thread,\n text,\n card,\n });\n console.log(chalk.green(`✓ Message sent (message: ${result.messageId})`));\n }),\n );\n","import { readFileSync, statSync } from \"node:fs\";\nimport { basename, extname } from \"node:path\";\n\nimport { Command } from \"commander\";\nimport { FEISHU_FILE_UPLOAD_MAX_BYTES } from \"@vm0/api-contracts/contracts/integrations\";\n\nimport {\n completeFeishuFileUpload,\n initFeishuFileUpload,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nconst MIME_BY_EXTENSION: Readonly<Record<string, string>> = {\n \".csv\": \"text/csv\",\n \".gif\": \"image/gif\",\n \".jpeg\": \"image/jpeg\",\n \".jpg\": \"image/jpeg\",\n \".json\": \"application/json\",\n \".md\": \"text/markdown\",\n \".mov\": \"video/quicktime\",\n \".mp4\": \"video/mp4\",\n \".pdf\": \"application/pdf\",\n \".png\": \"image/png\",\n \".svg\": \"image/svg+xml\",\n \".txt\": \"text/plain\",\n \".webm\": \"video/webm\",\n \".webp\": \"image/webp\",\n};\n\ninterface UploadFeishuOptions {\n readonly file: string;\n readonly installation?: string;\n readonly chat?: string;\n readonly user?: string;\n readonly reply?: string;\n readonly thread?: boolean;\n readonly contentType?: string;\n}\n\nfunction inferContentType(localPath: string): string {\n return (\n MIME_BY_EXTENSION[extname(localPath).toLowerCase()] ??\n \"application/octet-stream\"\n );\n}\n\nexport const uploadFileCommand = new Command()\n .name(\"upload-file\")\n .description(\"Upload a local file to Feishu as an organization bot\")\n .requiredOption(\"-f, --file <path>\", \"Local file path to upload\")\n .option(\"-i, --installation <id>\", \"Feishu installation ID\")\n .option(\"-c, --chat <id>\", \"Feishu chat ID\")\n .option(\"-u, --user <open-id>\", 'Feishu user open ID (use \"me\" for yourself)')\n .option(\"-r, --reply <message-id>\", \"Message ID to reply to\")\n .option(\"--thread\", \"Reply in a Feishu thread\")\n .option(\"--content-type <mime>\", \"Override inferred content type\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload to a chat: zero feishu upload-file -f /tmp/report.pdf -c oc_xxx\n Send a DM: zero feishu upload-file -f /tmp/report.pdf -u ou_xxx\n Reply with a file: zero feishu upload-file -f /tmp/report.pdf -r om_xxx --thread\n Select a custom app: zero feishu upload-file -f /tmp/report.pdf -i <installation-id> -c oc_xxx\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"messageId\":\"om_xxx\",\"chatId\":\"oc_xxx\",\"fileKey\":\"file_xxx\",\"filename\":\"report.pdf\",\"mimetype\":\"application/pdf\",\"size\":12345,\"url\":\"https://...\"}\n\nNotes:\n - Exactly one of --chat, --user, or --reply is required\n - Feishu accepts non-empty files up to 30 MB\n - Specify --installation when the organization has multiple Feishu bots`,\n )\n .action(\n withErrorHandler(async (options: UploadFeishuOptions) => {\n const targets = [options.chat, options.user, options.reply].filter(\n Boolean,\n );\n if (targets.length !== 1) {\n throw new Error(\n \"Exactly one of --chat, --user, or --reply must be provided\",\n );\n }\n if (options.thread && !options.reply) {\n throw new Error(\"--thread requires --reply\");\n }\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 if (fileSize === 0) {\n throw new Error(\"File is empty\");\n }\n if (fileSize > FEISHU_FILE_UPLOAD_MAX_BYTES) {\n throw new Error(\n `File exceeds Feishu's ${FEISHU_FILE_UPLOAD_MAX_BYTES}-byte limit`,\n );\n }\n\n const filename = basename(options.file);\n const contentType = options.contentType ?? inferContentType(options.file);\n const prepared = await initFeishuFileUpload({\n filename,\n contentType,\n length: fileSize,\n });\n const uploadResponse = await fetch(prepared.uploadUrl, {\n method: \"PUT\",\n headers: { \"Content-Type\": prepared.contentType },\n body: new Uint8Array(readFileSync(options.file)),\n });\n if (!uploadResponse.ok) {\n throw new Error(\n `File upload failed: ${uploadResponse.status} ${uploadResponse.statusText}`,\n );\n }\n\n const result = await completeFeishuFileUpload({\n uploadId: prepared.uploadId,\n installationId: options.installation,\n chat: options.chat,\n user: options.user,\n replyToMessageId: options.reply,\n replyInThread: options.thread,\n contentType: prepared.contentType,\n });\n console.log(JSON.stringify(result));\n }),\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;AAAA,SAAS,cAAc;AACvB,SAAS,UAAU,YAAY;AAQ/B,SAAS,eAAe,SAAyB;AAC/C,SAAO,KAAK,OAAO,GAAG,UAAU,SAAS,OAAO,EAAE,MAAM,GAAG,EAAE,CAAC,EAAE;AAClE;AAEA,SAAS,kBAAkB,OAAmC;AAC5D,MAAI,UAAU,UAAU,UAAU,SAAS;AACzC,UAAM,IAAI,MAAM,qCAAqC;AAAA,EACvD;AACA,SAAO;AACT;AAEO,IAAM,sBAAsB,IAAI,QAAQ,EAC5C,KAAK,eAAe,EACp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,IAAI,QAAQ,EAC1C,KAAK,QAAQ,EACb,YAAY,iDAAiD,EAC7D,WAAW,wBAAwB,EACnC,WAAW,mBAAmB,EAC9B,WAAW,iBAAiB,EAC5B;AAAA,EACC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOF;","names":["readFileSync","basename","basename","readFileSync"]}
1
+ {"version":3,"sources":["../src/commands/zero/feishu/index.ts","../src/commands/zero/feishu/download-file.ts","../src/commands/zero/feishu/message/index.ts","../src/commands/zero/feishu/message/send.ts","../src/commands/zero/feishu/upload-file.ts"],"sourcesContent":["import { Command } from \"commander\";\n\nimport { downloadFileCommand } from \"./download-file\";\nimport { zeroFeishuMessageCommand } from \"./message\";\nimport { uploadFileCommand } from \"./upload-file\";\n\nexport const zeroFeishuCommand = new Command()\n .name(\"feishu\")\n .description(\"Send messages and transfer files through Feishu\")\n .addCommand(zeroFeishuMessageCommand)\n .addCommand(downloadFileCommand)\n .addCommand(uploadFileCommand)\n .addHelpText(\n \"after\",\n `\nExamples:\n Send to a chat: zero feishu message send -c <chat-id> -t \"Hello!\"\n Send a DM: zero feishu message send -u <open-id> -t \"Hello!\"\n Reply in a thread: zero feishu message send -r <message-id> --thread -t \"Reply\"\n Upload a file: zero feishu upload-file -f /tmp/report.pdf -c <chat-id>\n Download a file: zero feishu download-file <message-id> <file-key> --type file`,\n );\n","import { tmpdir } from \"node:os\";\nimport { basename, join } from \"node:path\";\n\nimport { Command } from \"commander\";\nimport type { FeishuResourceType } from \"@vm0/api-contracts/contracts/integrations\";\n\nimport { downloadFeishuFile } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nfunction defaultOutPath(fileKey: string): string {\n return join(tmpdir(), `feishu-${basename(fileKey).slice(0, 80)}`);\n}\n\nfunction parseResourceType(value: string): FeishuResourceType {\n if (value !== \"file\" && value !== \"image\") {\n throw new Error(\"--type must be either file or image\");\n }\n return value;\n}\n\nexport const downloadFileCommand = new Command()\n .name(\"download-file\")\n .description(\"Download a file from a Feishu message\")\n .argument(\"<message-id>\", \"Message ID from a [Feishu file] block\")\n .argument(\"<file-key>\", \"File key from a [Feishu file] block\")\n .requiredOption(\n \"--type <type>\",\n \"Resource type from the block: file or image\",\n )\n .option(\"-i, --installation <id>\", \"Feishu installation ID\")\n .option(\"-o, --out <path>\", \"Output path (default: /tmp/feishu-<file-key>)\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Download a file: zero feishu download-file om_xxx file_xxx --type file\n Download an image: zero feishu download-file om_xxx img_xxx --type image -o /tmp/image.png\n Select an app: zero feishu download-file om_xxx file_xxx --type file -i <installation-id>\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"path\":\"/tmp/feishu-file_xxx\",\"mimetype\":\"application/pdf\",\"size\":12345}\n\nNotes:\n - Use the message ID, file key, and type exactly as shown in a [Feishu file] block\n - Specify --installation when the organization has multiple Feishu bots\n - Streams the file bytes directly to disk`,\n )\n .action(\n withErrorHandler(\n async (\n messageId: string,\n fileKey: string,\n options: {\n readonly type: string;\n readonly installation?: string;\n readonly out?: string;\n },\n ) => {\n const outPath = options.out ?? defaultOutPath(fileKey);\n const result = await downloadFeishuFile(\n messageId,\n fileKey,\n parseResourceType(options.type),\n options.installation,\n outPath,\n );\n console.log(JSON.stringify(result));\n },\n ),\n );\n","import { Command } from \"commander\";\n\nimport { sendCommand } from \"./send\";\n\nexport const zeroFeishuMessageCommand = new Command()\n .name(\"message\")\n .description(\"Send Feishu messages\")\n .addCommand(sendCommand);\n","import { readFileSync } from \"node:fs\";\n\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\n\nimport { sendFeishuMessage } from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\ninterface SendFeishuOptions {\n readonly installation?: string;\n readonly chat?: string;\n readonly user?: string;\n readonly reply?: string;\n readonly thread?: boolean;\n readonly text?: string;\n readonly card?: string;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction parseCard(\n input: string | undefined,\n): Record<string, unknown> | undefined {\n if (!input) {\n return undefined;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(input);\n } catch {\n throw new Error(\"Invalid JSON for --card flag\", {\n cause: new Error(\"Provide a valid Feishu card JSON object\"),\n });\n }\n if (!isRecord(parsed)) {\n throw new Error(\"Invalid JSON for --card\", {\n cause: new Error(\"Provide a Feishu card JSON object\"),\n });\n }\n return parsed;\n}\n\nexport const sendCommand = new Command()\n .name(\"send\")\n .description(\"Send a message to a Feishu chat or user\")\n .option(\"-i, --installation <id>\", \"Feishu installation ID\")\n .option(\"-c, --chat <id>\", \"Feishu chat ID\")\n .option(\"-u, --user <open-id>\", 'Feishu user open ID (use \"me\" for yourself)')\n .option(\"-r, --reply <message-id>\", \"Message ID to reply to\")\n .option(\"--thread\", \"Reply in a Feishu thread\")\n .option(\"-t, --text <message>\", \"Message text\")\n .option(\"--card <json>\", \"Feishu interactive card JSON\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Chat message: zero feishu message send -c oc_xxx -t \"Hello!\"\n Direct message: zero feishu message send -u ou_xxx -t \"Hello!\"\n DM yourself: zero feishu message send -u me -t \"Hello!\"\n Thread reply: zero feishu message send -r om_xxx --thread -t \"Reply\"\n Interactive card: zero feishu message send -c oc_xxx --card '{\"schema\":\"2.0\",\"body\":{\"elements\":[]}}'\n Select a custom app: zero feishu message send -i <installation-id> -c oc_xxx -t \"Hello!\"\n\nNotes:\n - Exactly one of --chat, --user, or --reply is required\n - Exactly one of --text or --card is required\n - --installation is required when the organization has multiple Feishu bots`,\n )\n .action(\n withErrorHandler(async (options: SendFeishuOptions) => {\n const targets = [options.chat, options.user, options.reply].filter(\n Boolean,\n );\n if (targets.length !== 1) {\n throw new Error(\n \"Exactly one of --chat, --user, or --reply must be provided\",\n );\n }\n if (options.thread && !options.reply) {\n throw new Error(\"--thread requires --reply\");\n }\n\n let text = options.text;\n if (!text && !options.card && !process.stdin.isTTY) {\n try {\n text = readFileSync(\"/dev/stdin\", \"utf8\").trim();\n } catch {\n // stdin is not readable; fall through to normal input validation.\n }\n }\n const card = parseCard(options.card);\n if (Boolean(text) === Boolean(card)) {\n throw new Error(\"Exactly one of --text or --card must be provided\");\n }\n\n const result = await sendFeishuMessage({\n installationId: options.installation,\n chat: options.chat,\n user: options.user,\n replyToMessageId: options.reply,\n replyInThread: options.thread,\n text,\n card,\n });\n console.log(chalk.green(`✓ Message sent (message: ${result.messageId})`));\n }),\n );\n","import { readFileSync, statSync } from \"node:fs\";\nimport { basename, extname } from \"node:path\";\n\nimport { Command } from \"commander\";\nimport { FEISHU_FILE_UPLOAD_MAX_BYTES } from \"@vm0/api-contracts/contracts/integrations\";\n\nimport {\n completeFeishuFileUpload,\n initFeishuFileUpload,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\n\nconst MIME_BY_EXTENSION: Readonly<Record<string, string>> = {\n \".csv\": \"text/csv\",\n \".gif\": \"image/gif\",\n \".jpeg\": \"image/jpeg\",\n \".jpg\": \"image/jpeg\",\n \".json\": \"application/json\",\n \".md\": \"text/markdown\",\n \".mov\": \"video/quicktime\",\n \".mp4\": \"video/mp4\",\n \".pdf\": \"application/pdf\",\n \".png\": \"image/png\",\n \".svg\": \"image/svg+xml\",\n \".txt\": \"text/plain\",\n \".webm\": \"video/webm\",\n \".webp\": \"image/webp\",\n};\n\ninterface UploadFeishuOptions {\n readonly file: string;\n readonly installation?: string;\n readonly chat?: string;\n readonly user?: string;\n readonly reply?: string;\n readonly thread?: boolean;\n readonly contentType?: string;\n}\n\nfunction inferContentType(localPath: string): string {\n return (\n MIME_BY_EXTENSION[extname(localPath).toLowerCase()] ??\n \"application/octet-stream\"\n );\n}\n\nexport const uploadFileCommand = new Command()\n .name(\"upload-file\")\n .description(\"Upload a local file to Feishu as an organization bot\")\n .requiredOption(\"-f, --file <path>\", \"Local file path to upload\")\n .option(\"-i, --installation <id>\", \"Feishu installation ID\")\n .option(\"-c, --chat <id>\", \"Feishu chat ID\")\n .option(\"-u, --user <open-id>\", 'Feishu user open ID (use \"me\" for yourself)')\n .option(\"-r, --reply <message-id>\", \"Message ID to reply to\")\n .option(\"--thread\", \"Reply in a Feishu thread\")\n .option(\"--content-type <mime>\", \"Override inferred content type\")\n .addHelpText(\n \"after\",\n `\nExamples:\n Upload to a chat: zero feishu upload-file -f /tmp/report.pdf -c oc_xxx\n Send a DM: zero feishu upload-file -f /tmp/report.pdf -u ou_xxx\n Reply with a file: zero feishu upload-file -f /tmp/report.pdf -r om_xxx --thread\n Select a custom app: zero feishu upload-file -f /tmp/report.pdf -i <installation-id> -c oc_xxx\n\nOutput:\n Prints a JSON object to stdout on success:\n {\"messageId\":\"om_xxx\",\"chatId\":\"oc_xxx\",\"fileKey\":\"file_xxx\",\"filename\":\"report.pdf\",\"mimetype\":\"application/pdf\",\"size\":12345,\"url\":\"https://...\"}\n\nNotes:\n - Exactly one of --chat, --user, or --reply is required\n - Feishu accepts non-empty files up to 30 MB\n - Specify --installation when the organization has multiple Feishu bots`,\n )\n .action(\n withErrorHandler(async (options: UploadFeishuOptions) => {\n const targets = [options.chat, options.user, options.reply].filter(\n Boolean,\n );\n if (targets.length !== 1) {\n throw new Error(\n \"Exactly one of --chat, --user, or --reply must be provided\",\n );\n }\n if (options.thread && !options.reply) {\n throw new Error(\"--thread requires --reply\");\n }\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 if (fileSize === 0) {\n throw new Error(\"File is empty\");\n }\n if (fileSize > FEISHU_FILE_UPLOAD_MAX_BYTES) {\n throw new Error(\n `File exceeds Feishu's ${FEISHU_FILE_UPLOAD_MAX_BYTES}-byte limit`,\n );\n }\n\n const filename = basename(options.file);\n const contentType = options.contentType ?? inferContentType(options.file);\n const prepared = await initFeishuFileUpload({\n filename,\n contentType,\n length: fileSize,\n supportsUploadHeaders: true,\n });\n const uploadResponse = await fetch(prepared.uploadUrl, {\n method: \"PUT\",\n headers: {\n \"Content-Type\": prepared.contentType,\n ...prepared.uploadHeaders,\n },\n body: new Uint8Array(readFileSync(options.file)),\n });\n if (!uploadResponse.ok) {\n throw new Error(\n `File upload failed: ${uploadResponse.status} ${uploadResponse.statusText}`,\n );\n }\n\n const result = await completeFeishuFileUpload({\n uploadId: prepared.uploadId,\n installationId: options.installation,\n chat: options.chat,\n user: options.user,\n replyToMessageId: options.reply,\n replyInThread: options.thread,\n contentType: prepared.contentType,\n });\n console.log(JSON.stringify(result));\n }),\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;AAAA,SAAS,cAAc;AACvB,SAAS,UAAU,YAAY;AAQ/B,SAAS,eAAe,SAAyB;AAC/C,SAAO,KAAK,OAAO,GAAG,UAAU,SAAS,OAAO,EAAE,MAAM,GAAG,EAAE,CAAC,EAAE;AAClE;AAEA,SAAS,kBAAkB,OAAmC;AAC5D,MAAI,UAAU,UAAU,UAAU,SAAS;AACzC,UAAM,IAAI,MAAM,qCAAqC;AAAA,EACvD;AACA,SAAO;AACT;AAEO,IAAM,sBAAsB,IAAI,QAAQ,EAC5C,KAAK,eAAe,EACpB,YAAY,uCAAuC,EACnD,SAAS,gBAAgB,uCAAuC,EAChE,SAAS,cAAc,qCAAqC,EAC5D;AAAA,EACC;AAAA,EACA;AACF,EACC,OAAO,2BAA2B,wBAAwB,EAC1D,OAAO,oBAAoB,+CAA+C,EAC1E;AAAA,EACC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcF,EACC;AAAA,EACC;AAAA,IACE,OACE,WACA,SACA,YAKG;AACH,YAAM,UAAU,QAAQ,OAAO,eAAe,OAAO;AACrD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AM,IAAI;AAAA,QACR,yBAAyB,4BAA4B;AAAA,MACvD;AAAA,IACF;AAEA,UAAM,WAAWC,UAAS,QAAQ,IAAI;AACtC,UAAM,cAAc,QAAQ,eAAe,iBAAiB,QAAQ,IAAI;AACxE,UAAM,WAAW,MAAM,qBAAqB;AAAA,MAC1C;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR,uBAAuB;AAAA,IACzB,CAAC;AACD,UAAM,iBAAiB,MAAM,MAAM,SAAS,WAAW;AAAA,MACrD,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,gBAAgB,SAAS;AAAA,QACzB,GAAG,SAAS;AAAA,MACd;AAAA,MACA,MAAM,IAAI,WAAWC,cAAa,QAAQ,IAAI,CAAC;AAAA,IACjD,CAAC;AACD,QAAI,CAAC,eAAe,IAAI;AACtB,YAAM,IAAI;AAAA,QACR,uBAAuB,eAAe,MAAM,IAAI,eAAe,UAAU;AAAA,MAC3E;AAAA,IACF;AAEA,UAAM,SAAS,MAAM,yBAAyB;AAAA,MAC5C,UAAU,SAAS;AAAA,MACnB,gBAAgB,QAAQ;AAAA,MACxB,MAAM,QAAQ;AAAA,MACd,MAAM,QAAQ;AAAA,MACd,kBAAkB,QAAQ;AAAA,MAC1B,eAAe,QAAQ;AAAA,MACvB,aAAa,SAAS;AAAA,IACxB,CAAC;AACD,YAAQ,IAAI,KAAK,UAAU,MAAM,CAAC;AAAA,EACpC,CAAC;AACH;;;AJzIK,IAAM,oBAAoB,IAAI,QAAQ,EAC1C,KAAK,QAAQ,EACb,YAAY,iDAAiD,EAC7D,WAAW,wBAAwB,EACnC,WAAW,mBAAmB,EAC9B,WAAW,iBAAiB,EAC5B;AAAA,EACC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOF;","names":["readFileSync","basename","basename","readFileSync"]}
@@ -14,13 +14,13 @@ import {
14
14
  zeroFinanceQuoteRequestSchema,
15
15
  zeroFinanceRangeSchema,
16
16
  zeroFinanceSearchRequestSchema
17
- } from "./chunk-IRYWZDHD.js";
18
- import "./chunk-6APTUGDE.js";
17
+ } from "./chunk-TZDXFY6G.js";
18
+ import "./chunk-JXUQQIUP.js";
19
19
  import "./chunk-MA22KQYU.js";
20
20
  import {
21
21
  source_default,
22
22
  withErrorHandler
23
- } from "./chunk-LRNTCZW5.js";
23
+ } from "./chunk-D7TEG7WN.js";
24
24
  import "./chunk-MD3YWUKO.js";
25
25
  import {
26
26
  Command,
@@ -125,4 +125,4 @@ Notes:
125
125
  export {
126
126
  zeroFinanceCommand
127
127
  };
128
- //# sourceMappingURL=finance-AXTNCFO2.js.map
128
+ //# sourceMappingURL=finance-QRINPXNY.js.map
@@ -19,7 +19,7 @@ import {
19
19
  resolvePresentationRunbookColorToken,
20
20
  selectResourceCandidates,
21
21
  toGenerationTarget
22
- } from "./chunk-NZHREXMF.js";
22
+ } from "./chunk-TM6A5MNI.js";
23
23
  import {
24
24
  currentPlanAllowsVideo,
25
25
  currentTokenCanReadBilling
@@ -29,24 +29,24 @@ import {
29
29
  getZeroBillingStatus,
30
30
  listZeroConnectorCatalog,
31
31
  listZeroConnectorCatalogStatus
32
- } from "./chunk-IRYWZDHD.js";
32
+ } from "./chunk-TZDXFY6G.js";
33
33
  import {
34
34
  generateWebImage,
35
35
  generateWebVideo,
36
36
  generateWebVoice
37
- } from "./chunk-6APTUGDE.js";
37
+ } from "./chunk-JXUQQIUP.js";
38
38
  import {
39
39
  planUpgradeUrl
40
40
  } from "./chunk-2NW76WYJ.js";
41
41
  import {
42
42
  getPlatformOrigin
43
- } from "./chunk-TRGD5ZVE.js";
43
+ } from "./chunk-CCUKVMAH.js";
44
44
  import "./chunk-MA22KQYU.js";
45
45
  import {
46
46
  ApiRequestError,
47
47
  source_default,
48
48
  withErrorHandler
49
- } from "./chunk-LRNTCZW5.js";
49
+ } from "./chunk-D7TEG7WN.js";
50
50
  import "./chunk-MD3YWUKO.js";
51
51
  import {
52
52
  Command,
@@ -2804,4 +2804,4 @@ var generateCommand = new Command().name("generate").description(
2804
2804
  export {
2805
2805
  generateCommand
2806
2806
  };
2807
- //# sourceMappingURL=generate-2WUDNC2R.js.map
2807
+ //# sourceMappingURL=generate-OR4TSIMU.js.map
@@ -5,12 +5,12 @@ import {
5
5
  completeGithubFileUpload,
6
6
  downloadGithubFile,
7
7
  initGithubFileUpload
8
- } from "./chunk-IRYWZDHD.js";
9
- import "./chunk-6APTUGDE.js";
8
+ } from "./chunk-TZDXFY6G.js";
9
+ import "./chunk-JXUQQIUP.js";
10
10
  import "./chunk-MA22KQYU.js";
11
11
  import {
12
12
  withErrorHandler
13
- } from "./chunk-LRNTCZW5.js";
13
+ } from "./chunk-D7TEG7WN.js";
14
14
  import "./chunk-MD3YWUKO.js";
15
15
  import {
16
16
  Command
@@ -165,12 +165,16 @@ Notes:
165
165
  const prepared = await initGithubFileUpload({
166
166
  filename,
167
167
  contentType,
168
- length: fileSize
168
+ length: fileSize,
169
+ supportsUploadHeaders: true
169
170
  });
170
171
  const fileContent = readFileSync(options.file);
171
172
  const uploadResponse = await fetch(prepared.uploadUrl, {
172
173
  method: "PUT",
173
- headers: { "Content-Type": prepared.contentType },
174
+ headers: {
175
+ "Content-Type": prepared.contentType,
176
+ ...prepared.uploadHeaders
177
+ },
174
178
  body: new Uint8Array(fileContent)
175
179
  });
176
180
  if (!uploadResponse.ok) {
@@ -201,4 +205,4 @@ Examples:
201
205
  export {
202
206
  zeroGithubCommand
203
207
  };
204
- //# sourceMappingURL=github-Z3ZI2RYC.js.map
208
+ //# sourceMappingURL=github-B6FLS3YK.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/commands/zero/github/index.ts","../src/commands/zero/github/download-file.ts","../src/commands/zero/github/upload-file.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { downloadFileCommand } from \"./download-file\";\nimport { uploadFileCommand } from \"./upload-file\";\n\nexport const zeroGithubCommand = new Command()\n .name(\"github\")\n .description(\"Upload and download GitHub files\")\n .addCommand(downloadFileCommand)\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 );\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 safeDefaultFilename(filename: string): string {\n const component = basename(filename.replaceAll(\"\\\\\", \"/\"));\n if (!component || component === \".\" || component === \"..\") {\n return \"file\";\n }\n return component;\n}\n\nfunction defaultOutPath(fileUrl: string, filename?: string): string {\n return join(\n tmpdir(),\n `github-${safeDefaultFilename(filename || filenameFromUrl(fileUrl))}`,\n );\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): transcribe audio first with\n zero video transcribe --url <download-url>\n or extract frames with\n ffmpeg -i <path> -vf \"fps=1\" -q:v 2 /tmp/github_frame_%03d.jpg\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 { 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"],"mappings":";;;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AACd,YAAI,iBAAiB,SAAS,MAAM,QAAQ,WAAW,MAAM,GAAG;AAC9D,gBAAM;AAAA,QACR;AACA,cAAM,IAAI,MAAM,mBAAmB,QAAQ,IAAI,EAAE;AAAA,MACnD;AAEA,UAAI,aAAa,GAAG;AAClB,cAAM,IAAI,MAAM,eAAe;AAAA,MACjC;AAEA,YAAM,WAAWC,UAAS,QAAQ,IAAI;AACtC,YAAM,cACJ,QAAQ,eAAe,iBAAiB,QAAQ,IAAI;AACtD,YAAM,cAAc,iBAAiB,QAAQ,WAAW;AAExD,YAAM,WAAW,MAAM,qBAAqB;AAAA,QAC1C;AAAA,QACA;AAAA,QACA,QAAQ;AAAA,MACV,CAAC;AAED,YAAM,cAAc,aAAa,QAAQ,IAAI;AAC7C,YAAM,iBAAiB,MAAM,MAAM,SAAS,WAAW;AAAA,QACrD,QAAQ;AAAA,QACR,SAAS,EAAE,gBAAgB,SAAS,YAAY;AAAA,QAChD,MAAM,IAAI,WAAW,WAAW;AAAA,MAClC,CAAC;AAED,UAAI,CAAC,eAAe,IAAI;AACtB,cAAM,IAAI;AAAA,UACR,uBAAuB,eAAe,MAAM,IAAI,eAAe,UAAU;AAAA,QAC3E;AAAA,MACF;AAEA,YAAM,SAAS,MAAM,yBAAyB;AAAA,QAC5C,UAAU,SAAS;AAAA,QACnB,MAAM,QAAQ;AAAA,QACd;AAAA,QACA,aAAa,SAAS;AAAA,QACtB,SAAS,QAAQ;AAAA,MACnB,CAAC;AAED,cAAQ,IAAI,KAAK,UAAU,MAAM,CAAC;AAAA,IACpC;AAAA,EACF;AACF;;;AF3HK,IAAM,oBAAoB,IAAI,QAAQ,EAC1C,KAAK,QAAQ,EACb,YAAY,kCAAkC,EAC9C,WAAW,mBAAmB,EAC9B,WAAW,iBAAiB,EAC5B;AAAA,EACC;AAAA,EACA;AAAA;AAAA;AAAA;AAIF;","names":["basename","basename"]}
1
+ {"version":3,"sources":["../src/commands/zero/github/index.ts","../src/commands/zero/github/download-file.ts","../src/commands/zero/github/upload-file.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { downloadFileCommand } from \"./download-file\";\nimport { uploadFileCommand } from \"./upload-file\";\n\nexport const zeroGithubCommand = new Command()\n .name(\"github\")\n .description(\"Upload and download GitHub files\")\n .addCommand(downloadFileCommand)\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 );\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 safeDefaultFilename(filename: string): string {\n const component = basename(filename.replaceAll(\"\\\\\", \"/\"));\n if (!component || component === \".\" || component === \"..\") {\n return \"file\";\n }\n return component;\n}\n\nfunction defaultOutPath(fileUrl: string, filename?: string): string {\n return join(\n tmpdir(),\n `github-${safeDefaultFilename(filename || filenameFromUrl(fileUrl))}`,\n );\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): transcribe audio first with\n zero video transcribe --url <download-url>\n or extract frames with\n ffmpeg -i <path> -vf \"fps=1\" -q:v 2 /tmp/github_frame_%03d.jpg\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 { 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 supportsUploadHeaders: true,\n });\n\n const fileContent = readFileSync(options.file);\n const uploadResponse = await fetch(prepared.uploadUrl, {\n method: \"PUT\",\n headers: {\n \"Content-Type\": prepared.contentType,\n ...prepared.uploadHeaders,\n },\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;AAAA,SAAS,UAAU,YAAY;AAC/B,SAAS,cAAc;AAKvB,SAAS,gBAAgB,SAAyB;AAChD,MAAI,IAAI,SAAS,OAAO,GAAG;AACzB,UAAM,UAAU,IAAI,IAAI,OAAO,EAAE,SAAS,MAAM,GAAG,EAAE,OAAO,OAAO,EAAE,IAAI;AACzE,QAAI,CAAC,SAAS;AACZ,aAAO;AAAA,IACT;AACA,QAAI;AACF,aAAO,mBAAmB,OAAO;AAAA,IACnC,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO,SAAS,OAAO,KAAK;AAC9B;AAEA,SAAS,oBAAoB,UAA0B;AACrD,QAAM,YAAY,SAAS,SAAS,WAAW,MAAM,GAAG,CAAC;AACzD,MAAI,CAAC,aAAa,cAAc,OAAO,cAAc,MAAM;AACzD,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,SAAS,eAAe,SAAiB,UAA2B;AAClE,SAAO;AAAA,IACL,OAAO;AAAA,IACP,UAAU,oBAAoB,YAAY,gBAAgB,OAAO,CAAC,CAAC;AAAA,EACrE;AACF;AAEO,IAAM,sBAAsB,IAAI,QAAQ,EAC5C,KAAK,eAAe,EACpB,YAAY,6CAA6C,EACzD,SAAS,SAAS,gCAAgC,EAClD;AAAA,EACC;AAAA,EACA;AACF,EACC,OAAO,qBAAqB,4CAA4C,EACxE;AAAA,EACC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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