@ttt-productions/ttt-core 0.78.20 → 0.78.22

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 (78) hide show
  1. package/dist/constants/admin-labels.d.ts +1 -1
  2. package/dist/constants/admin-labels.js +2 -2
  3. package/dist/constants/admin-labels.js.map +1 -1
  4. package/dist/constants/center-stage-rooms.js +1 -1
  5. package/dist/constants/center-stage-rooms.js.map +1 -1
  6. package/dist/constants/company-mascots.js +1 -1
  7. package/dist/constants/company-mascots.js.map +1 -1
  8. package/dist/constants/index.d.ts +1 -0
  9. package/dist/constants/index.d.ts.map +1 -1
  10. package/dist/constants/index.js +1 -0
  11. package/dist/constants/index.js.map +1 -1
  12. package/dist/constants/media-processing.d.ts +13 -0
  13. package/dist/constants/media-processing.d.ts.map +1 -0
  14. package/dist/constants/media-processing.js +18 -0
  15. package/dist/constants/media-processing.js.map +1 -0
  16. package/dist/constants/publish-attestations.js +1 -1
  17. package/dist/constants/publish-attestations.js.map +1 -1
  18. package/dist/constants/safety-confirmation-phrases.js +1 -1
  19. package/dist/constants/safety-confirmation-phrases.js.map +1 -1
  20. package/dist/doc-schemas/account-deletion.js +1 -1
  21. package/dist/doc-schemas/account-deletion.js.map +1 -1
  22. package/dist/doc-schemas/moderation.d.ts +2 -0
  23. package/dist/doc-schemas/moderation.d.ts.map +1 -1
  24. package/dist/doc-schemas/registry.d.ts +18 -0
  25. package/dist/doc-schemas/registry.d.ts.map +1 -1
  26. package/dist/doc-schemas/registry.js +1 -1
  27. package/dist/doc-schemas/registry.js.map +1 -1
  28. package/dist/doc-schemas/safety/age.js +1 -1
  29. package/dist/doc-schemas/safety/age.js.map +1 -1
  30. package/dist/doc-schemas/safety/evidence.js +1 -1
  31. package/dist/doc-schemas/safety/evidence.js.map +1 -1
  32. package/dist/doc-schemas/safety/foundation.d.ts +3 -3
  33. package/dist/doc-schemas/safety/foundation.d.ts.map +1 -1
  34. package/dist/doc-schemas/safety/foundation.js +3 -3
  35. package/dist/doc-schemas/safety/foundation.js.map +1 -1
  36. package/dist/doc-schemas/square-announcement-jobs.d.ts +1 -1
  37. package/dist/doc-schemas/square-announcement-jobs.js +2 -2
  38. package/dist/doc-schemas/square-announcement-jobs.js.map +1 -1
  39. package/dist/media/pending-media.d.ts +32 -0
  40. package/dist/media/pending-media.d.ts.map +1 -1
  41. package/dist/media/target-info.js +1 -1
  42. package/dist/media/target-info.js.map +1 -1
  43. package/dist/paths/collections.js +2 -2
  44. package/dist/paths/collections.js.map +1 -1
  45. package/dist/paths/path-builders.js +1 -1
  46. package/dist/paths/path-builders.js.map +1 -1
  47. package/dist/paths/related-ids.js +1 -1
  48. package/dist/paths/related-ids.js.map +1 -1
  49. package/dist/safety/active-safety-case-alert.js +1 -1
  50. package/dist/safety/active-safety-case-alert.js.map +1 -1
  51. package/dist/safety/ncii-intake-derivations.js +1 -1
  52. package/dist/safety/ncii-intake-derivations.js.map +1 -1
  53. package/dist/safety/resource-keys.js +1 -1
  54. package/dist/safety/resource-keys.js.map +1 -1
  55. package/dist/schemas/chat.js +1 -1
  56. package/dist/schemas/chat.js.map +1 -1
  57. package/dist/schemas/craft-skills.js +1 -1
  58. package/dist/schemas/craft-skills.js.map +1 -1
  59. package/dist/schemas/hall-library.js +1 -1
  60. package/dist/schemas/hall-library.js.map +1 -1
  61. package/dist/schemas/notification.js +1 -1
  62. package/dist/schemas/notification.js.map +1 -1
  63. package/dist/schemas/safety.d.ts +1 -1
  64. package/dist/schemas/safety.js +1 -1
  65. package/dist/schemas/safety.js.map +1 -1
  66. package/dist/types/admin-ops.d.ts +1 -1
  67. package/dist/types/admin-ops.d.ts.map +1 -1
  68. package/dist/types/admin-ops.js +1 -1
  69. package/dist/types/admin-ops.js.map +1 -1
  70. package/dist/types/admin-users.js +1 -1
  71. package/dist/types/admin-users.js.map +1 -1
  72. package/dist/types/social.d.ts +1 -1
  73. package/dist/types/social.js.map +1 -1
  74. package/dist/upload-variables/create-admin-audition-variables.js +1 -1
  75. package/dist/upload-variables/create-admin-audition-variables.js.map +1 -1
  76. package/dist/upload-variables/create-work-project-audition-variables.js +1 -1
  77. package/dist/upload-variables/create-work-project-audition-variables.js.map +1 -1
  78. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/schemas/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,kCAAkC,EAClC,yCAAyC,GAC1C,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,iCAAiC,EACjC,sCAAsC,EACtC,iCAAiC,GAClC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,aAAa,GACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAE5E,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD,aAAa,EAAE,mBAAmB;IAClC,kBAAkB,EAAE,wBAAwB;CAC7C,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ,gGAAgG;AAChG,kGAAkG;AAClG,yFAAyF;AACzF,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACxD,aAAa,EAAE,mBAAmB;IAClC,kBAAkB,EAAE,wBAAwB;CAC7C,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACxD,aAAa,EAAE,mBAAmB;IAClC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,kCAAkC,CAAC;IACtE,WAAW,EAAE,CAAC,CAAC,MAAM,EA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ILD_CHAT_CHANNEL_NAME_LENGTH,\n MAX_GUILD_CHAT_CHANNEL_DESCRIPTION_LENGTH,\n} from '../constants/chat.js';\nimport {\n MAX_ADMIN_DISPATCH_SUBJECT_LENGTH,\n MAX_ADMIN_DISPATCH_INITIAL_TEXT_LENGTH,\n MAX_CHAT_MODERATION_REASON_LENGTH,\n} from '../constants/business.js';\nimport {\n ReplyToSchema,\n} from '@ttt-productions/chat-schemas';\nimport { AdminDispatchContextRefSchema } from '../doc-schemas/messaging.js';\n\nexport const ArchiveGuildChatChannelInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n guildChatChannelId: guildChatChannelIdSchema,\n}).strict();\nexport type ArchiveGuildChatChannelInput = z.infer<typeof ArchiveGuildChatChannelInputSchema>;\n\n// Tombstone (delete) a guild chat channel — same input shape as archive. The callable marks the\n// channel `isDeleted`, bumps configVersion, revokes grants, and re-projects members to `removed`;\n// storage is retained (never a physical purge). See docs/design/chat-realtime-system.md.\nexport const DeleteGuildChatChannelInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n guildChatChannelId: guildChatChannelIdSchema,\n}).strict();\nexport type DeleteGuildChatChannelInput = z.infer<typeof DeleteGuildChatChannelInputSchema>;\n\nexport const CreateGuildChatChannelInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n channelName: z.string().min(1).max(MAX_GUILD_CHAT_CHANNEL_NAME_LENGTH),\n description: z.string().max(MAX_GUILD_CHAT_CHANNEL_DESCRIPTION_LENGTH).optional(),\n requiredGuildStandings: z.array(z.string().min(1).max(64)).max(20),\n allowedUserIds: z.array(z.string().min(1).max(128)).max(500),\n}).strict();\nexport type CreateGuildChatChannelInput = z.infer<typeof CreateGuildChatChannelInputSchema>;\n\n// Guild channels + invite threads moved to the realtime chat (Cloudflare DOs), which\n// sends through the DO client — NOT this callable. The Firestore send path is retained\n// PERMANENTLY for admin-support threads only (docs/design/chat-realtime-system.md).\nexport const SendGuildChatMessageInputSchema = z.object({\n threadKind: z.literal('adminSupport'),\n adminDispatchId: adminDispatchIdSchema,\n isUserReply: z.boolean(),\n text: z.string().max(MAX_CHAT_MESSAGE_LENGTH),\n replyTo: ReplyToSchema.optional(),\n}).strict();\nexport type SendGuildChatMessageInput = z.infer<typeof SendGuildChatMessageInputSchema>;\n\n// Wire result contract for the sendGuildChatMessage callable — what the CLIENT relies on.\n// The backend core's internal result type extends this with composition-only\n// inline-materialize fields (backend↔backend contract; see runSendGuildChatMessage) —\n// those extra fields may appear on the wire and are not part of the client contract,\n// so this schema is deliberately non-strict.\nexport const SendGuildChatMessageResultSchema = z.object({\n success: z.literal(true),\n messageId: z.string().min(1),\n messageDocPath: z.string().min(1),\n});\nexport type SendGuildChatMessageResult = z.infer<typeof SendGuildChatMessageResultSchema>;\n\n// Subject/initial-text share the admin-dispatch caps (the \"contact admin\" composer\n// enforces them) — the old MAX_CHAT_MESSAGE_LENGTH bound let a 4000-char SUBJECT through.\nexport const StartAdminSupportThreadInputSchema = z.object({\n subject: z.string().min(1).max(MAX_ADMIN_DISPATCH_SUBJECT_LENGTH),\n initialMessage: z.string().min(1).max(MAX_ADMIN_DISPATCH_INITIAL_TEXT_LENGTH),\n}).strict();\nexport type StartAdminSupportThreadInput = z.infer<typeof StartAdminSupportThreadInputSchema>;\n\n// Authoritative result of startAdminSupportThread — both ids are minted inside the\n// creating transaction. Non-strict (server → client result posture).\nexport const StartAdminSupportThreadResultSchema = z.object({\n success: z.literal(true),\n adminDispatchId: z.string().min(1),\n /** Doc id of the initial conversation message. */\n messageId: z.string().min(1),\n});\nexport type StartAdminSupportThreadResult = z.infer<typeof StartAdminSupportThreadResultSchema>;\n\n// Member-initiated workProject → admin correspondence thread (party-generic dispatch,\n// partyKind 'workProject'). Initiating is a Work ACTION (`adminDispatch.start`, Rule 23);\n// the callable enforces the one-open-work-initiated-thread spam guard. `contextRef` is\n// server-validated against the workProject before it is stored.\nexport const StartWorkProjectAdminSupportThreadInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n subject: z.string().min(1).max(MAX_ADMIN_DISPATCH_SUBJECT_LENGTH),\n initialMessage: z.string().min(1).max(MAX_ADMIN_DISPATCH_INITIAL_TEXT_LENGTH),\n contextRef: AdminDispatchContextRefSchema.optional(),\n}).strict();\nexport type StartWorkProjectAdminSupportThreadInput = z.infer<typeof StartWorkProjectAdminSupportThreadInputSchema>;\n\n// Admin-initiated dispatch to a workProject party (mirrors the admin→user dispatch:\n// lands unread for the work's active guildmates, creates NO admin task, uncapped).\nexport const CreateAdminDispatchToWorkProjectInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n subject: z.string().trim().min(1).max(MAX_ADMIN_DISPATCH_SUBJECT_LENGTH),\n message: z.string().trim().min(1).max(MAX_ADMIN_DISPATCH_INITIAL_TEXT_LENGTH),\n contextRef: AdminDispatchContextRefSchema.optional(),\n}).strict();\nexport type CreateAdminDispatchToWorkProjectInput = z.infer<typeof CreateAdminDispatchToWorkProjectInputSchema>;\n\n// CLIENT-CALLED wire contract for the `mintChatGrant` callable (Contract A; P3).\n// Crosses the backend↔frontend boundary — the web client (and any future mobile/TV\n// client) constructs this payload — so it lives here per the callable-validation\n// convention, not locally in the functions repo. The REAL Firestore authorization\n// check happens in the callable; this schema pins the scope shape.\nexport const ChatGrantInputSchema = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('channel'), workProjectId: workProjectIdSchema, guildChatChannelId: guildChatChannelIdSchema }).strict(),\n z.object({ kind: z.literal('invite'), guildInviteId: guildInviteIdSchema }).strict(),\n z.object({ kind: z.literal('inbox') }).strict(),\n]);\nexport type ChatGrantInput = z.infer<typeof ChatGrantInputSchema>;\n\nexport const UpdateGuildChatChannelInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n guildChatChannelId: guildChatChannelIdSchema,\n channelName: z.string().min(1).max(MAX_GUILD_CHAT_CHANNEL_NAME_LENGTH).optional(),\n description: z.string().max(MAX_GUILD_CHAT_CHANNEL_DESCRIPTION_LENGTH).optional(),\n requiredGuildStandings: z.array(z.string().min(1).max(64)).max(20).optional(),\n allowedUserIds: z.array(z.string().min(1).max(128)).max(500).optional(),\n}).strict();\nexport type UpdateGuildChatChannelInput = z.infer<typeof UpdateGuildChatChannelInputSchema>;\n\n// --- Admin chat moderation callables (review-only; chat-realtime-system.md) ---\n\n// The CLIENT-facing channel-ref for the admin chat-moderation callables\n// (`adminModerateChatMessage` / `adminReadChannelContext`). This is the WIRE shape, which\n// is `kind`-discriminated — NOT the internal `scope`-keyed `ChannelRefTupleSchema`\n// (@ttt-productions/chat-schemas), which the callables map to server-side AFTER parsing.\n// Mirrors the existing `TombstoneChatSchema.channel` union in schemas/admin.ts.\nexport const AdminChatModerationChannelSchema = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('channel'), workProjectId: workProjectIdSchema, guildChatChannelId: guildChatChannelIdSchema }).strict(),\n z.object({ kind: z.literal('invite'), guildInviteId: guildInviteIdSchema }).strict(),\n]);\nexport type AdminChatModerationChannel = z.infer<typeof AdminChatModerationChannelSchema>;\n\n// `adminModerateChatMessage` — queue a DO-owned hide/delete command. The moderated message's\n// attachment asset id(s) are NEVER client-supplied (the drain derives them server-side), so\n// `.strict()` rejects any such field.\nexport const AdminModerateChatMessageInputSchema = z.object({\n requestId: z.string().min(1).max(200),\n action: z.enum(['hide', 'delete']),\n messageSeq: z.number().int().nonnegative(),\n expectedMessageRevision: z.number().int().nonnegative(),\n caseId: z.string().min(1).max(200),\n reason: z.string().min(1).max(MAX_CHAT_MODERATION_REASON_LENGTH),\n channel: AdminChatModerationChannelSchema,\n}).strict();\nexport type AdminModerateChatMessageInput = z.infer<typeof AdminModerateChatMessageInputSchema>;\n\n// `adminReadChannelContext` — case-bound admin read of a bounded (≤50 before / ≤50 after)\n// message window around a reported message. Requires a case id + reason; both request and\n// outcome are audited.\nexport const AdminReadChannelContextInputSchema = z.object({\n reportedSeq: z.number().int().nonnegative(),\n caseId: z.string().min(1).max(200),\n reason: z.string().min(1).max(MAX_CHAT_MODERATION_REASON_LENGTH),\n before: z.number().int().min(0).max(50).optional(),\n after: z.number().int().min(0).max(50).optional(),\n channel: AdminChatModerationChannelSchema,\n}).strict();\nexport type AdminReadChannelContextInput = z.infer<typeof AdminReadChannelContextInputSchema>;\n\n\n\n"]}
