@indexnetwork/protocol 20.0.0-rc.484.1 → 21.0.0-rc.486.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 (56) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/IMPLEMENTATION.md +1 -1
  3. package/dist/agents/index.d.ts +0 -1
  4. package/dist/agents/index.js +0 -1
  5. package/dist/chat/chat.agent.d.ts +0 -6
  6. package/dist/chat/chat.agent.js +0 -94
  7. package/dist/chat/chat.persona.d.ts +1 -2
  8. package/dist/chat/chat.prompt.js +1 -1
  9. package/dist/chat/chat.prompt.modules.d.ts +0 -2
  10. package/dist/index.d.ts +0 -1
  11. package/dist/index.js +0 -1
  12. package/dist/mcp/elicitation.builder.d.ts +1 -1
  13. package/dist/mcp/elicitation.dispatcher.d.ts +1 -1
  14. package/dist/questions/index.d.ts +37 -8
  15. package/dist/questions/index.js +38 -2
  16. package/dist/questions/{application/question.agent.d.ts → question.agent.d.ts} +2 -2
  17. package/dist/questions/{application/question.agent.js → question.agent.js} +6 -9
  18. package/dist/questions/{application/question.ask.tool.d.ts → question.ask.tool.d.ts} +2 -2
  19. package/dist/questions/{application/question.ask.tool.js → question.ask.tool.js} +4 -7
  20. package/dist/questions/{application/question.env.d.ts → question.env.d.ts} +1 -4
  21. package/dist/questions/{application/question.env.js → question.env.js} +1 -4
  22. package/dist/questions/{application/question.input.d.ts → question.input.d.ts} +4 -7
  23. package/dist/questions/{application/question.input.js → question.input.js} +1 -1
  24. package/dist/questions/{ports/question.persistence.port.d.ts → question.persistence.port.d.ts} +2 -4
  25. package/dist/questions/{application/question.presets.d.ts → question.presets.d.ts} +2 -5
  26. package/dist/questions/{application/question.presets.js → question.presets.js} +12 -2
  27. package/dist/questions/{domain/question.schema.d.ts → question.schema.d.ts} +43 -47
  28. package/dist/questions/{domain/question.schema.js → question.schema.js} +32 -32
  29. package/dist/questions/{application/question.tools.d.ts → question.tools.d.ts} +2 -2
  30. package/dist/questions/{application/question.tools.js → question.tools.js} +4 -7
  31. package/dist/questions/{ports/question.tools.port.d.ts → question.tools.port.d.ts} +2 -4
  32. package/dist/shared/agent/tool.factory.js +0 -1
  33. package/dist/shared/agent/tool.helpers.d.ts +3 -11
  34. package/dist/shared/agent/tool.helpers.js +1 -2
  35. package/dist/shared/schemas/pending-question.schema.d.ts +1 -1
  36. package/dist/shared/schemas/underspecification.schema.d.ts +1 -1
  37. package/dist/shared/schemas/underspecification.schema.js +1 -1
  38. package/package.json +1 -1
  39. package/dist/chat/reporter.action.contracts.d.ts +0 -36
  40. package/dist/chat/reporter.action.contracts.js +0 -1
  41. package/dist/chat/reporter.action.tools.d.ts +0 -17
  42. package/dist/chat/reporter.action.tools.js +0 -145
  43. package/dist/chat/reporter.persona.d.ts +0 -31
  44. package/dist/chat/reporter.persona.js +0 -207
  45. package/dist/chat/reporter.prompt.d.ts +0 -24
  46. package/dist/chat/reporter.prompt.js +0 -149
  47. package/dist/questions/application/index.d.ts +0 -39
  48. package/dist/questions/application/index.js +0 -41
  49. package/dist/questions/application/question.qud.d.ts +0 -12
  50. package/dist/questions/application/question.qud.js +0 -16
  51. package/dist/questions/domain/index.d.ts +0 -24
  52. package/dist/questions/domain/index.js +0 -24
  53. package/dist/questions/ports/index.d.ts +0 -27
  54. package/dist/questions/ports/index.js +0 -26
  55. /package/dist/questions/{ports/question.persistence.port.js → question.persistence.port.js} +0 -0
  56. /package/dist/questions/{ports/question.tools.port.js → question.tools.port.js} +0 -0
@@ -1,14 +1,12 @@
1
1
  /**
2
- * questions/domain/question.schema — canonical home for question value types and schemas.
2
+ * questions/question.schema — canonical home for question value types and schemas.
3
3
  *
4
4
  * Defines the public structured shape consumed by frontend renderers and MCP
5
5
  * elicitation dispatch, plus internal generator, persistence, and delivery
6
6
  * envelopes used across the questions capability.
7
- *
8
- * IND-547: canonical question schema in the questions domain layer.
9
7
  */
10
8
  import { z } from "zod";
11
- import { UnderspecificationTypeSchema, type UnderspecificationType } from "../../shared/schemas/underspecification.schema.js";
9
+ import { UnderspecificationTypeSchema, type UnderspecificationType } from "../shared/schemas/underspecification.schema.js";
12
10
  export { UnderspecificationTypeSchema };
