@ttt-productions/ttt-core 0.79.36 → 0.79.38

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 (93) hide show
  1. package/dist/constants/business-content.d.ts +8 -0
  2. package/dist/constants/business-content.d.ts.map +1 -1
  3. package/dist/constants/business-content.js.map +1 -1
  4. package/dist/doc-schemas/chat-sync.d.ts +3 -2
  5. package/dist/doc-schemas/chat-sync.d.ts.map +1 -1
  6. package/dist/doc-schemas/chat-sync.js +3 -0
  7. package/dist/doc-schemas/chat-sync.js.map +1 -1
  8. package/dist/doc-schemas/commissions.d.ts +7 -5
  9. package/dist/doc-schemas/commissions.d.ts.map +1 -1
  10. package/dist/doc-schemas/commissions.js +2 -0
  11. package/dist/doc-schemas/commissions.js.map +1 -1
  12. package/dist/doc-schemas/content.d.ts +64 -9
  13. package/dist/doc-schemas/content.d.ts.map +1 -1
  14. package/dist/doc-schemas/content.js +43 -0
  15. package/dist/doc-schemas/content.js.map +1 -1
  16. package/dist/doc-schemas/media-activation-jobs.d.ts +3 -3
  17. package/dist/doc-schemas/media-assets.d.ts +12 -12
  18. package/dist/doc-schemas/messaging.d.ts +4 -4
  19. package/dist/doc-schemas/moderation.d.ts +22 -9
  20. package/dist/doc-schemas/moderation.d.ts.map +1 -1
  21. package/dist/doc-schemas/moderation.js +13 -2
  22. package/dist/doc-schemas/moderation.js.map +1 -1
  23. package/dist/doc-schemas/ncii/cases.d.ts +30 -3
  24. package/dist/doc-schemas/ncii/cases.d.ts.map +1 -1
  25. package/dist/doc-schemas/ncii/cases.js +20 -0
  26. package/dist/doc-schemas/ncii/cases.js.map +1 -1
  27. package/dist/doc-schemas/ncii/removal.d.ts +2 -2
  28. package/dist/doc-schemas/ncii/requests.d.ts +9 -8
  29. package/dist/doc-schemas/ncii/requests.d.ts.map +1 -1
  30. package/dist/doc-schemas/ncii/requests.js +5 -1
  31. package/dist/doc-schemas/ncii/requests.js.map +1 -1
  32. package/dist/doc-schemas/notification-archive-all-jobs.d.ts +3 -3
  33. package/dist/doc-schemas/notification-ledger.d.ts +9 -1
  34. package/dist/doc-schemas/notification-ledger.d.ts.map +1 -1
  35. package/dist/doc-schemas/notification-ledger.js +26 -1
  36. package/dist/doc-schemas/notification-ledger.js.map +1 -1
  37. package/dist/doc-schemas/payments.d.ts +3 -3
  38. package/dist/doc-schemas/registry.d.ts +371 -92
  39. package/dist/doc-schemas/registry.d.ts.map +1 -1
  40. package/dist/doc-schemas/registry.js +7 -6
  41. package/dist/doc-schemas/registry.js.map +1 -1
  42. package/dist/doc-schemas/report-docs.d.ts +8 -7
  43. package/dist/doc-schemas/report-docs.d.ts.map +1 -1
  44. package/dist/doc-schemas/report-docs.js +3 -0
  45. package/dist/doc-schemas/report-docs.js.map +1 -1
  46. package/dist/doc-schemas/safety/case-aliases.d.ts +2 -0
  47. package/dist/doc-schemas/safety/case-aliases.d.ts.map +1 -1
  48. package/dist/doc-schemas/safety/case-aliases.js +4 -0
  49. package/dist/doc-schemas/safety/case-aliases.js.map +1 -1
  50. package/dist/doc-schemas/safety/case.d.ts +2 -2
  51. package/dist/doc-schemas/safety/evidence.d.ts +378 -3
  52. package/dist/doc-schemas/safety/evidence.d.ts.map +1 -1
  53. package/dist/doc-schemas/safety/evidence.js +61 -0
  54. package/dist/doc-schemas/safety/evidence.js.map +1 -1
  55. package/dist/doc-schemas/safety/foundation.d.ts +11 -11
  56. package/dist/doc-schemas/safety/holds.d.ts +3 -3
  57. package/dist/doc-schemas/safety/report.d.ts +77 -2
  58. package/dist/doc-schemas/safety/report.d.ts.map +1 -1
  59. package/dist/doc-schemas/safety/report.js +69 -1
  60. package/dist/doc-schemas/safety/report.js.map +1 -1
  61. package/dist/doc-schemas/safety/sagas.d.ts +1 -0
  62. package/dist/doc-schemas/safety/sagas.d.ts.map +1 -1
  63. package/dist/doc-schemas/safety/sagas.js +3 -0
  64. package/dist/doc-schemas/safety/sagas.js.map +1 -1
  65. package/dist/doc-schemas/social.d.ts +17 -17
  66. package/dist/doc-schemas/square-announcement-jobs.d.ts +15 -15
  67. package/dist/doc-schemas/user.d.ts +11 -8
  68. package/dist/doc-schemas/user.d.ts.map +1 -1
  69. package/dist/doc-schemas/user.js +9 -0
  70. package/dist/doc-schemas/user.js.map +1 -1
  71. package/dist/doc-schemas/work-project.d.ts +1 -1
  72. package/dist/media/atoms.d.ts +4 -4
  73. package/dist/media/domain-events-user.d.ts +4 -4
  74. package/dist/media/domain-events.d.ts +4 -4
  75. package/dist/media/pending-media.d.ts +44 -44
  76. package/dist/media/target-info.d.ts +5 -5
  77. package/dist/paths/collections.d.ts +1 -0
  78. package/dist/paths/collections.d.ts.map +1 -1
  79. package/dist/paths/collections.js +4 -0
  80. package/dist/paths/collections.js.map +1 -1
  81. package/dist/paths/path-builders.d.ts +1 -0
  82. package/dist/paths/path-builders.d.ts.map +1 -1
  83. package/dist/paths/path-builders.js +3 -0
  84. package/dist/paths/path-builders.js.map +1 -1
  85. package/dist/schemas/admin.d.ts +6 -6
  86. package/dist/schemas/atoms.d.ts +2 -2
  87. package/dist/schemas/commissions.d.ts +1 -1
  88. package/dist/schemas/hall-library.d.ts +1 -1
  89. package/dist/schemas/notification.d.ts +5 -5
  90. package/dist/schemas/social.d.ts +14 -14
  91. package/dist/schemas/work-project-management.d.ts +4 -4
  92. package/dist/upload-variables/square-streetz-post-variables.d.ts +2 -2
  93. package/package.json +1 -1
@@ -50,6 +50,14 @@ export type ModerationClearableSurface = keyof typeof MODERATION_CLEARABLE_TEXT_
50
50
  * compile error until its label and cap exist.
51
51
  */
52
52
  export type ClearableTextFieldName = (typeof MODERATION_CLEARABLE_TEXT_FIELDS)[ModerationClearableSurface][number];
