@antiphony/shared 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/cjs/api-codecs.cjs +26 -650
  2. package/dist/cjs/api-codecs.d.cts +15 -233
  3. package/dist/cjs/index.cjs +29 -761
  4. package/dist/cjs/index.d.cts +4 -4
  5. package/dist/cjs/nsid.cjs +3 -10
  6. package/dist/cjs/nsid.d.cts +1 -9
  7. package/dist/cjs/types/api.cjs +11 -571
  8. package/dist/cjs/types/api.d.cts +13 -265
  9. package/dist/cjs/types/audio.cjs +26 -547
  10. package/dist/cjs/types/audio.d.cts +93 -52
  11. package/dist/cjs/types/records.cjs +3 -328
  12. package/dist/cjs/types/records.d.cts +7 -729
  13. package/dist/cjs/types/views.cjs +8 -649
  14. package/dist/cjs/types/views.d.cts +43 -9123
  15. package/dist/esm/api-codecs.d.ts +46 -264
  16. package/dist/esm/api-codecs.js +5 -5
  17. package/dist/esm/{chunk-ORMEWXMH.js → chunk-5JBD5THX.js} +1 -16
  18. package/dist/esm/{chunk-XDBKR6LW.js → chunk-6LROFBKK.js} +3 -10
  19. package/dist/esm/{chunk-F2CANZZ7.js → chunk-BNNLHRH7.js} +1 -1
  20. package/dist/esm/{chunk-BUNMR4ZO.js → chunk-F7IHVM34.js} +20 -3
  21. package/dist/esm/chunk-FDM5FDN4.js +46 -0
  22. package/dist/esm/chunk-IHIBHQBJ.js +78 -0
  23. package/dist/esm/chunk-R6SBR3IG.js +97 -0
  24. package/dist/esm/chunk-Y6HNNRVD.js +12 -0
  25. package/dist/esm/errors/index.js +1 -1
  26. package/dist/esm/index.d.ts +4 -4
  27. package/dist/esm/index.js +8 -8
  28. package/dist/esm/nsid.d.ts +1 -9
  29. package/dist/esm/nsid.js +2 -2
  30. package/dist/esm/observability/index.js +2 -2
  31. package/dist/esm/observability/report-error.js +2 -2
  32. package/dist/esm/types/api.d.ts +15 -267
  33. package/dist/esm/types/api.js +4 -5
  34. package/dist/esm/types/audio.d.ts +170 -129
  35. package/dist/esm/types/audio.js +4 -4
  36. package/dist/esm/types/blob.js +1 -1
  37. package/dist/esm/types/records.d.ts +10 -732
  38. package/dist/esm/types/records.js +2 -3
  39. package/dist/esm/types/views.d.ts +51 -9131
  40. package/dist/esm/types/views.js +3 -4
  41. package/dist/esm/utils/index.js +1 -1
  42. package/package.json +1 -1
  43. package/dist/cjs/types/channels.cjs +0 -170
  44. package/dist/cjs/types/channels.d.cts +0 -262
  45. package/dist/cjs/types/storage.cjs +0 -414
  46. package/dist/cjs/types/storage.d.cts +0 -197
  47. package/dist/esm/chunk-3WZJXJNU.js +0 -378
  48. package/dist/esm/chunk-7V44CPRR.js +0 -132
  49. package/dist/esm/chunk-EA4OONDV.js +0 -380
  50. package/dist/esm/chunk-TIZRJORN.js +0 -24
  51. package/dist/esm/types/channels.d.ts +0 -262
  52. package/dist/esm/types/channels.js +0 -162
  53. package/dist/esm/types/storage.d.ts +0 -197
  54. package/dist/esm/types/storage.js +0 -26
@@ -23,18 +23,15 @@ declare function httpsUrl(): z.ZodEffects<z.ZodString, string, string>;
23
23
  * coerces to an Invalid Date (e.g. `new Date("")` or a malformed string),
24
24
  * the parse fails loudly via a `ZodIssue` rather than returning a
25
25
  * downstream-crashing value.
26
- *
27
- * Why strict: PR #425 added defensive coercion in ReplyListItem after the
28
- * dashboard was crashing on `formatDistanceToNow(invalid)` calls. The
29
- * underlying issue was that `z.string()` here accepted any string and
30
- * `new Date(badString)` produces Invalid Date, which Zod returned
31
- * successfully. Rejecting at the schema boundary keeps downstream
32
- * `formatDistanceToNow` / `.toISOString()` callers safe by construction.
33
26
  */
34
27
  declare const FirestoreTimestampSchema: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
35
28
  type FirestoreTimestamp = Date;
36
29
  /**
37
- * The raw user data stored in Firestore.
30
+ * The raw actor (user) identity record stored in Firestore.
31
+ *
32
+ * This is the canonical identity record for the Antiphony actor surface.
33
+ * Audio content lives in `dev.antiphony.audio.post` (see `types/audio.ts`),
34
+ * never on the user record.
38
35
  */
