@ttt-productions/ttt-core 0.79.23 → 0.79.24

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 (91) hide show
  1. package/dist/constants/app-mode.d.ts +3 -0
  2. package/dist/constants/app-mode.d.ts.map +1 -1
  3. package/dist/constants/app-mode.js +37 -0
  4. package/dist/constants/app-mode.js.map +1 -1
  5. package/dist/constants/business-admin.d.ts +4 -0
  6. package/dist/constants/business-admin.d.ts.map +1 -1
  7. package/dist/constants/business-admin.js +4 -0
  8. package/dist/constants/business-admin.js.map +1 -1
  9. package/dist/constants/retention.d.ts +3 -0
  10. package/dist/constants/retention.d.ts.map +1 -1
  11. package/dist/constants/retention.js +11 -0
  12. package/dist/constants/retention.js.map +1 -1
  13. package/dist/constants/storage-keys.d.ts +5 -0
  14. package/dist/constants/storage-keys.d.ts.map +1 -1
  15. package/dist/constants/storage-keys.js +11 -0
  16. package/dist/constants/storage-keys.js.map +1 -1
  17. package/dist/doc-schemas/audit.d.ts +1 -1
  18. package/dist/doc-schemas/audit.js +1 -1
  19. package/dist/doc-schemas/audit.js.map +1 -1
  20. package/dist/doc-schemas/backend-state.d.ts +48 -0
  21. package/dist/doc-schemas/backend-state.d.ts.map +1 -0
  22. package/dist/doc-schemas/backend-state.js +81 -0
  23. package/dist/doc-schemas/backend-state.js.map +1 -0
  24. package/dist/doc-schemas/firestore-primitives.d.ts.map +1 -1
  25. package/dist/doc-schemas/firestore-primitives.js +11 -5
  26. package/dist/doc-schemas/firestore-primitives.js.map +1 -1
  27. package/dist/doc-schemas/index.d.ts +1 -0
  28. package/dist/doc-schemas/index.d.ts.map +1 -1
  29. package/dist/doc-schemas/index.js +2 -0
  30. package/dist/doc-schemas/index.js.map +1 -1
  31. package/dist/doc-schemas/media-activation-jobs.d.ts +6 -6
  32. package/dist/doc-schemas/media-activation-jobs.d.ts.map +1 -1
  33. package/dist/doc-schemas/media-activation-jobs.js +10 -8
  34. package/dist/doc-schemas/media-activation-jobs.js.map +1 -1
  35. package/dist/doc-schemas/payments.d.ts +1 -1
  36. package/dist/doc-schemas/payments.d.ts.map +1 -1
  37. package/dist/doc-schemas/payments.js +11 -6
  38. package/dist/doc-schemas/payments.js.map +1 -1
  39. package/dist/doc-schemas/registry.d.ts +81 -95
  40. package/dist/doc-schemas/registry.d.ts.map +1 -1
  41. package/dist/doc-schemas/registry.js +59 -42
  42. package/dist/doc-schemas/registry.js.map +1 -1
  43. package/dist/doc-schemas/system.d.ts +1 -0
  44. package/dist/doc-schemas/system.d.ts.map +1 -1
  45. package/dist/doc-schemas/system.js +6 -0
  46. package/dist/doc-schemas/system.js.map +1 -1
  47. package/dist/doc-schemas/user.d.ts +4 -0
  48. package/dist/doc-schemas/user.d.ts.map +1 -1
  49. package/dist/doc-schemas/user.js +4 -0
  50. package/dist/doc-schemas/user.js.map +1 -1
  51. package/dist/doc-schemas/work-project.d.ts +6 -0
  52. package/dist/doc-schemas/work-project.d.ts.map +1 -1
  53. package/dist/doc-schemas/work-project.js +7 -1
  54. package/dist/doc-schemas/work-project.js.map +1 -1
  55. package/dist/media/target-info.d.ts +99 -0
  56. package/dist/media/target-info.d.ts.map +1 -1
  57. package/dist/media/target-info.js +75 -3
  58. package/dist/media/target-info.js.map +1 -1
  59. package/dist/paths/collections.d.ts +33 -23
  60. package/dist/paths/collections.d.ts.map +1 -1
  61. package/dist/paths/collections.js +69 -33
  62. package/dist/paths/collections.js.map +1 -1
  63. package/dist/paths/path-builders.d.ts +10 -2
  64. package/dist/paths/path-builders.d.ts.map +1 -1
  65. package/dist/paths/path-builders.js +39 -7
  66. package/dist/paths/path-builders.js.map +1 -1
  67. package/dist/permissions/guild-standing-assignment-policy.d.ts.map +1 -1
  68. package/dist/permissions/guild-standing-assignment-policy.js +3 -3
  69. package/dist/permissions/guild-standing-assignment-policy.js.map +1 -1
  70. package/dist/permissions/work-project-permissions-data.d.ts +7 -0
  71. package/dist/permissions/work-project-permissions-data.d.ts.map +1 -1
  72. package/dist/permissions/work-project-permissions-data.js +7 -0
  73. package/dist/permissions/work-project-permissions-data.js.map +1 -1
  74. package/dist/permissions/work-project-permissions.d.ts +6 -0
  75. package/dist/permissions/work-project-permissions.d.ts.map +1 -1
  76. package/dist/permissions/work-project-permissions.js +9 -1
  77. package/dist/permissions/work-project-permissions.js.map +1 -1
  78. package/dist/schemas/admin.d.ts +1 -0
  79. package/dist/schemas/admin.d.ts.map +1 -1
  80. package/dist/schemas/admin.js +3 -1
  81. package/dist/schemas/admin.js.map +1 -1
  82. package/dist/schemas/payments.d.ts.map +1 -1
  83. package/dist/schemas/payments.js +2 -1
  84. package/dist/schemas/payments.js.map +1 -1
  85. package/dist/types/audit.d.ts +7 -7
  86. package/dist/types/audit.js.map +1 -1
  87. package/dist/types/work-project.d.ts +19 -1
  88. package/dist/types/work-project.d.ts.map +1 -1
  89. package/dist/types/work-project.js +41 -0
  90. package/dist/types/work-project.js.map +1 -1
  91. package/package.json +2 -2
