@vm0/cli 9.253.0 → 9.254.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 (105) hide show
  1. package/{agent-X6O3YR4M.js → agent-RMGI2J4J.js} +7 -7
  2. package/{banking-NGZXYSVB.js → banking-MY3UOHLJ.js} +5 -5
  3. package/chat-YXUYGE6R.js +622 -0
  4. package/chat-YXUYGE6R.js.map +1 -0
  5. package/{chunk-2E37DQSD.js → chunk-5SWLOAHS.js} +2 -2
  6. package/{chunk-7YTIE7KU.js → chunk-7JATDT76.js} +147 -46
  7. package/{chunk-7YTIE7KU.js.map → chunk-7JATDT76.js.map} +1 -1
  8. package/{chunk-RANJI5FZ.js → chunk-7U3FWIOP.js} +2 -2
  9. package/chunk-B6ELBBRJ.js +83 -0
  10. package/chunk-B6ELBBRJ.js.map +1 -0
  11. package/{chunk-XM3WOXFE.js → chunk-CMTIFAL7.js} +4 -4
  12. package/{chunk-KMRZUQHC.js → chunk-D4OTAABD.js} +3 -2
  13. package/{chunk-KMRZUQHC.js.map → chunk-D4OTAABD.js.map} +1 -1
  14. package/{chunk-7JNLGFRW.js → chunk-ES2FTLAP.js} +9 -76
  15. package/{chunk-7JNLGFRW.js.map → chunk-ES2FTLAP.js.map} +1 -1
  16. package/{chunk-RMLNBK2X.js → chunk-OVTYR6LM.js} +2 -2
  17. package/{chunk-2YJV4T5H.js → chunk-RPYYZK6K.js} +41 -5
  18. package/chunk-RPYYZK6K.js.map +1 -0
  19. package/{chunk-LIT3JQQR.js → chunk-SISEWEDH.js} +2 -2
  20. package/{chunk-FJFJLQQW.js → chunk-UUKFGXX5.js} +2 -2
  21. package/{chunk-LO2JYFNP.js → chunk-YHVB66HI.js} +2 -2
  22. package/{computer-use-C3HZXTKZ.js → computer-use-SLXQQH6Q.js} +5 -5
  23. package/{connector-DPZKQG4U.js → connector-KVBWTIAC.js} +8 -8
  24. package/{credit-WY6P3D6B.js → credit-RNDNLWHJ.js} +7 -7
  25. package/{developer-support-RYY76Y65.js → developer-support-CFRQKOWQ.js} +5 -5
  26. package/{doctor-XZH52P7J.js → doctor-FAAS4UMJ.js} +7 -7
  27. package/{feishu-HLSIBEHH.js → feishu-RLVDQZZT.js} +5 -5
  28. package/{finance-IWVIYPXL.js → finance-SASI7YWY.js} +5 -5
  29. package/{generate-IAA656VE.js → generate-TTD32HUK.js} +7 -7
  30. package/{github-MJZJ2VLC.js → github-5TLXNMQW.js} +5 -5
  31. package/{goal-7OCVIFTQ.js → goal-XLBFOMEC.js} +5 -5
  32. package/{host-KX7NPRZM.js → host-G2TQRV4H.js} +5 -5
  33. package/{logs-AHOU7TJL.js → logs-YB3S2OWH.js} +12 -10
  34. package/{logs-AHOU7TJL.js.map → logs-YB3S2OWH.js.map} +1 -1
  35. package/{mail-D3YBSKA6.js → mail-446A7J5Y.js} +7 -7
  36. package/{maps-AT7I4KK6.js → maps-5WELBNFI.js} +5 -5
  37. package/{model-7AEJV5QI.js → model-WTBLQPBE.js} +6 -6
  38. package/{model-provider-CNTRAXGR.js → model-provider-DFU346QW.js} +6 -6
  39. package/{org-4EOIMAMU.js → org-DPZYCCSA.js} +5 -5
  40. package/package.json +1 -1
  41. package/{people-search-YIPV2HRX.js → people-search-OI637MVP.js} +5 -5
  42. package/{phone-RGFGHH4G.js → phone-JJBH46SC.js} +5 -5
  43. package/{preference-UIFDOWCE.js → preference-WDN7V4ZO.js} +5 -5
  44. package/{resource-UCO5W2EM.js → resource-QZJY6YQN.js} +5 -5
  45. package/{scrape-V6KXL77N.js → scrape-BNBCWLIJ.js} +5 -5
  46. package/{search-FKCTV4PA.js → search-BK4RVQZI.js} +11 -9
  47. package/{search-FKCTV4PA.js.map → search-BK4RVQZI.js.map} +1 -1
  48. package/{secret-ZOUQEPTX.js → secret-74X2Y5XO.js} +5 -5
  49. package/{slack-4WKWNC54.js → slack-HHZLW2WS.js} +5 -5
  50. package/{teams-MRN5OZEA.js → teams-SPHFPBB3.js} +5 -5
  51. package/{telegram-DJ6DOWYM.js → telegram-QXFDSGQX.js} +5 -5
  52. package/{upgrade-2VYHUARI.js → upgrade-IXKNUAPA.js} +4 -4
  53. package/{variable-6SNXAUY7.js → variable-HTV3JLS7.js} +5 -5
  54. package/{video-DF4MZ6J2.js → video-AVKB4NEL.js} +4 -4
  55. package/{weather-PATAREUP.js → weather-GAER2LFF.js} +5 -5
  56. package/{web-GMBMMBHY.js → web-PF3ZHXHX.js} +5 -5
  57. package/{web-search-SYJ7DI6M.js → web-search-ZPAQX3HG.js} +5 -5
  58. package/{whoami-KD3QSC6J.js → whoami-WPZMQHJF.js} +7 -7
  59. package/{workflow-DATIF2MF.js → workflow-M5KSFXFM.js} +5 -5
  60. package/zero.js +42 -42
  61. package/chat-CRY62LOA.js +0 -246
  62. package/chat-CRY62LOA.js.map +0 -1
  63. package/chunk-2YJV4T5H.js.map +0 -1
  64. /package/{agent-X6O3YR4M.js.map → agent-RMGI2J4J.js.map} +0 -0
  65. /package/{banking-NGZXYSVB.js.map → banking-MY3UOHLJ.js.map} +0 -0
  66. /package/{chunk-2E37DQSD.js.map → chunk-5SWLOAHS.js.map} +0 -0
  67. /package/{chunk-RANJI5FZ.js.map → chunk-7U3FWIOP.js.map} +0 -0
  68. /package/{chunk-XM3WOXFE.js.map → chunk-CMTIFAL7.js.map} +0 -0
  69. /package/{chunk-RMLNBK2X.js.map → chunk-OVTYR6LM.js.map} +0 -0
  70. /package/{chunk-LIT3JQQR.js.map → chunk-SISEWEDH.js.map} +0 -0
  71. /package/{chunk-FJFJLQQW.js.map → chunk-UUKFGXX5.js.map} +0 -0
  72. /package/{chunk-LO2JYFNP.js.map → chunk-YHVB66HI.js.map} +0 -0
  73. /package/{computer-use-C3HZXTKZ.js.map → computer-use-SLXQQH6Q.js.map} +0 -0
  74. /package/{connector-DPZKQG4U.js.map → connector-KVBWTIAC.js.map} +0 -0
  75. /package/{credit-WY6P3D6B.js.map → credit-RNDNLWHJ.js.map} +0 -0
  76. /package/{developer-support-RYY76Y65.js.map → developer-support-CFRQKOWQ.js.map} +0 -0
  77. /package/{doctor-XZH52P7J.js.map → doctor-FAAS4UMJ.js.map} +0 -0
  78. /package/{feishu-HLSIBEHH.js.map → feishu-RLVDQZZT.js.map} +0 -0
  79. /package/{finance-IWVIYPXL.js.map → finance-SASI7YWY.js.map} +0 -0
  80. /package/{generate-IAA656VE.js.map → generate-TTD32HUK.js.map} +0 -0
  81. /package/{github-MJZJ2VLC.js.map → github-5TLXNMQW.js.map} +0 -0
  82. /package/{goal-7OCVIFTQ.js.map → goal-XLBFOMEC.js.map} +0 -0
  83. /package/{host-KX7NPRZM.js.map → host-G2TQRV4H.js.map} +0 -0
  84. /package/{mail-D3YBSKA6.js.map → mail-446A7J5Y.js.map} +0 -0
  85. /package/{maps-AT7I4KK6.js.map → maps-5WELBNFI.js.map} +0 -0
  86. /package/{model-7AEJV5QI.js.map → model-WTBLQPBE.js.map} +0 -0
  87. /package/{model-provider-CNTRAXGR.js.map → model-provider-DFU346QW.js.map} +0 -0
  88. /package/{org-4EOIMAMU.js.map → org-DPZYCCSA.js.map} +0 -0
  89. /package/{people-search-YIPV2HRX.js.map → people-search-OI637MVP.js.map} +0 -0
  90. /package/{phone-RGFGHH4G.js.map → phone-JJBH46SC.js.map} +0 -0
  91. /package/{preference-UIFDOWCE.js.map → preference-WDN7V4ZO.js.map} +0 -0
  92. /package/{resource-UCO5W2EM.js.map → resource-QZJY6YQN.js.map} +0 -0
  93. /package/{scrape-V6KXL77N.js.map → scrape-BNBCWLIJ.js.map} +0 -0
  94. /package/{secret-ZOUQEPTX.js.map → secret-74X2Y5XO.js.map} +0 -0
  95. /package/{slack-4WKWNC54.js.map → slack-HHZLW2WS.js.map} +0 -0
  96. /package/{teams-MRN5OZEA.js.map → teams-SPHFPBB3.js.map} +0 -0
  97. /package/{telegram-DJ6DOWYM.js.map → telegram-QXFDSGQX.js.map} +0 -0
  98. /package/{upgrade-2VYHUARI.js.map → upgrade-IXKNUAPA.js.map} +0 -0
  99. /package/{variable-6SNXAUY7.js.map → variable-HTV3JLS7.js.map} +0 -0
  100. /package/{video-DF4MZ6J2.js.map → video-AVKB4NEL.js.map} +0 -0
  101. /package/{weather-PATAREUP.js.map → weather-GAER2LFF.js.map} +0 -0
  102. /package/{web-GMBMMBHY.js.map → web-PF3ZHXHX.js.map} +0 -0
  103. /package/{web-search-SYJ7DI6M.js.map → web-search-ZPAQX3HG.js.map} +0 -0
  104. /package/{whoami-KD3QSC6J.js.map → whoami-WPZMQHJF.js.map} +0 -0
  105. /package/{workflow-DATIF2MF.js.map → workflow-M5KSFXFM.js.map} +0 -0
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from "node:module";
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  getApiUrl
6
- } from "./chunk-7YTIE7KU.js";
6
+ } from "./chunk-7JATDT76.js";
7
7
  import {
8
8
  init_esm_shims
9
9
  } from "./chunk-3VVCUQPB.js";