13
11
  export declare const QuestionOptionSchema: z.ZodObject<{
14
12
  /** Display text. Suffix " (Recommended)" on the safest path; list it first. */
@@ -256,24 +254,24 @@ export declare const QuestionPurposeSchema: z.ZodEnum<["uptake", "recovery", "st
256
254
  * authoritative rows before generation; callers cannot mint provenance.
257
255
  */
258
256
  export declare const NegotiationQuestionCandidateSchema: z.ZodEffects<z.ZodObject<{
259
- purpose: z.ZodEnum<["uptake", "stalled_followup", "inflight_consultation"]>;
260
- recipientUserId: z.ZodString;
261
- recipientIntentId: z.ZodString;
262
- opportunityId: z.ZodString;
263
- taskId: z.ZodOptional<z.ZodString>;
264
- networkId: z.ZodString;
257
+ readonly purpose: z.ZodEnum<["uptake", "stalled_followup", "inflight_consultation"]>;
258
+ readonly recipientUserId: z.ZodString;
259
+ readonly recipientIntentId: z.ZodString;
260
+ readonly opportunityId: z.ZodString;
261
+ readonly taskId: z.ZodOptional<z.ZodString>;
262
+ readonly networkId: z.ZodString;
265
263
  /** Uptake only: exact low-authority counterparty eligibility binding. */
266
- counterpartyUserId: z.ZodOptional<z.ZodString>;
267
- counterpartyIntentId: z.ZodOptional<z.ZodString>;
268
- counterpartyFelicityAuthority: z.ZodOptional<z.ZodNumber>;
264
+ readonly counterpartyUserId: z.ZodOptional<z.ZodString>;
265
+ readonly counterpartyIntentId: z.ZodOptional<z.ZodString>;
266
+ readonly counterpartyFelicityAuthority: z.ZodOptional<z.ZodNumber>;
269
267
  }, "strip", z.ZodTypeAny, {
270
268
  networkId: string;
271
269
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
272
270
  recipientUserId: string;
273
271
  recipientIntentId: string;
274
272
  opportunityId: string;
275
- taskId?: string | undefined;
276
273
  counterpartyUserId?: string | undefined;
274
+ taskId?: string | undefined;
277
275
  counterpartyIntentId?: string | undefined;
278
276
  counterpartyFelicityAuthority?: number | undefined;
279
277
  }, {
@@ -282,8 +280,8 @@ export declare const NegotiationQuestionCandidateSchema: z.ZodEffects<z.ZodObjec
282
280
  recipientUserId: string;
283
281
  recipientIntentId: string;
284
282
  opportunityId: string;
285
- taskId?: string | undefined;
286
283
  counterpartyUserId?: string | undefined;
284
+ taskId?: string | undefined;
287
285
  counterpartyIntentId?: string | undefined;
288
286
  counterpartyFelicityAuthority?: number | undefined;
289
287
  }>, {
@@ -292,8 +290,8 @@ export declare const NegotiationQuestionCandidateSchema: z.ZodEffects<z.ZodObjec
292
290
  recipientUserId: string;
293
291
  recipientIntentId: string;
294
292
  opportunityId: string;
295
- taskId?: string | undefined;
296
293
  counterpartyUserId?: string | undefined;
294
+ taskId?: string | undefined;
297
295
  counterpartyIntentId?: string | undefined;
298
296
  counterpartyFelicityAuthority?: number | undefined;
299
297
  }, {
@@ -302,8 +300,8 @@ export declare const NegotiationQuestionCandidateSchema: z.ZodEffects<z.ZodObjec
302
300
  recipientUserId: string;
303
301
  recipientIntentId: string;
304
302
  opportunityId: string;
305
- taskId?: string | undefined;
306
303
  counterpartyUserId?: string | undefined;
304
+ taskId?: string | undefined;
307
305
  counterpartyIntentId?: string | undefined;
308
306
  counterpartyFelicityAuthority?: number | undefined;
309
307
  }>;
@@ -312,24 +310,23 @@ export declare const NegotiationQuestionCandidateSchema: z.ZodEffects<z.ZodObjec
312
310
  * questions. This object is stripped from every REST/MCP projection.
313
311
  */
314
312
  export declare const NegotiationQuestionProvenanceSchema: z.ZodEffects<z.ZodObject<{
315
- version: z.ZodLiteral<1>;
313
+ intentFingerprint: z.ZodString;
314
+ opportunityStatus: z.ZodEnum<["latent", "draft", "negotiating", "pending", "stalled", "accepted", "rejected", "expired"]>;
315
+ opportunityUpdatedAt: z.ZodString;
316
+ taskState: z.ZodOptional<z.ZodEnum<["submitted", "working", "input_required", "completed", "canceled", "failed", "rejected", "auth_required", "waiting_for_agent", "claimed"]>>;
317
+ taskUpdatedAt: z.ZodOptional<z.ZodString>;
318
+ /** Stable per-generation position so retries dedupe without reducing cardinality. */
319
+ questionOrdinal: z.ZodNumber;
316
320
  purpose: z.ZodEnum<["uptake", "stalled_followup", "inflight_consultation"]>;
317
321
  recipientUserId: z.ZodString;
318
322
  recipientIntentId: z.ZodString;
319
323
  opportunityId: z.ZodString;
320
324
  taskId: z.ZodOptional<z.ZodString>;
321
325
  networkId: z.ZodString;
322
- intentFingerprint: z.ZodString;
323
- opportunityStatus: z.ZodEnum<["latent", "draft", "negotiating", "pending", "stalled", "accepted", "rejected", "expired"]>;
324
- opportunityUpdatedAt: z.ZodString;
325
- taskState: z.ZodOptional<z.ZodEnum<["submitted", "working", "input_required", "completed", "canceled", "failed", "rejected", "auth_required", "waiting_for_agent", "claimed"]>>;
326
- taskUpdatedAt: z.ZodOptional<z.ZodString>;
327
- /** Uptake only: exact low-authority counterparty eligibility binding. */
328
326
  counterpartyUserId: z.ZodOptional<z.ZodString>;
329
327
  counterpartyIntentId: z.ZodOptional<z.ZodString>;
330
328
  counterpartyFelicityAuthority: z.ZodOptional<z.ZodNumber>;
331
- /** Stable per-generation position so retries dedupe without reducing cardinality. */
332
- questionOrdinal: z.ZodNumber;
329
+ version: z.ZodLiteral<1>;
333
330
  }, "strip", z.ZodTypeAny, {
334
331
  networkId: string;
335
332
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
@@ -341,8 +338,8 @@ export declare const NegotiationQuestionProvenanceSchema: z.ZodEffects<z.ZodObje
341
338
  opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
342
339
  opportunityUpdatedAt: string;
343
340
  questionOrdinal: number;
344
- taskId?: string | undefined;
345
341
  counterpartyUserId?: string | undefined;
342
+ taskId?: string | undefined;
346
343
  counterpartyIntentId?: string | undefined;
347
344
  counterpartyFelicityAuthority?: number | undefined;
348
345
  taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
@@ -358,8 +355,8 @@ export declare const NegotiationQuestionProvenanceSchema: z.ZodEffects<z.ZodObje
358
355
  opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
359
356
  opportunityUpdatedAt: string;
360
357
  questionOrdinal: number;
361
- taskId?: string | undefined;
362
358
  counterpartyUserId?: string | undefined;
359
+ taskId?: string | undefined;
363
360
  counterpartyIntentId?: string | undefined;
364
361
  counterpartyFelicityAuthority?: number | undefined;
365
362
  taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
@@ -375,8 +372,8 @@ export declare const NegotiationQuestionProvenanceSchema: z.ZodEffects<z.ZodObje
375
372
  opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
376
373
  opportunityUpdatedAt: string;
377
374
  questionOrdinal: number;
378
- taskId?: string | undefined;
379
375
  counterpartyUserId?: string | undefined;
376
+ taskId?: string | undefined;
380
377
  counterpartyIntentId?: string | undefined;
381
378
  counterpartyFelicityAuthority?: number | undefined;
382
379
  taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
@@ -392,8 +389,8 @@ export declare const NegotiationQuestionProvenanceSchema: z.ZodEffects<z.ZodObje
392
389
  opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
393
390
  opportunityUpdatedAt: string;
394
391
  questionOrdinal: number;
395
- taskId?: string | undefined;
396
392
  counterpartyUserId?: string | undefined;
393
+ taskId?: string | undefined;
397
394
  counterpartyIntentId?: string | undefined;
398
395
  counterpartyFelicityAuthority?: number | undefined;
399
396
  taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
@@ -740,24 +737,23 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
740
737
  purpose: z.ZodOptional<z.ZodEnum<["uptake", "recovery", "stalled_followup", "inflight_consultation"]>>;
741
738
  /** Exact negotiation recipient/intent/task routing provenance. Internal only. */
742
739
  negotiation: z.ZodOptional<z.ZodEffects<z.ZodObject<{
743
- version: z.ZodLiteral<1>;
740
+ intentFingerprint: z.ZodString;
741
+ opportunityStatus: z.ZodEnum<["latent", "draft", "negotiating", "pending", "stalled", "accepted", "rejected", "expired"]>;
742
+ opportunityUpdatedAt: z.ZodString;
743
+ taskState: z.ZodOptional<z.ZodEnum<["submitted", "working", "input_required", "completed", "canceled", "failed", "rejected", "auth_required", "waiting_for_agent", "claimed"]>>;
744
+ taskUpdatedAt: z.ZodOptional<z.ZodString>;
745
+ /** Stable per-generation position so retries dedupe without reducing cardinality. */
746
+ questionOrdinal: z.ZodNumber;
744
747
  purpose: z.ZodEnum<["uptake", "stalled_followup", "inflight_consultation"]>;
745
748
  recipientUserId: z.ZodString;
746
749
  recipientIntentId: z.ZodString;
747
750
  opportunityId: z.ZodString;
748
751
  taskId: z.ZodOptional<z.ZodString>;
749
752
  networkId: z.ZodString;
750
- intentFingerprint: z.ZodString;
751
- opportunityStatus: z.ZodEnum<["latent", "draft", "negotiating", "pending", "stalled", "accepted", "rejected", "expired"]>;
752
- opportunityUpdatedAt: z.ZodString;
753
- taskState: z.ZodOptional<z.ZodEnum<["submitted", "working", "input_required", "completed", "canceled", "failed", "rejected", "auth_required", "waiting_for_agent", "claimed"]>>;
754
- taskUpdatedAt: z.ZodOptional<z.ZodString>;
755
- /** Uptake only: exact low-authority counterparty eligibility binding. */
756
753
  counterpartyUserId: z.ZodOptional<z.ZodString>;
757
754
  counterpartyIntentId: z.ZodOptional<z.ZodString>;
758
755
  counterpartyFelicityAuthority: z.ZodOptional<z.ZodNumber>;
759
- /** Stable per-generation position so retries dedupe without reducing cardinality. */
760
- questionOrdinal: z.ZodNumber;
756
+ version: z.ZodLiteral<1>;
761
757
  }, "strip", z.ZodTypeAny, {
762
758
  networkId: string;
763
759
  purpose: "uptake" | "stalled_followup" | "inflight_consultation";
@@ -769,8 +765,8 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
769
765
  opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
770
766
  opportunityUpdatedAt: string;
771
767
  questionOrdinal: number;
772
- taskId?: string | undefined;
773
768
  counterpartyUserId?: string | undefined;
769
+ taskId?: string | undefined;
774
770
  counterpartyIntentId?: string | undefined;
775
771
  counterpartyFelicityAuthority?: number | undefined;
776
772
  taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
@@ -786,8 +782,8 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
786
782
  opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
787
783
  opportunityUpdatedAt: string;
788
784
  questionOrdinal: number;
789
- taskId?: string | undefined;
790
785
  counterpartyUserId?: string | undefined;
786
+ taskId?: string | undefined;
791
787
  counterpartyIntentId?: string | undefined;
792
788
  counterpartyFelicityAuthority?: number | undefined;
793
789
  taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
@@ -803,8 +799,8 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
803
799
  opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
804
800
  opportunityUpdatedAt: string;
805
801
  questionOrdinal: number;
806
- taskId?: string | undefined;
807
802
  counterpartyUserId?: string | undefined;
803
+ taskId?: string | undefined;
808
804
  counterpartyIntentId?: string | undefined;
809
805
  counterpartyFelicityAuthority?: number | undefined;
810
806
  taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
@@ -820,8 +816,8 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
820
816
  opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
821
817
  opportunityUpdatedAt: string;
822
818
  questionOrdinal: number;
823
- taskId?: string | undefined;
824
819
  counterpartyUserId?: string | undefined;
820
+ taskId?: string | undefined;
825
821
  counterpartyIntentId?: string | undefined;
826
822
  counterpartyFelicityAuthority?: number | undefined;
827
823
  taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
@@ -1161,8 +1157,8 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1161
1157
  opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
1162
1158
  opportunityUpdatedAt: string;
1163
1159
  questionOrdinal: number;
1164
- taskId?: string | undefined;
1165
1160
  counterpartyUserId?: string | undefined;
1161
+ taskId?: string | undefined;
1166
1162
  counterpartyIntentId?: string | undefined;
1167
1163
  counterpartyFelicityAuthority?: number | undefined;
1168
1164
  taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
@@ -1255,8 +1251,8 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1255
1251
  opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
1256
1252
  opportunityUpdatedAt: string;
1257
1253
  questionOrdinal: number;
1258
- taskId?: string | undefined;
1259
1254
  counterpartyUserId?: string | undefined;
1255
+ taskId?: string | undefined;
1260
1256
  counterpartyIntentId?: string | undefined;
1261
1257
  counterpartyFelicityAuthority?: number | undefined;
1262
1258
  taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
@@ -1349,8 +1345,8 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1349
1345
  opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
1350
1346
  opportunityUpdatedAt: string;
1351
1347
  questionOrdinal: number;
1352
- taskId?: string | undefined;
1353
1348
  counterpartyUserId?: string | undefined;
1349
+ taskId?: string | undefined;
1354
1350
  counterpartyIntentId?: string | undefined;
1355
1351
  counterpartyFelicityAuthority?: number | undefined;
1356
1352
  taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
@@ -1443,8 +1439,8 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
1443
1439
  opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
1444
1440
  opportunityUpdatedAt: string;
1445
1441
  questionOrdinal: number;
1446
- taskId?: string | undefined;
1447
1442
  counterpartyUserId?: string | undefined;
1443
+ taskId?: string | undefined;
1448
1444
  counterpartyIntentId?: string | undefined;
1449
1445
  counterpartyFelicityAuthority?: number | undefined;
1450
1446
  taskState?: "rejected" | "waiting_for_agent" | "input_required" | "completed" | "failed" | "submitted" | "working" | "canceled" | "auth_required" | "claimed" | undefined;
@@ -1,14 +1,12 @@
1
1
  /**
2
- * questions/domain/question.schema — canonical home for question value types and schemas.
2
+ * questions/question.schema — canonical home for question value types and schemas.
3
3
  *
4
4
  * Defines the public structured shape consumed by frontend renderers and MCP
5
5
  * elicitation dispatch, plus internal generator, persistence, and delivery
6
6
  * envelopes used across the questions capability.
7
- *
8
- * IND-547: canonical question schema in the questions domain layer.
9
7
  */
10
8
  import { z } from "zod";
11
- import { UnderspecificationTypeSchema } from "../../shared/schemas/underspecification.schema.js";
9
+ import { UnderspecificationTypeSchema } from "../shared/schemas/underspecification.schema.js";
12
10
  export { UnderspecificationTypeSchema };
13
11
  export const QuestionOptionSchema = z.object({
14
12
  /** Display text. Suffix " (Recommended)" on the safest path; list it first. */
@@ -71,10 +69,11 @@ export const QuestionPurposeSchema = z.enum([
71
69
  "inflight_consultation",
72
70
  ]);
73
71
  /**
74
- * Producer-supplied candidate binding. The API re-resolves every field from
75
- * authoritative rows before generation; callers cannot mint provenance.
72
+ * Routing fields every negotiation-family binding carries. The provenance
73
+ * envelope extends this with freshness and ordinal fields; the candidate is
74
+ * exactly this shape.
76
75
  */
77
- export const NegotiationQuestionCandidateSchema = z.object({
76
+ const negotiationQuestionBinding = {
78
77
  purpose: NegotiationQuestionPurposeSchema,
79
78
  recipientUserId: z.string().min(1),
80
79
  recipientIntentId: z.string().min(1),
@@ -85,7 +84,29 @@ export const NegotiationQuestionCandidateSchema = z.object({
85
84
  counterpartyUserId: z.string().min(1).optional(),
86
85
  counterpartyIntentId: z.string().min(1).optional(),
87
86
  counterpartyFelicityAuthority: z.number().min(0).max(100).optional(),
88
- }).superRefine((candidate, ctx) => {
87
+ };
88
+ /**
89
+ * Counterparty eligibility is carried by uptake bindings and ONLY by uptake
90
+ * bindings — exactly present on uptake, entirely absent otherwise. Identical on
91
+ * the candidate and the provenance envelope, so both delegate here.
92
+ */
93
+ function refineCounterpartyEligibility(binding, ctx) {
94
+ const path = ["counterpartyUserId"];
95
+ if (binding.purpose === "uptake") {
96
+ if (!binding.counterpartyUserId || !binding.counterpartyIntentId || binding.counterpartyFelicityAuthority === undefined) {
97
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path, message: "uptake bindings require exact counterparty eligibility" });
98
+ }
99
+ return;
100
+ }
101
+ if (binding.counterpartyUserId || binding.counterpartyIntentId || binding.counterpartyFelicityAuthority !== undefined) {
102
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path, message: "only uptake bindings carry counterparty eligibility" });
103
+ }
104
+ }
105
+ /**
106
+ * Producer-supplied candidate binding. The API re-resolves every field from
107
+ * authoritative rows before generation; callers cannot mint provenance.
108
+ */
109
+ export const NegotiationQuestionCandidateSchema = z.object(negotiationQuestionBinding).superRefine((candidate, ctx) => {
89
110
  const taskRequired = candidate.purpose !== "uptake";
90
111
  if (taskRequired !== Boolean(candidate.taskId)) {
91
112
  ctx.addIssue({
@@ -96,13 +117,7 @@ export const NegotiationQuestionCandidateSchema = z.object({
96
117
  : "uptake questions must not carry a synthetic taskId",
97
118
  });
98
119
  }
99
- const hasCounterparty = Boolean(candidate.counterpartyUserId) || Boolean(candidate.counterpartyIntentId);
100
- if (candidate.purpose === "uptake" && (!candidate.counterpartyUserId || !candidate.counterpartyIntentId || candidate.counterpartyFelicityAuthority === undefined)) {
101
- ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["counterpartyUserId"], message: "uptake questions require exact counterparty provenance" });
102
- }
103
- if (candidate.purpose !== "uptake" && (hasCounterparty || candidate.counterpartyFelicityAuthority !== undefined)) {
104
- ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["counterpartyUserId"], message: "only uptake questions carry counterparty provenance" });
105
- }
120
+ refineCounterpartyEligibility(candidate, ctx);
106
121
  });
107
122
  /**
108
123
  * Durable server-only routing and freshness envelope for negotiation-family
@@ -110,21 +125,12 @@ export const NegotiationQuestionCandidateSchema = z.object({
110
125
  */
111
126
  export const NegotiationQuestionProvenanceSchema = z.object({
112
127
  version: z.literal(1),
113
- purpose: NegotiationQuestionPurposeSchema,
114
- recipientUserId: z.string().min(1),
115
- recipientIntentId: z.string().min(1),
116
- opportunityId: z.string().min(1),
117
- taskId: z.string().min(1).optional(),
118
- networkId: z.string().min(1),
128
+ ...negotiationQuestionBinding,
119
129
  intentFingerprint: z.string().min(1),
120
130
  opportunityStatus: z.enum(["latent", "draft", "negotiating", "pending", "stalled", "accepted", "rejected", "expired"]),
121
131
  opportunityUpdatedAt: z.string().datetime(),
122
132
  taskState: z.enum(["submitted", "working", "input_required", "completed", "canceled", "failed", "rejected", "auth_required", "waiting_for_agent", "claimed"]).optional(),
123
133
  taskUpdatedAt: z.string().datetime().optional(),
124
- /** Uptake only: exact low-authority counterparty eligibility binding. */
125
- counterpartyUserId: z.string().min(1).optional(),
126
- counterpartyIntentId: z.string().min(1).optional(),
127
- counterpartyFelicityAuthority: z.number().min(0).max(100).optional(),
128
134
  /** Stable per-generation position so retries dedupe without reducing cardinality. */
129
135
  questionOrdinal: z.number().int().min(0).max(2),
130
136
  }).superRefine((provenance, ctx) => {
@@ -149,13 +155,7 @@ export const NegotiationQuestionProvenanceSchema = z.object({
149
155
  if (provenance.purpose === "inflight_consultation" && provenance.taskState !== "input_required") {
150
156
  ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["taskState"], message: "inflight task must be input_required" });
151
157
  }
152
- const hasCounterparty = Boolean(provenance.counterpartyUserId) || Boolean(provenance.counterpartyIntentId);
153
- if (provenance.purpose === "uptake" && (!provenance.counterpartyUserId || !provenance.counterpartyIntentId || provenance.counterpartyFelicityAuthority === undefined)) {
154
- ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["counterpartyUserId"], message: "uptake provenance requires exact counterparty eligibility" });
155
- }
156
- if (provenance.purpose !== "uptake" && (hasCounterparty || provenance.counterpartyFelicityAuthority !== undefined)) {
157
- ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["counterpartyUserId"], message: "only uptake provenance carries counterparty eligibility" });
158
- }
158
+ refineCounterpartyEligibility(provenance, ctx);
159
159
  });
