@indexnetwork/protocol 4.5.0-rc.335.1 → 4.5.0-rc.336.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 (40) hide show
  1. package/dist/chat/chat-streaming.types.d.ts +1 -1
  2. package/dist/chat/chat-streaming.types.d.ts.map +1 -1
  3. package/dist/chat/chat-streaming.types.js.map +1 -1
  4. package/dist/chat/chat.agent.d.ts +1 -1
  5. package/dist/chat/chat.agent.d.ts.map +1 -1
  6. package/dist/chat/chat.agent.js.map +1 -1
  7. package/dist/index.d.ts +4 -4
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +2 -2
  10. package/dist/index.js.map +1 -1
  11. package/dist/negotiation/negotiation.agent.d.ts +9 -0
  12. package/dist/negotiation/negotiation.agent.d.ts.map +1 -1
  13. package/dist/negotiation/negotiation.agent.js +11 -3
  14. package/dist/negotiation/negotiation.agent.js.map +1 -1
  15. package/dist/negotiation/negotiation.graph.d.ts +130 -34
  16. package/dist/negotiation/negotiation.graph.d.ts.map +1 -1
  17. package/dist/negotiation/negotiation.graph.js +168 -7
  18. package/dist/negotiation/negotiation.graph.js.map +1 -1
  19. package/dist/negotiation/negotiation.protocol.d.ts +250 -2
  20. package/dist/negotiation/negotiation.protocol.d.ts.map +1 -1
  21. package/dist/negotiation/negotiation.protocol.js +57 -8
  22. package/dist/negotiation/negotiation.protocol.js.map +1 -1
  23. package/dist/negotiation/negotiation.state.d.ts +40 -7
  24. package/dist/negotiation/negotiation.state.d.ts.map +1 -1
  25. package/dist/negotiation/negotiation.state.js +5 -1
  26. package/dist/negotiation/negotiation.state.js.map +1 -1
  27. package/dist/opportunity/question.prompt.d.ts +1 -1
  28. package/dist/opportunity/question.prompt.d.ts.map +1 -1
  29. package/dist/opportunity/question.prompt.js.map +1 -1
  30. package/dist/shared/interfaces/negotiation-events.interface.d.ts +30 -0
  31. package/dist/shared/interfaces/negotiation-events.interface.d.ts.map +1 -1
  32. package/dist/shared/interfaces/negotiation-events.interface.js.map +1 -1
  33. package/dist/shared/schemas/discovery-question.schema.d.ts +8 -8
  34. package/dist/shared/schemas/discovery-question.schema.js +1 -1
  35. package/dist/shared/schemas/discovery-question.schema.js.map +1 -1
  36. package/dist/shared/schemas/negotiation-state.schema.d.ts +41 -4
  37. package/dist/shared/schemas/negotiation-state.schema.d.ts.map +1 -1
  38. package/dist/shared/schemas/negotiation-state.schema.js +14 -0
  39. package/dist/shared/schemas/negotiation-state.schema.js.map +1 -1
  40. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"negotiation-state.schema.d.ts","sourceRoot":"/","sources":["shared/schemas/negotiation-state.schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,oGAGtB,CAAC;AACX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,8DAA8D;AAC9D,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,cAAc,CAAC;AAE3D,6DAA6D;AAC7D,MAAM,MAAM,0BAA0B,GAAG,IAAI,GAAG,IAAI,CAAC;AAErD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAI1E,kDAAkD;AAClD,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,KAAK,CAAC;QAA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hC,oDAAoD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEpD,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAI1E,kDAAkD;AAClD,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvF,OAAO,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CACtG;AAED,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD"}
@@ -18,7 +18,19 @@ import { z } from "zod";
18
18
  export const NEGOTIATION_ACTIONS = [
19
19
  "propose", "accept", "reject", "counter", "question",
20
20
  "outreach", "withdraw", "decline",
21
+ "ask_user",
21
22
  ];