@@ -42,4 +42,4 @@ export {
42
42
  toPlatformUrl,
43
43
  getPlatformOrigin
44
44
  };
45
- //# sourceMappingURL=chunk-RANJI5FZ.js.map
45
+ //# sourceMappingURL=chunk-7U3FWIOP.js.map
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from "node:module";
3
+ const require = __createRequire(import.meta.url);
4
+ import {
5
+ init_esm_shims
6
+ } from "./chunk-3VVCUQPB.js";
7
+
8
+ // src/lib/utils/time-format.ts
9
+ init_esm_shims();
10
+ function formatIsoTimestamp(value) {
11
+ const timestamp = value instanceof Date ? value : new Date(value);
12
+ if (!Number.isFinite(timestamp.getTime())) {
13
+ return "invalid-date";
14
+ }
15
+ return timestamp.toISOString().replace(/\.\d{3}Z$/, "Z");
16
+ }
17
+
18
+ // src/lib/utils/log-pagination.ts
19
+ init_esm_shims();
20
+ function parsePositiveLogCount(value, optionName) {
21
+ const trimmed = value.trim();
22
+ if (!/^0*[1-9]\d*$/.test(trimmed)) {
23
+ throw new Error(`Option ${optionName} must be a positive integer`);
24
+ }
25
+ const count = Number(trimmed);
26
+ if (!Number.isSafeInteger(count)) {
27
+ throw new Error(`Option ${optionName} must be a positive integer`);
28
+ }
29
+ return count;
30
+ }
31
+ function parseBoundedLogCount(value, optionName, min, max) {
32
+ const trimmed = value.trim();
33
+ if (!/^\d+$/.test(trimmed)) {
34
+ throw new Error(`${optionName} must be between ${min} and ${max}`);
35
+ }
36
+ const count = Number(trimmed);
37
+ if (!Number.isSafeInteger(count) || count < min || count > max) {
38
+ throw new Error(`${optionName} must be between ${min} and ${max}`);
39
+ }
40
+ return count;
41
+ }
42
+ async function collectLogItems(options) {
43
+ const collected = [];
44
+ const seenCursors = /* @__PURE__ */ new Set();
45
+ let cursor;
46
+ while (true) {
47
+ const requestLimit = options.targetCount === "all" ? options.pageLimit : Math.min(options.pageLimit, options.targetCount - collected.length);
48
+ const page = await options.fetchPage({
49
+ sinceTime: options.sinceTime,
50
+ cursor,
51
+ limit: requestLimit,
52
+ order: options.order
53
+ });
54
+ collected.push(...page.items);
55
+ if (options.targetCount !== "all" && collected.length >= options.targetCount) {
56
+ break;
57
+ }
58
+ const nextCursor = page.nextCursor ?? null;
59
+ if (!page.hasMore || !nextCursor || seenCursors.has(nextCursor)) {
60
+ break;
61
+ }
62
+ seenCursors.add(nextCursor);
63
+ cursor = nextCursor;
64
+ }
65
+ const entries = options.targetCount === "all" ? collected : collected.slice(0, options.targetCount);
66
+ return options.order === "desc" ? entries.reverse() : entries;
67
+ }
68
+
69
+ // src/lib/utils/uuid.ts
70
+ init_esm_shims();
71
+ var UUID_PATTERN = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
72
+ function isUuid(value) {
73
+ return UUID_PATTERN.test(value);
74
+ }
75
+
76
+ export {
77
+ formatIsoTimestamp,
78
+ parsePositiveLogCount,
79
+ parseBoundedLogCount,
80
+ collectLogItems,
81
+ isUuid
82
+ };
83
+ //# sourceMappingURL=chunk-B6ELBBRJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/utils/time-format.ts","../src/lib/utils/log-pagination.ts","../src/lib/utils/uuid.ts"],"sourcesContent":["export function formatIsoTimestamp(value: Date | string): string {\n const timestamp = value instanceof Date ? value : new Date(value);\n if (!Number.isFinite(timestamp.getTime())) {\n return \"invalid-date\";\n }\n return timestamp.toISOString().replace(/\\.\\d{3}Z$/, \"Z\");\n}\n","type LogOrder = \"asc\" | \"desc\";\n\ninterface CursorLogPageRequest {\n readonly sinceTime?: number;\n readonly cursor?: string;\n readonly limit: number;\n readonly order: LogOrder;\n}\n\ninterface CursorLogPage<T> {\n readonly items: readonly T[];\n readonly hasMore: boolean;\n readonly nextCursor?: string | null;\n}\n\ninterface CollectLogItemsOptions<T> {\n readonly fetchPage: (\n request: CursorLogPageRequest,\n ) => Promise<CursorLogPage<T>>;\n readonly sinceTime?: number;\n readonly targetCount: number | \"all\";\n readonly order: LogOrder;\n readonly pageLimit: number;\n}\n\nexport function parsePositiveLogCount(\n value: string,\n optionName: string,\n): number {\n const trimmed = value.trim();\n if (!/^0*[1-9]\\d*$/.test(trimmed)) {\n throw new Error(`Option ${optionName} must be a positive integer`);\n }\n\n const count = Number(trimmed);\n if (!Number.isSafeInteger(count)) {\n throw new Error(`Option ${optionName} must be a positive integer`);\n }\n\n return count;\n}\n\nexport function parseBoundedLogCount(\n value: string,\n optionName: string,\n min: number,\n max: number,\n): number {\n const trimmed = value.trim();\n if (!/^\\d+$/.test(trimmed)) {\n throw new Error(`${optionName} must be between ${min} and ${max}`);\n }\n\n const count = Number(trimmed);\n if (!Number.isSafeInteger(count) || count < min || count > max) {\n throw new Error(`${optionName} must be between ${min} and ${max}`);\n }\n\n return count;\n}\n\nexport async function collectLogItems<T>(\n options: CollectLogItemsOptions<T>,\n): Promise<T[]> {\n const collected: T[] = [];\n const seenCursors = new Set<string>();\n let cursor: string | undefined;\n\n while (true) {\n const requestLimit =\n options.targetCount === \"all\"\n ? options.pageLimit\n : Math.min(options.pageLimit, options.targetCount - collected.length);\n\n const page = await options.fetchPage({\n sinceTime: options.sinceTime,\n cursor,\n limit: requestLimit,\n order: options.order,\n });\n\n collected.push(...page.items);\n\n if (\n options.targetCount !== \"all\" &&\n collected.length >= options.targetCount\n ) {\n break;\n }\n\n const nextCursor = page.nextCursor ?? null;\n if (!page.hasMore || !nextCursor || seenCursors.has(nextCursor)) {\n break;\n }\n\n seenCursors.add(nextCursor);\n cursor = nextCursor;\n }\n\n const entries =\n options.targetCount === \"all\"\n ? collected\n : collected.slice(0, options.targetCount);\n\n return options.order === \"desc\" ? entries.reverse() : entries;\n}\n","const UUID_PATTERN =\n /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;\n\nexport function isUuid(value: string): boolean {\n return UUID_PATTERN.test(value);\n}\n"],"mappings":";;;;;;;;AAAA;AAAO,SAAS,mBAAmB,OAA8B;AAC/D,QAAM,YAAY,iBAAiB,OAAO,QAAQ,IAAI,KAAK,KAAK;AAChE,MAAI,CAAC,OAAO,SAAS,UAAU,QAAQ,CAAC,GAAG;AACzC,WAAO;AAAA,EACT;AACA,SAAO,UAAU,YAAY,EAAE,QAAQ,aAAa,GAAG;AACzD;;;ACNA;AAyBO,SAAS,sBACd,OACA,YACQ;AACR,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,CAAC,eAAe,KAAK,OAAO,GAAG;AACjC,UAAM,IAAI,MAAM,UAAU,UAAU,6BAA6B;AAAA,EACnE;AAEA,QAAM,QAAQ,OAAO,OAAO;AAC5B,MAAI,CAAC,OAAO,cAAc,KAAK,GAAG;AAChC,UAAM,IAAI,MAAM,UAAU,UAAU,6BAA6B;AAAA,EACnE;AAEA,SAAO;AACT;AAEO,SAAS,qBACd,OACA,YACA,KAC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,13 @@ import { createRequire as __createRequire } from "node:module";
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  resolveFirewallMetadataPolicies
6
- } from "./chunk-RMLNBK2X.js";
6
+ } from "./chunk-OVTYR6LM.js";
7
7
  import {
8
8
  getZeroConnectorCatalogPermissions
9
- } from "./chunk-2YJV4T5H.js";
9
+ } from "./chunk-RPYYZK6K.js";
10
10
  import {
11
11
  source_default
12
- } from "./chunk-7YTIE7KU.js";
12
+ } from "./chunk-7JATDT76.js";
13
13
  import {
14
14
  init_esm_shims
15
15
  } from "./chunk-3VVCUQPB.js";
