@indexnetwork/protocol 3.7.0-rc.277.1 → 3.7.1-rc.278.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 (86) hide show
  1. package/dist/agent/agent.tools.js +1 -1
  2. package/dist/agent/agent.tools.js.map +1 -1
  3. package/dist/chat/chat.agent.d.ts +6 -6
  4. package/dist/chat/chat.agent.d.ts.map +1 -1
  5. package/dist/chat/chat.agent.js +9 -9
  6. package/dist/chat/chat.agent.js.map +1 -1
  7. package/dist/chat/chat.graph.d.ts.map +1 -1
  8. package/dist/chat/chat.graph.js +3 -12
  9. package/dist/chat/chat.graph.js.map +1 -1
  10. package/dist/chat/chat.interrupt.classifier.d.ts.map +1 -1
  11. package/dist/chat/chat.interrupt.classifier.js +1 -3
  12. package/dist/chat/chat.interrupt.classifier.js.map +1 -1
  13. package/dist/chat/chat.suggester.js.map +1 -1
  14. package/dist/context/context.generator.d.ts +2 -0
  15. package/dist/context/context.generator.d.ts.map +1 -1
  16. package/dist/context/context.generator.js +8 -6
  17. package/dist/context/context.generator.js.map +1 -1
  18. package/dist/intent/intent.clarifier.d.ts +2 -0
  19. package/dist/intent/intent.clarifier.d.ts.map +1 -1
  20. package/dist/intent/intent.clarifier.js +9 -23
  21. package/dist/intent/intent.clarifier.js.map +1 -1
  22. package/dist/intent/intent.graph.d.ts.map +1 -1
  23. package/dist/intent/intent.graph.js +29 -26
  24. package/dist/intent/intent.graph.js.map +1 -1
  25. package/dist/intent/intent.tools.d.ts.map +1 -1
  26. package/dist/intent/intent.tools.js +18 -48
  27. package/dist/intent/intent.tools.js.map +1 -1
  28. package/dist/maintenance/maintenance.graph.d.ts.map +1 -1
  29. package/dist/maintenance/maintenance.graph.js +1 -2
  30. package/dist/maintenance/maintenance.graph.js.map +1 -1
  31. package/dist/mcp/mcp.server.d.ts.map +1 -1
  32. package/dist/mcp/mcp.server.js +2 -4
  33. package/dist/mcp/mcp.server.js.map +1 -1
  34. package/dist/negotiation/negotiation.graph.d.ts.map +1 -1
  35. package/dist/negotiation/negotiation.graph.js +13 -20
  36. package/dist/negotiation/negotiation.graph.js.map +1 -1
  37. package/dist/negotiation/negotiation.tools.d.ts.map +1 -1
  38. package/dist/negotiation/negotiation.tools.js +12 -12
  39. package/dist/negotiation/negotiation.tools.js.map +1 -1
  40. package/dist/network/indexer/indexer.graph.d.ts +9 -9
  41. package/dist/network/indexer/indexer.graph.d.ts.map +1 -1
  42. package/dist/network/indexer/indexer.graph.js.map +1 -1
  43. package/dist/network/network.graph.d.ts.map +1 -1
  44. package/dist/network/network.graph.js +19 -25
  45. package/dist/network/network.graph.js.map +1 -1
  46. package/dist/opportunity/feed/feed.categorizer.d.ts.map +1 -1
  47. package/dist/opportunity/feed/feed.categorizer.js +15 -20
  48. package/dist/opportunity/feed/feed.categorizer.js.map +1 -1
  49. package/dist/opportunity/feed/feed.graph.d.ts.map +1 -1
  50. package/dist/opportunity/feed/feed.graph.js +8 -10
  51. package/dist/opportunity/feed/feed.graph.js.map +1 -1
  52. package/dist/opportunity/opportunity.introducer.d.ts.map +1 -1
  53. package/dist/opportunity/opportunity.introducer.js +1 -2
  54. package/dist/opportunity/opportunity.introducer.js.map +1 -1
  55. package/dist/opportunity/opportunity.tools.d.ts.map +1 -1
  56. package/dist/opportunity/opportunity.tools.js +3 -2
  57. package/dist/opportunity/opportunity.tools.js.map +1 -1
  58. package/dist/profile/profile.enricher.d.ts +5 -7
  59. package/dist/profile/profile.enricher.d.ts.map +1 -1
  60. package/dist/profile/profile.enricher.js +8 -10
  61. package/dist/profile/profile.enricher.js.map +1 -1
  62. package/dist/profile/profile.generator.d.ts.map +1 -1
  63. package/dist/profile/profile.generator.js +1 -2
  64. package/dist/profile/profile.generator.js.map +1 -1
  65. package/dist/profile/profile.tools.js +1 -1
  66. package/dist/profile/profile.tools.js.map +1 -1
  67. package/dist/questioner/questioner.presets.d.ts.map +1 -1
  68. package/dist/questioner/questioner.presets.js +24 -38
  69. package/dist/questioner/questioner.presets.js.map +1 -1
  70. package/dist/shared/agent/tool.factory.d.ts.map +1 -1
  71. package/dist/shared/agent/tool.factory.js +1 -2
  72. package/dist/shared/agent/tool.factory.js.map +1 -1
  73. package/dist/shared/agent/tool.runtime.d.ts.map +1 -1
  74. package/dist/shared/agent/tool.runtime.js +20 -13
  75. package/dist/shared/agent/tool.runtime.js.map +1 -1
  76. package/dist/shared/hyde/hyde.graph.d.ts.map +1 -1
  77. package/dist/shared/hyde/hyde.graph.js +3 -2
  78. package/dist/shared/hyde/hyde.graph.js.map +1 -1
  79. package/dist/shared/hyde/hyde.strategies.d.ts +2 -1
  80. package/dist/shared/hyde/hyde.strategies.d.ts.map +1 -1
  81. package/dist/shared/hyde/hyde.strategies.js.map +1 -1
  82. package/dist/shared/observability/trace.d.ts +3 -3
  83. package/dist/shared/observability/trace.d.ts.map +1 -1
  84. package/dist/shared/observability/trace.js +19 -33
  85. package/dist/shared/observability/trace.js.map +1 -1
  86. package/package.json +1 -1