160
160
  export const QuestionModeSchema = z.enum([
161
161
  "intent",
@@ -1,5 +1,5 @@
1
- import type { DefineTool } from "../../shared/agent/tool.helpers.js";
2
- import type { QuestionerToolDeps } from "../ports/question.tools.port.js";
1
+ import type { DefineTool } from "../shared/agent/tool.helpers.js";
2
+ import type { QuestionerToolDeps } from "./question.tools.port.js";
3
3
  /**
4
4
  * Creates MCP tool definitions for the questioner domain.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * questions/application/question.tools — foreground adapter: MCP question tools.
2
+ * questions/question.tools — foreground adapter: MCP question tools.
3
3
  *
4
4
  * Creates MCP tool definitions for the questions domain. Exposes
5
5
  * `read_pending_questions` and `answer_pending_question` for retrieving and
@@ -9,14 +9,11 @@
9
9
  * Foreground adapter: these tools respond to authenticated user actions
10
10
  * (read, answer, dismiss). Ambient delivery adapters are handled separately
11
11
  * via the QuestionerQueue.
12
- *
13
- * IND-547: canonical home — previously questioner/questioner.tools.ts.
14
- * Legacy path is a thin compatibility shim pointing here.
15
12
  */
16
13
  import { z } from "zod";
17
- import { error, success } from "../../shared/agent/tool.helpers.js";
18
- import { focusedIntentId, focusedNetworkId, focusedNetworkLabel } from "../../shared/agent/tool.scope.js";
19
- import { callerMayAccessQuestionMode } from "../../shared/agent/activity-projection.js";
14
+ import { error, success } from "../shared/agent/tool.helpers.js";
15
+ import { focusedIntentId, focusedNetworkId, focusedNetworkLabel } from "../shared/agent/tool.scope.js";
16
+ import { callerMayAccessQuestionMode } from "../shared/agent/activity-projection.js";
20
17
  /**
21
18
  * Detection modes whose questions derive solely from the caller's own data
22
19
  * (profile gaps, own intents, own discovery sessions). Negotiation-mode
@@ -1,13 +1,11 @@
1
1
  /**
2
- * questions/ports/question.tools.port — host capabilities injected into question tools.
2
+ * questions/question.tools.port — host capabilities injected into question tools.
3
3
  *
4
4
  * Declares the narrow port types consumed by the foreground adapter tools
5
5
  * (question delivery and chat-inline ask_user_question) without importing
6
6
  * the full ToolRegistryCompositionDeps interface.
7
- *
8
- * IND-547: canonical tool-host port.
9
7
  */
10
- import type { ToolRegistryCompositionDeps } from "../../shared/agent/tool.helpers.js";
8
+ import type { ToolRegistryCompositionDeps } from "../shared/agent/tool.helpers.js";
11
9
  /** Host capabilities consumed by asynchronous question delivery tools. */
12
10
  export type QuestionerToolDeps = Pick<ToolRegistryCompositionDeps, "answerPendingQuestion" | "findPendingQuestions" | "reportToolError">;
13
11
  /** Host capabilities consumed by the blocking, chat-only question tool. */
@@ -50,7 +50,6 @@ export async function createChatTools(deps, preResolvedContext) {
50
50
  userId: deps.userId,
51
51
  networkId: explicitScope.scopeType === 'network' ? explicitScope.scopeId : deps.networkId,
52
52
  sessionId: deps.sessionId,
53
- actionToolsEnabled: deps.actionToolsEnabled,
54
53
  }));