@@ -89,4 +89,4 @@ export {
89
89
  policyIcon,
90
90
  loadConnectorPermissionInfos
91
91
  };
92
- //# sourceMappingURL=chunk-XM3WOXFE.js.map
92
+ //# sourceMappingURL=chunk-CMTIFAL7.js.map
@@ -427,7 +427,8 @@ var FEATURE_SWITCHES = {
427
427
  ["hostedArtifactVersions" /* HostedArtifactVersions */]: {
428
428
  maintainer: "yuma@vm0.ai",
429
429
  description: "Create immutable hosted artifact versions behind stable site aliases.",
430
- enabled: false
430
+ enabled: false,
431
+ enabledOrgIdHashes: STAFF_ORG_ID_HASHES
431
432
  },
432
433
  ["videoArtifactPosters" /* VideoArtifactPosters */]: {
433
434
  maintainer: "bingjie@vm0.ai",
@@ -524,4 +525,4 @@ export {
524
525
  isFeatureEnabled,
525
526
  decodeZeroTokenPayload
526
527
  };
527
- //# sourceMappingURL=chunk-KMRZUQHC.js.map
528
+ //# sourceMappingURL=chunk-D4OTAABD.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../packages/connectors/src/feature-switch-key.ts","../../../packages/core/src/feature-switch.ts","../../../packages/core/src/feature-switch-key.ts","../../../packages/core/src/identity-hash.ts","../src/lib/api/zero-token.ts"],"sourcesContent":["/**\n * Feature switch keys\n *\n * Defines all available feature switch identifiers.\n */\nexport enum FeatureSwitchKey {\n Dummy = \"dummy\",\n ExternalConnectorCatalog = \"externalConnectorCatalog\",\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 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 CanonicalSlackIngress = \"canonicalSlackIngress\",\n CanonicalSlackWebVisibility = \"canonicalSlackWebVisibility\",\n CanonicalSlackAssets = \"canonicalSlackAssets\",\n ZeroWeather = \"zeroWeather\",\n ZeroFinance = \"zeroFinance\",\n ZeroPeopleSearch = \"zeroPeopleSearch\",\n Banking = \"banking\",\n Lab = \"lab\",\n NotionWorkflowAutomations = \"notionWorkflowAutomations\",\n GithubWebhookAutomations = \"githubWebhookAutomations\",\n GithubWorkflowRunAutomations = \"githubWorkflowRunAutomations\",\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 RealAgentInPreview = \"realAgentInPreview\",\n ComposerUploadPopover = \"composerUploadPopover\",\n StructuredPrompt = \"structuredPrompt\",\n\n ZapierConnector = \"zapierConnector\",\n HtmlArtifactCommentEditing = \"htmlArtifactCommentEditing\",\n ComputerUseDesktopPlugins = \"computerUseDesktopPlugins\",\n AgentUnreadIndicators = \"agentUnreadIndicators\",\n ChatThreadUnifiedSearch = \"chatThreadUnifiedSearch\",\n ComposerChatThreadSuggestions = \"composerChatThreadSuggestions\",\n SidebarSubscriptionUsage = \"sidebarSubscriptionUsage\",\n TeamsIntegration = \"teamsIntegration\",\n FeishuIntegration = \"feishuIntegration\",\n PresentationExport = \"presentationExport\",\n Artifacts = \"artifacts\",\n HostedArtifactVersions = \"hostedArtifactVersions\",\n VideoArtifactPosters = \"videoArtifactPosters\",\n WebsiteTemplateV2 = \"websiteTemplateV2\",\n PlanUpgradeGuidance = \"planUpgradeGuidance\",\n OrgPlanEntitlementReads = \"orgPlanEntitlementReads\",\n WorkflowConnectorReadiness = \"workflowConnectorReadiness\",\n ZeroMail = \"zeroMail\",\n ComposerConnectorPermissions = \"composerConnectorPermissions\",\n ThreeColumnNav = \"threeColumnNav\",\n ChatHistoryBackfillProgress = \"chatHistoryBackfillProgress\",\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.ExternalConnectorCatalog]: {\n maintainer: \"liangyou@vm0.ai\",\n description:\n \"Use the accepted external catalog as the global source for official connectors\",\n enabled: false,\n userOverridable: false,\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.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.CanonicalSlackIngress]: {\n maintainer: \"lancy@vm0.ai\",\n description:\n \"Route newly admitted per-user Slack threads through canonical chat ingress.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.CanonicalSlackWebVisibility]: {\n maintainer: \"lancy@vm0.ai\",\n description:\n \"Show canonical Slack chat threads in Web chat surfaces for enrolled users.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.CanonicalSlackAssets]: {\n maintainer: \"lancy@vm0.ai\",\n description:\n \"Canonicalize direct Slack inputs and run-scoped Slack file publications.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.ZeroWeather]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Enable the managed Google-backed Zero Weather and Air Quality APIs and weather:read ZERO_TOKEN capability.\",\n enabled: true,\n },\n [FeatureSwitchKey.ZeroFinance]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Enable the managed APIDojo-backed Zero Finance API and finance:read ZERO_TOKEN capability.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.ZeroPeopleSearch]: {\n maintainer: \"liangyou@vm0.ai\",\n description:\n \"Enable managed Perplexity People Search and the people-search:read ZERO_TOKEN capability.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\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.GithubWorkflowRunAutomations]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Enable GitHub Actions workflow run completed event automations.\",\n enabled: true,\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.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.StructuredPrompt]: {\n maintainer: \"bingjie@vm0.ai\",\n description:\n \"Enable structured user prompt rendering, sends, and drafts while preserving the legacy content fallback.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\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.HtmlArtifactCommentEditing]: {\n maintainer: \"bingjie@vm0.ai\",\n description:\n \"Enable the HTML artifact comment-editing workflow for collecting DOM comments and preparing instrumented working-copy edits.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\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.AgentUnreadIndicators]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Show chat unread indicators in sidebar pinned agent lists and the conversation picker.\",\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.ComposerChatThreadSuggestions]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Suggest titled chat threads from the current agent when typing @ in the chat composer.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.ChatHistoryBackfillProgress]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Progress bar under the chat thread header showing history backfill progress while older messages load.\",\n // Not rolled out to anyone yet; enable per-user via the Lab page.\n enabled: false,\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.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.PresentationExport]: {\n maintainer: \"bingjie@vm0.ai\",\n description:\n \"Enable downloading presentation artifacts as PPTX files and uploading them as native, editable Google Slides decks.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.Artifacts]: {\n maintainer: \"bingjie@vm0.ai\",\n description:\n \"Show the Artifacts manage page for generated artifacts in the current organization.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\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 },\n [FeatureSwitchKey.VideoArtifactPosters]: {\n maintainer: \"bingjie@vm0.ai\",\n description:\n \"Generate poster images asynchronously when video artifacts are recorded.\",\n enabled: false,\n enabledUserHashes: [\"032a75d8\"],\n },\n [FeatureSwitchKey.WebsiteTemplateV2]: {\n maintainer: \"bingjie@vm0.ai\",\n description:\n \"Generate websites from refreshed self-contained template packages. When off, website generation uses the existing package versions.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.PlanUpgradeGuidance]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Show plan-upgrade guidance in Zero CLI help and render billing plan links as rich chat cards.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n userOverridable: false,\n },\n [FeatureSwitchKey.OrgPlanEntitlementReads]: {\n maintainer: \"yuma@vm0.ai\",\n description:\n \"Read runtime plan capability limits from org_plan_entitlements instead of deriving them from org_metadata.tier.\",\n enabled: true,\n userOverridable: false,\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.ZeroMail]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Enable persistent Gmail and Outlook draft cards created through the Zero Mail CLI.\",\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};\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","export { FeatureSwitchKey } from \"@vm0/connectors/feature-switch-key\";\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","export interface ZeroTokenPayload {\n userId: string;\n runId: string;\n orgId: string;\n scope: string;\n capabilities: string[];\n iat: number;\n exp: number;\n}\n\n/**\n * Decode a ZERO_TOKEN JWT payload.\n * Only decodes — does NOT verify signature (server does that).\n * If no token is provided, reads from process.env.ZERO_TOKEN.\n * Returns undefined if token is missing, malformed, or not a zero-scoped token.\n */\nexport function decodeZeroTokenPayload(\n token?: string,\n): ZeroTokenPayload | undefined {\n const raw = token ?? process.env.ZERO_TOKEN;\n if (!raw) return undefined;\n\n const prefix = \"vm0_sandbox_\";\n if (!raw.startsWith(prefix)) return undefined;\n const jwt = raw.slice(prefix.length);\n\n const parts = jwt.split(\".\");\n if (parts.length !== 3) return undefined;\n\n try {\n const payload = JSON.parse(\n Buffer.from(parts[1]!, \"base64url\").toString(),\n ) as ZeroTokenPayload;\n if (payload.scope === \"zero\" && Array.isArray(payload.capabilities)) {\n return payload;\n }\n } catch {\n // Malformed token — fall through\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;AAAA;;;ACAA;;;ACAA;;;ACAA;AASO,SAAS,MAAM,OAAuB;AAC3C,MAAI,IAAI,eAAe;AACvB,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,SAAK,MAAM,WAAW,CAAC;AACvB,QAAI,KAAK,KAAK,GAAG,QAAQ,MAAM;AAAA,EACjC;AACA,SAAO,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG;AACvC;AASO,IAAM,sBAAyC;AAAA,EACpD;AAAA;AACF;;;AFeA,IAAM,mBAA4D;AAAA,EAChE,oBAAuB,GAAG;AAAA,IACxB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AAAA,EACA,0DAA0C,GAAG;AAAA,IAC3C,YAAY;AAAA,IACZ,aACE;AAAA,IACF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MAAM,GAAG;AAC3B,MAAI,MAAM,WAAW,EAAG,QAAO;AAE/B,MAAI;AACF,UAAM,UAAU,KAAK;AAAA,MACnB,OAAO,KAAK,MAAM,CAAC,GAAI,WAAW,EAAE,SAAS;AAAA,IAC/C;AACA,QAAI,QAAQ,UAAU,UAAU,MAAM,QAAQ,QAAQ,YAAY,GAAG;AACnE,aAAO;AAAA,IACT;AAAA,EACF,QAAQ;AAAA,EAER;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../packages/connectors/src/feature-switch-key.ts","../../../packages/core/src/feature-switch.ts","../../../packages/core/src/feature-switch-key.ts","../../../packages/core/src/identity-hash.ts","../src/lib/api/zero-token.ts"],"sourcesContent":["/**\n * Feature switch keys\n *\n * Defines all available feature switch identifiers.\n */\nexport enum FeatureSwitchKey {\n Dummy = \"dummy\",\n ExternalConnectorCatalog = \"externalConnectorCatalog\",\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 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 CanonicalSlackIngress = \"canonicalSlackIngress\",\n CanonicalSlackWebVisibility = \"canonicalSlackWebVisibility\",\n CanonicalSlackAssets = \"canonicalSlackAssets\",\n ZeroWeather = \"zeroWeather\",\n ZeroFinance = \"zeroFinance\",\n ZeroPeopleSearch = \"zeroPeopleSearch\",\n Banking = \"banking\",\n Lab = \"lab\",\n NotionWorkflowAutomations = \"notionWorkflowAutomations\",\n GithubWebhookAutomations = \"githubWebhookAutomations\",\n GithubWorkflowRunAutomations = \"githubWorkflowRunAutomations\",\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 RealAgentInPreview = \"realAgentInPreview\",\n ComposerUploadPopover = \"composerUploadPopover\",\n StructuredPrompt = \"structuredPrompt\",\n\n ZapierConnector = \"zapierConnector\",\n HtmlArtifactCommentEditing = \"htmlArtifactCommentEditing\",\n ComputerUseDesktopPlugins = \"computerUseDesktopPlugins\",\n AgentUnreadIndicators = \"agentUnreadIndicators\",\n ChatThreadUnifiedSearch = \"chatThreadUnifiedSearch\",\n ComposerChatThreadSuggestions = \"composerChatThreadSuggestions\",\n SidebarSubscriptionUsage = \"sidebarSubscriptionUsage\",\n TeamsIntegration = \"teamsIntegration\",\n FeishuIntegration = \"feishuIntegration\",\n PresentationExport = \"presentationExport\",\n Artifacts = \"artifacts\",\n HostedArtifactVersions = \"hostedArtifactVersions\",\n VideoArtifactPosters = \"videoArtifactPosters\",\n WebsiteTemplateV2 = \"websiteTemplateV2\",\n PlanUpgradeGuidance = \"planUpgradeGuidance\",\n OrgPlanEntitlementReads = \"orgPlanEntitlementReads\",\n WorkflowConnectorReadiness = \"workflowConnectorReadiness\",\n ZeroMail = \"zeroMail\",\n ComposerConnectorPermissions = \"composerConnectorPermissions\",\n ThreeColumnNav = \"threeColumnNav\",\n ChatHistoryBackfillProgress = \"chatHistoryBackfillProgress\",\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.ExternalConnectorCatalog]: {\n maintainer: \"liangyou@vm0.ai\",\n description:\n \"Use the accepted external catalog as the global source for official connectors\",\n enabled: false,\n userOverridable: false,\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.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.CanonicalSlackIngress]: {\n maintainer: \"lancy@vm0.ai\",\n description:\n \"Route newly admitted per-user Slack threads through canonical chat ingress.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.CanonicalSlackWebVisibility]: {\n maintainer: \"lancy@vm0.ai\",\n description:\n \"Show canonical Slack chat threads in Web chat surfaces for enrolled users.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.CanonicalSlackAssets]: {\n maintainer: \"lancy@vm0.ai\",\n description:\n \"Canonicalize direct Slack inputs and run-scoped Slack file publications.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.ZeroWeather]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Enable the managed Google-backed Zero Weather and Air Quality APIs and weather:read ZERO_TOKEN capability.\",\n enabled: true,\n },\n [FeatureSwitchKey.ZeroFinance]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Enable the managed APIDojo-backed Zero Finance API and finance:read ZERO_TOKEN capability.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.ZeroPeopleSearch]: {\n maintainer: \"liangyou@vm0.ai\",\n description:\n \"Enable managed Perplexity People Search and the people-search:read ZERO_TOKEN capability.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\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.GithubWorkflowRunAutomations]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Enable GitHub Actions workflow run completed event automations.\",\n enabled: true,\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.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.StructuredPrompt]: {\n maintainer: \"bingjie@vm0.ai\",\n description:\n \"Enable structured user prompt rendering, sends, and drafts while preserving the legacy content fallback.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\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.HtmlArtifactCommentEditing]: {\n maintainer: \"bingjie@vm0.ai\",\n description:\n \"Enable the HTML artifact comment-editing workflow for collecting DOM comments and preparing instrumented working-copy edits.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\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.AgentUnreadIndicators]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Show chat unread indicators in sidebar pinned agent lists and the conversation picker.\",\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.ComposerChatThreadSuggestions]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Suggest titled chat threads from the current agent when typing @ in the chat composer.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.ChatHistoryBackfillProgress]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Progress bar under the chat thread header showing history backfill progress while older messages load.\",\n // Not rolled out to anyone yet; enable per-user via the Lab page.\n enabled: false,\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.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.PresentationExport]: {\n maintainer: \"bingjie@vm0.ai\",\n description:\n \"Enable downloading presentation artifacts as PPTX files and uploading them as native, editable Google Slides decks.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.Artifacts]: {\n maintainer: \"bingjie@vm0.ai\",\n description:\n \"Show the Artifacts manage page for generated artifacts in the current organization.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\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: false,\n enabledUserHashes: [\"032a75d8\"],\n },\n [FeatureSwitchKey.WebsiteTemplateV2]: {\n maintainer: \"bingjie@vm0.ai\",\n description:\n \"Generate websites from refreshed self-contained template packages. When off, website generation uses the existing package versions.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n },\n [FeatureSwitchKey.PlanUpgradeGuidance]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Show plan-upgrade guidance in Zero CLI help and render billing plan links as rich chat cards.\",\n enabled: false,\n enabledOrgIdHashes: STAFF_ORG_ID_HASHES,\n userOverridable: false,\n },\n [FeatureSwitchKey.OrgPlanEntitlementReads]: {\n maintainer: \"yuma@vm0.ai\",\n description:\n \"Read runtime plan capability limits from org_plan_entitlements instead of deriving them from org_metadata.tier.\",\n enabled: true,\n userOverridable: false,\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.ZeroMail]: {\n maintainer: \"ethan@vm0.ai\",\n description:\n \"Enable persistent Gmail and Outlook draft cards created through the Zero Mail CLI.\",\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};\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","export { FeatureSwitchKey } from \"@vm0/connectors/feature-switch-key\";\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","export interface ZeroTokenPayload {\n userId: string;\n runId: string;\n orgId: string;\n scope: string;\n capabilities: string[];\n iat: number;\n exp: number;\n}\n\n/**\n * Decode a ZERO_TOKEN JWT payload.\n * Only decodes — does NOT verify signature (server does that).\n * If no token is provided, reads from process.env.ZERO_TOKEN.\n * Returns undefined if token is missing, malformed, or not a zero-scoped token.\n */\nexport function decodeZeroTokenPayload(\n token?: string,\n): ZeroTokenPayload | undefined {\n const raw = token ?? process.env.ZERO_TOKEN;\n if (!raw) return undefined;\n\n const prefix = \"vm0_sandbox_\";\n if (!raw.startsWith(prefix)) return undefined;\n const jwt = raw.slice(prefix.length);\n\n const parts = jwt.split(\".\");\n if (parts.length !== 3) return undefined;\n\n try {\n const payload = JSON.parse(\n Buffer.from(parts[1]!, \"base64url\").toString(),\n ) as ZeroTokenPayload;\n if (payload.scope === \"zero\" && Array.isArray(payload.capabilities)) {\n return payload;\n }\n } catch {\n // Malformed token — fall through\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;AAAA;;;ACAA;;;ACAA;;;ACAA;AASO,SAAS,MAAM,OAAuB;AAC3C,MAAI,IAAI,eAAe;AACvB,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,SAAK,MAAM,WAAW,CAAC;AACvB,QAAI,KAAK,KAAK,GAAG,QAAQ,MAAM;AAAA,EACjC;AACA,SAAO,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG;AACvC;AASO,IAAM,sBAAyC;AAAA,EACpD;AAAA;AACF;;;AFeA,IAAM,mBAA4D;AAAA,EAChE,oBAAuB,GAAG;AAAA,IACxB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AAAA,EACA,0DAA0C,GAAG;AAAA,IAC3C,YAAY;AAAA,IACZ,aACE;AAAA,IACF,SAAS;AAAA,IACT,iBAAiB;AAAA,EACnB;AAAA,EACA,wCAAiC,GAAG;AAAA,IAClC,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AAAA,EACA,oCAA+B,GAAG;AAAA,IAChC,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AAAA,EACA,0CAAkC,GAAG;AAAA,IACnC,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AAAA,EACA,kCAA8B,GAAG;AAAA,IAC/B,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AAAA,EACA,sCAAgC,GAAG;AAAA,IACjC,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AAAA,EACA,wCAAiC,GAAG;AAAA,IAClC,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AAAA,EACA,wCAAiC,GAAG;AAAA,IAClC,YAAY;AAAA,IACZ,a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AU,cAAc,mBAAmB,QAAQ;AACzD,QAAI,cAAc,kBAAkB,SAAS,MAAM,IAAI,MAAM,CAAC;AAC5D,aAAO;AAAA,EACX;AACA,MAAI,IAAI,SAAS,cAAc,oBAAoB,QAAQ;AACzD,QACE,cAAc,mBAAmB,SAAS,MAAM,IAAI,MAAM,YAAY,CAAC,CAAC;AAExE,aAAO;AAAA,EACX;AACA,MAAI,IAAI,SAAS,cAAc,oBAAoB,QAAQ;AACzD,QAAI,cAAc,mBAAmB,SAAS,MAAM,IAAI,KAAK,CAAC;AAC5D,aAAO;AAAA,EACX;AACA,SAAO;AACT;;;AGlrBA;AAgBO,SAAS,uBACd,OAC8B;AAC9B,QAAM,MAAM,SAAS,QAAQ,IAAI;AACjC,MAAI,CAAC,IAAK,QAAO;AAEjB,QAAM,SAAS;AACf,MAAI,CAAC,IAAI,WAAW,MAAM,EAAG,QAAO;AACpC,QAAM,MAAM,IAAI,MAAM,OAAO,MAAM;AAEnC,QAAM,QAAQ,IAAI,MAAM,GAAG;AAC3B,MAAI,MAAM,WAAW,EAAG,QAAO;AAE/B,MAAI;AACF,UAAM,UAAU,KAAK;AAAA,MACnB,OAAO,KAAK,MAAM,CAAC,GAAI,WAAW,EAAE,SAAS;AAAA,IAC/C;AACA,QAAI,QAAQ,UAAU,UAAU,MAAM,QAAQ,QAAQ,YAAY,GAAG;AACnE,aAAO;AAAA,IACT;AAAA,EACF,QAAQ;AAAA,EAER;AACA,SAAO;AACT;","names":[]}
@@ -1,6 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __createRequire } from "node:module";
3
3
  const require = __createRequire(import.meta.url);
4
+ import {
5
+ formatIsoTimestamp,
6
+ isUuid,
7
+ parseBoundedLogCount
8
+ } from "./chunk-B6ELBBRJ.js";
4
9
  import {
5
10
  listVideoTemplates
6
11
  } from "./chunk-UG5XA6KU.js";
@@ -12,7 +17,7 @@ import {
12
17
  runnerGroupSchema,
13
18
  searchZeroLogs,
14
19
  zeroAgentVisibilitySchema
15
- } from "./chunk-2YJV4T5H.js";
20
+ } from "./chunk-RPYYZK6K.js";
16
21
  import {
17
22
  apiErrorSchema,
18
23
  external_exports,
@@ -26,7 +31,7 @@ import {
26
31
  upsertModelProviderRequestSchema,
27
32
  upsertModelProviderResponseSchema,
28
33
  withErrorHandler
29
- } from "./chunk-7YTIE7KU.js";
34
+ } from "./chunk-7JATDT76.js";
30
35
  import {
31
36
  Command
32
37
  } from "./chunk-LD4ZVU4O.js";
