@indexnetwork/protocol 0.16.0-rc.39.1 → 0.17.0-rc.41.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 (42) hide show
  1. package/README.md +0 -2
  2. package/dist/agent/agent.tools.d.ts +1 -1
  3. package/dist/agent/agent.tools.d.ts.map +1 -1
  4. package/dist/agent/agent.tools.js +5 -132
  5. package/dist/agent/agent.tools.js.map +1 -1
  6. package/dist/chat/chat.agent.d.ts +7 -0
  7. package/dist/chat/chat.agent.d.ts.map +1 -1
  8. package/dist/chat/chat.agent.js +16 -2
  9. package/dist/chat/chat.agent.js.map +1 -1
  10. package/dist/negotiation/negotiation.graph.d.ts +12 -0
  11. package/dist/negotiation/negotiation.graph.d.ts.map +1 -1
  12. package/dist/negotiation/negotiation.graph.js +27 -5
  13. package/dist/negotiation/negotiation.graph.js.map +1 -1
  14. package/dist/opportunity/opportunity.discover.d.ts +19 -0
  15. package/dist/opportunity/opportunity.discover.d.ts.map +1 -1
  16. package/dist/opportunity/opportunity.discover.js +25 -2
  17. package/dist/opportunity/opportunity.discover.js.map +1 -1
  18. package/dist/opportunity/opportunity.enricher.d.ts +20 -1
  19. package/dist/opportunity/opportunity.enricher.d.ts.map +1 -1
  20. package/dist/opportunity/opportunity.enricher.js +15 -1
  21. package/dist/opportunity/opportunity.enricher.js.map +1 -1
  22. package/dist/opportunity/opportunity.graph.d.ts +57 -0
  23. package/dist/opportunity/opportunity.graph.d.ts.map +1 -1
  24. package/dist/opportunity/opportunity.graph.js +92 -5
  25. package/dist/opportunity/opportunity.graph.js.map +1 -1
  26. package/dist/opportunity/opportunity.state.d.ts +65 -0
  27. package/dist/opportunity/opportunity.state.d.ts.map +1 -1
  28. package/dist/opportunity/opportunity.state.js +50 -0
  29. package/dist/opportunity/opportunity.state.js.map +1 -1
  30. package/dist/opportunity/opportunity.tools.d.ts.map +1 -1
  31. package/dist/opportunity/opportunity.tools.js +15 -0
  32. package/dist/opportunity/opportunity.tools.js.map +1 -1
  33. package/dist/shared/agent/tool.helpers.d.ts +3 -3
  34. package/dist/shared/agent/tool.helpers.js +3 -3
  35. package/dist/shared/interfaces/agent.interface.d.ts +2 -2
  36. package/dist/shared/interfaces/agent.interface.d.ts.map +1 -1
  37. package/dist/shared/interfaces/database.interface.d.ts +13 -3
  38. package/dist/shared/interfaces/database.interface.d.ts.map +1 -1
  39. package/dist/shared/observability/request-context.d.ts +30 -1
  40. package/dist/shared/observability/request-context.d.ts.map +1 -1
  41. package/dist/shared/observability/request-context.js.map +1 -1
  42. package/package.json +1 -1
@@ -1,14 +1,43 @@
1
+ import type { Opportunity } from "../interfaces/database.interface.js";
1
2
  import { AsyncLocalStorage } from "async_hooks";
2
- /** Callback for streaming graph/agent trace events from deep inside graph nodes. */
3
+ /**
4
+ * Callback for streaming trace / domain events from deep inside graph nodes
5
+ * back to the caller (typically chat.agent's stream pipeline).
6
+ *
7
+ * Carries two flavors of event:
8
+ * - Trace events (`graph_start | graph_end | agent_start | agent_end`) — used
9
+ * by the chat TRACE panel to visualize what the agent is doing.
10
+ * - Domain events (`opportunity_draft_ready`) — emitted by the orchestrator
11
+ * branch of OpportunityGraph.negotiateNode so the frontend can render each
12
+ * accepted draft card progressively as its negotiation resolves.
13
+ *
14
+ * Kept as a single emitter rather than splitting into two to minimize plumbing
15
+ * through AsyncLocalStorage; the chat.agent relay branches on event.type.
16
+ */
3
17
  export type TraceEmitter = (event: {
4
18
  type: "graph_start" | "graph_end" | "agent_start" | "agent_end";
5
19
  name: string;
6
20
  durationMs?: number;
7
21
  summary?: string;
22
+ } | {
23
+ type: "opportunity_draft_ready";
24
+ opportunityId: string;
25
+ opportunity: Opportunity;
8
26
  }) => void;
9
27
  interface RequestContext {
10
28
  originUrl?: string;
11
29
  traceEmitter?: TraceEmitter;
30
+ /**
31
+ * Signal for cooperative cancellation — propagates the caller's AbortSignal
32
+ * into long-running graph nodes (e.g. orchestrator negotiation fan-out) so
33
+ * they can stop emitting events when the chat session closes.
34
+ *
35
+ * The orchestrator branch checks this before persisting status flips or
36
+ * pushing `opportunity_draft_ready` events. In-flight negotiations are not
37
+ * forcibly cancelled — they finish or time out naturally via their park
38
+ * window — but their results are suppressed once the signal trips.
39
+ */
40
+ abortSignal?: AbortSignal;
12
41
  }
13
42
  /**
14
43
  * AsyncLocalStorage for propagating request-scoped context through the protocol layer.
@@ -1 +1 @@
1
- {"version":3,"file":"request-context.d.ts","sourceRoot":"","sources":["../../../src/shared/observability/request-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,oFAAoF;AACpF,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE;IACjC,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,KAAK,IAAI,CAAC;AAEX,UAAU,cAAc;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,mCAA0C,CAAC"}
1
+ {"version":3,"file":"request-context.d.ts","sourceRoot":"","sources":["../../../src/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;CAC1B,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 +1 @@
1
- {"version":3,"file":"request-context.js","sourceRoot":"","sources":["../../../src/shared/observability/request-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAehD;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,iBAAiB,EAAkB,CAAC"}
1
+ {"version":3,"file":"request-context.js","sourceRoot":"","sources":["../../../src/shared/observability/request-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AA+ChD;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,iBAAiB,EAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/protocol",
3
- "version": "0.16.0-rc.39.1",
3
+ "version": "0.17.0-rc.41.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",