@indexnetwork/protocol 4.3.7-rc.317.1 → 4.4.1-rc.319.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 (65) hide show
  1. package/dist/chat/chat-streaming.types.d.ts +29 -2
  2. package/dist/chat/chat-streaming.types.d.ts.map +1 -1
  3. package/dist/chat/chat-streaming.types.js +3 -0
  4. package/dist/chat/chat-streaming.types.js.map +1 -1
  5. package/dist/chat/chat.agent.d.ts +15 -0
  6. package/dist/chat/chat.agent.d.ts.map +1 -1
  7. package/dist/chat/chat.agent.js.map +1 -1
  8. package/dist/chat/chat.prompt.d.ts.map +1 -1
  9. package/dist/chat/chat.prompt.js +3 -0
  10. package/dist/chat/chat.prompt.js.map +1 -1
  11. package/dist/chat/chat.streamer.d.ts.map +1 -1
  12. package/dist/chat/chat.streamer.js +9 -1
  13. package/dist/chat/chat.streamer.js.map +1 -1
  14. package/dist/enrichment/enrichment.graph.d.ts +3 -11
  15. package/dist/enrichment/enrichment.graph.d.ts.map +1 -1
  16. package/dist/enrichment/enrichment.graph.js +72 -2
  17. package/dist/enrichment/enrichment.graph.js.map +1 -1
  18. package/dist/enrichment/enrichment.tools.d.ts.map +1 -1
  19. package/dist/enrichment/enrichment.tools.js +1 -0
  20. package/dist/enrichment/enrichment.tools.js.map +1 -1
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/premise/premise.decomposer.d.ts +12 -1
  25. package/dist/premise/premise.decomposer.d.ts.map +1 -1
  26. package/dist/premise/premise.decomposer.js +87 -5
  27. package/dist/premise/premise.decomposer.js.map +1 -1
  28. package/dist/premise/premise.tools.d.ts.map +1 -1
  29. package/dist/premise/premise.tools.js +0 -24
  30. package/dist/premise/premise.tools.js.map +1 -1
  31. package/dist/questioner/questioner.ask.tool.d.ts +14 -0
  32. package/dist/questioner/questioner.ask.tool.d.ts.map +1 -0
  33. package/dist/questioner/questioner.ask.tool.js +309 -0
  34. package/dist/questioner/questioner.ask.tool.js.map +1 -0
  35. package/dist/questioner/questioner.presets.d.ts.map +1 -1
  36. package/dist/questioner/questioner.presets.js +73 -0
  37. package/dist/questioner/questioner.presets.js.map +1 -1
  38. package/dist/questioner/questioner.types.d.ts +21 -1
  39. package/dist/questioner/questioner.types.d.ts.map +1 -1
  40. package/dist/questioner/questioner.types.js.map +1 -1
  41. package/dist/shared/agent/tool.factory.d.ts.map +1 -1
  42. package/dist/shared/agent/tool.factory.js +10 -1
  43. package/dist/shared/agent/tool.factory.js.map +1 -1
  44. package/dist/shared/agent/tool.helpers.d.ts +20 -14
  45. package/dist/shared/agent/tool.helpers.d.ts.map +1 -1
  46. package/dist/shared/agent/tool.helpers.js +12 -1
  47. package/dist/shared/agent/tool.helpers.js.map +1 -1
  48. package/dist/shared/agent/tool.runtime.d.ts +1 -1
  49. package/dist/shared/agent/tool.runtime.d.ts.map +1 -1
  50. package/dist/shared/agent/tool.runtime.js +14 -3
  51. package/dist/shared/agent/tool.runtime.js.map +1 -1
  52. package/dist/shared/interfaces/database.interface.d.ts +9 -1
  53. package/dist/shared/interfaces/database.interface.d.ts.map +1 -1
  54. package/dist/shared/interfaces/database.interface.js.map +1 -1
  55. package/dist/shared/interfaces/questioner.interface.d.ts +26 -0
  56. package/dist/shared/interfaces/questioner.interface.d.ts.map +1 -1
  57. package/dist/shared/interfaces/questioner.interface.js.map +1 -1
  58. package/dist/shared/observability/request-context.d.ts +15 -0
  59. package/dist/shared/observability/request-context.d.ts.map +1 -1
  60. package/dist/shared/observability/request-context.js.map +1 -1
  61. package/dist/shared/schemas/question.schema.d.ts +4 -4
  62. package/dist/shared/schemas/question.schema.d.ts.map +1 -1
  63. package/dist/shared/schemas/question.schema.js +2 -0
  64. package/dist/shared/schemas/question.schema.js.map +1 -1
  65. package/package.json +1 -1
