@indexnetwork/protocol 12.1.0-rc.463.1 → 13.1.0-rc.465.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/capabilities/questions.facade.d.ts +2 -2
  3. package/dist/capabilities/questions.facade.js +1 -1
  4. package/dist/capabilities/questions.runtime.facade.d.ts +1 -1
  5. package/dist/capabilities/questions.runtime.facade.js +1 -1
  6. package/dist/chat/reporter.persona.js +1 -1
  7. package/dist/enrichment/enrichment.graph.d.ts +1 -3
  8. package/dist/enrichment/enrichment.graph.js +1 -2
  9. package/dist/index.d.ts +2 -2
  10. package/dist/negotiation/application/negotiation.graph.d.ts +5 -5
  11. package/dist/negotiation/domain/negotiation.state.d.ts +1 -1
  12. package/dist/opportunity/application/opportunity.graph.d.ts +23 -23
  13. package/dist/opportunity/domain/opportunity.state.d.ts +6 -6
  14. package/dist/opportunity/ports/opportunity.tools.port.d.ts +1 -1
  15. package/dist/questions/application/index.d.ts +2 -2
  16. package/dist/questions/application/index.js +1 -1
  17. package/dist/questions/application/question.env.d.ts +0 -30
  18. package/dist/questions/application/question.env.js +0 -38
  19. package/dist/questions/application/question.input.d.ts +2 -16
  20. package/dist/questions/application/question.presets.js +0 -66
  21. package/dist/questions/application/question.tools.js +3 -3
  22. package/dist/questions/domain/question.schema.d.ts +84 -68
  23. package/dist/questions/domain/question.schema.js +9 -3
  24. package/dist/questions/ports/index.d.ts +0 -2
  25. package/dist/questions/ports/index.js +0 -1
  26. package/dist/questions/public/index.d.ts +2 -2
  27. package/dist/questions/public/index.js +1 -1
  28. package/dist/runtime/foreground/composition/tool.factory.js +1 -2
  29. package/dist/shared/agent/activity-projection.d.ts +4 -4
  30. package/dist/shared/agent/activity-projection.js +6 -0
  31. package/dist/shared/agent/tool.helpers.d.ts +2 -8
  32. package/dist/shared/schemas/discovery-question.schema.d.ts +10 -28
  33. package/dist/shared/schemas/discovery-question.schema.js +2 -4
  34. package/dist/shared/schemas/negotiation-digest.schema.d.ts +5 -5
  35. package/package.json +1 -1
  36. package/dist/questions/application/question.discovery.prompt.d.ts +0 -8
  37. package/dist/questions/application/question.discovery.prompt.js +0 -181
  38. package/dist/questions/ports/question.generator.port.d.ts +0 -33
  39. package/dist/questions/ports/question.generator.port.js +0 -1
@@ -268,40 +268,40 @@ export declare const NegotiationQuestionCandidateSchema: z.ZodEffects<z.ZodObjec
268
268
  counterpartyFelicityAuthority: z.ZodOptional<z.ZodNumber>;
