@indexnetwork/protocol 4.11.0-rc.351.1 → 4.13.0-rc.353.1
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.
- package/CHANGELOG.md +5 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/intent/intent.graph.d.ts +12 -5
- package/dist/intent/intent.graph.d.ts.map +1 -1
- package/dist/intent/intent.graph.js +19 -6
- package/dist/intent/intent.graph.js.map +1 -1
- package/dist/opportunity/discriminator/discriminator.question.d.ts +2 -0
- package/dist/opportunity/discriminator/discriminator.question.d.ts.map +1 -1
- package/dist/opportunity/discriminator/discriminator.question.js +3 -0
- package/dist/opportunity/discriminator/discriminator.question.js.map +1 -1
- package/dist/opportunity/discriminator/discriminator.shadow.d.ts +8 -0
- package/dist/opportunity/discriminator/discriminator.shadow.d.ts.map +1 -1
- package/dist/opportunity/discriminator/discriminator.shadow.js +41 -7
- package/dist/opportunity/discriminator/discriminator.shadow.js.map +1 -1
- package/dist/opportunity/discriminator/discriminator.types.d.ts +4 -0
- package/dist/opportunity/discriminator/discriminator.types.d.ts.map +1 -1
- package/dist/opportunity/discriminator/discriminator.types.js.map +1 -1
- package/dist/opportunity/opportunity.pending-questions.d.ts.map +1 -1
- package/dist/opportunity/opportunity.pending-questions.js +2 -1
- package/dist/opportunity/opportunity.pending-questions.js.map +1 -1
- package/dist/opportunity/opportunity.tools.d.ts.map +1 -1
- package/dist/opportunity/opportunity.tools.js +85 -3
- package/dist/opportunity/opportunity.tools.js.map +1 -1
- package/dist/questioner/questioner.env.d.ts +9 -0
- package/dist/questioner/questioner.env.d.ts.map +1 -1
- package/dist/questioner/questioner.env.js +19 -0
- package/dist/questioner/questioner.env.js.map +1 -1
- package/dist/questioner/questioner.presets.d.ts.map +1 -1
- package/dist/questioner/questioner.presets.js +44 -4
- package/dist/questioner/questioner.presets.js.map +1 -1
- package/dist/questioner/questioner.tools.d.ts.map +1 -1
- package/dist/questioner/questioner.tools.js +3 -3
- package/dist/questioner/questioner.tools.js.map +1 -1
- package/dist/questioner/questioner.types.d.ts +37 -8
- package/dist/questioner/questioner.types.d.ts.map +1 -1
- package/dist/questioner/questioner.types.js.map +1 -1
- package/dist/shared/agent/tool.helpers.d.ts +4 -1
- package/dist/shared/agent/tool.helpers.d.ts.map +1 -1
- package/dist/shared/agent/tool.helpers.js.map +1 -1
- package/dist/shared/interfaces/questioner.interface.d.ts +2 -1
- package/dist/shared/interfaces/questioner.interface.d.ts.map +1 -1
- package/dist/shared/interfaces/questioner.interface.js.map +1 -1
- package/dist/shared/schemas/pending-question.schema.d.ts +3 -1
- package/dist/shared/schemas/pending-question.schema.d.ts.map +1 -1
- package/dist/shared/schemas/pending-question.schema.js.map +1 -1
- package/dist/shared/schemas/question.schema.d.ts +81 -0
- package/dist/shared/schemas/question.schema.d.ts.map +1 -1
- package/dist/shared/schemas/question.schema.js +10 -0
- package/dist/shared/schemas/question.schema.js.map +1 -1
- package/package.json +1 -1
|
@@ -219,6 +219,8 @@ export interface QuestionGenerationResult {
|
|
|
219
219
|
strategies: QuestionStrategy[];
|
|
220
220
|
underspecificationTypes: Array<UnderspecificationType | null>;
|
|
221
221
|
}
|
|
222
|
+
/** Internal reason a question was generated, orthogonal to mode and QUD metadata. */
|
|
223
|
+
export declare const QuestionPurposeSchema: z.ZodEnum<["uptake"]>;
|
|
222
224
|
export declare const QuestionModeSchema: z.ZodEnum<["discovery", "intent", "enrichment", "negotiation", "negotiation_inflight", "chat", "pool_discovery"]>;
|
|
223
225
|
/** One server-side candidate→side assignment (never serialized to clients). */
|
|
224
226
|
export declare const QuestionPoolAssignmentSchema: z.ZodObject<{
|
|
@@ -245,6 +247,10 @@ export declare const QuestionPoolDiscriminatorSchema: z.ZodObject<{
|
|
|
245
247
|
sideCounts: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
246
248
|
voi: z.ZodNumber;
|
|
247
249
|
evidenceRate: z.ZodNumber;
|
|
250
|
+
/** Discriminator embedding retained for durable semantic novelty checks. */
|
|
251
|
+
embedding: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
252
|
+
/** Model that generated `embedding`; mismatches must fall back to text. */
|
|
253
|
+
embeddingModel: z.ZodOptional<z.ZodString>;
|
|
248
254
|
/** Verified assignments only — the P3 re-rank input. */
|
|
249
255
|
assignments: z.ZodArray<z.ZodObject<{
|
|
250
256
|
opportunityId: z.ZodString;
|
|
@@ -267,6 +273,8 @@ export declare const QuestionPoolDiscriminatorSchema: z.ZodObject<{
|
|
|
267
273
|
opportunityId: string;
|
|
268
274
|
side: string;
|
|
269
275
|
}[];
|
|
276
|
+
embedding?: number[] | undefined;
|
|
277
|
+
embeddingModel?: string | undefined;
|
|
270
278
|
}, {
|
|
271
279
|
label: string;
|
|
272
280
|
questionSeed: string;
|
|
@@ -278,6 +286,8 @@ export declare const QuestionPoolDiscriminatorSchema: z.ZodObject<{
|
|
|
278
286
|
opportunityId: string;
|
|
279
287
|
side: string;
|
|
280
288
|
}[];
|
|
289
|
+
embedding?: number[] | undefined;
|
|
290
|
+
embeddingModel?: string | undefined;
|
|
281
291
|
}>;
|
|
282
292
|
/** Pool snapshot stored on pool_discovery questions (server-side only). */
|
|
283
293
|
export declare const QuestionPoolSnapshotSchema: z.ZodObject<{
|
|
@@ -288,6 +298,8 @@ export declare const QuestionPoolSnapshotSchema: z.ZodObject<{
|
|
|
288
298
|
runId: z.ZodOptional<z.ZodString>;
|
|
289
299
|
/** Intent payload snippet (≤160 chars) — reused by chained questions' evidence chips. */
|
|
290
300
|
intentText: z.ZodOptional<z.ZodString>;
|
|
301
|
+
/** Stable hash of the full normalized payload + summary used for freshness. */
|
|
302
|
+
intentFingerprint: z.ZodOptional<z.ZodString>;
|
|
291
303
|
/** The discriminator this question asks about. */
|
|
292
304
|
discriminator: z.ZodObject<{
|
|
293
305
|
label: z.ZodString;
|
|
@@ -297,6 +309,10 @@ export declare const QuestionPoolSnapshotSchema: z.ZodObject<{
|
|
|
297
309
|
sideCounts: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
298
310
|
voi: z.ZodNumber;
|
|
299
311
|
evidenceRate: z.ZodNumber;
|
|
312
|
+
/** Discriminator embedding retained for durable semantic novelty checks. */
|
|
313
|
+
embedding: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
314
|
+
/** Model that generated `embedding`; mismatches must fall back to text. */
|
|
315
|
+
embeddingModel: z.ZodOptional<z.ZodString>;
|
|
300
316
|
/** Verified assignments only — the P3 re-rank input. */
|
|
301
317
|
assignments: z.ZodArray<z.ZodObject<{
|
|
302
318
|
opportunityId: z.ZodString;
|
|
@@ -319,6 +335,8 @@ export declare const QuestionPoolSnapshotSchema: z.ZodObject<{
|
|
|
319
335
|
opportunityId: string;
|
|
320
336
|
side: string;
|
|
321
337
|
}[];
|
|
338
|
+
embedding?: number[] | undefined;
|
|
339
|
+
embeddingModel?: string | undefined;
|
|
322
340
|
}, {
|
|
323
341
|
label: string;
|
|
324
342
|
questionSeed: string;
|
|
@@ -330,6 +348,8 @@ export declare const QuestionPoolSnapshotSchema: z.ZodObject<{
|
|
|
330
348
|
opportunityId: string;
|
|
331
349
|
side: string;
|
|
332
350
|
}[];
|
|
351
|
+
embedding?: number[] | undefined;
|
|
352
|
+
embeddingModel?: string | undefined;
|
|
333
353
|
}>;
|
|
334
354
|
/** Remaining ranked discriminators for interview-mode chaining. */
|
|
335
355
|
alternates: z.ZodArray<z.ZodObject<{
|
|
@@ -340,6 +360,10 @@ export declare const QuestionPoolSnapshotSchema: z.ZodObject<{
|
|
|
340
360
|
sideCounts: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
341
361
|
voi: z.ZodNumber;
|
|
342
362
|
evidenceRate: z.ZodNumber;
|
|
363
|
+
/** Discriminator embedding retained for durable semantic novelty checks. */
|
|
364
|
+
embedding: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
365
|
+
/** Model that generated `embedding`; mismatches must fall back to text. */
|
|
366
|
+
embeddingModel: z.ZodOptional<z.ZodString>;
|
|
343
367
|
/** Verified assignments only — the P3 re-rank input. */
|
|
344
368
|
assignments: z.ZodArray<z.ZodObject<{
|
|
345
369
|
opportunityId: z.ZodString;
|
|
@@ -362,6 +386,8 @@ export declare const QuestionPoolSnapshotSchema: z.ZodObject<{
|
|
|
362
386
|
opportunityId: string;
|
|
363
387
|
side: string;
|
|
364
388
|
}[];
|
|
389
|
+
embedding?: number[] | undefined;
|
|
390
|
+
embeddingModel?: string | undefined;
|
|
365
391
|
}, {
|
|
366
392
|
label: string;
|
|
367
393
|
questionSeed: string;
|
|
@@ -373,6 +399,8 @@ export declare const QuestionPoolSnapshotSchema: z.ZodObject<{
|
|
|
373
399
|
opportunityId: string;
|
|
374
400
|
side: string;
|
|
375
401
|
}[];
|
|
402
|
+
embedding?: number[] | undefined;
|
|
403
|
+
embeddingModel?: string | undefined;
|
|
376
404
|
}>, "many">;
|
|
377
405
|
}, "strip", z.ZodTypeAny, {
|
|
378
406
|
poolSize: number;
|
|
@@ -388,6 +416,8 @@ export declare const QuestionPoolSnapshotSchema: z.ZodObject<{
|
|
|
388
416
|
opportunityId: string;
|
|
389
417
|
side: string;
|
|
390
418
|
}[];
|
|
419
|
+
embedding?: number[] | undefined;
|
|
420
|
+
embeddingModel?: string | undefined;
|
|
391
421
|
};
|
|
392
422
|
alternates: {
|
|
393
423
|
label: string;
|
|
@@ -400,9 +430,12 @@ export declare const QuestionPoolSnapshotSchema: z.ZodObject<{
|
|
|
400
430
|
opportunityId: string;
|
|
401
431
|
side: string;
|
|
402
432
|
}[];
|
|
433
|
+
embedding?: number[] | undefined;
|
|
434
|
+
embeddingModel?: string | undefined;
|
|
403
435
|
}[];
|
|
404
436
|
runId?: string | undefined;
|
|
405
437
|
intentText?: string | undefined;
|
|
438
|
+
intentFingerprint?: string | undefined;
|
|
406
439
|
}, {
|
|
407
440
|
poolSize: number;
|
|
408
441
|
minedAt: string;
|
|
@@ -417,6 +450,8 @@ export declare const QuestionPoolSnapshotSchema: z.ZodObject<{
|
|
|
417
450
|
opportunityId: string;
|
|
418
451
|
side: string;
|
|
419
452
|
}[];
|
|
453
|
+
embedding?: number[] | undefined;
|
|
454
|
+
embeddingModel?: string | undefined;
|
|
420
455
|
};
|
|
421
456
|
alternates: {
|
|
422
457
|
label: string;
|
|
@@ -429,13 +464,18 @@ export declare const QuestionPoolSnapshotSchema: z.ZodObject<{
|
|
|
429
464
|
opportunityId: string;
|
|
430
465
|
side: string;
|
|
431
466
|
}[];
|
|
467
|
+
embedding?: number[] | undefined;
|
|
468
|
+
embeddingModel?: string | undefined;
|
|
432
469
|
}[];
|
|
433
470
|
runId?: string | undefined;
|
|
434
471
|
intentText?: string | undefined;
|
|
472
|
+
intentFingerprint?: string | undefined;
|
|
435
473
|
}>;
|
|
436
474
|
export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
437
475
|
/** Which preset mode generated this question. */
|
|
438
476
|
mode: z.ZodEnum<["discovery", "intent", "enrichment", "negotiation", "negotiation_inflight", "chat", "pool_discovery"]>;
|
|
477
|
+
/** Internal reason for generation; independent of mode and QUD repair metadata. */
|
|
478
|
+
purpose: z.ZodOptional<z.ZodEnum<["uptake"]>>;
|
|
439
479
|
/** Entity type that triggered generation (e.g. "opportunity", "intent", "profile"). */
|
|
440
480
|
sourceType: z.ZodString;
|
|
441
481
|
/** ID of the triggering entity. */
|
|
@@ -462,6 +502,8 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
462
502
|
runId: z.ZodOptional<z.ZodString>;
|
|
463
503
|
/** Intent payload snippet (≤160 chars) — reused by chained questions' evidence chips. */
|
|
464
504
|
intentText: z.ZodOptional<z.ZodString>;
|
|
505
|
+
/** Stable hash of the full normalized payload + summary used for freshness. */
|
|
506
|
+
intentFingerprint: z.ZodOptional<z.ZodString>;
|
|
465
507
|
/** The discriminator this question asks about. */
|
|
466
508
|
discriminator: z.ZodObject<{
|
|
467
509
|
label: z.ZodString;
|
|
@@ -471,6 +513,10 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
471
513
|
sideCounts: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
472
514
|
voi: z.ZodNumber;
|
|
473
515
|
evidenceRate: z.ZodNumber;
|
|
516
|
+
/** Discriminator embedding retained for durable semantic novelty checks. */
|
|
517
|
+
embedding: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
518
|
+
/** Model that generated `embedding`; mismatches must fall back to text. */
|
|
519
|
+
embeddingModel: z.ZodOptional<z.ZodString>;
|
|
474
520
|
/** Verified assignments only — the P3 re-rank input. */
|
|
475
521
|
assignments: z.ZodArray<z.ZodObject<{
|
|
476
522
|
opportunityId: z.ZodString;
|
|
@@ -493,6 +539,8 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
493
539
|
opportunityId: string;
|
|
494
540
|
side: string;
|
|
495
541
|
}[];
|
|
542
|
+
embedding?: number[] | undefined;
|
|
543
|
+
embeddingModel?: string | undefined;
|
|
496
544
|
}, {
|
|
497
545
|
label: string;
|
|
498
546
|
questionSeed: string;
|
|
@@ -504,6 +552,8 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
504
552
|
opportunityId: string;
|
|
505
553
|
side: string;
|
|
506
554
|
}[];
|
|
555
|
+
embedding?: number[] | undefined;
|
|
556
|
+
embeddingModel?: string | undefined;
|
|
507
557
|
}>;
|
|
508
558
|
/** Remaining ranked discriminators for interview-mode chaining. */
|
|
509
559
|
alternates: z.ZodArray<z.ZodObject<{
|
|
@@ -514,6 +564,10 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
514
564
|
sideCounts: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
515
565
|
voi: z.ZodNumber;
|
|
516
566
|
evidenceRate: z.ZodNumber;
|
|
567
|
+
/** Discriminator embedding retained for durable semantic novelty checks. */
|
|
568
|
+
embedding: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
569
|
+
/** Model that generated `embedding`; mismatches must fall back to text. */
|
|
570
|
+
embeddingModel: z.ZodOptional<z.ZodString>;
|
|
517
571
|
/** Verified assignments only — the P3 re-rank input. */
|
|
518
572
|
assignments: z.ZodArray<z.ZodObject<{
|
|
519
573
|
opportunityId: z.ZodString;
|
|
@@ -536,6 +590,8 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
536
590
|
opportunityId: string;
|
|
537
591
|
side: string;
|
|
538
592
|
}[];
|
|
593
|
+
embedding?: number[] | undefined;
|
|
594
|
+
embeddingModel?: string | undefined;
|
|
539
595
|
}, {
|
|
540
596
|
label: string;
|
|
541
597
|
questionSeed: string;
|
|
@@ -547,6 +603,8 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
547
603
|
opportunityId: string;
|
|
548
604
|
side: string;
|
|
549
605
|
}[];
|
|
606
|
+
embedding?: number[] | undefined;
|
|
607
|
+
embeddingModel?: string | undefined;
|
|
550
608
|
}>, "many">;
|
|
551
609
|
}, "strip", z.ZodTypeAny, {
|
|
552
610
|
poolSize: number;
|
|
@@ -562,6 +620,8 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
562
620
|
opportunityId: string;
|
|
563
621
|
side: string;
|
|
564
622
|
}[];
|
|
623
|
+
embedding?: number[] | undefined;
|
|
624
|
+
embeddingModel?: string | undefined;
|
|
565
625
|
};
|
|
566
626
|
alternates: {
|
|
567
627
|
label: string;
|
|
@@ -574,9 +634,12 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
574
634
|
opportunityId: string;
|
|
575
635
|
side: string;
|
|
576
636
|
}[];
|
|
637
|
+
embedding?: number[] | undefined;
|
|
638
|
+
embeddingModel?: string | undefined;
|
|
577
639
|
}[];
|
|
578
640
|
runId?: string | undefined;
|
|
579
641
|
intentText?: string | undefined;
|
|
642
|
+
intentFingerprint?: string | undefined;
|
|
580
643
|
}, {
|
|
581
644
|
poolSize: number;
|
|
582
645
|
minedAt: string;
|
|
@@ -591,6 +654,8 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
591
654
|
opportunityId: string;
|
|
592
655
|
side: string;
|
|
593
656
|
}[];
|
|
657
|
+
embedding?: number[] | undefined;
|
|
658
|
+
embeddingModel?: string | undefined;
|
|
594
659
|
};
|
|
595
660
|
alternates: {
|
|
596
661
|
label: string;
|
|
@@ -603,9 +668,12 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
603
668
|
opportunityId: string;
|
|
604
669
|
side: string;
|
|
605
670
|
}[];
|
|
671
|
+
embedding?: number[] | undefined;
|
|
672
|
+
embeddingModel?: string | undefined;
|
|
606
673
|
}[];
|
|
607
674
|
runId?: string | undefined;
|
|
608
675
|
intentText?: string | undefined;
|
|
676
|
+
intentFingerprint?: string | undefined;
|
|
609
677
|
}>>;
|
|
610
678
|
}, "strip", z.ZodTypeAny, {
|
|
611
679
|
mode: "intent" | "chat" | "enrichment" | "discovery" | "negotiation" | "negotiation_inflight" | "pool_discovery";
|
|
@@ -614,6 +682,7 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
614
682
|
timestamp: string;
|
|
615
683
|
strategy?: "refine_intent" | "surface_missing_detail" | "open_adjacent_thread" | "reflective_summary" | "surface_emergent_knowledge" | undefined;
|
|
616
684
|
underspecificationType?: "missing_constituent" | "missing_constraint" | "open_alternative_set" | null | undefined;
|
|
685
|
+
purpose?: "uptake" | undefined;
|
|
617
686
|
triggeredBy?: string | undefined;
|
|
618
687
|
messageId?: string | undefined;
|
|
619
688
|
pool?: {
|
|
@@ -630,6 +699,8 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
630
699
|
opportunityId: string;
|
|
631
700
|
side: string;
|
|
632
701
|
}[];
|
|
702
|
+
embedding?: number[] | undefined;
|
|
703
|
+
embeddingModel?: string | undefined;
|
|
633
704
|
};
|
|
634
705
|
alternates: {
|
|
635
706
|
label: string;
|
|
@@ -642,9 +713,12 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
642
713
|
opportunityId: string;
|
|
643
714
|
side: string;
|
|
644
715
|
}[];
|
|
716
|
+
embedding?: number[] | undefined;
|
|
717
|
+
embeddingModel?: string | undefined;
|
|
645
718
|
}[];
|
|
646
719
|
runId?: string | undefined;
|
|
647
720
|
intentText?: string | undefined;
|
|
721
|
+
intentFingerprint?: string | undefined;
|
|
648
722
|
} | undefined;
|
|
649
723
|
}, {
|
|
650
724
|
mode: "intent" | "chat" | "enrichment" | "discovery" | "negotiation" | "negotiation_inflight" | "pool_discovery";
|
|
@@ -653,6 +727,7 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
653
727
|
timestamp: string;
|
|
654
728
|
strategy?: "refine_intent" | "surface_missing_detail" | "open_adjacent_thread" | "reflective_summary" | "surface_emergent_knowledge" | undefined;
|
|
655
729
|
underspecificationType?: "missing_constituent" | "missing_constraint" | "open_alternative_set" | null | undefined;
|
|
730
|
+
purpose?: "uptake" | undefined;
|
|
656
731
|
triggeredBy?: string | undefined;
|
|
657
732
|
messageId?: string | undefined;
|
|
658
733
|
pool?: {
|
|
@@ -669,6 +744,8 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
669
744
|
opportunityId: string;
|
|
670
745
|
side: string;
|
|
671
746
|
}[];
|
|
747
|
+
embedding?: number[] | undefined;
|
|
748
|
+
embeddingModel?: string | undefined;
|
|
672
749
|
};
|
|
673
750
|
alternates: {
|
|
674
751
|
label: string;
|
|
@@ -681,9 +758,12 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
|
|
|
681
758
|
opportunityId: string;
|
|
682
759
|
side: string;
|
|
683
760
|
}[];
|
|
761
|
+
embedding?: number[] | undefined;
|
|
762
|
+
embeddingModel?: string | undefined;
|
|
684
763
|
}[];
|
|
685
764
|
runId?: string | undefined;
|
|
686
765
|
intentText?: string | undefined;
|
|
766
|
+
intentFingerprint?: string | undefined;
|
|
687
767
|
} | undefined;
|
|
688
768
|
}>;
|
|
689
769
|
export declare const QuestionActorSchema: z.ZodObject<{
|
|
@@ -722,6 +802,7 @@ export declare const QuestionAnswerSchema: z.ZodObject<{
|
|
|
722
802
|
answeredAt: string;
|
|
723
803
|
freeText?: string | undefined;
|
|
724
804
|
}>;
|
|
805
|
+
export type QuestionPurpose = z.infer<typeof QuestionPurposeSchema>;
|
|
725
806
|
export type QuestionMode = z.infer<typeof QuestionModeSchema>;
|
|
726
807
|
export type QuestionDetection = z.infer<typeof QuestionDetectionSchema>;
|
|
727
808
|
export type QuestionActor = z.infer<typeof QuestionActorSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.schema.d.ts","sourceRoot":"/","sources":["shared/schemas/question.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,oBAAoB;IAC/B,+EAA+E;;IAE/E,iFAAiF;;;;;;;;EAEjF,CAAC;AAEH,eAAO,MAAM,cAAc;IACzB,+EAA+E;;IAE/E,yDAAyD;;IAEzD,6EAA6E;;QAX7E,+EAA+E;;QAE/E,iFAAiF;;;;;;;;;IAWjF,0EAA0E;;IAE1E;;;;OAIG;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,4EAA4E;AAC5E,eAAO,MAAM,4BAA4B,kFAIvC,CAAC;AAEH,eAAO,MAAM,sBAAsB,oIAMjC,CAAC;AAEH,eAAO,MAAM,0BAA0B;IA/BrC,+EAA+E;;IAE/E,yDAAyD;;IAEzD,6EAA6E;;QAX7E,+EAA+E;;QAE/E,iFAAiF;;;;;;;;;IAWjF,0EAA0E;;IAE1E;;;;OAIG;;;;IAqBH,0FAA0F;;;;;;;;;;;;;;;;;;;;;;;;EAE1F,CAAC;AAEH,eAAO,MAAM,+BAA+B;;QArC1C,+EAA+E;;QAE/E,yDAAyD;;QAEzD,6EAA6E;;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B,CAAC,CAAC;AAClF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
|
@@ -53,6 +53,8 @@ export const QuestionGeneratorResponseSchema = z.object({
|
|
|
53
53
|
questions: z.array(QuestionWithStrategySchema).max(3),
|
|
54
54
|
});
|
|
55
55
|
// ─── Persistence types (opportunity-style composable jsonb) ──────────────────
|
|
56
|
+
/** Internal reason a question was generated, orthogonal to mode and QUD metadata. */
|
|
57
|
+
export const QuestionPurposeSchema = z.enum(["uptake"]);
|
|
56
58
|
export const QuestionModeSchema = z.enum([
|
|
57
59
|
"discovery",
|
|
58
60
|
"intent",
|
|
@@ -86,6 +88,10 @@ export const QuestionPoolDiscriminatorSchema = z.object({
|
|
|
86
88
|
sideCounts: z.record(z.string(), z.number()),
|
|
87
89
|
voi: z.number(),
|
|
88
90
|
evidenceRate: z.number(),
|
|
91
|
+
/** Discriminator embedding retained for durable semantic novelty checks. */
|
|
92
|
+
embedding: z.array(z.number().finite()).min(1).max(4096).optional(),
|
|
93
|
+
/** Model that generated `embedding`; mismatches must fall back to text. */
|
|
94
|
+
embeddingModel: z.string().min(1).optional(),
|
|
89
95
|
/** Verified assignments only — the P3 re-rank input. */
|
|
90
96
|
assignments: z.array(QuestionPoolAssignmentSchema),
|
|
91
97
|
});
|
|
@@ -98,6 +104,8 @@ export const QuestionPoolSnapshotSchema = z.object({
|
|
|
98
104
|
runId: z.string().optional(),
|
|
99
105
|
/** Intent payload snippet (≤160 chars) — reused by chained questions' evidence chips. */
|
|
100
106
|
intentText: z.string().optional(),
|
|
107
|
+
/** Stable hash of the full normalized payload + summary used for freshness. */
|
|
108
|
+
intentFingerprint: z.string().min(1).optional(),
|
|
101
109
|
/** The discriminator this question asks about. */
|
|
102
110
|
discriminator: QuestionPoolDiscriminatorSchema,
|
|
103
111
|
/** Remaining ranked discriminators for interview-mode chaining. */
|
|
@@ -106,6 +114,8 @@ export const QuestionPoolSnapshotSchema = z.object({
|
|
|
106
114
|
export const QuestionDetectionSchema = z.object({
|
|
107
115
|
/** Which preset mode generated this question. */
|
|
108
116
|
mode: QuestionModeSchema,
|
|
117
|
+
/** Internal reason for generation; independent of mode and QUD repair metadata. */
|
|
118
|
+
purpose: QuestionPurposeSchema.optional(),
|
|
109
119
|
/** Entity type that triggered generation (e.g. "opportunity", "intent", "profile"). */
|
|
110
120
|
sourceType: z.string().min(1),
|
|
111
121
|
/** ID of the triggering entity. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.schema.js","sourceRoot":"/","sources":["shared/schemas/question.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,+EAA+E;IAC/E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACjC,iFAAiF;IACjF,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CACxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,+EAA+E;IAC/E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IAChC,yDAAyD;IACzD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAClC,6EAA6E;IAC7E,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,C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AAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,uCAAuC;IACvC,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACpC,iEAAiE;IACjE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,+BAA+B;IAC/B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,2DAA2D;IAC3D,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC9B,CAAC,CAAC","sourcesContent":["/**\n * Question — public structured shape consumed by frontend renderers and MCP\n * elicitation dispatch. Mirrors the brainstorming AskUserQuestion skill so a\n * Question can be rendered identically across surfaces.\n *\n * `QuestionWithStrategy` extends the public shape with internal `strategy`\n * and QUD underspecification tags used by generator guardrails and persisted\n * metadata. Both tags are stripped before the public payload leaves the\n * generator — users never see them.\n */\nimport { z } from \"zod\";\n\nexport const QuestionOptionSchema = z.object({\n /** Display text. Suffix \" (Recommended)\" on the safest path; list it first. */\n label: z.string().min(1).max(120),\n /** Explains the consequence of choosing this option, not just its definition. */\n description: z.string().min(1).max(280),\n});\n\nexport const QuestionSchema = z.object({\n /** ≤12 chars. Noun of the decision domain — e.g. \"Stage\", \"Timing\", \"Role\". */\n title: z.string().min(1).max(12),\n /** ≤2 sentences, ≤400 chars. Ends in a question mark. */\n prompt: z.string().min(1).max(400),\n /** 2–4 options. No explicit \"Other\" — clients provide that automatically. */\n options: z.array(QuestionOptionSchema).min(2).max(4),\n /** True when options are not mutually exclusive (priorities, bundles). */\n multiSelect: z.boolean(),\n /**\n * Optional provenance line rendered as a muted chip above the prompt\n * (e.g. \"based on 18 people matching this intent\"). Aggregate counts only —\n * never individual identities (pool_discovery k-anonymity invariant).\n */\n evidence: z.string().min(1).max(160).optional(),\n});\n\n/** Canonical QUD repair categories for underspecified intents/questions. */\nexport const UnderspecificationTypeSchema = z.enum([\n \"missing_constituent\",\n \"missing_constraint\",\n \"open_alternative_set\",\n]);\n\nexport const QuestionStrategySchema = z.enum([\n \"refine_intent\",\n \"surface_missing_detail\",\n \"open_adjacent_thread\",\n \"reflective_summary\",\n \"surface_emergent_knowledge\",\n]);\n\nexport const QuestionWithStrategySchema = QuestionSchema.extend({\n strategy: QuestionStrategySchema,\n /** QUD repair category, or null when the question is not an underspecification repair. */\n underspecificationType: UnderspecificationTypeSchema.nullable(),\n});\n\nexport const QuestionGeneratorResponseSchema = z.object({\n questions: z.array(QuestionWithStrategySchema).max(3),\n});\n\nexport type QuestionOption = z.infer<typeof QuestionOptionSchema>;\nexport type Question = z.infer<typeof QuestionSchema>;\nexport type UnderspecificationType = z.infer<typeof UnderspecificationTypeSchema>;\nexport type QuestionStrategy = z.infer<typeof QuestionStrategySchema>;\nexport type QuestionWithStrategy = z.infer<typeof QuestionWithStrategySchema>;\nexport type QuestionGeneratorResponse = z.infer<typeof QuestionGeneratorResponseSchema>;\n\n/**\n * Internal generator output: public questions plus parallel strategy and QUD\n * taxonomy arrays for metadata-only consumption. The generator emits this;\n * callers forward only `questions` to renderers.\n */\nexport interface QuestionGenerationResult {\n questions: Question[];\n strategies: QuestionStrategy[];\n underspecificationTypes: Array<UnderspecificationType | null>;\n}\n\n// ─── Persistence types (opportunity-style composable jsonb) ──────────────────\n\nexport const QuestionModeSchema = z.enum([\n \"discovery\",\n \"intent\",\n \"enrichment\",\n \"negotiation\",\n // Negotiator-initiated mid-negotiation client questions (ask_user action, P3).\n // Distinct from \"negotiation\", which covers post-stall questions only.\n \"negotiation_inflight\",\n // Orchestrator-initiated mid-conversation questions (ask_user_question tool).\n \"chat\",\n // Pool-discriminator questions mined from the intent's candidate pool\n // (IND-418). Synthesized deterministically — no generator LLM call.\n \"pool_discovery\",\n]);\n\n/** One server-side candidate→side assignment (never serialized to clients). */\nexport const QuestionPoolAssignmentSchema = z.object({\n opportunityId: z.string().min(1),\n side: z.string().min(1),\n});\n\n/**\n * One mined discriminator carried inside a pool_discovery question's\n * detection (the asked one plus ranked alternates for interview-mode\n * chaining). INTERNAL — the read path strips `detection.pool` before any\n * payload leaves the server.\n */\nexport const QuestionPoolDiscriminatorSchema = z.object({\n label: z.string().min(1),\n questionSeed: z.string().min(1),\n sides: z.array(z.string().min(1)).min(2).max(3),\n /** Verified-assignment count per side label. */\n sideCounts: z.record(z.string(), z.number()),\n voi: z.number(),\n evidenceRate: z.number(),\n /** Verified assignments only — the P3 re-rank input. */\n assignments: z.array(QuestionPoolAssignmentSchema),\n});\n\n/** Pool snapshot stored on pool_discovery questions (server-side only). */\nexport const QuestionPoolSnapshotSchema = z.object({\n poolSize: z.number().int().min(0),\n /** ISO-8601 timestamp of the mining pass. */\n minedAt: z.string().min(1),\n /** Discovery run that produced the pool, when known. */\n runId: z.string().optional(),\n /** Intent payload snippet (≤160 chars) — reused by chained questions' evidence chips. */\n intentText: z.string().optional(),\n /** The discriminator this question asks about. */\n discriminator: QuestionPoolDiscriminatorSchema,\n /** Remaining ranked discriminators for interview-mode chaining. */\n alternates: z.array(QuestionPoolDiscriminatorSchema),\n});\n\nexport const QuestionDetectionSchema = z.object({\n /** Which preset mode generated this question. */\n mode: QuestionModeSchema,\n /** Entity type that triggered generation (e.g. \"opportunity\", \"intent\", \"profile\"). */\n sourceType: z.string().min(1),\n /** ID of the triggering entity. */\n sourceId: z.string().min(1),\n /** Optional intent ID that was the root cause. */\n triggeredBy: z.string().optional(),\n /** ISO-8601 timestamp of generation. */\n timestamp: z.string().min(1),\n /** Generation strategy persisted as internal metadata. */\n strategy: QuestionStrategySchema.optional(),\n /** QUD repair category persisted as internal metadata. */\n underspecificationType: UnderspecificationTypeSchema.nullable().optional(),\n /** ID of the assistant message that triggered this question. Used by the frontend to anchor the question card inline. */\n messageId: z.string().optional(),\n /**\n * pool_discovery only: the mined pool snapshot (assignments + alternates).\n * INTERNAL — stripped from every client-facing read (web + MCP).\n */\n pool: QuestionPoolSnapshotSchema.optional(),\n});\n\nexport const QuestionActorSchema = z.object({\n /** The user this question is for. */\n userId: z.string().min(1),\n /** Optional network context. */\n networkId: z.string().optional(),\n /** Actor's role in the question — currently always \"subject\". */\n role: z.literal(\"subject\"),\n});\n\nexport const QuestionAnswerSchema = z.object({\n /** Option labels the user selected. */\n selectedOptions: z.array(z.string()),\n /** Free-text input when the user chose \"Other\" or elaborated. */\n freeText: z.string().optional(),\n /** User ID of the answerer. */\n answeredBy: z.string().min(1),\n /** ISO-8601 timestamp of when the answer was submitted. */\n answeredAt: z.string().min(1),\n});\n\nexport type QuestionMode = z.infer<typeof QuestionModeSchema>;\nexport type QuestionDetection = z.infer<typeof QuestionDetectionSchema>;\nexport type QuestionActor = z.infer<typeof QuestionActorSchema>;\nexport type QuestionAnswer = z.infer<typeof QuestionAnswerSchema>;\nexport type QuestionPoolAssignment = z.infer<typeof QuestionPoolAssignmentSchema>;\nexport type QuestionPoolDiscriminator = z.infer<typeof QuestionPoolDiscriminatorSchema>;\nexport type QuestionPoolSnapshot = z.infer<typeof QuestionPoolSnapshotSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"question.schema.js","sourceRoot":"/","sources":["shared/schemas/question.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,+EAA+E;IAC/E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACjC,iFAAiF;IACjF,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CACxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC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M,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC9B,CAAC,CAAC","sourcesContent":["/**\n * Question — public structured shape consumed by frontend renderers and MCP\n * elicitation dispatch. Mirrors the brainstorming AskUserQuestion skill so a\n * Question can be rendered identically across surfaces.\n *\n * `QuestionWithStrategy` extends the public shape with internal `strategy`\n * and QUD underspecification tags used by generator guardrails and persisted\n * metadata. Both tags are stripped before the public payload leaves the\n * generator — users never see them.\n */\nimport { z } from \"zod\";\n\nexport const QuestionOptionSchema = z.object({\n /** Display text. Suffix \" (Recommended)\" on the safest path; list it first. */\n label: z.string().min(1).max(120),\n /** Explains the consequence of choosing this option, not just its definition. */\n description: z.string().min(1).max(280),\n});\n\nexport const QuestionSchema = z.object({\n /** ≤12 chars. Noun of the decision domain — e.g. \"Stage\", \"Timing\", \"Role\". */\n title: z.string().min(1).max(12),\n /** ≤2 sentences, ≤400 chars. Ends in a question mark. */\n prompt: z.string().min(1).max(400),\n /** 2–4 options. No explicit \"Other\" — clients provide that automatically. */\n options: z.array(QuestionOptionSchema).min(2).max(4),\n /** True when options are not mutually exclusive (priorities, bundles). */\n multiSelect: z.boolean(),\n /**\n * Optional provenance line rendered as a muted chip above the prompt\n * (e.g. \"based on 18 people matching this intent\"). Aggregate counts only —\n * never individual identities (pool_discovery k-anonymity invariant).\n */\n evidence: z.string().min(1).max(160).optional(),\n});\n\n/** Canonical QUD repair categories for underspecified intents/questions. */\nexport const UnderspecificationTypeSchema = z.enum([\n \"missing_constituent\",\n \"missing_constraint\",\n \"open_alternative_set\",\n]);\n\nexport const QuestionStrategySchema = z.enum([\n \"refine_intent\",\n \"surface_missing_detail\",\n \"open_adjacent_thread\",\n \"reflective_summary\",\n \"surface_emergent_knowledge\",\n]);\n\nexport const QuestionWithStrategySchema = QuestionSchema.extend({\n strategy: QuestionStrategySchema,\n /** QUD repair category, or null when the question is not an underspecification repair. */\n underspecificationType: UnderspecificationTypeSchema.nullable(),\n});\n\nexport const QuestionGeneratorResponseSchema = z.object({\n questions: z.array(QuestionWithStrategySchema).max(3),\n});\n\nexport type QuestionOption = z.infer<typeof QuestionOptionSchema>;\nexport type Question = z.infer<typeof QuestionSchema>;\nexport type UnderspecificationType = z.infer<typeof UnderspecificationTypeSchema>;\nexport type QuestionStrategy = z.infer<typeof QuestionStrategySchema>;\nexport type QuestionWithStrategy = z.infer<typeof QuestionWithStrategySchema>;\nexport type QuestionGeneratorResponse = z.infer<typeof QuestionGeneratorResponseSchema>;\n\n/**\n * Internal generator output: public questions plus parallel strategy and QUD\n * taxonomy arrays for metadata-only consumption. The generator emits this;\n * callers forward only `questions` to renderers.\n */\nexport interface QuestionGenerationResult {\n questions: Question[];\n strategies: QuestionStrategy[];\n underspecificationTypes: Array<UnderspecificationType | null>;\n}\n\n// ─── Persistence types (opportunity-style composable jsonb) ──────────────────\n\n/** Internal reason a question was generated, orthogonal to mode and QUD metadata. */\nexport const QuestionPurposeSchema = z.enum([\"uptake\"]);\n\nexport const QuestionModeSchema = z.enum([\n \"discovery\",\n \"intent\",\n \"enrichment\",\n \"negotiation\",\n // Negotiator-initiated mid-negotiation client questions (ask_user action, P3).\n // Distinct from \"negotiation\", which covers post-stall questions only.\n \"negotiation_inflight\",\n // Orchestrator-initiated mid-conversation questions (ask_user_question tool).\n \"chat\",\n // Pool-discriminator questions mined from the intent's candidate pool\n // (IND-418). Synthesized deterministically — no generator LLM call.\n \"pool_discovery\",\n]);\n\n/** One server-side candidate→side assignment (never serialized to clients). */\nexport const QuestionPoolAssignmentSchema = z.object({\n opportunityId: z.string().min(1),\n side: z.string().min(1),\n});\n\n/**\n * One mined discriminator carried inside a pool_discovery question's\n * detection (the asked one plus ranked alternates for interview-mode\n * chaining). INTERNAL — the read path strips `detection.pool` before any\n * payload leaves the server.\n */\nexport const QuestionPoolDiscriminatorSchema = z.object({\n label: z.string().min(1),\n questionSeed: z.string().min(1),\n sides: z.array(z.string().min(1)).min(2).max(3),\n /** Verified-assignment count per side label. */\n sideCounts: z.record(z.string(), z.number()),\n voi: z.number(),\n evidenceRate: z.number(),\n /** Discriminator embedding retained for durable semantic novelty checks. */\n embedding: z.array(z.number().finite()).min(1).max(4096).optional(),\n /** Model that generated `embedding`; mismatches must fall back to text. */\n embeddingModel: z.string().min(1).optional(),\n /** Verified assignments only — the P3 re-rank input. */\n assignments: z.array(QuestionPoolAssignmentSchema),\n});\n\n/** Pool snapshot stored on pool_discovery questions (server-side only). */\nexport const QuestionPoolSnapshotSchema = z.object({\n poolSize: z.number().int().min(0),\n /** ISO-8601 timestamp of the mining pass. */\n minedAt: z.string().min(1),\n /** Discovery run that produced the pool, when known. */\n runId: z.string().optional(),\n /** Intent payload snippet (≤160 chars) — reused by chained questions' evidence chips. */\n intentText: z.string().optional(),\n /** Stable hash of the full normalized payload + summary used for freshness. */\n intentFingerprint: z.string().min(1).optional(),\n /** The discriminator this question asks about. */\n discriminator: QuestionPoolDiscriminatorSchema,\n /** Remaining ranked discriminators for interview-mode chaining. */\n alternates: z.array(QuestionPoolDiscriminatorSchema),\n});\n\nexport const QuestionDetectionSchema = z.object({\n /** Which preset mode generated this question. */\n mode: QuestionModeSchema,\n /** Internal reason for generation; independent of mode and QUD repair metadata. */\n purpose: QuestionPurposeSchema.optional(),\n /** Entity type that triggered generation (e.g. \"opportunity\", \"intent\", \"profile\"). */\n sourceType: z.string().min(1),\n /** ID of the triggering entity. */\n sourceId: z.string().min(1),\n /** Optional intent ID that was the root cause. */\n triggeredBy: z.string().optional(),\n /** ISO-8601 timestamp of generation. */\n timestamp: z.string().min(1),\n /** Generation strategy persisted as internal metadata. */\n strategy: QuestionStrategySchema.optional(),\n /** QUD repair category persisted as internal metadata. */\n underspecificationType: UnderspecificationTypeSchema.nullable().optional(),\n /** ID of the assistant message that triggered this question. Used by the frontend to anchor the question card inline. */\n messageId: z.string().optional(),\n /**\n * pool_discovery only: the mined pool snapshot (assignments + alternates).\n * INTERNAL — stripped from every client-facing read (web + MCP).\n */\n pool: QuestionPoolSnapshotSchema.optional(),\n});\n\nexport const QuestionActorSchema = z.object({\n /** The user this question is for. */\n userId: z.string().min(1),\n /** Optional network context. */\n networkId: z.string().optional(),\n /** Actor's role in the question — currently always \"subject\". */\n role: z.literal(\"subject\"),\n});\n\nexport const QuestionAnswerSchema = z.object({\n /** Option labels the user selected. */\n selectedOptions: z.array(z.string()),\n /** Free-text input when the user chose \"Other\" or elaborated. */\n freeText: z.string().optional(),\n /** User ID of the answerer. */\n answeredBy: z.string().min(1),\n /** ISO-8601 timestamp of when the answer was submitted. */\n answeredAt: z.string().min(1),\n});\n\nexport type QuestionPurpose = z.infer<typeof QuestionPurposeSchema>;\nexport type QuestionMode = z.infer<typeof QuestionModeSchema>;\nexport type QuestionDetection = z.infer<typeof QuestionDetectionSchema>;\nexport type QuestionActor = z.infer<typeof QuestionActorSchema>;\nexport type QuestionAnswer = z.infer<typeof QuestionAnswerSchema>;\nexport type QuestionPoolAssignment = z.infer<typeof QuestionPoolAssignmentSchema>;\nexport type QuestionPoolDiscriminator = z.infer<typeof QuestionPoolDiscriminatorSchema>;\nexport type QuestionPoolSnapshot = z.infer<typeof QuestionPoolSnapshotSchema>;\n"]}
|