55
54
  if (!preResolvedContext && explicitScope.scopeType && explicitScope.scopeId) {
56
55
  resolvedContext.scopeType = explicitScope.scopeType;
@@ -20,11 +20,11 @@ import type { AgentDatabase } from "../../agents/ports/index.js";
20
20
  import type { NegotiationTimeoutQueue } from "../interfaces/negotiation-events.interface.js";
21
21
  import type { AgentDispatcher } from "../interfaces/agent-dispatcher.interface.js";
22
22
  import type { DeliveryLedger } from "../interfaces/delivery-ledger.interface.js";
23
- import type { ChatQuestionsHost, QuestionerDatabase } from "../../questions/ports/index.js";
23
+ import type { ChatQuestionsHost, QuestionerDatabase } from "../../questions/question.persistence.port.js";
24
24
  import type { NegotiatorMemoryToolsHost } from "../interfaces/negotiator-memory.interface.js";
25
- import type { QuestionerEnqueueFn } from "../../questions/application/question.input.js";
25
+ import type { QuestionerEnqueueFn } from "../../questions/question.input.js";
26
26
  import type { PendingQuestionSummary } from "../schemas/pending-question.schema.js";
27
- import type { QuestionMode, QuestionPurpose } from "../../questions/domain/question.schema.js";
27
+ import type { QuestionMode, QuestionPurpose } from "../../questions/question.schema.js";
28
28
  import type { EnrichmentRunQueue, EnrichmentRunStore } from "../interfaces/enrichment-run.interface.js";
29
29
  import type { McpActivityCaller } from "./activity-projection.js";
30
30
  export type IdentityContext = UserIdentity | null;
@@ -98,8 +98,6 @@ export interface ResolvedToolContext {
98
98
  * which are owner-trusted and receive the full owner view.
99
99
  */
100
100
  mcpCaller?: McpActivityCaller;
101
- /** True only when the gated reporter cleanup-action proposal tool is registered. */
102
- actionToolsEnabled?: boolean;
103
101
  }
104
102
  /**
105
103
  * Dependencies passed when creating tools for a user session.
@@ -137,8 +135,6 @@ interface ToolContextBindings {
137
135
  intentQueue: IntentGraphQueue;
138
136
  /** Contact management operations. */
139
137
  contactService: ContactServiceAdapter;
140
- /** True only when the gated reporter cleanup-action proposal tool is registered. */
141
- actionToolsEnabled?: boolean;
142
138
  /** Chat session reader for loading conversation history. */
143
139
  chatSession: ChatSessionReader;
144
140
  /** Read-through chat-session digest. Optional; consumers fall back to undefined `chatContext`. */
@@ -184,8 +180,6 @@ interface ToolContextBindings {
184
180
  * the backend composition root; when absent the tool is not registered.
185
181
  */
186
182
  chatQuestions?: ChatQuestionsHost;
187
- /** Optional durable persistence for reporter cleanup-action proposals. */
188
- actionProposalStore?: import('../../chat/reporter.action.contracts.js').AgentActionProposalStore;
189
183
  /** Durable host persistence for verified intent proposals shown in chat. */
190
184
  intentProposalStore?: import('../../intents/intent.proposal.js').IntentProposalStore;
191
185
  /**
@@ -292,8 +286,6 @@ export declare function resolveChatContext(params: {
292
286
  networkId?: string;
293
287
  /** Chat session ID for draft opportunities (stored as context.conversationId). */
294
288
  sessionId?: string;
295
- /** Reporter action gate forwarded into the persona prompt/context. */
296
- actionToolsEnabled?: boolean;
297
289
  }): Promise<ResolvedToolContext>;