23
+ /**
24
+ * Payload for the v2 `ask_user` action (P3.2): the negotiator pauses the
25
+ * negotiation to consult its OWN client. `disclosureSubject` states what the
26
+ * negotiator wants permission to share or needs to know; `draftQuestion` is
27
+ * the negotiator's own phrasing, refined by the questioner's
28
+ * `negotiation_inflight` preset before delivery.
29
+ */
30
+ export const AskUserPayloadSchema = z.object({
31
+ disclosureSubject: z.string(),
32
+ draftQuestion: z.string().nullable().optional(),
33
+ });
22
34
  export const NegotiationTurnSchema = z.object({
23
35
  action: z.enum(NEGOTIATION_ACTIONS),
24
36
  assessment: z.object({
@@ -29,6 +41,8 @@ export const NegotiationTurnSchema = z.object({
29
41
  }),
30
42
  }),
31
43
  message: z.string().nullable().optional(),
44
+ /** Present when action is `ask_user` (v2, P3.2). */
45
+ askUser: AskUserPayloadSchema.nullable().optional(),
32
46
  });
33
47
  export const NegotiationOutcomeSchema = z.object({
34
48
  hasOpportunity: z.boolean(),
@@ -1 +1 @@
1
- {"version":3,"file":"negotiation-state.schema.js","sourceRoot":"/","sources":["shared/schemas/negotiation-state.schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iFAAiF;AAEjF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU;IACpD,UAAU,EAAE,UAAU,EAAE,SAAS;CACzB,CAAC;AASX,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC;IACnC,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;QACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,cAAc,EAAE,CAAC,CAAC,MAAM,CAAC;YACvB,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;YAC7C,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;SAChD,CAAC;KACH,CAAC;IACF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;IAC3B,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;KAC3C,CAAC,CAAC;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE;CACnD,CAAC,CAAC","sourcesContent":["/**\n * Negotiation state DTOs extracted from negotiation/negotiation.state.ts for\n * consumption by shared interfaces. This shared module owns the DTO schemas;\n * LangGraph Annotation.Root stays in the domain file.\n */\nimport { z } from \"zod\";\n\n// ─── Zod schemas (available for runtime validation) ───────────────────────────\n\n/**\n * Union of every negotiation turn action across protocol versions.\n *\n * v1 vocabulary: `propose | accept | reject | counter | question`.\n * v2 (client-advocate seat rules) renames `propose`→`outreach` and splits\n * `reject` into `withdraw` (initiator seat) / `decline` (counterparty seat).\n * Which subset is valid for a given turn depends on the task's\n * `protocolVersion` and the acting user's seat — see\n * `negotiation/negotiation.protocol.ts` for the seat-scoped schemas.\n */\nexport const NEGOTIATION_ACTIONS = [\n \"propose\", \"accept\", \"reject\", \"counter\", \"question\",\n \"outreach\", \"withdraw\", \"decline\",\n] as const;\nexport type NegotiationAction = (typeof NEGOTIATION_ACTIONS)[number];\n\n/** Negotiation seat under the v2 client-advocate protocol. */\nexport type NegotiationSeat = \"initiator\" | \"counterparty\";\n\n/** Negotiation protocol version stamped on task metadata. */\nexport type NegotiationProtocolVersion = \"v1\" | \"v2\";\n\nexport const NegotiationTurnSchema = z.object({\n action: z.enum(NEGOTIATION_ACTIONS),\n assessment: z.object({\n reasoning: z.string(),\n suggestedRoles: z.object({\n ownUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n otherUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n }),\n }),\n message: z.string().nullable().optional(),\n});\nexport type NegotiationTurn = z.infer<typeof NegotiationTurnSchema>;\n\nexport const NegotiationOutcomeSchema = z.object({\n hasOpportunity: z.boolean(),\n agreedRoles: z.array(z.object({\n userId: z.string(),\n role: z.enum([\"agent\", \"patient\", \"peer\"]),\n })),\n reasoning: z.string(),\n turnCount: z.number(),\n reason: z.enum([\"turn_cap\", \"timeout\"]).optional(),\n});\nexport type NegotiationOutcome = z.infer<typeof NegotiationOutcomeSchema>;\n\n// ─── Pure interfaces ──────────────────────────────────────────────────────────\n\n/** Context each agent receives about its user. */\nexport interface UserNegotiationContext {\n id: string;\n intents: Array<{ id: string; title: string; description: string; confidence: number }>;\n profile: { name?: string; bio?: string; location?: string; interests?: string[]; skills?: string[] };\n}\n\n/** Seed assessment from the evaluator pre-filter. */\nexport interface SeedAssessment {\n reasoning: string;\n valencyRole: string;\n actors?: Array<{ userId: string; role: string }>;\n}"]}
1
+ {"version":3,"file":"negotiation-state.schema.js","sourceRoot":"/","sources":["shared/schemas/negotiation-state.schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iFAAiF;AAEjF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU;IACpD,UAAU,EAAE,UAAU,EAAE,SAAS;IACjC,UAA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IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE;CACnD,CAAC,CAAC","sourcesContent":["/**\n * Negotiation state DTOs extracted from negotiation/negotiation.state.ts for\n * consumption by shared interfaces. This shared module owns the DTO schemas;\n * LangGraph Annotation.Root stays in the domain file.\n */\nimport { z } from \"zod\";\n\n// ─── Zod schemas (available for runtime validation) ───────────────────────────\n\n/**\n * Union of every negotiation turn action across protocol versions.\n *\n * v1 vocabulary: `propose | accept | reject | counter | question`.\n * v2 (client-advocate seat rules) renames `propose`→`outreach` and splits\n * `reject` into `withdraw` (initiator seat) / `decline` (counterparty seat).\n * Which subset is valid for a given turn depends on the task's\n * `protocolVersion` and the acting user's seat — see\n * `negotiation/negotiation.protocol.ts` for the seat-scoped schemas.\n */\nexport const NEGOTIATION_ACTIONS = [\n \"propose\", \"accept\", \"reject\", \"counter\", \"question\",\n \"outreach\", \"withdraw\", \"decline\",\n \"ask_user\",\n] as const;\nexport type NegotiationAction = (typeof NEGOTIATION_ACTIONS)[number];\n\n/** Negotiation seat under the v2 client-advocate protocol. */\nexport type NegotiationSeat = \"initiator\" | \"counterparty\";\n\n/** Negotiation protocol version stamped on task metadata. */\nexport type NegotiationProtocolVersion = \"v1\" | \"v2\";\n\n/**\n * Payload for the v2 `ask_user` action (P3.2): the negotiator pauses the\n * negotiation to consult its OWN client. `disclosureSubject` states what the\n * negotiator wants permission to share or needs to know; `draftQuestion` is\n * the negotiator's own phrasing, refined by the questioner's\n * `negotiation_inflight` preset before delivery.\n */\nexport const AskUserPayloadSchema = z.object({\n disclosureSubject: z.string(),\n draftQuestion: z.string().nullable().optional(),\n});\nexport type AskUserPayload = z.infer<typeof AskUserPayloadSchema>;\n\nexport const NegotiationTurnSchema = z.object({\n action: z.enum(NEGOTIATION_ACTIONS),\n assessment: z.object({\n reasoning: z.string(),\n suggestedRoles: z.object({\n ownUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n otherUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n }),\n }),\n message: z.string().nullable().optional(),\n /** Present when action is `ask_user` (v2, P3.2). */\n askUser: AskUserPayloadSchema.nullable().optional(),\n});\nexport type NegotiationTurn = z.infer<typeof NegotiationTurnSchema>;\n\nexport const NegotiationOutcomeSchema = z.object({\n hasOpportunity: z.boolean(),\n agreedRoles: z.array(z.object({\n userId: z.string(),\n role: z.enum([\"agent\", \"patient\", \"peer\"]),\n })),\n reasoning: z.string(),\n turnCount: z.number(),\n reason: z.enum([\"turn_cap\", \"timeout\"]).optional(),\n});\nexport type NegotiationOutcome = z.infer<typeof NegotiationOutcomeSchema>;\n\n// ─── Pure interfaces ──────────────────────────────────────────────────────────\n\n/** Context each agent receives about its user. */\nexport interface UserNegotiationContext {\n id: string;\n intents: Array<{ id: string; title: string; description: string; confidence: number }>;\n profile: { name?: string; bio?: string; location?: string; interests?: string[]; skills?: string[] };\n}\n\n/** Seed assessment from the evaluator pre-filter. */\nexport interface SeedAssessment {\n reasoning: string;\n valencyRole: string;\n actors?: Array<{ userId: string; role: string }>;\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/protocol",
3
- "version": "4.5.0-rc.335.1",
3
+ "version": "4.5.0-rc.336.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",