@@ -6,6 +6,7 @@
6
6
  * infers free-text "lenses" dynamically. This file re-exports the lens
7
7
  * types and provides constants for the HyDE pipeline.
8
8
  */
9
+ import type { HydeTargetCorpus } from './lens.inferrer.js';
9
10
  export type { Lens, HydeTargetCorpus, LensInferenceInput, LensInferenceOutput } from './lens.inferrer.js';
10
11
  /** Default cache TTL for ephemeral HyDE documents (1 hour). */
11
12
  export declare const HYDE_DEFAULT_CACHE_TTL = 3600;
@@ -13,5 +14,5 @@ export declare const HYDE_DEFAULT_CACHE_TTL = 3600;
13
14
  * Prompt templates for HyDE document generation.
14
15
  * Keyed by target corpus — the lens label provides the semantic specificity.
15
16
  */
16
- export declare const HYDE_CORPUS_PROMPTS: Record<'profiles' | 'intents' | 'premises', (sourceText: string, lens: string) => string>;
17
+ export declare const HYDE_CORPUS_PROMPTS: Record<HydeTargetCorpus, (sourceText: string, lens: string) => string>;
17
18
  //# sourceMappingURL=hyde.strategies.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hyde.strategies.d.ts","sourceRoot":"/","sources":["shared/hyde/hyde.strategies.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE1G,+DAA+D;AAC/D,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,UAAU,GAAG,SAAS,GAAG,UAAU,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAmBzH,CAAC"}
