@indexnetwork/protocol 0.4.0-rc.13.1 → 0.4.0-rc.15.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 (57) hide show
  1. package/dist/chat/chat.agent.d.ts.map +1 -1
  2. package/dist/chat/chat.agent.js +7 -6
  3. package/dist/chat/chat.agent.js.map +1 -1
  4. package/dist/index.d.ts +3 -2
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/negotiation/negotiation.agent.d.ts +30 -0
  9. package/dist/negotiation/negotiation.agent.d.ts.map +1 -0
  10. package/dist/negotiation/negotiation.agent.js +92 -0
  11. package/dist/negotiation/negotiation.agent.js.map +1 -0
  12. package/dist/negotiation/negotiation.graph.d.ts +138 -166
  13. package/dist/negotiation/negotiation.graph.d.ts.map +1 -1
  14. package/dist/negotiation/negotiation.graph.js +85 -80
  15. package/dist/negotiation/negotiation.graph.js.map +1 -1
  16. package/dist/negotiation/negotiation.state.d.ts +128 -34
  17. package/dist/negotiation/negotiation.state.d.ts.map +1 -1
  18. package/dist/negotiation/negotiation.state.js +45 -14
  19. package/dist/negotiation/negotiation.state.js.map +1 -1
  20. package/dist/negotiation/negotiation.tools.d.ts.map +1 -1
  21. package/dist/negotiation/negotiation.tools.js +183 -172
  22. package/dist/negotiation/negotiation.tools.js.map +1 -1
  23. package/dist/opportunity/opportunity.evaluator.d.ts.map +1 -1
  24. package/dist/opportunity/opportunity.evaluator.js +35 -10
  25. package/dist/opportunity/opportunity.evaluator.js.map +1 -1
  26. package/dist/opportunity/opportunity.graph.d.ts +1 -2
  27. package/dist/opportunity/opportunity.graph.d.ts.map +1 -1
  28. package/dist/opportunity/opportunity.graph.js +4 -10
  29. package/dist/opportunity/opportunity.graph.js.map +1 -1
  30. package/dist/shared/agent/model.config.d.ts +1 -4
  31. package/dist/shared/agent/model.config.d.ts.map +1 -1
  32. package/dist/shared/agent/model.config.js +1 -2
  33. package/dist/shared/agent/model.config.js.map +1 -1
  34. package/dist/shared/agent/tool.factory.d.ts.map +1 -1
  35. package/dist/shared/agent/tool.factory.js +7 -6
  36. package/dist/shared/agent/tool.factory.js.map +1 -1
  37. package/dist/shared/agent/tool.helpers.d.ts +6 -9
  38. package/dist/shared/agent/tool.helpers.d.ts.map +1 -1
  39. package/dist/shared/agent/tool.helpers.js.map +1 -1
  40. package/dist/shared/interfaces/agent-dispatcher.interface.d.ts +68 -0
  41. package/dist/shared/interfaces/agent-dispatcher.interface.d.ts.map +1 -0
  42. package/dist/shared/interfaces/agent-dispatcher.interface.js +9 -0
  43. package/dist/shared/interfaces/agent-dispatcher.interface.js.map +1 -0
  44. package/dist/shared/interfaces/database.interface.d.ts +1 -1
  45. package/dist/shared/interfaces/database.interface.d.ts.map +1 -1
  46. package/dist/shared/interfaces/negotiation-events.interface.d.ts +2 -34
  47. package/dist/shared/interfaces/negotiation-events.interface.d.ts.map +1 -1
  48. package/dist/shared/interfaces/negotiation-events.interface.js +2 -2
  49. package/package.json +1 -1
  50. package/dist/negotiation/negotiation.proposer.d.ts +0 -26
  51. package/dist/negotiation/negotiation.proposer.d.ts.map +0 -1
  52. package/dist/negotiation/negotiation.proposer.js +0 -67
  53. package/dist/negotiation/negotiation.proposer.js.map +0 -1
  54. package/dist/negotiation/negotiation.responder.d.ts +0 -26
  55. package/dist/negotiation/negotiation.responder.d.ts.map +0 -1
  56. package/dist/negotiation/negotiation.responder.js +0 -71
  57. package/dist/negotiation/negotiation.responder.js.map +0 -1