@@ -63,6 +63,9 @@ export interface TttLimits {
63
63
  SHORT_LINK_CLICK: RateLimitValue;
64
64
  FOLLOW: RateLimitValue;
65
65
  MENTION_HISTORY: RateLimitValue;
66
+ MEDIA_GRANT: RateLimitValue;
67
+ CHAT_GRANT: RateLimitValue;
68
+ OPERATOR_STEP_UP: RateLimitValue;
66
69
  ADMIN_MESSAGE_READ: RateLimitValue;
67
70
  USER_LOOKUP: RateLimitValue;
68
71
  NOTIFICATION_BROADCAST: RateLimitValue;
@@ -1 +1 @@
1
- {"version":3,"file":"app-mode.d.ts","sourceRoot":"","sources":["../../src/constants/app-mode.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzC,8EAA8E;AAC9E,eAAO,MAAM,QAAQ,EAAE,OAAmB,CAAC;AAE3C,qDAAqD;AACrD,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,KAAG,CACM,CAAC;AA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AY,EAAE,cAAc,CAAC;QAC7B,UAAU,EAAE,cAAc,CAAC;QAC3B,aAAa,EAAE,cAAc,CAAC;QAC9B,UAAU,EAAE,cAAc,CAAC;QAC3B,cAAc,EAAE,cAAc,CAAC;QAC/B,cAAc,EAAE,cAAc,CAAC;QAC/B,gBAAgB,EAAE,cAAc,CAAC;QACjC,MAAM,EAAE,cAAc,CAAC;QACvB,eAAe,EAAE,cAAc,CAAC;QAChC,WAAW,EAAE,cAAc,CAAC;QAC5B,UAAU,EAAE,cAAc,CAAC;QAC3B,gBAAgB,EAAE,cAAc,CAAC;QACjC,kBAAkB,EAAE,cAAc,CAAC;QACnC,WAAW,EAAE,cAAc,CAAC;QAC5B,sBAAsB,EAAE,cAAc,CAAC;QACvC,oBAAoB,EAAE,cAAc,CAAC;QACrC,sBAAsB,EAAE,cAAc,CAAC;QACvC,QAAQ,EAAE,cAAc,CAAC;QACzB,iBAAiB,EAAE,cAAc,CAAC;QAClC,aAAa,EAAE,cAAc,CAAC;QAC9B,kBAAkB,EAAE,cAAc,CAAC;QACnC,cAAc,EAAE,cAAc,CAAC;QAC/B,eAAe,EAAE,cAAc,CAAC;KACjC,CAAC;CACH;AAED,eAAO,MAAM,cAAc,EAAE,SAoH5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,SAuFzB,CAAC;AAEF;uEACuE;AACvE,eAAO,MAAM,aAAa,EAAE,SAA+C,CAAC"}
@@ -86,6 +86,34 @@ export const CHARTER_LIMITS = {
86
86
  SHORT_LINK_CLICK: { maxRequests: 60, window: '1 h' },
87
87
  FOLLOW: { maxRequests: 20, window: '1 m' },
88
88
  MENTION_HISTORY: { maxRequests: 120, window: '1 h' },
89
+ // Scoped-media grant minting (createMediaGrant). Its OWN bucket — it used to charge
90
+ // MENTION_HISTORY, an unrelated surface, so neither limit meant what its name said and the
91
+ // two shared a budget sized for neither (BACKEND-013). Refresh-driven, not user-initiated:
92
+ // a grant is short-TTL (60 min work media, 15 min chat/folder scopes) and the client re-mints
93
+ // under expiry, so a browsing session naturally spends several per hour PER SCOPE (each work,
94
+ // each private file folder, each conversation). Cheap to serve (a Firestore permission read
95
+ // plus an HMAC sign — no third-party cost), and a false 429 breaks media rendering outright,
96
+ // so the ceiling is generous: it exists to stop a scripted grant-farming sweep, not to pace a
97
+ // real reader. 120/h charter.
98
+ MEDIA_GRANT: { maxRequests: 120, window: '1 h' },
99
+ // Realtime chat grant minting (mintChatGrant) — previously NO limiter at all (BACKEND-013),
100
+ // despite minting signed grants at concurrency: 20. Same refresh-driven shape as MEDIA_GRANT:
101
+ // a 15-minute grant TTL means ~4 mints/hour for the inbox plus ~4 per open channel, doubled
102
+ // again by socket reconnects on a flaky mobile network. It stays behind the per-channel
103
+ // authorizeChannelScope gate, so this bucket is a cost/DoS ceiling rather than the
104
+ // authorization boundary — sized to match MEDIA_GRANT so the two grant surfaces are paced
105
+ // alike and neither can be starved by the other (separate Redis prefixes).
106
+ CHAT_GRANT: { maxRequests: 120, window: '1 h' },
107
+ // Operator step-up TOTP verification (confirmOperatorStepUp / verifyOperatorStepUp) —
108
+ // previously unthrottled, so an attacker holding a stolen full-admin session could
109
+ // brute-force the 6-digit second factor guarding the safety console (BACKEND-013).
110
+ // DELIBERATELY THE TIGHTEST BUCKET IN THE SET: a real operator enrolls once and verifies
111
+ // roughly twice an hour (the grant window is 30 minutes), so 10/h absorbs every legitimate
112
+ // mistype while capping guessing at 10 attempts per hour against a code that rotates every
113
+ // 30 seconds. Mode-INVARIANT — this is an admin security control, not a cost driver, so it
114
+ // never loosens at the full-mode flip (same posture as MODERATION / BAN_ACTION / USER_LOOKUP).
115
+ // The lockout-after-N-failures behaviour is a separate app-side concern; this is the throttle.
116
+ OPERATOR_STEP_UP: { maxRequests: 10, window: '1 h' },
89
117
  ADMIN_MESSAGE_READ: { maxRequests: 60, window: '1 h' },
90
118
  // Admin exact-account lookup (searchPublicUsers / lookupUserByEmailOrUid) — a read, so a
91
119
  // generous per-minute bucket that still backstops a scripted enumeration sweep. Admin-only
@@ -167,6 +195,15 @@ export const FULL_LIMITS = {
167
195
  SHORT_LINK_CLICK: { maxRequests: 60, window: '1 h' },
168
196
  FOLLOW: { maxRequests: 60, window: '1 m' },
169
197
  MENTION_HISTORY: { maxRequests: 120, window: '1 h' },
198
+ // 240/h (full): the same grant-minting buckets as charter, doubled with the surrounding
199
+ // content limits. Full mode raises the ceilings a grant is minted PER (250-guildmate guilds,
200
+ // 25 file folders, 1000 work files, 10 auditions), so one session legitimately touches more
201
+ // scopes and re-mints more often. See the CHARTER_LIMITS notes above.
202
+ MEDIA_GRANT: { maxRequests: 240, window: '1 h' },
203
+ CHAT_GRANT: { maxRequests: 240, window: '1 h' },
204
+ // Operator step-up stays at 10/h in BOTH modes — an admin second-factor throttle is a
205
+ // security control, not a cost lever, so it never loosens at the flip. See CHARTER_LIMITS.
206
+ OPERATOR_STEP_UP: { maxRequests: 10, window: '1 h' },
170
207
  ADMIN_MESSAGE_READ: { maxRequests: 60, window: '1 h' },
171
208
  // Admin exact-account lookup — same read bucket in both modes (see CHARTER_LIMITS note).
172
209
  USER_LOOKUP: { maxRequests: 30, window: '1 m' },
@@ -1 +1 @@
1
- {"version":3,"file":"app-mode.js","sourceRoot":"","sources":["../../src/constants/app-mode.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,wEAAwE;AACxE,yEAAyE;AACzE,+DAA+D;AAC/D,2DAA2D;AAC3D,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,yEAAyE;AACzE,0EAA0E;AAC1E,yEAAyE;AAIzE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,QAAQ,GAAY,SAAS,CAAC;AAE3C,qDAAqD;AACrD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAI,OAAU,EAAE,IAAO,EAAK,EAAE,CACjD,QAAoB,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AA8EvD,MAAM,CAAC,MAAM,cAAc,GAAc;I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,KAAK,EAAE;KACpD;CACF,CAAC;AAEF;uEACuE;AACvE,MAAM,CAAC,MAAM,aAAa,GAAc,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC","sourcesContent":["// App mode + the charter/full limit sets — the single published constant that\n// drives the whole app's cost posture. The flip to full-live is: change\n// APP_MODE → publish ttt-core → install in ttt-prod (root + functions) →\n// deploy. There is NO runtime mode flag and NO console toggle.\n// See ttt-prod docs/design/charter-season-and-app-mode.md.\n//\n// Only real cost/abuse drivers vary by mode: media specs (ttt-media-specs.ts),\n// rate-limit values, count caps, batch sizes. Text-length limits and payment\n// min/max are deliberately mode-invariant — with ONE ruled exception (DJ\n// 2026-07-13): chapter body content (maxChapterContentLength), because it\n// bounds threshold-review reading effort per item during charter season.\n\nexport type AppMode = 'charter' | 'full';\n\n/** The deployed mode. Changing this constant (and publishing) IS the flip. */\nexport const APP_MODE: AppMode = 'charter';\n\n/** Pick the active value for a mode-varied limit. */\nexport const byMode = <T>(charter: T, full: T): T =>\n (APP_MODE as AppMode) === 'charter' ? charter : full;\n\n/** Upstash-style sliding-window duration, e.g. '1 h'. */\nexport type RateLimitWindow = `${number} ${'ms' | 's' | 'm' | 'h' | 'd'}`;\n\nexport interface RateLimitValue {\n maxRequests: number;\n window: RateLimitWindow;\n}\n\nexport interface TttLimits {\n mode: AppMode;\n user: {\n maxCraftSkills: number;\n maxOwnedWorkProjects: number;\n maxAssociatedWorkProjects: number;\n };\n workProject: {\n maxGuildSize: number;\n maxFileFolders: number;\n maxWorkFiles: number;\n maxWorkFileStorageBytes: number;\n maxWorkProjectAuditions: number;\n maxCommissionListings: number;\n maxChapters: number;\n /** Chapter BODY length (chars) — the one mode-varied text limit (DJ 2026-07-13). */\n maxChapterContentLength: number;\n maxTuneTracks: number;\n maxTelevisionEpisodes: number;\n };\n /** Conversation Files container caps — PER CONVERSATION (one guild-invite\n * conversation or one admin-support dispatch thread). Both scopes share one cap\n * set; guild chat channels have no Conversation Files. DJ ruling 2026-07-25. */\n conversation: {\n /** Published active Conversation Files allowed in one conversation. */\n maxConversationFiles: number;\n /** Published STORED-OUTPUT bytes allowed in one conversation. */\n maxConversationFileStorageBytes: number;\n };\n hall: {\n maxSubmitBatch: number;\n };\n batches: {\n trendingFeedProcessLimit: number;\n maxFeedbackSubmitters: number;\n };\n /** Values for the backend rate limiters. Prefixes/factory stay in functions. */\n rateLimits: {\n UPLOAD: RateLimitValue;\n ADMIN_UPLOAD: RateLimitValue;\n CONTENT_WRITE: RateLimitValue;\n VOTE: RateLimitValue;\n MODERATION: RateLimitValue;\n SENSITIVE_ACTION: RateLimitValue;\n DISPLAY_NAME_CHECK: RateLimitValue;\n CHAT_MESSAGE: RateLimitValue;\n ADMIN_TASK: RateLimitValue;\n APPEAL_REVIEW: RateLimitValue;\n BAN_ACTION: RateLimitValue;\n SHARE_TRANSFER: RateLimitValue;\n CONTENT_REPORT: RateLimitValue;\n SHORT_LINK_CLICK: RateLimitValue;\n FOLLOW: RateLimitValue;\n MENTION_HISTORY: RateLimitValue;\n ADMIN_MESSAGE_READ: RateLimitValue;\n USER_LOOKUP: RateLimitValue;\n NOTIFICATION_BROADCAST: RateLimitValue;\n NOTIFICATION_ARCHIVE: RateLimitValue;\n NOTIFICATION_MARK_SEEN: RateLimitValue;\n FEEDBACK: RateLimitValue;\n SHORT_LINK_CREATE: RateLimitValue;\n INVITE_ACTION: RateLimitValue;\n LIBRARY_SUBMISSION: RateLimitValue;\n CHANNEL_CREATE: RateLimitValue;\n CHECKOUT_CREATE: RateLimitValue;\n };\n}\n\nexport const CHARTER_LIMITS: TttLimits = {\n mode: 'charter',\n user: {\n maxCraftSkills: 8,\n maxOwnedWorkProjects: 3,\n maxAssociatedWorkProjects: 10,\n },\n workProject: {\n maxGuildSize: 25,\n maxFileFolders: 10,\n maxWorkFiles: 100,\n maxWorkFileStorageBytes: 2_684_354_560, // 2.5 GiB\n maxWorkProjectAuditions: 3,\n maxCommissionListings: 3,\n maxChapters: 5,\n // ~5,000 words — a full real chapter, while keeping the human threshold-review\n // reading effort per item bounded during charter season.\n maxChapterContentLength: 30_000,\n maxTuneTracks: 5,\n maxTelevisionEpisodes: 3,\n },\n // Conversation Files are QUOTA'D PER CONVERSATION (DJ ruling 2026-07-25). Counted on\n // STORED OUTPUT bytes (what actually sits in R2 after transcode), never on raw upload\n // bytes. Rationale: a per-file `maxBytes` cap alone bounds one upload but nothing stops\n // unbounded accumulation across a long-running conversation — this is the abuse brake\n // on that, and it is what `startUpload`'s reservation and the publication transfer both\n // check. Charter: 10 files / 500 MiB per conversation.\n conversation: {\n maxConversationFiles: 10,\n maxConversationFileStorageBytes: 524_288_000, // 500 MiB\n },\n hall: { maxSubmitBatch: 10 },\n batches: { trendingFeedProcessLimit: 250, maxFeedbackSubmitters: 25 },\n rateLimits: {\n // Uploads are charged ONCE per upload (in startUpload); the processor-side\n // check is a non-charging guard.\n UPLOAD: { maxRequests: 15, window: '1 h' },\n // A separate HIGHER bucket for uploads performed through the sanctioned admin\n // authority path — never an exemption. Bulk admin setup work (creating 3\n // auditions is ~5 uploads) exhausts the 15/h user bucket; 60/h covers a real\n // bulk admin session while keeping a brake on a compromised admin token and on\n // third-party quota/cost (Vision / Video Intelligence / R2). DJ ruling 2026-07-25.\n ADMIN_UPLOAD: { maxRequests: 60, window: '1 h' },\n // General content-write throttle for the non-upload write callables (text posts,\n // craft-skill edits, support-thread starts) that used to charge UPLOAD. Sharing\n // the 15/h charter upload window meant heavy text posting blocked real uploads\n // and vice versa; a separate 30/h bucket keeps each cost driver on its own\n // ceiling. DJ ruling 2026-07-25.\n CONTENT_WRITE: { maxRequests: 30, window: '1 h' },\n VOTE: { maxRequests: 100, window: '1 h' },\n MODERATION: { maxRequests: 50, window: '1 h' },\n // 30/h: one bucket is shared by ~35 callables (register, become-artisan,\n // create-work, invites, trades, appeals, …) — a real first-hour artisan does\n // 10-15 legitimate sensitive actions; 5/h blocked the intended golden path\n // (proven live by the hosted-dev E2E, 2026-07-07). DJ ruling 2026-07-08.\n SENSITIVE_ACTION: { maxRequests: 30, window: '1 h' },\n // 120/h (charter): checkDisplayNameAvailable is enforceAppCheck:true, so\n // reCAPTCHA-Enterprise attestation is the real abuse gate — this bucket is a\n // cost/DoS ceiling, not the security boundary. It is IP-keyed (pre-registration,\n // no uid yet) and the register form fires it debounced-LIVE as you type, so one\n // legit registrant spends ~3-8 checks and shared NAT/CGNAT multiplies that across\n // everyone on the IP. The old 20/h false-rejected legitimate shared-IP users and\n // could not fit a full hosted-dev E2E suite run on one IP. DJ ruling 2026-07-21.\n DISPLAY_NAME_CHECK: { maxRequests: 120, window: '1 h' },\n CHAT_MESSAGE: { maxRequests: 125, window: '1 h' },\n ADMIN_TASK: { maxRequests: 60, window: '1 h' },\n APPEAL_REVIEW: { maxRequests: 30, window: '1 h' },\n BAN_ACTION: { maxRequests: 20, window: '1 h' },\n SHARE_TRANSFER: { maxRequests: 10, window: '1 h' },\n CONTENT_REPORT: { maxRequests: 5, window: '1 h' },\n SHORT_LINK_CLICK: { maxRequests: 60, window: '1 h' },\n FOLLOW: { maxRequests: 20, window: '1 m' },\n MENTION_HISTORY: { maxRequests: 120, window: '1 h' },\n ADMIN_MESSAGE_READ: { maxRequests: 60, window: '1 h' },\n // Admin exact-account lookup (searchPublicUsers / lookupUserByEmailOrUid) — a read, so a\n // generous per-minute bucket that still backstops a scripted enumeration sweep. Admin-only\n // and not a cost driver, so the value is the same in both modes (like MODERATION/ADMIN_TASK).\n USER_LOOKUP: { maxRequests: 30, window: '1 m' },\n NOTIFICATION_BROADCAST: { maxRequests: 10, window: '1 h' },\n NOTIFICATION_ARCHIVE: { maxRequests: 120, window: '1 h' },\n NOTIFICATION_MARK_SEEN: { maxRequests: 120, window: '1 h' },\n FEEDBACK: { maxRequests: 10, window: '1 h' },\n SHORT_LINK_CREATE: { maxRequests: 30, window: '1 h' },\n INVITE_ACTION: { maxRequests: 30, window: '1 h' },\n LIBRARY_SUBMISSION: { maxRequests: 10, window: '1 h' },\n CHANNEL_CREATE: { maxRequests: 5, window: '1 h' },\n CHECKOUT_CREATE: { maxRequests: 5, window: '1 h' },\n },\n};\n\nexport const FULL_LIMITS: TttLimits = {\n mode: 'full',\n user: {\n maxCraftSkills: 24,\n maxOwnedWorkProjects: 25,\n maxAssociatedWorkProjects: 100,\n },\n workProject: {\n maxGuildSize: 250,\n maxFileFolders: 25,\n maxWorkFiles: 1000,\n maxWorkFileStorageBytes: 26_843_545_600, // 25 GiB\n maxWorkProjectAuditions: 10,\n maxCommissionListings: 10,\n maxChapters: 50,\n // The intentional design ceiling (~17,000 words; trivially inside Firestore's\n // 1 MiB doc limit) — the audit trail deliberately stores field LENGTHS, not\n // content, because chapters can be this large (runUpdateChapterDetails).\n maxChapterContentLength: 100_000,\n maxTuneTracks: 50,\n maxTelevisionEpisodes: 25,\n },\n // 20 files / 1 GiB (full): the same per-conversation Conversation Files quota as\n // charter, scaled for a public-launch conversation. Still a hard ceiling on\n // unbounded R2 accumulation. See the CHARTER_LIMITS note above. DJ ruling 2026-07-25.\n conversation: {\n maxConversationFiles: 20,\n maxConversationFileStorageBytes: 1_073_741_824, // 1 GiB\n },\n hall: { maxSubmitBatch: 50 },\n batches: { trendingFeedProcessLimit: 1000, maxFeedbackSubmitters: 100 },\n rateLimits: {\n UPLOAD: { maxRequests: 30, window: '1 h' },\n // 120/h (full): the same sanctioned-admin-path upload bucket as charter, scaled\n // with UPLOAD — always HIGHER than the user bucket, never an exemption, so a\n // compromised admin token and third-party media cost stay bounded. See the\n // CHARTER_LIMITS note above. DJ ruling 2026-07-25.\n ADMIN_UPLOAD: { maxRequests: 120, window: '1 h' },\n // 60/h (full): the same non-upload content-write bucket as charter, scaled with\n // UPLOAD so text writes and media uploads never consume each other's ceiling.\n // See the CHARTER_LIMITS note above. DJ ruling 2026-07-25.\n CONTENT_WRITE: { maxRequests: 60, window: '1 h' },\n VOTE: { maxRequests: 200, window: '1 h' },\n MODERATION: { maxRequests: 50, window: '1 h' },\n // 60/h: full-mode power users managing several works do dozens of legitimate\n // management actions per hour; still a hard backstop against scripts.\n // DJ ruling 2026-07-08 (charter 30 / full 60, single bucket; a bucket split\n // is filed post-launch in ttt-prod docs/post-launch/).\n SENSITIVE_ACTION: { maxRequests: 60, window: '1 h' },\n // 300/h (full): same reasoning as the charter value above (App-Check-gated\n // cost ceiling, IP-keyed, debounced-live). Public-launch CGNAT exposure is far\n // larger — hundreds of concurrent legit registrants can sit behind one carrier\n // IP — so err generous; the only cost of \"too high\" is trivial Firestore reads,\n // while \"too low\" false-rejects real users. Raise on evidence (watch prod logs\n // for legit 429s) rather than pre-emptively tightening. DJ ruling 2026-07-21.\n DISPLAY_NAME_CHECK: { maxRequests: 300, window: '1 h' },\n CHAT_MESSAGE: { maxRequests: 150, window: '1 h' },\n ADMIN_TASK: { maxRequests: 60, window: '1 h' },\n APPEAL_REVIEW: { maxRequests: 30, window: '1 h' },\n BAN_ACTION: { maxRequests: 20, window: '1 h' },\n SHARE_TRANSFER: { maxRequests: 10, window: '1 h' },\n CONTENT_REPORT: { maxRequests: 20, window: '1 h' },\n SHORT_LINK_CLICK: { maxRequests: 60, window: '1 h' },\n FOLLOW: { maxRequests: 60, window: '1 m' },\n MENTION_HISTORY: { maxRequests: 120, window: '1 h' },\n ADMIN_MESSAGE_READ: { maxRequests: 60, window: '1 h' },\n // Admin exact-account lookup — same read bucket in both modes (see CHARTER_LIMITS note).\n USER_LOOKUP: { maxRequests: 30, window: '1 m' },\n NOTIFICATION_BROADCAST: { maxRequests: 10, window: '1 h' },\n NOTIFICATION_ARCHIVE: { maxRequests: 120, window: '1 h' },\n NOTIFICATION_MARK_SEEN: { maxRequests: 120, window: '1 h' },\n FEEDBACK: { maxRequests: 10, window: '1 h' },\n SHORT_LINK_CREATE: { maxRequests: 30, window: '1 h' },\n INVITE_ACTION: { maxRequests: 60, window: '1 h' },\n LIBRARY_SUBMISSION: { maxRequests: 20, window: '1 h' },\n CHANNEL_CREATE: { maxRequests: 20, window: '1 h' },\n CHECKOUT_CREATE: { maxRequests: 20, window: '1 h' },\n },\n};\n\n/** The resolved limit set for the deployed mode. Import THIS (or the alias\n * constants that re-export from it), never CHARTER_/FULL_ directly. */\nexport const ACTIVE_LIMITS: TttLimits = byMode(CHARTER_LIMITS, FULL_LIMITS);\n"]}
1
+ {"version":3,"file":"app-mode.js","sourceRoot":"","sources":["../../src/constants/app-mode.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,wEAAwE;AACxE,yEAAyE;AACzE,+DAA+D;AAC/D,2DAA2D;AAC3D,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,yEAAyE;AACzE,0EAA0E;AAC1E,yEAAyE;AAIzE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,QAAQ,GAAY,SAAS,CAAC;AAE3C,qDAAqD;AACrD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAI,OAAU,EAAE,IAAO,EAAK,EAAE,CACjD,QAAoB,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AAiFvD,MAAM,CAAC,MAAM,cAAc,GAAc;IACvC,IAAI,EAAE,SAAS;IACf,IAAI,EAAE;QACJ,cAAc,EAAE,CAAC;QACjB,oBAAoB,EAAE,CAAC;QACvB,yBAAyB,EAAE,EAAE;KAC9B;IACD,WAAW,EAAE;QACX,YAAY,EAAE,EAAE;QAChB,cAAc,EAAE,EAAE;QAClB,YAAY,EAAE,GAAG;QACjB,uBAAuB,EAAE,aAAa,EAAE,UAAU;QAClD,uBAAuB,EAAE,CAAC;QAC1B,qBAAqB,EAAE,CAAC;QACxB,WAAW,EAAE,CAAC;QACd,+EAA+E;QAC/E,yDAAyD;QACzD,uBAAuB,EAAE,MAAM;QAC/B,aAAa,EAAE,CAAC;QAChB,qBAAqB,EAAE,CAAC;KACzB;IACD,qFAAqF;IACrF,sFAAsF;IACtF,wFAAwF;IACxF,sFAAsF;IACtF,wFAAwF;IACxF,uDAAuD;IACvD,YAAY,EAAE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AE,KAAK,EAAE;QAC5C,iBAAiB,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;QACrD,aAAa,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;QACjD,kBAAkB,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;QACtD,cAAc,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;QAClD,eAAe,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;KACpD;CACF,CAAC;AAEF;uEACuE;AACvE,MAAM,CAAC,MAAM,aAAa,GAAc,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC","sourcesContent":["// App mode + the charter/full limit sets — the single published constant that\n// drives the whole app's cost posture. The flip to full-live is: change\n// APP_MODE → publish ttt-core → install in ttt-prod (root + functions) →\n// deploy. There is NO runtime mode flag and NO console toggle.\n// See ttt-prod docs/design/charter-season-and-app-mode.md.\n//\n// Only real cost/abuse drivers vary by mode: media specs (ttt-media-specs.ts),\n// rate-limit values, count caps, batch sizes. Text-length limits and payment\n// min/max are deliberately mode-invariant — with ONE ruled exception (DJ\n// 2026-07-13): chapter body content (maxChapterContentLength), because it\n// bounds threshold-review reading effort per item during charter season.\n\nexport type AppMode = 'charter' | 'full';\n\n/** The deployed mode. Changing this constant (and publishing) IS the flip. */\nexport const APP_MODE: AppMode = 'charter';\n\n/** Pick the active value for a mode-varied limit. */\nexport const byMode = <T>(charter: T, full: T): T =>\n (APP_MODE as AppMode) === 'charter' ? charter : full;\n\n/** Upstash-style sliding-window duration, e.g. '1 h'. */\nexport type RateLimitWindow = `${number} ${'ms' | 's' | 'm' | 'h' | 'd'}`;\n\nexport interface RateLimitValue {\n maxRequests: number;\n window: RateLimitWindow;\n}\n\nexport interface TttLimits {\n mode: AppMode;\n user: {\n maxCraftSkills: number;\n maxOwnedWorkProjects: number;\n maxAssociatedWorkProjects: number;\n };\n workProject: {\n maxGuildSize: number;\n maxFileFolders: number;\n maxWorkFiles: number;\n maxWorkFileStorageBytes: number;\n maxWorkProjectAuditions: number;\n maxCommissionListings: number;\n maxChapters: number;\n /** Chapter BODY length (chars) — the one mode-varied text limit (DJ 2026-07-13). */\n maxChapterContentLength: number;\n maxTuneTracks: number;\n maxTelevisionEpisodes: number;\n };\n /** Conversation Files container caps — PER CONVERSATION (one guild-invite\n * conversation or one admin-support dispatch thread). Both scopes share one cap\n * set; guild chat channels have no Conversation Files. DJ ruling 2026-07-25. */\n conversation: {\n /** Published active Conversation Files allowed in one conversation. */\n maxConversationFiles: number;\n /** Published STORED-OUTPUT bytes allowed in one conversation. */\n maxConversationFileStorageBytes: number;\n };\n hall: {\n maxSubmitBatch: number;\n };\n batches: {\n trendingFeedProcessLimit: number;\n maxFeedbackSubmitters: number;\n };\n /** Values for the backend rate limiters. Prefixes/factory stay in functions. */\n rateLimits: {\n UPLOAD: RateLimitValue;\n ADMIN_UPLOAD: RateLimitValue;\n CONTENT_WRITE: RateLimitValue;\n VOTE: RateLimitValue;\n MODERATION: RateLimitValue;\n SENSITIVE_ACTION: RateLimitValue;\n DISPLAY_NAME_CHECK: RateLimitValue;\n CHAT_MESSAGE: RateLimitValue;\n ADMIN_TASK: RateLimitValue;\n APPEAL_REVIEW: RateLimitValue;\n BAN_ACTION: RateLimitValue;\n SHARE_TRANSFER: RateLimitValue;\n CONTENT_REPORT: RateLimitValue;\n SHORT_LINK_CLICK: RateLimitValue;\n FOLLOW: RateLimitValue;\n MENTION_HISTORY: RateLimitValue;\n MEDIA_GRANT: RateLimitValue;\n CHAT_GRANT: RateLimitValue;\n OPERATOR_STEP_UP: RateLimitValue;\n ADMIN_MESSAGE_READ: RateLimitValue;\n USER_LOOKUP: RateLimitValue;\n NOTIFICATION_BROADCAST: RateLimitValue;\n NOTIFICATION_ARCHIVE: RateLimitValue;\n NOTIFICATION_MARK_SEEN: RateLimitValue;\n FEEDBACK: RateLimitValue;\n SHORT_LINK_CREATE: RateLimitValue;\n INVITE_ACTION: RateLimitValue;\n LIBRARY_SUBMISSION: RateLimitValue;\n CHANNEL_CREATE: RateLimitValue;\n CHECKOUT_CREATE: RateLimitValue;\n };\n}\n\nexport const CHARTER_LIMITS: TttLimits = {\n mode: 'charter',\n user: {\n maxCraftSkills: 8,\n maxOwnedWorkProjects: 3,\n maxAssociatedWorkProjects: 10,\n },\n workProject: {\n maxGuildSize: 25,\n maxFileFolders: 10,\n maxWorkFiles: 100,\n maxWorkFileStorageBytes: 2_684_354_560, // 2.5 GiB\n maxWorkProjectAuditions: 3,\n maxCommissionListings: 3,\n maxChapters: 5,\n // ~5,000 words — a full real chapter, while keeping the human threshold-review\n // reading effort per item bounded during charter season.\n maxChapterContentLength: 30_000,\n maxTuneTracks: 5,\n maxTelevisionEpisodes: 3,\n },\n // Conversation Files are QUOTA'D PER CONVERSATION (DJ ruling 2026-07-25). Counted on\n // STORED OUTPUT bytes (what actually sits in R2 after transcode), never on raw upload\n // bytes. Rationale: a per-file `maxBytes` cap alone bounds one upload but nothing stops\n // unbounded accumulation across a long-running conversation — this is the abuse brake\n // on that, and it is what `startUpload`'s reservation and the publication transfer both\n // check. Charter: 10 files / 500 MiB per conversation.\n conversation: {\n maxConversationFiles: 10,\n maxConversationFileStorageBytes: 524_288_000, // 500 MiB\n },\n hall: { maxSubmitBatch: 10 },\n batches: { trendingFeedProcessLimit: 250, maxFeedbackSubmitters: 25 },\n rateLimits: {\n // Uploads are charged ONCE per upload (in startUpload); the processor-side\n // check is a non-charging guard.\n UPLOAD: { maxRequests: 15, window: '1 h' },\n // A separate HIGHER bucket for uploads performed through the sanctioned admin\n // authority path — never an exemption. Bulk admin setup work (creating 3\n // auditions is ~5 uploads) exhausts the 15/h user bucket; 60/h covers a real\n // bulk admin session while keeping a brake on a compromised admin token and on\n // third-party quota/cost (Vision / Video Intelligence / R2). DJ ruling 2026-07-25.\n ADMIN_UPLOAD: { maxRequests: 60, window: '1 h' },\n // General content-write throttle for the non-upload write callables (text posts,\n // craft-skill edits, support-thread starts) that used to charge UPLOAD. Sharing\n // the 15/h charter upload window meant heavy text posting blocked real uploads\n // and vice versa; a separate 30/h bucket keeps each cost driver on its own\n // ceiling. DJ ruling 2026-07-25.\n CONTENT_WRITE: { maxRequests: 30, window: '1 h' },\n VOTE: { maxRequests: 100, window: '1 h' },\n MODERATION: { maxRequests: 50, window: '1 h' },\n // 30/h: one bucket is shared by ~35 callables (register, become-artisan,\n // create-work, invites, trades, appeals, …) — a real first-hour artisan does\n // 10-15 legitimate sensitive actions; 5/h blocked the intended golden path\n // (proven live by the hosted-dev E2E, 2026-07-07). DJ ruling 2026-07-08.\n SENSITIVE_ACTION: { maxRequests: 30, window: '1 h' },\n // 120/h (charter): checkDisplayNameAvailable is enforceAppCheck:true, so\n // reCAPTCHA-Enterprise attestation is the real abuse gate — this bucket is a\n // cost/DoS ceiling, not the security boundary. It is IP-keyed (pre-registration,\n // no uid yet) and the register form fires it debounced-LIVE as you type, so one\n // legit registrant spends ~3-8 checks and shared NAT/CGNAT multiplies that across\n // everyone on the IP. The old 20/h false-rejected legitimate shared-IP users and\n // could not fit a full hosted-dev E2E suite run on one IP. DJ ruling 2026-07-21.\n DISPLAY_NAME_CHECK: { maxRequests: 120, window: '1 h' },\n CHAT_MESSAGE: { maxRequests: 125, window: '1 h' },\n ADMIN_TASK: { maxRequests: 60, window: '1 h' },\n APPEAL_REVIEW: { maxRequests: 30, window: '1 h' },\n BAN_ACTION: { maxRequests: 20, window: '1 h' },\n SHARE_TRANSFER: { maxRequests: 10, window: '1 h' },\n CONTENT_REPORT: { maxRequests: 5, window: '1 h' },\n SHORT_LINK_CLICK: { maxRequests: 60, window: '1 h' },\n FOLLOW: { maxRequests: 20, window: '1 m' },\n MENTION_HISTORY: { maxRequests: 120, window: '1 h' },\n // Scoped-media grant minting (createMediaGrant). Its OWN bucket — it used to charge\n // MENTION_HISTORY, an unrelated surface, so neither limit meant what its name said and the\n // two shared a budget sized for neither (BACKEND-013). Refresh-driven, not user-initiated:\n // a grant is short-TTL (60 min work media, 15 min chat/folder scopes) and the client re-mints\n // under expiry, so a browsing session naturally spends several per hour PER SCOPE (each work,\n // each private file folder, each conversation). Cheap to serve (a Firestore permission read\n // plus an HMAC sign — no third-party cost), and a false 429 breaks media rendering outright,\n // so the ceiling is generous: it exists to stop a scripted grant-farming sweep, not to pace a\n // real reader. 120/h charter.\n MEDIA_GRANT: { maxRequests: 120, window: '1 h' },\n // Realtime chat grant minting (mintChatGrant) — previously NO limiter at all (BACKEND-013),\n // despite minting signed grants at concurrency: 20. Same refresh-driven shape as MEDIA_GRANT:\n // a 15-minute grant TTL means ~4 mints/hour for the inbox plus ~4 per open channel, doubled\n // again by socket reconnects on a flaky mobile network. It stays behind the per-channel\n // authorizeChannelScope gate, so this bucket is a cost/DoS ceiling rather than the\n // authorization boundary — sized to match MEDIA_GRANT so the two grant surfaces are paced\n // alike and neither can be starved by the other (separate Redis prefixes).\n CHAT_GRANT: { maxRequests: 120, window: '1 h' },\n // Operator step-up TOTP verification (confirmOperatorStepUp / verifyOperatorStepUp) —\n // previously unthrottled, so an attacker holding a stolen full-admin session could\n // brute-force the 6-digit second factor guarding the safety console (BACKEND-013).\n // DELIBERATELY THE TIGHTEST BUCKET IN THE SET: a real operator enrolls once and verifies\n // roughly twice an hour (the grant window is 30 minutes), so 10/h absorbs every legitimate\n // mistype while capping guessing at 10 attempts per hour against a code that rotates every\n // 30 seconds. Mode-INVARIANT — this is an admin security control, not a cost driver, so it\n // never loosens at the full-mode flip (same posture as MODERATION / BAN_ACTION / USER_LOOKUP).\n // The lockout-after-N-failures behaviour is a separate app-side concern; this is the throttle.\n OPERATOR_STEP_UP: { maxRequests: 10, window: '1 h' },\n ADMIN_MESSAGE_READ: { maxRequests: 60, window: '1 h' },\n // Admin exact-account lookup (searchPublicUsers / lookupUserByEmailOrUid) — a read, so a\n // generous per-minute bucket that still backstops a scripted enumeration sweep. Admin-only\n // and not a cost driver, so the value is the same in both modes (like MODERATION/ADMIN_TASK).\n USER_LOOKUP: { maxRequests: 30, window: '1 m' },\n NOTIFICATION_BROADCAST: { maxRequests: 10, window: '1 h' },\n NOTIFICATION_ARCHIVE: { maxRequests: 120, window: '1 h' },\n NOTIFICATION_MARK_SEEN: { maxRequests: 120, window: '1 h' },\n FEEDBACK: { maxRequests: 10, window: '1 h' },\n SHORT_LINK_CREATE: { maxRequests: 30, window: '1 h' },\n INVITE_ACTION: { maxRequests: 30, window: '1 h' },\n LIBRARY_SUBMISSION: { maxRequests: 10, window: '1 h' },\n CHANNEL_CREATE: { maxRequests: 5, window: '1 h' },\n CHECKOUT_CREATE: { maxRequests: 5, window: '1 h' },\n },\n};\n\nexport const FULL_LIMITS: TttLimits = {\n mode: 'full',\n user: {\n maxCraftSkills: 24,\n maxOwnedWorkProjects: 25,\n maxAssociatedWorkProjects: 100,\n },\n workProject: {\n maxGuildSize: 250,\n maxFileFolders: 25,\n maxWorkFiles: 1000,\n maxWorkFileStorageBytes: 26_843_545_600, // 25 GiB\n maxWorkProjectAuditions: 10,\n maxCommissionListings: 10,\n maxChapters: 50,\n // The intentional design ceiling (~17,000 words; trivially inside Firestore's\n // 1 MiB doc limit) — the audit trail deliberately stores field LENGTHS, not\n // content, because chapters can be this large (runUpdateChapterDetails).\n maxChapterContentLength: 100_000,\n maxTuneTracks: 50,\n maxTelevisionEpisodes: 25,\n },\n // 20 files / 1 GiB (full): the same per-conversation Conversation Files quota as\n // charter, scaled for a public-launch conversation. Still a hard ceiling on\n // unbounded R2 accumulation. See the CHARTER_LIMITS note above. DJ ruling 2026-07-25.\n conversation: {\n maxConversationFiles: 20,\n maxConversationFileStorageBytes: 1_073_741_824, // 1 GiB\n },\n hall: { maxSubmitBatch: 50 },\n batches: { trendingFeedProcessLimit: 1000, maxFeedbackSubmitters: 100 },\n rateLimits: {\n UPLOAD: { maxRequests: 30, window: '1 h' },\n // 120/h (full): the same sanctioned-admin-path upload bucket as charter, scaled\n // with UPLOAD — always HIGHER than the user bucket, never an exemption, so a\n // compromised admin token and third-party media cost stay bounded. See the\n // CHARTER_LIMITS note above. DJ ruling 2026-07-25.\n ADMIN_UPLOAD: { maxRequests: 120, window: '1 h' },\n // 60/h (full): the same non-upload content-write bucket as charter, scaled with\n // UPLOAD so text writes and media uploads never consume each other's ceiling.\n // See the CHARTER_LIMITS note above. DJ ruling 2026-07-25.\n CONTENT_WRITE: { maxRequests: 60, window: '1 h' },\n VOTE: { maxRequests: 200, window: '1 h' },\n MODERATION: { maxRequests: 50, window: '1 h' },\n // 60/h: full-mode power users managing several works do dozens of legitimate\n // management actions per hour; still a hard backstop against scripts.\n // DJ ruling 2026-07-08 (charter 30 / full 60, single bucket; a bucket split\n // is filed post-launch in ttt-prod docs/post-launch/).\n SENSITIVE_ACTION: { maxRequests: 60, window: '1 h' },\n // 300/h (full): same reasoning as the charter value above (App-Check-gated\n // cost ceiling, IP-keyed, debounced-live). Public-launch CGNAT exposure is far\n // larger — hundreds of concurrent legit registrants can sit behind one carrier\n // IP — so err generous; the only cost of \"too high\" is trivial Firestore reads,\n // while \"too low\" false-rejects real users. Raise on evidence (watch prod logs\n // for legit 429s) rather than pre-emptively tightening. DJ ruling 2026-07-21.\n DISPLAY_NAME_CHECK: { maxRequests: 300, window: '1 h' },\n CHAT_MESSAGE: { maxRequests: 150, window: '1 h' },\n ADMIN_TASK: { maxRequests: 60, window: '1 h' },\n APPEAL_REVIEW: { maxRequests: 30, window: '1 h' },\n BAN_ACTION: { maxRequests: 20, window: '1 h' },\n SHARE_TRANSFER: { maxRequests: 10, window: '1 h' },\n CONTENT_REPORT: { maxRequests: 20, window: '1 h' },\n SHORT_LINK_CLICK: { maxRequests: 60, window: '1 h' },\n FOLLOW: { maxRequests: 60, window: '1 m' },\n MENTION_HISTORY: { maxRequests: 120, window: '1 h' },\n // 240/h (full): the same grant-minting buckets as charter, doubled with the surrounding\n // content limits. Full mode raises the ceilings a grant is minted PER (250-guildmate guilds,\n // 25 file folders, 1000 work files, 10 auditions), so one session legitimately touches more\n // scopes and re-mints more often. See the CHARTER_LIMITS notes above.\n MEDIA_GRANT: { maxRequests: 240, window: '1 h' },\n CHAT_GRANT: { maxRequests: 240, window: '1 h' },\n // Operator step-up stays at 10/h in BOTH modes — an admin second-factor throttle is a\n // security control, not a cost lever, so it never loosens at the flip. See CHARTER_LIMITS.\n OPERATOR_STEP_UP: { maxRequests: 10, window: '1 h' },\n ADMIN_MESSAGE_READ: { maxRequests: 60, window: '1 h' },\n // Admin exact-account lookup — same read bucket in both modes (see CHARTER_LIMITS note).\n USER_LOOKUP: { maxRequests: 30, window: '1 m' },\n NOTIFICATION_BROADCAST: { maxRequests: 10, window: '1 h' },\n NOTIFICATION_ARCHIVE: { maxRequests: 120, window: '1 h' },\n NOTIFICATION_MARK_SEEN: { maxRequests: 120, window: '1 h' },\n FEEDBACK: { maxRequests: 10, window: '1 h' },\n SHORT_LINK_CREATE: { maxRequests: 30, window: '1 h' },\n INVITE_ACTION: { maxRequests: 60, window: '1 h' },\n LIBRARY_SUBMISSION: { maxRequests: 20, window: '1 h' },\n CHANNEL_CREATE: { maxRequests: 20, window: '1 h' },\n CHECKOUT_CREATE: { maxRequests: 20, window: '1 h' },\n },\n};\n\n/** The resolved limit set for the deployed mode. Import THIS (or the alias\n * constants that re-export from it), never CHARTER_/FULL_ directly. */\nexport const ACTIVE_LIMITS: TttLimits = byMode(CHARTER_LIMITS, FULL_LIMITS);\n"]}
@@ -82,6 +82,10 @@ export declare const MAX_CONTENT_PAGE_HEADING_LENGTH = 300;
82
82
  export declare const MAX_CONTENT_PAGE_BODY_LENGTH = 20000;
83
83
  export declare const MAX_TAKE_IT_DOWN_COPY_LENGTH = 8000;
84
84
  export declare const MAX_MAINTENANCE_MESSAGE_LENGTH = 2000;
85
+ /** Announcement-banner copy on `_config/app.announcementMessage`. Deliberately far
86
+ * shorter than the maintenance message: the announcement renders as a one-line banner
87
+ * on the landing page and login screen, not a full-page takeover. */
88
+ export declare const MAX_ANNOUNCEMENT_MESSAGE_LENGTH = 300;
85
89
  /** Admin notes on a content-appeal review (reviewContentAppeal). */
86
90
  export declare const MAX_APPEAL_REVIEW_NOTES_LENGTH = 2000;
87
91
  /** Admin reason on a Work/Realm forced-retitle remedy. */
@@ -1 +1 @@
1
- {"version":3,"file":"business-admin.d.ts","sourceRoot":"","sources":["../../src/constants/business-admin.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAEnF,eAAO,MAAM,oBAAoB;;;;;CAKvB,CAAC;AAEX;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB;;;;;IAK9B;;uDAEmD;;CAE3C,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAE/F,mFAAmF;AACnF,eAAO,MAAM,4BAA4B;;;;;CAK/B,CAAC;AAIX,yDAAyD;AACzD,eAAO,MAAM,iCAAiC,MAAM,CAAC;AAErD,qEAAqE;AACrE,eAAO,MAAM,sCAAsC,OAAO,CAAC;AAI3D,6DAA6D;AAC7D,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C;gEACgE;AAChE,eAAO,MAAM,iCAAiC,OAAO,CAAC;AAMtD,8FAA8F;AAC9F,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,6FAA6F;AAC7F,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD,sEAAsE;AACtE,eAAO,MAAM,oCAAoC,OAAO,CAAC;AAEzD,sDAAsD;AACtD,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAIjD,wFAAwF;AACxF,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD;iFACiF;AACjF,eAAO,MAAM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AAM,6BAA6B,QAAoC,CAAC;AAI/E,qCAAqC;AACrC,eAAO,MAAM,iBAAiB;;;;;CAKpB,CAAC"}
@@ -97,6 +97,10 @@ export const MAX_CONTENT_PAGE_HEADING_LENGTH = 300;
97
97
  export const MAX_CONTENT_PAGE_BODY_LENGTH = 20000;
98
98
  export const MAX_TAKE_IT_DOWN_COPY_LENGTH = 8000;
99
99
  export const MAX_MAINTENANCE_MESSAGE_LENGTH = 2000;
100
+ /** Announcement-banner copy on `_config/app.announcementMessage`. Deliberately far
101
+ * shorter than the maintenance message: the announcement renders as a one-line banner
102
+ * on the landing page and login screen, not a full-page takeover. */
103
+ export const MAX_ANNOUNCEMENT_MESSAGE_LENGTH = 300;
100
104
  /** Admin notes on a content-appeal review (reviewContentAppeal). */
101
105
  export const MAX_APPEAL_REVIEW_NOTES_LENGTH = 2000;
102
106
  /** Admin reason on a Work/Realm forced-retitle remedy. */
@@ -1 +1 @@
1
- {"version":3,"file":"business-admin.js","sourceRoot":"","sources":["../../src/constants/business-admin.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,8DAA8D;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,qCAAqC;AAErC,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,QAAQ,EAAE,CAAC;IACX,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC;CACE,CAAC;AAIX,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,KAAK;CACA,CAAC;AAEX;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,GAAG;IACT,QAAQ,EAAE,IAAI;IACd;;uDAEmD;IACnD,aAAa,EAAE,IAAI;CACX,C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AAS,EAAE,WAAW;CACd,CAAC","sourcesContent":["// Admin + content-moderation business-rule constants — task priority, dispatches,\n// the moderation/feedback workflow, and admin-task lifecycle.\nimport { ACTIVE_LIMITS } from './app-mode.js';\n\n// --- Admin Task Priority System ---\n\nexport const TASK_PRIORITY = {\n CRITICAL: 4,\n HIGH: 3,\n NORMAL: 2,\n LOW: 1,\n} as const;\n\nexport type TaskPriorityLevel = (typeof TASK_PRIORITY)[keyof typeof TASK_PRIORITY];\n\nexport const TASK_PRIORITY_LABELS = {\n 4: 'CRITICAL',\n 3: 'HIGH',\n 2: 'NORMAL',\n 1: 'LOW',\n} as const;\n\n/**\n * Canonical NUMERIC priority scale for `adminTasks.priority`, shared by BOTH\n * priority systems so `checkoutNextImportantTask` (orderBy priority desc across all\n * task types) compares commensurable values. The userReport report-core score formula\n * already writes on this scale (≈40–2250); the level-based types (thresholdLibraryReview,\n * content-appeal, adminDispatch) map their TASK_PRIORITY level onto these numbers instead\n * of writing the raw 1–4.\n *\n * Resulting order: safety reports (1200–2250) > money anomalies (1100) >\n * CRITICAL (1000) > HIGH (800) > routine reports interleave below > spam-tier (~80).\n */\nexport const TASK_PRIORITY_SCORE = {\n LOW: 50,\n NORMAL: 200,\n HIGH: 800,\n CRITICAL: 1000,\n /** Money-integrity anomaly (stake-share / pledge-ledger corruption signal) — outranks\n * everything except safety-class reports. The three anomaly creators that previously\n * hardcoded `priority: 1` (LOW) all write this. */\n MONEY_ANOMALY: 1100,\n} as const;\n\nexport type TaskPriorityScore = (typeof TASK_PRIORITY_SCORE)[keyof typeof TASK_PRIORITY_SCORE];\n\n/** Maps a level-based TASK_PRIORITY value (1–4) to its canonical numeric score. */\nexport const TASK_PRIORITY_LEVEL_TO_SCORE = {\n [TASK_PRIORITY.LOW]: TASK_PRIORITY_SCORE.LOW,\n [TASK_PRIORITY.NORMAL]: TASK_PRIORITY_SCORE.NORMAL,\n [TASK_PRIORITY.HIGH]: TASK_PRIORITY_SCORE.HIGH,\n [TASK_PRIORITY.CRITICAL]: TASK_PRIORITY_SCORE.CRITICAL,\n} as const;\n\n// --- Admin Dispatches ---\n\n/** Maximum length for an admin-dispatch subject line. */\nexport const MAX_ADMIN_DISPATCH_SUBJECT_LENGTH = 100;\n\n/** Maximum length for the initial body text of an admin dispatch. */\nexport const MAX_ADMIN_DISPATCH_INITIAL_TEXT_LENGTH = 1000;\n\n// --- Content Moderation Workflow ---\n\n/** Maximum length for a content-violation appeal message. */\nexport const MAX_APPEAL_MESSAGE_LENGTH = 1000;\n\n/** Threshold-review reviewer notes (revision notes shown to the author). One owner for\n * the review callable schema AND the admin work-view input. */\nexport const MAX_THRESHOLD_REVIEW_NOTES_LENGTH = 2000;\n\n// --- Moderation / safety operator text caps ---\n// Each is declared ONCE here and derived by every input schema AND persisted doc schema\n// that carries the field — the numbers must never be re-hardcoded at an enforcement point.\n\n/** Operator-facing INTERNAL reason/rationale (LE-loggable; account actions, case reopens). */\nexport const MAX_INTERNAL_REASON_LENGTH = 2000;\n\n/** The generic owner-readable (user-facing) reason — deliberately short, no detail leaks. */\nexport const MAX_USER_FACING_REASON_LENGTH = 280;\n\n/** Structured close-out summary on report/safety-case resolutions. */\nexport const MAX_SAFETY_RESOLUTION_SUMMARY_LENGTH = 2000;\n\n/** Optional operator note attached to a close-out. */\nexport const MAX_SAFETY_ADMIN_NOTE_LENGTH = 4000;\n\n// --- Report intake text caps ---\n\n/** Reporter free-text narrative/comment (segregated private doc; never on the root). */\nexport const MAX_REPORT_NARRATIVE_LENGTH = 4000;\n\n/** The report DIALOG's comment field cap (the client-side compose bound — tighter than\n * the server narrative cap above, which also absorbs upgrade concatenations). */\nexport const MAX_REPORT_COMMENT_LENGTH = 1000;\n\n/** Minimum operator rationale/reason length on safety-console staged actions. */\nexport const MIN_SAFETY_RATIONALE_LENGTH = 10;\n\n/** Operator reason on an admin chat-moderation action (adminModerateChatMessage /\n * adminReadChannelContext). ONE owner for both callables' `reason` bound. */\nexport const MAX_CHAT_MODERATION_REASON_LENGTH = 1000;\n\n/** Broadcast explicitUids selector audience cap (schema + composer both derive). */\nexport const MAX_BROADCAST_EXPLICIT_UIDS = 2000;\n\n// --- Operator step-up sentinel error codes ---\n// The two backend HttpsError messages the operator TOTP step-up throws; the frontend\n// matches them to open the step-up dialog in ENROLL vs VERIFY mode. ONE declaration —\n// both the callable (functions operatorStepUp.ts) and the frontend hook import these.\nexport const STEP_UP_ENROLL_REQUIRED = 'OPERATOR_STEP_UP_ENROLL_REQUIRED';\nexport const STEP_UP_REQUIRED = 'OPERATOR_STEP_UP_REQUIRED';\n\n/** The frozen report-time captured text snapshot (edit-to-evade guard; NO PII). */\nexport const MAX_REPORT_SNAPSHOT_TEXT_LENGTH = 4000;\n\n// --- Admin console config-content text caps ---\n// Every number the system uses lives HERE — even a field only one surface consumes\n// today, because any future client (TV / phone / admin app) reads ttt-core.\n\nexport const MAX_FUTURE_PLAN_TITLE_LENGTH = 200;\nexport const MAX_FUTURE_PLAN_DESCRIPTION_LENGTH = 4000;\nexport const MAX_PLATFORM_RULE_TITLE_LENGTH = 200;\nexport const MAX_PLATFORM_RULE_DESCRIPTION_LENGTH = 4000;\nexport const MAX_AGREEMENT_POINT_LENGTH = 2000;\nexport const MAX_CONTENT_PAGE_HEADING_LENGTH = 300;\nexport const MAX_CONTENT_PAGE_BODY_LENGTH = 20000;\nexport const MAX_TAKE_IT_DOWN_COPY_LENGTH = 8000;\nexport const MAX_MAINTENANCE_MESSAGE_LENGTH = 2000;\n\n/** Admin notes on a content-appeal review (reviewContentAppeal). */\nexport const MAX_APPEAL_REVIEW_NOTES_LENGTH = 2000;\n\n/** Admin reason on a Work/Realm forced-retitle remedy. */\nexport const MAX_REQUIRE_RETITLE_REASON_LENGTH = 500;\n\n/** Optional user-facing DETAIL text on a normal-report resolution. */\nexport const MAX_USER_FACING_REASON_DETAIL_LENGTH = 2000;\n\n/** Admin broadcast / user notification message body. */\nexport const MAX_NOTIFICATION_MESSAGE_LENGTH = 2000;\n\n/** Admin user-search query input. */\nexport const MAX_USER_SEARCH_QUERY_LENGTH = 100;\n\n// --- NCII / child-safety statutory + operator text caps ---\n\n/** Operator reason on the admin \"mark as NCII linked evidence\" intake. */\nexport const MAX_NCII_EVIDENCE_REASON_LENGTH = 1000;\n\n/** Operator written rationale on a TAKE IT DOWN validity decision (immutable row). */\nexport const MAX_NCII_RATIONALE_LENGTH = 4000;\n\n/** Requester's statement of nonconsent (statutory intake — in-app and no-login). */\nexport const MAX_NCII_NONCONSENT_STATEMENT_LENGTH = 4000;\n\n/** Typed-name electronic signature on a statutory request. */\nexport const MAX_NCII_SIGNED_NAME_LENGTH = 256;\n\n/** Requester's optional supporting facts (statutory intake). */\nexport const MAX_NCII_SUPPORTING_FACTS_LENGTH = 8000;\n\n/** Bounded, non-sensitive summary on an NCII request action row. */\nexport const MAX_NCII_ACTION_SUMMARY_LENGTH = 280;\n\n/** Operator description of a registered evidence artifact (e.g. portal screenshot). */\nexport const MAX_SAFETY_ARTIFACT_DESCRIPTION_LENGTH = 500;\n\n/** Operator proof note on a manual NCMEC portal filing. */\nexport const MAX_NCMEC_PORTAL_PROOF_TEXT_LENGTH = 2000;\n\n/** Requester's typed name on the no-login TAKE IT DOWN statutory intake. */\nexport const MAX_NCII_REQUESTER_NAME_LENGTH = 256;\n\n/** Name of the depicted person a representative files on behalf of. */\nexport const MAX_NCII_REPRESENTED_PERSON_NAME_LENGTH = 256;\n\n/** Representative's stated basis of authority (parent/guardian/counsel etc.). */\nexport const MAX_NCII_AUTHORITY_BASIS_LENGTH = 2000;\n\n/** Optional pointer/reference to authority evidence supplied by a representative. */\nexport const MAX_NCII_AUTHORITY_EVIDENCE_REF_LENGTH = 512;\n\n/** Maximum length for a feedback suggestion. */\nexport const MAX_FEEDBACK_SUGGESTION_LENGTH = 100;\n\n/** Maximum number of distinct submitters tracked per feedback suggestion. Mode-varied. */\nexport const MAX_FEEDBACK_SUBMITTERS = ACTIVE_LIMITS.batches.maxFeedbackSubmitters;\n\n/**\n * Canonical list of feedback types accepted by `submitFeedback`. Used both\n * for runtime validation in the schema (`SubmitFeedbackInputSchema`) and\n * for type-safe consumer props on the frontend `<FeedbackSubmission />`\n * component. Adding a new type here is the single source of truth — no\n * mirroring in callers required.\n */\nexport const FEEDBACK_TYPES = [\n 'tradeProfessionSuggestions',\n 'craftSkillTagSuggestions',\n 'talesWorkGenreSuggestions',\n 'tunesWorkGenreSuggestions',\n 'televisionWorkGenreSuggestions',\n] as const;\n\n/** Union of canonical feedback types. */\nexport type FeedbackType = (typeof FEEDBACK_TYPES)[number];\n\n/** Maximum number of items submitted in a single hallLibrary-review submission. Mode-varied. */\nexport const MAX_HALL_LIBRARY_SUBMIT_BATCH = ACTIVE_LIMITS.hall.maxSubmitBatch;\n\n// --- Admin Tasks ---\n\n/** Admin task lifecycle statuses. */\nexport const ADMIN_TASK_STATUS = {\n PENDING: 'pending',\n CHECKED_OUT: 'checkedOut',\n WORK_LATER: 'workLater',\n COMPLETED: 'completed',\n} as const;\n"]}
1
+ {"version":3,"file":"business-admin.js","sourceRoot":"","sources":["../../src/constants/business-admin.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,8DAA8D;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,qCAAqC;AAErC,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,QAAQ,EAAE,CAAC;IACX,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC;CACE,CAAC;AAIX,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,KAAK;CACA,CAAC;AAEX;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,GAAG;IACT,QAAQ,EAAE,IAAI;IACd;;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AAC,MAAM,iBAAiB,GAAG;IAC/B,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,YAAY;IACzB,UAAU,EAAE,WAAW;IACvB,SAAS,EAAE,WAAW;CACd,CAAC","sourcesContent":["// Admin + content-moderation business-rule constants — task priority, dispatches,\n// the moderation/feedback workflow, and admin-task lifecycle.\nimport { ACTIVE_LIMITS } from './app-mode.js';\n\n// --- Admin Task Priority System ---\n\nexport const TASK_PRIORITY = {\n CRITICAL: 4,\n HIGH: 3,\n NORMAL: 2,\n LOW: 1,\n} as const;\n\nexport type TaskPriorityLevel = (typeof TASK_PRIORITY)[keyof typeof TASK_PRIORITY];\n\nexport const TASK_PRIORITY_LABELS = {\n 4: 'CRITICAL',\n 3: 'HIGH',\n 2: 'NORMAL',\n 1: 'LOW',\n} as const;\n\n/**\n * Canonical NUMERIC priority scale for `adminTasks.priority`, shared by BOTH\n * priority systems so `checkoutNextImportantTask` (orderBy priority desc across all\n * task types) compares commensurable values. The userReport report-core score formula\n * already writes on this scale (≈40–2250); the level-based types (thresholdLibraryReview,\n * content-appeal, adminDispatch) map their TASK_PRIORITY level onto these numbers instead\n * of writing the raw 1–4.\n *\n * Resulting order: safety reports (1200–2250) > money anomalies (1100) >\n * CRITICAL (1000) > HIGH (800) > routine reports interleave below > spam-tier (~80).\n */\nexport const TASK_PRIORITY_SCORE = {\n LOW: 50,\n NORMAL: 200,\n HIGH: 800,\n CRITICAL: 1000,\n /** Money-integrity anomaly (stake-share / pledge-ledger corruption signal) — outranks\n * everything except safety-class reports. The three anomaly creators that previously\n * hardcoded `priority: 1` (LOW) all write this. */\n MONEY_ANOMALY: 1100,\n} as const;\n\nexport type TaskPriorityScore = (typeof TASK_PRIORITY_SCORE)[keyof typeof TASK_PRIORITY_SCORE];\n\n/** Maps a level-based TASK_PRIORITY value (1–4) to its canonical numeric score. */\nexport const TASK_PRIORITY_LEVEL_TO_SCORE = {\n [TASK_PRIORITY.LOW]: TASK_PRIORITY_SCORE.LOW,\n [TASK_PRIORITY.NORMAL]: TASK_PRIORITY_SCORE.NORMAL,\n [TASK_PRIORITY.HIGH]: TASK_PRIORITY_SCORE.HIGH,\n [TASK_PRIORITY.CRITICAL]: TASK_PRIORITY_SCORE.CRITICAL,\n} as const;\n\n// --- Admin Dispatches ---\n\n/** Maximum length for an admin-dispatch subject line. */\nexport const MAX_ADMIN_DISPATCH_SUBJECT_LENGTH = 100;\n\n/** Maximum length for the initial body text of an admin dispatch. */\nexport const MAX_ADMIN_DISPATCH_INITIAL_TEXT_LENGTH = 1000;\n\n// --- Content Moderation Workflow ---\n\n/** Maximum length for a content-violation appeal message. */\nexport const MAX_APPEAL_MESSAGE_LENGTH = 1000;\n\n/** Threshold-review reviewer notes (revision notes shown to the author). One owner for\n * the review callable schema AND the admin work-view input. */\nexport const MAX_THRESHOLD_REVIEW_NOTES_LENGTH = 2000;\n\n// --- Moderation / safety operator text caps ---\n// Each is declared ONCE here and derived by every input schema AND persisted doc schema\n// that carries the field — the numbers must never be re-hardcoded at an enforcement point.\n\n/** Operator-facing INTERNAL reason/rationale (LE-loggable; account actions, case reopens). */\nexport const MAX_INTERNAL_REASON_LENGTH = 2000;\n\n/** The generic owner-readable (user-facing) reason — deliberately short, no detail leaks. */\nexport const MAX_USER_FACING_REASON_LENGTH = 280;\n\n/** Structured close-out summary on report/safety-case resolutions. */\nexport const MAX_SAFETY_RESOLUTION_SUMMARY_LENGTH = 2000;\n\n/** Optional operator note attached to a close-out. */\nexport const MAX_SAFETY_ADMIN_NOTE_LENGTH = 4000;\n\n// --- Report intake text caps ---\n\n/** Reporter free-text narrative/comment (segregated private doc; never on the root). */\nexport const MAX_REPORT_NARRATIVE_LENGTH = 4000;\n\n/** The report DIALOG's comment field cap (the client-side compose bound — tighter than\n * the server narrative cap above, which also absorbs upgrade concatenations). */\nexport const MAX_REPORT_COMMENT_LENGTH = 1000;\n\n/** Minimum operator rationale/reason length on safety-console staged actions. */\nexport const MIN_SAFETY_RATIONALE_LENGTH = 10;\n\n/** Operator reason on an admin chat-moderation action (adminModerateChatMessage /\n * adminReadChannelContext). ONE owner for both callables' `reason` bound. */\nexport const MAX_CHAT_MODERATION_REASON_LENGTH = 1000;\n\n/** Broadcast explicitUids selector audience cap (schema + composer both derive). */\nexport const MAX_BROADCAST_EXPLICIT_UIDS = 2000;\n\n// --- Operator step-up sentinel error codes ---\n// The two backend HttpsError messages the operator TOTP step-up throws; the frontend\n// matches them to open the step-up dialog in ENROLL vs VERIFY mode. ONE declaration —\n// both the callable (functions operatorStepUp.ts) and the frontend hook import these.\nexport const STEP_UP_ENROLL_REQUIRED = 'OPERATOR_STEP_UP_ENROLL_REQUIRED';\nexport const STEP_UP_REQUIRED = 'OPERATOR_STEP_UP_REQUIRED';\n\n/** The frozen report-time captured text snapshot (edit-to-evade guard; NO PII). */\nexport const MAX_REPORT_SNAPSHOT_TEXT_LENGTH = 4000;\n\n// --- Admin console config-content text caps ---\n// Every number the system uses lives HERE — even a field only one surface consumes\n// today, because any future client (TV / phone / admin app) reads ttt-core.\n\nexport const MAX_FUTURE_PLAN_TITLE_LENGTH = 200;\nexport const MAX_FUTURE_PLAN_DESCRIPTION_LENGTH = 4000;\nexport const MAX_PLATFORM_RULE_TITLE_LENGTH = 200;\nexport const MAX_PLATFORM_RULE_DESCRIPTION_LENGTH = 4000;\nexport const MAX_AGREEMENT_POINT_LENGTH = 2000;\nexport const MAX_CONTENT_PAGE_HEADING_LENGTH = 300;\nexport const MAX_CONTENT_PAGE_BODY_LENGTH = 20000;\nexport const MAX_TAKE_IT_DOWN_COPY_LENGTH = 8000;\nexport const MAX_MAINTENANCE_MESSAGE_LENGTH = 2000;\n\n/** Announcement-banner copy on `_config/app.announcementMessage`. Deliberately far\n * shorter than the maintenance message: the announcement renders as a one-line banner\n * on the landing page and login screen, not a full-page takeover. */\nexport const MAX_ANNOUNCEMENT_MESSAGE_LENGTH = 300;\n\n/** Admin notes on a content-appeal review (reviewContentAppeal). */\nexport const MAX_APPEAL_REVIEW_NOTES_LENGTH = 2000;\n\n/** Admin reason on a Work/Realm forced-retitle remedy. */\nexport const MAX_REQUIRE_RETITLE_REASON_LENGTH = 500;\n\n/** Optional user-facing DETAIL text on a normal-report resolution. */\nexport const MAX_USER_FACING_REASON_DETAIL_LENGTH = 2000;\n\n/** Admin broadcast / user notification message body. */\nexport const MAX_NOTIFICATION_MESSAGE_LENGTH = 2000;\n\n/** Admin user-search query input. */\nexport const MAX_USER_SEARCH_QUERY_LENGTH = 100;\n\n// --- NCII / child-safety statutory + operator text caps ---\n\n/** Operator reason on the admin \"mark as NCII linked evidence\" intake. */\nexport const MAX_NCII_EVIDENCE_REASON_LENGTH = 1000;\n\n/** Operator written rationale on a TAKE IT DOWN validity decision (immutable row). */\nexport const MAX_NCII_RATIONALE_LENGTH = 4000;\n\n/** Requester's statement of nonconsent (statutory intake — in-app and no-login). */\nexport const MAX_NCII_NONCONSENT_STATEMENT_LENGTH = 4000;\n\n/** Typed-name electronic signature on a statutory request. */\nexport const MAX_NCII_SIGNED_NAME_LENGTH = 256;\n\n/** Requester's optional supporting facts (statutory intake). */\nexport const MAX_NCII_SUPPORTING_FACTS_LENGTH = 8000;\n\n/** Bounded, non-sensitive summary on an NCII request action row. */\nexport const MAX_NCII_ACTION_SUMMARY_LENGTH = 280;\n\n/** Operator description of a registered evidence artifact (e.g. portal screenshot). */\nexport const MAX_SAFETY_ARTIFACT_DESCRIPTION_LENGTH = 500;\n\n/** Operator proof note on a manual NCMEC portal filing. */\nexport const MAX_NCMEC_PORTAL_PROOF_TEXT_LENGTH = 2000;\n\n/** Requester's typed name on the no-login TAKE IT DOWN statutory intake. */\nexport const MAX_NCII_REQUESTER_NAME_LENGTH = 256;\n\n/** Name of the depicted person a representative files on behalf of. */\nexport const MAX_NCII_REPRESENTED_PERSON_NAME_LENGTH = 256;\n\n/** Representative's stated basis of authority (parent/guardian/counsel etc.). */\nexport const MAX_NCII_AUTHORITY_BASIS_LENGTH = 2000;\n\n/** Optional pointer/reference to authority evidence supplied by a representative. */\nexport const MAX_NCII_AUTHORITY_EVIDENCE_REF_LENGTH = 512;\n\n/** Maximum length for a feedback suggestion. */\nexport const MAX_FEEDBACK_SUGGESTION_LENGTH = 100;\n\n/** Maximum number of distinct submitters tracked per feedback suggestion. Mode-varied. */\nexport const MAX_FEEDBACK_SUBMITTERS = ACTIVE_LIMITS.batches.maxFeedbackSubmitters;\n\n/**\n * Canonical list of feedback types accepted by `submitFeedback`. Used both\n * for runtime validation in the schema (`SubmitFeedbackInputSchema`) and\n * for type-safe consumer props on the frontend `<FeedbackSubmission />`\n * component. Adding a new type here is the single source of truth — no\n * mirroring in callers required.\n */\nexport const FEEDBACK_TYPES = [\n 'tradeProfessionSuggestions',\n 'craftSkillTagSuggestions',\n 'talesWorkGenreSuggestions',\n 'tunesWorkGenreSuggestions',\n 'televisionWorkGenreSuggestions',\n] as const;\n\n/** Union of canonical feedback types. */\nexport type FeedbackType = (typeof FEEDBACK_TYPES)[number];\n\n/** Maximum number of items submitted in a single hallLibrary-review submission. Mode-varied. */\nexport const MAX_HALL_LIBRARY_SUBMIT_BATCH = ACTIVE_LIMITS.hall.maxSubmitBatch;\n\n// --- Admin Tasks ---\n\n/** Admin task lifecycle statuses. */\nexport const ADMIN_TASK_STATUS = {\n PENDING: 'pending',\n CHECKED_OUT: 'checkedOut',\n WORK_LATER: 'workLater',\n COMPLETED: 'completed',\n} as const;\n"]}
@@ -4,6 +4,9 @@ export declare const WORD_LIST_CACHE_TTL_MS: number;
4
4
  export declare const PENDING_MEDIA_ARCHIVE_AFTER_DAYS = 7;
5
5
  /** Per-run cap on docs archived by the archivePendingMedia scheduled commission. */
6
6
  export declare const PENDING_MEDIA_ARCHIVE_BATCH_SIZE = 500;
7
+ /** Days a moderation-rejected upload's quarantined bytes are retained before the
8
+ * hold-aware sweep deletes them. */
9
+ export declare const REJECTED_MEDIA_RETENTION_DAYS = 90;
7
10
  /** TTL in hours after which an orphan storage upload becomes eligible for deletion. */
8
11
  export declare const ORPHAN_UPLOAD_TTL_HOURS = 24;
9
12
  /** Per-run cap on orphan storage deletions. */
@@ -1 +1 @@
1
- {"version":3,"file":"retention.d.ts","sourceRoot":"","sources":["../../src/constants/retention.ts"],"names":[],"mappings":"AAIA,gEAAgE;AAChE,eAAO,MAAM,sBAAsB,QAAiB,CAAC;AAIrD,oFAAoF;AACpF,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAElD,oFAAoF;AACpF,eAAO,MAAM,gCAAgC,MAAM,CAAC;AAIpD,uFAAuF;AACvF,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,+CAA+C;AAC/C,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,4CAA4C;AAC5C,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAIjD,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,QAAsB,CAAC;AAItD,+DAA+D;AAC/D,eAAO,MAAM,0BAA0B,QAAiB,CAAC;AAEzD,wDAAwD;AACxD,eAAO,MAAM,uBAAuB,QAAiB,CAAC"}
1
+ {"version":3,"file":"retention.d.ts","sourceRoot":"","sources":["../../src/constants/retention.ts"],"names":[],"mappings":"AAIA,gEAAgE;AAChE,eAAO,MAAM,sBAAsB,QAAiB,CAAC;AAIrD,oFAAoF;AACpF,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAElD,oFAAoF;AACpF,eAAO,MAAM,gCAAgC,MAAM,CAAC;AAWpD;qCACqC;AACrC,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAIhD,uFAAuF;AACvF,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,+CAA+C;AAC/C,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,4CAA4C;AAC5C,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAIjD,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,QAAsB,CAAC;AAItD,+DAA+D;AAC/D,eAAO,MAAM,0BAA0B,QAAiB,CAAC;AAEzD,wDAAwD;AACxD,eAAO,MAAM,uBAAuB,QAAiB,CAAC"}
@@ -7,6 +7,17 @@ export const WORD_LIST_CACHE_TTL_MS = 1000 * 60 * 60;
7
7
  export const PENDING_MEDIA_ARCHIVE_AFTER_DAYS = 7;
8
8
  /** Per-run cap on docs archived by the archivePendingMedia scheduled commission. */
9
9
  export const PENDING_MEDIA_ARCHIVE_BATCH_SIZE = 500;
10
+ // --- Rejected (moderation-quarantined) media retention ---
11
+ // Bytes a moderation decision rejected are kept at `rejected/{userId}/…` as APPEAL EVIDENCE
12
+ // (the violation's `rejectedFilePath`; owner + admin readable, never served through the media
13
+ // gateway). They are not kept forever: after this window the hold-aware fail-closed sweep
14
+ // deletes them. Fail-closed means a file it cannot prove is out of window — or that carries an
15
+ // active Trust & Safety / legal hold — is LEFT IN PLACE, never deleted on a best guess.
16
+ // 90 days sits comfortably past the appeal window while bounding indefinite retention of
17
+ // often-adult rejected content. See ttt-prod docs/design/content-moderation-and-reporting.md.
18
+ /** Days a moderation-rejected upload's quarantined bytes are retained before the
19
+ * hold-aware sweep deletes them. */
20
+ export const REJECTED_MEDIA_RETENTION_DAYS = 90;
10
21
  // --- Orphan upload cleanup ---
11
22
  /** TTL in hours after which an orphan storage upload becomes eligible for deletion. */
12
23
  export const ORPHAN_UPLOAD_TTL_HOURS = 24;
@@ -1 +1 @@
1
- {"version":3,"file":"retention.js","sourceRoot":"","sources":["../../src/constants/retention.ts"],"names":[],"mappings":"AAAA,sDAAsD;AAEtD,oCAAoC;AAEpC,gEAAgE;AAChE,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC;AAErD,gCAAgC;AAEhC,oFAAoF;AACpF,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAElD,oFAAoF;AACpF,MAAM,CAAC,MAAM,gCAAgC,GAAG,GAAG,CAAC;AAEpD,gCAAgC;AAEhC,uFAAuF;AACvF,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAE1C,+CAA+C;AAC/C,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAE5C,4CAA4C;AAC5C,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAEjD,8CAA8C;AAE9C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEtD,yCAAyC;AAEzC,+DAA+D;AAC/D,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEzD,wDAAwD;AACxD,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC","sourcesContent":["// Caching, retention, and cleanup TTLs / batch sizes.\n\n// --- Profanity word list cache ---\n\n/** TTL for the in-memory profanity word list cache (1 hour). */\nexport const WORD_LIST_CACHE_TTL_MS = 1000 * 60 * 60;\n\n// --- Pending media archive ---\n\n/** Days after which a terminal pendingMedia doc is moved to pendingMediaArchive. */\nexport const PENDING_MEDIA_ARCHIVE_AFTER_DAYS = 7;\n\n/** Per-run cap on docs archived by the archivePendingMedia scheduled commission. */\nexport const PENDING_MEDIA_ARCHIVE_BATCH_SIZE = 500;\n\n// --- Orphan upload cleanup ---\n\n/** TTL in hours after which an orphan storage upload becomes eligible for deletion. */\nexport const ORPHAN_UPLOAD_TTL_HOURS = 24;\n\n/** Per-run cap on orphan storage deletions. */\nexport const ORPHAN_UPLOAD_DELETE_CAP = 500;\n\n/** Page size for listing orphan uploads. */\nexport const ORPHAN_UPLOAD_LIST_PAGE_SIZE = 1000;\n\n// --- Frontend in-flight upload listeners ---\n\n/** Maximum lookback window for the in-flight upload listener (24 hours). */\nexport const LISTENER_WINDOW_MS = 24 * 60 * 60 * 1000;\n\n// --- Public users React Query cache ---\n\n/** Stale time for the publicUsers query cache (30 minutes). */\nexport const PUBLIC_USERS_STALE_TIME_MS = 30 * 60 * 1000;\n\n/** GC time for the publicUsers query cache (1 hour). */\nexport const PUBLIC_USERS_GC_TIME_MS = 60 * 60 * 1000;\n\n"]}
1
+ {"version":3,"file":"retention.js","sourceRoot":"","sources":["../../src/constants/retention.ts"],"names":[],"mappings":"AAAA,sDAAsD;AAEtD,oCAAoC;AAEpC,gEAAgE;AAChE,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC;AAErD,gCAAgC;AAEhC,oFAAoF;AACpF,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAElD,oFAAoF;AACpF,MAAM,CAAC,MAAM,gCAAgC,GAAG,GAAG,CAAC;AAEpD,4DAA4D;AAC5D,4FAA4F;AAC5F,8FAA8F;AAC9F,0FAA0F;AAC1F,+FAA+F;AAC/F,wFAAwF;AACxF,yFAAyF;AACzF,8FAA8F;AAE9F;qCACqC;AACrC,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAEhD,gCAAgC;AAEhC,uFAAuF;AACvF,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAE1C,+CAA+C;AAC/C,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAE5C,4CAA4C;AAC5C,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAEjD,8CAA8C;AAE9C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEtD,yCAAyC;AAEzC,+DAA+D;AAC/D,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEzD,wDAAwD;AACxD,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC","sourcesContent":["// Caching, retention, and cleanup TTLs / batch sizes.\n\n// --- Profanity word list cache ---\n\n/** TTL for the in-memory profanity word list cache (1 hour). */\nexport const WORD_LIST_CACHE_TTL_MS = 1000 * 60 * 60;\n\n// --- Pending media archive ---\n\n/** Days after which a terminal pendingMedia doc is moved to pendingMediaArchive. */\nexport const PENDING_MEDIA_ARCHIVE_AFTER_DAYS = 7;\n\n/** Per-run cap on docs archived by the archivePendingMedia scheduled commission. */\nexport const PENDING_MEDIA_ARCHIVE_BATCH_SIZE = 500;\n\n// --- Rejected (moderation-quarantined) media retention ---\n// Bytes a moderation decision rejected are kept at `rejected/{userId}/…` as APPEAL EVIDENCE\n// (the violation's `rejectedFilePath`; owner + admin readable, never served through the media\n// gateway). They are not kept forever: after this window the hold-aware fail-closed sweep\n// deletes them. Fail-closed means a file it cannot prove is out of window — or that carries an\n// active Trust & Safety / legal hold — is LEFT IN PLACE, never deleted on a best guess.\n// 90 days sits comfortably past the appeal window while bounding indefinite retention of\n// often-adult rejected content. See ttt-prod docs/design/content-moderation-and-reporting.md.\n\n/** Days a moderation-rejected upload's quarantined bytes are retained before the\n * hold-aware sweep deletes them. */\nexport const REJECTED_MEDIA_RETENTION_DAYS = 90;\n\n// --- Orphan upload cleanup ---\n\n/** TTL in hours after which an orphan storage upload becomes eligible for deletion. */\nexport const ORPHAN_UPLOAD_TTL_HOURS = 24;\n\n/** Per-run cap on orphan storage deletions. */\nexport const ORPHAN_UPLOAD_DELETE_CAP = 500;\n\n/** Page size for listing orphan uploads. */\nexport const ORPHAN_UPLOAD_LIST_PAGE_SIZE = 1000;\n\n// --- Frontend in-flight upload listeners ---\n\n/** Maximum lookback window for the in-flight upload listener (24 hours). */\nexport const LISTENER_WINDOW_MS = 24 * 60 * 60 * 1000;\n\n// --- Public users React Query cache ---\n\n/** Stale time for the publicUsers query cache (30 minutes). */\nexport const PUBLIC_USERS_STALE_TIME_MS = 30 * 60 * 1000;\n\n/** GC time for the publicUsers query cache (1 hour). */\nexport const PUBLIC_USERS_GC_TIME_MS = 60 * 60 * 1000;\n\n"]}
@@ -30,6 +30,11 @@ export declare const TEXT_SIZE_STORAGE_KEY = "ttt-text-size";
30
30
  /** Same-tab window event dispatched when TEXT_SIZE_STORAGE_KEY changes (localStorage
31
31
  * 'storage' events do not fire in the writing tab), mirroring REDUCED_MOTION_CHANGE_EVENT. */
32
32
  export declare const TEXT_SIZE_CHANGE_EVENT = "ttt-text-size-change";
33
+ /** localStorage key — and the matching first-party cookie name — holding the visitor's
34
+ * cookie/analytics consent choice. The underscore spelling is byte-stable for backward
35
+ * compatibility with already-stored values and MUST NOT be re-styled to match the
36
+ * hyphenated House-control keys above. */
37
+ export declare const COOKIE_CONSENT_STORAGE_KEY = "ttt_cookie_consent";
33
38
  /** localStorage key holding the caller's single unconfirmed site-tour choice. Scoped by the
34
39
  * AUTHENTICATED uid — never a browser-global key. */
35
40
  export declare function siteTourPendingStorageKey(uid: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"storage-keys.d.ts","sourceRoot":"","sources":["../../src/constants/storage-keys.ts"],"names":[],"mappings":"AAEA,4FAA4F;AAC5F,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,2FAA2F;AAC3F,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,uFAAuF;AACvF,eAAO,MAAM,uBAAuB,iCAAiC,CAAC;AAMtE,qFAAqF;AACrF,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,qFAAqF;AACrF,eAAO,MAAM,yBAAyB,oBAAoB,CAAC;AAE3D;uCACuC;AACvC,eAAO,MAAM,6BAA6B,wBAAwB,CAAC;AAEnE;sEACsE;AACtE,eAAO,MAAM,0BAA0B,yBAAyB,CAAC;AAEjE,2EAA2E;AAC3E,eAAO,MAAM,sBAAsB,iCAAiC,CAAC;AAErE;0CAC0C;AAC1C,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAS/D;8EAC8E;AAC9E,eAAO,MAAM,0BAA0B,uBAAuB,CAAC;AAE/D;0FAC0F;AAC1F,eAAO,MAAM,2BAA2B,8BAA8B,CAAC;AAQvE,yFAAyF;AACzF,eA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C,CAAC"}
@@ -45,6 +45,17 @@ export const TEXT_SIZE_STORAGE_KEY = 'ttt-text-size';
45
45
  /** Same-tab window event dispatched when TEXT_SIZE_STORAGE_KEY changes (localStorage
46
46
  * 'storage' events do not fire in the writing tab), mirroring REDUCED_MOTION_CHANGE_EVENT. */
47
47
  export const TEXT_SIZE_CHANGE_EVENT = 'ttt-text-size-change';
48
+ // --- GDPR cookie / analytics consent (device-local) ---
49
+ // Device-local like the House controls above — consent is a per-device choice, never mirrored
50
+ // to Firestore or the private user document. The app persists the same value in BOTH
51
+ // localStorage (under this key) and a first-party cookie of the SAME name, so SSR/middleware can
52
+ // read it; both derive from this one declaration. Values are the ConsentState strings
53
+ // ('granted' | 'denied'); ABSENT means un-chosen (opt-in default, analytics OFF).
54
+ /** localStorage key — and the matching first-party cookie name — holding the visitor's
55
+ * cookie/analytics consent choice. The underscore spelling is byte-stable for backward
56
+ * compatibility with already-stored values and MUST NOT be re-styled to match the
57
+ * hyphenated House-control keys above. */
58
+ export const COOKIE_CONSENT_STORAGE_KEY = 'ttt_cookie_consent';
48
59
  // --- First-visit site-tour pending preference (the ONE sanctioned optimistic-hide slot) ---
49
60
  // Unlike the House controls above, site-tour state is ACCOUNT-DURABLE: `privateData/{uid}.siteTour`
50
61
  // stays the sole authority and the `updateSiteTourPreference` callable stays its sole writer. This
@@ -1 +1 @@
1
- {"version":3,"file":"storage-keys.js","sourceRoot":"","sources":["../../src/constants/storage-keys.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAEjE,4FAA4F;AAC5F,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAEhD,2FAA2F;AAC3F,MAAM,CAAC,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAEhD,uFAAuF;AACvF,MAAM,CAAC,MAAM,uBAAuB,GAAG,8BAA8B,CAAC;AAEtE,uEAAuE;AACvE,4EAA4E;AAC5E,0DAA0D;AAE1D,qFAAqF;AACrF,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAE7D,qFAAqF;AACrF,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAE3D;uCACuC;AACvC,MAAM,CAAC,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;AAEnE;sEACsE;AACtE,MAAM,CAAC,MAAM,0BAA0B,GAAG,sBAAsB,CAAC;AAEjE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,sBAAsB,GAAG,8BAA8B,CAAC;AAErE;0CAC0C;AAC1C,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAE/D,6DAA6D;AAC7D,yFAAyF;AACzF,0FAA0F;AAC1F,wFAAwF;AACxF,2FAA2F;AAC3F,8DAA8D;AAE9D;8EAC8E;AAC9E,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAE/D;0FAC0F;AAC1F,MAAM,CAAC,MAAM,2BAA2B,GAAG,2BAA2B,CAAC;AAEvE,kDAAkD;AAClD,mFAAmF;AACnF,+FAA+F;AAC/F,+FAA+F;AAC/F,uEAAuE;AAEvE,yFAAyF;AACzF,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAErD;+FAC+F;AAC/F,MAAM,CAAC,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;AAE7D,6FAA6F;AAC7F,oGAAoG;AACpG,mGAAmG;AACnG,+FAA+F;AAC/F,mGAAmG;AACnG,oGAAoG;AACpG,oGAAoG;AACpG,EAAE;AACF,iGAAiG;AACjG,+FAA+F;AAC/F,mGAAmG;AACnG,yDAAyD;AAEzD;sDACsD;AACtD,MAAM,UAAU,yBAAyB,CAAC,GAAW;IACnD,OAAO,yBAAyB,GAAG,EAAE,CAAC;AACxC,CAAC;AAED;;4FAE4F;AAC5F,MAAM,CAAC,MAAM,8BAA8B,GAAG,8BAA8B,CAAC","sourcesContent":["// Well-known keys used in browser sessionStorage / localStorage.\n\n/** sessionStorage key holding the path the user wanted before being redirected to login. */\nexport const REDIRECT_PATH_KEY = 'redirectPath';\n\n/** localStorage key holding the last-seen app version (used by version-gate component). */\nexport const LS_VERSION_KEY = 'ttt-app-version';\n\n/** sessionStorage key marking that a version-mismatch reload was already attempted. */\nexport const SS_RELOAD_ATTEMPTED_KEY = 'ttt-version-reload-attempted';\n\n// --- Company / Green Room dock companion (device-local v1 stores) ---\n// Values are byte-stable for backward compatibility — the historical 'bill'\n// naming predates the Company rename and MUST NOT change.\n\n/** localStorage key holding the user's chosen dock companion id ('bill' | 'kit'). */\nexport const COMPANION_STORAGE_KEY = 'ttt-company-companion';\n\n/** localStorage key: 'true' when the user has hidden the dock companion entirely. */\nexport const MASCOT_HIDDEN_STORAGE_KEY = 'ttt-bill-hidden';\n\n/** localStorage key holding the last-shown dock-bubble line index (avoids an\n * immediate repeat across visits). */\nexport const MASCOT_LINE_INDEX_STORAGE_KEY = 'ttt-bill-line-index';\n\n/** Same-tab window event dispatched when MASCOT_HIDDEN_STORAGE_KEY changes\n * (localStorage 'storage' events do not fire in the writing tab). */\nexport const MASCOT_HIDDEN_CHANGE_EVENT = 'ttt-bill-pref-change';\n\n/** Same-tab window event dispatched when COMPANION_STORAGE_KEY changes. */\nexport const COMPANION_CHANGE_EVENT = 'ttt-company-companion-change';\n\n/** Same-tab window event dispatched when the transient dock-puppet pose changes\n * (in-memory store; never persisted). */\nexport const MASCOT_POSE_CHANGE_EVENT = 'ttt-bill-pose-change';\n\n// --- Manual reduced-motion House control (device-local) ---\n// Independent of the companion visibility store above: reducing motion does not hide the\n// companion, and hiding the companion does not change motion. Effective reduced motion is\n// (the device's prefers-reduced-motion request) OR (this manual preference); the device\n// request always wins. Device-local BY DESIGN — never mirrored to Firestore or the private\n// user document (unlike the account-durable site-tour state).\n\n/** localStorage key: 'true' when the member has manually enabled TTT's app-wide\n * reduced-motion preference (the \"Motion: Full / Reduced\" House control). */\nexport const REDUCED_MOTION_STORAGE_KEY = 'ttt-reduced-motion';\n\n/** Same-tab window event dispatched when REDUCED_MOTION_STORAGE_KEY changes (localStorage\n * 'storage' events do not fire in the writing tab), mirroring COMPANION_CHANGE_EVENT. */\nexport const REDUCED_MOTION_CHANGE_EVENT = 'ttt-reduced-motion-change';\n\n// --- Large-text House control (device-local) ---\n// The root font-size scale behind the House \"Text size\" control. Same device-local\n// useSyncExternalStore shape as the reduced-motion control above — never mirrored to Firestore\n// or the private user document. The <html> CSS hook it applies stays app-side next to the rule\n// that defines it (as the reduced-motion store's root attribute does).\n\n/** localStorage key holding the member's text-size preference ('standard' | 'large'). */\nexport const TEXT_SIZE_STORAGE_KEY = 'ttt-text-size';\n\n/** Same-tab window event dispatched when TEXT_SIZE_STORAGE_KEY changes (localStorage\n * 'storage' events do not fire in the writing tab), mirroring REDUCED_MOTION_CHANGE_EVENT. */\nexport const TEXT_SIZE_CHANGE_EVENT = 'ttt-text-size-change';\n\n// --- First-visit site-tour pending preference (the ONE sanctioned optimistic-hide slot) ---\n// Unlike the House controls above, site-tour state is ACCOUNT-DURABLE: `privateData/{uid}.siteTour`\n// stays the sole authority and the `updateSiteTourPreference` callable stays its sole writer. This\n// key holds a SINGLE uid-scoped entry recording a choice the member has already made but whose\n// server write has not been confirmed yet, so the overlay can close instantly and the write can be\n// replayed on the next boot. It is a one-entry durable retry SLOT, never a cache, mirror, or second\n// source of eligibility — a member with no pending entry is evaluated purely from the server state.\n//\n// UID-SCOPED BY CONSTRUCTION: a browser-global key would let user A's choice suppress (or replay\n// into) the tour for user B after a sign-out/sign-in on the same device. The stored entry ALSO\n// carries its own `uid` (SiteTourPendingPreferenceSchema, schemas/users.ts) and must match the key\n// owner before it may affect eligibility or be replayed.\n\n/** localStorage key holding the caller's single unconfirmed site-tour choice. Scoped by the\n * AUTHENTICATED uid — never a browser-global key. */\nexport function siteTourPendingStorageKey(uid: string): string {\n return `ttt-site-tour-pending:${uid}`;\n}\n\n/** Same-tab window event dispatched when a `siteTourPendingStorageKey(uid)` entry is written or\n * removed (localStorage 'storage' events do not fire in the writing tab), mirroring\n * TEXT_SIZE_CHANGE_EVENT. Cross-tab propagation still rides the native 'storage' event. */\nexport const SITE_TOUR_PENDING_CHANGE_EVENT = 'ttt-site-tour-pending-change';\n"]}
1
+ {"version":3,"file":"storage-keys.js","sourceRoot":"","sources":["../../src/constants/storage-keys.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAEjE,4FAA4F;AAC5F,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAEhD,2FAA2F;AAC3F,MAAM,CAAC,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAEhD,uFAAuF;AACvF,MAAM,CAAC,MAAM,uBAAuB,GAAG,8BAA8B,CAAC;AAEtE,uEAAuE;AACvE,4EAA4E;AAC5E,0DAA0D;AAE1D,qFAAqF;AACrF,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAE7D,qFAAqF;AACrF,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAE3D;uCACuC;AACvC,MAAM,CAAC,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;AAEnE;sEACsE;AACtE,MAAM,CAAC,MAAM,0BAA0B,GAAG,sBAAsB,CAAC;AAEjE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,sBAAsB,GAAG,8BAA8B,CAAC;AAErE;0CAC0C;AAC1C,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAE/D,6DAA6D;AAC7D,yFAAyF;AACzF,0FAA0F;AAC1F,wFAAwF;AACxF,2FAA2F;AAC3F,8DAA8D;AAE9D;8EAC8E;AAC9E,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAE/D;0FAC0F;AAC1F,MAAM,CAAC,MAAM,2BAA2B,GAAG,2BAA2B,CAAC;AAEvE,kDAAkD;AAClD,mFAAmF;AACnF,+FAA+F;AAC/F,+FAA+F;AAC/F,uEAAuE;AAEvE,yFAAyF;AACzF,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAErD;+FAC+F;AAC/F,MAAM,CAAC,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;AAE7D,yDAAyD;AACzD,8FAA8F;AAC9F,qFAAqF;AACrF,iGAAiG;AACjG,sFAAsF;AACtF,kFAAkF;AAElF;;;2CAG2C;AAC3C,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAE/D,6FAA6F;AAC7F,oGAAoG;AACpG,mGAAmG;AACnG,+FAA+F;AAC/F,mGAAmG;AACnG,oGAAoG;AACpG,oGAAoG;AACpG,EAAE;AACF,iGAAiG;AACjG,+FAA+F;AAC/F,mGAAmG;AACnG,yDAAyD;AAEzD;sDACsD;AACtD,MAAM,UAAU,yBAAyB,CAAC,GAAW;IACnD,OAAO,yBAAyB,GAAG,EAAE,CAAC;AACxC,CAAC;AAED;;4FAE4F;AAC5F,MAAM,CAAC,MAAM,8BAA8B,GAAG,8BAA8B,CAAC","sourcesContent":["// Well-known keys used in browser sessionStorage / localStorage.\n\n/** sessionStorage key holding the path the user wanted before being redirected to login. */\nexport const REDIRECT_PATH_KEY = 'redirectPath';\n\n/** localStorage key holding the last-seen app version (used by version-gate component). */\nexport const LS_VERSION_KEY = 'ttt-app-version';\n\n/** sessionStorage key marking that a version-mismatch reload was already attempted. */\nexport const SS_RELOAD_ATTEMPTED_KEY = 'ttt-version-reload-attempted';\n\n// --- Company / Green Room dock companion (device-local v1 stores) ---\n// Values are byte-stable for backward compatibility — the historical 'bill'\n// naming predates the Company rename and MUST NOT change.\n\n/** localStorage key holding the user's chosen dock companion id ('bill' | 'kit'). */\nexport const COMPANION_STORAGE_KEY = 'ttt-company-companion';\n\n/** localStorage key: 'true' when the user has hidden the dock companion entirely. */\nexport const MASCOT_HIDDEN_STORAGE_KEY = 'ttt-bill-hidden';\n\n/** localStorage key holding the last-shown dock-bubble line index (avoids an\n * immediate repeat across visits). */\nexport const MASCOT_LINE_INDEX_STORAGE_KEY = 'ttt-bill-line-index';\n\n/** Same-tab window event dispatched when MASCOT_HIDDEN_STORAGE_KEY changes\n * (localStorage 'storage' events do not fire in the writing tab). */\nexport const MASCOT_HIDDEN_CHANGE_EVENT = 'ttt-bill-pref-change';\n\n/** Same-tab window event dispatched when COMPANION_STORAGE_KEY changes. */\nexport const COMPANION_CHANGE_EVENT = 'ttt-company-companion-change';\n\n/** Same-tab window event dispatched when the transient dock-puppet pose changes\n * (in-memory store; never persisted). */\nexport const MASCOT_POSE_CHANGE_EVENT = 'ttt-bill-pose-change';\n\n// --- Manual reduced-motion House control (device-local) ---\n// Independent of the companion visibility store above: reducing motion does not hide the\n// companion, and hiding the companion does not change motion. Effective reduced motion is\n// (the device's prefers-reduced-motion request) OR (this manual preference); the device\n// request always wins. Device-local BY DESIGN — never mirrored to Firestore or the private\n// user document (unlike the account-durable site-tour state).\n\n/** localStorage key: 'true' when the member has manually enabled TTT's app-wide\n * reduced-motion preference (the \"Motion: Full / Reduced\" House control). */\nexport const REDUCED_MOTION_STORAGE_KEY = 'ttt-reduced-motion';\n\n/** Same-tab window event dispatched when REDUCED_MOTION_STORAGE_KEY changes (localStorage\n * 'storage' events do not fire in the writing tab), mirroring COMPANION_CHANGE_EVENT. */\nexport const REDUCED_MOTION_CHANGE_EVENT = 'ttt-reduced-motion-change';\n\n// --- Large-text House control (device-local) ---\n// The root font-size scale behind the House \"Text size\" control. Same device-local\n// useSyncExternalStore shape as the reduced-motion control above — never mirrored to Firestore\n// or the private user document. The <html> CSS hook it applies stays app-side next to the rule\n// that defines it (as the reduced-motion store's root attribute does).\n\n/** localStorage key holding the member's text-size preference ('standard' | 'large'). */\nexport const TEXT_SIZE_STORAGE_KEY = 'ttt-text-size';\n\n/** Same-tab window event dispatched when TEXT_SIZE_STORAGE_KEY changes (localStorage\n * 'storage' events do not fire in the writing tab), mirroring REDUCED_MOTION_CHANGE_EVENT. */\nexport const TEXT_SIZE_CHANGE_EVENT = 'ttt-text-size-change';\n\n// --- GDPR cookie / analytics consent (device-local) ---\n// Device-local like the House controls above — consent is a per-device choice, never mirrored\n// to Firestore or the private user document. The app persists the same value in BOTH\n// localStorage (under this key) and a first-party cookie of the SAME name, so SSR/middleware can\n// read it; both derive from this one declaration. Values are the ConsentState strings\n// ('granted' | 'denied'); ABSENT means un-chosen (opt-in default, analytics OFF).\n\n/** localStorage key — and the matching first-party cookie name — holding the visitor's\n * cookie/analytics consent choice. The underscore spelling is byte-stable for backward\n * compatibility with already-stored values and MUST NOT be re-styled to match the\n * hyphenated House-control keys above. */\nexport const COOKIE_CONSENT_STORAGE_KEY = 'ttt_cookie_consent';\n\n// --- First-visit site-tour pending preference (the ONE sanctioned optimistic-hide slot) ---\n// Unlike the House controls above, site-tour state is ACCOUNT-DURABLE: `privateData/{uid}.siteTour`\n// stays the sole authority and the `updateSiteTourPreference` callable stays its sole writer. This\n// key holds a SINGLE uid-scoped entry recording a choice the member has already made but whose\n// server write has not been confirmed yet, so the overlay can close instantly and the write can be\n// replayed on the next boot. It is a one-entry durable retry SLOT, never a cache, mirror, or second\n// source of eligibility — a member with no pending entry is evaluated purely from the server state.\n//\n// UID-SCOPED BY CONSTRUCTION: a browser-global key would let user A's choice suppress (or replay\n// into) the tour for user B after a sign-out/sign-in on the same device. The stored entry ALSO\n// carries its own `uid` (SiteTourPendingPreferenceSchema, schemas/users.ts) and must match the key\n// owner before it may affect eligibility or be replayed.\n\n/** localStorage key holding the caller's single unconfirmed site-tour choice. Scoped by the\n * AUTHENTICATED uid — never a browser-global key. */\nexport function siteTourPendingStorageKey(uid: string): string {\n return `ttt-site-tour-pending:${uid}`;\n}\n\n/** Same-tab window event dispatched when a `siteTourPendingStorageKey(uid)` entry is written or\n * removed (localStorage 'storage' events do not fire in the writing tab), mirroring\n * TEXT_SIZE_CHANGE_EVENT. Cross-tab propagation still rides the native 'storage' event. */\nexport const SITE_TOUR_PENDING_CHANGE_EVENT = 'ttt-site-tour-pending-change';\n"]}
@@ -9,7 +9,7 @@ export declare const TTTAuditEventSchema: z.ZodObject<{
9
9
  actorMode: z.ZodEnum<{
10
10
  user: "user";
11
11
  system: "system";
12
- projectMember: "projectMember";
12
+ guildmateUser: "guildmateUser";
13
13
  }>;
14
14
  }, z.core.$strip>, z.ZodObject<{
15
15
  uid: z.ZodNullable<z.ZodString>;
@@ -8,7 +8,7 @@ const TTTAuditActorSchema = z.discriminatedUnion('actorMode', [
8
8
  z.object({
9
9
  uid: z.string().nullable(),
10
10
  isAdmin: z.boolean(),
11
- actorMode: z.enum(['user', 'projectMember', 'system']),
11
+ actorMode: z.enum(['user', 'guildmateUser', 'system']),
12
12
  }),
13
13
  z.object({
14
14
  uid: z.string().nullable(),
@@ -1 +1 @@
1
- {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/doc-schemas/audit.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,yFAAyF;AACzF,oFAAoF;AACpF,qFAAqF;AACrF,mFAAmF;AAEnF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,mBAAmB,GAAG,CAAC,CAAC,kBAAkB,CAAC,WAAW,EAAE;IAC5D,CAAC,CAAC,MAAM,CAAC;QACP,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC1B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;QACpB,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;KACvD,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC1B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;QACpB,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;QACnD,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;KACzC,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,KAAK,EAAE,mBAAmB,CAAC,QAAQ,EAAE;IACrC,MAAM,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IACvC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IAC3C,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACtC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC","sourcesContent":["// Registry schema for auditEvents/{eventId}. Mirrors the structural shape of\n// TTTAuditEvent in ../types/audit.ts — which stays the canonical TYPE because it encodes\n// compiler-enforced actor/role rules (systemRole required on admin modes, forbidden\n// otherwise) that Zod can't express. `type` is validated as a string here; the exact\n// ~80-value AuditEventType union remains the source of truth in ../types/audit.ts.\n\nimport { z } from 'zod';\n\nconst TTTAuditActorSchema = z.discriminatedUnion('actorMode', [\n z.object({\n uid: z.string().nullable(),\n isAdmin: z.boolean(),\n actorMode: z.enum(['user', 'projectMember', 'system']),\n }),\n z.object({\n uid: z.string().nullable(),\n isAdmin: z.boolean(),\n actorMode: z.enum(['adminReview', 'adminOverride']),\n systemRole: z.enum(['admin', 'jrAdmin']),\n }),\n]);\n\nconst TTTAuditTargetSchema = z.object({\n uid: z.string().nullable(),\n ref: z.string().nullable(),\n});\n\nexport const TTTAuditEventSchema = z.object({\n id: z.string(),\n type: z.string(),\n schemaVersion: z.number(),\n actor: TTTAuditActorSchema.nullable(),\n target: TTTAuditTargetSchema.nullable(),\n timestamp: z.number(),\n ip: z.string().nullable(),\n userAgent: z.string().nullable(),\n region: z.string().nullable(),\n metadata: z.record(z.string(), z.unknown()),\n result: z.enum(['success', 'failure']),\n failureReason: z.string().nullable(),\n correlationId: z.string().nullable(),\n});\n"]}
1
+ {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/doc-schemas/audit.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,yFAAyF;AACzF,oFAAoF;AACpF,qFAAqF;AACrF,mFAAmF;AAEnF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,mBAAmB,GAAG,CAAC,CAAC,kBAAkB,CAAC,WAAW,EAAE;IAC5D,CAAC,CAAC,MAAM,CAAC;QACP,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC1B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;QACpB,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;KACvD,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC1B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;QACpB,S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Id}. Mirrors the structural shape of\n// TTTAuditEvent in ../types/audit.ts — which stays the canonical TYPE because it encodes\n// compiler-enforced actor/role rules (systemRole required on admin modes, forbidden\n// otherwise) that Zod can't express. `type` is validated as a string here; the exact\n// ~80-value AuditEventType union remains the source of truth in ../types/audit.ts.\n\nimport { z } from 'zod';\n\nconst TTTAuditActorSchema = z.discriminatedUnion('actorMode', [\n z.object({\n uid: z.string().nullable(),\n isAdmin: z.boolean(),\n actorMode: z.enum(['user', 'guildmateUser', 'system']),\n }),\n z.object({\n uid: z.string().nullable(),\n isAdmin: z.boolean(),\n actorMode: z.enum(['adminReview', 'adminOverride']),\n systemRole: z.enum(['admin', 'jrAdmin']),\n }),\n]);\n\nconst TTTAuditTargetSchema = z.object({\n uid: z.string().nullable(),\n ref: z.string().nullable(),\n});\n\nexport const TTTAuditEventSchema = z.object({\n id: z.string(),\n type: z.string(),\n schemaVersion: z.number(),\n actor: TTTAuditActorSchema.nullable(),\n target: TTTAuditTargetSchema.nullable(),\n timestamp: z.number(),\n ip: z.string().nullable(),\n userAgent: z.string().nullable(),\n region: z.string().nullable(),\n metadata: z.record(z.string(), z.unknown()),\n result: z.enum(['success', 'failure']),\n failureReason: z.string().nullable(),\n correlationId: z.string().nullable(),\n});\n"]}
@@ -0,0 +1,48 @@
1
+ import { z } from 'zod';
2
+ export declare const HallMediaReaperCursorSchema: z.ZodObject<{
3
+ createdAtCursor: z.ZodNumber;
4
+ updatedAt: z.ZodNumber;
5
+ }, z.core.$strip>;
6
+ export type HallMediaReaperCursor = z.infer<typeof HallMediaReaperCursorSchema>;
7
+ export declare const OperatorStepUpSchema: z.ZodObject<{
8
+ secret: z.ZodString;
9
+ status: z.ZodEnum<{
10
+ pending: "pending";
11
+ active: "active";
12
+ }>;
13
+ grantExpiresAt: z.ZodOptional<z.ZodNumber>;
14
+ createdAt: z.ZodNumber;
15
+ updatedAt: z.ZodNumber;
16
+ confirmedAt: z.ZodOptional<z.ZodNumber>;
17
+ }, z.core.$strip>;
18
+ export type OperatorStepUp = z.infer<typeof OperatorStepUpSchema>;
19
+ export declare const SafetyReconcilerCursorSchema: z.ZodObject<{
20
+ afterValue: z.ZodOptional<z.ZodNumber>;
21
+ updatedAt: z.ZodNumber;
22
+ }, z.core.$strip>;
23
+ export type SafetyReconcilerCursor = z.infer<typeof SafetyReconcilerCursorSchema>;
24
+ export declare const NcmecPortalReceiptArtifactV1Schema: z.ZodObject<{
25
+ schemaVersion: z.ZodLiteral<1>;
26
+ caseId: z.ZodString;
27
+ submissionId: z.ZodString;
28
+ evidenceVaultKey: z.ZodString;
29
+ objectGeneration: z.ZodString;
30
+ sha256: z.ZodString;
31
+ contentType: z.ZodString;
32
+ sizeBytes: z.ZodNumber;
33
+ capturedAt: z.ZodNumber;
34
+ registeredByUid: z.ZodString;
35
+ description: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strip>;
37
+ export type NcmecPortalReceiptArtifactV1 = z.infer<typeof NcmecPortalReceiptArtifactV1Schema>;
38
+ export declare const NcmecPortalCorrectionRecordV1Schema: z.ZodObject<{
39
+ schemaVersion: z.ZodLiteral<1>;
40
+ caseId: z.ZodString;
41
+ ncmecReportId: z.ZodString;
42
+ correctionFiledAt: z.ZodNumber;
43
+ reason: z.ZodString;
44
+ recordedByUid: z.ZodString;
45
+ recordedAt: z.ZodNumber;
46
+ }, z.core.$strip>;
47
+ export type NcmecPortalCorrectionRecordV1 = z.infer<typeof NcmecPortalCorrectionRecordV1Schema>;
48
+ //# sourceMappingURL=backend-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend-state.d.ts","sourceRoot":"","sources":["../../src/doc-schemas/backend-state.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,2BAA2B;;;iBAGtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAOhF,eAAO,MAAM,oBAAoB;;;;;;;;;;iBAS/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAMlE,eAAO,MAAM,4BAA4B;;;iBAIvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AASlF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;iBAgB7C,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAQ9F,eAAO,MAAM,mCAAmC;;;;;;;;iBAU9C,CAAC;AACH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC"}
@@ -0,0 +1,81 @@
1
+ // Backend-only state document SCHEMAS — Cloud-Functions-owned bookkeeping docs that no
2
+ // client ever reads or writes (firestore.rules denies client access to every path below).
3
+ // They are registered here for the same reason every other stored shape is: ARCH-104 gives
4
+ // the path ONE owner, and COLLECTION_SCHEMAS is the inventory the schema-doc generator and
5
+ // the drift-check read. Types are inferred via z.infer.
6
+ import { z } from 'zod';
7
+ // _systemData/hallMediaReaperCursor — the scheduled Hall-media orphan reaper's scan cursor.
8
+ // `createdAtCursor` is the highest mediaAssets `createdAt` the reaper has POSITIVELY cleared
9
+ // (candidate resolved referenced / reaped / already-deleted), so each pass resumes past
10
+ // permanently-live Hall assets instead of re-reading the same oldest page forever.
11
+ // (functions/src/media/reapOrphanedHallMediaCopies.ts)
12
+ export const HallMediaReaperCursorSchema = z.object({
13
+ createdAtCursor: z.number(),
14
+ updatedAt: z.number(),
15
+ });
16
+ // operatorStepUp/{uid} — [H-08] per-operator TOTP step-up state: the authenticator secret
17
+ // plus the currently open grant window. The secret is returned to the client EXACTLY ONCE by
18
+ // enrollOperatorStepUp and is never readable through Firestore afterwards; `status` goes
19
+ // 'pending' → 'active' on confirm, and each successful verify pushes `grantExpiresAt` out by
20
+ // the step-up window. (functions/src/safety/operatorStepUp.ts)
21
+ export const OperatorStepUpSchema = z.object({
22
+ secret: z.string(),
23
+ status: z.enum(['pending', 'active']),
24
+ /** Absent until the first successful verify; a grant is live while now < grantExpiresAt. */
25
+ grantExpiresAt: z.number().optional(),
26
+ createdAt: z.number(),
27
+ updatedAt: z.number(),
28
+ /** Set when enrollment is confirmed (status flips to 'active'). */
29
+ confirmedAt: z.number().optional(),
30
+ });
31
+ // safetyReconcilerCursors/{cursorKey} — one persisted pagination cursor per reconciler
32
+ // needs-work backstop sweep (quarantine enqueue, NCMEC enqueue). The sweep pages a
33
+ // needs-work-filtered query from `afterValue` and WRAPS to the start when exhausted, so
34
+ // coverage does not stall on the oldest rows. (functions/src/safety/reconcilerCursor.ts)
35
+ export const SafetyReconcilerCursorSchema = z.object({
36
+ /** `orderBy` value of the last row examined last pass (exclusive lower bound). Absent ⇒ 0. */
37
+ afterValue: z.number().optional(),
38
+ updatedAt: z.number(),
39
+ });
40
+ // childSafetyCases/{caseId}/portalReceiptArtifacts/{artifactId} — [Q13/H-06] the immutable
41
+ // record of a PDF/screenshot of the completed NCMEC CyberTipline submission, stored in the
42
+ // restricted evidence vault. `markNcmecPortalComplete` accepts only the id of a verified
43
+ // artifact bound to the SAME (caseId, submissionId); an arbitrary operator string is never
44
+ // proof. Written create-only, never overwritten, and carries the server-verified storage facts
45
+ // (generation + sha256) so a later transactional verification can confirm the same object
46
+ // still exists unchanged. (functions/src/safety/ncmecOperatorCommands.ts)
47
+ export const NcmecPortalReceiptArtifactV1Schema = z.object({
48
+ schemaVersion: z.literal(1),
49
+ caseId: z.string(),
50
+ submissionId: z.string(),
51
+ /** Key of the object in the restricted evidence vault bucket. */
52
+ evidenceVaultKey: z.string(),
53
+ /** GCS object generation at capture time (immutable identity peg). */
54
+ objectGeneration: z.string(),
55
+ /** SHA-256 hex digest of the object bytes at capture time. */
56
+ sha256: z.string(),
57
+ contentType: z.string(),
58
+ sizeBytes: z.number(),
59
+ capturedAt: z.number(),
60
+ registeredByUid: z.string(),
61
+ /** Optional operator free-text describing what the artifact is. */
62
+ description: z.string().optional(),
63
+ });
64
+ // childSafetyCases/{caseId}/ncmecPortalCorrections/{correctionId} — the immutable record that
65
+ // the operator filed a CORRECTION on the NCMEC manual portal. There is no in-app correction
66
+ // submission pipeline; this records the portal filing. Its EXISTENCE is the gate on the
67
+ // corrected-no-apparent-violation disposition, so it is never a bare-discretion close. Each
68
+ // correction is a fresh id — a later correction is an additional record, never a mutation of
69
+ // the prior one. (functions/src/safety/recordNcmecPortalCorrection.ts)
70
+ export const NcmecPortalCorrectionRecordV1Schema = z.object({
71
+ schemaVersion: z.literal(1),
72
+ caseId: z.string(),
73
+ /** The portal-assigned NCMEC report id being corrected. */
74
+ ncmecReportId: z.string(),
75
+ /** When the operator filed the correction on the portal (operator-supplied). */
76
+ correctionFiledAt: z.number(),
77
+ reason: z.string(),
78
+ recordedByUid: z.string(),
79
+ recordedAt: z.number(),
80
+ });
81
+ //# sourceMappingURL=backend-state.js.map