1
+ {"version":3,"file":"hyde.strategies.d.ts","sourceRoot":"/","sources":["shared/hyde/hyde.strategies.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE1G,+DAA+D;AAC/D,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAmBtG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"hyde.strategies.js","sourceRoot":"/","sources":["shared/hyde/hyde.strategies.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA8F;IAC5H,QAAQ,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;+EAC6C,UAAU;0EACf,IAAI;;;GAG3E;IACD,OAAO,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;+DAC8B,IAAI;6CACtB,UAAU;;;GAGpD;IACD,QAAQ,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;oGACkE,UAAU;0CACpE,IAAI;;;GAG3C;CACF,CAAC","sourcesContent":["/**\n * HyDE (Hypothetical Document Embeddings) type definitions.\n *\n * The system is now role-agnostic: instead of hardcoded strategy names\n * (mirror, reciprocal, mentor, investor, collaborator, hiree), an LLM\n * infers free-text \"lenses\" dynamically. This file re-exports the lens\n * types and provides constants for the HyDE pipeline.\n */\n\nexport type { Lens, HydeTargetCorpus, LensInferenceInput, LensInferenceOutput } from './lens.inferrer.js';\n\n/** Default cache TTL for ephemeral HyDE documents (1 hour). */\nexport const HYDE_DEFAULT_CACHE_TTL = 3600;\n\n/**\n * Prompt templates for HyDE document generation.\n * Keyed by target corpus — the lens label provides the semantic specificity.\n */\nexport const HYDE_CORPUS_PROMPTS: Record<'profiles' | 'intents' | 'premises', (sourceText: string, lens: string) => string> = {\n profiles: (sourceText, lens) => `\n Write a professional biography for someone who could fulfill this need: \"${sourceText}\".\n Focus on the specific expertise, background, and role described by: ${lens}.\n\n Write in first person. Include concrete skills, domain experience, and current professional focus that would make them a strong match.\n `,\n intents: (sourceText, lens) => `\n Write a goal or aspiration statement for someone who is: ${lens}.\n This person's needs would complement: \"${sourceText}\".\n\n Write in first person as if stating their own goal.\n `,\n premises: (sourceText, lens) => `\n Write a short self-description for someone whose identity, values, or worldview aligns with: \"${sourceText}\".\n Reflect the character described by: ${lens}.\n\n Write in first person as a stable statement of who this person is, not what they want.\n `,\n};\n"]}
1
+ {"version":3,"file":"hyde.strategies.js","sourceRoot":"/","sources":["shared/hyde/hyde.strategies.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA2E;IACzG,QAAQ,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;+EAC6C,UAAU;0EACf,IAAI;;;GAG3E;IACD,OAAO,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;+DAC8B,IAAI;6CACtB,UAAU;;;GAGpD;IACD,QAAQ,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;oGACkE,UAAU;0CACpE,IAAI;;;GAG3C;CACF,CAAC","sourcesContent":["/**\n * HyDE (Hypothetical Document Embeddings) type definitions.\n *\n * The system is now role-agnostic: instead of hardcoded strategy names\n * (mirror, reciprocal, mentor, investor, collaborator, hiree), an LLM\n * infers free-text \"lenses\" dynamically. This file re-exports the lens\n * types and provides constants for the HyDE pipeline.\n */\n\nimport type { HydeTargetCorpus } from './lens.inferrer.js';\n\nexport type { Lens, HydeTargetCorpus, LensInferenceInput, LensInferenceOutput } from './lens.inferrer.js';\n\n/** Default cache TTL for ephemeral HyDE documents (1 hour). */\nexport const HYDE_DEFAULT_CACHE_TTL = 3600;\n\n/**\n * Prompt templates for HyDE document generation.\n * Keyed by target corpus — the lens label provides the semantic specificity.\n */\nexport const HYDE_CORPUS_PROMPTS: Record<HydeTargetCorpus, (sourceText: string, lens: string) => string> = {\n profiles: (sourceText, lens) => `\n Write a professional biography for someone who could fulfill this need: \"${sourceText}\".\n Focus on the specific expertise, background, and role described by: ${lens}.\n\n Write in first person. Include concrete skills, domain experience, and current professional focus that would make them a strong match.\n `,\n intents: (sourceText, lens) => `\n Write a goal or aspiration statement for someone who is: ${lens}.\n This person's needs would complement: \"${sourceText}\".\n\n Write in first person as if stating their own goal.\n `,\n premises: (sourceText, lens) => `\n Write a short self-description for someone whose identity, values, or worldview aligns with: \"${sourceText}\".\n Reflect the character described by: ${lens}.\n\n Write in first person as a stable statement of who this person is, not what they want.\n `,\n};\n"]}
@@ -34,7 +34,7 @@ export declare function traceAgent<T>(name: string, fn: () => Promise<T>, summar
34
34
  * async run() { ... }
35
35
  * }
36
36
  */
37
- export declare function TraceGraph(name: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
37
+ export declare const TraceGraph: (name: string) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
38
38
  /**
39
39
  * Method decorator. Wraps the decorated async method in `traceAgent(name, ...)`.
40
40
  * Use on class methods that represent a single agent step (one LLM call,
@@ -46,7 +46,7 @@ export declare function TraceGraph(name: string): (target: any, propertyKey: str
46
46
  * async run() { ... }
47
47
  * }
48
48
  */
49
- export declare function TraceAgent(name: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
49
+ export declare const TraceAgent: (name: string) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
50
50
  /**
51
51
  * Method decorator. Wraps the decorated async method in `tracePhase(name, ...)`.
52
52
  * Use for logical groupings of inline work that aren't LangGraph state machines.
@@ -57,5 +57,5 @@ export declare function TraceAgent(name: string): (target: any, propertyKey: str
57
57
  * async run() { ... }
58
58
  * }
59
59
  */
60
- export declare function TracePhase(name: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
60
+ export declare const TracePhase: (name: string) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
61
61
  //# sourceMappingURL=trace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"trace.d.ts","sourceRoot":"/","sources":["shared/observability/trace.ts"],"names":[],"mappings":"AAuBA;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CASlF;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CASlF;AAED;;;;GAIG;AACH,wBAAsB,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,KAAK,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,GAC3C,OAAO,CAAC,CAAC,CAAC,CAeZ;AAsBD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,SAvBb,MAAM,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,KAAK,IAuBvC,CAAC;AAErD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,SApCb,MAAM,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,KAAK,IAoCvC,CAAC;AAErD;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,SAhDb,MAAM,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,KAAK,IAgDvC,CAAC"}
@@ -78,6 +78,22 @@ export async function traceAgent(name, fn, summarize) {
78
78
  emit?.({ type: "agent_end", name, durationMs, ...(summary ? { summary } : {}) });
79
79
  return value;
80
80
  }
81
+ /**
82
+ * Builds a method decorator that wraps the decorated async method in the given
83
+ * trace wrapper (`traceGraph` / `traceAgent` / `tracePhase`). Uses the legacy
84
+ * decorator shape already adopted by `@Timed()`.
85
+ */
86
+ function traceDecorator(wrap) {
87
+ return (name) =>
88
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
89
+ function (_target, _propertyKey, descriptor) {
90
+ const original = descriptor.value;
91
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
92
+ descriptor.value = function (...args) {
93
+ return wrap(name, () => original.apply(this, args));
94
+ };
95
+ };
96
+ }
81
97
  /**
82
98
  * Method decorator. Wraps the decorated async method in `traceGraph(name, ...)`.
83
99
  * Use on class methods that represent a logical "graph" (a sub-flow with
@@ -89,17 +105,7 @@ export async function traceAgent(name, fn, summarize) {
89
105
  * async run() { ... }
90
106
  * }
91
107
  */
92
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
93
- export function TraceGraph(name) {
94
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
95
- return function (_target, _propertyKey, descriptor) {
96
- const original = descriptor.value;
97
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
98
- descriptor.value = function (...args) {
99
- return traceGraph(name, () => original.apply(this, args));
100
- };
101
- };
102
- }
108
+ export const TraceGraph = traceDecorator(traceGraph);
103
109
  /**
104
110
  * Method decorator. Wraps the decorated async method in `traceAgent(name, ...)`.
105
111
  * Use on class methods that represent a single agent step (one LLM call,
@@ -111,17 +117,7 @@ export function TraceGraph(name) {
111
117
  * async run() { ... }
112
118
  * }
113
119
  */
114
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
115
- export function TraceAgent(name) {
116
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
117
- return function (_target, _propertyKey, descriptor) {
118
- const original = descriptor.value;
119
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
120
- descriptor.value = function (...args) {
121
- return traceAgent(name, () => original.apply(this, args));
122
- };
123
- };
124
- }
120
+ export const TraceAgent = traceDecorator(traceAgent);
125
121
  /**
126
122
  * Method decorator. Wraps the decorated async method in `tracePhase(name, ...)`.
127
123
  * Use for logical groupings of inline work that aren't LangGraph state machines.
@@ -132,15 +128,5 @@ export function TraceAgent(name) {
132
128
  * async run() { ... }
133
129
  * }
134
130
  */
135
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
136
- export function TracePhase(name) {
137
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
138
- return function (_target, _propertyKey, descriptor) {
139
- const original = descriptor.value;
140
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
141
- descriptor.value = function (...args) {
142
- return tracePhase(name, () => original.apply(this, args));
143
- };
144
- };
145
- }
131
+ export const TracePhase = traceDecorator(tracePhase);
146
132
  //# sourceMappingURL=trace.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"trace.js","sourceRoot":"/","sources":["shared/observability/trace.ts"],"names":[],"mappings":"AA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AAC,CAAC;QAC5D,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,8DAA8D;AAC9D,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,8DAA8D;IAC9D,OAAO,UAAU,OAAY,EAAE,YAAoB,EAAE,UAA8B;QACjF,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;QAClC,8DAA8D;QAC9D,UAAU,CAAC,KAAK,GAAG,UAAqB,GAAG,IAAW;YACpD,OAAO,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,8DAA8D;AAC9D,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,8DAA8D;IAC9D,OAAO,UAAU,OAAY,EAAE,YAAoB,EAAE,UAA8B;QACjF,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;QAClC,8DAA8D;QAC9D,UAAU,CAAC,KAAK,GAAG,UAAqB,GAAG,IAAW;YACpD,OAAO,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Trace helpers — wrap async work in `graph_start`/`graph_end` or\n * `agent_start`/`agent_end` events automatically. Pulls the emitter from the\n * ambient request context so callers don't pass it manually.\n *\n * Available in two flavours:\n * - Functional: `traceGraph(name, fn)` / `traceAgent(name, fn)` — for inline\n * blocks. Returns whatever the wrapped function returns.\n * - Decorator: `@TraceGraph(name)` / `@TraceAgent(name)` — for class methods.\n * Uses the legacy decorator shape already adopted by `@Timed()`.\n */\nimport { requestContext } from \"./request-context.js\";\n\ntype Emitter = (event: Record<string, unknown>) => void;\n\nfunction getEmitter(): Emitter | undefined {\n const raw = requestContext.getStore()?.traceEmitter;\n // The ambient TraceEmitter is typed against a constrained event union; we\n // emit a broader shape here. Same wide-cast pattern used elsewhere\n // (see opportunity.graph.ts, opportunity.discover.ts).\n return raw as unknown as Emitter | undefined;\n}\n\n/**\n * Wrap an async function so it emits `graph_start` / `graph_end` events around\n * its execution. `durationMs` is measured in wall time. If the wrapped\n * function throws, `graph_end` still fires before the error propagates.\n *\n * Use ONLY for actual LangGraph compiled state machines (Opportunity graph,\n * Negotiation graph, etc). For logical groupings of inline work, use\n * `tracePhase` — it has a distinct visual in the trace UI so users can tell\n * \"this is a graph\" from \"this is a phase\".\n */\nexport async function traceGraph<T>(name: string, fn: () => Promise<T>): Promise<T> {\n const emit = getEmitter();\n emit?.({ type: \"graph_start\", name });\n const start = Date.now();\n try {\n return await fn();\n } finally {\n emit?.({ type: \"graph_end\", name, durationMs: Date.now() - start });\n }\n}\n\n/**\n * Wrap an async function so it emits `phase_start` / `phase_end` events around\n * its execution. Phases are logical groupings of inline async work — they\n * share container semantics with graphs (they can host agents) but render\n * differently in the trace UI to make it clear they're NOT LangGraph state\n * machines.\n */\nexport async function tracePhase<T>(name: string, fn: () => Promise<T>): Promise<T> {\n const emit = getEmitter();\n emit?.({ type: \"phase_start\", name });\n const start = Date.now();\n try {\n return await fn();\n } finally {\n emit?.({ type: \"phase_end\", name, durationMs: Date.now() - start });\n }\n}\n\n/**\n * Wrap an async function so it emits `agent_start` / `agent_end` events. The\n * optional `summarize` callback produces a short string shown in the trace\n * panel; receives the wrapped function's resolved value.\n */\nexport async function traceAgent<T>(\n name: string,\n fn: () => Promise<T>,\n summarize?: (value: T) => string | undefined,\n): Promise<T> {\n const emit = getEmitter();\n emit?.({ type: \"agent_start\", name });\n const start = Date.now();\n let value: T;\n try {\n value = await fn();\n } catch (err) {\n emit?.({ type: \"agent_end\", name, durationMs: Date.now() - start });\n throw err;\n }\n const durationMs = Date.now() - start;\n const summary = summarize?.(value);\n emit?.({ type: \"agent_end\", name, durationMs, ...(summary ? { summary } : {}) });\n return value;\n}\n\n/**\n * Method decorator. Wraps the decorated async method in `traceGraph(name, ...)`.\n * Use on class methods that represent a logical \"graph\" (a sub-flow with\n * internal agent calls).\n *\n * @example\n * class RefinePhase {\n * @TraceGraph(\"Refine\")\n * async run() { ... }\n * }\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function TraceGraph(name: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) {\n const original = descriptor.value;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n descriptor.value = function (this: any, ...args: any[]) {\n return traceGraph(name, () => original.apply(this, args));\n };\n };\n}\n\n/**\n * Method decorator. Wraps the decorated async method in `traceAgent(name, ...)`.\n * Use on class methods that represent a single agent step (one LLM call,\n * one summarization, etc).\n *\n * @example\n * class ChatSummary {\n * @TraceAgent(\"Chat summary\")\n * async run() { ... }\n * }\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function TraceAgent(name: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) {\n const original = descriptor.value;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n descriptor.value = function (this: any, ...args: any[]) {\n return traceAgent(name, () => original.apply(this, args));\n };\n };\n}\n\n/**\n * Method decorator. Wraps the decorated async method in `tracePhase(name, ...)`.\n * Use for logical groupings of inline work that aren't LangGraph state machines.\n *\n * @example\n * class RefinePhase {\n * @TracePhase(\"Refine\")\n * async run() { ... }\n * }\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function TracePhase(name: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) {\n const original = descriptor.value;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n descriptor.value = function (this: any, ...args: any[]) {\n return tracePhase(name, () => original.apply(this, args));\n };\n };\n}\n"]}
1
+ {"version":3,"file":"trace.js","sourceRoot":"/","sources":["shared/observability/trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAItD,SAAS,UAAU;IACjB,MAAM,GAAG,GAAG,cAAc,CAAC,QAAQ,EAAE,EAAE,YAAY,CAAC;IACpD,0EAA0E;IAC1E,mEAAmE;IACnE,uDAAuD;IACvD,OAAO,GAAqC,CAAC;AAC/C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAI,IAAY,EAAE,EAAoB;IACpE,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC;IAC1B,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACzB,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,EAAE,CAAC;IACpB,CAAC;YAAS,CAAC;QACT,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAI,IAAY,EAAE,EAAoB;IACpE,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC;IAC1B,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACzB,IAAI,CAAC;QACH,OAAO,MA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,UAA8B;QAC1E,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;QAClC,8DAA8D;QAC9D,UAAU,CAAC,KAAK,GAAG,UAAqB,GAAG,IAAW;YACpD,OAAO,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QACtD,CAAC,CAAC;IACJ,CAAC,CAAC;AACN,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;AAErD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC","sourcesContent":["/**\n * Trace helpers — wrap async work in `graph_start`/`graph_end` or\n * `agent_start`/`agent_end` events automatically. Pulls the emitter from the\n * ambient request context so callers don't pass it manually.\n *\n * Available in two flavours:\n * - Functional: `traceGraph(name, fn)` / `traceAgent(name, fn)` — for inline\n * blocks. Returns whatever the wrapped function returns.\n * - Decorator: `@TraceGraph(name)` / `@TraceAgent(name)` — for class methods.\n * Uses the legacy decorator shape already adopted by `@Timed()`.\n */\nimport { requestContext } from \"./request-context.js\";\n\ntype Emitter = (event: Record<string, unknown>) => void;\n\nfunction getEmitter(): Emitter | undefined {\n const raw = requestContext.getStore()?.traceEmitter;\n // The ambient TraceEmitter is typed against a constrained event union; we\n // emit a broader shape here. Same wide-cast pattern used elsewhere\n // (see opportunity.graph.ts, opportunity.discover.ts).\n return raw as unknown as Emitter | undefined;\n}\n\n/**\n * Wrap an async function so it emits `graph_start` / `graph_end` events around\n * its execution. `durationMs` is measured in wall time. If the wrapped\n * function throws, `graph_end` still fires before the error propagates.\n *\n * Use ONLY for actual LangGraph compiled state machines (Opportunity graph,\n * Negotiation graph, etc). For logical groupings of inline work, use\n * `tracePhase` — it has a distinct visual in the trace UI so users can tell\n * \"this is a graph\" from \"this is a phase\".\n */\nexport async function traceGraph<T>(name: string, fn: () => Promise<T>): Promise<T> {\n const emit = getEmitter();\n emit?.({ type: \"graph_start\", name });\n const start = Date.now();\n try {\n return await fn();\n } finally {\n emit?.({ type: \"graph_end\", name, durationMs: Date.now() - start });\n }\n}\n\n/**\n * Wrap an async function so it emits `phase_start` / `phase_end` events around\n * its execution. Phases are logical groupings of inline async work — they\n * share container semantics with graphs (they can host agents) but render\n * differently in the trace UI to make it clear they're NOT LangGraph state\n * machines.\n */\nexport async function tracePhase<T>(name: string, fn: () => Promise<T>): Promise<T> {\n const emit = getEmitter();\n emit?.({ type: \"phase_start\", name });\n const start = Date.now();\n try {\n return await fn();\n } finally {\n emit?.({ type: \"phase_end\", name, durationMs: Date.now() - start });\n }\n}\n\n/**\n * Wrap an async function so it emits `agent_start` / `agent_end` events. The\n * optional `summarize` callback produces a short string shown in the trace\n * panel; receives the wrapped function's resolved value.\n */\nexport async function traceAgent<T>(\n name: string,\n fn: () => Promise<T>,\n summarize?: (value: T) => string | undefined,\n): Promise<T> {\n const emit = getEmitter();\n emit?.({ type: \"agent_start\", name });\n const start = Date.now();\n let value: T;\n try {\n value = await fn();\n } catch (err) {\n emit?.({ type: \"agent_end\", name, durationMs: Date.now() - start });\n throw err;\n }\n const durationMs = Date.now() - start;\n const summary = summarize?.(value);\n emit?.({ type: \"agent_end\", name, durationMs, ...(summary ? { summary } : {}) });\n return value;\n}\n\n/**\n * Builds a method decorator that wraps the decorated async method in the given\n * trace wrapper (`traceGraph` / `traceAgent` / `tracePhase`). Uses the legacy\n * decorator shape already adopted by `@Timed()`.\n */\nfunction traceDecorator(\n wrap: <T>(name: string, fn: () => Promise<T>) => Promise<T>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): (name: string) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void {\n return (name: string) =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) {\n const original = descriptor.value;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n descriptor.value = function (this: any, ...args: any[]) {\n return wrap(name, () => original.apply(this, args));\n };\n };\n}\n\n/**\n * Method decorator. Wraps the decorated async method in `traceGraph(name, ...)`.\n * Use on class methods that represent a logical \"graph\" (a sub-flow with\n * internal agent calls).\n *\n * @example\n * class RefinePhase {\n * @TraceGraph(\"Refine\")\n * async run() { ... }\n * }\n */\nexport const TraceGraph = traceDecorator(traceGraph);\n\n/**\n * Method decorator. Wraps the decorated async method in `traceAgent(name, ...)`.\n * Use on class methods that represent a single agent step (one LLM call,\n * one summarization, etc).\n *\n * @example\n * class ChatSummary {\n * @TraceAgent(\"Chat summary\")\n * async run() { ... }\n * }\n */\nexport const TraceAgent = traceDecorator(traceAgent);\n\n/**\n * Method decorator. Wraps the decorated async method in `tracePhase(name, ...)`.\n * Use for logical groupings of inline work that aren't LangGraph state machines.\n *\n * @example\n * class RefinePhase {\n * @TracePhase(\"Refine\")\n * async run() { ... }\n * }\n */\nexport const TracePhase = traceDecorator(tracePhase);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/protocol",
3
- "version": "3.7.0-rc.277.1",
3
+ "version": "3.7.1-rc.278.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",