@@ -19,6 +19,21 @@ export type TraceEmitter = (event: {
19
19
  name: string;
20
20
  durationMs?: number;
21
21
  summary?: string;
22
+ } | {
23
+ type: "user_question";
24
+ questions: Array<{
25
+ id: string;
26
+ title: string;
27
+ prompt: string;
28
+ options: Array<{
29
+ label: string;
30
+ description: string;
31
+ }>;
32
+ multiSelect: boolean;
33
+ }>;
34
+ } | {
35
+ type: "status";
36
+ message: string;
22
37
  } | {
23
38
  type: "opportunity_draft_ready";
24
39
  opportunityId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"request-context.d.ts","sourceRoot":"/","sources":["shared/observability/request-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,YAAY,GAAG,CACzB,KAAK,EACD;IACE,IAAI,EAAE,aAAa,GAAG,WAAW,GAAG,aAAa,GAAG,WAAW,CAAC;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GACD;IACE,IAAI,EAAE,yBAAyB,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,WAAW,CAAC;IACzB,oEAAoE;IACpE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;;OAMG;IACH,YAAY,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH,KACF,IAAI,CAAC;AAEV,UAAU,cAAc;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,mCAA0C,CAAC"}
1
+ {"version":3,"file":"request-context.d.ts","sourceRoot":"/","sources":["shared/observability/request-context.ts"],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AAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"request-context.js","sourceRoot":"/","sources":["shared/observability/request-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AA4DhD;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,iBAAiB,EAAkB,CAAC","sourcesContent":["import type { Opportunity } from \"../interfaces/database.interface.js\";\nimport { AsyncLocalStorage } from \"async_hooks\";\n\n/**\n * Callback for streaming trace / domain events from deep inside graph nodes\n * back to the caller (typically chat.agent's stream pipeline).\n *\n * Carries two flavors of event:\n * - Trace events (`graph_start | graph_end | agent_start | agent_end`) — used\n * by the chat TRACE panel to visualize what the agent is doing.\n * - Domain events (`opportunity_draft_ready`) — emitted by the orchestrator\n * branch of OpportunityGraph.negotiateNode so the frontend can render each\n * accepted draft card progressively as its negotiation resolves.\n *\n * Kept as a single emitter rather than splitting into two to minimize plumbing\n * through AsyncLocalStorage; the chat.agent relay branches on event.type.\n */\nexport type TraceEmitter = (\n event:\n | {\n type: \"graph_start\" | \"graph_end\" | \"agent_start\" | \"agent_end\";\n name: string;\n durationMs?: number;\n summary?: string;\n }\n | {\n type: \"opportunity_draft_ready\";\n opportunityId: string;\n opportunity: Opportunity;\n /** Viewer-centric summary derived from interpretation.reasoning. */\n personalizedSummary?: string;\n /**\n * Minimal counterparty data for rendering the inline card without a\n * second-round-trip user lookup. Populated from the negotiation\n * candidate's profile; avatar is intentionally omitted (the card\n * falls back to initials) since UserNegotiationContext doesn't\n * carry avatars.\n */\n counterparty: {\n userId: string;\n name?: string;\n };\n },\n) => void;\n\ninterface RequestContext {\n originUrl?: string;\n traceEmitter?: TraceEmitter;\n /**\n * Signal for cooperative cancellation — propagates the caller's AbortSignal\n * into long-running graph nodes (e.g. orchestrator negotiation fan-out) so\n * they can stop emitting events when the chat session closes.\n *\n * The orchestrator branch checks this before persisting status flips or\n * pushing `opportunity_draft_ready` events. In-flight negotiations are not\n * forcibly cancelled — they finish or time out naturally via their park\n * window — but their results are suppressed once the signal trips.\n */\n abortSignal?: AbortSignal;\n}\n\n/**\n * AsyncLocalStorage for propagating request-scoped context through the protocol layer.\n * The host application is responsible for calling `requestContext.run()` to set the context.\n */\nexport const requestContext = new AsyncLocalStorage<RequestContext>();\n"]}
1
+ {"version":3,"file":"request-context.js","sourceRoot":"/","sources":["shared/observability/request-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAgFhD;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,iBAAiB,EAAkB,CAAC","sourcesContent":["import type { Opportunity } from \"../interfaces/database.interface.js\";\nimport { AsyncLocalStorage } from \"async_hooks\";\n\n/**\n * Callback for streaming trace / domain events from deep inside graph nodes\n * back to the caller (typically chat.agent's stream pipeline).\n *\n * Carries two flavors of event:\n * - Trace events (`graph_start | graph_end | agent_start | agent_end`) — used\n * by the chat TRACE panel to visualize what the agent is doing.\n * - Domain events (`opportunity_draft_ready`) — emitted by the orchestrator\n * branch of OpportunityGraph.negotiateNode so the frontend can render each\n * accepted draft card progressively as its negotiation resolves.\n *\n * Kept as a single emitter rather than splitting into two to minimize plumbing\n * through AsyncLocalStorage; the chat.agent relay branches on event.type.\n */\nexport type TraceEmitter = (\n event:\n | {\n type: \"graph_start\" | \"graph_end\" | \"agent_start\" | \"agent_end\";\n name: string;\n durationMs?: number;\n summary?: string;\n }\n | {\n // Emitted by the ask_user_question tool: structured questions were\n // persisted and the turn is now blocked awaiting the user's answer.\n // Carries persisted question ids so the frontend can answer them\n // through the questions REST endpoints while the stream is live.\n type: \"user_question\";\n questions: Array<{\n id: string;\n title: string;\n prompt: string;\n options: Array<{ label: string; description: string }>;\n multiSelect: boolean;\n }>;\n }\n | {\n // Lightweight keep-alive/status line. Used by long-blocking tools\n // (ask_user_question wait loop) so SSE transports do not idle out.\n type: \"status\";\n message: string;\n }\n | {\n type: \"opportunity_draft_ready\";\n opportunityId: string;\n opportunity: Opportunity;\n /** Viewer-centric summary derived from interpretation.reasoning. */\n personalizedSummary?: string;\n /**\n * Minimal counterparty data for rendering the inline card without a\n * second-round-trip user lookup. Populated from the negotiation\n * candidate's profile; avatar is intentionally omitted (the card\n * falls back to initials) since UserNegotiationContext doesn't\n * carry avatars.\n */\n counterparty: {\n userId: string;\n name?: string;\n };\n },\n) => void;\n\ninterface RequestContext {\n originUrl?: string;\n traceEmitter?: TraceEmitter;\n /**\n * Signal for cooperative cancellation — propagates the caller's AbortSignal\n * into long-running graph nodes (e.g. orchestrator negotiation fan-out) so\n * they can stop emitting events when the chat session closes.\n *\n * The orchestrator branch checks this before persisting status flips or\n * pushing `opportunity_draft_ready` events. In-flight negotiations are not\n * forcibly cancelled — they finish or time out naturally via their park\n * window — but their results are suppressed once the signal trips.\n */\n abortSignal?: AbortSignal;\n}\n\n/**\n * AsyncLocalStorage for propagating request-scoped context through the protocol layer.\n * The host application is responsible for calling `requestContext.run()` to set the context.\n */\nexport const requestContext = new AsyncLocalStorage<RequestContext>();\n"]}
@@ -179,10 +179,10 @@ export interface QuestionGenerationResult {
179
179
  questions: Question[];
180
180
  strategies: QuestionStrategy[];
181
181
  }
182
- export declare const QuestionModeSchema: z.ZodEnum<["discovery", "intent", "enrichment", "negotiation"]>;
182
+ export declare const QuestionModeSchema: z.ZodEnum<["discovery", "intent", "enrichment", "negotiation", "chat"]>;
183
183
  export declare const QuestionDetectionSchema: z.ZodObject<{
184
184
  /** Which preset mode generated this question. */
185
- mode: z.ZodEnum<["discovery", "intent", "enrichment", "negotiation"]>;
185
+ mode: z.ZodEnum<["discovery", "intent", "enrichment", "negotiation", "chat"]>;
186
186
  /** Entity type that triggered generation (e.g. "opportunity", "intent", "profile"). */
187
187
  sourceType: z.ZodString;
188
188
  /** ID of the triggering entity. */
@@ -194,14 +194,14 @@ export declare const QuestionDetectionSchema: z.ZodObject<{
194
194
  /** ID of the assistant message that triggered this question. Used by the frontend to anchor the question card inline. */
195
195
  messageId: z.ZodOptional<z.ZodString>;
196
196
  }, "strip", z.ZodTypeAny, {
197
- mode: "intent" | "enrichment" | "discovery" | "negotiation";
197
+ mode: "intent" | "chat" | "enrichment" | "discovery" | "negotiation";
198
198
  sourceType: string;
199
199
  sourceId: string;
200
200
  timestamp: string;
201
201
  triggeredBy?: string | undefined;
202
202
  messageId?: string | undefined;
203
203
  }, {
204
- mode: "intent" | "enrichment" | "discovery" | "negotiation";
204
+ mode: "intent" | "chat" | "enrichment" | "discovery" | "negotiation";
205
205
  sourceType: string;
206
206
  sourceId: string;
207
207
  timestamp: string;
@@ -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;;;;;;;;;;;;;;;;;;EAE1E,CAAC;AAEH,eAAO,MAAM,sBAAsB,oIAMjC,CAAC;AAEH,eAAO,MAAM,0BAA0B;IAlBrC,+EAA+E;;IAE/E,yDAAyD;;IAEzD,6EAA6E;;QAX7E,+EAA+E;;QAE/E,iFAAiF;;;;;;;;;IAWjF,0EAA0E;;;;;;;;;;;;;;;;;;;;;;EAc1E,CAAC;AAEH,eAAO,MAAM,+BAA+B;;QAtB1C,+EAA+E;;QAE/E,yDAAyD;;QAEzD,6EAA6E;;YAX7E,+EAA+E;;YAE/E,iFAAiF;;;;;;;;;QAWjF,0EAA0E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkB1E,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,C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AExF;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,UAAU,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAID,eAAO,MAAM,kBAAkB,yEAO7B,CAAC;AAEH,eAAO,MAAM,uBAAuB;IAClC,iDAAiD;;IAEjD,uFAAuF;;IAEvF,mCAAmC;;IAEnC,kDAAkD;;IAElD,wCAAwC;;IAExC,yHAAyH;;;;;;;;;;;;;;;;EAEzH,CAAC;AAEH,eAAO,MAAM,mBAAmB;IAC9B,qCAAqC;;IAErC,gCAAgC;;IAEhC,iEAAiE;;;;;;;;;;EAEjE,CAAC;AAEH,eAAO,MAAM,oBAAoB;IAC/B,uCAAuC;;IAEvC,iEAAiE;;IAEjE,+BAA+B;;IAE/B,2DAA2D;;;;;;;;;;;;EAE3D,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -44,6 +44,8 @@ export const QuestionModeSchema = z.enum([
44
44
  "intent",
45
45
  "enrichment",
46
46
  "negotiation",
47
+ // Orchestrator-initiated mid-conversation questions (ask_user_question tool).
48
+ "chat",
47
49
  ]);
48
50
  export const QuestionDetectionSchema = z.object({
49
51
  /** Which preset mode generated this question. */
@@ -1 +1 @@
1
- {"version":3,"file":"question.schema.js","sourceRoot":"/","sources":["shared/schemas/question.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,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A+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 an internal `strategy`\n * tag used by the generator's guardrails (dedup/diversity) and recorded in\n * `debugMeta`. The tag is stripped before the public payload leaves the\n * generator — users never see it.\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\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});\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 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 a parallel strategies\n * array for debug-only consumption. The generator emits this; callers\n * forward `questions` to renderers and `strategies` to `debugMeta` only.\n */\nexport interface QuestionGenerationResult {\n questions: Question[];\n strategies: QuestionStrategy[];\n}\n\n// ─── Persistence types (opportunity-style composable jsonb) ──────────────────\n\nexport const QuestionModeSchema = z.enum([\n \"discovery\",\n \"intent\",\n \"enrichment\",\n \"negotiation\",\n]);\n\nexport const QuestionDetectionSchema = z.object({\n /** Which preset mode generated this question. */\n mode: QuestionModeSchema,\n /** Entity type that triggered generation (e.g. \"opportunity\", \"intent\", \"profile\"). */\n sourceType: z.string().min(1),\n /** ID of the triggering entity. */\n sourceId: z.string().min(1),\n /** Optional intent ID that was the root cause. */\n triggeredBy: z.string().optional(),\n /** ISO-8601 timestamp of generation. */\n timestamp: z.string().min(1),\n /** ID of the assistant message that triggered this question. Used by the frontend to anchor the question card inline. */\n messageId: z.string().optional(),\n});\n\nexport const QuestionActorSchema = z.object({\n /** The user this question is for. */\n userId: z.string().min(1),\n /** Optional network context. */\n networkId: z.string().optional(),\n /** Actor's role in the question — currently always \"subject\". */\n role: z.literal(\"subject\"),\n});\n\nexport const QuestionAnswerSchema = z.object({\n /** Option labels the user selected. */\n selectedOptions: z.array(z.string()),\n /** Free-text input when the user chose \"Other\" or elaborated. */\n freeText: z.string().optional(),\n /** User ID of the answerer. */\n answeredBy: z.string().min(1),\n /** ISO-8601 timestamp of when the answer was submitted. */\n answeredAt: z.string().min(1),\n});\n\nexport type QuestionMode = z.infer<typeof QuestionModeSchema>;\nexport type QuestionDetection = z.infer<typeof QuestionDetectionSchema>;\nexport type QuestionActor = z.infer<typeof QuestionActorSchema>;\nexport type QuestionAnswer = z.infer<typeof QuestionAnswerSchema>;\n"]}
1
+ {"version":3,"file":"question.schema.js","sourceRoot":"/","sources":["shared/schemas/question.schema.ts"],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,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 an internal `strategy`\n * tag used by the generator's guardrails (dedup/diversity) and recorded in\n * `debugMeta`. The tag is stripped before the public payload leaves the\n * generator — users never see it.\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\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});\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 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 a parallel strategies\n * array for debug-only consumption. The generator emits this; callers\n * forward `questions` to renderers and `strategies` to `debugMeta` only.\n */\nexport interface QuestionGenerationResult {\n questions: Question[];\n strategies: QuestionStrategy[];\n}\n\n// ─── Persistence types (opportunity-style composable jsonb) ──────────────────\n\nexport const QuestionModeSchema = z.enum([\n \"discovery\",\n \"intent\",\n \"enrichment\",\n \"negotiation\",\n // Orchestrator-initiated mid-conversation questions (ask_user_question tool).\n \"chat\",\n]);\n\nexport const QuestionDetectionSchema = z.object({\n /** Which preset mode generated this question. */\n mode: QuestionModeSchema,\n /** Entity type that triggered generation (e.g. \"opportunity\", \"intent\", \"profile\"). */\n sourceType: z.string().min(1),\n /** ID of the triggering entity. */\n sourceId: z.string().min(1),\n /** Optional intent ID that was the root cause. */\n triggeredBy: z.string().optional(),\n /** ISO-8601 timestamp of generation. */\n timestamp: z.string().min(1),\n /** ID of the assistant message that triggered this question. Used by the frontend to anchor the question card inline. */\n messageId: z.string().optional(),\n});\n\nexport const QuestionActorSchema = z.object({\n /** The user this question is for. */\n userId: z.string().min(1),\n /** Optional network context. */\n networkId: z.string().optional(),\n /** Actor's role in the question — currently always \"subject\". */\n role: z.literal(\"subject\"),\n});\n\nexport const QuestionAnswerSchema = z.object({\n /** Option labels the user selected. */\n selectedOptions: z.array(z.string()),\n /** Free-text input when the user chose \"Other\" or elaborated. */\n freeText: z.string().optional(),\n /** User ID of the answerer. */\n answeredBy: z.string().min(1),\n /** ISO-8601 timestamp of when the answer was submitted. */\n answeredAt: z.string().min(1),\n});\n\nexport type QuestionMode = z.infer<typeof QuestionModeSchema>;\nexport type QuestionDetection = z.infer<typeof QuestionDetectionSchema>;\nexport type QuestionActor = z.infer<typeof QuestionActorSchema>;\nexport type QuestionAnswer = z.infer<typeof QuestionAnswerSchema>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/protocol",
3
- "version": "4.3.7-rc.317.1",
3
+ "version": "4.4.1-rc.319.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",