1
+ {"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/schemas/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,kCAAkC,EAClC,yCAAyC,GAC1C,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,iCAAiC,EACjC,sCAAsC,EACtC,iCAAiC,GAClC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,aAAa,GACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAE5E,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD,aAAa,EAAE,mBAAmB;IAClC,kBAAkB,EAAE,wBAAwB;CAC7C,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ,gGAAgG;AAChG,kGAAkG;AAClG,yFAAyF;AACzF,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACxD,aAAa,EAAE,mBAAmB;IAClC,kBAAkB,EAAE,wBAAwB;CAC7C,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACxD,aAAa,EAAE,mBAAmB;IAClC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,kCAAkC,CAAC;IACtE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,y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,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACvD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAClC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,iCAAiC,CAAC;IAChE,OAAO,EAAE,gCAAgC;CAC1C,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ,0FAA0F;AAC1F,0FAA0F;AAC1F,uBAAuB;AACvB,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC3C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAClC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,iCAAiC,CAAC;IAChE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;IAClD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;IACjD,OAAO,EAAE,gCAAgC;CAC1C,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n workProjectIdSchema,\n guildChatChannelIdSchema,\n guildInviteIdSchema,\n adminDispatchIdSchema,\n} from './atoms.js';\nimport {\n MAX_CHAT_MESSAGE_LENGTH,\n MAX_GUILD_CHAT_CHANNEL_NAME_LENGTH,\n MAX_GUILD_CHAT_CHANNEL_DESCRIPTION_LENGTH,\n} from '../constants/chat.js';\nimport {\n MAX_ADMIN_DISPATCH_SUBJECT_LENGTH,\n MAX_ADMIN_DISPATCH_INITIAL_TEXT_LENGTH,\n MAX_CHAT_MODERATION_REASON_LENGTH,\n} from '../constants/business.js';\nimport {\n ReplyToSchema,\n} from '@ttt-productions/chat-schemas';\nimport { AdminDispatchContextRefSchema } from '../doc-schemas/messaging.js';\n\nexport const ArchiveGuildChatChannelInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n guildChatChannelId: guildChatChannelIdSchema,\n}).strict();\nexport type ArchiveGuildChatChannelInput = z.infer<typeof ArchiveGuildChatChannelInputSchema>;\n\n// Tombstone (delete) a guild chat channel — same input shape as archive. The callable marks the\n// channel `isDeleted`, bumps configVersion, revokes grants, and re-projects members to `removed`;\n// storage is retained (never a physical purge). See docs/design/chat-realtime-system.md.\nexport const DeleteGuildChatChannelInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n guildChatChannelId: guildChatChannelIdSchema,\n}).strict();\nexport type DeleteGuildChatChannelInput = z.infer<typeof DeleteGuildChatChannelInputSchema>;\n\nexport const CreateGuildChatChannelInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n channelName: z.string().min(1).max(MAX_GUILD_CHAT_CHANNEL_NAME_LENGTH),\n description: z.string().max(MAX_GUILD_CHAT_CHANNEL_DESCRIPTION_LENGTH).optional(),\n requiredGuildStandings: z.array(z.string().min(1).max(64)).max(20),\n allowedUserIds: z.array(z.string().min(1).max(128)).max(500),\n}).strict();\nexport type CreateGuildChatChannelInput = z.infer<typeof CreateGuildChatChannelInputSchema>;\n\n// Guild channels + invite threads moved to the realtime chat (Cloudflare DOs), which\n// sends through the DO client — NOT this callable. The Firestore send path is retained\n// PERMANENTLY for admin-support threads only (docs/design/chat-realtime-system.md).\nexport const SendGuildChatMessageInputSchema = z.object({\n threadKind: z.literal('adminSupport'),\n adminDispatchId: adminDispatchIdSchema,\n isUserReply: z.boolean(),\n text: z.string().max(MAX_CHAT_MESSAGE_LENGTH),\n replyTo: ReplyToSchema.optional(),\n}).strict();\nexport type SendGuildChatMessageInput = z.infer<typeof SendGuildChatMessageInputSchema>;\n\n// Wire result contract for the sendGuildChatMessage callable — what the CLIENT relies on.\n// The backend core's internal result type extends this with composition-only\n// inline-materialize fields (backend↔backend contract; see runSendGuildChatMessage) —\n// those extra fields may appear on the wire and are not part of the client contract,\n// so this schema is deliberately non-strict.\nexport const SendGuildChatMessageResultSchema = z.object({\n success: z.literal(true),\n messageId: z.string().min(1),\n messageDocPath: z.string().min(1),\n});\nexport type SendGuildChatMessageResult = z.infer<typeof SendGuildChatMessageResultSchema>;\n\n// Subject/initial-text share the admin-dispatch caps (the \"contact admin\" composer\n// enforces them) — the old MAX_CHAT_MESSAGE_LENGTH bound let a 4000-char SUBJECT through.\nexport const StartAdminSupportThreadInputSchema = z.object({\n subject: z.string().min(1).max(MAX_ADMIN_DISPATCH_SUBJECT_LENGTH),\n initialMessage: z.string().min(1).max(MAX_ADMIN_DISPATCH_INITIAL_TEXT_LENGTH),\n}).strict();\nexport type StartAdminSupportThreadInput = z.infer<typeof StartAdminSupportThreadInputSchema>;\n\n// Authoritative result of startAdminSupportThread — both ids are minted inside the\n// creating transaction. Non-strict (server → client result posture).\nexport const StartAdminSupportThreadResultSchema = z.object({\n success: z.literal(true),\n adminDispatchId: z.string().min(1),\n /** Doc id of the initial conversation message. */\n messageId: z.string().min(1),\n});\nexport type StartAdminSupportThreadResult = z.infer<typeof StartAdminSupportThreadResultSchema>;\n\n// Member-initiated workProject → admin correspondence thread (party-generic dispatch,\n// partyKind 'workProject'). Initiating is a Work ACTION (`adminDispatch.start`, BACKEND-006);\n// the callable enforces the one-open-work-initiated-thread spam guard. `contextRef` is\n// server-validated against the workProject before it is stored.\nexport const StartWorkProjectAdminSupportThreadInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n subject: z.string().min(1).max(MAX_ADMIN_DISPATCH_SUBJECT_LENGTH),\n initialMessage: z.string().min(1).max(MAX_ADMIN_DISPATCH_INITIAL_TEXT_LENGTH),\n contextRef: AdminDispatchContextRefSchema.optional(),\n}).strict();\nexport type StartWorkProjectAdminSupportThreadInput = z.infer<typeof StartWorkProjectAdminSupportThreadInputSchema>;\n\n// Admin-initiated dispatch to a workProject party (mirrors the admin→user dispatch:\n// lands unread for the work's active guildmates, creates NO admin task, uncapped).\nexport const CreateAdminDispatchToWorkProjectInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n subject: z.string().trim().min(1).max(MAX_ADMIN_DISPATCH_SUBJECT_LENGTH),\n message: z.string().trim().min(1).max(MAX_ADMIN_DISPATCH_INITIAL_TEXT_LENGTH),\n contextRef: AdminDispatchContextRefSchema.optional(),\n}).strict();\nexport type CreateAdminDispatchToWorkProjectInput = z.infer<typeof CreateAdminDispatchToWorkProjectInputSchema>;\n\n// CLIENT-CALLED wire contract for the `mintChatGrant` callable (Contract A; P3).\n// Crosses the backend↔frontend boundary — the web client (and any future mobile/TV\n// client) constructs this payload — so it lives here per the callable-validation\n// convention, not locally in the functions repo. The REAL Firestore authorization\n// check happens in the callable; this schema pins the scope shape.\nexport const ChatGrantInputSchema = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('channel'), workProjectId: workProjectIdSchema, guildChatChannelId: guildChatChannelIdSchema }).strict(),\n z.object({ kind: z.literal('invite'), guildInviteId: guildInviteIdSchema }).strict(),\n z.object({ kind: z.literal('inbox') }).strict(),\n]);\nexport type ChatGrantInput = z.infer<typeof ChatGrantInputSchema>;\n\nexport const UpdateGuildChatChannelInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n guildChatChannelId: guildChatChannelIdSchema,\n channelName: z.string().min(1).max(MAX_GUILD_CHAT_CHANNEL_NAME_LENGTH).optional(),\n description: z.string().max(MAX_GUILD_CHAT_CHANNEL_DESCRIPTION_LENGTH).optional(),\n requiredGuildStandings: z.array(z.string().min(1).max(64)).max(20).optional(),\n allowedUserIds: z.array(z.string().min(1).max(128)).max(500).optional(),\n}).strict();\nexport type UpdateGuildChatChannelInput = z.infer<typeof UpdateGuildChatChannelInputSchema>;\n\n// --- Admin chat moderation callables (review-only; chat-realtime-system.md) ---\n\n// The CLIENT-facing channel-ref for the admin chat-moderation callables\n// (`adminModerateChatMessage` / `adminReadChannelContext`). This is the WIRE shape, which\n// is `kind`-discriminated — NOT the internal `scope`-keyed `ChannelRefTupleSchema`\n// (@ttt-productions/chat-schemas), which the callables map to server-side AFTER parsing.\n// Mirrors the existing `TombstoneChatSchema.channel` union in schemas/admin.ts.\nexport const AdminChatModerationChannelSchema = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('channel'), workProjectId: workProjectIdSchema, guildChatChannelId: guildChatChannelIdSchema }).strict(),\n z.object({ kind: z.literal('invite'), guildInviteId: guildInviteIdSchema }).strict(),\n]);\nexport type AdminChatModerationChannel = z.infer<typeof AdminChatModerationChannelSchema>;\n\n// `adminModerateChatMessage` — queue a DO-owned hide/delete command. The moderated message's\n// attachment asset id(s) are NEVER client-supplied (the drain derives them server-side), so\n// `.strict()` rejects any such field.\nexport const AdminModerateChatMessageInputSchema = z.object({\n requestId: z.string().min(1).max(200),\n action: z.enum(['hide', 'delete']),\n messageSeq: z.number().int().nonnegative(),\n expectedMessageRevision: z.number().int().nonnegative(),\n caseId: z.string().min(1).max(200),\n reason: z.string().min(1).max(MAX_CHAT_MODERATION_REASON_LENGTH),\n channel: AdminChatModerationChannelSchema,\n}).strict();\nexport type AdminModerateChatMessageInput = z.infer<typeof AdminModerateChatMessageInputSchema>;\n\n// `adminReadChannelContext` — case-bound admin read of a bounded (≤50 before / ≤50 after)\n// message window around a reported message. Requires a case id + reason; both request and\n// outcome are audited.\nexport const AdminReadChannelContextInputSchema = z.object({\n reportedSeq: z.number().int().nonnegative(),\n caseId: z.string().min(1).max(200),\n reason: z.string().min(1).max(MAX_CHAT_MODERATION_REASON_LENGTH),\n before: z.number().int().min(0).max(50).optional(),\n after: z.number().int().min(0).max(50).optional(),\n channel: AdminChatModerationChannelSchema,\n}).strict();\nexport type AdminReadChannelContextInput = z.infer<typeof AdminReadChannelContextInputSchema>;\n\n\n\n"]}
@@ -5,7 +5,7 @@ export const DeleteCraftSkillInputSchema = z.object({
5
5
  craftSkillId: craftSkillIdSchema,
6
6
  }).strict();
7
7
  // `tag` is constrained to the canonical option list — the wire schema is the moderation
8
- // boundary (Invariant 12). A free-text tag would put unmoderated public text on the profile
8
+ // boundary (BACKEND-106). A free-text tag would put unmoderated public text on the profile
9
9
  // badge + pollute the craftSkillsByTag index with junk doc IDs (and could break path builders).
