@indexnetwork/protocol 4.5.0-rc.337.1 → 4.5.0-rc.339.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 (46) hide show
  1. package/dist/chat/negotiator.persona.d.ts.map +1 -1
  2. package/dist/chat/negotiator.persona.js +15 -1
  3. package/dist/chat/negotiator.persona.js.map +1 -1
  4. package/dist/chat/negotiator.prompt.d.ts +15 -0
  5. package/dist/chat/negotiator.prompt.d.ts.map +1 -1
  6. package/dist/chat/negotiator.prompt.js +22 -2
  7. package/dist/chat/negotiator.prompt.js.map +1 -1
  8. package/dist/chat/negotiator.tools.d.ts +45 -0
  9. package/dist/chat/negotiator.tools.d.ts.map +1 -0
  10. package/dist/chat/negotiator.tools.js +137 -0
  11. package/dist/chat/negotiator.tools.js.map +1 -0
  12. package/dist/index.d.ts +4 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +2 -0
  15. package/dist/index.js.map +1 -1
  16. package/dist/negotiation/negotiation.agent.d.ts +7 -0
  17. package/dist/negotiation/negotiation.agent.d.ts.map +1 -1
  18. package/dist/negotiation/negotiation.agent.js +4 -2
  19. package/dist/negotiation/negotiation.agent.js.map +1 -1
  20. package/dist/negotiation/negotiation.graph.d.ts +21 -3
  21. package/dist/negotiation/negotiation.graph.d.ts.map +1 -1
  22. package/dist/negotiation/negotiation.graph.js +51 -3
  23. package/dist/negotiation/negotiation.graph.js.map +1 -1
  24. package/dist/negotiation/negotiation.memory.d.ts +58 -0
  25. package/dist/negotiation/negotiation.memory.d.ts.map +1 -0
  26. package/dist/negotiation/negotiation.memory.js +71 -0
  27. package/dist/negotiation/negotiation.memory.js.map +1 -0
  28. package/dist/negotiation/negotiation.screen.d.ts +8 -1
  29. package/dist/negotiation/negotiation.screen.d.ts.map +1 -1
  30. package/dist/negotiation/negotiation.screen.js +5 -3
  31. package/dist/negotiation/negotiation.screen.js.map +1 -1
  32. package/dist/negotiation/negotiation.state.d.ts +9 -0
  33. package/dist/negotiation/negotiation.state.d.ts.map +1 -1
  34. package/dist/negotiation/negotiation.state.js +11 -0
  35. package/dist/negotiation/negotiation.state.js.map +1 -1
  36. package/dist/shared/agent/tool.helpers.d.ts +9 -0
  37. package/dist/shared/agent/tool.helpers.d.ts.map +1 -1
  38. package/dist/shared/agent/tool.helpers.js.map +1 -1
  39. package/dist/shared/interfaces/agent-dispatcher.interface.d.ts +8 -0
  40. package/dist/shared/interfaces/agent-dispatcher.interface.d.ts.map +1 -1
  41. package/dist/shared/interfaces/agent-dispatcher.interface.js.map +1 -1
  42. package/dist/shared/interfaces/negotiator-memory.interface.d.ts +59 -0
  43. package/dist/shared/interfaces/negotiator-memory.interface.d.ts.map +1 -0
  44. package/dist/shared/interfaces/negotiator-memory.interface.js +12 -0
  45. package/dist/shared/interfaces/negotiator-memory.interface.js.map +1 -0
  46. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"agent-dispatcher.interface.js","sourceRoot":"/","sources":["shared/interfaces/agent-dispatcher.interface.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","sourcesContent":["/**\n * AgentDispatcher interface for the negotiation graph.\n *\n * The graph calls dispatch() per turn and receives a result.\n * It never knows about webhooks, MCP, transports, or agent resolution.\n * The concrete implementation lives in the host application.\n */\n\nimport type { NegotiationTurn, UserNegotiationContext, SeedAssessment } from '../schemas/negotiation-state.schema.js';\n\n/** Payload sent to the dispatcher for each negotiation turn. */\nexport interface NegotiationTurnPayload {\n negotiationId: string;\n ownUser: UserNegotiationContext;\n otherUser: UserNegotiationContext;\n indexContext: { networkId: string; prompt?: string };\n seedAssessment: SeedAssessment;\n history: NegotiationTurn[];\n isFinalTurn: boolean;\n /** Whether ownUser is the party that initiated the discovery. */\n isDiscoverer: boolean;\n /** The explicit search query that triggered this discovery (if any). Takes priority over background intents. */\n discoveryQuery?: string;\n /** The acting user's seat under the v2 client-advocate protocol (`initiator` | `counterparty`). */\n seat?: string;\n /** Negotiation protocol version for this task (`v1` | `v2`). */\n protocolVersion?: string;\n /** Actions the acting seat may submit on this turn (seat + version + final-turn scoped). */\n allowedActions?: string[];\n}\n\n/** Result of a dispatch attempt. */\nexport type AgentDispatchResult =\n | { handled: true; turn: NegotiationTurn }\n | { handled: false; reason: 'no_agent' | 'timeout' }\n | { handled: false; reason: 'waiting'; resumeToken: string };\n\n/**\n * Dispatches a negotiation turn to the appropriate agent.\n * Tries external (poller) agents first, falls back to system agent.\n */\nexport interface AgentDispatcher {\n /**\n * Attempt to dispatch a negotiation turn to an external (poller) agent.\n * @param userId - The user whose agent should handle this turn\n * @param scope - Permission scope for agent resolution\n * @param payload - Turn context (users, history, seed assessment)\n * @param options - Timeout configuration\n * @returns Handled result with turn, or unhandled result with reason\n */\n dispatch(\n userId: string,\n scope: { action: string; scopeType: string; scopeId?: string },\n payload: NegotiationTurnPayload,\n options: { timeoutMs: number },\n ): Promise<AgentDispatchResult>;\n\n /**\n * Check whether a user has an authorized external (poller) agent for the given\n * scope. Used at init to determine scenario-based turn caps. Type-only by design\n * (no heartbeat freshness) — see IND-410.\n */\n hasExternalAgent(\n userId: string,\n scope: { action: string; scopeType: string; scopeId?: string },\n ): Promise<boolean>;\n}\n"]}