269
269
  }, "strip", z.ZodTypeAny, {
270
270
  networkId: string;
271
+ opportunityId: string;
271
272
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
272
273
  recipientUserId: string;
273
274
  recipientIntentId: string;
274
- opportunityId: string;
275
275
  taskId?: string | undefined;
276
276
  counterpartyUserId?: string | undefined;
277
277
  counterpartyIntentId?: string | undefined;
278
278
  counterpartyFelicityAuthority?: number | undefined;
279
279
  }, {
280
280
  networkId: string;
281
+ opportunityId: string;
281
282
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
282
283
  recipientUserId: string;
283
284
  recipientIntentId: string;
284
- opportunityId: string;
285
285
  taskId?: string | undefined;
286
286
  counterpartyUserId?: string | undefined;
287
287
  counterpartyIntentId?: string | undefined;
288
288
  counterpartyFelicityAuthority?: number | undefined;
289
289
  }>, {
290
290
  networkId: string;
291
+ opportunityId: string;
291
292
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
292
293
  recipientUserId: string;
293
294
  recipientIntentId: string;
294
- opportunityId: string;
295
295
  taskId?: string | undefined;
296
296
  counterpartyUserId?: string | undefined;
297
297
  counterpartyIntentId?: string | undefined;
298
298
  counterpartyFelicityAuthority?: number | undefined;
299
299
  }, {
300
300
  networkId: string;
301
+ opportunityId: string;
301
302
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
302
303
  recipientUserId: string;
303
304
  recipientIntentId: string;
304
- opportunityId: string;
305
305
  taskId?: string | undefined;
306
306
  counterpartyUserId?: string | undefined;
307
307
  counterpartyIntentId?: string | undefined;
@@ -332,74 +332,74 @@ export declare const NegotiationQuestionProvenanceSchema: z.ZodEffects<z.ZodObje
332
332
  questionOrdinal: z.ZodNumber;
333
333
  }, "strip", z.ZodTypeAny, {
334
334
  networkId: string;
335
+ opportunityId: string;
336
+ opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
337
+ opportunityUpdatedAt: string;
335
338
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
336
339
  recipientUserId: string;
337
340
  recipientIntentId: string;
338
- opportunityId: string;
339
341
  version: 1;
340
342
  intentFingerprint: string;
341
- opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
342
- opportunityUpdatedAt: string;
343
343
  questionOrdinal: number;
344
344
  taskId?: string | undefined;
345
345
  counterpartyUserId?: string | undefined;
346
346
  counterpartyIntentId?: string | undefined;
347
347
  counterpartyFelicityAuthority?: number | undefined;
348
- taskState?: "rejected" | "waiting_for_agent" | "input_required" | "submitted" | "working" | "completed" | "canceled" | "failed" | "auth_required" | "claimed" | undefined;
348
+ taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
349
349
  taskUpdatedAt?: string | undefined;
350
350
  }, {
351
351
  networkId: string;
352
+ opportunityId: string;
353
+ opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
354
+ opportunityUpdatedAt: string;
352
355
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
353
356
  recipientUserId: string;
354
357
  recipientIntentId: string;
355
- opportunityId: string;
356
358
  version: 1;
357
359
  intentFingerprint: string;
358
- opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
359
- opportunityUpdatedAt: string;
360
360
  questionOrdinal: number;
361
361
  taskId?: string | undefined;
362
362
  counterpartyUserId?: string | undefined;
363
363
  counterpartyIntentId?: string | undefined;
364
364
  counterpartyFelicityAuthority?: number | undefined;
365
- taskState?: "rejected" | "waiting_for_agent" | "input_required" | "submitted" | "working" | "completed" | "canceled" | "failed" | "auth_required" | "claimed" | undefined;
365
+ taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
366
366
  taskUpdatedAt?: string | undefined;
367
367
  }>, {
368
368
  networkId: string;
369
+ opportunityId: string;
370
+ opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
371
+ opportunityUpdatedAt: string;
369
372
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
370
373
  recipientUserId: string;
371
374
  recipientIntentId: string;
372
- opportunityId: string;
373
375
  version: 1;
374
376
  intentFingerprint: string;
375
- opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
376
- opportunityUpdatedAt: string;
377
377
  questionOrdinal: number;
378
378
  taskId?: string | undefined;
379
379
  counterpartyUserId?: string | undefined;
380
380
  counterpartyIntentId?: string | undefined;
381
381
  counterpartyFelicityAuthority?: number | undefined;
382
- taskState?: "rejected" | "waiting_for_agent" | "input_required" | "submitted" | "working" | "completed" | "canceled" | "failed" | "auth_required" | "claimed" | undefined;
382
+ taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
383
383
  taskUpdatedAt?: string | undefined;
384
384
  }, {
385
385
  networkId: string;
386
+ opportunityId: string;
387
+ opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
388
+ opportunityUpdatedAt: string;
386
389
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
387
390
  recipientUserId: string;
388
391
  recipientIntentId: string;
389
- opportunityId: string;
390
392
  version: 1;
391
393
  intentFingerprint: string;
392
- opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
393
- opportunityUpdatedAt: string;
394
394
  questionOrdinal: number;
395
395
  taskId?: string | undefined;
396
396
  counterpartyUserId?: string | undefined;
397
397
  counterpartyIntentId?: string | undefined;
398
398
  counterpartyFelicityAuthority?: number | undefined;
399
- taskState?: "rejected" | "waiting_for_agent" | "input_required" | "submitted" | "working" | "completed" | "canceled" | "failed" | "auth_required" | "claimed" | undefined;
399
+ taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
400
400
  taskUpdatedAt?: string | undefined;
401
401
  }>;
402
- export declare const QuestionModeSchema: z.ZodEnum<["discovery", "intent", "enrichment", "negotiation", "negotiation_inflight", "chat", "pool_discovery"]>;
402
+ export declare const QuestionModeSchema: z.ZodEnum<["intent", "negotiation", "negotiation_inflight", "chat", "pool_discovery"]>;
403
403
  /** One server-side candidate→side assignment (never serialized to clients). */