298
290
  /**
299
291
  * Type for the `defineTool` closure created in `createChatTools`.
@@ -16,7 +16,7 @@ export class ChatContextAccessError extends Error {
16
16
  * This preloads user identity, profile, network memberships, and scoped index role.
17
17
  */
18
18
  export async function resolveChatContext(params) {
19
- const { database, userId, networkId, sessionId, actionToolsEnabled } = params;
19
+ const { database, userId, networkId, sessionId } = params;
20
20
  const [user, rawProfile, userNetworks, globalContext] = await Promise.all([
21
21
  database.getUser(userId),
22
22
  database.getProfile(userId),
@@ -93,7 +93,6 @@ export async function resolveChatContext(params) {
93
93
  scopedMembershipRole,
94
94
  isOnboarding: !(user.onboarding?.completedAt),
95
95
  hasName,
96
- actionToolsEnabled,
97
96
  ...(sessionId !== undefined ? { sessionId } : {}),
98
97
  };
99
98
  }
@@ -3,7 +3,7 @@
3
3
  * in tool results. Omits internal fields (actors, answer, status) that
4
4
  * are not needed by the chat agent or MCP client.
5
5
  */
6
- import type { QuestionMode, QuestionPurpose } from "../../questions/domain/question.schema.js";
6
+ import type { QuestionMode, QuestionPurpose } from "../../questions/question.schema.js";
7
7
  export interface PendingQuestionSummary {
8
8
  id: string;
9
9
  title: string;
@@ -5,7 +5,7 @@ import { z } from "zod";
5
5
  * Shared between signals (the intent clarifier decides whether an utterance is
6
6
  * underspecified) and questions (which records the category on the question it
7
7
  * raises). It lives here rather than inside either capability because both need
8
- * it: filing it under `questions/domain` meant the signals clarifier had to
8
+ * it: filing it under `questions/` meant the signals clarifier had to
9
9
  * import the whole questions capability — LLM agents and tools included — to
10
10
  * reach a three-value enum.
11
11
  */
@@ -5,7 +5,7 @@ import { z } from "zod";
5
5
  * Shared between signals (the intent clarifier decides whether an utterance is
6
6
  * underspecified) and questions (which records the category on the question it
7
7
  * raises). It lives here rather than inside either capability because both need
8
- * it: filing it under `questions/domain` meant the signals clarifier had to
8
+ * it: filing it under `questions/` meant the signals clarifier had to
9
9
  * import the whole questions capability — LLM agents and tools included — to
10
10
  * reach a three-value enum.
11
11
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/protocol",
3
- "version": "20.0.0-rc.484.1",
3
+ "version": "21.0.0-rc.486.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,36 +0,0 @@
1
- export type AgentCleanupActionType = "retract_premise" | "narrow_signal" | "pause_signal";
2
- export interface AgentActionProposalSnapshot {
3
- status: string;
4
- updatedAt?: string;
5
- payload?: string;
6
- summary?: string | null;
7
- assertionText?: string;
8
- }
9
- interface AgentActionProposalActionBase {
10
- entityId: string;
11
- currentState: string;
12
- proposedOperation: string;
13
- evidence?: string;
14
- skipped?: boolean;
15
- reason?: string;
16
- snapshot?: AgentActionProposalSnapshot;
17
- description?: string;
18
- }
19
- export type AgentActionProposalAction = (AgentActionProposalActionBase & {
20
- type: "retract_premise";
21
- }) | (AgentActionProposalActionBase & {
22
- type: "narrow_signal";
23
- }) | (AgentActionProposalActionBase & {
24
- type: "pause_signal";
25
- });
26
- export interface AgentActionProposal {
27
- proposalId: string;
28
- userId: string;
29
- conversationId?: string;
30
- actions: AgentActionProposalAction[];
31
- }
32
- /** Host persistence bridge for proposals; the reporter tool never mutates domain rows. */
33
- export interface AgentActionProposalStore {
34
- createProposal(proposal: AgentActionProposal): Promise<void>;
35
- }
36
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,17 +0,0 @@
1
- import type { ChatGraphCompositeDatabase, UserDatabase } from "../shared/interfaces/database.interface.js";
2
- import type { ChatTools, ResolvedToolContext, ToolContext } from "../shared/agent/tool.factory.js";
3
- import type { AgentActionProposalStore } from "./reporter.action.contracts.js";
4
- export type { AgentActionProposal, AgentActionProposalAction, AgentActionProposalSnapshot, AgentActionProposalStore, AgentCleanupActionType, } from "./reporter.action.contracts.js";
5
- export declare const AGENT_ACTION_PROPOSAL_FENCE = "agent_action_proposal";
6
- /**
7
- * Creates the reporter-only proposal tool. It validates owner state and records
8
- * snapshots, but intentionally has no mutation dependency.
9
- */
10
- export declare function createProposeCleanupActionsTool(input: {
11
- database: ChatGraphCompositeDatabase;
12
- userDb: UserDatabase;
13
- context: ResolvedToolContext;
14
- store: AgentActionProposalStore;
15
- }): ChatTools[number];
16
- /** Build the optional action tool from the host-provided ToolContext. */
17
- export declare function createReporterActionTool(deps: ToolContext, context: ResolvedToolContext, userDb: UserDatabase): ChatTools[number] | null;