1
+ {"version":3,"file":"agent-dispatcher.interface.js","sourceRoot":"/","sources":["shared/interfaces/agent-dispatcher.interface.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","sourcesContent":["/**\n * AgentDispatcher interface for the negotiation graph.\n *\n * The graph calls dispatch() per turn and receives a result.\n * It never knows about webhooks, MCP, transports, or agent resolution.\n * The concrete implementation lives in the host application.\n */\n\nimport type { NegotiationTurn, UserNegotiationContext, SeedAssessment } from '../schemas/negotiation-state.schema.js';\nimport type { NegotiatorMemoryEntry } from '../../negotiation/negotiation.memory.js';\n\n/** Payload sent to the dispatcher for each negotiation turn. */\nexport interface NegotiationTurnPayload {\n negotiationId: string;\n ownUser: UserNegotiationContext;\n otherUser: UserNegotiationContext;\n indexContext: { networkId: string; prompt?: string };\n seedAssessment: SeedAssessment;\n history: NegotiationTurn[];\n isFinalTurn: boolean;\n /** Whether ownUser is the party that initiated the discovery. */\n isDiscoverer: boolean;\n /** The explicit search query that triggered this discovery (if any). Takes priority over background intents. */\n discoveryQuery?: string;\n /** The acting user's seat under the v2 client-advocate protocol (`initiator` | `counterparty`). */\n seat?: string;\n /** Negotiation protocol version for this task (`v1` | `v2`). */\n protocolVersion?: string;\n /** Actions the acting seat may submit on this turn (seat + version + final-turn scoped). */\n allowedActions?: string[];\n /**\n * The acting user's OWN negotiator memories (P5.3 read path) — private\n * context for the dispatched agent. Never contains the counterparty's\n * memory; absent when `NEGOTIATOR_MEMORY_INJECT` is off or nothing was\n * retrieved.\n */\n negotiatorMemory?: NegotiatorMemoryEntry[];\n}\n\n/** Result of a dispatch attempt. */\nexport type AgentDispatchResult =\n | { handled: true; turn: NegotiationTurn }\n | { handled: false; reason: 'no_agent' | 'timeout' }\n | { handled: false; reason: 'waiting'; resumeToken: string };\n\n/**\n * Dispatches a negotiation turn to the appropriate agent.\n * Tries external (poller) agents first, falls back to system agent.\n */\nexport interface AgentDispatcher {\n /**\n * Attempt to dispatch a negotiation turn to an external (poller) agent.\n * @param userId - The user whose agent should handle this turn\n * @param scope - Permission scope for agent resolution\n * @param payload - Turn context (users, history, seed assessment)\n * @param options - Timeout configuration\n * @returns Handled result with turn, or unhandled result with reason\n */\n dispatch(\n userId: string,\n scope: { action: string; scopeType: string; scopeId?: string },\n payload: NegotiationTurnPayload,\n options: { timeoutMs: number },\n ): Promise<AgentDispatchResult>;\n\n /**\n * Check whether a user has an authorized external (poller) agent for the given\n * scope. Used at init to determine scenario-based turn caps. Type-only by design\n * (no heartbeat freshness) — see IND-410.\n */\n hasExternalAgent(\n userId: string,\n scope: { action: string; scopeType: string; scopeId?: string },\n ): Promise<boolean>;\n}\n"]}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Host bridge for the negotiator persona's `remember`/`forget` chat tools
3
+ * (P5.4 / IND-408).
4
+ *
5
+ * The negotiator's private memory store lives on the host (API) side; the
6
+ * protocol package only ever sees this narrow surface. The bridge is
7
+ * injected by the composition root ONLY into the negotiator persona's
8
+ * toolset — the orchestrator registry never registers these tools — and
9
+ * only when the host's memory write flag is on.
10
+ */
11
+ /** Memory kinds the client can create directly from chat. Deliberately
12
+ * excludes `counterparty_dossier`: dossiers are distilled from negotiation
13
+ * transcripts, not dictated. */
14
+ export type RememberableMemoryKind = "disclosure_rule" | "playbook" | "threshold";
15
+ export interface NegotiatorMemoryRememberInput {
16
+ kind: RememberableMemoryKind;
17
+ /** The rule as one self-contained sentence (what the client actually said). */
18
+ content: string;
19
+ /** Chat session the instruction came from (provenance). */
20
+ sessionId?: string;
21
+ }
22
+ /** A remembered/deleted row, shaped for chat rendering (no embedding, no refs). */
23
+ export interface NegotiatorMemoryToolView {
24
+ id: string;
25
+ kind: string;
26
+ content: string;
27
+ }
28
+ export type NegotiatorMemoryForgetResult =
29
+ /** Exactly one memory matched and was deleted. */
30
+ {
31
+ status: "deleted";
32
+ memory: NegotiatorMemoryToolView;
33
+ }
34
+ /** Several memories matched; the client must pick one (re-call with memoryId). */
35
+ | {
36
+ status: "ambiguous";
37
+ candidates: NegotiatorMemoryToolView[];
38
+ }
39
+ /** Nothing matched the reference/description. */
40
+ | {
41
+ status: "not_found";
42
+ };
43
+ export interface NegotiatorMemoryToolsHost {
44
+ /**
45
+ * Persist a standing rule the client just stated in chat.
46
+ * Returns null when memory writes are disabled on the host.
47
+ */
48
+ remember(userId: string, input: NegotiatorMemoryRememberInput): Promise<NegotiatorMemoryToolView | null>;
49
+ /**
50
+ * Delete a memory by id or by the client's description of it.
51
+ * Deletion is always honored regardless of the write flag — forgetting is
52
+ * the client's standing right.
53
+ */
54
+ forget(userId: string, input: {
55
+ memoryId?: string;
56
+ description?: string;
57
+ }): Promise<NegotiatorMemoryForgetResult>;
58
+ }
59
+ //# sourceMappingURL=negotiator-memory.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"negotiator-memory.interface.d.ts","sourceRoot":"/","sources":["shared/interfaces/negotiator-memory.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;iCAEiC;AACjC,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,GAAG,UAAU,GAAG,WAAW,CAAC;AAElF,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,sBAAsB,CAAC;IAC7B,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,mFAAmF;AACnF,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,4BAA4B;AACtC,kDAAkD;AAChD;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,wBAAwB,CAAA;CAAE;AACzD,kFAAkF;GAChF;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,UAAU,EAAE,wBAAwB,EAAE,CAAA;CAAE;AACjE,iDAAiD;GAC/C;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,CAAC;AAE5B,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,QAAQ,CACN,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,6BAA6B,GACnC,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAAC;IAC5C;;;;OAIG;IACH,MAAM,CACJ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GACjD,OAAO,CAAC,4BAA4B,CAAC,CAAC;CAC1C"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Host bridge for the negotiator persona's `remember`/`forget` chat tools
3
+ * (P5.4 / IND-408).
4
+ *
5
+ * The negotiator's private memory store lives on the host (API) side; the
6
+ * protocol package only ever sees this narrow surface. The bridge is
7
+ * injected by the composition root ONLY into the negotiator persona's
8
+ * toolset — the orchestrator registry never registers these tools — and
9
+ * only when the host's memory write flag is on.
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=negotiator-memory.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"negotiator-memory.interface.js","sourceRoot":"/","sources":["shared/interfaces/negotiator-memory.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG","sourcesContent":["/**\n * Host bridge for the negotiator persona's `remember`/`forget` chat tools\n * (P5.4 / IND-408).\n *\n * The negotiator's private memory store lives on the host (API) side; the\n * protocol package only ever sees this narrow surface. The bridge is\n * injected by the composition root ONLY into the negotiator persona's\n * toolset — the orchestrator registry never registers these tools — and\n * only when the host's memory write flag is on.\n */\n\n/** Memory kinds the client can create directly from chat. Deliberately\n * excludes `counterparty_dossier`: dossiers are distilled from negotiation\n * transcripts, not dictated. */\nexport type RememberableMemoryKind = \"disclosure_rule\" | \"playbook\" | \"threshold\";\n\nexport interface NegotiatorMemoryRememberInput {\n kind: RememberableMemoryKind;\n /** The rule as one self-contained sentence (what the client actually said). */\n content: string;\n /** Chat session the instruction came from (provenance). */\n sessionId?: string;\n}\n\n/** A remembered/deleted row, shaped for chat rendering (no embedding, no refs). */\nexport interface NegotiatorMemoryToolView {\n id: string;\n kind: string;\n content: string;\n}\n\nexport type NegotiatorMemoryForgetResult =\n /** Exactly one memory matched and was deleted. */\n | { status: \"deleted\"; memory: NegotiatorMemoryToolView }\n /** Several memories matched; the client must pick one (re-call with memoryId). */\n | { status: \"ambiguous\"; candidates: NegotiatorMemoryToolView[] }\n /** Nothing matched the reference/description. */\n | { status: \"not_found\" };\n\nexport interface NegotiatorMemoryToolsHost {\n /**\n * Persist a standing rule the client just stated in chat.\n * Returns null when memory writes are disabled on the host.\n */\n remember(\n userId: string,\n input: NegotiatorMemoryRememberInput,\n ): Promise<NegotiatorMemoryToolView | null>;\n /**\n * Delete a memory by id or by the client's description of it.\n * Deletion is always honored regardless of the write flag — forgetting is\n * the client's standing right.\n */\n forget(\n userId: string,\n input: { memoryId?: string; description?: string },\n ): Promise<NegotiatorMemoryForgetResult>;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/protocol",
3
- "version": "4.5.0-rc.337.1",
3
+ "version": "4.5.0-rc.339.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",