@@ -1,71 +0,0 @@
1
- import { createModel } from "../shared/agent/model.config.js";
2
- import { NegotiationTurnSchema } from "./negotiation.state.js";
3
- const SYSTEM_PROMPT = `You are a negotiation agent representing your user in an opportunity matching system.
4
- Your role is to EVALUATE proposals and PROTECT your user from poor matches.
5
-
6
- You will receive:
7
- - Your user's profile, intents, and context
8
- - The other user's profile, intents, and context
9
- - The proposal or counter-proposal from the other agent
10
- - Full negotiation history
11
-
12
- Your job:
13
- 1. Critically evaluate whether this match genuinely serves YOUR user's intents.
14
- 2. Respond with one of:
15
- - "accept" — the match is genuinely valuable for your user. Both sides benefit.
16
- - "reject" — the match does not serve your user's needs. Explain clearly why.
17
- - "counter" — partially convinced but have specific objections. State what's missing or weak.
18
-
19
- Rules:
20
- - Be skeptical. Your job is to protect your user from noise.
21
- - Don't accept just because the other agent is enthusiastic.
22
- - Look for concrete intent alignment, not vague overlap.
23
- - If the other agent addressed your previous objections well, acknowledge it.
24
- - If their counter didn't address your concerns, reject.
25
- - Your fitScore should reflect YOUR independent assessment.
26
- - suggestedRoles: "agent" = can help, "patient" = seeks help, "peer" = mutual benefit.`;
27
- /**
28
- * Negotiation agent that evaluates proposals against its user's interests.
29
- * @remarks Uses structured output to produce a NegotiationTurn.
30
- */
31
- export class NegotiationResponder {
32
- constructor() {
33
- this.model = createModel("negotiationResponder").withStructuredOutput(NegotiationTurnSchema, { name: "negotiation_responder" });
34
- }
35
- /**
36
- * Evaluate a proposal/counter and respond.
37
- * @param input - User contexts, seed assessment, and negotiation history
38
- * @returns A structured NegotiationTurn (accept/reject/counter)
39
- */
40
- async invoke(input) {
41
- const historyText = input.history
42
- .map((t, i) => `Turn ${i + 1}: ${t.action} — fitScore: ${t.assessment.fitScore}, reasoning: ${t.assessment.reasoning}`)
43
- .join("\n");
44
- const userMessage = `YOUR USER:
45
- Name: ${input.ownUser.profile.name ?? "Unknown"}
46
- Bio: ${input.ownUser.profile.bio ?? "N/A"}
47
- Skills: ${input.ownUser.profile.skills?.join(", ") ?? "N/A"}
48
- Intents: ${input.ownUser.intents.map((i) => `- ${i.title}: ${i.description} (confidence: ${i.confidence})`).join("\n")}
49
-
50
- OTHER USER (proposing the match):
51
- Name: ${input.otherUser.profile.name ?? "Unknown"}
52
- Bio: ${input.otherUser.profile.bio ?? "N/A"}
53
- Skills: ${input.otherUser.profile.skills?.join(", ") ?? "N/A"}
54
- Intents: ${input.otherUser.intents.map((i) => `- ${i.title}: ${i.description} (confidence: ${i.confidence})`).join("\n")}
55
-
56
- INDEX CONTEXT: ${input.indexContext.prompt || "General discovery"}
57
-
58
- EVALUATOR PRE-SCREEN: Score ${input.seedAssessment.score}/100 — ${input.seedAssessment.reasoning}
59
-
60
- NEGOTIATION HISTORY:
61
- ${historyText}
62
-
63
- Evaluate the latest proposal/counter from the other agent. Does this match genuinely serve your user?`;
64
- const result = await this.model.invoke([
65
- { role: "system", content: SYSTEM_PROMPT },
66
- { role: "user", content: userMessage },
67
- ]);
68
- return result;
69
- }
70
- }
71
- //# sourceMappingURL=negotiation.responder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation.responder.js","sourceRoot":"","sources":["../../src/negotiation/negotiation.responder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAA0E,MAAM,wBAAwB,CAAC;AAEvI,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;uFAuBiE,CAAC;AAUxF;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAG/B;QACE,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,sBAAsB,CAAC,CAAC,oBAAoB,CACnE,qBAAqB,EACrB,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAClC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,KAAgC;QAC3C,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO;aAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,gBAAgB,CAAC,CAAC,UAAU,CAAC,QAAQ,gBAAgB,CAAC,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;aACtH,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,MAAM,WAAW,GAAG;QAChB,KAAK,CAAC,OAAO,CAAC,OAA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