@indexnetwork/protocol 6.12.0-rc.403.1 → 6.12.1-rc.404.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 CHANGED
@@ -13,6 +13,7 @@ See [STABILITY.md](./STABILITY.md) for the public-contract and tier definitions.
13
13
  ## [Unreleased]
14
14
 
15
15
  ### Fixed
16
+ - Make the Questioner clarifying-questions schema survive strict structured-output conversion: the `Question.evidence` provenance field is now declared `.nullable().optional()` (was bare `.optional()`, which OpenAI/OpenRouter strict mode rejects), so every `QuestionerAgent` LLM call no longer failed client-side before any network I/O. A `.transform()` normalizes an LLM-returned `null` back to `undefined` so a null is never persisted or treated as "evidence present"; real string evidence chips (pool_discovery) flow through unchanged and the intent-recovery `!question.evidence` selection filter is unaffected (regression from the IND-418 pool_discovery work).
16
17
  - Allow the private intent-refinement provenance snapshot to identify intent creation as a producer and make the shared refinement prompt independent of no-opportunity process state, enabling creation and authoritative discovery producers to converge on one ordinary intent-page question cadence.
17
18
 
18
19
  ### Added
@@ -45,8 +45,18 @@ export declare const QuestionSchema: z.ZodObject<{
45
45
  * Optional provenance line rendered as a muted chip above the prompt
46
46
  * (e.g. "based on 18 people matching this intent"). Aggregate counts only —
47
47
  * never individual identities (pool_discovery k-anonymity invariant).
48
+ *
49
+ * Declared `.nullable().optional()` (not bare `.optional()`) so the schema
50
+ * survives OpenAI/OpenRouter strict structured-output conversion, which
51
+ * rejects optional-without-nullable fields (see createStructuredModel in the
52
+ * questioner agent). The `.transform()` normalizes an LLM-returned `null`
53
+ * back to `undefined` so a null is NEVER persisted or treated as
54
+ * "evidence present": real string evidence flows through unchanged, while
55
+ * both `null` and omitted read as absent everywhere downstream
56
+ * (e.g. the intent-recovery `!question.evidence` selection filter and the
57
+ * pool_discovery provenance chip).
48
58
  */
49
- evidence: z.ZodOptional<z.ZodString>;
59
+ evidence: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>;
50
60
  }, "strip", z.ZodTypeAny, {
51
61
  prompt: string;
52
62
  options: {
@@ -64,7 +74,7 @@ export declare const QuestionSchema: z.ZodObject<{
64
74
  }[];
65
75
  title: string;
66
76
  multiSelect: boolean;
67
- evidence?: string | undefined;
77
+ evidence?: string | null | undefined;
68
78
  }>;
69
79
  /** Canonical QUD repair categories for underspecified intents/questions. */
70
80
  export declare const UnderspecificationTypeSchema: z.ZodEnum<["missing_constituent", "missing_constraint", "open_alternative_set"]>;
@@ -93,8 +103,18 @@ export declare const QuestionWithStrategySchema: z.ZodObject<{
93
103
  * Optional provenance line rendered as a muted chip above the prompt
94
104
  * (e.g. "based on 18 people matching this intent"). Aggregate counts only —
95
105
  * never individual identities (pool_discovery k-anonymity invariant).
106
+ *
107
+ * Declared `.nullable().optional()` (not bare `.optional()`) so the schema
108
+ * survives OpenAI/OpenRouter strict structured-output conversion, which
109
+ * rejects optional-without-nullable fields (see createStructuredModel in the
110
+ * questioner agent). The `.transform()` normalizes an LLM-returned `null`
111
+ * back to `undefined` so a null is NEVER persisted or treated as
112
+ * "evidence present": real string evidence flows through unchanged, while
113
+ * both `null` and omitted read as absent everywhere downstream
114
+ * (e.g. the intent-recovery `!question.evidence` selection filter and the
115
+ * pool_discovery provenance chip).
96
116
  */
97
- evidence: z.ZodOptional<z.ZodString>;
117
+ evidence: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>;
98
118
  } & {
99
119
  strategy: z.ZodEnum<["refine_intent", "surface_missing_detail", "open_adjacent_thread", "reflective_summary", "surface_emergent_knowledge"]>;
100
120
  /** QUD repair category, or null when the question is not an underspecification repair. */
@@ -120,7 +140,7 @@ export declare const QuestionWithStrategySchema: z.ZodObject<{
120
140
  multiSelect: boolean;
121
141
  strategy: "refine_intent" | "surface_missing_detail" | "open_adjacent_thread" | "reflective_summary" | "surface_emergent_knowledge";
122
142
  underspecificationType: "missing_constituent" | "missing_constraint" | "open_alternative_set" | null;
123
- evidence?: string | undefined;
143
+ evidence?: string | null | undefined;
124
144
  }>;
125
145
  export declare const QuestionGeneratorResponseSchema: z.ZodObject<{
126
146
  questions: z.ZodArray<z.ZodObject<{
@@ -147,8 +167,18 @@ export declare const QuestionGeneratorResponseSchema: z.ZodObject<{
147
167
  * Optional provenance line rendered as a muted chip above the prompt
148
168
  * (e.g. "based on 18 people matching this intent"). Aggregate counts only —
149
169
  * never individual identities (pool_discovery k-anonymity invariant).
170
+ *
171
+ * Declared `.nullable().optional()` (not bare `.optional()`) so the schema
172
+ * survives OpenAI/OpenRouter strict structured-output conversion, which
173
+ * rejects optional-without-nullable fields (see createStructuredModel in the
174
+ * questioner agent). The `.transform()` normalizes an LLM-returned `null`
175
+ * back to `undefined` so a null is NEVER persisted or treated as
176
+ * "evidence present": real string evidence flows through unchanged, while
177
+ * both `null` and omitted read as absent everywhere downstream
178
+ * (e.g. the intent-recovery `!question.evidence` selection filter and the
179
+ * pool_discovery provenance chip).
150
180
  */
151
- evidence: z.ZodOptional<z.ZodString>;
181
+ evidence: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>;
152
182
  } & {
153
183
  strategy: z.ZodEnum<["refine_intent", "surface_missing_detail", "open_adjacent_thread", "reflective_summary", "surface_emergent_knowledge"]>;
154
184
  /** QUD repair category, or null when the question is not an underspecification repair. */
@@ -174,7 +204,7 @@ export declare const QuestionGeneratorResponseSchema: z.ZodObject<{
174
204
  multiSelect: boolean;
175
205
  strategy: "refine_intent" | "surface_missing_detail" | "open_adjacent_thread" | "reflective_summary" | "surface_emergent_knowledge";
176
206
  underspecificationType: "missing_constituent" | "missing_constraint" | "open_alternative_set" | null;
177
- evidence?: string | undefined;
207
+ evidence?: string | null | undefined;
178
208
  }>, "many">;
179
209
  }, "strip", z.ZodTypeAny, {
180
210
  questions: {
@@ -200,7 +230,7 @@ export declare const QuestionGeneratorResponseSchema: z.ZodObject<{
200
230
  multiSelect: boolean;
201
231
  strategy: "refine_intent" | "surface_missing_detail" | "open_adjacent_thread" | "reflective_summary" | "surface_emergent_knowledge";
202
232
  underspecificationType: "missing_constituent" | "missing_constraint" | "open_alternative_set" | null;
203
- evidence?: string | undefined;
233
+ evidence?: string | null | undefined;
204
234
  }[];
205
235
  }>;
206
236
  export type QuestionOption = z.infer<typeof QuestionOptionSchema>;
@@ -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;;YAX7E,+EAA+E;;YAE/E,iFAAiF;;;;;;;;;QAWjF,0EAA0E;;QAE1E;;;;WAIG;;;;QAqBH,0FAA0F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM1F,CAAC;AAEH,MAAM,MAAM,c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OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC;AAChG,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC"}
@@ -28,8 +28,18 @@ export const QuestionSchema = z.object({
28
28
  * Optional provenance line rendered as a muted chip above the prompt
29
29
  * (e.g. "based on 18 people matching this intent"). Aggregate counts only —
30
30
  * never individual identities (pool_discovery k-anonymity invariant).
31
+ *
32
+ * Declared `.nullable().optional()` (not bare `.optional()`) so the schema
33
+ * survives OpenAI/OpenRouter strict structured-output conversion, which
34
+ * rejects optional-without-nullable fields (see createStructuredModel in the
35
+ * questioner agent). The `.transform()` normalizes an LLM-returned `null`
36
+ * back to `undefined` so a null is NEVER persisted or treated as
37
+ * "evidence present": real string evidence flows through unchanged, while
38
+ * both `null` and omitted read as absent everywhere downstream
39
+ * (e.g. the intent-recovery `!question.evidence` selection filter and the
40
+ * pool_discovery provenance chip).
31
41
  */
32
- evidence: z.string().min(1).max(160).optional(),
42
+ evidence: z.string().min(1).max(160).nullable().optional().transform((value) => value ?? undefined),
33
43
  });
34
44
  /** Canonical QUD repair categories for underspecified intents/questions. */
35
45
  export const UnderspecificationTypeSchema = z.enum([
@@ -1 +1 @@
1
- {"version":3,"file":"question.schema.js","sourceRoot":"/","sources":["shared/schemas/question.schema.ts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IAAI,CAAC,SAAS,CAAC,uBAAuB,EAAE,CAAC;YACvC,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;gBAC3B,IAAI,EAAE,CAAC,yBAAyB,CAAC;gBACjC,OAAO,EAAE,8CAA8C;aACxD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,qCAAqC;IACrC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,gCAAgC;IAChC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,iEAAiE;IACjE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,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\n/** Internal reason a question was generated, orthogonal to mode and QUD metadata. */\nexport const NegotiationQuestionPurposeSchema = z.enum([\n \"uptake\",\n \"stalled_followup\",\n \"inflight_consultation\",\n]);\nexport const QuestionPurposeSchema = z.enum([\n \"uptake\",\n \"recovery\",\n \"stalled_followup\",\n \"inflight_consultation\",\n]);\n\n/**\n * Producer-supplied candidate binding. The API re-resolves every field from\n * authoritative rows before generation; callers cannot mint provenance.\n */\nexport const NegotiationQuestionCandidateSchema = z.object({\n purpose: NegotiationQuestionPurposeSchema,\n recipientUserId: z.string().min(1),\n recipientIntentId: z.string().min(1),\n opportunityId: z.string().min(1),\n taskId: z.string().min(1).optional(),\n networkId: z.string().min(1),\n /** Uptake only: exact low-authority counterparty eligibility binding. */\n counterpartyUserId: z.string().min(1).optional(),\n counterpartyIntentId: z.string().min(1).optional(),\n counterpartyFelicityAuthority: z.number().min(0).max(100).optional(),\n}).superRefine((candidate, ctx) => {\n const taskRequired = candidate.purpose !== \"uptake\";\n if (taskRequired !== Boolean(candidate.taskId)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"taskId\"],\n message: taskRequired\n ? \"task-backed negotiation questions require taskId\"\n : \"uptake questions must not carry a synthetic taskId\",\n });\n }\n const hasCounterparty = Boolean(candidate.counterpartyUserId) || Boolean(candidate.counterpartyIntentId);\n if (candidate.purpose === \"uptake\" && (!candidate.counterpartyUserId || !candidate.counterpartyIntentId || candidate.counterpartyFelicityAuthority === undefined)) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"counterpartyUserId\"], message: \"uptake questions require exact counterparty provenance\" });\n }\n if (candidate.purpose !== \"uptake\" && (hasCounterparty || candidate.counterpartyFelicityAuthority !== undefined)) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"counterpartyUserId\"], message: \"only uptake questions carry counterparty provenance\" });\n }\n});\n\n/**\n * Durable server-only routing and freshness envelope for negotiation-family\n * questions. This object is stripped from every REST/MCP projection.\n */\nexport const NegotiationQuestionProvenanceSchema = z.object({\n version: z.literal(1),\n purpose: NegotiationQuestionPurposeSchema,\n recipientUserId: z.string().min(1),\n recipientIntentId: z.string().min(1),\n opportunityId: z.string().min(1),\n taskId: z.string().min(1).optional(),\n networkId: z.string().min(1),\n intentFingerprint: z.string().min(1),\n opportunityStatus: z.enum([\"latent\", \"draft\", \"negotiating\", \"pending\", \"stalled\", \"accepted\", \"rejected\", \"expired\"]),\n opportunityUpdatedAt: z.string().datetime(),\n taskState: z.enum([\"submitted\", \"working\", \"input_required\", \"completed\", \"canceled\", \"failed\", \"rejected\", \"auth_required\", \"waiting_for_agent\", \"claimed\"]).optional(),\n taskUpdatedAt: z.string().datetime().optional(),\n /** Uptake only: exact low-authority counterparty eligibility binding. */\n counterpartyUserId: z.string().min(1).optional(),\n counterpartyIntentId: z.string().min(1).optional(),\n counterpartyFelicityAuthority: z.number().min(0).max(100).optional(),\n /** Stable per-generation position so retries dedupe without reducing cardinality. */\n questionOrdinal: z.number().int().min(0).max(2),\n}).superRefine((provenance, ctx) => {\n const taskRequired = provenance.purpose !== \"uptake\";\n if (taskRequired && (!provenance.taskId || !provenance.taskState || !provenance.taskUpdatedAt)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"taskId\"],\n message: \"task-backed provenance requires task id, state, and updatedAt\",\n });\n }\n if (!taskRequired && (provenance.taskId || provenance.taskState || provenance.taskUpdatedAt)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"taskId\"],\n message: \"uptake provenance must not carry task fields\",\n });\n }\n if (provenance.purpose === \"stalled_followup\" && provenance.taskState !== \"completed\") {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"taskState\"], message: \"follow-up task must be completed\" });\n }\n if (provenance.purpose === \"inflight_consultation\" && provenance.taskState !== \"input_required\") {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"taskState\"], message: \"inflight task must be input_required\" });\n }\n const hasCounterparty = Boolean(provenance.counterpartyUserId) || Boolean(provenance.counterpartyIntentId);\n if (provenance.purpose === \"uptake\" && (!provenance.counterpartyUserId || !provenance.counterpartyIntentId || provenance.counterpartyFelicityAuthority === undefined)) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"counterpartyUserId\"], message: \"uptake provenance requires exact counterparty eligibility\" });\n }\n if (provenance.purpose !== \"uptake\" && (hasCounterparty || provenance.counterpartyFelicityAuthority !== undefined)) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"counterpartyUserId\"], message: \"only uptake provenance carries counterparty eligibility\" });\n }\n});\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 /** Exact bounded candidate pool. Optional for legacy rows/jobs created before IND-422. */\n opportunityIds: z.array(z.string().uuid()).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\n/** Internal delivery ledger for proactive pool-question pushes (IND-421). */\nexport const QuestionPoolPushSchema = z.object({\n version: z.literal(1),\n source: z.literal(\"pool_discovery\"),\n recipientId: z.string().min(1),\n intentId: z.string().min(1),\n cycleKey: z.string().min(1),\n messageId: z.string().min(1),\n surfaces: z.tuple([\n z.literal(\"personal_agent_badge\"),\n z.literal(\"negotiator_dm\"),\n ]),\n claimedAt: z.string().min(1),\n deliveryStatus: z.enum([\"claimed\", \"delivered\", \"suppressed\", \"failed\"]),\n conversationId: z.string().min(1).optional(),\n deliveredAt: z.string().min(1).optional(),\n suppressedAt: z.string().min(1).optional(),\n failure: z.string().min(1).max(500).optional(),\n});\n\n/** Durable request state for proactive pool-question delivery. */\nexport const QuestionPoolPushRequestStatusSchema = z.enum([\"requested\", \"suppressed\"]);\n\n/** Private snapshot for a post-discovery recovery refinement question. */\nexport const QuestionRecoverySnapshotSchema = z.object({\n version: z.literal(1),\n intentFingerprint: z.string().regex(/^[a-f0-9]{64}$/),\n completionSource: z.enum([\"intent_creation\", \"from_intent\", \"discovery_run\"]),\n /** Privacy-safe aggregate only; raw negotiation evidence is never persisted. */\n rejectedNegotiationCount: z.number().int().min(1).max(50).optional(),\n /** Bounded internal correlation id for an asynchronous discovery run. */\n runId: z.string().min(1).max(128).optional(),\n});\n\n/** Internal reason a pending question was voided. */\nexport const QuestionVoidedReasonSchema = z.enum([\n \"pool_drift\",\n \"intent_edit\",\n \"recovery_drift\",\n \"negotiation_stale\",\n]);\n\n/** Permanent reasons that terminalize an unclaimed proactive push request. */\nexport const QuestionPoolPushRequestReasonSchema = z.enum([\n \"question_lifecycle\",\n \"intent_lifecycle\",\n \"malformed_source\",\n \"malformed_actor\",\n \"malformed_pool\",\n \"malformed_cycle\",\n \"visited\",\n \"pool_size\",\n \"voi\",\n \"cycle_budget\",\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 /** Exact negotiation recipient/intent/task routing provenance. Internal only. */\n negotiation: NegotiationQuestionProvenanceSchema.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 /** Durable server-only conversation session binding used to validate messageId. */\n sessionId: 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 /** Post-discovery intent recovery snapshot. Internal only. */\n recovery: QuestionRecoverySnapshotSchema.optional(),\n /** Durable request marker written before enqueueing proactive delivery. Internal only. */\n pushRequestedAt: z.string().min(1).optional(),\n /** Last bounded recovery sweep that selected this request. Internal only. */\n pushRecoveryAttemptedAt: z.string().min(1).optional(),\n /** Durable request outcome. Internal only. */\n pushRequestStatus: QuestionPoolPushRequestStatusSchema.optional(),\n /** Permanent suppression reason for an unclaimed request. Internal only. */\n pushRequestReason: QuestionPoolPushRequestReasonSchema.optional(),\n /** ISO-8601 timestamp at which an unclaimed request was suppressed. Internal only. */\n pushRequestSuppressedAt: z.string().min(1).optional(),\n /** Internal proactive delivery state. Never serialize to public clients. */\n push: QuestionPoolPushSchema.optional(),\n /** Internal reason this question was voided after pool or intent drift. */\n voidedReason: QuestionVoidedReasonSchema.optional(),\n /** Authoritative successful-delivery ledger timestamp. Internal only. */\n pushedAt: z.string().min(1).optional(),\n}).superRefine((detection, ctx) => {\n const negotiationFamily = detection.mode === \"negotiation\" || detection.mode === \"negotiation_inflight\";\n if (negotiationFamily !== Boolean(detection.negotiation)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"negotiation\"],\n message: negotiationFamily\n ? \"negotiation-family detection requires exact provenance\"\n : \"non-negotiation detection must not carry negotiation provenance\",\n });\n }\n if (detection.negotiation) {\n if (detection.sourceType !== \"opportunity\" || detection.sourceId !== detection.negotiation.opportunityId) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"sourceId\"], message: \"negotiation sourceId must equal opportunityId\" });\n }\n if (detection.purpose !== detection.negotiation.purpose) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"purpose\"], message: \"detection purpose must match negotiation provenance\" });\n }\n if (detection.mode === \"negotiation_inflight\" && detection.negotiation.purpose !== \"inflight_consultation\") {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"negotiation\", \"purpose\"], message: \"inflight mode requires inflight purpose\" });\n }\n if (detection.mode === \"negotiation\" && detection.negotiation.purpose === \"inflight_consultation\") {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"negotiation\", \"purpose\"], message: \"ordinary negotiation mode cannot carry inflight purpose\" });\n }\n }\n if (\n detection.mode === \"pool_discovery\"\n && (!detection.triggeredBy?.trim() || detection.triggeredBy !== detection.sourceId)\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"triggeredBy\"],\n message: \"pool_discovery triggeredBy must be non-empty and equal sourceId\",\n });\n }\n if (detection.purpose === \"recovery\") {\n if (\n detection.mode !== \"intent\"\n || detection.sourceType !== \"intent\"\n || !detection.triggeredBy?.trim()\n || detection.triggeredBy !== detection.sourceId\n || !detection.recovery\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"recovery\"],\n message: \"recovery purpose requires intent mode/source, equal trigger provenance, and a recovery snapshot\",\n });\n }\n } else if (detection.recovery) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"purpose\"],\n message: \"recovery snapshot requires recovery purpose\",\n });\n }\n if (detection.pushRequestStatus && !detection.pushRequestedAt) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"pushRequestedAt\"],\n message: \"push request state requires a request timestamp\",\n });\n }\n if (detection.pushRecoveryAttemptedAt && !detection.pushRequestedAt) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"pushRequestedAt\"],\n message: \"push recovery attempts require a request timestamp\",\n });\n }\n if (detection.pushRequestStatus === \"suppressed\") {\n if (!detection.pushRequestReason) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"pushRequestReason\"],\n message: \"suppressed push requests require a reason\",\n });\n }\n if (!detection.pushRequestSuppressedAt) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"pushRequestSuppressedAt\"],\n message: \"suppressed push requests require a timestamp\",\n });\n }\n }\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 NegotiationQuestionPurpose = z.infer<typeof NegotiationQuestionPurposeSchema>;\nexport type NegotiationQuestionCandidate = z.infer<typeof NegotiationQuestionCandidateSchema>;\nexport type NegotiationQuestionProvenance = z.infer<typeof NegotiationQuestionProvenanceSchema>;\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>;\nexport type QuestionRecoverySnapshot = z.infer<typeof QuestionRecoverySnapshotSchema>;\nexport type QuestionPoolPush = z.infer<typeof QuestionPoolPushSchema>;\nexport type QuestionVoidedReason = z.infer<typeof QuestionVoidedReasonSchema>;\nexport type QuestionPoolPushRequestStatus = z.infer<typeof QuestionPoolPushRequestStatusSchema>;\nexport type QuestionPoolPushRequestReason = z.infer<typeof QuestionPoolPushRequestReasonSchema>;\n"]}
1
+ {"version":3,"file":"question.schema.js","sourceRoot":"/","sources":["shared/schemas/question.schema.ts"],"names":[],"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AAI,EAAE,CAAC,mBAAmB,CAAC;gBAC3B,OAAO,EAAE,2CAA2C;aACrD,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,uBAAuB,EAAE,CAAC;YACvC,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;gBAC3B,IAAI,EAAE,CAAC,yBAAyB,CAAC;gBACjC,OAAO,EAAE,8CAA8C;aACxD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,qCAAqC;IACrC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,gCAAgC;IAChC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,iEAAiE;IACjE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,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 * Declared `.nullable().optional()` (not bare `.optional()`) so the schema\n * survives OpenAI/OpenRouter strict structured-output conversion, which\n * rejects optional-without-nullable fields (see createStructuredModel in the\n * questioner agent). The `.transform()` normalizes an LLM-returned `null`\n * back to `undefined` so a null is NEVER persisted or treated as\n * \"evidence present\": real string evidence flows through unchanged, while\n * both `null` and omitted read as absent everywhere downstream\n * (e.g. the intent-recovery `!question.evidence` selection filter and the\n * pool_discovery provenance chip).\n */\n evidence: z.string().min(1).max(160).nullable().optional().transform((value) => value ?? undefined),\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 NegotiationQuestionPurposeSchema = z.enum([\n \"uptake\",\n \"stalled_followup\",\n \"inflight_consultation\",\n]);\nexport const QuestionPurposeSchema = z.enum([\n \"uptake\",\n \"recovery\",\n \"stalled_followup\",\n \"inflight_consultation\",\n]);\n\n/**\n * Producer-supplied candidate binding. The API re-resolves every field from\n * authoritative rows before generation; callers cannot mint provenance.\n */\nexport const NegotiationQuestionCandidateSchema = z.object({\n purpose: NegotiationQuestionPurposeSchema,\n recipientUserId: z.string().min(1),\n recipientIntentId: z.string().min(1),\n opportunityId: z.string().min(1),\n taskId: z.string().min(1).optional(),\n networkId: z.string().min(1),\n /** Uptake only: exact low-authority counterparty eligibility binding. */\n counterpartyUserId: z.string().min(1).optional(),\n counterpartyIntentId: z.string().min(1).optional(),\n counterpartyFelicityAuthority: z.number().min(0).max(100).optional(),\n}).superRefine((candidate, ctx) => {\n const taskRequired = candidate.purpose !== \"uptake\";\n if (taskRequired !== Boolean(candidate.taskId)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"taskId\"],\n message: taskRequired\n ? \"task-backed negotiation questions require taskId\"\n : \"uptake questions must not carry a synthetic taskId\",\n });\n }\n const hasCounterparty = Boolean(candidate.counterpartyUserId) || Boolean(candidate.counterpartyIntentId);\n if (candidate.purpose === \"uptake\" && (!candidate.counterpartyUserId || !candidate.counterpartyIntentId || candidate.counterpartyFelicityAuthority === undefined)) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"counterpartyUserId\"], message: \"uptake questions require exact counterparty provenance\" });\n }\n if (candidate.purpose !== \"uptake\" && (hasCounterparty || candidate.counterpartyFelicityAuthority !== undefined)) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"counterpartyUserId\"], message: \"only uptake questions carry counterparty provenance\" });\n }\n});\n\n/**\n * Durable server-only routing and freshness envelope for negotiation-family\n * questions. This object is stripped from every REST/MCP projection.\n */\nexport const NegotiationQuestionProvenanceSchema = z.object({\n version: z.literal(1),\n purpose: NegotiationQuestionPurposeSchema,\n recipientUserId: z.string().min(1),\n recipientIntentId: z.string().min(1),\n opportunityId: z.string().min(1),\n taskId: z.string().min(1).optional(),\n networkId: z.string().min(1),\n intentFingerprint: z.string().min(1),\n opportunityStatus: z.enum([\"latent\", \"draft\", \"negotiating\", \"pending\", \"stalled\", \"accepted\", \"rejected\", \"expired\"]),\n opportunityUpdatedAt: z.string().datetime(),\n taskState: z.enum([\"submitted\", \"working\", \"input_required\", \"completed\", \"canceled\", \"failed\", \"rejected\", \"auth_required\", \"waiting_for_agent\", \"claimed\"]).optional(),\n taskUpdatedAt: z.string().datetime().optional(),\n /** Uptake only: exact low-authority counterparty eligibility binding. */\n counterpartyUserId: z.string().min(1).optional(),\n counterpartyIntentId: z.string().min(1).optional(),\n counterpartyFelicityAuthority: z.number().min(0).max(100).optional(),\n /** Stable per-generation position so retries dedupe without reducing cardinality. */\n questionOrdinal: z.number().int().min(0).max(2),\n}).superRefine((provenance, ctx) => {\n const taskRequired = provenance.purpose !== \"uptake\";\n if (taskRequired && (!provenance.taskId || !provenance.taskState || !provenance.taskUpdatedAt)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"taskId\"],\n message: \"task-backed provenance requires task id, state, and updatedAt\",\n });\n }\n if (!taskRequired && (provenance.taskId || provenance.taskState || provenance.taskUpdatedAt)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"taskId\"],\n message: \"uptake provenance must not carry task fields\",\n });\n }\n if (provenance.purpose === \"stalled_followup\" && provenance.taskState !== \"completed\") {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"taskState\"], message: \"follow-up task must be completed\" });\n }\n if (provenance.purpose === \"inflight_consultation\" && provenance.taskState !== \"input_required\") {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"taskState\"], message: \"inflight task must be input_required\" });\n }\n const hasCounterparty = Boolean(provenance.counterpartyUserId) || Boolean(provenance.counterpartyIntentId);\n if (provenance.purpose === \"uptake\" && (!provenance.counterpartyUserId || !provenance.counterpartyIntentId || provenance.counterpartyFelicityAuthority === undefined)) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"counterpartyUserId\"], message: \"uptake provenance requires exact counterparty eligibility\" });\n }\n if (provenance.purpose !== \"uptake\" && (hasCounterparty || provenance.counterpartyFelicityAuthority !== undefined)) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"counterpartyUserId\"], message: \"only uptake provenance carries counterparty eligibility\" });\n }\n});\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 /** Exact bounded candidate pool. Optional for legacy rows/jobs created before IND-422. */\n opportunityIds: z.array(z.string().uuid()).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\n/** Internal delivery ledger for proactive pool-question pushes (IND-421). */\nexport const QuestionPoolPushSchema = z.object({\n version: z.literal(1),\n source: z.literal(\"pool_discovery\"),\n recipientId: z.string().min(1),\n intentId: z.string().min(1),\n cycleKey: z.string().min(1),\n messageId: z.string().min(1),\n surfaces: z.tuple([\n z.literal(\"personal_agent_badge\"),\n z.literal(\"negotiator_dm\"),\n ]),\n claimedAt: z.string().min(1),\n deliveryStatus: z.enum([\"claimed\", \"delivered\", \"suppressed\", \"failed\"]),\n conversationId: z.string().min(1).optional(),\n deliveredAt: z.string().min(1).optional(),\n suppressedAt: z.string().min(1).optional(),\n failure: z.string().min(1).max(500).optional(),\n});\n\n/** Durable request state for proactive pool-question delivery. */\nexport const QuestionPoolPushRequestStatusSchema = z.enum([\"requested\", \"suppressed\"]);\n\n/** Private snapshot for a post-discovery recovery refinement question. */\nexport const QuestionRecoverySnapshotSchema = z.object({\n version: z.literal(1),\n intentFingerprint: z.string().regex(/^[a-f0-9]{64}$/),\n completionSource: z.enum([\"intent_creation\", \"from_intent\", \"discovery_run\"]),\n /** Privacy-safe aggregate only; raw negotiation evidence is never persisted. */\n rejectedNegotiationCount: z.number().int().min(1).max(50).optional(),\n /** Bounded internal correlation id for an asynchronous discovery run. */\n runId: z.string().min(1).max(128).optional(),\n});\n\n/** Internal reason a pending question was voided. */\nexport const QuestionVoidedReasonSchema = z.enum([\n \"pool_drift\",\n \"intent_edit\",\n \"recovery_drift\",\n \"negotiation_stale\",\n]);\n\n/** Permanent reasons that terminalize an unclaimed proactive push request. */\nexport const QuestionPoolPushRequestReasonSchema = z.enum([\n \"question_lifecycle\",\n \"intent_lifecycle\",\n \"malformed_source\",\n \"malformed_actor\",\n \"malformed_pool\",\n \"malformed_cycle\",\n \"visited\",\n \"pool_size\",\n \"voi\",\n \"cycle_budget\",\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 /** Exact negotiation recipient/intent/task routing provenance. Internal only. */\n negotiation: NegotiationQuestionProvenanceSchema.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 /** Durable server-only conversation session binding used to validate messageId. */\n sessionId: 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 /** Post-discovery intent recovery snapshot. Internal only. */\n recovery: QuestionRecoverySnapshotSchema.optional(),\n /** Durable request marker written before enqueueing proactive delivery. Internal only. */\n pushRequestedAt: z.string().min(1).optional(),\n /** Last bounded recovery sweep that selected this request. Internal only. */\n pushRecoveryAttemptedAt: z.string().min(1).optional(),\n /** Durable request outcome. Internal only. */\n pushRequestStatus: QuestionPoolPushRequestStatusSchema.optional(),\n /** Permanent suppression reason for an unclaimed request. Internal only. */\n pushRequestReason: QuestionPoolPushRequestReasonSchema.optional(),\n /** ISO-8601 timestamp at which an unclaimed request was suppressed. Internal only. */\n pushRequestSuppressedAt: z.string().min(1).optional(),\n /** Internal proactive delivery state. Never serialize to public clients. */\n push: QuestionPoolPushSchema.optional(),\n /** Internal reason this question was voided after pool or intent drift. */\n voidedReason: QuestionVoidedReasonSchema.optional(),\n /** Authoritative successful-delivery ledger timestamp. Internal only. */\n pushedAt: z.string().min(1).optional(),\n}).superRefine((detection, ctx) => {\n const negotiationFamily = detection.mode === \"negotiation\" || detection.mode === \"negotiation_inflight\";\n if (negotiationFamily !== Boolean(detection.negotiation)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"negotiation\"],\n message: negotiationFamily\n ? \"negotiation-family detection requires exact provenance\"\n : \"non-negotiation detection must not carry negotiation provenance\",\n });\n }\n if (detection.negotiation) {\n if (detection.sourceType !== \"opportunity\" || detection.sourceId !== detection.negotiation.opportunityId) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"sourceId\"], message: \"negotiation sourceId must equal opportunityId\" });\n }\n if (detection.purpose !== detection.negotiation.purpose) {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"purpose\"], message: \"detection purpose must match negotiation provenance\" });\n }\n if (detection.mode === \"negotiation_inflight\" && detection.negotiation.purpose !== \"inflight_consultation\") {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"negotiation\", \"purpose\"], message: \"inflight mode requires inflight purpose\" });\n }\n if (detection.mode === \"negotiation\" && detection.negotiation.purpose === \"inflight_consultation\") {\n ctx.addIssue({ code: z.ZodIssueCode.custom, path: [\"negotiation\", \"purpose\"], message: \"ordinary negotiation mode cannot carry inflight purpose\" });\n }\n }\n if (\n detection.mode === \"pool_discovery\"\n && (!detection.triggeredBy?.trim() || detection.triggeredBy !== detection.sourceId)\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"triggeredBy\"],\n message: \"pool_discovery triggeredBy must be non-empty and equal sourceId\",\n });\n }\n if (detection.purpose === \"recovery\") {\n if (\n detection.mode !== \"intent\"\n || detection.sourceType !== \"intent\"\n || !detection.triggeredBy?.trim()\n || detection.triggeredBy !== detection.sourceId\n || !detection.recovery\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"recovery\"],\n message: \"recovery purpose requires intent mode/source, equal trigger provenance, and a recovery snapshot\",\n });\n }\n } else if (detection.recovery) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"purpose\"],\n message: \"recovery snapshot requires recovery purpose\",\n });\n }\n if (detection.pushRequestStatus && !detection.pushRequestedAt) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"pushRequestedAt\"],\n message: \"push request state requires a request timestamp\",\n });\n }\n if (detection.pushRecoveryAttemptedAt && !detection.pushRequestedAt) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"pushRequestedAt\"],\n message: \"push recovery attempts require a request timestamp\",\n });\n }\n if (detection.pushRequestStatus === \"suppressed\") {\n if (!detection.pushRequestReason) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"pushRequestReason\"],\n message: \"suppressed push requests require a reason\",\n });\n }\n if (!detection.pushRequestSuppressedAt) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"pushRequestSuppressedAt\"],\n message: \"suppressed push requests require a timestamp\",\n });\n }\n }\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 NegotiationQuestionPurpose = z.infer<typeof NegotiationQuestionPurposeSchema>;\nexport type NegotiationQuestionCandidate = z.infer<typeof NegotiationQuestionCandidateSchema>;\nexport type NegotiationQuestionProvenance = z.infer<typeof NegotiationQuestionProvenanceSchema>;\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>;\nexport type QuestionRecoverySnapshot = z.infer<typeof QuestionRecoverySnapshotSchema>;\nexport type QuestionPoolPush = z.infer<typeof QuestionPoolPushSchema>;\nexport type QuestionVoidedReason = z.infer<typeof QuestionVoidedReasonSchema>;\nexport type QuestionPoolPushRequestStatus = z.infer<typeof QuestionPoolPushRequestStatusSchema>;\nexport type QuestionPoolPushRequestReason = z.infer<typeof QuestionPoolPushRequestReasonSchema>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/protocol",
3
- "version": "6.12.0-rc.403.1",
3
+ "version": "6.12.1-rc.404.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",