404
404
  export declare const QuestionPoolAssignmentSchema: z.ZodObject<{
405
405
  opportunityId: z.ZodString;
@@ -661,7 +661,15 @@ export declare const QuestionPoolPushSchema: z.ZodObject<{
661
661
  intentId: z.ZodString;
662
662
  cycleKey: z.ZodString;
663
663
  messageId: z.ZodString;
664
- surfaces: z.ZodTuple<[z.ZodLiteral<"personal_agent_badge">, z.ZodLiteral<"negotiator_dm">], null>;
664
+ /**
665
+ * Where a claimed push is delivered. The second slot names the negotiator
666
+ * surface: new claims write `negotiator_intent_chat` (the intent-pinned
667
+ * session). `negotiator_dm` is the legacy literal for rows persisted before
668
+ * the unscoped DM was removed — this schema is validated on read, so the
669
+ * union keeps those rows parsing instead of rejecting them. Read-compat
670
+ * only; nothing writes it.
671
+ */
672
+ surfaces: z.ZodTuple<[z.ZodLiteral<"personal_agent_badge">, z.ZodUnion<[z.ZodLiteral<"negotiator_intent_chat">, z.ZodLiteral<"negotiator_dm">]>], null>;
665
673
  claimedAt: z.ZodString;
666
674
  deliveryStatus: z.ZodEnum<["claimed", "delivered", "suppressed", "failed"]>;
667
675
  conversationId: z.ZodOptional<z.ZodString>;
@@ -675,7 +683,7 @@ export declare const QuestionPoolPushSchema: z.ZodObject<{
675
683
  intentId: string;
676
684
  cycleKey: string;
677
685
  messageId: string;
678
- surfaces: ["personal_agent_badge", "negotiator_dm"];
686
+ surfaces: ["personal_agent_badge", "negotiator_intent_chat" | "negotiator_dm"];
679
687
  claimedAt: string;
680
688
  deliveryStatus: "failed" | "claimed" | "delivered" | "suppressed";
681
689
  conversationId?: string | undefined;
@@ -689,7 +697,7 @@ export declare const QuestionPoolPushSchema: z.ZodObject<{
689
697
  intentId: string;
690
698
  cycleKey: string;
691
699
  messageId: string;
692
- surfaces: ["personal_agent_badge", "negotiator_dm"];
700
+ surfaces: ["personal_agent_badge", "negotiator_intent_chat" | "negotiator_dm"];
693
701
  claimedAt: string;
694
702
  deliveryStatus: "failed" | "claimed" | "delivered" | "suppressed";
695
703
  conversationId?: string | undefined;
@@ -727,7 +735,7 @@ export declare const QuestionVoidedReasonSchema: z.ZodEnum<["pool_drift", "inten
727
735
  export declare const QuestionPoolPushRequestReasonSchema: z.ZodEnum<["question_lifecycle", "intent_lifecycle", "malformed_source", "malformed_actor", "malformed_pool", "malformed_cycle", "visited", "pool_size", "voi", "cycle_budget"]>;
728
736
  export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
729
737
  /** Which preset mode generated this question. */
730
- mode: z.ZodEnum<["discovery", "intent", "enrichment", "negotiation", "negotiation_inflight", "chat", "pool_discovery"]>;
738
+ mode: z.ZodEnum<["intent", "negotiation", "negotiation_inflight", "chat", "pool_discovery"]>;
731
739
  /** Internal reason for generation; independent of mode and QUD repair metadata. */
732
740
  purpose: z.ZodOptional<z.ZodEnum<["uptake", "recovery", "stalled_followup", "inflight_consultation"]>>;
733
741
  /** Exact negotiation recipient/intent/task routing provenance. Internal only. */
@@ -752,71 +760,71 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
752
760
  questionOrdinal: z.ZodNumber;
753
761
  }, "strip", z.ZodTypeAny, {
754
762
  networkId: string;
763
+ opportunityId: string;
764
+ opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
765
+ opportunityUpdatedAt: string;
755
766
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
756
767
  recipientUserId: string;
757
768
  recipientIntentId: string;
758
- opportunityId: string;
759
769
  version: 1;
760
770
  intentFingerprint: string;
761
- opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
762
- opportunityUpdatedAt: string;
763
771
  questionOrdinal: number;
764
772
  taskId?: string | undefined;
765
773
  counterpartyUserId?: string | undefined;
766
774
  counterpartyIntentId?: string | undefined;
767
775
  counterpartyFelicityAuthority?: number | undefined;
768
- taskState?: "rejected" | "waiting_for_agent" | "input_required" | "submitted" | "working" | "completed" | "canceled" | "failed" | "auth_required" | "claimed" | undefined;
776
+ taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
769
777
  taskUpdatedAt?: string | undefined;
770
778
  }, {
771
779
  networkId: string;
780
+ opportunityId: string;
781
+ opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
782
+ opportunityUpdatedAt: string;
772
783
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
773
784
  recipientUserId: string;
774
785
  recipientIntentId: string;
775
- opportunityId: string;
776
786
  version: 1;
777
787
  intentFingerprint: string;
778
- opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
779
- opportunityUpdatedAt: string;
780
788
  questionOrdinal: number;
781
789
  taskId?: string | undefined;
782
790
  counterpartyUserId?: string | undefined;
783
791
  counterpartyIntentId?: string | undefined;
784
792
  counterpartyFelicityAuthority?: number | undefined;
785
- taskState?: "rejected" | "waiting_for_agent" | "input_required" | "submitted" | "working" | "completed" | "canceled" | "failed" | "auth_required" | "claimed" | undefined;
793
+ taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
786
794
  taskUpdatedAt?: string | undefined;
787
795
  }>, {
788
796
  networkId: string;
797
+ opportunityId: string;
798
+ opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
799
+ opportunityUpdatedAt: string;
789
800
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
790
801
  recipientUserId: string;
791
802
  recipientIntentId: string;
792
- opportunityId: string;
793
803
  version: 1;
794
804
  intentFingerprint: string;
795
- opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
796
- opportunityUpdatedAt: string;
797
805
  questionOrdinal: number;
798
806
  taskId?: string | undefined;
799
807
  counterpartyUserId?: string | undefined;
800
808
  counterpartyIntentId?: string | undefined;
801
809
  counterpartyFelicityAuthority?: number | undefined;
802
- taskState?: "rejected" | "waiting_for_agent" | "input_required" | "submitted" | "working" | "completed" | "canceled" | "failed" | "auth_required" | "claimed" | undefined;
810
+ taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
803
811
  taskUpdatedAt?: string | undefined;
804
812
  }, {
805
813
  networkId: string;
814
+ opportunityId: string;
815
+ opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
816
+ opportunityUpdatedAt: string;
806
817
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
807
818
  recipientUserId: string;
808
819
  recipientIntentId: string;
809
- opportunityId: string;
810
820
  version: 1;
811
821
  intentFingerprint: string;
812
- opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
813
- opportunityUpdatedAt: string;
814
822
  questionOrdinal: number;
815
823
  taskId?: string | undefined;
816
824
  counterpartyUserId?: string | undefined;
817
825
  counterpartyIntentId?: string | undefined;
818
826
  counterpartyFelicityAuthority?: number | undefined;
819
- taskState?: "rejected" | "waiting_for_agent" | "input_required" | "submitted" | "working" | "completed" | "canceled" | "failed" | "auth_required" | "claimed" | undefined;
827
+ taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
820
828
  taskUpdatedAt?: string | undefined;
821
829
  }>>;
822
830
  /** Entity type that triggered generation (e.g. "opportunity", "intent", "profile"). */
@@ -1064,7 +1072,15 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1064
1072
  intentId: z.ZodString;
1065
1073
  cycleKey: z.ZodString;
1066
1074
  messageId: z.ZodString;
1067
- surfaces: z.ZodTuple<[z.ZodLiteral<"personal_agent_badge">, z.ZodLiteral<"negotiator_dm">], null>;
1075
+ /**
1076
+ * Where a claimed push is delivered. The second slot names the negotiator
1077
+ * surface: new claims write `negotiator_intent_chat` (the intent-pinned
1078
+ * session). `negotiator_dm` is the legacy literal for rows persisted before
1079
+ * the unscoped DM was removed — this schema is validated on read, so the
1080
+ * union keeps those rows parsing instead of rejecting them. Read-compat
1081
+ * only; nothing writes it.
1082
+ */
1083
+ surfaces: z.ZodTuple<[z.ZodLiteral<"personal_agent_badge">, z.ZodUnion<[z.ZodLiteral<"negotiator_intent_chat">, z.ZodLiteral<"negotiator_dm">]>], null>;
1068
1084
  claimedAt: z.ZodString;
1069
1085
  deliveryStatus: z.ZodEnum<["claimed", "delivered", "suppressed", "failed"]>;
1070
1086
  conversationId: z.ZodOptional<z.ZodString>;
@@ -1078,7 +1094,7 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1078
1094
  intentId: string;
1079
1095
  cycleKey: string;
1080
1096
  messageId: string;
1081
- surfaces: ["personal_agent_badge", "negotiator_dm"];
1097
+ surfaces: ["personal_agent_badge", "negotiator_intent_chat" | "negotiator_dm"];
1082
1098
  claimedAt: string;
1083
1099
  deliveryStatus: "failed" | "claimed" | "delivered" | "suppressed";
1084
1100
  conversationId?: string | undefined;
@@ -1092,7 +1108,7 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1092
1108
  intentId: string;
1093
1109
  cycleKey: string;
1094
1110
  messageId: string;
1095
- surfaces: ["personal_agent_badge", "negotiator_dm"];
1111
+ surfaces: ["personal_agent_badge", "negotiator_intent_chat" | "negotiator_dm"];
1096
1112
  claimedAt: string;
1097
1113
  deliveryStatus: "failed" | "claimed" | "delivered" | "suppressed";
1098
1114
  conversationId?: string | undefined;
@@ -1105,7 +1121,7 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1105
1121
  /** Authoritative successful-delivery ledger timestamp. Internal only. */
1106
1122
  pushedAt: z.ZodOptional<z.ZodString>;
1107
1123
  }, "strip", z.ZodTypeAny, {
1108
- mode: "chat" | "intent" | "enrichment" | "discovery" | "negotiation" | "negotiation_inflight" | "pool_discovery";
1124
+ mode: "chat" | "intent" | "negotiation" | "negotiation_inflight" | "pool_discovery";
1109
1125
  sourceType: string;
1110
1126
  sourceId: string;
1111
1127
  timestamp: string;
@@ -1116,7 +1132,7 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1116
1132
  intentId: string;
1117
1133
  cycleKey: string;
1118
1134
  messageId: string;
1119
- surfaces: ["personal_agent_badge", "negotiator_dm"];
1135
+ surfaces: ["personal_agent_badge", "negotiator_intent_chat" | "negotiator_dm"];
1120
1136
  claimedAt: string;
1121
1137
  deliveryStatus: "failed" | "claimed" | "delivered" | "suppressed";
1122
1138
  conversationId?: string | undefined;
@@ -1136,20 +1152,20 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1136
1152
  purpose?: "uptake" | "stalled_followup" | "inflight_consultation" | "recovery" | undefined;
1137
1153
  negotiation?: {
1138
1154
  networkId: string;
1155
+ opportunityId: string;
1156
+ opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
1157
+ opportunityUpdatedAt: string;
1139
1158
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
1140
1159
  recipientUserId: string;
1141
1160
  recipientIntentId: string;
1142
- opportunityId: string;
1143
1161
  version: 1;
1144
1162
  intentFingerprint: string;
1145
- opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
1146
- opportunityUpdatedAt: string;
1147
1163
  questionOrdinal: number;
1148
1164
  taskId?: string | undefined;
1149
1165
  counterpartyUserId?: string | undefined;
1150
1166
  counterpartyIntentId?: string | undefined;
1151
1167
  counterpartyFelicityAuthority?: number | undefined;
1152
- taskState?: "rejected" | "waiting_for_agent" | "input_required" | "submitted" | "working" | "completed" | "canceled" | "failed" | "auth_required" | "claimed" | undefined;
1168
+ taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
1153
1169
  taskUpdatedAt?: string | undefined;
1154
1170
  } | undefined;
1155
1171
  messageId?: string | undefined;
@@ -1199,7 +1215,7 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1199
1215
  voidedReason?: "pool_drift" | "intent_edit" | "recovery_drift" | "negotiation_stale" | undefined;
1200
1216
  pushedAt?: string | undefined;
1201
1217
  }, {
1202
- mode: "chat" | "intent" | "enrichment" | "discovery" | "negotiation" | "negotiation_inflight" | "pool_discovery";
1218
+ mode: "chat" | "intent" | "negotiation" | "negotiation_inflight" | "pool_discovery";
1203
1219
  sourceType: string;
1204
1220
  sourceId: string;
1205
1221
  timestamp: string;
@@ -1210,7 +1226,7 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1210
1226
  intentId: string;
1211
1227
  cycleKey: string;
1212
1228
  messageId: string;
1213
- surfaces: ["personal_agent_badge", "negotiator_dm"];
1229
+ surfaces: ["personal_agent_badge", "negotiator_intent_chat" | "negotiator_dm"];
1214
1230
  claimedAt: string;
1215
1231
  deliveryStatus: "failed" | "claimed" | "delivered" | "suppressed";
1216
1232
  conversationId?: string | undefined;
@@ -1230,20 +1246,20 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1230
1246
  purpose?: "uptake" | "stalled_followup" | "inflight_consultation" | "recovery" | undefined;
1231
1247
  negotiation?: {
1232
1248
  networkId: string;
1249
+ opportunityId: string;
1250
+ opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
1251
+ opportunityUpdatedAt: string;
1233
1252
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
1234
1253
  recipientUserId: string;
1235
1254
  recipientIntentId: string;
1236
- opportunityId: string;
1237
1255
  version: 1;
1238
1256
  intentFingerprint: string;
1239
- opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
1240
- opportunityUpdatedAt: string;
1241
1257
  questionOrdinal: number;
1242
1258
  taskId?: string | undefined;
1243
1259
  counterpartyUserId?: string | undefined;
1244
1260
  counterpartyIntentId?: string | undefined;
1245
1261
  counterpartyFelicityAuthority?: number | undefined;
1246
- taskState?: "rejected" | "waiting_for_agent" | "input_required" | "submitted" | "working" | "completed" | "canceled" | "failed" | "auth_required" | "claimed" | undefined;
1262
+ taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
1247
1263
  taskUpdatedAt?: string | undefined;
1248
1264
  } | undefined;
1249
1265
  messageId?: string | undefined;
@@ -1293,7 +1309,7 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1293
1309
  voidedReason?: "pool_drift" | "intent_edit" | "recovery_drift" | "negotiation_stale" | undefined;
1294
1310
  pushedAt?: string | undefined;
1295
1311
  }>, {
1296
- mode: "chat" | "intent" | "enrichment" | "discovery" | "negotiation" | "negotiation_inflight" | "pool_discovery";
1312
+ mode: "chat" | "intent" | "negotiation" | "negotiation_inflight" | "pool_discovery";
1297
1313
  sourceType: string;
1298
1314
  sourceId: string;
1299
1315
  timestamp: string;
@@ -1304,7 +1320,7 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1304
1320
  intentId: string;
1305
1321
  cycleKey: string;
1306
1322
  messageId: string;
1307
- surfaces: ["personal_agent_badge", "negotiator_dm"];
1323
+ surfaces: ["personal_agent_badge", "negotiator_intent_chat" | "negotiator_dm"];
1308
1324
  claimedAt: string;
1309
1325
  deliveryStatus: "failed" | "claimed" | "delivered" | "suppressed";
1310
1326
  conversationId?: string | undefined;
@@ -1324,20 +1340,20 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1324
1340
  purpose?: "uptake" | "stalled_followup" | "inflight_consultation" | "recovery" | undefined;
1325
1341
  negotiation?: {
1326
1342
  networkId: string;
1343
+ opportunityId: string;
1344
+ opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
1345
+ opportunityUpdatedAt: string;
1327
1346
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
1328
1347
  recipientUserId: string;
1329
1348
  recipientIntentId: string;
1330
- opportunityId: string;
1331
1349
  version: 1;
1332
1350
  intentFingerprint: string;
1333
- opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
1334
- opportunityUpdatedAt: string;
1335
1351
  questionOrdinal: number;
1336
1352
  taskId?: string | undefined;
1337
1353
  counterpartyUserId?: string | undefined;
1338
1354
  counterpartyIntentId?: string | undefined;
1339
1355
  counterpartyFelicityAuthority?: number | undefined;
1340
- taskState?: "rejected" | "waiting_for_agent" | "input_required" | "submitted" | "working" | "completed" | "canceled" | "failed" | "auth_required" | "claimed" | undefined;
1356
+ taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
1341
1357
  taskUpdatedAt?: string | undefined;
1342
1358
  } | undefined;
1343
1359
  messageId?: string | undefined;
@@ -1387,7 +1403,7 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1387
1403
  voidedReason?: "pool_drift" | "intent_edit" | "recovery_drift" | "negotiation_stale" | undefined;
1388
1404
  pushedAt?: string | undefined;
1389
1405
  }, {
1390
- mode: "chat" | "intent" | "enrichment" | "discovery" | "negotiation" | "negotiation_inflight" | "pool_discovery";
1406
+ mode: "chat" | "intent" | "negotiation" | "negotiation_inflight" | "pool_discovery";
1391
1407
  sourceType: string;
1392
1408
  sourceId: string;
1393
1409
  timestamp: string;
@@ -1398,7 +1414,7 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1398
1414
  intentId: string;
1399
1415
  cycleKey: string;
1400
1416
  messageId: string;
1401
- surfaces: ["personal_agent_badge", "negotiator_dm"];
1417
+ surfaces: ["personal_agent_badge", "negotiator_intent_chat" | "negotiator_dm"];
1402
1418
  claimedAt: string;
1403
1419
  deliveryStatus: "failed" | "claimed" | "delivered" | "suppressed";
1404
1420
  conversationId?: string | undefined;
@@ -1418,20 +1434,20 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1418
1434
  purpose?: "uptake" | "stalled_followup" | "inflight_consultation" | "recovery" | undefined;
1419
1435
  negotiation?: {
1420
1436
  networkId: string;
1437
+ opportunityId: string;
1438
+ opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
1439
+ opportunityUpdatedAt: string;
1421
1440
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
1422
1441
  recipientUserId: string;
1423
1442
  recipientIntentId: string;
1424
- opportunityId: string;
1425
1443
  version: 1;
1426
1444
  intentFingerprint: string;
1427
- opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
1428
- opportunityUpdatedAt: string;
1429
1445
  questionOrdinal: number;
1430
1446
  taskId?: string | undefined;
1431
1447
  counterpartyUserId?: string | undefined;
1432
1448
  counterpartyIntentId?: string | undefined;
1433
1449
  counterpartyFelicityAuthority?: number | undefined;
1434
- taskState?: "rejected" | "waiting_for_agent" | "input_required" | "submitted" | "working" | "completed" | "canceled" | "failed" | "auth_required" | "claimed" | undefined;
1450
+ taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
1435
1451
  taskUpdatedAt?: string | undefined;
1436
1452
  } | undefined;
1437
1453
  messageId?: string | undefined;
@@ -162,9 +162,7 @@ export const NegotiationQuestionProvenanceSchema = z.object({
162
162
  }
163
163
  });
164
164
  export const QuestionModeSchema = z.enum([
165
- "discovery",
166
165
  "intent",
167
- "enrichment",
168
166
  "negotiation",
169
167
  // Negotiator-initiated mid-negotiation client questions (ask_user action, P3).
170
168
  // Distinct from "negotiation", which covers post-stall questions only.
@@ -227,9 +225,17 @@ export const QuestionPoolPushSchema = z.object({
227
225
  intentId: z.string().min(1),
228
226
  cycleKey: z.string().min(1),
229
227
  messageId: z.string().min(1),
228
+ /**
229
+ * Where a claimed push is delivered. The second slot names the negotiator
230
+ * surface: new claims write `negotiator_intent_chat` (the intent-pinned
231
+ * session). `negotiator_dm` is the legacy literal for rows persisted before
232
+ * the unscoped DM was removed — this schema is validated on read, so the
233
+ * union keeps those rows parsing instead of rejecting them. Read-compat
234
+ * only; nothing writes it.
235
+ */
230
236
  surfaces: z.tuple([
231
237
  z.literal("personal_agent_badge"),
232
- z.literal("negotiator_dm"),
238
+ z.union([z.literal("negotiator_intent_chat"), z.literal("negotiator_dm")]),
233
239
  ]),
234
240
  claimedAt: z.string().min(1),
235
241
  deliveryStatus: z.enum(["claimed", "delivered", "suppressed", "failed"]),
@@ -16,7 +16,6 @@
16
16
  * - ChatQuestionAnswerOutcome — resolution shape for awaited answers.
17
17
  *
18
18
  * ### Generator port (deprecated)
19
- * - QuestionGeneratorReader — legacy inline discovery question generator.
20
19
  *
21
20
  * ### Tool host ports
22
21
  * - QuestionerToolDeps — host capabilities for async question delivery tools.
@@ -25,5 +24,4 @@
25
24
  * IND-547: canonical ports surface for the questions capability.
26
25
  */
27
26
  export type { PersistableQuestion, PersistedQuestion, QuestionFilters, ChatQuestionAnswerOutcome, ChatQuestionsHost, QuestionerDatabase, } from "./question.persistence.port.js";
28
- export type { QuestionGeneratorReader } from "./question.generator.port.js";
29
27
  export type { QuestionerToolDeps, AskUserQuestionToolDeps } from "./question.tools.port.js";
@@ -16,7 +16,6 @@
16
16
  * - ChatQuestionAnswerOutcome — resolution shape for awaited answers.
17
17
  *
18
18
  * ### Generator port (deprecated)
19
- * - QuestionGeneratorReader — legacy inline discovery question generator.
20
19
  *
21
20
  * ### Tool host ports
22
21
  * - QuestionerToolDeps — host capabilities for async question delivery tools.
@@ -40,8 +40,8 @@
40
40
  export * from "../domain/index.js";
41
41
  export { QuestionerAgent } from "../application/index.js";
42
42
  export type { QuestionerAgentConfig } from "../application/index.js";
43
- export { isQuestionerEnabled, isDiscoveryQuestionsEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, discoveryQuestionsInputMode, discoveryQuestionsTimeoutMs, DISCOVERY_QUESTIONS_TIMEOUT_MS_DEFAULT, UPTAKE_AUTHORITY_THRESHOLD_DEFAULT, } from "../application/index.js";
43
+ export { isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, UPTAKE_AUTHORITY_THRESHOLD_DEFAULT, } from "../application/index.js";
44
44
  export { isValidQuestionerInputContract, } from "../application/index.js";
45
45
  export type { QuestionerInput, QuestionerEnqueuePayload, QuestionerEnqueueFn, PoolDiscoveryContext, RecoveryQuestionerInput, UptakeQuestionerInput, PostStallQuestionerInput, InflightQuestionerInput, } from "../application/index.js";
46
46
  export { createQuestionerTools, createAskUserQuestionTools } from "../application/index.js";
47
- export type { AskUserQuestionToolDeps, ChatQuestionAnswerOutcome, ChatQuestionsHost, PersistableQuestion, PersistedQuestion, QuestionFilters, QuestionGeneratorReader, QuestionerDatabase, QuestionerToolDeps, } from "../ports/index.js";
47
+ export type { AskUserQuestionToolDeps, ChatQuestionAnswerOutcome, ChatQuestionsHost, PersistableQuestion, PersistedQuestion, QuestionFilters, QuestionerDatabase, QuestionerToolDeps, } from "../ports/index.js";
@@ -42,7 +42,7 @@ export * from "../domain/index.js";
42
42
  // ── Application: agent ────────────────────────────────────────────────────────
43
43
  export { QuestionerAgent } from "../application/index.js";
44
44
  // ── Application: env accessors ────────────────────────────────────────────────
45
- export { isQuestionerEnabled, isDiscoveryQuestionsEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, discoveryQuestionsInputMode, discoveryQuestionsTimeoutMs, DISCOVERY_QUESTIONS_TIMEOUT_MS_DEFAULT, UPTAKE_AUTHORITY_THRESHOLD_DEFAULT, } from "../application/index.js";
45
+ export { isQuestionerEnabled, isUptakeGuardEnabled, uptakeAuthorityThreshold, UPTAKE_AUTHORITY_THRESHOLD_DEFAULT, } from "../application/index.js";
46
46
  // ── Application: input types and validation ───────────────────────────────────
47
47
  export { isValidQuestionerInputContract, } from "../application/index.js";
48
48
  // ── Application: foreground adapter tools ─────────────────────────────────────
@@ -117,7 +117,7 @@ export async function createChatTools(deps, preResolvedContext) {
117
117
  : undefined;
118
118
  const intentGraph = new IntentGraphFactory(database, embedder, deps.intentQueue, sessionAwareEnqueue).createGraph();
119
119
  const premiseGraph = new PremiseGraphFactory(database, embedder).createGraph();
120
- const profileGraph = new EnrichmentGraphFactory(database, scraper, deps.enricher, sessionAwareEnqueue, premiseGraph).createGraph();
120
+ const profileGraph = new EnrichmentGraphFactory(database, scraper, deps.enricher, premiseGraph).createGraph();
121
121
  const hydeCache = deps.hydeCache;
122
122
  const lensInferrer = new LensInferrer();
123
123
  const hydeGenerator = new HydeGenerator();
@@ -169,7 +169,6 @@ export async function createChatTools(deps, preResolvedContext) {
169
169
  frontendUrl: deps.frontendUrl,
170
170
  apiBaseUrl: deps.apiBaseUrl,
171
171
  ...(deps.chatSummary && { chatSummary: deps.chatSummary }),
172
- ...(deps.questionGenerator && { questionGenerator: deps.questionGenerator }),
173
172
  ...(sessionAwareEnqueue && { questionerEnqueue: sessionAwareEnqueue }),
174
173
  ...(deps.findPendingQuestions && { findPendingQuestions: deps.findPendingQuestions }),
175
174
  ...(deps.answerPendingQuestion && { answerPendingQuestion: deps.answerPendingQuestion }),
@@ -136,13 +136,13 @@ export declare const ActivitySummaryResponseSchema: z.ZodObject<{
136
136
  title: z.ZodString;
137
137
  count: z.ZodNumber;
138
138
  }, "strict", z.ZodTypeAny, {
139
+ count: number;
139
140
  title: string;
140
141
  intentId: string;
141
- count: number;
142
142
  }, {
143
+ count: number;
143
144
  title: string;
144
145
  intentId: string;
145
- count: number;
146
146
  }>, "many">>;
147
147
  /** questions domain (meta-network) — counts grouped by affected domain. */
148
148
  pendingQuestionsByDomain: z.ZodOptional<z.ZodObject<{
@@ -199,9 +199,9 @@ export declare const ActivitySummaryResponseSchema: z.ZodObject<{
199
199
  liveSignalsWatched?: number | undefined;
200
200
  opportunitiesSurfaced?: number | undefined;
201
201
  opportunitiesBySignal?: {
202
+ count: number;
202
203
  title: string;
203
204
  intentId: string;
204
- count: number;
205
205
  }[] | undefined;
206
206
  pendingQuestionsByDomain?: {
207
207
  chat?: number | undefined;
@@ -226,9 +226,9 @@ export declare const ActivitySummaryResponseSchema: z.ZodObject<{
226
226
  liveSignalsWatched?: number | undefined;
227
227
  opportunitiesSurfaced?: number | undefined;
228
228
  opportunitiesBySignal?: {
229
+ count: number;
229
230
  title: string;
230
231
  intentId: string;
231
- count: number;
232
232
  }[] | undefined;
233
233
  pendingQuestionsByDomain?: {
234
234
  chat?: number | undefined;
@@ -53,6 +53,12 @@ export const ActivityQuestionDomainSchema = z.enum([
53
53
  * bucket so a future protocol mode can never leak to an agent caller.
54
54
  */
55
55
  export const QUESTION_MODE_TO_DOMAIN = {
56
+ // `enrichment` and `discovery` are retired generators — no new question is
57
+ // ever produced in either mode. Their rows predate the removal and remain
58
+ // answerable, so both keep their original affected-domain mapping: dropping
59
+ // them here would silently fall back to the "chat" domain and change which
60
+ // permission an agent needs to answer a pre-existing row.
61
+ //
56
62
  // Enrichment answers run the PremiseGraph lifecycle (createPremiseFromAnswer →
57
63
  // PremiseEvents.onCreated), so enrichment questions affect the premises domain.
58
64
  enrichment: "premises",