39
36
  declare const UserRecordSchema: z.ZodObject<{
40
37
  /** Unique Firebase UID */
@@ -43,10 +40,7 @@ declare const UserRecordSchema: z.ZodObject<{
43
40
  handle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
44
41
  /** User stated intent (e.g. "Podcaster", "Listener") */
45
42
  usageIntent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
- /**
47
- * Domain for federated handle support.
48
- * Defaults to 'voxpop.com'.
49
- */
43
+ /** Domain for federated handle support. */
50
44
  domain: z.ZodDefault<z.ZodString>;
51
45
  /**
52
46
  * Display Name (e.g. "Brad Thorson"). Nullable: Firestore stores `null`
@@ -82,12 +76,6 @@ declare const UserRecordSchema: z.ZodObject<{
82
76
  status: z.ZodDefault<z.ZodEnum<["active", "deactivated"]>>;
83
77
  /** Timestamp when the account was deactivated (soft deleted) */
84
78
  deactivatedAt: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>>;
85
- /**
86
- * Denormalized org memberships — { orgId: role } for fast lookup.
87
- * Source of truth is organizations/{orgId}/members/{userId}.
88
- * Kept in sync by Cloud Function trigger.
89
- */
90
- orgMemberships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<["owner", "admin", "member"]>>>;
91
79
  }, "strip", z.ZodTypeAny, {
92
80
  status: "active" | "deactivated";
93
81
  id: string;
@@ -95,10 +83,10 @@ declare const UserRecordSchema: z.ZodObject<{
95
83
  createdAt: Date;
96
84
  tier: "free" | "creator_pro";
97
85
  handle?: string | null | undefined;
98
- usageIntent?: string | null | undefined;
99
86
  displayName?: string | null | undefined;
100
87
  bio?: string | null | undefined;
101
88
  avatarUrl?: string | null | undefined;
89
+ usageIntent?: string | null | undefined;
102
90
  website?: string | null | undefined;
103
91
  links?: {
104
92
  label: string;
@@ -106,735 +94,25 @@ declare const UserRecordSchema: z.ZodObject<{
106
94
  }[] | undefined;
107
95
  showBlueskyPublicly?: boolean | undefined;
108
96
  deactivatedAt?: Date | undefined;
109
- orgMemberships?: Record<string, "owner" | "admin" | "member"> | undefined;
110
97
  }, {
111
98
  id: string;
112
99
  status?: "active" | "deactivated" | undefined;
113
100
  handle?: string | null | undefined;
114
- usageIntent?: string | null | undefined;
115
- domain?: string | undefined;
116
101
  displayName?: string | null | undefined;
117
102
  bio?: string | null | undefined;
118
103
  avatarUrl?: string | null | undefined;
104
+ usageIntent?: string | null | undefined;
119
105
  website?: string | null | undefined;
120
106
  links?: {
121
107
  label: string;
122
108
  url: string;
123
109
  }[] | undefined;
124
110
  showBlueskyPublicly?: boolean | undefined;
111
+ domain?: string | undefined;
125
112
  createdAt?: unknown;
126
113
  tier?: "free" | "creator_pro" | undefined;
127
114
  deactivatedAt?: unknown;
128
- orgMemberships?: Record<string, "owner" | "admin" | "member"> | undefined;
129
115
  }>;
130
116
  type UserRecord = z.infer<typeof UserRecordSchema>;
131
- /**
132
- * The raw prompt data stored in Firestore.
133
- */
134
- declare const PromptRecordSchema: z.ZodObject<{
135
- /** Unique Prompt ID */
136
- id: z.ZodString;
137
- /** ID of the User who created this prompt. Always a user ID, never an org ID. @see UserRecord */
138
- authorId: z.ZodString;
139
- /** Organization context this prompt belongs to (null = personal/no org) */
140
- orgId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
141
- /** The main text of the question/prompt */
142
- title: z.ZodString;
143
- /** Optional extra context */
144
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
145
- /** User who created this prompt (differs from authorId when org-owned) */
146
- createdBy: z.ZodOptional<z.ZodString>;
147
- /** URL to the recorded audio file (GCS) */
148
- audioUrl: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
149
- /** AT Protocol blob reference (future replacement for audioUrl) */
150
- audio: z.ZodOptional<z.ZodObject<{
151
- $type: z.ZodLiteral<"blob">;
152
- ref: z.ZodString;
153
- mimeType: z.ZodString;
154
- size: z.ZodNumber;
155
- }, "strip", z.ZodTypeAny, {
156
- $type: "blob";
157
- ref: string;
158
- mimeType: string;
159
- size: number;
160
- }, {
161
- $type: "blob";
162
- ref: string;
163
- mimeType: string;
164
- size: number;
165
- }>>;
166
- /**
167
- * AT Protocol URI returned by the publisher after a successful
168
- * `repo.putRecord` against the author's PDS — e.g.
169
- * `at://did:plc:abc123/com.voxpop.audio.prompt/3kj4...`. Optional,
170
- * no migration: existing rows leave it unset. Format-validated so
171
- * malformed strings surface at the schema-parse boundary rather than
172
- * being silently stored.
173
- */
174
- atprotoUri: z.ZodOptional<z.ZodString>;
175
- /** Server timestamp of creation */
176
- createdAt: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
177
- /**
178
- * Life-cycle status.
179
- * - `live`: Visible and accepting replies.
180
- * - `archived`: Visible but closed for new replies.
181
- * - `deleted`: Soft deleted.
182
- */
183
- status: z.ZodDefault<z.ZodEnum<["live", "archived", "deleted"]>>;
184
- /** AI Enrichment Fields */
185
- aiStatus: z.ZodOptional<z.ZodEnum<["pending", "complete", "error"]>>;
186
- aiError: z.ZodOptional<z.ZodString>;
187
- aiSummary: z.ZodOptional<z.ZodString>;
188
- aiLabels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
189
- transcription: z.ZodOptional<z.ZodString>;
190
- /** Pre-computed waveform peaks (normalized 0–1) for instant audio visualization */
191
- waveformPeaks: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
192
- /** Social Share Video Fields */
193
- socialVideoUrl: z.ZodOptional<z.ZodString>;
194
- socialVideoStoragePath: z.ZodOptional<z.ZodString>;
195
- socialVideoStatus: z.ZodOptional<z.ZodEnum<["pending", "complete", "error"]>>;
196
- socialVideoError: z.ZodOptional<z.ZodString>;
197
- /** The audio URL/path used to generate the current video (for cache invalidation) */
198
- socialVideoSourceAudio: z.ZodOptional<z.ZodString>;
199
- }, "strip", z.ZodTypeAny, {
200
- status: "live" | "archived" | "deleted";
201
- id: string;
202
- createdAt: Date;
203
- authorId: string;
204
- title: string;
205
- audioUrl: string;
206
- orgId?: string | null | undefined;
207
- description?: string | null | undefined;
208
- createdBy?: string | undefined;
209
- audio?: {
210
- $type: "blob";
211
- ref: string;
212
- mimeType: string;
213
- size: number;
214
- } | undefined;
215
- atprotoUri?: string | undefined;
216
- aiStatus?: "pending" | "complete" | "error" | undefined;
217
- aiError?: string | undefined;
218
- aiSummary?: string | undefined;
219
- aiLabels?: string[] | undefined;
220
- transcription?: string | undefined;
221
- waveformPeaks?: number[] | undefined;
222
- socialVideoUrl?: string | undefined;
223
- socialVideoStoragePath?: string | undefined;
224
- socialVideoStatus?: "pending" | "complete" | "error" | undefined;
225
- socialVideoError?: string | undefined;
226
- socialVideoSourceAudio?: string | undefined;
227
- }, {
228
- id: string;
229
- authorId: string;
230
- title: string;
231
- audioUrl: string;
232
- status?: "live" | "archived" | "deleted" | undefined;
233
- createdAt?: unknown;
234
- orgId?: string | null | undefined;
235
- description?: string | null | undefined;
236
- createdBy?: string | undefined;
237
- audio?: {
238
- $type: "blob";
239
- ref: string;
240
- mimeType: string;
241
- size: number;
242
- } | undefined;
243
- atprotoUri?: string | undefined;
244
- aiStatus?: "pending" | "complete" | "error" | undefined;
245
- aiError?: string | undefined;
246
- aiSummary?: string | undefined;
247
- aiLabels?: string[] | undefined;
248
- transcription?: string | undefined;
249
- waveformPeaks?: number[] | undefined;
250
- socialVideoUrl?: string | undefined;
251
- socialVideoStoragePath?: string | undefined;
252
- socialVideoStatus?: "pending" | "complete" | "error" | undefined;
253
- socialVideoError?: string | undefined;
254
- socialVideoSourceAudio?: string | undefined;
255
- }>;
256
- type PromptRecord = z.infer<typeof PromptRecordSchema>;
257
- /**
258
- * The raw reply data stored in Firestore.
259
- *
260
- * AI-derived fields (transcription, sentiment, engagement score, voice
261
- * isolation, social-share video, etc.) live on `ReplyEnrichmentRecord`
262
- * at `enrichments/replies/items/{id}` — see § 1 of
263
- * `specs/ai-enrichment-split.md`. Only ingestion-time outputs that a
264
- * self-hoster without paid AI still needs (waveform peaks + audio
265
- * duration) remain on the canonical doc.
266
- */
267
- declare const ReplyRecordSchema: z.ZodObject<{
268
- /** Unique Reply ID */
269
- id: z.ZodString;
270
- /** The Prompt being replied to. @see PromptRecord */
271
- promptId: z.ZodString;
272
- /** The User who replied. @see UserRecord */
273
- authorId: z.ZodString;
274
- /** URL to the recorded audio file (GCS) */
275
- audioUrl: z.ZodString;
276
- /** AT Protocol blob reference (future replacement for audioUrl) */
277
- audio: z.ZodOptional<z.ZodObject<{
278
- $type: z.ZodLiteral<"blob">;
279
- ref: z.ZodString;
280
- mimeType: z.ZodString;
281
- size: z.ZodNumber;
282
- }, "strip", z.ZodTypeAny, {
283
- $type: "blob";
284
- ref: string;
285
- mimeType: string;
286
- size: number;
287
- }, {
288
- $type: "blob";
289
- ref: string;
290
- mimeType: string;
291
- size: number;
292
- }>>;
293
- /** Server timestamp of creation */
294
- createdAt: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
295
- /**
296
- * Life-cycle status.
297
- * - `live`: Visible and accepting replies.
298
- * - `archived`: Visible but closed for new replies.
299
- * - `deleted`: Soft deleted.
300
- */
301
- status: z.ZodDefault<z.ZodEnum<["live", "archived", "deleted"]>>;
302
- /**
303
- * Pre-computed waveform peaks (normalized 0–1) for instant audio
304
- * visualization. **Stays on canonical** (does NOT move to the
305
- * enrichment doc) — produced by a plain ffmpeg pass at ingestion,
306
- * not an AI step; a self-hoster without paid-tier AI still needs
307
- * this on every reply for the audio player. See
308
- * `specs/ai-enrichment-split.md` § 5.
309
- */
310
- waveformPeaks: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
311
- /**
312
- * Duration of the audio in seconds, computed server-side from
313
- * ffmpeg. **Stays on canonical** (same reasoning as `waveformPeaks`
314
- * above — ingestion ffmpeg output, not an AI enrichment). See
315
- * `specs/ai-enrichment-split.md` § 5.
316
- */
317
- audioDurationSec: z.ZodOptional<z.ZodNumber>;
318
- }, "strip", z.ZodTypeAny, {
319
- status: "live" | "archived" | "deleted";
320
- id: string;
321
- createdAt: Date;
322
- authorId: string;
323
- audioUrl: string;
324
- promptId: string;
325
- audio?: {
326
- $type: "blob";
327
- ref: string;
328
- mimeType: string;
329
- size: number;
330
- } | undefined;
331
- waveformPeaks?: number[] | undefined;
332
- audioDurationSec?: number | undefined;
333
- }, {
334
- id: string;
335
- authorId: string;
336
- audioUrl: string;
337
- promptId: string;
338
- status?: "live" | "archived" | "deleted" | undefined;
339
- createdAt?: unknown;
340
- audio?: {
341
- $type: "blob";
342
- ref: string;
343
- mimeType: string;
344
- size: number;
345
- } | undefined;
346
- waveformPeaks?: number[] | undefined;
347
- audioDurationSec?: number | undefined;
348
- }>;
349
- type ReplyRecord = z.infer<typeof ReplyRecordSchema>;
350
- /**
351
- * Reply Enrichment Record. Per-reply CRM data owned by the prompt-author
352
- * (the "viewer" with read/write access). Stored at
353
- * `enrichments/replies/{replyId}` — a separate namespace from the canonical
354
- * `replies/{replyId}` so self-hosters running just core-api see clean
355
- * records without phantom CRM fields. See specs/data-separation.md § 3.
356
- *
357
- * `id` matches the parent reply's id by convention (same doc id, sibling
358
- * collection space).
359
- */
360
- declare const ReplyEnrichmentRecordSchema: z.ZodObject<{
361
- id: z.ZodString;
362
- /** Private notes by the prompt author about this reply. */
363
- notes: z.ZodOptional<z.ZodString>;
364
- aiStatus: z.ZodOptional<z.ZodEnum<["pending", "complete", "error", "skipped_too_short"]>>;
365
- aiError: z.ZodOptional<z.ZodString>;
366
- aiSummary: z.ZodOptional<z.ZodString>;
367
- aiLabels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
368
- transcription: z.ZodOptional<z.ZodString>;
369
- sentiment: z.ZodOptional<z.ZodEnum<["Positive", "Negative", "Neutral"]>>;
370
- /** Must match the widened enum in `ReplyRecordSchema.energyLevel`. */
371
- energyLevel: z.ZodOptional<z.ZodEnum<["High", "Low", "Neutral"]>>;
372
- engagementScore: z.ZodOptional<z.ZodNumber>;
373
- /** Noise-reduced audio URL — replaces `audioUrl` for downstream players when present. PUBLIC. */
374
- enhancedAudioUrl: z.ZodOptional<z.ZodString>;
375
- /** Storage path companion to `enhancedAudioUrl` — private. */
376
- enhancedStoragePath: z.ZodOptional<z.ZodString>;
377
- socialVideoUrl: z.ZodOptional<z.ZodString>;
378
- socialVideoStoragePath: z.ZodOptional<z.ZodString>;
379
- socialVideoStatus: z.ZodOptional<z.ZodEnum<["pending", "complete", "error"]>>;
380
- socialVideoError: z.ZodOptional<z.ZodString>;
381
- /** The audio URL/path used to generate the current video (for cache invalidation). */
382
- socialVideoSourceAudio: z.ZodOptional<z.ZodString>;
383
- }, "strip", z.ZodTypeAny, {
384
- id: string;
385
- aiStatus?: "pending" | "complete" | "error" | "skipped_too_short" | undefined;
386
- aiError?: string | undefined;
387
- aiSummary?: string | undefined;
388
- aiLabels?: string[] | undefined;
389
- transcription?: string | undefined;
390
- socialVideoUrl?: string | undefined;
391
- socialVideoStoragePath?: string | undefined;
392
- socialVideoStatus?: "pending" | "complete" | "error" | undefined;
393
- socialVideoError?: string | undefined;
394
- socialVideoSourceAudio?: string | undefined;
395
- notes?: string | undefined;
396
- sentiment?: "Positive" | "Negative" | "Neutral" | undefined;
397
- energyLevel?: "Neutral" | "High" | "Low" | undefined;
398
- engagementScore?: number | undefined;
399
- enhancedAudioUrl?: string | undefined;
400
- enhancedStoragePath?: string | undefined;
401
- }, {
402
- id: string;
403
- aiStatus?: "pending" | "complete" | "error" | "skipped_too_short" | undefined;
404
- aiError?: string | undefined;
405
- aiSummary?: string | undefined;
406
- aiLabels?: string[] | undefined;
407
- transcription?: string | undefined;
408
- socialVideoUrl?: string | undefined;
409
- socialVideoStoragePath?: string | undefined;
410
- socialVideoStatus?: "pending" | "complete" | "error" | undefined;
411
- socialVideoError?: string | undefined;
412
- socialVideoSourceAudio?: string | undefined;
413
- notes?: string | undefined;
414
- sentiment?: "Positive" | "Negative" | "Neutral" | undefined;
415
- energyLevel?: "Neutral" | "High" | "Low" | undefined;
416
- engagementScore?: number | undefined;
417
- enhancedAudioUrl?: string | undefined;
418
- enhancedStoragePath?: string | undefined;
419
- }>;
420
- type ReplyEnrichmentRecord = z.infer<typeof ReplyEnrichmentRecordSchema>;
421
- /**
422
- * Per-viewer CRM enrichment about a target person, owned by the viewing
423
- * creator. Stored at `enrichments/people/items/{viewerUid}_{targetUid}` —
424
- * the tier-2 enrichment namespace, served by the closed `apps/relationships`
425
- * deployable (NOT core-api), so self-hosters running core-api see clean
426
- * canonical records without phantom CRM/identity fields. See
427
- * `specs/data-separation.md` § 3 and `specs/people-enrichment-split.md`.
428
- *
429
- * `id` is the composite `${viewerUid}_${targetUid}` (Option D in the split
430
- * spec): immutable across handle renames, and per-viewer scoped — Alice's
431
- * notes about @bob and Charlie's notes about @bob live in different docs.
432
- *
433
- * Lifts/replaces the legacy per-handle `users/{viewerUid}/crm/{handle}`
434
- * store (migrated by `scripts/migrate-crm-notes-to-enrichments.ts`).
435
- */
436
- declare const PersonEnrichmentRecordSchema: z.ZodObject<{
437
- /** Composite key `${viewerUid}_${targetUid}`. */
438
- id: z.ZodString;
439
- /** Per-viewer CRM notes about the target. */
440
- notes: z.ZodOptional<z.ZodString>;
441
- /** Per-viewer freeform tags about the target. */
442
- tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
443
- aliases: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
444
- lastUpdated: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>>;
445
- }, "strip", z.ZodTypeAny, {
446
- id: string;
447
- notes?: string | undefined;
448
- tags?: string[] | undefined;
449
- aliases?: string[] | undefined;
450
- lastUpdated?: Date | undefined;
451
- }, {
452
- id: string;
453
- notes?: string | undefined;
454
- tags?: string[] | undefined;
455
- aliases?: string[] | undefined;
456
- lastUpdated?: unknown;
457
- }>;
458
- type PersonEnrichmentRecord = z.infer<typeof PersonEnrichmentRecordSchema>;
459
- /**
460
- * SIP Enrichment data stored in `users/{uid}/enrichment/sip`.
461
- */
462
- declare const SipEnrichmentSchema: z.ZodObject<{
463
- sipUri: z.ZodString;
464
- sipUsername: z.ZodString;
465
- sipSecret: z.ZodString;
466
- provider: z.ZodEnum<["twilio", "plivo", "internal"]>;
467
- }, "strip", z.ZodTypeAny, {
468
- sipUri: string;
469
- sipUsername: string;
470
- sipSecret: string;
471
- provider: "twilio" | "plivo" | "internal";
472
- }, {
473
- sipUri: string;
474
- sipUsername: string;
475
- sipSecret: string;
476
- provider: "twilio" | "plivo" | "internal";
477
- }>;
478
- type SipEnrichment = z.infer<typeof SipEnrichmentSchema>;
479
- /**
480
- * Call forwarding configuration stored in `users/{uid}/private_data/call_forwarding`.
481
- * Tracks the user's PSTN forwarding setup for routing missed calls to VoxPop IVR.
482
- */
483
- declare const CallForwardingConfigSchema: z.ZodObject<{
484
- /** User's personal phone number (E.164) */
485
- phoneNumber: z.ZodString;
486
- /** Line type from Twilio Lookup v2 */
487
- lineType: z.ZodNullable<z.ZodString>;
488
- /** Carrier name from Twilio Lookup v2 */
489
- carrier: z.ZodNullable<z.ZodString>;
490
- /** free = shared Twilio number (ForwardedFrom routing), paid = dedicated number */
491
- tier: z.ZodEnum<["free", "paid"]>;
492
- /** The VoxPop Twilio number calls forward to (E.164) */
493
- voxpopNumber: z.ZodString;
494
- /** Twilio Phone Number SID (paid tier only) */
495
- twilioNumberSid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
496
- /** Forwarding verification state */
497
- verificationStatus: z.ZodDefault<z.ZodEnum<["pending", "verifying", "verified", "failed"]>>;
498
- /** Last verification attempt timestamp */
499
- lastVerificationAt: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>>;
500
- /** Number of verification attempts */
501
- verificationAttempts: z.ZodDefault<z.ZodNumber>;
502
- /** Reason for verification failure */
503
- failureReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
504
- /** Whether call forwarding is active */
505
- enabled: z.ZodDefault<z.ZodBoolean>;
506
- createdAt: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
507
- updatedAt: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
508
- }, "strip", z.ZodTypeAny, {
509
- createdAt: Date;
510
- tier: "free" | "paid";
511
- phoneNumber: string;
512
- lineType: string | null;
513
- carrier: string | null;
514
- voxpopNumber: string;
515
- verificationStatus: "pending" | "verifying" | "verified" | "failed";
516
- verificationAttempts: number;
517
- enabled: boolean;
518
- updatedAt: Date;
519
- twilioNumberSid?: string | null | undefined;
520
- lastVerificationAt?: Date | undefined;
521
- failureReason?: string | null | undefined;
522
- }, {
523
- tier: "free" | "paid";
524
- phoneNumber: string;
525
- lineType: string | null;
526
- carrier: string | null;
527
- voxpopNumber: string;
528
- createdAt?: unknown;
529
- twilioNumberSid?: string | null | undefined;
530
- verificationStatus?: "pending" | "verifying" | "verified" | "failed" | undefined;
531
- lastVerificationAt?: unknown;
532
- verificationAttempts?: number | undefined;
533
- failureReason?: string | null | undefined;
534
- enabled?: boolean | undefined;
535
- updatedAt?: unknown;
536
- }>;
537
- type CallForwardingConfig = z.infer<typeof CallForwardingConfigSchema>;
538
- /**
539
- * Connector-config primitive (Plan B). The uniform control-plane record for a
540
- * connector's per-owner settings. The core owns the *envelope* (ownership,
541
- * enabled, status, timestamps) and treats `settings` as an opaque,
542
- * connector-specific blob — the connector app validates its own settings shape
543
- * on read. Secrets are never stored here; `secretRef` points into a secret
544
- * store. Stored at `connector_configs/{ownerId}/items/{connectorType}`.
545
- *
546
- * See `specs/plan-b-connector-boundaries.md`.
547
- */
548
- /**
549
- * Known connector types. An allowlist (not a free string) so the core can
550
- * enforce "connectorType is known" at the envelope boundary. Extend as
551
- * connectors are added.
552
- */
553
- declare const ConnectorTypeSchema: z.ZodEnum<["telephony"]>;
554
- type ConnectorType = z.infer<typeof ConnectorTypeSchema>;
555
- /**
556
- * Connector-reported status. `state` is a coarse lifecycle the control-plane UI
557
- * can render generically; `detail` carries a connector-specific human string
558
- * (e.g. a verification failure reason).
559
- */
560
- declare const ConnectorStatusSchema: z.ZodObject<{
561
- /** Coarse, generic lifecycle the control-plane UI can render without
562
- * connector-specific knowledge. */
563
- state: z.ZodDefault<z.ZodEnum<["unconfigured", "pending", "active", "error", "disabled"]>>;
564
- detail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
565
- /** Opaque, connector-specific status detail (e.g. telephony's
566
- * `{ verificationStatus, verificationAttempts, failureReason }`). Connector-
567
- * owned like the rest of `status` — never user-writable. Nullable so a doc
568
- * that stored `data: null` round-trips without a parse error. */
569
- data: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
570
- updatedAt: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>>;
571
- }, "strip", z.ZodTypeAny, {
572
- state: "active" | "pending" | "error" | "unconfigured" | "disabled";
573
- updatedAt?: Date | undefined;
574
- detail?: string | null | undefined;
575
- data?: Record<string, unknown> | null | undefined;
576
- }, {
577
- updatedAt?: unknown;
578
- state?: "active" | "pending" | "error" | "unconfigured" | "disabled" | undefined;
579
- detail?: string | null | undefined;
580
- data?: Record<string, unknown> | null | undefined;
581
- }>;
582
- type ConnectorStatus = z.infer<typeof ConnectorStatusSchema>;
583
- declare const ConnectorConfigRecordSchema: z.ZodObject<{
584
- connectorType: z.ZodEnum<["telephony"]>;
585
- /** The owning user. Org-scoping (ownerId as an orgId) is a later step. */
586
- ownerId: z.ZodString;
587
- /** Opaque, connector-specific blob. Core does not interpret this. */
588
- settings: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
589
- /** Reference into a secret store (e.g. Secret Manager key). Never a raw secret. */
590
- secretRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
591
- enabled: z.ZodDefault<z.ZodBoolean>;
592
- status: z.ZodDefault<z.ZodObject<{
593
- /** Coarse, generic lifecycle the control-plane UI can render without
594
- * connector-specific knowledge. */
595
- state: z.ZodDefault<z.ZodEnum<["unconfigured", "pending", "active", "error", "disabled"]>>;
596
- detail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
597
- /** Opaque, connector-specific status detail (e.g. telephony's
598
- * `{ verificationStatus, verificationAttempts, failureReason }`). Connector-
599
- * owned like the rest of `status` — never user-writable. Nullable so a doc
600
- * that stored `data: null` round-trips without a parse error. */
601
- data: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
602
- updatedAt: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>>;
603
- }, "strip", z.ZodTypeAny, {
604
- state: "active" | "pending" | "error" | "unconfigured" | "disabled";
605
- updatedAt?: Date | undefined;
606
- detail?: string | null | undefined;
607
- data?: Record<string, unknown> | null | undefined;
608
- }, {
609
- updatedAt?: unknown;
610
- state?: "active" | "pending" | "error" | "unconfigured" | "disabled" | undefined;
611
- detail?: string | null | undefined;
612
- data?: Record<string, unknown> | null | undefined;
613
- }>>;
614
- createdAt: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
615
- updatedAt: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
616
- }, "strip", z.ZodTypeAny, {
617
- status: {
618
- state: "active" | "pending" | "error" | "unconfigured" | "disabled";
619
- updatedAt?: Date | undefined;
620
- detail?: string | null | undefined;
621
- data?: Record<string, unknown> | null | undefined;
622
- };
623
- createdAt: Date;
624
- enabled: boolean;
625
- updatedAt: Date;
626
- connectorType: "telephony";
627
- ownerId: string;
628
- settings: Record<string, unknown>;
629
- secretRef?: string | null | undefined;
630
- }, {
631
- connectorType: "telephony";
632
- ownerId: string;
633
- status?: {
634
- updatedAt?: unknown;
635
- state?: "active" | "pending" | "error" | "unconfigured" | "disabled" | undefined;
636
- detail?: string | null | undefined;
637
- data?: Record<string, unknown> | null | undefined;
638
- } | undefined;
639
- createdAt?: unknown;
640
- enabled?: boolean | undefined;
641
- updatedAt?: unknown;
642
- settings?: Record<string, unknown> | undefined;
643
- secretRef?: string | null | undefined;
644
- }>;
645
- type ConnectorConfigRecord = z.infer<typeof ConnectorConfigRecordSchema>;
646
- /**
647
- * A single screening (allowlist) rule — canonical user-authored config, NOT
648
- * derived/enriched, so it's owned by core-api (tier 1) like call-forwarding.
649
- * Stored per-user under `users/{uid}/private_data/screening/rules/{ruleId}`.
650
- *
651
- * "Who gets through": `allow` = ring through, `screen` = go async. A
652
- * time-boxed exception is just an `allow` rule with `expiresAt` set (enforced
653
- * at read/evaluation time — no scheduler). Under Phase-1 missed-call-only
654
- * capture these rules are foundational/editable but not yet gating ring-
655
- * through; they become behavioral at capture-all (Phase 2). See
656
- * `specs/consumer-call-app.md` § 5.
657
- */
658
- declare const ScreeningRuleRecordSchema: z.ZodObject<{
659
- id: z.ZodString;
660
- ownerId: z.ZodString;
661
- /** The caller number this rule matches (E.164). Format-enforced at the
662
- * record level so any writer (API, future contact-sync/callback) can't
663
- * persist a malformed number. */
664
- e164: z.ZodString;
665
- /** Display label, e.g. "Mom" / "Delta Airlines". null = unlabeled. */
666
- label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
667
- /** `allow` = ring through; `screen` = async voicemail. */
668
- action: z.ZodEnum<["allow", "screen"]>;
669
- /** Provenance. `manual` = user-created; the others are future writers. */
670
- source: z.ZodEnum<["manual", "contact-sync", "callback"]>;
671
- /** null = permanent; a date = self-expiring exception. */
672
- expiresAt: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>>>;
673
- createdAt: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
674
- }, "strip", z.ZodTypeAny, {
675
- id: string;
676
- createdAt: Date;
677
- ownerId: string;
678
- e164: string;
679
- action: "allow" | "screen";
680
- source: "manual" | "contact-sync" | "callback";
681
- label?: string | null | undefined;
682
- expiresAt?: Date | null | undefined;
683
- }, {
684
- id: string;
685
- ownerId: string;
686
- e164: string;
687
- action: "allow" | "screen";
688
- source: "manual" | "contact-sync" | "callback";
689
- label?: string | null | undefined;
690
- createdAt?: unknown;
691
- expiresAt?: unknown;
692
- }>;
693
- type ScreeningRuleRecord = z.infer<typeof ScreeningRuleRecordSchema>;
694
- /**
695
- * An Organization (Workspace) that users can be members of.
696
- */
697
- declare const OrganizationRecordSchema: z.ZodObject<{
698
- id: z.ZodString;
699
- /** Display name of the organization */
700
- name: z.ZodString;
701
- /**
702
- * Unique handle for the organization (e.g. voxpop.com/@mypodcast).
703
- * Used for public URLs.
704
- */
705
- slug: z.ZodString;
706
- /** URL to avatar/logo */
707
- avatarUrl: z.ZodOptional<z.ZodString>;
708
- /** URL to the podcast RSS feed */
709
- rssFeedUrl: z.ZodOptional<z.ZodString>;
710
- /** External website URL */
711
- websiteUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
712
- /** Description or tagline */
713
- description: z.ZodOptional<z.ZodString>;
714
- /** Owner ID (User ID) */
715
- ownerId: z.ZodString;
716
- /** Server timestamp of creation */
717
- createdAt: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
718
- /** Verified domain (e.g., "acme.com") — enables auto-join, enterprise features */
719
- domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
720
- /** Whether the domain has been verified via DNS TXT record */
721
- domainVerified: z.ZodDefault<z.ZodBoolean>;
722
- /** DNS verification token (stored server-side until verification completes) */
723
- domainVerificationToken: z.ZodOptional<z.ZodString>;
724
- /** Billing email — required for paid orgs, where invoices go */
725
- billingEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
726
- /**
727
- * Tier determines isolation and feature set. Orgs are meant to be paid
728
- * (business or enterprise); free/pro exist on the enum for the individual track.
729
- * Default is provisionally `business` (the entry paid tier) — it's assigned at
730
- * creation with no subscription behind it yet, so it stays provisional until billing
731
- * promotes/reconciles the org. See docs/tech-debt.md "Org tier billing reconciliation".
732
- */
733
- tier: z.ZodDefault<z.ZodEnum<["free", "pro", "business", "enterprise"]>>;
734
- /** Stripe Customer ID */
735
- stripeCustomerId: z.ZodOptional<z.ZodString>;
736
- /** Subscription Status */
737
- subscriptionStatus: z.ZodOptional<z.ZodEnum<["active", "trialing", "past_due", "canceled", "unpaid"]>>;
738
- }, "strip", z.ZodTypeAny, {
739
- id: string;
740
- createdAt: Date;
741
- tier: "free" | "pro" | "business" | "enterprise";
742
- ownerId: string;
743
- name: string;
744
- slug: string;
745
- domainVerified: boolean;
746
- domain?: string | null | undefined;
747
- avatarUrl?: string | undefined;
748
- description?: string | undefined;
749
- rssFeedUrl?: string | undefined;
750
- websiteUrl?: string | undefined;
751
- domainVerificationToken?: string | undefined;
752
- billingEmail?: string | null | undefined;
753
- stripeCustomerId?: string | undefined;
754
- subscriptionStatus?: "active" | "trialing" | "past_due" | "canceled" | "unpaid" | undefined;
755
- }, {
756
- id: string;
757
- ownerId: string;
758
- name: string;
759
- slug: string;
760
- domain?: string | null | undefined;
761
- avatarUrl?: string | undefined;
762
- createdAt?: unknown;
763
- tier?: "free" | "pro" | "business" | "enterprise" | undefined;
764
- description?: string | undefined;
765
- rssFeedUrl?: string | undefined;
766
- websiteUrl?: string | undefined;
767
- domainVerified?: boolean | undefined;
768
- domainVerificationToken?: string | undefined;
769
- billingEmail?: string | null | undefined;
770
- stripeCustomerId?: string | undefined;
771
- subscriptionStatus?: "active" | "trialing" | "past_due" | "canceled" | "unpaid" | undefined;
772
- }>;
773
- type OrganizationRecord = z.infer<typeof OrganizationRecordSchema>;
774
- /**
775
- * A member of an Organization.
776
- * Stored in `organizations/{orgId}/members/{userId}`
777
- */
778
- declare const OrganizationMemberRecordSchema: z.ZodObject<{
779
- orgId: z.ZodString;
780
- userId: z.ZodString;
781
- /** Role in the organization */
782
- role: z.ZodEnum<["owner", "admin", "member"]>;
783
- /** Server timestamp of joining */
784
- joinedAt: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
785
- invitedBy: z.ZodOptional<z.ZodString>;
786
- }, "strip", z.ZodTypeAny, {
787
- orgId: string;
788
- userId: string;
789
- role: "owner" | "admin" | "member";
790
- joinedAt: Date;
791
- invitedBy?: string | undefined;
792
- }, {
793
- orgId: string;
794
- userId: string;
795
- role: "owner" | "admin" | "member";
796
- joinedAt?: unknown;
797
- invitedBy?: string | undefined;
798
- }>;
799
- type OrganizationMemberRecord = z.infer<typeof OrganizationMemberRecordSchema>;
800
- /**
801
- * An invite to join an Organization.
802
- * Stored in `organizations/{orgId}/invites/{inviteId}`
803
- */
804
- declare const OrgInviteRecordSchema: z.ZodObject<{
805
- id: z.ZodString;
806
- orgId: z.ZodString;
807
- /** Email the invite was sent to */
808
- email: z.ZodString;
809
- /** Role to assign on acceptance */
810
- role: z.ZodEnum<["admin", "member"]>;
811
- /** User ID of who sent the invite */
812
- invitedBy: z.ZodString;
813
- /** Invite lifecycle status */
814
- status: z.ZodDefault<z.ZodEnum<["pending", "accepted", "expired", "revoked"]>>;
815
- /** Server timestamp of creation */
816
- createdAt: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
817
- /** When this invite expires */
818
- expiresAt: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
819
- }, "strip", z.ZodTypeAny, {
820
- status: "pending" | "accepted" | "expired" | "revoked";
821
- id: string;
822
- createdAt: Date;
823
- orgId: string;
824
- expiresAt: Date;
825
- role: "admin" | "member";
826
- invitedBy: string;
827
- email: string;
828
- }, {
829
- id: string;
830
- orgId: string;
831
- role: "admin" | "member";
832
- invitedBy: string;
833
- email: string;
834
- status?: "pending" | "accepted" | "expired" | "revoked" | undefined;
835
- createdAt?: unknown;
836
- expiresAt?: unknown;
837
- }>;
838
- type OrgInviteRecord = z.infer<typeof OrgInviteRecordSchema>;
839
117
 
840
- export { type CallForwardingConfig, CallForwardingConfigSchema, type ConnectorConfigRecord, ConnectorConfigRecordSchema, type ConnectorStatus, ConnectorStatusSchema, type ConnectorType, ConnectorTypeSchema, type FirestoreTimestamp, FirestoreTimestampSchema, type OrgInviteRecord, OrgInviteRecordSchema, type OrganizationMemberRecord, OrganizationMemberRecordSchema, type OrganizationRecord, OrganizationRecordSchema, type PersonEnrichmentRecord, PersonEnrichmentRecordSchema, type PromptRecord, PromptRecordSchema, type ReplyEnrichmentRecord, ReplyEnrichmentRecordSchema, type ReplyRecord, ReplyRecordSchema, type ScreeningRuleRecord, ScreeningRuleRecordSchema, type SipEnrichment, SipEnrichmentSchema, type UserRecord, UserRecordSchema, httpsUrl };
118
+ export { type FirestoreTimestamp, FirestoreTimestampSchema, type UserRecord, UserRecordSchema, httpsUrl };