53
+ /**
54
+ * The bounded computed-field portion of a moderation text-clear write. Writers
55
+ * may only set one of the canonical clearable field names, never an arbitrary
56
+ * document key. Sentinel-bearing moderation metadata stays runtime-specific.
57
+ */
58
+ export type ModerationClearTextFieldPatch = {
59
+ [Field in ClearableTextFieldName]?: string;
60
+ };
53
61
  /**
54
62
  * The DISTINCT clearable text-field NAMES across the whole hall content family (tale/tune/
55
63
  * television detail → title/description; chapter → title/content; track/episode →
@@ -1 +1 @@
1
- {"version":3,"file":"business-content.d.ts","sourceRoot":"","sources":["../../src/constants/business-content.ts"],"names":[],"mappings":"AAYA,gGAAgG;AAChG,eAAO,MAAM,qCAAqC,MAAM,CAAC;AAIzD,8EAA8E;AAC9E,eAAO,MAAM,uBAAuB,QAAkD,CAAC;AAEvF,iEAAiE;AACjE,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,6CAA6C;AAC7C,eAAO,MAAM,2BAA2B,MAAgC,CAAC;AAEzE,kEAAkE;AAClE,eAAO,MAAM,iCAAiC,MAAM,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,oEACqB,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,2BAA2B,CAAC;AAC1E,eAAO,MAAM,iCAAiC,6CAA6C,CAAC;AAE5F;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;CAYS,CAAC;AAEvD,8EAA8E;AAC9E,MAAM,MAAM,0BAA0B,GAAG,MAAM,OAAO,gCAAgC,CAAC;AAEvF;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,gCAAgC,CAAC,CAAC,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhF;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B,8CAIlC,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;CASiB,CAAC;AAEvD;;;;;oBAKoB;AACpB,eAAO,MAAM,2BAA2B;;;;;;CAMmB,CAAC;AAE5D;;4BAE4B;AAC5B,MAAM,WAAW,yBAAyB;IACxC,6EAA6E;IAC7E,aAAa,EAAE,0BAA0B,CAAC;IAC1C,kDAAkD;IAClD,YAAY,EAAE,SAAS,sBAAsB,EAAE,CAAC;IA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zC,wFAAwF;IACxF,yFAAyF;IACzF,0FAA0F;IAC1F,uFAAuF;IACvF,0FAA0F;IAC1F,gDAAgD,CAAC;AAEnD,qGAAqG;AAErG;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,aAAa,EAAE,GAAG;IAClB,YAAY,EAAE,GAAG;IACjB,UAAU,EAAE,EAAE;IACd,cAAc,EAAE,EAAE;CACuB,CAAC;AAE5C,oBAAoB;AAEpB,4CAA4C;AAC5C,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAE7C;;4EAE4E;AAC5E,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAC9C,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAE9C,kDAAkD;AAClD,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAI,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,OAAO,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAC7C,8FAA8F,CAAC;AAEjG,sCAAsC;AAEtC,+CAA+C;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AAEnC,yEAAyE;AACzE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAE9B,8EAA8E;AAC9E,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAE7C,6BAA6B;AAE7B,iDAAiD;AACjD,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAEnD,kDAAkD;AAClD,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,CAAC","sourcesContent":["// Content-surface business-rule constants — commissions, auditions, the social\n// feed, and messaging.\nimport {\n MAX_WORK_PROJECT_TITLE_LENGTH,\n MAX_WORK_PROJECT_DESCRIPTION_LENGTH,\n MAX_CHAPTER_CONTENT_LENGTH,\n MAX_WORK_REALM_TITLE_LENGTH,\n MAX_WORK_REALM_DESCRIPTION_LENGTH,\n} from \"./business-work-project.js\";\nimport { ACTIVE_LIMITS } from './app-mode.js';\nimport type { WorkProjectType } from '../types/content.js';\n\n/** The maximum character length for a SquareStreetz post created on behalf of a workProject. */\nexport const MAX_SQUARE_STREETZ_DESCRIPTION_LENGTH = 150;\n\n// --- Commission Board & Proposals ---\n\n/** Maximum number of open commissions a workProject can have. Mode-varied. */\nexport const MAX_COMMISSION_LISTINGS = ACTIVE_LIMITS.workProject.maxCommissionListings;\n\n/** Maximum number of proposal artisans saved to a commission. */\nexport const MAX_SAVED_PROPOSAL_ARTISANS = 5;\n\n/** Maximum length for a commission title. */\nexport const MAX_COMMISSION_TITLE_LENGTH = MAX_WORK_PROJECT_TITLE_LENGTH;\n\n/** Maximum length for a commission description / cover letter. */\nexport const MAX_COMMISSION_DESCRIPTION_LENGTH = 400;\n\n// --- Moderation text-clear + published hall-content text fields ---\n\n/**\n * Neutral placeholder written into a single cleared text field by the moderation\n * text-clear remedy. Canonical wording — the backend `runModerationClearText`\n * core writes exactly this string; a wording change is a single edit here.\n */\nexport const MODERATION_CLEAR_PLACEHOLDER =\n 'Removed by moderation — awaiting an update by the steward.';\n\n/**\n * Default REASON strings recorded on a moderation action when the admin supplies no\n * user-facing reason. Distinct from MODERATION_CLEAR_PLACEHOLDER (which is written INTO\n * cleared content fields) — these are the recorded justification text. Canonical wording;\n * consumers (resolveAdminTask's forceRetitle / chat-delete actions) never inline them.\n */\nexport const MODERATION_DEFAULT_REMOVAL_REASON = 'Removed by moderation.';\nexport const MODERATION_DEFAULT_RETITLE_REASON = 'Title/description removed by moderation.';\n\n/**\n * CANONICAL clearable text-field map for the per-field moderation TEXT-CLEAR remedy.\n * Cross-boundary single owner: the admin field-picker offers this set per surface and\n * the backend clear runner validates + normalizes caller-supplied fields against it.\n * Keys are surfaces; values are the exact document field names (NOT display labels)\n * recorded verbatim in `moderationClearedFields`. Covers every clearable surface —\n * workProject/workRealm shell metadata, hall parent details (tale/tune/television),\n * and hall sub-items (chapter/track/episode).\n */\nexport const MODERATION_CLEARABLE_TEXT_FIELDS = {\n // workProject + workRealm shell metadata\n workProject: ['workingTitle', 'workingDescription'],\n workRealm: ['workingTitle', 'workingDescription'],\n // hall content parent details\n tale: ['title', 'description'],\n tune: ['title', 'description'],\n television: ['title', 'description'],\n // hall content sub-items\n chapter: ['title', 'content'],\n tuneTrack: ['title', 'description'],\n televisionEpisode: ['title', 'description'],\n} as const satisfies Record<string, readonly string[]>;\n\n/** A surface whose text fields the moderation clear remedy can neutralize. */\nexport type ModerationClearableSurface = keyof typeof MODERATION_CLEARABLE_TEXT_FIELDS;\n\n/**\n * Every DISTINCT clearable/changeable text-field NAME, DERIVED from the canonical\n * MODERATION_CLEARABLE_TEXT_FIELDS map (the union of every surface's tuple). Label maps and\n * per-field cap maps key on this instead of `string`, so adding a field to a surface is a\n * compile error until its label and cap exist.\n */\nexport type ClearableTextFieldName =\n (typeof MODERATION_CLEARABLE_TEXT_FIELDS)[ModerationClearableSurface][number];\n\n/**\n * The DISTINCT clearable text-field NAMES across the whole hall content family (tale/tune/\n * television detail → title/description; chapter → title/content; track/episode →\n * title/description). DERIVED from the canonical MODERATION_CLEARABLE_TEXT_FIELDS map — the\n * union of every hall surface's fields — so the `clearHallContentText` callable's field-enum\n * (`HallClearFieldSchema`) never restates the `title`/`description`/`content` literals. Index\n * access on the map's readonly tuples preserves the literal types, so this stays a typed\n * `readonly ['title','description','content']` a `z.enum(...)` can consume directly.\n */\nexport const HALL_CLEARABLE_TEXT_FIELD_NAMES = [\n MODERATION_CLEARABLE_TEXT_FIELDS.tale[0], // title\n MODERATION_CLEARABLE_TEXT_FIELDS.tale[1], // description\n MODERATION_CLEARABLE_TEXT_FIELDS.chapter[1], // content\n] as const;\n\n/**\n * The raw doc field names each published hall-content surface exposes as changeable TEXT.\n * Cross-boundary: the member \"Update details\" field picker offers this set per surface and\n * the change-request submit runner validates against it. Detail surfaces (tale/tune/\n * television) live on the hall parent doc; sub-item surfaces on the published chapter/\n * track/episode doc. This is the HALL-SURFACE SUBSET of the canonical\n * MODERATION_CLEARABLE_TEXT_FIELDS above (it excludes the `workProject` shell) — every\n * tuple is projected from that one owner, so the two can never drift.\n */\nexport const HALL_CONTENT_TEXT_FIELDS = {\n tale: MODERATION_CLEARABLE_TEXT_FIELDS.tale,\n tune: MODERATION_CLEARABLE_TEXT_FIELDS.tune,\n television: MODERATION_CLEARABLE_TEXT_FIELDS.television,\n chapter: MODERATION_CLEARABLE_TEXT_FIELDS.chapter,\n tuneTrack: MODERATION_CLEARABLE_TEXT_FIELDS.tuneTrack,\n televisionEpisode: MODERATION_CLEARABLE_TEXT_FIELDS.televisionEpisode,\n // Realm grain (R1, 2026-07-12): targets the `workRealms/{id}` doc directly.\n workRealm: MODERATION_CLEARABLE_TEXT_FIELDS.workRealm,\n} as const satisfies Record<string, readonly string[]>;\n\n/** Per-field max lengths for proposed hall-content text. DERIVED from the owning\n * constants — never independent numbers — so the change-request pipeline can never\n * drift from the authoring limits again (the pre-2026-07-13 copy carried its own\n * 200/5000/100000 set while authoring enforced 150/300/2500). Keyed on the derived\n * ClearableTextFieldName union, so a new clearable field fails the build here until\n * it has a cap. */\nexport const HALL_CONTENT_TEXT_FIELD_MAX = {\n title: MAX_WORK_PROJECT_TITLE_LENGTH,\n description: MAX_WORK_PROJECT_DESCRIPTION_LENGTH,\n content: MAX_CHAPTER_CONTENT_LENGTH,\n workingTitle: MAX_WORK_REALM_TITLE_LENGTH,\n workingDescription: MAX_WORK_REALM_DESCRIPTION_LENGTH,\n} as const satisfies Record<ClearableTextFieldName, number>;\n\n/** One work-project type's two hall text surfaces — the published DETAIL on the hall parent\n * and its chapter/track/episode SUB-ITEM — each with the clearable/changeable field tuple\n * that surface exposes. */\nexport interface HallContentSurfaceRouting {\n /** Surface identity of the hall parent DETAIL (tale / tune / television). */\n detailSurface: ModerationClearableSurface;\n /** The DETAIL surface's clearable text fields. */\n detailFields: readonly ClearableTextFieldName[];\n /** Surface identity of the SUB-ITEM (chapter / tuneTrack / televisionEpisode). */\n subItemSurface: ModerationClearableSurface;\n /** The SUB-ITEM surface's clearable text fields — a Tale chapter carries title/content, a\n * Tune track and a Television episode title/description. */\n subItemFields: readonly ClearableTextFieldName[];\n}\n\n/**\n * CANONICAL WorkProjectType → hall text-surface routing. The ONE owner of \"a Tale's sub-item is\n * a chapter, a Tune's is a tuneTrack, a Television's is a televisionEpisode\" and of which fields\n * each of those surfaces exposes. Cross-boundary: the backend text-clear and change-request\n * runners resolve `surface` from (workProjectType, is-sub-item?) through this map, and the admin\n * field pickers project their checkbox options from the same entry — three sites that each\n * hand-rolled the routing before (a ternary that fell through to the tuneTrack tuple for\n * Television, silently correct only because the two tuples happen to match today).\n *\n * Every field tuple is PROJECTED from MODERATION_CLEARABLE_TEXT_FIELDS above — no field literal\n * is restated here — and the `satisfies Record<WorkProjectType, …>` makes adding a work-project\n * type a compile error until its surfaces are routed.\n */\nexport const HALL_CONTENT_SURFACES_BY_WORK_TYPE = {\n Tales: {\n detailSurface: 'tale',\n detailFields: MODERATION_CLEARABLE_TEXT_FIELDS.tale,\n subItemSurface: 'chapter',\n subItemFields: MODERATION_CLEARABLE_TEXT_FIELDS.chapter,\n },\n Tunes: {\n detailSurface: 'tune',\n detailFields: MODERATION_CLEARABLE_TEXT_FIELDS.tune,\n subItemSurface: 'tuneTrack',\n subItemFields: MODERATION_CLEARABLE_TEXT_FIELDS.tuneTrack,\n },\n Television: {\n detailSurface: 'television',\n detailFields: MODERATION_CLEARABLE_TEXT_FIELDS.television,\n subItemSurface: 'televisionEpisode',\n subItemFields: MODERATION_CLEARABLE_TEXT_FIELDS.televisionEpisode,\n },\n} as const satisfies Record<WorkProjectType, HallContentSurfaceRouting>;\n\n/** Admin decision reason on a published change request (required on a deny; shown to\n * the member). One owner for the review callable schema AND the admin work-view input. */\nexport const MAX_HALL_CHANGE_REQUEST_REASON_LENGTH = 2000;\n\n// --- Real-people / parody disclaimer (R3, 2026-07-12) ---\n\n/**\n * The ONE standard platform disclaimer rendered on every published work whose\n * author attested it depicts real people (parody / satire / commentary). Two\n * layers, always shown together (DJ, 2026-07-12): the themed playbill HEADER\n * on top, the plain legal MESSAGE underneath. There is no free-text disclaimer\n * anywhere — these constants are the only wording, so a wording change is a\n * single edit here (display surfaces and any backend consumer read these; the\n * text is never persisted on docs). The MESSAGE deliberately never ADMITS the\n * work depicts real people — it hedges (\"even those based on real people\",\n * the standard film-boilerplate move) so the disclaimer never hands over the\n * depiction element of a claim. Legal wording pending counsel confirmation\n * (tracked in docs/ttt-prod-legal/).\n */\nexport const REAL_PEOPLE_DISCLAIMER_HEADER =\n 'A Notice from the Management: the faces may be familiar, but the players are pure ' +\n 'invention — parody and satire, in the grand old tradition of the stage.';\n\nexport const REAL_PEOPLE_DISCLAIMER_MESSAGE =\n 'All characters, statements, and events in this work, even those based on real people, ' +\n 'are entirely fictional and are presented as parody, satire, or commentary. Any voices, ' +\n 'likenesses, or portrayals of real people are impersonated or fictionalized, and nothing ' +\n 'in this work should be understood as a statement of fact about, or as speech by, any ' +\n 'real person. This work is not created by, affiliated with, sponsored by, or endorsed by ' +\n 'any real person portrayed or referenced in it.';\n\n// --- Hall library per-user viewing-state doc (hall-viewing-experience Area 2, ruled 2026-07-04) ---\n\n/**\n * Caps for the per-user Hall viewing-state doc (`HallLibraryPreferencesSchema`,\n * `userProfiles/{uid}/privateData/hallLibraryPreferences`). Every list on that doc is\n * capped for launch — no unbounded per-user lists. `hiddenWorkIds`/`inkedWorkIds` are\n * oldest-pruned (or the write is rejected with a friendly message once full);\n * `inProgress` is LRU-pruned by `updatedAt`; `recentlyViewed` is capped, newest-kept.\n * Enforcement lives in the backend core (`runX`) that owns this doc — this is the\n * shared source of truth for the cap values themselves.\n */\nexport const HALL_LIBRARY_PREFS_CAPS = {\n hiddenWorkIds: 200,\n inkedWorkIds: 200,\n inProgress: 50,\n recentlyViewed: 20,\n} as const satisfies Record<string, number>;\n\n// --- Auditions ---\n\n/** Maximum length for an audition title. */\nexport const MAX_AUDITION_TITLE_LENGTH = 150;\n\n/** Curated-audition option-video batch bounds (the fixed 2..8 option count carried\n * from the Create click through targetInfo/upload-variables to the create core's\n * re-check). ONE declaration — every `.min()/.max()` derives from these. */\nexport const MIN_CURATED_AUDITION_OPTIONS = 2;\nexport const MAX_CURATED_AUDITION_OPTIONS = 8;\n\n/** Maximum length for an audition description. */\nexport const MAX_AUDITION_DESCRIPTION_LENGTH = 1000;\n\n/**\n * Maximum sponsored-audition payout amount in whole USD accepted at the upload\n * trust boundary. Mirrors MAX_PLEDGE_PAYMENT_AMOUNT_CENTS ($500,000) expressed\n * in dollars — a finite ceiling that rejects absurd/garbage amounts before any\n * downstream processing.\n */\nexport const MAX_SPONSORED_AUDITION_AMOUNT_USD = 500_000;\n\n/**\n * The one user-facing rejection sentence when a Work's own active guildmate tries to enter\n * that Work's open audition (entries exist to recruit OUTSIDERS; a member can't be\n * recruited). Shared by both backend enforcement points (upload-accept and publish) — it is\n * the `failed-precondition` answer text the entry UI renders verbatim.\n */\nexport const GUILDMATE_AUDITION_ENTRY_REJECTION =\n 'You are already a guildmate of this Work — its audition is for recruiting new collaborators.';\n\n// --- SquareStreetz (Social Feed) ---\n\n/** Maximum length for a SquareStreetz post. */\nexport const MAX_POST_LENGTH = 500;\n\n/** Maximum number of mentions allowed in a single SquareStreetz post. */\nexport const MAX_MENTIONS = 3;\n\n/** Maximum characters of a mention's display name shown before truncation. */\nexport const MAX_MENTION_DISPLAY_LENGTH = 30;\n\n// --- Messages & Invites ---\n\n/** Maximum length for a guild-invite message. */\nexport const MAX_GUILD_INVITE_MESSAGE_LENGTH = 500;\n\n/** Maximum length for a pledgePayment message. */\nexport const MAX_PLEDGE_PAYMENT_MESSAGE_LENGTH = 500;\n"]}
1
+ {"version":3,"file":"business-content.js","sourceRoot":"","sources":["../../src/constants/business-content.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,uBAAuB;AACvB,OAAO,EACL,6BAA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B,iDAAiD;AACjD,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAEnD,kDAAkD;AAClD,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,CAAC","sourcesContent":["// Content-surface business-rule constants — commissions, auditions, the social\n// feed, and messaging.\nimport {\n MAX_WORK_PROJECT_TITLE_LENGTH,\n MAX_WORK_PROJECT_DESCRIPTION_LENGTH,\n MAX_CHAPTER_CONTENT_LENGTH,\n MAX_WORK_REALM_TITLE_LENGTH,\n MAX_WORK_REALM_DESCRIPTION_LENGTH,\n} from \"./business-work-project.js\";\nimport { ACTIVE_LIMITS } from './app-mode.js';\nimport type { WorkProjectType } from '../types/content.js';\n\n/** The maximum character length for a SquareStreetz post created on behalf of a workProject. */\nexport const MAX_SQUARE_STREETZ_DESCRIPTION_LENGTH = 150;\n\n// --- Commission Board & Proposals ---\n\n/** Maximum number of open commissions a workProject can have. Mode-varied. */\nexport const MAX_COMMISSION_LISTINGS = ACTIVE_LIMITS.workProject.maxCommissionListings;\n\n/** Maximum number of proposal artisans saved to a commission. */\nexport const MAX_SAVED_PROPOSAL_ARTISANS = 5;\n\n/** Maximum length for a commission title. */\nexport const MAX_COMMISSION_TITLE_LENGTH = MAX_WORK_PROJECT_TITLE_LENGTH;\n\n/** Maximum length for a commission description / cover letter. */\nexport const MAX_COMMISSION_DESCRIPTION_LENGTH = 400;\n\n// --- Moderation text-clear + published hall-content text fields ---\n\n/**\n * Neutral placeholder written into a single cleared text field by the moderation\n * text-clear remedy. Canonical wording — the backend `runModerationClearText`\n * core writes exactly this string; a wording change is a single edit here.\n */\nexport const MODERATION_CLEAR_PLACEHOLDER =\n 'Removed by moderation — awaiting an update by the steward.';\n\n/**\n * Default REASON strings recorded on a moderation action when the admin supplies no\n * user-facing reason. Distinct from MODERATION_CLEAR_PLACEHOLDER (which is written INTO\n * cleared content fields) — these are the recorded justification text. Canonical wording;\n * consumers (resolveAdminTask's forceRetitle / chat-delete actions) never inline them.\n */\nexport const MODERATION_DEFAULT_REMOVAL_REASON = 'Removed by moderation.';\nexport const MODERATION_DEFAULT_RETITLE_REASON = 'Title/description removed by moderation.';\n\n/**\n * CANONICAL clearable text-field map for the per-field moderation TEXT-CLEAR remedy.\n * Cross-boundary single owner: the admin field-picker offers this set per surface and\n * the backend clear runner validates + normalizes caller-supplied fields against it.\n * Keys are surfaces; values are the exact document field names (NOT display labels)\n * recorded verbatim in `moderationClearedFields`. Covers every clearable surface —\n * workProject/workRealm shell metadata, hall parent details (tale/tune/television),\n * and hall sub-items (chapter/track/episode).\n */\nexport const MODERATION_CLEARABLE_TEXT_FIELDS = {\n // workProject + workRealm shell metadata\n workProject: ['workingTitle', 'workingDescription'],\n workRealm: ['workingTitle', 'workingDescription'],\n // hall content parent details\n tale: ['title', 'description'],\n tune: ['title', 'description'],\n television: ['title', 'description'],\n // hall content sub-items\n chapter: ['title', 'content'],\n tuneTrack: ['title', 'description'],\n televisionEpisode: ['title', 'description'],\n} as const satisfies Record<string, readonly string[]>;\n\n/** A surface whose text fields the moderation clear remedy can neutralize. */\nexport type ModerationClearableSurface = keyof typeof MODERATION_CLEARABLE_TEXT_FIELDS;\n\n/**\n * Every DISTINCT clearable/changeable text-field NAME, DERIVED from the canonical\n * MODERATION_CLEARABLE_TEXT_FIELDS map (the union of every surface's tuple). Label maps and\n * per-field cap maps key on this instead of `string`, so adding a field to a surface is a\n * compile error until its label and cap exist.\n */\nexport type ClearableTextFieldName =\n (typeof MODERATION_CLEARABLE_TEXT_FIELDS)[ModerationClearableSurface][number];\n\n/**\n * The bounded computed-field portion of a moderation text-clear write. Writers\n * may only set one of the canonical clearable field names, never an arbitrary\n * document key. Sentinel-bearing moderation metadata stays runtime-specific.\n */\nexport type ModerationClearTextFieldPatch = {\n [Field in ClearableTextFieldName]?: string;\n};\n\n/**\n * The DISTINCT clearable text-field NAMES across the whole hall content family (tale/tune/\n * television detail → title/description; chapter → title/content; track/episode →\n * title/description). DERIVED from the canonical MODERATION_CLEARABLE_TEXT_FIELDS map — the\n * union of every hall surface's fields — so the `clearHallContentText` callable's field-enum\n * (`HallClearFieldSchema`) never restates the `title`/`description`/`content` literals. Index\n * access on the map's readonly tuples preserves the literal types, so this stays a typed\n * `readonly ['title','description','content']` a `z.enum(...)` can consume directly.\n */\nexport const HALL_CLEARABLE_TEXT_FIELD_NAMES = [\n MODERATION_CLEARABLE_TEXT_FIELDS.tale[0], // title\n MODERATION_CLEARABLE_TEXT_FIELDS.tale[1], // description\n MODERATION_CLEARABLE_TEXT_FIELDS.chapter[1], // content\n] as const;\n\n/**\n * The raw doc field names each published hall-content surface exposes as changeable TEXT.\n * Cross-boundary: the member \"Update details\" field picker offers this set per surface and\n * the change-request submit runner validates against it. Detail surfaces (tale/tune/\n * television) live on the hall parent doc; sub-item surfaces on the published chapter/\n * track/episode doc. This is the HALL-SURFACE SUBSET of the canonical\n * MODERATION_CLEARABLE_TEXT_FIELDS above (it excludes the `workProject` shell) — every\n * tuple is projected from that one owner, so the two can never drift.\n */\nexport const HALL_CONTENT_TEXT_FIELDS = {\n tale: MODERATION_CLEARABLE_TEXT_FIELDS.tale,\n tune: MODERATION_CLEARABLE_TEXT_FIELDS.tune,\n television: MODERATION_CLEARABLE_TEXT_FIELDS.television,\n chapter: MODERATION_CLEARABLE_TEXT_FIELDS.chapter,\n tuneTrack: MODERATION_CLEARABLE_TEXT_FIELDS.tuneTrack,\n televisionEpisode: MODERATION_CLEARABLE_TEXT_FIELDS.televisionEpisode,\n // Realm grain (R1, 2026-07-12): targets the `workRealms/{id}` doc directly.\n workRealm: MODERATION_CLEARABLE_TEXT_FIELDS.workRealm,\n} as const satisfies Record<string, readonly string[]>;\n\n/** Per-field max lengths for proposed hall-content text. DERIVED from the owning\n * constants — never independent numbers — so the change-request pipeline can never\n * drift from the authoring limits again (the pre-2026-07-13 copy carried its own\n * 200/5000/100000 set while authoring enforced 150/300/2500). Keyed on the derived\n * ClearableTextFieldName union, so a new clearable field fails the build here until\n * it has a cap. */\nexport const HALL_CONTENT_TEXT_FIELD_MAX = {\n title: MAX_WORK_PROJECT_TITLE_LENGTH,\n description: MAX_WORK_PROJECT_DESCRIPTION_LENGTH,\n content: MAX_CHAPTER_CONTENT_LENGTH,\n workingTitle: MAX_WORK_REALM_TITLE_LENGTH,\n workingDescription: MAX_WORK_REALM_DESCRIPTION_LENGTH,\n} as const satisfies Record<ClearableTextFieldName, number>;\n\n/** One work-project type's two hall text surfaces — the published DETAIL on the hall parent\n * and its chapter/track/episode SUB-ITEM — each with the clearable/changeable field tuple\n * that surface exposes. */\nexport interface HallContentSurfaceRouting {\n /** Surface identity of the hall parent DETAIL (tale / tune / television). */\n detailSurface: ModerationClearableSurface;\n /** The DETAIL surface's clearable text fields. */\n detailFields: readonly ClearableTextFieldName[];\n /** Surface identity of the SUB-ITEM (chapter / tuneTrack / televisionEpisode). */\n subItemSurface: ModerationClearableSurface;\n /** The SUB-ITEM surface's clearable text fields — a Tale chapter carries title/content, a\n * Tune track and a Television episode title/description. */\n subItemFields: readonly ClearableTextFieldName[];\n}\n\n/**\n * CANONICAL WorkProjectType → hall text-surface routing. The ONE owner of \"a Tale's sub-item is\n * a chapter, a Tune's is a tuneTrack, a Television's is a televisionEpisode\" and of which fields\n * each of those surfaces exposes. Cross-boundary: the backend text-clear and change-request\n * runners resolve `surface` from (workProjectType, is-sub-item?) through this map, and the admin\n * field pickers project their checkbox options from the same entry — three sites that each\n * hand-rolled the routing before (a ternary that fell through to the tuneTrack tuple for\n * Television, silently correct only because the two tuples happen to match today).\n *\n * Every field tuple is PROJECTED from MODERATION_CLEARABLE_TEXT_FIELDS above — no field literal\n * is restated here — and the `satisfies Record<WorkProjectType, …>` makes adding a work-project\n * type a compile error until its surfaces are routed.\n */\nexport const HALL_CONTENT_SURFACES_BY_WORK_TYPE = {\n Tales: {\n detailSurface: 'tale',\n detailFields: MODERATION_CLEARABLE_TEXT_FIELDS.tale,\n subItemSurface: 'chapter',\n subItemFields: MODERATION_CLEARABLE_TEXT_FIELDS.chapter,\n },\n Tunes: {\n detailSurface: 'tune',\n detailFields: MODERATION_CLEARABLE_TEXT_FIELDS.tune,\n subItemSurface: 'tuneTrack',\n subItemFields: MODERATION_CLEARABLE_TEXT_FIELDS.tuneTrack,\n },\n Television: {\n detailSurface: 'television',\n detailFields: MODERATION_CLEARABLE_TEXT_FIELDS.television,\n subItemSurface: 'televisionEpisode',\n subItemFields: MODERATION_CLEARABLE_TEXT_FIELDS.televisionEpisode,\n },\n} as const satisfies Record<WorkProjectType, HallContentSurfaceRouting>;\n\n/** Admin decision reason on a published change request (required on a deny; shown to\n * the member). One owner for the review callable schema AND the admin work-view input. */\nexport const MAX_HALL_CHANGE_REQUEST_REASON_LENGTH = 2000;\n\n// --- Real-people / parody disclaimer (R3, 2026-07-12) ---\n\n/**\n * The ONE standard platform disclaimer rendered on every published work whose\n * author attested it depicts real people (parody / satire / commentary). Two\n * layers, always shown together (DJ, 2026-07-12): the themed playbill HEADER\n * on top, the plain legal MESSAGE underneath. There is no free-text disclaimer\n * anywhere — these constants are the only wording, so a wording change is a\n * single edit here (display surfaces and any backend consumer read these; the\n * text is never persisted on docs). The MESSAGE deliberately never ADMITS the\n * work depicts real people — it hedges (\"even those based on real people\",\n * the standard film-boilerplate move) so the disclaimer never hands over the\n * depiction element of a claim. Legal wording pending counsel confirmation\n * (tracked in docs/ttt-prod-legal/).\n */\nexport const REAL_PEOPLE_DISCLAIMER_HEADER =\n 'A Notice from the Management: the faces may be familiar, but the players are pure ' +\n 'invention — parody and satire, in the grand old tradition of the stage.';\n\nexport const REAL_PEOPLE_DISCLAIMER_MESSAGE =\n 'All characters, statements, and events in this work, even those based on real people, ' +\n 'are entirely fictional and are presented as parody, satire, or commentary. Any voices, ' +\n 'likenesses, or portrayals of real people are impersonated or fictionalized, and nothing ' +\n 'in this work should be understood as a statement of fact about, or as speech by, any ' +\n 'real person. This work is not created by, affiliated with, sponsored by, or endorsed by ' +\n 'any real person portrayed or referenced in it.';\n\n// --- Hall library per-user viewing-state doc (hall-viewing-experience Area 2, ruled 2026-07-04) ---\n\n/**\n * Caps for the per-user Hall viewing-state doc (`HallLibraryPreferencesSchema`,\n * `userProfiles/{uid}/privateData/hallLibraryPreferences`). Every list on that doc is\n * capped for launch — no unbounded per-user lists. `hiddenWorkIds`/`inkedWorkIds` are\n * oldest-pruned (or the write is rejected with a friendly message once full);\n * `inProgress` is LRU-pruned by `updatedAt`; `recentlyViewed` is capped, newest-kept.\n * Enforcement lives in the backend core (`runX`) that owns this doc — this is the\n * shared source of truth for the cap values themselves.\n */\nexport const HALL_LIBRARY_PREFS_CAPS = {\n hiddenWorkIds: 200,\n inkedWorkIds: 200,\n inProgress: 50,\n recentlyViewed: 20,\n} as const satisfies Record<string, number>;\n\n// --- Auditions ---\n\n/** Maximum length for an audition title. */\nexport const MAX_AUDITION_TITLE_LENGTH = 150;\n\n/** Curated-audition option-video batch bounds (the fixed 2..8 option count carried\n * from the Create click through targetInfo/upload-variables to the create core's\n * re-check). ONE declaration — every `.min()/.max()` derives from these. */\nexport const MIN_CURATED_AUDITION_OPTIONS = 2;\nexport const MAX_CURATED_AUDITION_OPTIONS = 8;\n\n/** Maximum length for an audition description. */\nexport const MAX_AUDITION_DESCRIPTION_LENGTH = 1000;\n\n/**\n * Maximum sponsored-audition payout amount in whole USD accepted at the upload\n * trust boundary. Mirrors MAX_PLEDGE_PAYMENT_AMOUNT_CENTS ($500,000) expressed\n * in dollars — a finite ceiling that rejects absurd/garbage amounts before any\n * downstream processing.\n */\nexport const MAX_SPONSORED_AUDITION_AMOUNT_USD = 500_000;\n\n/**\n * The one user-facing rejection sentence when a Work's own active guildmate tries to enter\n * that Work's open audition (entries exist to recruit OUTSIDERS; a member can't be\n * recruited). Shared by both backend enforcement points (upload-accept and publish) — it is\n * the `failed-precondition` answer text the entry UI renders verbatim.\n */\nexport const GUILDMATE_AUDITION_ENTRY_REJECTION =\n 'You are already a guildmate of this Work — its audition is for recruiting new collaborators.';\n\n// --- SquareStreetz (Social Feed) ---\n\n/** Maximum length for a SquareStreetz post. */\nexport const MAX_POST_LENGTH = 500;\n\n/** Maximum number of mentions allowed in a single SquareStreetz post. */\nexport const MAX_MENTIONS = 3;\n\n/** Maximum characters of a mention's display name shown before truncation. */\nexport const MAX_MENTION_DISPLAY_LENGTH = 30;\n\n// --- Messages & Invites ---\n\n/** Maximum length for a guild-invite message. */\nexport const MAX_GUILD_INVITE_MESSAGE_LENGTH = 500;\n\n/** Maximum length for a pledgePayment message. */\nexport const MAX_PLEDGE_PAYMENT_MESSAGE_LENGTH = 500;\n"]}
@@ -16,6 +16,7 @@ export declare const ChatChannelAuthProjectionSchema: z.ZodObject<{
16
16
  channelAuthVersion: z.ZodNumber;
17
17
  inputFingerprint: z.ZodString;
18
18
  updatedAt: z.ZodNumber;
19
+ lastReconciledAt: z.ZodOptional<z.ZodNumber>;
19
20
  }, z.core.$strip>;
20
21
  export type ChatChannelAuthProjection = z.infer<typeof ChatChannelAuthProjectionSchema>;
21
22
  export declare const ChatScopeDegradedSchema: z.ZodObject<{
@@ -90,8 +91,8 @@ export declare const ChatSyncFanoutJobSchema: z.ZodObject<{
90
91
  revision: z.ZodNumber;
91
92
  status: z.ZodEnum<{
92
93
  pending: "pending";
93
- deadLetter: "deadLetter";
94
94
  complete: "complete";
95
+ deadLetter: "deadLetter";
95
96
  }>;
96
97
  attemptCount: z.ZodNumber;
97
98
  nextAttemptAt: z.ZodNumber;
@@ -147,9 +148,9 @@ export declare const ChatAdminActionCommandSchema: z.ZodObject<{
147
148
  expectedMessageRevision: z.ZodNumber;
148
149
  payloadHash: z.ZodString;
149
150
  state: z.ZodEnum<{
151
+ failed: "failed";
150
152
  applied: "applied";
151
153
  deadLetter: "deadLetter";
152
- failed: "failed";
153
154
  queued: "queued";
154
155
  delivering: "delivering";
155
156
  safetyRepair: "safetyRepair";
@@ -1 +1 @@
1
- {"version":3,"file":"chat-sync.d.ts","sourceRoot":"","sources":["../../src/doc-schemas/chat-sync.ts"],"names":[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;;;;;;;;;;;;;;;;;;;;;;iBAqCvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAgBlF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsB5C,CAAC;AACH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAK5F,eAAO,MAAM,2CAA2C;;;;;;;;;;;;;;iBAQtD,CAAC;AACH,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2CAA2C,CAAC,CAAC"}
@@ -23,6 +23,9 @@ export const ChatChannelAuthProjectionSchema = z.object({
23
23
  channelAuthVersion: z.number(),
24
24
  inputFingerprint: z.string(),
25
25
  updatedAt: z.number(),
26
+ // Reconcile cursor — advanced on every reconciler visit, including a no-op one, so a stuck
27
+ // window rotates. Absent until the reconciler first reaches the projection.
28
+ lastReconciledAt: z.number().optional(),
26
29
  });
27
30
  // ── chatScopeDegraded/{scopeKey} (+ causes/{causeId}) ───────────────────────
28
31
  // Exists IFF unresolvedCauseCount > 0. Grant mints fail closed while it exists.
@@ -1 +1 @@
1
- {"version":3,"file":"chat-sync.js","sourceRoot":"","sources":["../../src/doc-schemas/chat-sync.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,+EAA+E;AAC/E,gFAAgF;AAChF,mFAAmF;AACnF,+EAA+E;AAC/E,iFAAiF;AACjF,iFAAiF;AACjF,gEAAgE;AAEhE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,6GAA6G;AAC7G,MAAM,aAAa,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;AAE7C,+EAA+E;AAC/E,+EAA+E;AAC/E,MAAM,CAAC,MAAM,+BAA+B,GA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AE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClF,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE;IAC5B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,aAAa;CACxB,CAAC,CAAC;AAGH,gFAAgF;AAChF,iFAAiF;AACjF,yFAAyF;AACzF,MAAM,CAAC,MAAM,2CAA2C,GAAG,CAAC,CAAC,MAAM,CAAC;IAClE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxC,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACzC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;CACzC,CAAC,CAAC","sourcesContent":["// Chat realtime SYNC / projection / command Firestore schemas (chat-edge-rebuild P1).\n// The chat sync / projection / command (Firestore-side) field lists are FROZEN\n// here — this file is their single source; the durable design owner is ttt-prod\n// docs/design/chat-realtime-system.md. All of these collections are Admin-SDK-only\n// (`allow read, write: if false`). Per the TTT timestamp convention every time\n// field is epoch-ms `number`; the SINGLE exception is the native-TTL `expireAt`,\n// which is a real Firestore `Timestamp` (modeled as `unknown` so the drift-check\n// does not false-flag a Timestamp object against `z.number()`).\n\nimport { z } from 'zod';\nimport { systemRoleSchema } from '../schemas/atoms.js';\n\n/** Native-TTL field — a real Firestore Timestamp (NOT epoch-ms). Absent until the terminal that sets TTL. */\nconst expireAtField = z.unknown().optional();\n\n// ── chatChannelAuthProjections/{authPairKey} ────────────────────────────────\n// Per-(user, channel) authorization FACT. Absent ⇒ removed/deny (fail-closed).\nexport const ChatChannelAuthProjectionSchema = z.object({\n channelRefScope: z.enum(['channel', 'invite']),\n workProjectId: z.string().nullable(),\n guildChatChannelId: z.string().nullable(),\n guildInviteId: z.string().nullable(),\n uid: z.string(),\n channelKey: z.string(),\n channelAuthState: z.enum(['authorized', 'removed']),\n channelAuthVersion: z.number(),\n inputFingerprint: z.string(),\n updatedAt: z.number(),\n});\nexport type ChatChannelAuthProjection = z.infer<typeof ChatChannelAuthProjectionSchema>;\n\n// ── chatScopeDegraded/{scopeKey} (+ causes/{causeId}) ───────────────────────\n// Exists IFF unresolvedCauseCount > 0. Grant mints fail closed while it exists.\nexport const ChatScopeDegradedSchema = z.object({\n scopeKey: z.string(),\n scopeKind: z.enum(['channel', 'memberInWork']),\n // channel scope carries the channelRef tuple; memberInWork carries {uid, workProjectId}.\n workProjectId: z.string().nullable(),\n guildChatChannelId: z.string().nullable(),\n guildInviteId: z.string().nullable(),\n uid: z.string().nullable(),\n unresolvedCauseCount: z.number(),\n updatedAt: z.number(),\n});\nexport type ChatScopeDegraded = z.infer<typeof ChatScopeDegradedSchema>;\n\nexport const ChatScopeDegradedCauseSchema = z.object({\n causeId: z.string(),\n kind: z.enum(['syncEvent', 'fanoutJob']),\n ref: z.string(),\n deadLetteredAt: z.number(),\n});\nexport type ChatScopeDegradedCause = z.infer<typeof ChatScopeDegradedCauseSchema>;\n\n// ── chatSyncEvents/{eventId} ────────────────────────────────────────────────\nexport const ChatSyncEventSchema = z.object({\n eventId: z.string(),\n targetDo: z.string(),\n kind: z.enum(['channelAuth', 'accountAccess', 'config', 'serverMessage']),\n version: z.number(),\n payload: z.record(z.string(), z.unknown()).nullable(),\n tombstone: z.boolean().optional(),\n payloadHash: z.string(),\n status: z.enum(['pending', 'delivered', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n deliveredResult: z.record(z.string(), z.unknown()).nullable(),\n deliveredAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n expireAt: expireAtField,\n});\nexport type ChatSyncEvent = z.infer<typeof ChatSyncEventSchema>;\n\n// ── chatSyncFanoutJobs/{jobId} ──────────────────────────────────────────────\nexport const ChatSyncFanoutJobSchema = z.object({\n jobId: z.string(),\n selectorKind: z.enum(['channelMembers', 'workChannelsForUser', 'policyEditAffectedUsers']),\n selectorArgs: z.object({\n workProjectId: z.string().optional(),\n channelKey: z.string().optional(),\n uid: z.string().optional(),\n }),\n causeVersion: z.number(),\n cursor: z.object({ pageIndex: z.number(), lastDocId: z.string().nullable() }),\n revision: z.number(),\n status: z.enum(['pending', 'complete', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n completedAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n expireAt: expireAtField,\n});\nexport type ChatSyncFanoutJob = z.infer<typeof ChatSyncFanoutJobSchema>;\n\n// ── chatMessageOutbox/{commandId} ───────────────────────────────────────────\nexport const ChatMessageOutboxSchema = z.object({\n commandId: z.string(),\n kind: z.enum(['userMsg', 'systemMsg']),\n threadRef: z.string(),\n payload: z.record(z.string(), z.unknown()),\n payloadVersion: z.number(),\n status: z.enum(['pending', 'applied', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n appliedAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n expireAt: expireAtField,\n});\nexport type ChatMessageOutbox = z.infer<typeof ChatMessageOutboxSchema>;\n\n// ── chatAdminActionCommands/{requestId} ─────────────────────────────────────\n// `requestId` IS the doc id + DO dedup key. `delivering` is NOT a lease (it sets\n// nextAttemptAt = now + DELIVERY_TIMEOUT). terminalFailureGeneration default 0.\nexport const ChatAdminActionCommandSchema = z.object({\n requestId: z.string(),\n actorUid: z.string(),\n actorMode: z.enum(['adminReview', 'adminOverride']),\n systemRole: systemRoleSchema,\n channelRef: z.record(z.string(), z.unknown()),\n messageSeq: z.number(),\n action: z.enum(['hide', 'delete']),\n caseId: z.string(),\n reason: z.string(),\n expectedMessageRevision: z.number(),\n payloadHash: z.string(),\n // `safetyRepair` is the NONTERMINAL stall loop: a RESERVED command whose reconcile\n // leg (PROBE → FINALIZE) failed past ADMIN_COMMAND_MAX_ATTEMPTS. Drained like\n // `delivering`; never dead-letters.\n state: z.enum(['queued', 'delivering', 'safetyRepair', 'applied', 'failed', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n result: z.record(z.string(), z.unknown()).nullable(),\n doRevisionId: z.string().nullable(),\n terminalFailureGeneration: z.number(),\n createdAt: z.number(),\n appliedAt: z.number().nullable(),\n failedAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n reconciled: z.boolean(),\n reconciledAt: z.number().nullable(),\n safetyRepair: z.boolean(),\n // Monotonic counter of distinct entries into the safety-repair loop — keys the\n // per-entry idempotent failure audit.\n safetyRepairGeneration: z.number(),\n // Failed reconcile passes on an already-reserved command. Separate from\n // `attemptCount` (delivery attempts, which dead-letter); at the cap it escalates\n // once into `safetyRepair` instead of dead-lettering.\n reconcileAttemptCount: z.number(),\n expireAt: expireAtField,\n});\nexport type ChatAdminActionCommand = z.infer<typeof ChatAdminActionCommandSchema>;\n\n// ── chatHistoryAnonymizationJobs/{jobId} ────────────────────────────────────\n// Account-deletion history anonymization (Contract F; P8). Resumable + crash-safe:\n// the recorded source-manifest identity (key/hash/generation) + the three cursors\n// (scan/rewrite/delete) make every boundary restartable. jobId =\n// hash('chat-anonymize', channelDoId, epoch, anonymizedUid). `expireAt` (native TTL)\n// is set ONLY when the job reaches `done`.\n//\n// C-B1: the replacement generation is DO-OWNED — the Channel DO (single-threaded per\n// channel) allocates a DISTINCT monotonic generation per erasure off the epoch row and\n// rewrites against the CURRENT live manifest, so two erasures on one epoch chain instead\n// of colliding on a shared `anon-1` keyspace. These four fields are therefore RECORDED AT\n// SCAN (null until the DO reports/allocates them), not pinned at enqueue; if a concurrent\n// anonymization supersedes the source between scan and swap, the job resets to `scanning`\n// to re-derive against the new current manifest (keeping its own allocated generation).\nexport const ChatHistoryAnonymizationJobSchema = z.object({\n jobId: z.string(),\n channelDoId: z.string(),\n epoch: z.number(),\n anonymizedUid: z.string(),\n sourceManifestKey: z.string().nullable(),\n sourceManifestHash: z.string().nullable(),\n sourceGeneration: z.number().nullable(),\n replacementGeneration: z.number().nullable(),\n newManifestKey: z.string().nullable(),\n scanCursor: z.number(),\n rewriteCursor: z.number(),\n deleteCursor: z.number(),\n swappedAt: z.number().nullable(),\n state: z.enum(['scanning', 'rewriting', 'swapping', 'deleting', 'done', 'failed']),\n legalHoldPaused: z.boolean(),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n updatedAt: z.number(),\n expireAt: expireAtField,\n});\nexport type ChatHistoryAnonymizationJob = z.infer<typeof ChatHistoryAnonymizationJobSchema>;\n\n// ── chatHistoryAnonymizationJobs/{jobId}/affectedChunks/{chunkOrdinal} ───────\n// The non-contiguous affected-chunk set (round-16 finding 7) — a crash after the\n// manifest swap resumes deletion from these rows + `deleteCursor` without re-listing R2.\nexport const ChatHistoryAnonymizationAffectedChunkSchema = z.object({\n chunkOrdinal: z.number(),\n sourceChunkKey: z.string(),\n sourceSha256: z.string(),\n replacementChunkKey: z.string().nullable(),\n replacementSha256: z.string().nullable(),\n rewriteState: z.enum(['pending', 'done']),\n deleteState: z.enum(['pending', 'done']),\n});\nexport type ChatHistoryAnonymizationAffectedChunk = z.infer<typeof ChatHistoryAnonymizationAffectedChunkSchema>;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;IAC1C,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxC,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACzC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;CACzC,CAAC,CAAC","sourcesContent":["// Chat realtime SYNC / projection / command Firestore schemas (chat-edge-rebuild P1).\n// The chat sync / projection / command (Firestore-side) field lists are FROZEN\n// here — this file is their single source; the durable design owner is ttt-prod\n// docs/design/chat-realtime-system.md. All of these collections are Admin-SDK-only\n// (`allow read, write: if false`). Per the TTT timestamp convention every time\n// field is epoch-ms `number`; the SINGLE exception is the native-TTL `expireAt`,\n// which is a real Firestore `Timestamp` (modeled as `unknown` so the drift-check\n// does not false-flag a Timestamp object against `z.number()`).\n\nimport { z } from 'zod';\nimport { systemRoleSchema } from '../schemas/atoms.js';\n\n/** Native-TTL field — a real Firestore Timestamp (NOT epoch-ms). Absent until the terminal that sets TTL. */\nconst expireAtField = z.unknown().optional();\n\n// ── chatChannelAuthProjections/{authPairKey} ────────────────────────────────\n// Per-(user, channel) authorization FACT. Absent ⇒ removed/deny (fail-closed).\nexport const ChatChannelAuthProjectionSchema = z.object({\n channelRefScope: z.enum(['channel', 'invite']),\n workProjectId: z.string().nullable(),\n guildChatChannelId: z.string().nullable(),\n guildInviteId: z.string().nullable(),\n uid: z.string(),\n channelKey: z.string(),\n channelAuthState: z.enum(['authorized', 'removed']),\n channelAuthVersion: z.number(),\n inputFingerprint: z.string(),\n updatedAt: z.number(),\n // Reconcile cursor — advanced on every reconciler visit, including a no-op one, so a stuck\n // window rotates. Absent until the reconciler first reaches the projection.\n lastReconciledAt: z.number().optional(),\n});\nexport type ChatChannelAuthProjection = z.infer<typeof ChatChannelAuthProjectionSchema>;\n\n// ── chatScopeDegraded/{scopeKey} (+ causes/{causeId}) ───────────────────────\n// Exists IFF unresolvedCauseCount > 0. Grant mints fail closed while it exists.\nexport const ChatScopeDegradedSchema = z.object({\n scopeKey: z.string(),\n scopeKind: z.enum(['channel', 'memberInWork']),\n // channel scope carries the channelRef tuple; memberInWork carries {uid, workProjectId}.\n workProjectId: z.string().nullable(),\n guildChatChannelId: z.string().nullable(),\n guildInviteId: z.string().nullable(),\n uid: z.string().nullable(),\n unresolvedCauseCount: z.number(),\n updatedAt: z.number(),\n});\nexport type ChatScopeDegraded = z.infer<typeof ChatScopeDegradedSchema>;\n\nexport const ChatScopeDegradedCauseSchema = z.object({\n causeId: z.string(),\n kind: z.enum(['syncEvent', 'fanoutJob']),\n ref: z.string(),\n deadLetteredAt: z.number(),\n});\nexport type ChatScopeDegradedCause = z.infer<typeof ChatScopeDegradedCauseSchema>;\n\n// ── chatSyncEvents/{eventId} ────────────────────────────────────────────────\nexport const ChatSyncEventSchema = z.object({\n eventId: z.string(),\n targetDo: z.string(),\n kind: z.enum(['channelAuth', 'accountAccess', 'config', 'serverMessage']),\n version: z.number(),\n payload: z.record(z.string(), z.unknown()).nullable(),\n tombstone: z.boolean().optional(),\n payloadHash: z.string(),\n status: z.enum(['pending', 'delivered', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n deliveredResult: z.record(z.string(), z.unknown()).nullable(),\n deliveredAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n expireAt: expireAtField,\n});\nexport type ChatSyncEvent = z.infer<typeof ChatSyncEventSchema>;\n\n// ── chatSyncFanoutJobs/{jobId} ──────────────────────────────────────────────\nexport const ChatSyncFanoutJobSchema = z.object({\n jobId: z.string(),\n selectorKind: z.enum(['channelMembers', 'workChannelsForUser', 'policyEditAffectedUsers']),\n selectorArgs: z.object({\n workProjectId: z.string().optional(),\n channelKey: z.string().optional(),\n uid: z.string().optional(),\n }),\n causeVersion: z.number(),\n cursor: z.object({ pageIndex: z.number(), lastDocId: z.string().nullable() }),\n revision: z.number(),\n status: z.enum(['pending', 'complete', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n completedAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n expireAt: expireAtField,\n});\nexport type ChatSyncFanoutJob = z.infer<typeof ChatSyncFanoutJobSchema>;\n\n// ── chatMessageOutbox/{commandId} ───────────────────────────────────────────\nexport const ChatMessageOutboxSchema = z.object({\n commandId: z.string(),\n kind: z.enum(['userMsg', 'systemMsg']),\n threadRef: z.string(),\n payload: z.record(z.string(), z.unknown()),\n payloadVersion: z.number(),\n status: z.enum(['pending', 'applied', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n appliedAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n expireAt: expireAtField,\n});\nexport type ChatMessageOutbox = z.infer<typeof ChatMessageOutboxSchema>;\n\n// ── chatAdminActionCommands/{requestId} ─────────────────────────────────────\n// `requestId` IS the doc id + DO dedup key. `delivering` is NOT a lease (it sets\n// nextAttemptAt = now + DELIVERY_TIMEOUT). terminalFailureGeneration default 0.\nexport const ChatAdminActionCommandSchema = z.object({\n requestId: z.string(),\n actorUid: z.string(),\n actorMode: z.enum(['adminReview', 'adminOverride']),\n systemRole: systemRoleSchema,\n channelRef: z.record(z.string(), z.unknown()),\n messageSeq: z.number(),\n action: z.enum(['hide', 'delete']),\n caseId: z.string(),\n reason: z.string(),\n expectedMessageRevision: z.number(),\n payloadHash: z.string(),\n // `safetyRepair` is the NONTERMINAL stall loop: a RESERVED command whose reconcile\n // leg (PROBE → FINALIZE) failed past ADMIN_COMMAND_MAX_ATTEMPTS. Drained like\n // `delivering`; never dead-letters.\n state: z.enum(['queued', 'delivering', 'safetyRepair', 'applied', 'failed', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n result: z.record(z.string(), z.unknown()).nullable(),\n doRevisionId: z.string().nullable(),\n terminalFailureGeneration: z.number(),\n createdAt: z.number(),\n appliedAt: z.number().nullable(),\n failedAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n reconciled: z.boolean(),\n reconciledAt: z.number().nullable(),\n safetyRepair: z.boolean(),\n // Monotonic counter of distinct entries into the safety-repair loop — keys the\n // per-entry idempotent failure audit.\n safetyRepairGeneration: z.number(),\n // Failed reconcile passes on an already-reserved command. Separate from\n // `attemptCount` (delivery attempts, which dead-letter); at the cap it escalates\n // once into `safetyRepair` instead of dead-lettering.\n reconcileAttemptCount: z.number(),\n expireAt: expireAtField,\n});\nexport type ChatAdminActionCommand = z.infer<typeof ChatAdminActionCommandSchema>;\n\n// ── chatHistoryAnonymizationJobs/{jobId} ────────────────────────────────────\n// Account-deletion history anonymization (Contract F; P8). Resumable + crash-safe:\n// the recorded source-manifest identity (key/hash/generation) + the three cursors\n// (scan/rewrite/delete) make every boundary restartable. jobId =\n// hash('chat-anonymize', channelDoId, epoch, anonymizedUid). `expireAt` (native TTL)\n// is set ONLY when the job reaches `done`.\n//\n// C-B1: the replacement generation is DO-OWNED — the Channel DO (single-threaded per\n// channel) allocates a DISTINCT monotonic generation per erasure off the epoch row and\n// rewrites against the CURRENT live manifest, so two erasures on one epoch chain instead\n// of colliding on a shared `anon-1` keyspace. These four fields are therefore RECORDED AT\n// SCAN (null until the DO reports/allocates them), not pinned at enqueue; if a concurrent\n// anonymization supersedes the source between scan and swap, the job resets to `scanning`\n// to re-derive against the new current manifest (keeping its own allocated generation).\nexport const ChatHistoryAnonymizationJobSchema = z.object({\n jobId: z.string(),\n channelDoId: z.string(),\n epoch: z.number(),\n anonymizedUid: z.string(),\n sourceManifestKey: z.string().nullable(),\n sourceManifestHash: z.string().nullable(),\n sourceGeneration: z.number().nullable(),\n replacementGeneration: z.number().nullable(),\n newManifestKey: z.string().nullable(),\n scanCursor: z.number(),\n rewriteCursor: z.number(),\n deleteCursor: z.number(),\n swappedAt: z.number().nullable(),\n state: z.enum(['scanning', 'rewriting', 'swapping', 'deleting', 'done', 'failed']),\n legalHoldPaused: z.boolean(),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n updatedAt: z.number(),\n expireAt: expireAtField,\n});\nexport type ChatHistoryAnonymizationJob = z.infer<typeof ChatHistoryAnonymizationJobSchema>;\n\n// ── chatHistoryAnonymizationJobs/{jobId}/affectedChunks/{chunkOrdinal} ───────\n// The non-contiguous affected-chunk set (round-16 finding 7) — a crash after the\n// manifest swap resumes deletion from these rows + `deleteCursor` without re-listing R2.\nexport const ChatHistoryAnonymizationAffectedChunkSchema = z.object({\n chunkOrdinal: z.number(),\n sourceChunkKey: z.string(),\n sourceSha256: z.string(),\n replacementChunkKey: z.string().nullable(),\n replacementSha256: z.string().nullable(),\n rewriteState: z.enum(['pending', 'done']),\n deleteState: z.enum(['pending', 'done']),\n});\nexport type ChatHistoryAnonymizationAffectedChunk = z.infer<typeof ChatHistoryAnonymizationAffectedChunkSchema>;\n"]}
@@ -4,8 +4,8 @@ export declare const CommissionAttachmentSchema: z.ZodObject<{
4
4
  name: z.ZodString;
5
5
  mediaAssetId: z.ZodString;
6
6
  type: z.ZodEnum<{
7
- video: "video";
8
7
  image: "image";
8
+ video: "video";
9
9
  audio: "audio";
10
10
  }>;
11
11
  size: z.ZodNumber;
@@ -20,8 +20,8 @@ export declare const FullCommissionListingSchema: z.ZodObject<{
20
20
  name: z.ZodString;
21
21
  mediaAssetId: z.ZodString;
22
22
  type: z.ZodEnum<{
23
- video: "video";
24
23
  image: "image";
24
+ video: "video";
25
25
  audio: "audio";
26
26
  }>;
27
27
  size: z.ZodNumber;
@@ -40,6 +40,7 @@ export declare const FullCommissionListingSchema: z.ZodObject<{
40
40
  open: "open";
41
41
  closed: "closed";
42
42
  }>;
43
+ closedAt: z.ZodOptional<z.ZodNumber>;
43
44
  savedProposalArtisans: z.ZodArray<z.ZodString>;
44
45
  shortId: z.ZodOptional<z.ZodString>;
45
46
  shortUrl: z.ZodOptional<z.ZodString>;
@@ -58,10 +59,10 @@ export declare const CommissionProposalSchema: z.ZodObject<{
58
59
  }, z.core.$strip>;
59
60
  createdOn: z.ZodNumber;
60
61
  status: z.ZodEnum<{
62
+ rejected: "rejected";
61
63
  accepted: "accepted";
62
64
  open: "open";
63
65
  invited: "invited";
64
- rejected: "rejected";
65
66
  }>;
66
67
  guildInviteId: z.ZodOptional<z.ZodString>;
67
68
  invitedOn: z.ZodOptional<z.ZodNumber>;
@@ -86,10 +87,10 @@ export declare const CreateCommissionProposalTextResultSchema: z.ZodObject<{
86
87
  }, z.core.$strip>;
87
88
  createdOn: z.ZodNumber;
88
89
  status: z.ZodEnum<{
90
+ rejected: "rejected";
89
91
  accepted: "accepted";
90
92
  open: "open";
91
93
  invited: "invited";
92
- rejected: "rejected";
93
94
  }>;
94
95
  guildInviteId: z.ZodOptional<z.ZodString>;
95
96
  invitedOn: z.ZodOptional<z.ZodNumber>;
@@ -129,10 +130,10 @@ export declare const AuditionSchema: z.ZodObject<{
129
130
  curated: "curated";
130
131
  }>>;
131
132
  curatedAssemblyStatus: z.ZodOptional<z.ZodEnum<{
133
+ failed: "failed";
132
134
  closed: "closed";
133
135
  assembling: "assembling";
134
136
  ready: "ready";
135
- failed: "failed";
136
137
  }>>;
137
138
  expectedOptionCount: z.ZodOptional<z.ZodNumber>;
138
139
  curatedFailureReason: z.ZodOptional<z.ZodString>;
@@ -143,6 +144,7 @@ export declare const AuditionSchema: z.ZodObject<{
143
144
  closed: "closed";
144
145
  pendingReview: "pendingReview";
145
146
  }>;
147
+ closedAt: z.ZodOptional<z.ZodNumber>;
146
148
  auditionEntryCount: z.ZodOptional<z.ZodNumber>;
147
149
  shortId: z.ZodOptional<z.ZodString>;
148
150
  shortUrl: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"commissions.d.ts","sourceRoot":"","sources":["../../src/doc-schemas/commissions.ts"],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AM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -35,6 +35,7 @@ export const FullCommissionListingSchema = z.object({
35
35
  type: z.string(),
36
36
  }),
37
37
  status: z.enum(['open', 'closed']),
38
+ closedAt: z.number().optional(), // set by the close write, together with status 'closed'
38
39
  savedProposalArtisans: z.array(z.string()),
39
40
  shortId: z.string().optional(),
40
41
  shortUrl: z.string().optional(),
@@ -116,6 +117,7 @@ export const AuditionSchema = z.object({
116
117
  sponsoredAuditionAmountUSD: z.number().optional(),
117
118
  stakeSharesOffered: z.number().optional(),
118
119
  status: z.enum(['open', 'closed', 'pendingReview']),
120
+ closedAt: z.number().optional(), // set by the close write, together with status 'closed'
119
121
  auditionEntryCount: z.number().optional(),
120
122
  shortId: z.string().optional(),
121
123
  shortUrl: z.string().optional(),
@@ -1 +1 @@
1
- {"version":3,"file":"commissions.js","sourceRoot":"","sources":["../../src/doc-schemas/commissions.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,qFAAqF;AACrF,iDAAiD;AAEjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAEpD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,+EAA+E;IAC/E,yFAAyF;IACzF,wFAAwF;IACxF,8CAA8C;IAC9C,IAAI,EAAE,sBAAsB;IAC5B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AM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,uBAAuB,EAAE,CAAC,CAAC,MAAM,EAAE;IACnC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,2BAA2B,EAAE,aAAa;CAC3C,CAAC,CAAC","sourcesContent":["// Commission + Audition Firestore document SCHEMAS — commissionListings/{id} and its\n// commissionProposals, auditionBoard/{id} and its auditionEntries, plus the per-user\n// auditionVotes doc. Types inferred via z.infer.\n\nimport { z } from 'zod';\nimport { CommissionProposalStatusSchema } from '../schemas/commissions.js';\nimport { ContentMediaKindSchema } from './media-assets.js';\n\nconst userRefSchema = z.object({ uid: z.string() });\n\nexport const CommissionAttachmentSchema = z.object({\n pendingMediaId: z.string().optional(),\n name: z.string(),\n mediaAssetId: z.string(),\n // The stored content kind (image/video/audio). Set once by the upload pipeline\n // (getSimplifiedMediaType) and written by the commissionListingMedia publication adapter\n // as z.enum(['image','video','audio']); derived here from the ONE canonical stored-kind\n // union (ARCH-102), never a widened `string`.\n type: ContentMediaKindSchema,\n size: z.number(),\n});\nexport type CommissionAttachment = z.infer<typeof CommissionAttachmentSchema>;\n\nexport const FullCommissionListingSchema = z.object({\n commissionListingId: z.string(),\n title: z.string(),\n description: z.string(),\n commissionAttachment: CommissionAttachmentSchema.optional(),\n requiredTradeProfessions: z.array(z.string()),\n stakeSharesOffered: z.number(),\n createdAt: z.number(),\n createdBy: userRefSchema,\n // Work reference only — title/description are NOT snapshotted (Display Identity Invariant:\n // resolve at render from publicWorkProjects by id, fallback label if the work is gone).\n // `type` (Tales/Tunes/Television) is an immutable classification, not display text, and IS\n // consumed by a commission-board type filter/index, so it stays — mirroring the\n // GuildInviteConversation `workProject: { workProjectId, type }` precedent.\n workProjectAssociatedWith: z.object({\n workProjectId: z.string(),\n type: z.string(),\n }),\n status: z.enum(['open', 'closed']),\n savedProposalArtisans: z.array(z.string()),\n shortId: z.string().optional(),\n shortUrl: z.string().optional(),\n // Admin moderation hide (reversible). When true the listing is suppressed from\n // the commission board; restored by clearing it.\n hidden: z.boolean(),\n});\nexport type FullCommissionListing = z.infer<typeof FullCommissionListingSchema>;\n\nexport const CommissionProposalSchema = z.object({\n commissionProposalId: z.string(),\n commissionListingId: z.string(),\n workProjectId: z.string(),\n proposalText: z.string(),\n proposalFileAssetId: z.string().optional(),\n proposalFileType: z.string().optional(),\n createdBy: userRefSchema,\n createdOn: z.number(),\n status: CommissionProposalStatusSchema,\n guildInviteId: z.string().optional(),\n invitedOn: z.number().optional(),\n acceptedOn: z.number().optional(),\n rejectedAt: z.number().optional(),\n // [EUAS-006] Admin moderation hide (reversible) — matches the listing/audition/entry pattern. When\n // true the proposal's TEXT is suppressed from the board (tombstoned for ordinary viewers); restored\n // by clearing it. Optional so existing/seeded proposals don't need backfilling pre-launch.\n hidden: z.boolean().optional(),\n});\nexport type CommissionProposal = z.infer<typeof CommissionProposalSchema>;\n\n// Authoritative result of the createCommissionProposalText callable — the created item,\n// exactly as the transaction committed it; the client seeds its proposal caches from this\n// instead of refetching. Declared HERE (not schemas/commissions.ts) because it composes\n// CommissionProposalSchema and this module already imports schemas/commissions.js\n// (CommissionProposalStatusSchema) — the reverse runtime import would be a module cycle.\n// Re-exported on the ./schemas subpath via schemas/index.ts. Non-strict (server → client\n// result posture).\nexport const CreateCommissionProposalTextResultSchema = z.object({\n success: z.literal(true),\n commissionListingId: z.string().min(1),\n commissionProposalId: z.string().min(1),\n /** The proposal doc exactly as committed. */\n proposal: CommissionProposalSchema,\n});\nexport type CreateCommissionProposalTextResult = z.infer<typeof CreateCommissionProposalTextResultSchema>;\n\nexport const AuditionTypeSchema = z.enum(['platformAudition', 'sponsoredAudition', 'workAudition']);\nexport type AuditionType = z.infer<typeof AuditionTypeSchema>;\n\nexport const AuditionSchema = z.object({\n auditionId: z.string(),\n type: AuditionTypeSchema,\n title: z.string(),\n description: z.string(),\n videoAssetId: z.string(),\n // Auditions are VIDEO ONLY (DJ ruling). Paired with the required videoAssetId (both\n // always present — the MEDIA-101 shape, not a required-asset/optional-kind mismatch),\n // derived from the ONE canonical stored-kind union narrowed to video — never an inline\n // re-declared union (ARCH-102).\n mediaType: ContentMediaKindSchema.extract(['video']),\n openTill: z.number(),\n createdOn: z.number(),\n createdBy: userRefSchema,\n workProjectId: z.string().optional(),\n // Curated vs open. 'open' (default when absent — existing auditions): anyone may post reply\n // entries AND vote. 'curated': the creating work posts the option entries itself (min 2, max 8,\n // each `isCreatorOption: true`) and users may ONLY vote — community reply entries are rejected.\n mode: z.enum(['open', 'curated']).optional(),\n // Curated atomic-reveal state (only meaningful when mode === 'curated'). The prompt + all N option\n // videos upload as ONE fixed batch; the audition stays non-votable + off the public board until the\n // WHOLE batch is live and every video passed moderation:\n // 'assembling' — batch still processing/moderating; not votable, not on the board (status stays\n // 'pendingReview'), only the creator sees a \"preparing…\" state.\n // 'ready' — all N+1 landed and approved; app flips status → 'open' and the audition reveals.\n // 'failed' — any video in the batch was rejected by moderation; the whole audition fails.\n // status stays non-open; only the creator sees it (on the project page) to Edit &\n // resubmit or Discard.\n // 'closed' — a curated audition that was closed (by its creator or an admin) after reveal;\n // terminal, kept for record. Distinct from the pre-reveal assembly states above.\n curatedAssemblyStatus: z.enum(['assembling', 'ready', 'failed', 'closed']).optional(),\n // The fixed number of creator option videos submitted at create-time (2..8). Used to know when the\n // whole batch has landed (all expected entries approved → reveal).\n expectedOptionCount: z.number().int().optional(),\n // Set when curatedAssemblyStatus === 'failed': which video was rejected, for the creator-only\n // failed-audition surface on the project page.\n curatedFailureReason: z.string().optional(),\n sponsoredAuditionAmountUSD: z.number().optional(),\n stakeSharesOffered: z.number().optional(),\n status: z.enum(['open', 'closed', 'pendingReview']),\n auditionEntryCount: z.number().optional(),\n shortId: z.string().optional(),\n shortUrl: z.string().optional(),\n // Admin moderation hide (reversible). When true the audition is suppressed from\n // the audition board; restored by clearing it.\n hidden: z.boolean(),\n});\nexport type Audition = z.infer<typeof AuditionSchema>;\n\nexport const AuditionEntrySchema = z.object({\n auditionEntryId: z.string(),\n auditionId: z.string(),\n workProjectId: z.string().optional(),\n videoAssetId: z.string(),\n // Audition entries are VIDEO ONLY (DJ ruling) — same video-only pairing as the audition\n // prompt above; derived from the canonical stored-kind union narrowed to video.\n mediaType: ContentMediaKindSchema.extract(['video']),\n createdBy: userRefSchema,\n createdAt: z.number(),\n votes: z.number(),\n shortId: z.string().optional(),\n shortUrl: z.string().optional(),\n // Curated-mode option: true when this entry is a work-authored voting option on a\n // `mode: 'curated'` audition (posted by the creating work at creation), not a community reply.\n isCreatorOption: z.boolean().optional(),\n // Admin moderation hide (reversible). When true the entry is suppressed from the\n // audition's entry list; restored by clearing it.\n hidden: z.boolean(),\n});\nexport type AuditionEntry = z.infer<typeof AuditionEntrySchema>;\n\nexport const UserAuditionVoteSchema = z.object({\n votedForAuditionEntryId: z.string(),\n votedOn: z.number(),\n auditionEntryArtisanCreator: userRefSchema,\n});\nexport type UserAuditionVote = z.infer<typeof UserAuditionVoteSchema>;\n"]}
1
+ {"version":3,"file":"commissions.js","sourceRoot":"","sources":["../../src/doc-schemas/commissions.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,qFAAqF;AACrF,iDAAiD;AAEjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAEpD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,+EAA+E;IAC/E,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AE,CAAC,QAAQ,EAAE;IAC/B,kFAAkF;IAClF,+FAA+F;IAC/F,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACvC,iFAAiF;IACjF,kDAAkD;IAClD,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;CACpB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,uBAAuB,EAAE,CAAC,CAAC,MAAM,EAAE;IACnC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,2BAA2B,EAAE,aAAa;CAC3C,CAAC,CAAC","sourcesContent":["// Commission + Audition Firestore document SCHEMAS — commissionListings/{id} and its\n// commissionProposals, auditionBoard/{id} and its auditionEntries, plus the per-user\n// auditionVotes doc. Types inferred via z.infer.\n\nimport { z } from 'zod';\nimport { CommissionProposalStatusSchema } from '../schemas/commissions.js';\nimport { ContentMediaKindSchema } from './media-assets.js';\n\nconst userRefSchema = z.object({ uid: z.string() });\n\nexport const CommissionAttachmentSchema = z.object({\n pendingMediaId: z.string().optional(),\n name: z.string(),\n mediaAssetId: z.string(),\n // The stored content kind (image/video/audio). Set once by the upload pipeline\n // (getSimplifiedMediaType) and written by the commissionListingMedia publication adapter\n // as z.enum(['image','video','audio']); derived here from the ONE canonical stored-kind\n // union (ARCH-102), never a widened `string`.\n type: ContentMediaKindSchema,\n size: z.number(),\n});\nexport type CommissionAttachment = z.infer<typeof CommissionAttachmentSchema>;\n\nexport const FullCommissionListingSchema = z.object({\n commissionListingId: z.string(),\n title: z.string(),\n description: z.string(),\n commissionAttachment: CommissionAttachmentSchema.optional(),\n requiredTradeProfessions: z.array(z.string()),\n stakeSharesOffered: z.number(),\n createdAt: z.number(),\n createdBy: userRefSchema,\n // Work reference only — title/description are NOT snapshotted (Display Identity Invariant:\n // resolve at render from publicWorkProjects by id, fallback label if the work is gone).\n // `type` (Tales/Tunes/Television) is an immutable classification, not display text, and IS\n // consumed by a commission-board type filter/index, so it stays — mirroring the\n // GuildInviteConversation `workProject: { workProjectId, type }` precedent.\n workProjectAssociatedWith: z.object({\n workProjectId: z.string(),\n type: z.string(),\n }),\n status: z.enum(['open', 'closed']),\n closedAt: z.number().optional(), // set by the close write, together with status 'closed'\n savedProposalArtisans: z.array(z.string()),\n shortId: z.string().optional(),\n shortUrl: z.string().optional(),\n // Admin moderation hide (reversible). When true the listing is suppressed from\n // the commission board; restored by clearing it.\n hidden: z.boolean(),\n});\nexport type FullCommissionListing = z.infer<typeof FullCommissionListingSchema>;\n\nexport const CommissionProposalSchema = z.object({\n commissionProposalId: z.string(),\n commissionListingId: z.string(),\n workProjectId: z.string(),\n proposalText: z.string(),\n proposalFileAssetId: z.string().optional(),\n proposalFileType: z.string().optional(),\n createdBy: userRefSchema,\n createdOn: z.number(),\n status: CommissionProposalStatusSchema,\n guildInviteId: z.string().optional(),\n invitedOn: z.number().optional(),\n acceptedOn: z.number().optional(),\n rejectedAt: z.number().optional(),\n // [EUAS-006] Admin moderation hide (reversible) — matches the listing/audition/entry pattern. When\n // true the proposal's TEXT is suppressed from the board (tombstoned for ordinary viewers); restored\n // by clearing it. Optional so existing/seeded proposals don't need backfilling pre-launch.\n hidden: z.boolean().optional(),\n});\nexport type CommissionProposal = z.infer<typeof CommissionProposalSchema>;\n\n// Authoritative result of the createCommissionProposalText callable — the created item,\n// exactly as the transaction committed it; the client seeds its proposal caches from this\n// instead of refetching. Declared HERE (not schemas/commissions.ts) because it composes\n// CommissionProposalSchema and this module already imports schemas/commissions.js\n// (CommissionProposalStatusSchema) — the reverse runtime import would be a module cycle.\n// Re-exported on the ./schemas subpath via schemas/index.ts. Non-strict (server → client\n// result posture).\nexport const CreateCommissionProposalTextResultSchema = z.object({\n success: z.literal(true),\n commissionListingId: z.string().min(1),\n commissionProposalId: z.string().min(1),\n /** The proposal doc exactly as committed. */\n proposal: CommissionProposalSchema,\n});\nexport type CreateCommissionProposalTextResult = z.infer<typeof CreateCommissionProposalTextResultSchema>;\n\nexport const AuditionTypeSchema = z.enum(['platformAudition', 'sponsoredAudition', 'workAudition']);\nexport type AuditionType = z.infer<typeof AuditionTypeSchema>;\n\nexport const AuditionSchema = z.object({\n auditionId: z.string(),\n type: AuditionTypeSchema,\n title: z.string(),\n description: z.string(),\n videoAssetId: z.string(),\n // Auditions are VIDEO ONLY (DJ ruling). Paired with the required videoAssetId (both\n // always present — the MEDIA-101 shape, not a required-asset/optional-kind mismatch),\n // derived from the ONE canonical stored-kind union narrowed to video — never an inline\n // re-declared union (ARCH-102).\n mediaType: ContentMediaKindSchema.extract(['video']),\n openTill: z.number(),\n createdOn: z.number(),\n createdBy: userRefSchema,\n workProjectId: z.string().optional(),\n // Curated vs open. 'open' (default when absent — existing auditions): anyone may post reply\n // entries AND vote. 'curated': the creating work posts the option entries itself (min 2, max 8,\n // each `isCreatorOption: true`) and users may ONLY vote — community reply entries are rejected.\n mode: z.enum(['open', 'curated']).optional(),\n // Curated atomic-reveal state (only meaningful when mode === 'curated'). The prompt + all N option\n // videos upload as ONE fixed batch; the audition stays non-votable + off the public board until the\n // WHOLE batch is live and every video passed moderation:\n // 'assembling' — batch still processing/moderating; not votable, not on the board (status stays\n // 'pendingReview'), only the creator sees a \"preparing…\" state.\n // 'ready' — all N+1 landed and approved; app flips status → 'open' and the audition reveals.\n // 'failed' — any video in the batch was rejected by moderation; the whole audition fails.\n // status stays non-open; only the creator sees it (on the project page) to Edit &\n // resubmit or Discard.\n // 'closed' — a curated audition that was closed (by its creator or an admin) after reveal;\n // terminal, kept for record. Distinct from the pre-reveal assembly states above.\n curatedAssemblyStatus: z.enum(['assembling', 'ready', 'failed', 'closed']).optional(),\n // The fixed number of creator option videos submitted at create-time (2..8). Used to know when the\n // whole batch has landed (all expected entries approved → reveal).\n expectedOptionCount: z.number().int().optional(),\n // Set when curatedAssemblyStatus === 'failed': which video was rejected, for the creator-only\n // failed-audition surface on the project page.\n curatedFailureReason: z.string().optional(),\n sponsoredAuditionAmountUSD: z.number().optional(),\n stakeSharesOffered: z.number().optional(),\n status: z.enum(['open', 'closed', 'pendingReview']),\n closedAt: z.number().optional(), // set by the close write, together with status 'closed'\n auditionEntryCount: z.number().optional(),\n shortId: z.string().optional(),\n shortUrl: z.string().optional(),\n // Admin moderation hide (reversible). When true the audition is suppressed from\n // the audition board; restored by clearing it.\n hidden: z.boolean(),\n});\nexport type Audition = z.infer<typeof AuditionSchema>;\n\nexport const AuditionEntrySchema = z.object({\n auditionEntryId: z.string(),\n auditionId: z.string(),\n workProjectId: z.string().optional(),\n videoAssetId: z.string(),\n // Audition entries are VIDEO ONLY (DJ ruling) — same video-only pairing as the audition\n // prompt above; derived from the canonical stored-kind union narrowed to video.\n mediaType: ContentMediaKindSchema.extract(['video']),\n createdBy: userRefSchema,\n createdAt: z.number(),\n votes: z.number(),\n shortId: z.string().optional(),\n shortUrl: z.string().optional(),\n // Curated-mode option: true when this entry is a work-authored voting option on a\n // `mode: 'curated'` audition (posted by the creating work at creation), not a community reply.\n isCreatorOption: z.boolean().optional(),\n // Admin moderation hide (reversible). When true the entry is suppressed from the\n // audition's entry list; restored by clearing it.\n hidden: z.boolean(),\n});\nexport type AuditionEntry = z.infer<typeof AuditionEntrySchema>;\n\nexport const UserAuditionVoteSchema = z.object({\n votedForAuditionEntryId: z.string(),\n votedOn: z.number(),\n auditionEntryArtisanCreator: userRefSchema,\n});\nexport type UserAuditionVote = z.infer<typeof UserAuditionVoteSchema>;\n"]}