10
10
  export const UpdateCraftSkillTagsInputSchema = z.object({
11
11
  craftSkillId: craftSkillIdSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"craft-skills.js","sourceRoot":"","sources":["../../src/schemas/craft-skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,YAAY,EAAE,kBAAkB;CACjC,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ,wFAAwF;AACxF,4FAA4F;AAC5F,gGAAgG;AAChG,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,YAAY,EAAE,kBAAkB;IAChC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC;IACnC,MAAM,EAAE,qBAAqB;CAC9B,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ,8EAA8E;AAE9E,gFAAgF;AAChF,oFAAoF;AACpF,gFAAgF;AAChF,qFAAqF;AACrF,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3D,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IACxB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,oDAAoD;IACpD,YAAY,EAAE,kBAAkB;CACjC,CAAC,CAAC;AAGH,sFAAsF;AACtF,mFAAmF;AACnF,qFAAqF;AACrF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IACxB,YAAY,EAAE,kBAAkB;CACjC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IACxB,YAAY,EAAE,kBAAkB;IAChC,+EAA+E;IAC/E,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IAChD,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,qEAAqE;IACrE,MAAM,EAAE,qBAAqB;CAC9B,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { craftSkillIdSchema, addRemoveActionSchema } from './atoms.js';\nimport { CRAFT_SKILL_TAG_VALUES } from '../constants/options.js';\n\nexport const DeleteCraftSkillInputSchema = z.object({\n craftSkillId: craftSkillIdSchema,\n}).strict();\nexport type DeleteCraftSkillInput = z.infer<typeof DeleteCraftSkillInputSchema>;\n\n// `tag` is constrained to the canonical option list — the wire schema is the moderation\n// boundary (Invariant 12). A free-text tag would put unmoderated public text on the profile\n// badge + pollute the craftSkillsByTag index with junk doc IDs (and could break path builders).\nexport const UpdateCraftSkillTagsInputSchema = z.object({\n craftSkillId: craftSkillIdSchema,\n tag: z.enum(CRAFT_SKILL_TAG_VALUES),\n action: addRemoveActionSchema,\n}).strict();\nexport type UpdateCraftSkillTagsInput = z.infer<typeof UpdateCraftSkillTagsInputSchema>;\n\n// --- Authoritative mutation RESULTS (non-strict server → client posture) ---\n\n// Acceptance result of the craft-skill CREATE flow (startUpload with fileOrigin\n// 'craft-skill-media'). Creation itself is asynchronous via the media pipeline; the\n// skill doc id is minted server-side AS the pendingMedia id (processCraftSkill:\n// craftSkillId = pendingFile.id), so it is knowable at accept time without any read.\nexport const UploadCraftSkillAcceptedResultSchema = z.object({\n success: z.literal(true),\n pendingMediaId: z.string().min(1),\n /** Equal to pendingMediaId by pipeline contract. */\n craftSkillId: craftSkillIdSchema,\n});\nexport type UploadCraftSkillAcceptedResult = z.infer<typeof UploadCraftSkillAcceptedResultSchema>;\n\n// deleteCraftSkill: the skill doc + tag-index mirrors are gone at commit. The Streetz\n// feed patch (updatedPostIds/updates) deliberately does NOT ride this result — the\n// DELETE_CRAFT_SKILL post update is enqueued to the squareAnnouncementJobs outbox in\n// the delete transaction and applied by the outbox worker.\nexport const DeleteCraftSkillResultSchema = z.object({\n success: z.literal(true),\n craftSkillId: craftSkillIdSchema,\n});\nexport type DeleteCraftSkillResult = z.infer<typeof DeleteCraftSkillResultSchema>;\n\nexport const UpdateCraftSkillTagsResultSchema = z.object({\n success: z.literal(true),\n craftSkillId: craftSkillIdSchema,\n /** Authoritative tag list after commit (unchanged when `changed` is false). */\n newTags: z.array(z.enum(CRAFT_SKILL_TAG_VALUES)),\n changed: z.boolean(),\n /** Echo of the requested action (always known — it is the input). */\n action: addRemoveActionSchema,\n});\nexport type UpdateCraftSkillTagsResult = z.infer<typeof UpdateCraftSkillTagsResultSchema>;\n\n\n"]}
1
+ {"version":3,"file":"craft-skills.js","sourceRoot":"","sources":["../../src/schemas/craft-skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,y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qEAAqE;IACrE,MAAM,EAAE,qBAAqB;CAC9B,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { craftSkillIdSchema, addRemoveActionSchema } from './atoms.js';\nimport { CRAFT_SKILL_TAG_VALUES } from '../constants/options.js';\n\nexport const DeleteCraftSkillInputSchema = z.object({\n craftSkillId: craftSkillIdSchema,\n}).strict();\nexport type DeleteCraftSkillInput = z.infer<typeof DeleteCraftSkillInputSchema>;\n\n// `tag` is constrained to the canonical option list — the wire schema is the moderation\n// boundary (BACKEND-106). A free-text tag would put unmoderated public text on the profile\n// badge + pollute the craftSkillsByTag index with junk doc IDs (and could break path builders).\nexport const UpdateCraftSkillTagsInputSchema = z.object({\n craftSkillId: craftSkillIdSchema,\n tag: z.enum(CRAFT_SKILL_TAG_VALUES),\n action: addRemoveActionSchema,\n}).strict();\nexport type UpdateCraftSkillTagsInput = z.infer<typeof UpdateCraftSkillTagsInputSchema>;\n\n// --- Authoritative mutation RESULTS (non-strict server → client posture) ---\n\n// Acceptance result of the craft-skill CREATE flow (startUpload with fileOrigin\n// 'craft-skill-media'). Creation itself is asynchronous via the media pipeline; the\n// skill doc id is minted server-side AS the pendingMedia id (processCraftSkill:\n// craftSkillId = pendingFile.id), so it is knowable at accept time without any read.\nexport const UploadCraftSkillAcceptedResultSchema = z.object({\n success: z.literal(true),\n pendingMediaId: z.string().min(1),\n /** Equal to pendingMediaId by pipeline contract. */\n craftSkillId: craftSkillIdSchema,\n});\nexport type UploadCraftSkillAcceptedResult = z.infer<typeof UploadCraftSkillAcceptedResultSchema>;\n\n// deleteCraftSkill: the skill doc + tag-index mirrors are gone at commit. The Streetz\n// feed patch (updatedPostIds/updates) deliberately does NOT ride this result — the\n// DELETE_CRAFT_SKILL post update is enqueued to the squareAnnouncementJobs outbox in\n// the delete transaction and applied by the outbox worker.\nexport const DeleteCraftSkillResultSchema = z.object({\n success: z.literal(true),\n craftSkillId: craftSkillIdSchema,\n});\nexport type DeleteCraftSkillResult = z.infer<typeof DeleteCraftSkillResultSchema>;\n\nexport const UpdateCraftSkillTagsResultSchema = z.object({\n success: z.literal(true),\n craftSkillId: craftSkillIdSchema,\n /** Authoritative tag list after commit (unchanged when `changed` is false). */\n newTags: z.array(z.enum(CRAFT_SKILL_TAG_VALUES)),\n changed: z.boolean(),\n /** Echo of the requested action (always known — it is the input). */\n action: addRemoveActionSchema,\n});\nexport type UpdateCraftSkillTagsResult = z.infer<typeof UpdateCraftSkillTagsResultSchema>;\n\n\n"]}
@@ -174,7 +174,7 @@ export const UpdateTuneDetailsInputSchema = z.object({
174
174
  description: z.string().max(MAX_TUNE_DESCRIPTION_LENGTH).optional(),
175
175
  }).strict();
176
176
  // --- Per-user Hall viewing-state doc (hall-viewing-experience Area 2, ruled 2026-07-04) ---
177
- // One core (`runX`) owns the single privateData doc per Rule 3; writes are CALLABLE-ONLY —
177
+ // One core (`runX`) owns the single privateData doc per ARCH-001; writes are CALLABLE-ONLY —
178
178
  // no direct client Firestore writes anywhere in this system. Every list on the doc is capped
179
179
  // (HALL_LIBRARY_PREFS_CAPS in ../constants/business.js); cap enforcement is the backend
180
180
  // core's job, not this input-validation layer.
@@ -1 +1 @@
1
- {"version":3,"file":"hall-library.js","sourceRoot":"","sources":["../../src/schemas/hall-library.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,eAAe,EACf,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,iCAAiC,EACjC,iCAAiC,EACjC,yCAAyC,EACzC,iCAAiC,EACjC,qCAAqC,GACtC,MAAM,0BAA0B,CA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C,CAAC,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3D,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE;CAC3B,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n workProjectIdSchema,\n workProjectTypeSchema,\n taleIdSchema,\n tuneIdSchema,\n televisionIdSchema,\n chapterIdSchema,\n trackIdSchema,\n episodeIdSchema,\n titleSchema,\n addRemoveActionSchema,\n thresholdItemIdSchema,\n hallItemIdSchema,\n itemIdSchema,\n changeRequestIdSchema,\n} from './atoms.js';\nimport {\n MAX_HALL_LIBRARY_SUBMIT_BATCH,\n MAX_CHAPTER_CONTENT_LENGTH,\n MAX_TALE_DESCRIPTION_LENGTH,\n MAX_TUNE_DESCRIPTION_LENGTH,\n MAX_TELEVISION_DESCRIPTION_LENGTH,\n MAX_TUNE_TRACK_DESCRIPTION_LENGTH,\n MAX_TELEVISION_EPISODE_DESCRIPTION_LENGTH,\n MAX_THRESHOLD_REVIEW_NOTES_LENGTH,\n MAX_HALL_CHANGE_REQUEST_REASON_LENGTH,\n} from '../constants/business.js';\nimport { WORK_PROJECT_SPECIFIC_GENRES } from '../constants/options.js';\n\n// Canonical per-type genre enums. `WORK_PROJECT_SPECIFIC_GENRES.<type>` is a readonly\n// tuple of the exact genre strings the UI offers; the schema is the cross-boundary\n// contract, so a crafted callable can no longer put arbitrary/unmoderated text (or an\n// unbounded array of distinct strings) onto the public hall parent.\nconst TALE_GENRE_VALUES = WORK_PROJECT_SPECIFIC_GENRES.Tales as unknown as [string, ...string[]];\nconst TUNE_GENRE_VALUES = WORK_PROJECT_SPECIFIC_GENRES.Tunes as unknown as [string, ...string[]];\nconst TELEVISION_GENRE_VALUES = WORK_PROJECT_SPECIFIC_GENRES.Television as unknown as [string, ...string[]];\n\nexport const CreateChapterInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n taleId: taleIdSchema,\n title: titleSchema,\n}).strict();\nexport type CreateChapterInput = z.infer<typeof CreateChapterInputSchema>;\n\nexport const CreateTelevisionEpisodeInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n televisionId: televisionIdSchema,\n title: titleSchema,\n}).strict();\nexport type CreateTelevisionEpisodeInput = z.infer<typeof CreateTelevisionEpisodeInputSchema>;\n\nexport const CreateTuneTrackInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n tuneId: tuneIdSchema,\n title: titleSchema,\n}).strict();\nexport type CreateTuneTrackInput = z.infer<typeof CreateTuneTrackInputSchema>;\n\nexport const ReviewThresholdItemInputSchema = z.object({\n thresholdItemId: thresholdItemIdSchema,\n decision: z.enum(['approved', 'needs_revision']),\n adminNotes: z.string().max(MAX_THRESHOLD_REVIEW_NOTES_LENGTH).nullable().optional(),\n // Reviewer checklist confirmations, recorded on the review (mirrors `teachesSomething`).\n // Optional here so a `needs_revision` decision still validates; the callable REQUIRES all\n // true on an `approved` decision. First two: no-begging-for-bouquets, no-credits-in-content.\n confirmedNoBegging: z.boolean().optional(),\n confirmedNoCredits: z.boolean().optional(),\n // Reviewer verified the AUTHOR's real-people/parody attestation sits in the correct\n // position for the content they reviewed — checked if the work depicts real people,\n // unchecked if it does not (R3, DJ 2026-07-12). A wrong position is a needs-revision\n // send-back, never an admin edit.\n confirmedRealPeopleAttestation: z.boolean().optional(),\n}).strict();\nexport type ReviewThresholdItemInput = z.infer<typeof ReviewThresholdItemInputSchema>;\n\nexport const SubmitForThresholdLibraryReviewInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n workProjectType: workProjectTypeSchema,\n selectedItemIds: z.array(z.string().min(1)).min(1).max(MAX_HALL_LIBRARY_SUBMIT_BATCH),\n // AUTHOR attestation (R3, 2026-07-12): the submitting artisan attests this work\n // depicts real people (parody / satire / commentary). Stored on the threshold\n // item as `hasRealPeople`; the reviewer sees it READ-ONLY. When true, published\n // surfaces render the ONE standard platform disclaimer\n // (REAL_PEOPLE_DISCLAIMER_MESSAGE) — no free-text disclaimer input exists.\n depictsRealPeople: z.boolean(),\n}).strict();\nexport type SubmitForThresholdLibraryReviewInput = z.infer<typeof SubmitForThresholdLibraryReviewInputSchema>;\n\n// Member-initiated pull-back of a still-pending threshold submission. The runner derives\n// everything else from the threshold doc; rejects unless reviewStatus === 'pending'.\nexport const WithdrawFromThresholdLibraryReviewInputSchema = z.object({\n thresholdItemId: thresholdItemIdSchema,\n}).strict();\nexport type WithdrawFromThresholdLibraryReviewInput = z.infer<typeof WithdrawFromThresholdLibraryReviewInputSchema>;\n\n// Published change request (text-only at launch): the member proposes new values for TEXT\n// fields on a PUBLISHED surface — one pipeline, three grains (R1, 2026-07-12):\n// - hall grains: `hallItemId` set (+ `workProjectType`); the hall parent detail when\n// `subItemId` is absent, else the chapter/track/episode sub-item.\n// - realm grain: `workRealmId` set; targets the `workRealms/{id}` doc once the realm\n// counts as published. `workProjectType`/`subItemId` do not apply.\n// Exactly one of `hallItemId` / `workRealmId` must be set. Field names are validated by\n// the runner against the per-surface HALL_CONTENT_TEXT_FIELDS allowlist +\n// HALL_CONTENT_TEXT_FIELD_MAX caps; the schema-level cap is the largest field cap\n// anywhere (chapter content), derived from the same owning constant.\nexport const SubmitHallContentChangeRequestInputSchema = z.object({\n hallItemId: hallItemIdSchema.nullish(),\n workProjectType: workProjectTypeSchema.nullish(),\n workRealmId: z.string().min(1).nullish(),\n subItemId: z.string().min(1).nullish(),\n proposedFields: z.record(z.string().min(1).max(64), z.string().trim().min(1).max(MAX_CHAPTER_CONTENT_LENGTH))\n .refine((fields) => Object.keys(fields).length > 0, { message: 'Propose at least one field change.' }),\n}).strict().superRefine((val, ctx) => {\n const hasHallItem = typeof val.hallItemId === 'string' && val.hallItemId.length > 0;\n const hasRealm = typeof val.workRealmId === 'string' && val.workRealmId.length > 0;\n if (hasHallItem === hasRealm) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Provide exactly one of hallItemId or workRealmId.',\n path: [hasRealm ? 'workRealmId' : 'hallItemId'],\n });\n return;\n }\n if (hasHallItem && (val.workProjectType === null || val.workProjectType === undefined)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'workProjectType is required for a hall-item change request.',\n path: ['workProjectType'],\n });\n }\n if (hasRealm && (val.workProjectType !== null && val.workProjectType !== undefined)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'workProjectType does not apply to a realm change request.',\n path: ['workProjectType'],\n });\n }\n if (hasRealm && typeof val.subItemId === 'string' && val.subItemId.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'subItemId does not apply to a realm change request.',\n path: ['subItemId'],\n });\n }\n});\nexport type SubmitHallContentChangeRequestInput = z.infer<typeof SubmitHallContentChangeRequestInputSchema>;\n\n// Admin decision on a published change request. `resolutionReason` is REQUIRED on a deny\n// (the member is shown why); optional note on approve.\nexport const ReviewHallContentChangeRequestInputSchema = z.object({\n changeRequestId: changeRequestIdSchema,\n decision: z.enum(['approved', 'denied']),\n resolutionReason: z.string().trim().max(MAX_HALL_CHANGE_REQUEST_REASON_LENGTH).optional(),\n}).strict().superRefine((val, ctx) => {\n if (val.decision === 'denied' && (!val.resolutionReason || val.resolutionReason.length === 0)) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'A reason is required when denying a change request.', path: ['resolutionReason'] });\n }\n});\nexport type ReviewHallContentChangeRequestInput = z.infer<typeof ReviewHallContentChangeRequestInputSchema>;\n\nexport const UpdateChapterDetailsInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n taleId: taleIdSchema,\n chapterId: chapterIdSchema,\n title: titleSchema.optional(),\n content: z.string().max(MAX_CHAPTER_CONTENT_LENGTH).optional(),\n}).strict();\nexport type UpdateChapterDetailsInput = z.infer<typeof UpdateChapterDetailsInputSchema>;\n\nexport const UpdateTelevisionEpisodeDetailsInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n televisionId: televisionIdSchema,\n episodeId: episodeIdSchema,\n title: titleSchema.optional(),\n description: z.string().max(MAX_TELEVISION_EPISODE_DESCRIPTION_LENGTH).optional(),\n}).strict();\nexport type UpdateTelevisionEpisodeDetailsInput = z.infer<typeof UpdateTelevisionEpisodeDetailsInputSchema>;\n\nexport const UpdateTuneTrackDetailsInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n tuneId: tuneIdSchema,\n trackId: trackIdSchema,\n title: titleSchema.optional(),\n description: z.string().max(MAX_TUNE_TRACK_DESCRIPTION_LENGTH).optional(),\n}).strict();\nexport type UpdateTuneTrackDetailsInput = z.infer<typeof UpdateTuneTrackDetailsInputSchema>;\n\nexport const UpdateTaleWorkGenresInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n taleId: taleIdSchema,\n workGenre: z.enum(TALE_GENRE_VALUES),\n action: addRemoveActionSchema,\n}).strict();\nexport type UpdateTaleWorkGenresInput = z.infer<typeof UpdateTaleWorkGenresInputSchema>;\n\nexport const UpdateTaleDetailsInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n taleId: taleIdSchema,\n title: titleSchema.optional(),\n description: z.string().max(MAX_TALE_DESCRIPTION_LENGTH).optional(),\n}).strict();\nexport type UpdateTaleDetailsInput = z.infer<typeof UpdateTaleDetailsInputSchema>;\n\nexport const UpdateTelevisionWorkGenresInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n televisionId: televisionIdSchema,\n workGenre: z.enum(TELEVISION_GENRE_VALUES),\n action: addRemoveActionSchema,\n}).strict();\nexport type UpdateTelevisionWorkGenresInput = z.infer<typeof UpdateTelevisionWorkGenresInputSchema>;\n\nexport const UpdateTelevisionDetailsInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n televisionId: televisionIdSchema,\n title: titleSchema.optional(),\n description: z.string().max(MAX_TELEVISION_DESCRIPTION_LENGTH).optional(),\n}).strict();\nexport type UpdateTelevisionDetailsInput = z.infer<typeof UpdateTelevisionDetailsInputSchema>;\n\nexport const UpdateTuneWorkGenresInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n tuneId: tuneIdSchema,\n workGenre: z.enum(TUNE_GENRE_VALUES),\n action: addRemoveActionSchema,\n}).strict();\nexport type UpdateTuneWorkGenresInput = z.infer<typeof UpdateTuneWorkGenresInputSchema>;\n\nexport const UpdateTuneDetailsInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n tuneId: tuneIdSchema,\n title: titleSchema.optional(),\n description: z.string().max(MAX_TUNE_DESCRIPTION_LENGTH).optional(),\n}).strict();\nexport type UpdateTuneDetailsInput = z.infer<typeof UpdateTuneDetailsInputSchema>;\n\n// --- Per-user Hall viewing-state doc (hall-viewing-experience Area 2, ruled 2026-07-04) ---\n// One core (`runX`) owns the single privateData doc per Rule 3; writes are CALLABLE-ONLY —\n// no direct client Firestore writes anywhere in this system. Every list on the doc is capped\n// (HALL_LIBRARY_PREFS_CAPS in ../constants/business.js); cap enforcement is the backend\n// core's job, not this input-validation layer.\n\nexport const UpdateHallWorkHiddenInputSchema = z.object({\n hallItemId: hallItemIdSchema,\n hidden: z.boolean(),\n}).strict();\nexport type UpdateHallWorkHiddenInput = z.infer<typeof UpdateHallWorkHiddenInputSchema>;\n\n// \"Inked\" save-for-later watchlist toggle (My Playbill Area 7) — deliberately separate from\n// follows (Inked is private organization; follow is semi-public with a counter + notifications).\nexport const UpdateHallInkedWorkInputSchema = z.object({\n hallItemId: hallItemIdSchema,\n inked: z.boolean(),\n}).strict();\nexport type UpdateHallInkedWorkInput = z.infer<typeof UpdateHallInkedWorkInputSchema>;\n\n// Playback-progress heartbeat (throttled client-side to ~60s during playback, plus writes on\n// pause / pane-exit / media-end). `durationSeconds` is optional — not always known up front.\nexport const UpdateHallPlaybackProgressInputSchema = z.object({\n hallItemId: hallItemIdSchema,\n itemId: itemIdSchema,\n positionSeconds: z.number().min(0),\n durationSeconds: z.number().min(0).optional(),\n}).strict();\nexport type UpdateHallPlaybackProgressInput = z.infer<typeof UpdateHallPlaybackProgressInputSchema>;\n\n// Recently-viewed / History rail record. `itemId` is optional — a work-level view (no\n// sub-item selected yet) still records History.\nexport const UpdateHallRecentlyViewedInputSchema = z.object({\n hallItemId: hallItemIdSchema,\n itemId: itemIdSchema.nullish(),\n}).strict();\nexport type UpdateHallRecentlyViewedInput = z.infer<typeof UpdateHallRecentlyViewedInputSchema>;\n\nexport const UpdateHallLibrarySettingsInputSchema = z.object({\n tunesAutoplay: z.boolean(),\n}).strict();\nexport type UpdateHallLibrarySettingsInput = z.infer<typeof UpdateHallLibrarySettingsInputSchema>;\n\n\n"]}
1
+ {"version":3,"file":"hall-library.js","sourceRoot":"","sources":["../../src/schemas/hall-library.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,eAAe,EACf,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,iCAAiC,EACjC,iCAAiC,EACjC,yCAAyC,EACzC,iCAAiC,EACjC,qCAAqC,GACtC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAEvE,sFAAsF;AACtF,mFAAmF;AACnF,sFAAsF;AACtF,oEAAoE;AACpE,MAAM,iBAAiB,GAAG,4BAA4B,CAAC,KAAyC,CAAC;AACjG,MAAM,iBAAiB,GAAG,4BAA4B,CAAC,KAAyC,CAAC;AACjG,MAAM,uBAAuB,GAAG,4BAA4B,CAAC,UAA8C,CAAC;AAE5G,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,aAAa,EAAE,mBAAmB;IAClC,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,W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U,EAAE,gBAAgB;IAC5B,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;CACpB,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ,4FAA4F;AAC5F,iGAAiG;AACjG,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,UAAU,EAAE,gBAAgB;IAC5B,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;CACnB,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ,6FAA6F;AAC7F,6FAA6F;AAC7F,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5D,UAAU,EAAE,gBAAgB;IAC5B,MAAM,EAAE,YAAY;IACpB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAClC,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC9C,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ,sFAAsF;AACtF,gDAAgD;AAChD,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1D,UAAU,EAAE,gBAAgB;IAC5B,MAAM,EAAE,YAAY,CAAC,OAAO,EAAE;CAC/B,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3D,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE;CAC3B,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n workProjectIdSchema,\n workProjectTypeSchema,\n taleIdSchema,\n tuneIdSchema,\n televisionIdSchema,\n chapterIdSchema,\n trackIdSchema,\n episodeIdSchema,\n titleSchema,\n addRemoveActionSchema,\n thresholdItemIdSchema,\n hallItemIdSchema,\n itemIdSchema,\n changeRequestIdSchema,\n} from './atoms.js';\nimport {\n MAX_HALL_LIBRARY_SUBMIT_BATCH,\n MAX_CHAPTER_CONTENT_LENGTH,\n MAX_TALE_DESCRIPTION_LENGTH,\n MAX_TUNE_DESCRIPTION_LENGTH,\n MAX_TELEVISION_DESCRIPTION_LENGTH,\n MAX_TUNE_TRACK_DESCRIPTION_LENGTH,\n MAX_TELEVISION_EPISODE_DESCRIPTION_LENGTH,\n MAX_THRESHOLD_REVIEW_NOTES_LENGTH,\n MAX_HALL_CHANGE_REQUEST_REASON_LENGTH,\n} from '../constants/business.js';\nimport { WORK_PROJECT_SPECIFIC_GENRES } from '../constants/options.js';\n\n// Canonical per-type genre enums. `WORK_PROJECT_SPECIFIC_GENRES.<type>` is a readonly\n// tuple of the exact genre strings the UI offers; the schema is the cross-boundary\n// contract, so a crafted callable can no longer put arbitrary/unmoderated text (or an\n// unbounded array of distinct strings) onto the public hall parent.\nconst TALE_GENRE_VALUES = WORK_PROJECT_SPECIFIC_GENRES.Tales as unknown as [string, ...string[]];\nconst TUNE_GENRE_VALUES = WORK_PROJECT_SPECIFIC_GENRES.Tunes as unknown as [string, ...string[]];\nconst TELEVISION_GENRE_VALUES = WORK_PROJECT_SPECIFIC_GENRES.Television as unknown as [string, ...string[]];\n\nexport const CreateChapterInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n taleId: taleIdSchema,\n title: titleSchema,\n}).strict();\nexport type CreateChapterInput = z.infer<typeof CreateChapterInputSchema>;\n\nexport const CreateTelevisionEpisodeInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n televisionId: televisionIdSchema,\n title: titleSchema,\n}).strict();\nexport type CreateTelevisionEpisodeInput = z.infer<typeof CreateTelevisionEpisodeInputSchema>;\n\nexport const CreateTuneTrackInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n tuneId: tuneIdSchema,\n title: titleSchema,\n}).strict();\nexport type CreateTuneTrackInput = z.infer<typeof CreateTuneTrackInputSchema>;\n\nexport const ReviewThresholdItemInputSchema = z.object({\n thresholdItemId: thresholdItemIdSchema,\n decision: z.enum(['approved', 'needs_revision']),\n adminNotes: z.string().max(MAX_THRESHOLD_REVIEW_NOTES_LENGTH).nullable().optional(),\n // Reviewer checklist confirmations, recorded on the review (mirrors `teachesSomething`).\n // Optional here so a `needs_revision` decision still validates; the callable REQUIRES all\n // true on an `approved` decision. First two: no-begging-for-bouquets, no-credits-in-content.\n confirmedNoBegging: z.boolean().optional(),\n confirmedNoCredits: z.boolean().optional(),\n // Reviewer verified the AUTHOR's real-people/parody attestation sits in the correct\n // position for the content they reviewed — checked if the work depicts real people,\n // unchecked if it does not (R3, DJ 2026-07-12). A wrong position is a needs-revision\n // send-back, never an admin edit.\n confirmedRealPeopleAttestation: z.boolean().optional(),\n}).strict();\nexport type ReviewThresholdItemInput = z.infer<typeof ReviewThresholdItemInputSchema>;\n\nexport const SubmitForThresholdLibraryReviewInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n workProjectType: workProjectTypeSchema,\n selectedItemIds: z.array(z.string().min(1)).min(1).max(MAX_HALL_LIBRARY_SUBMIT_BATCH),\n // AUTHOR attestation (R3, 2026-07-12): the submitting artisan attests this work\n // depicts real people (parody / satire / commentary). Stored on the threshold\n // item as `hasRealPeople`; the reviewer sees it READ-ONLY. When true, published\n // surfaces render the ONE standard platform disclaimer\n // (REAL_PEOPLE_DISCLAIMER_MESSAGE) — no free-text disclaimer input exists.\n depictsRealPeople: z.boolean(),\n}).strict();\nexport type SubmitForThresholdLibraryReviewInput = z.infer<typeof SubmitForThresholdLibraryReviewInputSchema>;\n\n// Member-initiated pull-back of a still-pending threshold submission. The runner derives\n// everything else from the threshold doc; rejects unless reviewStatus === 'pending'.\nexport const WithdrawFromThresholdLibraryReviewInputSchema = z.object({\n thresholdItemId: thresholdItemIdSchema,\n}).strict();\nexport type WithdrawFromThresholdLibraryReviewInput = z.infer<typeof WithdrawFromThresholdLibraryReviewInputSchema>;\n\n// Published change request (text-only at launch): the member proposes new values for TEXT\n// fields on a PUBLISHED surface — one pipeline, three grains (R1, 2026-07-12):\n// - hall grains: `hallItemId` set (+ `workProjectType`); the hall parent detail when\n// `subItemId` is absent, else the chapter/track/episode sub-item.\n// - realm grain: `workRealmId` set; targets the `workRealms/{id}` doc once the realm\n// counts as published. `workProjectType`/`subItemId` do not apply.\n// Exactly one of `hallItemId` / `workRealmId` must be set. Field names are validated by\n// the runner against the per-surface HALL_CONTENT_TEXT_FIELDS allowlist +\n// HALL_CONTENT_TEXT_FIELD_MAX caps; the schema-level cap is the largest field cap\n// anywhere (chapter content), derived from the same owning constant.\nexport const SubmitHallContentChangeRequestInputSchema = z.object({\n hallItemId: hallItemIdSchema.nullish(),\n workProjectType: workProjectTypeSchema.nullish(),\n workRealmId: z.string().min(1).nullish(),\n subItemId: z.string().min(1).nullish(),\n proposedFields: z.record(z.string().min(1).max(64), z.string().trim().min(1).max(MAX_CHAPTER_CONTENT_LENGTH))\n .refine((fields) => Object.keys(fields).length > 0, { message: 'Propose at least one field change.' }),\n}).strict().superRefine((val, ctx) => {\n const hasHallItem = typeof val.hallItemId === 'string' && val.hallItemId.length > 0;\n const hasRealm = typeof val.workRealmId === 'string' && val.workRealmId.length > 0;\n if (hasHallItem === hasRealm) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Provide exactly one of hallItemId or workRealmId.',\n path: [hasRealm ? 'workRealmId' : 'hallItemId'],\n });\n return;\n }\n if (hasHallItem && (val.workProjectType === null || val.workProjectType === undefined)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'workProjectType is required for a hall-item change request.',\n path: ['workProjectType'],\n });\n }\n if (hasRealm && (val.workProjectType !== null && val.workProjectType !== undefined)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'workProjectType does not apply to a realm change request.',\n path: ['workProjectType'],\n });\n }\n if (hasRealm && typeof val.subItemId === 'string' && val.subItemId.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'subItemId does not apply to a realm change request.',\n path: ['subItemId'],\n });\n }\n});\nexport type SubmitHallContentChangeRequestInput = z.infer<typeof SubmitHallContentChangeRequestInputSchema>;\n\n// Admin decision on a published change request. `resolutionReason` is REQUIRED on a deny\n// (the member is shown why); optional note on approve.\nexport const ReviewHallContentChangeRequestInputSchema = z.object({\n changeRequestId: changeRequestIdSchema,\n decision: z.enum(['approved', 'denied']),\n resolutionReason: z.string().trim().max(MAX_HALL_CHANGE_REQUEST_REASON_LENGTH).optional(),\n}).strict().superRefine((val, ctx) => {\n if (val.decision === 'denied' && (!val.resolutionReason || val.resolutionReason.length === 0)) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'A reason is required when denying a change request.', path: ['resolutionReason'] });\n }\n});\nexport type ReviewHallContentChangeRequestInput = z.infer<typeof ReviewHallContentChangeRequestInputSchema>;\n\nexport const UpdateChapterDetailsInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n taleId: taleIdSchema,\n chapterId: chapterIdSchema,\n title: titleSchema.optional(),\n content: z.string().max(MAX_CHAPTER_CONTENT_LENGTH).optional(),\n}).strict();\nexport type UpdateChapterDetailsInput = z.infer<typeof UpdateChapterDetailsInputSchema>;\n\nexport const UpdateTelevisionEpisodeDetailsInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n televisionId: televisionIdSchema,\n episodeId: episodeIdSchema,\n title: titleSchema.optional(),\n description: z.string().max(MAX_TELEVISION_EPISODE_DESCRIPTION_LENGTH).optional(),\n}).strict();\nexport type UpdateTelevisionEpisodeDetailsInput = z.infer<typeof UpdateTelevisionEpisodeDetailsInputSchema>;\n\nexport const UpdateTuneTrackDetailsInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n tuneId: tuneIdSchema,\n trackId: trackIdSchema,\n title: titleSchema.optional(),\n description: z.string().max(MAX_TUNE_TRACK_DESCRIPTION_LENGTH).optional(),\n}).strict();\nexport type UpdateTuneTrackDetailsInput = z.infer<typeof UpdateTuneTrackDetailsInputSchema>;\n\nexport const UpdateTaleWorkGenresInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n taleId: taleIdSchema,\n workGenre: z.enum(TALE_GENRE_VALUES),\n action: addRemoveActionSchema,\n}).strict();\nexport type UpdateTaleWorkGenresInput = z.infer<typeof UpdateTaleWorkGenresInputSchema>;\n\nexport const UpdateTaleDetailsInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n taleId: taleIdSchema,\n title: titleSchema.optional(),\n description: z.string().max(MAX_TALE_DESCRIPTION_LENGTH).optional(),\n}).strict();\nexport type UpdateTaleDetailsInput = z.infer<typeof UpdateTaleDetailsInputSchema>;\n\nexport const UpdateTelevisionWorkGenresInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n televisionId: televisionIdSchema,\n workGenre: z.enum(TELEVISION_GENRE_VALUES),\n action: addRemoveActionSchema,\n}).strict();\nexport type UpdateTelevisionWorkGenresInput = z.infer<typeof UpdateTelevisionWorkGenresInputSchema>;\n\nexport const UpdateTelevisionDetailsInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n televisionId: televisionIdSchema,\n title: titleSchema.optional(),\n description: z.string().max(MAX_TELEVISION_DESCRIPTION_LENGTH).optional(),\n}).strict();\nexport type UpdateTelevisionDetailsInput = z.infer<typeof UpdateTelevisionDetailsInputSchema>;\n\nexport const UpdateTuneWorkGenresInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n tuneId: tuneIdSchema,\n workGenre: z.enum(TUNE_GENRE_VALUES),\n action: addRemoveActionSchema,\n}).strict();\nexport type UpdateTuneWorkGenresInput = z.infer<typeof UpdateTuneWorkGenresInputSchema>;\n\nexport const UpdateTuneDetailsInputSchema = z.object({\n workProjectId: workProjectIdSchema,\n tuneId: tuneIdSchema,\n title: titleSchema.optional(),\n description: z.string().max(MAX_TUNE_DESCRIPTION_LENGTH).optional(),\n}).strict();\nexport type UpdateTuneDetailsInput = z.infer<typeof UpdateTuneDetailsInputSchema>;\n\n// --- Per-user Hall viewing-state doc (hall-viewing-experience Area 2, ruled 2026-07-04) ---\n// One core (`runX`) owns the single privateData doc per ARCH-001; writes are CALLABLE-ONLY —\n// no direct client Firestore writes anywhere in this system. Every list on the doc is capped\n// (HALL_LIBRARY_PREFS_CAPS in ../constants/business.js); cap enforcement is the backend\n// core's job, not this input-validation layer.\n\nexport const UpdateHallWorkHiddenInputSchema = z.object({\n hallItemId: hallItemIdSchema,\n hidden: z.boolean(),\n}).strict();\nexport type UpdateHallWorkHiddenInput = z.infer<typeof UpdateHallWorkHiddenInputSchema>;\n\n// \"Inked\" save-for-later watchlist toggle (My Playbill Area 7) — deliberately separate from\n// follows (Inked is private organization; follow is semi-public with a counter + notifications).\nexport const UpdateHallInkedWorkInputSchema = z.object({\n hallItemId: hallItemIdSchema,\n inked: z.boolean(),\n}).strict();\nexport type UpdateHallInkedWorkInput = z.infer<typeof UpdateHallInkedWorkInputSchema>;\n\n// Playback-progress heartbeat (throttled client-side to ~60s during playback, plus writes on\n// pause / pane-exit / media-end). `durationSeconds` is optional — not always known up front.\nexport const UpdateHallPlaybackProgressInputSchema = z.object({\n hallItemId: hallItemIdSchema,\n itemId: itemIdSchema,\n positionSeconds: z.number().min(0),\n durationSeconds: z.number().min(0).optional(),\n}).strict();\nexport type UpdateHallPlaybackProgressInput = z.infer<typeof UpdateHallPlaybackProgressInputSchema>;\n\n// Recently-viewed / History rail record. `itemId` is optional — a work-level view (no\n// sub-item selected yet) still records History.\nexport const UpdateHallRecentlyViewedInputSchema = z.object({\n hallItemId: hallItemIdSchema,\n itemId: itemIdSchema.nullish(),\n}).strict();\nexport type UpdateHallRecentlyViewedInput = z.infer<typeof UpdateHallRecentlyViewedInputSchema>;\n\nexport const UpdateHallLibrarySettingsInputSchema = z.object({\n tunesAutoplay: z.boolean(),\n}).strict();\nexport type UpdateHallLibrarySettingsInput = z.infer<typeof UpdateHallLibrarySettingsInputSchema>;\n\n\n"]}
@@ -18,7 +18,7 @@ import { HallSubItemTypeSchema } from '../doc-schemas/content.js';
18
18
  import { ReportableItemTypeSchema } from '../doc-schemas/safety/foundation.js';
19
19
  // String shape atoms specific to notifications.
20
20
  const notificationMessageSchema = z.string().min(1).max(MAX_NOTIFICATION_MESSAGE_LENGTH);
21
- // The canonical reportable-item enum — never an open string (Rule 36).
21
+ // The canonical reportable-item enum — never an open string (ARCH-102).
22
22
  const reportedItemTypeSchema = ReportableItemTypeSchema;
23
23
  const reportedItemIdSchema = z.string().min(1).max(128);
24
24
  const reportIdSchema = z.string().min(1);
@@ -1 +1 @@
1
- {"version":3,"file":"notification.js","sourceRoot":"","sources":["../../src/schemas/notification.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,2EAA2E;AAC3E,gFAAgF;AAChF,EAAE;AACF,qEAAqE;AACrE,gEAAgE;AAChE,8EAA8E;AAC9E,2DAA2D;AAE3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,WAAW,EACX,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iCAAiC,EACjC,qCAAqC,EACrC,+BAA+B,EAC/B,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAE/E,gDAAgD;AAChD,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;AACzF,uEAAuE;AACvE,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AACxD,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,C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,CAAC;IACnD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,QAAQ,EAAE,0BAA0B;CACrC,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACzB,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ,iFAAiF;AACjF,kFAAkF;AAClF,oFAAoF;AACpF,sCAAsC;AACtC,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,KAAK,EAAE,6BAA6B;CACrC,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["// TTT notification contracts.\n//\n// `@ttt-productions/notification-core` is generic — at its package boundary a\n// notification's `metadata` is `Record<string, unknown>`. All TTT notification\n// policy lives here: the canonical type catalog (category / delivery / default\n// channels), the per-type typed `metadata` discriminated union, the broadcast\n// audience selector, and the callable input schemas. `runSendNotification`\n// (ttt-prod) validates `metadata` against the per-type schema before any write.\n//\n// The two notification audit-event payload shapes live here too (the\n// `AuditEventType` union members `notification.broadcastSent` /\n// `notification.adminArchived` are added in ../types/audit.ts; their actor is\n// always an admin mode — `adminReview` / `adminOverride`).\n\nimport { z } from 'zod';\nimport {\n userIdSchema,\n workProjectIdSchema,\n guildInviteIdSchema,\n adminDispatchIdSchema,\n hallItemIdSchema,\n thresholdItemIdSchema,\n changeRequestIdSchema,\n workProjectTypeSchema,\n notificationFanoutJobIdSchema,\n titleSchema,\n reportGroupIdSchema,\n} from './atoms.js';\nimport {\n MAX_THRESHOLD_REVIEW_NOTES_LENGTH,\n MAX_HALL_CHANGE_REQUEST_REASON_LENGTH,\n MAX_NOTIFICATION_MESSAGE_LENGTH,\n MAX_BROADCAST_EXPLICIT_UIDS,\n} from '../constants/business.js';\nimport { HallSubItemTypeSchema } from '../doc-schemas/content.js';\nimport { ReportableItemTypeSchema } from '../doc-schemas/safety/foundation.js';\n\n// String shape atoms specific to notifications.\nconst notificationMessageSchema = z.string().min(1).max(MAX_NOTIFICATION_MESSAGE_LENGTH);\n// The canonical reportable-item enum — never an open string (Rule 36).\nconst reportedItemTypeSchema = ReportableItemTypeSchema;\nconst reportedItemIdSchema = z.string().min(1).max(128);\nconst reportIdSchema = z.string().min(1);\nconst appealIdSchema = z.string().min(1);\nconst workRealmIdSchema = z.string().min(1);\n\n// ============================================================================\n// TYPE + CHANNEL CATALOG\n// ============================================================================\n\nexport const NOTIFICATION_TYPE_VALUES = [\n 'content_report',\n 'guild_invite',\n 'admin_dispatch_reply',\n 'threshold_library_submission',\n // Author feedback for a Threshold Library review decision (only needs_revision is\n // delivered today — an approval reaches the author via the publish member fanout).\n 'threshold_library_reviewed',\n // Proposer feedback for a PUBLISHED change-request decision (approve/deny).\n 'hall_content_change_request_resolved',\n 'admin_announcement',\n 'followed_content_published',\n // chat-edge-rebuild P7 — the two new fanout triggers (NOTIFICATIONS_REDESIGN \"Triggers\").\n // `member_content_published`: the Hall-publish MEMBER job (\"your work was published!\") — same\n // `thresholdItemId` eventId as the follower job, different type so `deliveryId` stays distinct.\n // `followed_craft_skill_published`: craft-skill publish → the artisan's followers\n // (`staticRelight` strategy — count 1 forever, static copy, no count shown).\n 'member_content_published',\n 'followed_craft_skill_published',\n // Reporter feedback (DJ ruling 2026-07-06): when a report a user submitted is\n // closed as a REAL case WITH action (ordinary report root flips to `actioned`),\n // the reporter gets one light informational card. Never sent on dismissals.\n // Generic copy only — the card must not reveal the reported user, reason, or\n // remedy (a bad-faith reporter must not be able to probe moderation outcomes).\n 'report_action_taken',\n // Appellant feedback for a content-appeal decision (DJ ruling 2026-07-10 —\n // gap found by the hosted E2E build: reviewContentAppeal decided appeals with\n // NO channel reporting the outcome to the appellant). Fired on BOTH approve\n // and deny. It is the appellant's OWN appeal, so unlike report_action_taken\n // there is no privacy ceiling: the card states the outcome plainly and\n // targets My Uploads, where the resulting upload state lives.\n 'content_appeal_reviewed',\n] as const;\n\nexport const NotificationTypeSchema = z.enum(NOTIFICATION_TYPE_VALUES);\nexport type NotificationType = z.infer<typeof NotificationTypeSchema>;\n\n/** Delivery channels. Only `inApp` is implemented at launch; `email`/`push`\n * are future channel handlers dispatched from the `runSendNotification`\n * chokepoint. */\nexport const NOTIFICATION_CHANNEL_VALUES = ['inApp', 'email', 'push'] as const;\nexport const NotificationChannelSchema = z.enum(NOTIFICATION_CHANNEL_VALUES);\nexport type NotificationChannel = z.infer<typeof NotificationChannelSchema>;\n\nexport type NotificationCategory = 'user' | 'admin';\nexport const NotificationCategorySchema = z.enum(['user', 'admin']);\n\nexport interface NotificationTypeCatalogEntry {\n /** Which active collection / audience this type writes to. */\n category: NotificationCategory;\n /** `realtime` writes straight to active; `queued` goes through the batch processor. */\n delivery: 'realtime' | 'queued';\n /** Default channel list applied when a send omits `channels`. All `['inApp']` at launch. */\n defaultChannels: NotificationChannel[];\n}\n\n/**\n * The canonical TTT notification type catalog. `runSendNotification` resolves a\n * type's category/delivery here and carries `defaultChannels` through when a\n * send omits `channels`.\n */\nexport const NOTIFICATION_TYPE_CATALOG: Record<NotificationType, NotificationTypeCatalogEntry> = {\n content_report: { category: 'admin', delivery: 'realtime', defaultChannels: ['inApp'] },\n guild_invite: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n admin_dispatch_reply: { category: 'user', delivery: 'realtime', defaultChannels: ['inApp'] },\n threshold_library_submission: { category: 'admin', delivery: 'queued', defaultChannels: ['inApp'] },\n threshold_library_reviewed: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n hall_content_change_request_resolved: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n admin_announcement: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n followed_content_published: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n member_content_published: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n followed_craft_skill_published: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n report_action_taken: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n content_appeal_reviewed: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n};\n\n// ============================================================================\n// PER-TYPE METADATA (discriminated union, keyed by `type`)\n// ============================================================================\n\n/**\n * Typed `metadata` payload for each notification type. The generic package\n * boundary takes `Record<string, unknown>`; the app validates against this\n * before sending so each type's payload is checked like every other callable\n * schema.\n */\nexport const NotificationMetadataByTypeSchema = z.discriminatedUnion('type', [\n z.object({\n type: z.literal('content_report'),\n reportGroupId: reportGroupIdSchema,\n reportedItemType: reportedItemTypeSchema,\n reportedItemId: reportedItemIdSchema,\n }).strict(),\n z.object({\n type: z.literal('guild_invite'),\n workProjectId: workProjectIdSchema,\n guildInviteId: guildInviteIdSchema,\n workTitle: titleSchema,\n }).strict(),\n z.object({\n type: z.literal('admin_dispatch_reply'),\n adminDispatchId: adminDispatchIdSchema,\n // Party-generic dispatch: present on workProject-party threads so the card routes\n // to the Work's correspondence surface. Absent on user-party threads (legacy shape).\n partyKind: z.enum(['user', 'workProject']).optional(),\n workProjectId: workProjectIdSchema.optional(),\n }).strict(),\n z.object({\n type: z.literal('threshold_library_submission'),\n thresholdItemId: thresholdItemIdSchema,\n hallItemId: hallItemIdSchema,\n workProjectId: workProjectIdSchema,\n }).strict(),\n // Author feedback for a review decision. Mirrors what runReviewThresholdItem\n // (ttt-prod) sends: only `needs_revision` is delivered today; `adminNotes` is\n // the reviewer's note, sent as null when the reviewer left none.\n z.object({\n type: z.literal('threshold_library_reviewed'),\n thresholdItemId: thresholdItemIdSchema,\n hallItemId: hallItemIdSchema,\n workProjectId: workProjectIdSchema,\n workProjectType: workProjectTypeSchema,\n itemId: z.string().min(1),\n decision: z.literal('needs_revision'),\n adminNotes: z.string().max(MAX_THRESHOLD_REVIEW_NOTES_LENGTH).nullable(),\n }).strict(),\n // Proposer feedback for a published change-request decision. Mirrors what\n // runReviewHallContentChangeRequest (ttt-prod) sends: `resolutionReason` is\n // required on a deny, optional on an approve — null when absent. The realm\n // grain (R1) sends `workRealmId` with `hallItemId` null; hall grains the\n // reverse.\n z.object({\n type: z.literal('hall_content_change_request_resolved'),\n changeRequestId: changeRequestIdSchema,\n hallItemId: hallItemIdSchema.nullable(),\n workRealmId: z.string().min(1).nullish(),\n workProjectId: workProjectIdSchema,\n decision: z.enum(['approved', 'denied']),\n resolutionReason: z.string().max(MAX_HALL_CHANGE_REQUEST_REASON_LENGTH).nullable(),\n }).strict(),\n z.object({\n type: z.literal('admin_announcement'),\n title: titleSchema,\n message: notificationMessageSchema,\n }).strict(),\n z.object({\n type: z.literal('followed_content_published'),\n workProjectId: workProjectIdSchema,\n workTitle: titleSchema,\n hallItemId: hallItemIdSchema,\n hallItemTitle: titleSchema,\n hallSubItemType: HallSubItemTypeSchema,\n }).strict(),\n // P7 Hall-publish MEMBER job — same Hall-publication fields as the follower type (it describes\n // the SAME publication to the work's members; the work route + \"your work was published!\" copy\n // are set by the emitter via targetPath/title, not metadata).\n z.object({\n type: z.literal('member_content_published'),\n workProjectId: workProjectIdSchema,\n workTitle: titleSchema,\n hallItemId: hallItemIdSchema,\n hallItemTitle: titleSchema,\n hallSubItemType: HallSubItemTypeSchema,\n }).strict(),\n // P7 craft-skill publish — points at the artisan whose skills updated. The actor name\n // (\"X uploaded new craft skills\") + the profile/skills route resolve from `artisanUid` at\n // render time (Display Identity Invariant); `staticRelight` shows no count.\n z.object({\n type: z.literal('followed_craft_skill_published'),\n artisanUid: userIdSchema,\n }).strict(),\n // Reporter feedback — metadata is deliberately minimal: `reportId` is the\n // reporter's OWN report-root doc id (deterministic per reporterUid + target,\n // see writeOrdinaryReport), used only as the dedup/aggregation key so a\n // reporter gets at most one card per report they filed. NO fields that\n // identify the reported user/content/remedy may ever be added here.\n z.object({\n type: z.literal('report_action_taken'),\n reportId: reportIdSchema,\n }).strict(),\n // Appellant feedback for a content-appeal decision. `appealId` is the\n // appellant's OWN appeal doc id (the dedup/aggregation key — one card per\n // appeal, a re-decision coalesces); `decision` drives the card copy.\n z.object({\n type: z.literal('content_appeal_reviewed'),\n appealId: appealIdSchema,\n decision: z.enum(['approved', 'denied']),\n }).strict(),\n]);\nexport type NotificationMetadataByType = z.infer<typeof NotificationMetadataByTypeSchema>;\n\n// ============================================================================\n// BROADCAST AUDIENCE SELECTOR\n// ============================================================================\n\n/**\n * Admin broadcast audience selector. Stored on a broadcast job; the scheduled\n * fan-out worker resolves a page of it into uids (domain-aware queries live in\n * ttt-prod — the package only ever receives uids).\n */\nexport const BroadcastAudienceSelectorSchema = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('allActiveUsers') }).strict(),\n z.object({\n kind: z.literal('explicitUids'),\n // The selector's documented audience cap (dedup + serialized-byte enforcement\n // for work/realm snapshots is app-side). Derives from the ONE named constant.\n uids: z.array(userIdSchema).min(1).max(MAX_BROADCAST_EXPLICIT_UIDS),\n }).strict(),\n z.object({\n kind: z.literal('workMembers'),\n workProjectId: workProjectIdSchema,\n }).strict(),\n z.object({\n kind: z.literal('realmMembers'),\n workRealmId: workRealmIdSchema,\n }).strict(),\n z.object({ kind: z.literal('allArtisans') }).strict(),\n]);\nexport type BroadcastAudienceSelector = z.infer<typeof BroadcastAudienceSelectorSchema>;\n\n// ============================================================================\n// CALLABLE INPUT SCHEMAS\n// ============================================================================\n\nexport const CreateNotificationBroadcastInputSchema = z.object({\n // Client-generated idempotency key — the app derives the broadcast eventId\n // deterministically from (actorUid, requestId) so a lost-ack retry is idempotent.\n requestId: z.string().min(1),\n selector: BroadcastAudienceSelectorSchema,\n title: titleSchema,\n message: notificationMessageSchema,\n}).strict();\nexport type CreateNotificationBroadcastInput = z.infer<typeof CreateNotificationBroadcastInputSchema>;\n\n/** Archive scope: a single notification, or the caller's whole category. */\nexport const ArchiveNotificationScopeSchema = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('single'), notificationId: z.string().min(1) }).strict(),\n z.object({ kind: z.literal('all') }).strict(),\n]);\nexport type ArchiveNotificationScope = z.infer<typeof ArchiveNotificationScopeSchema>;\n\n// No `device` field on the archive input — archive metadata is server-derived (A1).\nexport const ArchiveNotificationInputSchema = z.object({\n category: NotificationCategorySchema,\n scope: ArchiveNotificationScopeSchema,\n}).strict();\nexport type ArchiveNotificationInput = z.infer<typeof ArchiveNotificationInputSchema>;\n\n// Shared admin notifications have no per-admin seen state, so only the personal\n// `user` category can be marked seen.\nexport const MarkNotificationsSeenInputSchema = z.object({\n category: z.literal('user'),\n}).strict();\nexport type MarkNotificationsSeenInput = z.infer<typeof MarkNotificationsSeenInputSchema>;\n\n// ============================================================================\n// OBSERVED-GENERATION CALLABLE INPUT SCHEMAS (P6 tray)\n//\n// These are for the NEW observed-generation callables the P6 notification tray\n// will invoke. The LEGACY schemas above (MarkNotificationsSeenInputSchema /\n// ArchiveNotificationInputSchema) remain intact — the legacy callables still use\n// them.\n// ============================================================================\n\n// Max items per mark-seen call matches a sane notification tray page size.\nconst MARK_SEEN_MAX_ITEMS = 50;\n\n/**\n * A single rendered notification row and the generation the UI observed.\n * `activeId` is the Firestore active-notification document id;\n * `observedActivityGeneration` is the opaque token from that document.\n */\nconst SeenItemSchema = z.object({\n activeId: z.string().min(1),\n observedActivityGeneration: z.string().min(1),\n}).strict();\n\n/**\n * Input for the new observed-generation mark-seen callable (P6 tray).\n *\n * The UI sends only the rows it actually rendered plus their observed\n * `activityGeneration` tokens. The server sets `seenAt = now` ONLY when the\n * card's current `activityGeneration` matches `observedActivityGeneration`;\n * otherwise it is a no-op for that row (activity arrived after render, or a\n * delete+recreate rotated the token).\n *\n * category is always `'user'` — shared admin notifications have no per-admin\n * seen state.\n */\nexport const MarkNotificationsSeenObservedInputSchema = z.object({\n category: z.literal('user'),\n items: z.array(SeenItemSchema).min(1).max(MARK_SEEN_MAX_ITEMS),\n}).strict();\nexport type MarkNotificationsSeenObservedInput = z.infer<typeof MarkNotificationsSeenObservedInputSchema>;\n\n/**\n * Archive scope for the observed-generation callable.\n *\n * `single` — archive one notification card. Carries `notificationId` (the\n * active-card doc id) and `observedActivityGeneration` (the precondition:\n * the server archives only if the card's current generation matches).\n *\n * `all` — archive every card in the category. The per-card generation\n * precondition is applied server-side per card during bounded-page sweeps;\n * the caller supplies no single generation token here because there is no\n * single observed generation for the whole category. (Design choice: archive-all\n * carries no observedActivityGeneration at the top level; the server reads each\n * card's current generation as its own precondition. This is consistent with the\n * NOTIFICATIONS_REDESIGN \"mark-all/archive-all run bounded pages with stable\n * cursors until exhausted\" protocol and the archive-history identity formula\n * which keys each occurrence on requestId independently.)\n */\nexport const ArchiveNotificationObservedScopeSchema = z.discriminatedUnion('kind', [\n z.object({\n kind: z.literal('single'),\n notificationId: z.string().min(1),\n observedActivityGeneration: z.string().min(1),\n }).strict(),\n z.object({\n kind: z.literal('all'),\n }).strict(),\n]);\nexport type ArchiveNotificationObservedScope = z.infer<typeof ArchiveNotificationObservedScopeSchema>;\n\n/**\n * Input for the observed-generation archive callable (P6 tray).\n *\n * `requestId` is a per-call nonce — the tray mints a fresh uuid on every archive /\n * clear-all click, so it is NOT a replay-stability token (R39). Idempotency is provided\n * by ACTIVE-DOC DELETION: a replay finds the card already gone and no-ops, so an archive\n * never double-applies. The server combines `requestId` with the card's `activeId` to\n * form the deterministic history doc id (`hash('notification-archive', category,\n * audienceScope, requestId:activeId)`), so a single archive can never collide on another\n * card's history doc (R35).\n *\n * `category` scopes which active-notification collection is archived\n * (`activeUserNotifications` vs `activeAdminNotifications`) and forms part of\n * the history doc path.\n */\nexport const ArchiveNotificationObservedInputSchema = z.object({\n requestId: z.string().min(1),\n category: NotificationCategorySchema,\n scope: ArchiveNotificationObservedScopeSchema,\n}).strict();\nexport type ArchiveNotificationObservedInput = z.infer<typeof ArchiveNotificationObservedInputSchema>;\n\n// ============================================================================\n// SERVER-OWNED ARCHIVE-ALL JOB (replaces the browser clear-all loop)\n//\n// `enqueueArchiveAll` enqueues ONE durable archive-all job scoped to the tab's\n// category (idempotent per user+category+requestId) and returns { jobId }; the\n// bounded server worker drains that category's active cards each in its own\n// atomic archive+audit txn (per-card observed-generation precondition preserved).\n// `getArchiveAllStatus` is polled by the thin client hook. Per-tab scoping is\n// REQUIRED — a job only ever archives its own category, never all tabs.\n// ============================================================================\n\nexport const EnqueueArchiveAllInputSchema = z.object({\n requestId: z.string().min(1),\n category: NotificationCategorySchema,\n}).strict();\nexport type EnqueueArchiveAllInput = z.infer<typeof EnqueueArchiveAllInputSchema>;\n\nexport const GetArchiveAllStatusInputSchema = z.object({\n jobId: z.string().min(1),\n}).strict();\nexport type GetArchiveAllStatusInput = z.infer<typeof GetArchiveAllStatusInputSchema>;\n\n// Wire contract for the `resumeFanoutJob` callable — the admin console re-arms a\n// dead-lettered notification fanout job by id. Admin console-invoked, but still a\n// wire contract, so it lives here (callable-validation convention) rather than as a\n// local schema in the functions repo.\nexport const ResumeFanoutJobInputSchema = z.object({\n jobId: notificationFanoutJobIdSchema,\n}).strict();\nexport type ResumeFanoutJobInput = z.infer<typeof ResumeFanoutJobInputSchema>;\n\n// ============================================================================\n// AUDIT EVENT PAYLOADS (admin-only)\n// ============================================================================\n\n/**\n * Payload of a `notification.broadcastSent` audit event — written when an admin\n * enqueues a broadcast. Actor mode is `adminReview` / `adminOverride`. Records\n * the selector (never a pre-resolved uid list) + the job it created.\n */\nexport interface NotificationBroadcastSentAuditMetadata {\n jobId: string;\n selector: BroadcastAudienceSelector;\n title: string;\n}\n\n/**\n * Payload of a `notification.adminArchived` audit event — written when an admin\n * clears a shared admin notification (the `handledBy` action). Actor mode is\n * `adminReview` / `adminOverride`.\n */\nexport interface NotificationAdminArchivedAuditMetadata {\n scope: 'single' | 'all';\n /** Present for single-archive; absent for a category-wide `all` archive. */\n notificationId?: string;\n handledBy: string;\n}\n"]}
1
+ {"version":3,"file":"notification.js","sourceRoot":"","sources":["../../src/schemas/notification.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,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AAsC;AACtC,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,KAAK,EAAE,6BAA6B;CACrC,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["// TTT notification contracts.\n//\n// `@ttt-productions/notification-core` is generic — at its package boundary a\n// notification's `metadata` is `Record<string, unknown>`. All TTT notification\n// policy lives here: the canonical type catalog (category / delivery / default\n// channels), the per-type typed `metadata` discriminated union, the broadcast\n// audience selector, and the callable input schemas. `runSendNotification`\n// (ttt-prod) validates `metadata` against the per-type schema before any write.\n//\n// The two notification audit-event payload shapes live here too (the\n// `AuditEventType` union members `notification.broadcastSent` /\n// `notification.adminArchived` are added in ../types/audit.ts; their actor is\n// always an admin mode — `adminReview` / `adminOverride`).\n\nimport { z } from 'zod';\nimport {\n userIdSchema,\n workProjectIdSchema,\n guildInviteIdSchema,\n adminDispatchIdSchema,\n hallItemIdSchema,\n thresholdItemIdSchema,\n changeRequestIdSchema,\n workProjectTypeSchema,\n notificationFanoutJobIdSchema,\n titleSchema,\n reportGroupIdSchema,\n} from './atoms.js';\nimport {\n MAX_THRESHOLD_REVIEW_NOTES_LENGTH,\n MAX_HALL_CHANGE_REQUEST_REASON_LENGTH,\n MAX_NOTIFICATION_MESSAGE_LENGTH,\n MAX_BROADCAST_EXPLICIT_UIDS,\n} from '../constants/business.js';\nimport { HallSubItemTypeSchema } from '../doc-schemas/content.js';\nimport { ReportableItemTypeSchema } from '../doc-schemas/safety/foundation.js';\n\n// String shape atoms specific to notifications.\nconst notificationMessageSchema = z.string().min(1).max(MAX_NOTIFICATION_MESSAGE_LENGTH);\n// The canonical reportable-item enum — never an open string (ARCH-102).\nconst reportedItemTypeSchema = ReportableItemTypeSchema;\nconst reportedItemIdSchema = z.string().min(1).max(128);\nconst reportIdSchema = z.string().min(1);\nconst appealIdSchema = z.string().min(1);\nconst workRealmIdSchema = z.string().min(1);\n\n// ============================================================================\n// TYPE + CHANNEL CATALOG\n// ============================================================================\n\nexport const NOTIFICATION_TYPE_VALUES = [\n 'content_report',\n 'guild_invite',\n 'admin_dispatch_reply',\n 'threshold_library_submission',\n // Author feedback for a Threshold Library review decision (only needs_revision is\n // delivered today — an approval reaches the author via the publish member fanout).\n 'threshold_library_reviewed',\n // Proposer feedback for a PUBLISHED change-request decision (approve/deny).\n 'hall_content_change_request_resolved',\n 'admin_announcement',\n 'followed_content_published',\n // chat-edge-rebuild P7 — the two new fanout triggers (NOTIFICATIONS_REDESIGN \"Triggers\").\n // `member_content_published`: the Hall-publish MEMBER job (\"your work was published!\") — same\n // `thresholdItemId` eventId as the follower job, different type so `deliveryId` stays distinct.\n // `followed_craft_skill_published`: craft-skill publish → the artisan's followers\n // (`staticRelight` strategy — count 1 forever, static copy, no count shown).\n 'member_content_published',\n 'followed_craft_skill_published',\n // Reporter feedback (DJ ruling 2026-07-06): when a report a user submitted is\n // closed as a REAL case WITH action (ordinary report root flips to `actioned`),\n // the reporter gets one light informational card. Never sent on dismissals.\n // Generic copy only — the card must not reveal the reported user, reason, or\n // remedy (a bad-faith reporter must not be able to probe moderation outcomes).\n 'report_action_taken',\n // Appellant feedback for a content-appeal decision (DJ ruling 2026-07-10 —\n // gap found by the hosted E2E build: reviewContentAppeal decided appeals with\n // NO channel reporting the outcome to the appellant). Fired on BOTH approve\n // and deny. It is the appellant's OWN appeal, so unlike report_action_taken\n // there is no privacy ceiling: the card states the outcome plainly and\n // targets My Uploads, where the resulting upload state lives.\n 'content_appeal_reviewed',\n] as const;\n\nexport const NotificationTypeSchema = z.enum(NOTIFICATION_TYPE_VALUES);\nexport type NotificationType = z.infer<typeof NotificationTypeSchema>;\n\n/** Delivery channels. Only `inApp` is implemented at launch; `email`/`push`\n * are future channel handlers dispatched from the `runSendNotification`\n * chokepoint. */\nexport const NOTIFICATION_CHANNEL_VALUES = ['inApp', 'email', 'push'] as const;\nexport const NotificationChannelSchema = z.enum(NOTIFICATION_CHANNEL_VALUES);\nexport type NotificationChannel = z.infer<typeof NotificationChannelSchema>;\n\nexport type NotificationCategory = 'user' | 'admin';\nexport const NotificationCategorySchema = z.enum(['user', 'admin']);\n\nexport interface NotificationTypeCatalogEntry {\n /** Which active collection / audience this type writes to. */\n category: NotificationCategory;\n /** `realtime` writes straight to active; `queued` goes through the batch processor. */\n delivery: 'realtime' | 'queued';\n /** Default channel list applied when a send omits `channels`. All `['inApp']` at launch. */\n defaultChannels: NotificationChannel[];\n}\n\n/**\n * The canonical TTT notification type catalog. `runSendNotification` resolves a\n * type's category/delivery here and carries `defaultChannels` through when a\n * send omits `channels`.\n */\nexport const NOTIFICATION_TYPE_CATALOG: Record<NotificationType, NotificationTypeCatalogEntry> = {\n content_report: { category: 'admin', delivery: 'realtime', defaultChannels: ['inApp'] },\n guild_invite: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n admin_dispatch_reply: { category: 'user', delivery: 'realtime', defaultChannels: ['inApp'] },\n threshold_library_submission: { category: 'admin', delivery: 'queued', defaultChannels: ['inApp'] },\n threshold_library_reviewed: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n hall_content_change_request_resolved: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n admin_announcement: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n followed_content_published: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n member_content_published: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n followed_craft_skill_published: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n report_action_taken: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n content_appeal_reviewed: { category: 'user', delivery: 'queued', defaultChannels: ['inApp'] },\n};\n\n// ============================================================================\n// PER-TYPE METADATA (discriminated union, keyed by `type`)\n// ============================================================================\n\n/**\n * Typed `metadata` payload for each notification type. The generic package\n * boundary takes `Record<string, unknown>`; the app validates against this\n * before sending so each type's payload is checked like every other callable\n * schema.\n */\nexport const NotificationMetadataByTypeSchema = z.discriminatedUnion('type', [\n z.object({\n type: z.literal('content_report'),\n reportGroupId: reportGroupIdSchema,\n reportedItemType: reportedItemTypeSchema,\n reportedItemId: reportedItemIdSchema,\n }).strict(),\n z.object({\n type: z.literal('guild_invite'),\n workProjectId: workProjectIdSchema,\n guildInviteId: guildInviteIdSchema,\n workTitle: titleSchema,\n }).strict(),\n z.object({\n type: z.literal('admin_dispatch_reply'),\n adminDispatchId: adminDispatchIdSchema,\n // Party-generic dispatch: present on workProject-party threads so the card routes\n // to the Work's correspondence surface. Absent on user-party threads (legacy shape).\n partyKind: z.enum(['user', 'workProject']).optional(),\n workProjectId: workProjectIdSchema.optional(),\n }).strict(),\n z.object({\n type: z.literal('threshold_library_submission'),\n thresholdItemId: thresholdItemIdSchema,\n hallItemId: hallItemIdSchema,\n workProjectId: workProjectIdSchema,\n }).strict(),\n // Author feedback for a review decision. Mirrors what runReviewThresholdItem\n // (ttt-prod) sends: only `needs_revision` is delivered today; `adminNotes` is\n // the reviewer's note, sent as null when the reviewer left none.\n z.object({\n type: z.literal('threshold_library_reviewed'),\n thresholdItemId: thresholdItemIdSchema,\n hallItemId: hallItemIdSchema,\n workProjectId: workProjectIdSchema,\n workProjectType: workProjectTypeSchema,\n itemId: z.string().min(1),\n decision: z.literal('needs_revision'),\n adminNotes: z.string().max(MAX_THRESHOLD_REVIEW_NOTES_LENGTH).nullable(),\n }).strict(),\n // Proposer feedback for a published change-request decision. Mirrors what\n // runReviewHallContentChangeRequest (ttt-prod) sends: `resolutionReason` is\n // required on a deny, optional on an approve — null when absent. The realm\n // grain (R1) sends `workRealmId` with `hallItemId` null; hall grains the\n // reverse.\n z.object({\n type: z.literal('hall_content_change_request_resolved'),\n changeRequestId: changeRequestIdSchema,\n hallItemId: hallItemIdSchema.nullable(),\n workRealmId: z.string().min(1).nullish(),\n workProjectId: workProjectIdSchema,\n decision: z.enum(['approved', 'denied']),\n resolutionReason: z.string().max(MAX_HALL_CHANGE_REQUEST_REASON_LENGTH).nullable(),\n }).strict(),\n z.object({\n type: z.literal('admin_announcement'),\n title: titleSchema,\n message: notificationMessageSchema,\n }).strict(),\n z.object({\n type: z.literal('followed_content_published'),\n workProjectId: workProjectIdSchema,\n workTitle: titleSchema,\n hallItemId: hallItemIdSchema,\n hallItemTitle: titleSchema,\n hallSubItemType: HallSubItemTypeSchema,\n }).strict(),\n // P7 Hall-publish MEMBER job — same Hall-publication fields as the follower type (it describes\n // the SAME publication to the work's members; the work route + \"your work was published!\" copy\n // are set by the emitter via targetPath/title, not metadata).\n z.object({\n type: z.literal('member_content_published'),\n workProjectId: workProjectIdSchema,\n workTitle: titleSchema,\n hallItemId: hallItemIdSchema,\n hallItemTitle: titleSchema,\n hallSubItemType: HallSubItemTypeSchema,\n }).strict(),\n // P7 craft-skill publish — points at the artisan whose skills updated. The actor name\n // (\"X uploaded new craft skills\") + the profile/skills route resolve from `artisanUid` at\n // render time (Display Identity Invariant); `staticRelight` shows no count.\n z.object({\n type: z.literal('followed_craft_skill_published'),\n artisanUid: userIdSchema,\n }).strict(),\n // Reporter feedback — metadata is deliberately minimal: `reportId` is the\n // reporter's OWN report-root doc id (deterministic per reporterUid + target,\n // see writeOrdinaryReport), used only as the dedup/aggregation key so a\n // reporter gets at most one card per report they filed. NO fields that\n // identify the reported user/content/remedy may ever be added here.\n z.object({\n type: z.literal('report_action_taken'),\n reportId: reportIdSchema,\n }).strict(),\n // Appellant feedback for a content-appeal decision. `appealId` is the\n // appellant's OWN appeal doc id (the dedup/aggregation key — one card per\n // appeal, a re-decision coalesces); `decision` drives the card copy.\n z.object({\n type: z.literal('content_appeal_reviewed'),\n appealId: appealIdSchema,\n decision: z.enum(['approved', 'denied']),\n }).strict(),\n]);\nexport type NotificationMetadataByType = z.infer<typeof NotificationMetadataByTypeSchema>;\n\n// ============================================================================\n// BROADCAST AUDIENCE SELECTOR\n// ============================================================================\n\n/**\n * Admin broadcast audience selector. Stored on a broadcast job; the scheduled\n * fan-out worker resolves a page of it into uids (domain-aware queries live in\n * ttt-prod — the package only ever receives uids).\n */\nexport const BroadcastAudienceSelectorSchema = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('allActiveUsers') }).strict(),\n z.object({\n kind: z.literal('explicitUids'),\n // The selector's documented audience cap (dedup + serialized-byte enforcement\n // for work/realm snapshots is app-side). Derives from the ONE named constant.\n uids: z.array(userIdSchema).min(1).max(MAX_BROADCAST_EXPLICIT_UIDS),\n }).strict(),\n z.object({\n kind: z.literal('workMembers'),\n workProjectId: workProjectIdSchema,\n }).strict(),\n z.object({\n kind: z.literal('realmMembers'),\n workRealmId: workRealmIdSchema,\n }).strict(),\n z.object({ kind: z.literal('allArtisans') }).strict(),\n]);\nexport type BroadcastAudienceSelector = z.infer<typeof BroadcastAudienceSelectorSchema>;\n\n// ============================================================================\n// CALLABLE INPUT SCHEMAS\n// ============================================================================\n\nexport const CreateNotificationBroadcastInputSchema = z.object({\n // Client-generated idempotency key — the app derives the broadcast eventId\n // deterministically from (actorUid, requestId) so a lost-ack retry is idempotent.\n requestId: z.string().min(1),\n selector: BroadcastAudienceSelectorSchema,\n title: titleSchema,\n message: notificationMessageSchema,\n}).strict();\nexport type CreateNotificationBroadcastInput = z.infer<typeof CreateNotificationBroadcastInputSchema>;\n\n/** Archive scope: a single notification, or the caller's whole category. */\nexport const ArchiveNotificationScopeSchema = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('single'), notificationId: z.string().min(1) }).strict(),\n z.object({ kind: z.literal('all') }).strict(),\n]);\nexport type ArchiveNotificationScope = z.infer<typeof ArchiveNotificationScopeSchema>;\n\n// No `device` field on the archive input — archive metadata is server-derived (A1).\nexport const ArchiveNotificationInputSchema = z.object({\n category: NotificationCategorySchema,\n scope: ArchiveNotificationScopeSchema,\n}).strict();\nexport type ArchiveNotificationInput = z.infer<typeof ArchiveNotificationInputSchema>;\n\n// Shared admin notifications have no per-admin seen state, so only the personal\n// `user` category can be marked seen.\nexport const MarkNotificationsSeenInputSchema = z.object({\n category: z.literal('user'),\n}).strict();\nexport type MarkNotificationsSeenInput = z.infer<typeof MarkNotificationsSeenInputSchema>;\n\n// ============================================================================\n// OBSERVED-GENERATION CALLABLE INPUT SCHEMAS (P6 tray)\n//\n// These are for the NEW observed-generation callables the P6 notification tray\n// will invoke. The LEGACY schemas above (MarkNotificationsSeenInputSchema /\n// ArchiveNotificationInputSchema) remain intact — the legacy callables still use\n// them.\n// ============================================================================\n\n// Max items per mark-seen call matches a sane notification tray page size.\nconst MARK_SEEN_MAX_ITEMS = 50;\n\n/**\n * A single rendered notification row and the generation the UI observed.\n * `activeId` is the Firestore active-notification document id;\n * `observedActivityGeneration` is the opaque token from that document.\n */\nconst SeenItemSchema = z.object({\n activeId: z.string().min(1),\n observedActivityGeneration: z.string().min(1),\n}).strict();\n\n/**\n * Input for the new observed-generation mark-seen callable (P6 tray).\n *\n * The UI sends only the rows it actually rendered plus their observed\n * `activityGeneration` tokens. The server sets `seenAt = now` ONLY when the\n * card's current `activityGeneration` matches `observedActivityGeneration`;\n * otherwise it is a no-op for that row (activity arrived after render, or a\n * delete+recreate rotated the token).\n *\n * category is always `'user'` — shared admin notifications have no per-admin\n * seen state.\n */\nexport const MarkNotificationsSeenObservedInputSchema = z.object({\n category: z.literal('user'),\n items: z.array(SeenItemSchema).min(1).max(MARK_SEEN_MAX_ITEMS),\n}).strict();\nexport type MarkNotificationsSeenObservedInput = z.infer<typeof MarkNotificationsSeenObservedInputSchema>;\n\n/**\n * Archive scope for the observed-generation callable.\n *\n * `single` — archive one notification card. Carries `notificationId` (the\n * active-card doc id) and `observedActivityGeneration` (the precondition:\n * the server archives only if the card's current generation matches).\n *\n * `all` — archive every card in the category. The per-card generation\n * precondition is applied server-side per card during bounded-page sweeps;\n * the caller supplies no single generation token here because there is no\n * single observed generation for the whole category. (Design choice: archive-all\n * carries no observedActivityGeneration at the top level; the server reads each\n * card's current generation as its own precondition. This is consistent with the\n * NOTIFICATIONS_REDESIGN \"mark-all/archive-all run bounded pages with stable\n * cursors until exhausted\" protocol and the archive-history identity formula\n * which keys each occurrence on requestId independently.)\n */\nexport const ArchiveNotificationObservedScopeSchema = z.discriminatedUnion('kind', [\n z.object({\n kind: z.literal('single'),\n notificationId: z.string().min(1),\n observedActivityGeneration: z.string().min(1),\n }).strict(),\n z.object({\n kind: z.literal('all'),\n }).strict(),\n]);\nexport type ArchiveNotificationObservedScope = z.infer<typeof ArchiveNotificationObservedScopeSchema>;\n\n/**\n * Input for the observed-generation archive callable (P6 tray).\n *\n * `requestId` is a per-call nonce — the tray mints a fresh uuid on every archive /\n * clear-all click, so it is NOT a replay-stability token (R39). Idempotency is provided\n * by ACTIVE-DOC DELETION: a replay finds the card already gone and no-ops, so an archive\n * never double-applies. The server combines `requestId` with the card's `activeId` to\n * form the deterministic history doc id (`hash('notification-archive', category,\n * audienceScope, requestId:activeId)`), so a single archive can never collide on another\n * card's history doc (R35).\n *\n * `category` scopes which active-notification collection is archived\n * (`activeUserNotifications` vs `activeAdminNotifications`) and forms part of\n * the history doc path.\n */\nexport const ArchiveNotificationObservedInputSchema = z.object({\n requestId: z.string().min(1),\n category: NotificationCategorySchema,\n scope: ArchiveNotificationObservedScopeSchema,\n}).strict();\nexport type ArchiveNotificationObservedInput = z.infer<typeof ArchiveNotificationObservedInputSchema>;\n\n// ============================================================================\n// SERVER-OWNED ARCHIVE-ALL JOB (replaces the browser clear-all loop)\n//\n// `enqueueArchiveAll` enqueues ONE durable archive-all job scoped to the tab's\n// category (idempotent per user+category+requestId) and returns { jobId }; the\n// bounded server worker drains that category's active cards each in its own\n// atomic archive+audit txn (per-card observed-generation precondition preserved).\n// `getArchiveAllStatus` is polled by the thin client hook. Per-tab scoping is\n// REQUIRED — a job only ever archives its own category, never all tabs.\n// ============================================================================\n\nexport const EnqueueArchiveAllInputSchema = z.object({\n requestId: z.string().min(1),\n category: NotificationCategorySchema,\n}).strict();\nexport type EnqueueArchiveAllInput = z.infer<typeof EnqueueArchiveAllInputSchema>;\n\nexport const GetArchiveAllStatusInputSchema = z.object({\n jobId: z.string().min(1),\n}).strict();\nexport type GetArchiveAllStatusInput = z.infer<typeof GetArchiveAllStatusInputSchema>;\n\n// Wire contract for the `resumeFanoutJob` callable — the admin console re-arms a\n// dead-lettered notification fanout job by id. Admin console-invoked, but still a\n// wire contract, so it lives here (callable-validation convention) rather than as a\n// local schema in the functions repo.\nexport const ResumeFanoutJobInputSchema = z.object({\n jobId: notificationFanoutJobIdSchema,\n}).strict();\nexport type ResumeFanoutJobInput = z.infer<typeof ResumeFanoutJobInputSchema>;\n\n// ============================================================================\n// AUDIT EVENT PAYLOADS (admin-only)\n// ============================================================================\n\n/**\n * Payload of a `notification.broadcastSent` audit event — written when an admin\n * enqueues a broadcast. Actor mode is `adminReview` / `adminOverride`. Records\n * the selector (never a pre-resolved uid list) + the job it created.\n */\nexport interface NotificationBroadcastSentAuditMetadata {\n jobId: string;\n selector: BroadcastAudienceSelector;\n title: string;\n}\n\n/**\n * Payload of a `notification.adminArchived` audit event — written when an admin\n * clears a shared admin notification (the `handledBy` action). Actor mode is\n * `adminReview` / `adminOverride`.\n */\nexport interface NotificationAdminArchivedAuditMetadata {\n scope: 'single' | 'all';\n /** Present for single-archive; absent for a category-wide `all` archive. */\n notificationId?: string;\n handledBy: string;\n}\n"]}
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  /**
3
3
  * The per-account safety action the operator command applies — an ALIAS of the ONE
4
4
  * canonical `AccountActionSchema` (../doc-schemas/safety/sagas.ts), re-exported under
5
- * the callable-input name. Never a re-declared literal (Rule 36).
5
+ * the callable-input name. Never a re-declared literal (ARCH-102).
6
6
  */
7
7
  export declare const CommandAccountActionSchema: z.ZodEnum<{
8
8
  none: "none";
@@ -23,7 +23,7 @@ import { SafetyEvidenceExternalFactKindSchema } from '../doc-schemas/safety/evid
23
23
  /**
24
24
  * The per-account safety action the operator command applies — an ALIAS of the ONE
25
25
  * canonical `AccountActionSchema` (../doc-schemas/safety/sagas.ts), re-exported under
26
- * the callable-input name. Never a re-declared literal (Rule 36).
26
+ * the callable-input name. Never a re-declared literal (ARCH-102).
27
27
  */
28
28
  export const CommandAccountActionSchema = AccountActionSchema;
29
29
  export const CommandAccountActionInputSchema = z
@@ -1 +1 @@
1
- {"version":3,"file":"safety.js","sourceRoot":"","sources":["../../src/schemas/safety.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,EAAE;AACF,mFAAmF;AACnF,yFAAyF;AACzF,4FAA4F;AAC5F,yFAAyF;AACzF,0FAA0F;AAC1F,EAAE;AACF,wFAAwF;AACxF,yFAAyF;AACzF,4FAA4F;AAC5F,yFAAyF;AACzF,0BAA0B;AAE1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,sCAAsC,EACtC,kCAAkC,GACnC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,kCAAkC,EAClC,iCAAiC,EACjC,sCAAsC,EACtC,iCAAiC,EACjC,oCAAoC,GACrC,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EACL,4BAA4B,EAC5B,0CAA0C,GAC3C,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oCAAoC,EAAE,MAAM,mCAAmC,CAAC;AAEzF,8EAA8E;AAC9E,mFAAmF;AACnF,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,mBAAmB,CAAC;AAG9D,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC;KAC7C,MAAM,CAAC;IACN,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,MAAM,EAAE,0BAA0B;IAClC,wDAAwD;IACxD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAA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AAC,CAAC,CAAC;IACzB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC7B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,0BAA0B,CAAC;IACzD,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,oCAAoC,CAAC;CAC9D,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// TTT safety-domain callable input schemas.\n//\n// The Trust & Safety operator surface (safety case console, evidence reveal, NCMEC\n// manual-portal completion, per-account safety actions, operator TOTP step-up, retained-\n// evidence inventory, party panel, TAKE IT DOWN request detail, protected-context re-fetch)\n// crosses the backend↔frontend boundary, so its callable input contracts live here — the\n// single source of truth — instead of being redefined locally in `functions/src/safety/`.\n//\n// Every object schema is `.strict()` so an unknown field on a privileged operator/admin\n// action is REJECTED rather than silently accepted (defense-in-depth on the highest-risk\n// callables). `caseId` / `targetUid` / `requestId` / `submissionId` and similar identifiers\n// are plain `z.string().min(1)` — matching the shapes the callables accept today; do not\n// broaden or weaken them.\n\nimport { z } from 'zod';\nimport {\n MAX_INTERNAL_REASON_LENGTH,\n MAX_USER_FACING_REASON_LENGTH,\n MAX_SAFETY_ARTIFACT_DESCRIPTION_LENGTH,\n MAX_NCMEC_PORTAL_PROOF_TEXT_LENGTH,\n} from '../constants/business.js';\nimport {\n SAFETY_ACCOUNT_ACTION_CONFIRMATION,\n NCMEC_PORTAL_RECEIPT_CONFIRMATION,\n NCMEC_MANUAL_PORTAL_FILED_CONFIRMATION,\n REVEAL_CASE_EVIDENCE_CONFIRMATION,\n NCMEC_PORTAL_CORRECTION_CONFIRMATION,\n} from '../constants/safety-confirmation-phrases.js';\nimport { AccountActionSchema } from '../doc-schemas/safety/sagas.js';\nimport {\n ChildSafetyAccountRoleSchema,\n ChildSafetyAccountSubjectDispositionSchema,\n} from '../doc-schemas/safety/case.js';\nimport { SafetyEvidenceExternalFactKindSchema } from '../doc-schemas/safety/evidence.js';\n\n// ---------------------------------------------------------------------------\n// commandAccountAction — apply a per-account safety action on a child-safety case.\n// ---------------------------------------------------------------------------\n\n/**\n * The per-account safety action the operator command applies — an ALIAS of the ONE\n * canonical `AccountActionSchema` (../doc-schemas/safety/sagas.ts), re-exported under\n * the callable-input name. Never a re-declared literal (Rule 36).\n */\nexport const CommandAccountActionSchema = AccountActionSchema;\nexport type CommandAccountActionValue = z.infer<typeof CommandAccountActionSchema>;\n\nexport const CommandAccountActionInputSchema = z\n .object({\n caseId: z.string().min(1),\n targetUid: z.string().min(1),\n action: CommandAccountActionSchema,\n /** Operator-facing internal rationale (LE-loggable). */\n reasonInternal: z.string().min(4, 'An internal reason is required.').max(MAX_INTERNAL_REASON_LENGTH),\n /** The generic owner-readable reason (no detail leaks). */\n reasonUserFacing: z.string().min(1).max(MAX_USER_FACING_REASON_LENGTH),\n /** Per-account case role (A1b) — the canonical case enums, never re-declared. */\n role: ChildSafetyAccountRoleSchema,\n subjectDisposition: ChildSafetyAccountSubjectDispositionSchema,\n confirmation: z.literal(SAFETY_ACCOUNT_ACTION_CONFIRMATION),\n })\n .strict();\nexport type CommandAccountActionInput = z.infer<typeof CommandAccountActionInputSchema>;\n\n// ---------------------------------------------------------------------------\n// getSafetyCaseConsole — paginated read of the active safety-case console.\n// ---------------------------------------------------------------------------\n\n/** Cursor for the next page of a paginated console source — the last row's `(orderField value, docId)`. */\nexport const SafetyCaseConsoleCursorSchema = z\n .object({ v: z.number(), id: z.string().min(1) })\n .strict();\nexport type SafetyCaseConsoleCursor = z.infer<typeof SafetyCaseConsoleCursorSchema>;\n\nconst SAFETY_CONSOLE_MAX_PAGE_SIZE = 200;\n\nexport const GetSafetyCaseConsoleInputSchema = z\n .object({\n pageSize: z.number().int().min(1).max(SAFETY_CONSOLE_MAX_PAGE_SIZE).optional(),\n childSafetyCursor: SafetyCaseConsoleCursorSchema.nullish(),\n nciiCursor: SafetyCaseConsoleCursorSchema.nullish(),\n takeItDownCursor: SafetyCaseConsoleCursorSchema.nullish(),\n })\n .strict()\n .nullish();\nexport type GetSafetyCaseConsoleInput = z.infer<typeof GetSafetyCaseConsoleInputSchema>;\n\n// ---------------------------------------------------------------------------\n// getSafetyCaseById — full-admin read of a terminal safety case by id.\n// ---------------------------------------------------------------------------\n\nexport const GetSafetyCaseByIdInputSchema = z\n .object({\n caseType: z.enum(['csam', 'ncii']),\n caseId: z.string().min(1).max(200),\n })\n .strict();\nexport type GetSafetyCaseByIdInput = z.infer<typeof GetSafetyCaseByIdInputSchema>;\n\n// ---------------------------------------------------------------------------\n// getSafetyCaseParties — server-resolved party panel for a safety case.\n// ---------------------------------------------------------------------------\n\nexport const GetSafetyCasePartiesInputSchema = z\n .object({\n caseType: z.enum(['csam', 'ncii']),\n caseId: z.string().min(1),\n })\n .strict();\nexport type GetSafetyCasePartiesInput = z.infer<typeof GetSafetyCasePartiesInputSchema>;\n\n// ---------------------------------------------------------------------------\n// getTakeItDownRequestDetail — operator detail read for one public TAKE IT DOWN request.\n// ---------------------------------------------------------------------------\n\nexport const GetTakeItDownRequestDetailInputSchema = z\n .object({\n requestId: z.string().min(1),\n })\n .strict();\nexport type GetTakeItDownRequestDetailInput = z.infer<typeof GetTakeItDownRequestDetailInputSchema>;\n\n// ---------------------------------------------------------------------------\n// listRetainedEvidenceInventory — paginated retained-evidence inventory read.\n// ---------------------------------------------------------------------------\n\n/** Cursor for the retained-evidence inventory — the last row's `(createdAt, docId)`. */\nexport const RetainedEvidenceInventoryCursorSchema = z\n .object({ createdAt: z.number(), id: z.string().min(1) })\n .strict();\nexport type RetainedEvidenceInventoryCursor = z.infer<typeof RetainedEvidenceInventoryCursorSchema>;\n\nconst RETAINED_EVIDENCE_MAX_PAGE_SIZE = 200;\n\nexport const ListRetainedEvidenceInventoryInputSchema = z\n .object({\n pageSize: z.number().int().min(1).max(RETAINED_EVIDENCE_MAX_PAGE_SIZE).optional(),\n cursor: RetainedEvidenceInventoryCursorSchema.nullish(),\n /** Exact inventoryId lookup — returns just that row (or none), ignoring the cursor. */\n exactId: z.string().min(1).optional(),\n })\n .strict()\n .nullish();\nexport type ListRetainedEvidenceInventoryInput = z.infer<typeof ListRetainedEvidenceInventoryInputSchema>;\n\n// ---------------------------------------------------------------------------\n// ncmecOperatorCommands — NCMEC manual-portal completion path.\n// ---------------------------------------------------------------------------\n\nexport const RecordNcmecPortalReceiptArtifactInputSchema = z\n .object({\n caseId: z.string().min(1),\n submissionId: z.string().min(1),\n /** The key of an object already in the restricted evidence vault (verified via statObject). */\n evidenceVaultKey: z.string().min(1, 'An evidence vault object key is required.'),\n /** Optional operator description of what the artifact is (e.g. \"NCMEC portal screenshot\"). */\n description: z.string().min(1).max(MAX_SAFETY_ARTIFACT_DESCRIPTION_LENGTH).optional(),\n /** Explicit typed confirmation (interim control until the passkey profile lands). */\n confirmation: z.literal(NCMEC_PORTAL_RECEIPT_CONFIRMATION),\n })\n .strict();\nexport type RecordNcmecPortalReceiptArtifactInput = z.infer<\n typeof RecordNcmecPortalReceiptArtifactInputSchema\n>;\n\nexport const MarkNcmecPortalCompleteInputSchema = z\n .object({\n caseId: z.string().min(1),\n submissionId: z.string().min(1),\n /** [Q13/H-06] The ID of an existing NcmecPortalReceiptArtifactV1 record bound to this (caseId, submissionId). */\n artifactId: z.string().min(1, 'A valid portal-receipt artifact id is required.'),\n /** [Q13/H-06] The object generation recorded on the artifact at registration time (immutable-object peg). */\n artifactObjectGeneration: z.string().min(1, 'The artifact object generation is required.'),\n /** [Q13/H-06] The sha256 hex digest recorded on the artifact at registration time (content-integrity check). */\n artifactSha256: z.string().regex(/^[0-9a-f]{64}$/, 'artifactSha256 must be a 64-character hex string.'),\n /** Optional operator free-text note describing the portal confirmation. */\n proofText: z.string().min(1).max(MAX_NCMEC_PORTAL_PROOF_TEXT_LENGTH).optional(),\n /** The NCMEC-assigned report id — REQUIRED (it IS the proof; no \"filed, number pending\" grace). */\n ncmecReportId: z.string().min(1, 'The NCMEC report id is required to mark the report complete.'),\n /** Explicit typed confirmation (interim control until the passkey profile lands). */\n confirmation: z.literal(NCMEC_MANUAL_PORTAL_FILED_CONFIRMATION),\n })\n .strict();\nexport type MarkNcmecPortalCompleteInput = z.infer<typeof MarkNcmecPortalCompleteInputSchema>;\n\n// ---------------------------------------------------------------------------\n// operatorStepUp — app-level TOTP step-up (confirm / verify a 6-digit code).\n// ---------------------------------------------------------------------------\n\nexport const OperatorStepUpCodeInputSchema = z\n .object({\n code: z.string().trim().regex(/^\\d{6}$/u, 'Enter the 6-digit code.'),\n })\n .strict();\nexport type OperatorStepUpCodeInput = z.infer<typeof OperatorStepUpCodeInputSchema>;\n\n// ---------------------------------------------------------------------------\n// revealCaseEvidence — metadata→evidence reveal under reauth.\n// ---------------------------------------------------------------------------\n\nexport const RevealCaseEvidenceInputSchema = z\n .object({\n caseId: z.string().min(1),\n /** Explicit typed confirmation (interim control until the passkey profile lands). */\n confirmation: z.literal(REVEAL_CASE_EVIDENCE_CONFIRMATION),\n /** The operator's child-safety warning acknowledgement, carried so the backend can persist it\n * in the reveal audit trail. This schema serves ONLY the safety-console reveal-under-reauth\n * flow (its sibling `confirmation` literal gates the same surface), so the acknowledgement is a\n * required `true` — consistent with the existing explicit-confirmation style. Server-side\n * enforcement + audit persistence land app-side. */\n warningAcknowledged: z.literal(true),\n })\n .strict();\nexport type RevealCaseEvidenceInput = z.infer<typeof RevealCaseEvidenceInputSchema>;\n\n// ---------------------------------------------------------------------------\n// refetchProtectedCaseContext — operator manual re-fetch of protected chat context.\n// ---------------------------------------------------------------------------\n\nexport const RefetchProtectedCaseContextInputSchema = z\n .object({\n caseId: z.string().min(1),\n lane: z.enum(['csam', 'ncii']),\n })\n .strict();\nexport type RefetchProtectedCaseContextInput = z.infer<typeof RefetchProtectedCaseContextInputSchema>;\n\n// ---------------------------------------------------------------------------\n// preserveAsEvidence — general-purpose ADMIN \"Preserve as Evidence\" callable.\n// ---------------------------------------------------------------------------\n\n/**\n * A target to preserve, discriminated by surface. Non-strict members are carried faithfully\n * from the source callable. The id / path / ref bounds are opaque structural caps (not user\n * text), and the augmentation `factKind` REUSES the canonical evidence external-fact enum\n * (`SafetyEvidenceExternalFactKindSchema`) rather than re-declaring its members.\n */\nexport const PreserveTargetSchema = z.discriminatedUnion('targetKind', [\n z.object({\n targetKind: z.literal('media'),\n mediaAssetId: z.string().min(1).max(256),\n }),\n z.object({\n targetKind: z.literal('post'),\n postDocPath: z.string().min(1).max(1024),\n revision: z.number().int().nonnegative().optional(),\n }),\n z.object({\n targetKind: z.literal('profile'),\n uid: z.string().min(1).max(256),\n revision: z.number().int().nonnegative().optional(),\n }),\n z.object({\n targetKind: z.literal('chat'),\n channelId: z.string().min(1).max(256),\n messageSeqStart: z.number().int().nonnegative(),\n messageSeqEnd: z.number().int().nonnegative(),\n transcriptObjectRef: z.string().min(1).max(1024),\n attachmentItemIds: z.array(z.string().min(1)).max(256).optional(),\n }),\n]);\nexport type PreserveTarget = z.infer<typeof PreserveTargetSchema>;\n\nexport const PreserveAsEvidenceInputSchema = z\n .object({\n /** Attach to an existing case; absent → open a standalone preservation case. */\n caseId: z.string().min(1).max(256).optional(),\n target: PreserveTargetSchema,\n /** Operator note recorded on the case (internal). */\n reasonInternal: z.string().min(1).max(MAX_INTERNAL_REASON_LENGTH),\n /** Optional admin AUGMENTATION — extra externalFact refs preserved alongside the baseline. */\n augmentations: z\n .array(\n z.object({\n factKind: SafetyEvidenceExternalFactKindSchema,\n narrativeRef: z.string().min(1).max(1024),\n }),\n )\n .max(32)\n .optional(),\n })\n .strict();\nexport type PreserveAsEvidenceInput = z.infer<typeof PreserveAsEvidenceInputSchema>;\n\n// ---------------------------------------------------------------------------\n// recordNcmecPortalCorrection — record an operator's NCMEC manual-portal correction filing.\n// ---------------------------------------------------------------------------\n\nexport const RecordNcmecPortalCorrectionInputSchema = z\n .object({\n caseId: z.string().min(1),\n ncmecReportId: z.string().min(1),\n correctionFiledAt: z.number(),\n reason: z.string().min(1).max(MAX_INTERNAL_REASON_LENGTH),\n confirmation: z.literal(NCMEC_PORTAL_CORRECTION_CONFIRMATION),\n })\n .strict();\nexport type RecordNcmecPortalCorrectionInput = z.infer<typeof RecordNcmecPortalCorrectionInputSchema>;\n"]}
1
+ {"version":3,"file":"safety.js","sourceRoot":"","sources":["../../src/schemas/safety.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,EAAE;AACF,mFAAmF;AACnF,yFAAyF;AACzF,4FAA4F;AAC5F,yFAAyF;AACzF,0FAA0F;AAC1F,EAAE;AACF,wFAAwF;AACxF,yFAAyF;AACzF,4FAA4F;AAC5F,yFAAyF;AACzF,0BAA0B;AAE1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,sCAAsC,EACtC,kCAAkC,GACnC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,kCAAkC,EAClC,iCAAiC,EACjC,sCAAsC,EACtC,iCAAiC,EACjC,oCAAoC,GACrC,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EACL,4BAA4B,EAC5B,0CAA0C,GAC3C,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oCAAoC,EAAE,MAAM,mCAAmC,CAAC;AAEzF,8EAA8E;AAC9E,mFAAmF;AACnF,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,mBAAmB,CAAC;AAG9D,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC;KAC7C,MAAM,CAAC;IACN,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,MAAM,EAAE,0B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CAAC;KACpD,MAAM,CAAC;IACN,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC7B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,0BAA0B,CAAC;IACzD,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,oCAAoC,CAAC;CAC9D,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["// TTT safety-domain callable input schemas.\n//\n// The Trust & Safety operator surface (safety case console, evidence reveal, NCMEC\n// manual-portal completion, per-account safety actions, operator TOTP step-up, retained-\n// evidence inventory, party panel, TAKE IT DOWN request detail, protected-context re-fetch)\n// crosses the backend↔frontend boundary, so its callable input contracts live here — the\n// single source of truth — instead of being redefined locally in `functions/src/safety/`.\n//\n// Every object schema is `.strict()` so an unknown field on a privileged operator/admin\n// action is REJECTED rather than silently accepted (defense-in-depth on the highest-risk\n// callables). `caseId` / `targetUid` / `requestId` / `submissionId` and similar identifiers\n// are plain `z.string().min(1)` — matching the shapes the callables accept today; do not\n// broaden or weaken them.\n\nimport { z } from 'zod';\nimport {\n MAX_INTERNAL_REASON_LENGTH,\n MAX_USER_FACING_REASON_LENGTH,\n MAX_SAFETY_ARTIFACT_DESCRIPTION_LENGTH,\n MAX_NCMEC_PORTAL_PROOF_TEXT_LENGTH,\n} from '../constants/business.js';\nimport {\n SAFETY_ACCOUNT_ACTION_CONFIRMATION,\n NCMEC_PORTAL_RECEIPT_CONFIRMATION,\n NCMEC_MANUAL_PORTAL_FILED_CONFIRMATION,\n REVEAL_CASE_EVIDENCE_CONFIRMATION,\n NCMEC_PORTAL_CORRECTION_CONFIRMATION,\n} from '../constants/safety-confirmation-phrases.js';\nimport { AccountActionSchema } from '../doc-schemas/safety/sagas.js';\nimport {\n ChildSafetyAccountRoleSchema,\n ChildSafetyAccountSubjectDispositionSchema,\n} from '../doc-schemas/safety/case.js';\nimport { SafetyEvidenceExternalFactKindSchema } from '../doc-schemas/safety/evidence.js';\n\n// ---------------------------------------------------------------------------\n// commandAccountAction — apply a per-account safety action on a child-safety case.\n// ---------------------------------------------------------------------------\n\n/**\n * The per-account safety action the operator command applies — an ALIAS of the ONE\n * canonical `AccountActionSchema` (../doc-schemas/safety/sagas.ts), re-exported under\n * the callable-input name. Never a re-declared literal (ARCH-102).\n */\nexport const CommandAccountActionSchema = AccountActionSchema;\nexport type CommandAccountActionValue = z.infer<typeof CommandAccountActionSchema>;\n\nexport const CommandAccountActionInputSchema = z\n .object({\n caseId: z.string().min(1),\n targetUid: z.string().min(1),\n action: CommandAccountActionSchema,\n /** Operator-facing internal rationale (LE-loggable). */\n reasonInternal: z.string().min(4, 'An internal reason is required.').max(MAX_INTERNAL_REASON_LENGTH),\n /** The generic owner-readable reason (no detail leaks). */\n reasonUserFacing: z.string().min(1).max(MAX_USER_FACING_REASON_LENGTH),\n /** Per-account case role (A1b) — the canonical case enums, never re-declared. */\n role: ChildSafetyAccountRoleSchema,\n subjectDisposition: ChildSafetyAccountSubjectDispositionSchema,\n confirmation: z.literal(SAFETY_ACCOUNT_ACTION_CONFIRMATION),\n })\n .strict();\nexport type CommandAccountActionInput = z.infer<typeof CommandAccountActionInputSchema>;\n\n// ---------------------------------------------------------------------------\n// getSafetyCaseConsole — paginated read of the active safety-case console.\n// ---------------------------------------------------------------------------\n\n/** Cursor for the next page of a paginated console source — the last row's `(orderField value, docId)`. */\nexport const SafetyCaseConsoleCursorSchema = z\n .object({ v: z.number(), id: z.string().min(1) })\n .strict();\nexport type SafetyCaseConsoleCursor = z.infer<typeof SafetyCaseConsoleCursorSchema>;\n\nconst SAFETY_CONSOLE_MAX_PAGE_SIZE = 200;\n\nexport const GetSafetyCaseConsoleInputSchema = z\n .object({\n pageSize: z.number().int().min(1).max(SAFETY_CONSOLE_MAX_PAGE_SIZE).optional(),\n childSafetyCursor: SafetyCaseConsoleCursorSchema.nullish(),\n nciiCursor: SafetyCaseConsoleCursorSchema.nullish(),\n takeItDownCursor: SafetyCaseConsoleCursorSchema.nullish(),\n })\n .strict()\n .nullish();\nexport type GetSafetyCaseConsoleInput = z.infer<typeof GetSafetyCaseConsoleInputSchema>;\n\n// ---------------------------------------------------------------------------\n// getSafetyCaseById — full-admin read of a terminal safety case by id.\n// ---------------------------------------------------------------------------\n\nexport const GetSafetyCaseByIdInputSchema = z\n .object({\n caseType: z.enum(['csam', 'ncii']),\n caseId: z.string().min(1).max(200),\n })\n .strict();\nexport type GetSafetyCaseByIdInput = z.infer<typeof GetSafetyCaseByIdInputSchema>;\n\n// ---------------------------------------------------------------------------\n// getSafetyCaseParties — server-resolved party panel for a safety case.\n// ---------------------------------------------------------------------------\n\nexport const GetSafetyCasePartiesInputSchema = z\n .object({\n caseType: z.enum(['csam', 'ncii']),\n caseId: z.string().min(1),\n })\n .strict();\nexport type GetSafetyCasePartiesInput = z.infer<typeof GetSafetyCasePartiesInputSchema>;\n\n// ---------------------------------------------------------------------------\n// getTakeItDownRequestDetail — operator detail read for one public TAKE IT DOWN request.\n// ---------------------------------------------------------------------------\n\nexport const GetTakeItDownRequestDetailInputSchema = z\n .object({\n requestId: z.string().min(1),\n })\n .strict();\nexport type GetTakeItDownRequestDetailInput = z.infer<typeof GetTakeItDownRequestDetailInputSchema>;\n\n// ---------------------------------------------------------------------------\n// listRetainedEvidenceInventory — paginated retained-evidence inventory read.\n// ---------------------------------------------------------------------------\n\n/** Cursor for the retained-evidence inventory — the last row's `(createdAt, docId)`. */\nexport const RetainedEvidenceInventoryCursorSchema = z\n .object({ createdAt: z.number(), id: z.string().min(1) })\n .strict();\nexport type RetainedEvidenceInventoryCursor = z.infer<typeof RetainedEvidenceInventoryCursorSchema>;\n\nconst RETAINED_EVIDENCE_MAX_PAGE_SIZE = 200;\n\nexport const ListRetainedEvidenceInventoryInputSchema = z\n .object({\n pageSize: z.number().int().min(1).max(RETAINED_EVIDENCE_MAX_PAGE_SIZE).optional(),\n cursor: RetainedEvidenceInventoryCursorSchema.nullish(),\n /** Exact inventoryId lookup — returns just that row (or none), ignoring the cursor. */\n exactId: z.string().min(1).optional(),\n })\n .strict()\n .nullish();\nexport type ListRetainedEvidenceInventoryInput = z.infer<typeof ListRetainedEvidenceInventoryInputSchema>;\n\n// ---------------------------------------------------------------------------\n// ncmecOperatorCommands — NCMEC manual-portal completion path.\n// ---------------------------------------------------------------------------\n\nexport const RecordNcmecPortalReceiptArtifactInputSchema = z\n .object({\n caseId: z.string().min(1),\n submissionId: z.string().min(1),\n /** The key of an object already in the restricted evidence vault (verified via statObject). */\n evidenceVaultKey: z.string().min(1, 'An evidence vault object key is required.'),\n /** Optional operator description of what the artifact is (e.g. \"NCMEC portal screenshot\"). */\n description: z.string().min(1).max(MAX_SAFETY_ARTIFACT_DESCRIPTION_LENGTH).optional(),\n /** Explicit typed confirmation (interim control until the passkey profile lands). */\n confirmation: z.literal(NCMEC_PORTAL_RECEIPT_CONFIRMATION),\n })\n .strict();\nexport type RecordNcmecPortalReceiptArtifactInput = z.infer<\n typeof RecordNcmecPortalReceiptArtifactInputSchema\n>;\n\nexport const MarkNcmecPortalCompleteInputSchema = z\n .object({\n caseId: z.string().min(1),\n submissionId: z.string().min(1),\n /** [Q13/H-06] The ID of an existing NcmecPortalReceiptArtifactV1 record bound to this (caseId, submissionId). */\n artifactId: z.string().min(1, 'A valid portal-receipt artifact id is required.'),\n /** [Q13/H-06] The object generation recorded on the artifact at registration time (immutable-object peg). */\n artifactObjectGeneration: z.string().min(1, 'The artifact object generation is required.'),\n /** [Q13/H-06] The sha256 hex digest recorded on the artifact at registration time (content-integrity check). */\n artifactSha256: z.string().regex(/^[0-9a-f]{64}$/, 'artifactSha256 must be a 64-character hex string.'),\n /** Optional operator free-text note describing the portal confirmation. */\n proofText: z.string().min(1).max(MAX_NCMEC_PORTAL_PROOF_TEXT_LENGTH).optional(),\n /** The NCMEC-assigned report id — REQUIRED (it IS the proof; no \"filed, number pending\" grace). */\n ncmecReportId: z.string().min(1, 'The NCMEC report id is required to mark the report complete.'),\n /** Explicit typed confirmation (interim control until the passkey profile lands). */\n confirmation: z.literal(NCMEC_MANUAL_PORTAL_FILED_CONFIRMATION),\n })\n .strict();\nexport type MarkNcmecPortalCompleteInput = z.infer<typeof MarkNcmecPortalCompleteInputSchema>;\n\n// ---------------------------------------------------------------------------\n// operatorStepUp — app-level TOTP step-up (confirm / verify a 6-digit code).\n// ---------------------------------------------------------------------------\n\nexport const OperatorStepUpCodeInputSchema = z\n .object({\n code: z.string().trim().regex(/^\\d{6}$/u, 'Enter the 6-digit code.'),\n })\n .strict();\nexport type OperatorStepUpCodeInput = z.infer<typeof OperatorStepUpCodeInputSchema>;\n\n// ---------------------------------------------------------------------------\n// revealCaseEvidence — metadata→evidence reveal under reauth.\n// ---------------------------------------------------------------------------\n\nexport const RevealCaseEvidenceInputSchema = z\n .object({\n caseId: z.string().min(1),\n /** Explicit typed confirmation (interim control until the passkey profile lands). */\n confirmation: z.literal(REVEAL_CASE_EVIDENCE_CONFIRMATION),\n /** The operator's child-safety warning acknowledgement, carried so the backend can persist it\n * in the reveal audit trail. This schema serves ONLY the safety-console reveal-under-reauth\n * flow (its sibling `confirmation` literal gates the same surface), so the acknowledgement is a\n * required `true` — consistent with the existing explicit-confirmation style. Server-side\n * enforcement + audit persistence land app-side. */\n warningAcknowledged: z.literal(true),\n })\n .strict();\nexport type RevealCaseEvidenceInput = z.infer<typeof RevealCaseEvidenceInputSchema>;\n\n// ---------------------------------------------------------------------------\n// refetchProtectedCaseContext — operator manual re-fetch of protected chat context.\n// ---------------------------------------------------------------------------\n\nexport const RefetchProtectedCaseContextInputSchema = z\n .object({\n caseId: z.string().min(1),\n lane: z.enum(['csam', 'ncii']),\n })\n .strict();\nexport type RefetchProtectedCaseContextInput = z.infer<typeof RefetchProtectedCaseContextInputSchema>;\n\n// ---------------------------------------------------------------------------\n// preserveAsEvidence — general-purpose ADMIN \"Preserve as Evidence\" callable.\n// ---------------------------------------------------------------------------\n\n/**\n * A target to preserve, discriminated by surface. Non-strict members are carried faithfully\n * from the source callable. The id / path / ref bounds are opaque structural caps (not user\n * text), and the augmentation `factKind` REUSES the canonical evidence external-fact enum\n * (`SafetyEvidenceExternalFactKindSchema`) rather than re-declaring its members.\n */\nexport const PreserveTargetSchema = z.discriminatedUnion('targetKind', [\n z.object({\n targetKind: z.literal('media'),\n mediaAssetId: z.string().min(1).max(256),\n }),\n z.object({\n targetKind: z.literal('post'),\n postDocPath: z.string().min(1).max(1024),\n revision: z.number().int().nonnegative().optional(),\n }),\n z.object({\n targetKind: z.literal('profile'),\n uid: z.string().min(1).max(256),\n revision: z.number().int().nonnegative().optional(),\n }),\n z.object({\n targetKind: z.literal('chat'),\n channelId: z.string().min(1).max(256),\n messageSeqStart: z.number().int().nonnegative(),\n messageSeqEnd: z.number().int().nonnegative(),\n transcriptObjectRef: z.string().min(1).max(1024),\n attachmentItemIds: z.array(z.string().min(1)).max(256).optional(),\n }),\n]);\nexport type PreserveTarget = z.infer<typeof PreserveTargetSchema>;\n\nexport const PreserveAsEvidenceInputSchema = z\n .object({\n /** Attach to an existing case; absent → open a standalone preservation case. */\n caseId: z.string().min(1).max(256).optional(),\n target: PreserveTargetSchema,\n /** Operator note recorded on the case (internal). */\n reasonInternal: z.string().min(1).max(MAX_INTERNAL_REASON_LENGTH),\n /** Optional admin AUGMENTATION — extra externalFact refs preserved alongside the baseline. */\n augmentations: z\n .array(\n z.object({\n factKind: SafetyEvidenceExternalFactKindSchema,\n narrativeRef: z.string().min(1).max(1024),\n }),\n )\n .max(32)\n .optional(),\n })\n .strict();\nexport type PreserveAsEvidenceInput = z.infer<typeof PreserveAsEvidenceInputSchema>;\n\n// ---------------------------------------------------------------------------\n// recordNcmecPortalCorrection — record an operator's NCMEC manual-portal correction filing.\n// ---------------------------------------------------------------------------\n\nexport const RecordNcmecPortalCorrectionInputSchema = z\n .object({\n caseId: z.string().min(1),\n ncmecReportId: z.string().min(1),\n correctionFiledAt: z.number(),\n reason: z.string().min(1).max(MAX_INTERNAL_REASON_LENGTH),\n confirmation: z.literal(NCMEC_PORTAL_CORRECTION_CONFIRMATION),\n })\n .strict();\nexport type RecordNcmecPortalCorrectionInput = z.infer<typeof RecordNcmecPortalCorrectionInputSchema>;\n"]}
@@ -38,7 +38,7 @@ export interface OpsBrokenMachinery {
38
38
  /** `safetyMonitorHeartbeat/global.lastRunAt` (epoch ms) of the scheduled monitor sweep.
39
39
  * Absent if the heartbeat has never stamped. Display only — do NOT judge staleness from this
40
40
  * client-side: use `safetyMonitorHeartbeatStale`, which the backend derives from the SAME
41
- * threshold its dead-man checker alarms on (Rule 36: one declaration, enforcement derives). */
41
+ * threshold its dead-man checker alarms on (ARCH-102: one declaration, enforcement derives). */
42
42
  safetyMonitorHeartbeatLastRunAt?: number;
43
43
  /** True when the sweep's heartbeat is older than the backend's own dead-man threshold — i.e. the
44
44
  * scheduled safety monitors may not be running. Derived server-side so the operator chip and the
@@ -1 +1 @@
1
- {"version":3,"file":"admin-ops.d.ts","sourceRoot":"","sources":["../../src/types/admin-ops.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;;;qBAIqB;AACrB,MAAM,WAAW,eAAe;IAC9B,2FAA2F;IAC3F,aAAa,EAAE,MAAM,CAAC;IACtB,qFAAqF;IACrF,eAAe,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,uBAAuB;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,wBAAwB,EAAE,MAAM,CAAC;IACjC,+EAA+E;IAC/E,mBAAmB,CAAC,EAAE,MAAM,CA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AC;CAC7B;AAED,oDAAoD;AACpD,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,gFAAgF;IAChF,SAAS,EAAE,OAAO,CAAC;CACpB"}
@@ -2,6 +2,6 @@
2
2
  // builds them, frontend renders them), so they live HERE per the Cross-Boundary
3
3
  // Type Invariant. Consolidated 2026-07-13 from the former "intentional LOCAL DTO"
4
4
  // in functions/src/admin/getOpsStatus.ts + its structurally-matching frontend
5
- // re-declaration (publish-avoidance rationale — auto-reject; Rule 36 extended).
5
+ // re-declaration (publish-avoidance rationale — auto-reject; ARCH-102 extended).
6
6
  export {};
7
7
  //# sourceMappingURL=admin-ops.js.map