@@ -11967,6 +11972,7 @@ var testSlackStateResponseSchema = external_exports.object({
11967
11972
  itemType: external_exports.enum([
11968
11973
  "user_message",
11969
11974
  "slack_user_message",
11975
+ "feishu_user_message",
11970
11976
  "workflow_event"
11971
11977
  ]),
11972
11978
  triggerSource: external_exports.string().nullable(),
@@ -32693,16 +32699,6 @@ var EventStreamNormalizer = class {
32693
32699
  }
32694
32700
  };
32695
32701
 
32696
- // src/lib/utils/time-format.ts
32697
- init_esm_shims();
32698
- function formatIsoTimestamp(value) {
32699
- const timestamp = value instanceof Date ? value : new Date(value);
32700
- if (!Number.isFinite(timestamp.getTime())) {
32701
- return "invalid-date";
32702
- }
32703
- return timestamp.toISOString().replace(/\.\d{3}Z$/, "Z");
32704
- }
32705
-
32706
32702
  // src/lib/events/event-renderer.ts
32707
32703
  init_esm_shims();
32708
32704
 
@@ -33372,64 +33368,6 @@ var EventRenderer = class _EventRenderer {
33372
33368
  }
33373
33369
  };
33374
33370
 
33375
- // src/lib/utils/log-pagination.ts
33376
- init_esm_shims();
33377
- function parsePositiveLogCount(value, optionName) {
33378
- const trimmed = value.trim();
33379
- if (!/^0*[1-9]\d*$/.test(trimmed)) {
33380
- throw new Error(`Option ${optionName} must be a positive integer`);
33381
- }
33382
- const count = Number(trimmed);
33383
- if (!Number.isSafeInteger(count)) {
33384
- throw new Error(`Option ${optionName} must be a positive integer`);
33385
- }
33386
- return count;
33387
- }
33388
- function parseBoundedLogCount(value, optionName, min, max) {
33389
- const trimmed = value.trim();
33390
- if (!/^\d+$/.test(trimmed)) {
33391
- throw new Error(`${optionName} must be between ${min} and ${max}`);
33392
- }
33393
- const count = Number(trimmed);
33394
- if (!Number.isSafeInteger(count) || count < min || count > max) {
33395
- throw new Error(`${optionName} must be between ${min} and ${max}`);
33396
- }
33397
- return count;
33398
- }
33399
- async function collectLogItems(options) {
33400
- const collected = [];
33401
- const seenCursors = /* @__PURE__ */ new Set();
33402
- let cursor2;
33403
- while (true) {
33404
- const requestLimit = options.targetCount === "all" ? options.pageLimit : Math.min(options.pageLimit, options.targetCount - collected.length);
33405
- const page = await options.fetchPage({
33406
- sinceTime: options.sinceTime,
33407
- cursor: cursor2,
33408
- limit: requestLimit,
33409
- order: options.order
33410
- });
33411
- collected.push(...page.items);
33412
- if (options.targetCount !== "all" && collected.length >= options.targetCount) {
33413
- break;
33414
- }
33415
- const nextCursor = page.nextCursor ?? null;
33416
- if (!page.hasMore || !nextCursor || seenCursors.has(nextCursor)) {
33417
- break;
33418
- }
33419
- seenCursors.add(nextCursor);
33420
- cursor2 = nextCursor;
33421
- }
33422
- const entries = options.targetCount === "all" ? collected : collected.slice(0, options.targetCount);
33423
- return options.order === "desc" ? entries.reverse() : entries;
33424
- }
33425
-
33426
- // src/lib/utils/uuid.ts
33427
- init_esm_shims();
33428
- var UUID_PATTERN = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
33429
- function isUuid(value) {
33430
- return UUID_PATTERN.test(value);
33431
- }
33432
-
33433
33371
  // src/lib/utils/search-query.ts
33434
33372
  init_esm_shims();
33435
33373
  function parseSearchQuery(value, label) {
@@ -33589,14 +33527,9 @@ export {
33589
33527
  parseTime,
33590
33528
  isSupportedFramework,
33591
33529
  EventStreamNormalizer,
33592
- formatIsoTimestamp,
33593
33530
  EventRenderer,
33594
- parsePositiveLogCount,
33595
- parseBoundedLogCount,
33596
- collectLogItems,
33597
- isUuid,
33598
33531
  parseSearchQuery,
33599
33532
  runLogsSearch,
33600
33533
  searchCommand
33601
33534
  };
33602
- //# sourceMappingURL=chunk-7JNLGFRW.js.map
33535
+ //# sourceMappingURL=chunk-ES2FTLAP.js.map