@warlock.js/ai-panoptic 5.31.0 → 5.33.0

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 (146) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/cjs/index.cjs +72 -67
  3. package/cjs/index.cjs.map +1 -1
  4. package/esm/collector/collector.d.mts +3 -5
  5. package/esm/collector/collector.d.mts.map +1 -1
  6. package/esm/collector/collector.mjs +2 -0
  7. package/esm/collector/collector.mjs.map +1 -1
  8. package/esm/collector/content-capture.type.d.mts +4 -5
  9. package/esm/collector/content-capture.type.d.mts.map +1 -1
  10. package/esm/collector/extract-span-attributes.d.mts +1 -3
  11. package/esm/collector/extract-span-attributes.d.mts.map +1 -1
  12. package/esm/collector/extract-span-attributes.mjs +30 -6
  13. package/esm/collector/extract-span-attributes.mjs.map +1 -1
  14. package/esm/collector/index.d.mts +3 -1
  15. package/esm/collector/index.mjs +2 -1
  16. package/esm/collector/normalize-error.d.mts +1 -3
  17. package/esm/collector/normalize-error.d.mts.map +1 -1
  18. package/esm/collector/report-to-span.d.mts +1 -3
  19. package/esm/collector/report-to-span.d.mts.map +1 -1
  20. package/esm/collector/report-to-trace.d.mts +1 -3
  21. package/esm/collector/report-to-trace.d.mts.map +1 -1
  22. package/esm/collector/trace-subscriptions.d.mts +14 -0
  23. package/esm/collector/trace-subscriptions.d.mts.map +1 -0
  24. package/esm/collector/trace-subscriptions.mjs +26 -0
  25. package/esm/collector/trace-subscriptions.mjs.map +1 -0
  26. package/esm/config/apply-panoptic-config.d.mts +2 -3
  27. package/esm/config/apply-panoptic-config.d.mts.map +1 -1
  28. package/esm/config/index.d.mts +2 -1
  29. package/esm/config/index.mjs +1 -1
  30. package/esm/config/panoptic-config.type.d.mts +2 -4
  31. package/esm/config/panoptic-config.type.d.mts.map +1 -1
  32. package/esm/contracts/collector.contract.d.mts +1 -3
  33. package/esm/contracts/collector.contract.d.mts.map +1 -1
  34. package/esm/contracts/exporter.contract.d.mts +1 -3
  35. package/esm/contracts/exporter.contract.d.mts.map +1 -1
  36. package/esm/contracts/index.d.mts +2 -1
  37. package/esm/contracts/trace.type.d.mts +37 -20
  38. package/esm/contracts/trace.type.d.mts.map +1 -1
  39. package/esm/dashboard/dashboard.d.mts +1 -3
  40. package/esm/dashboard/dashboard.d.mts.map +1 -1
  41. package/esm/dashboard/dashboard.mjs +3 -2
  42. package/esm/dashboard/dashboard.mjs.map +1 -1
  43. package/esm/dashboard/dashboard.type.d.mts +9 -7
  44. package/esm/dashboard/dashboard.type.d.mts.map +1 -1
  45. package/esm/dashboard/index.d.mts +4 -1
  46. package/esm/dashboard/index.mjs +1 -1
  47. package/esm/dashboard/parse-query.d.mts +1 -1
  48. package/esm/dashboard/serve.d.mts +2 -1
  49. package/esm/dashboard/serve.mjs +1 -1
  50. package/esm/dashboard/serve.mjs.map +1 -1
  51. package/esm/dashboard/trace-filter.d.mts +44 -32
  52. package/esm/dashboard/trace-filter.d.mts.map +1 -1
  53. package/esm/evaluate/evaluate-system-prompt.d.mts +1 -3
  54. package/esm/evaluate/evaluate-system-prompt.d.mts.map +1 -1
  55. package/esm/evaluate/evaluate-system-prompt.mjs +3 -1
  56. package/esm/evaluate/evaluate-system-prompt.mjs.map +1 -1
  57. package/esm/evaluate/evaluate.type.d.mts +2 -4
  58. package/esm/evaluate/evaluate.type.d.mts.map +1 -1
  59. package/esm/evaluate/extract-last-system-prompt.d.mts +1 -3
  60. package/esm/evaluate/extract-last-system-prompt.d.mts.map +1 -1
  61. package/esm/evaluate/find-span-by-id.d.mts +1 -3
  62. package/esm/evaluate/find-span-by-id.d.mts.map +1 -1
  63. package/esm/evaluate/index.d.mts +2 -1
  64. package/esm/evaluate/index.mjs +1 -1
  65. package/esm/exporters/console/console-exporter.d.mts +2 -3
  66. package/esm/exporters/console/console-exporter.d.mts.map +1 -1
  67. package/esm/exporters/console/console-exporter.type.d.mts +2 -3
  68. package/esm/exporters/console/console-exporter.type.d.mts.map +1 -1
  69. package/esm/exporters/console/format-span-io.d.mts +2 -2
  70. package/esm/exporters/console/format-span-io.d.mts.map +1 -1
  71. package/esm/exporters/console/format-span-line.d.mts +2 -2
  72. package/esm/exporters/console/format-span-line.d.mts.map +1 -1
  73. package/esm/exporters/console/index.d.mts +2 -1
  74. package/esm/exporters/console/index.mjs +1 -1
  75. package/esm/exporters/file/file-exporter.d.mts +2 -3
  76. package/esm/exporters/file/file-exporter.d.mts.map +1 -1
  77. package/esm/exporters/file/file-exporter.type.d.mts +8 -5
  78. package/esm/exporters/file/file-exporter.type.d.mts.map +1 -1
  79. package/esm/exporters/file/index.d.mts +2 -1
  80. package/esm/exporters/index.d.mts +7 -1
  81. package/esm/exporters/index.mjs +1 -1
  82. package/esm/exporters/langfuse/index.d.mts +2 -1
  83. package/esm/exporters/langfuse/index.mjs +1 -1
  84. package/esm/exporters/langfuse/langfuse-exporter.d.mts +2 -3
  85. package/esm/exporters/langfuse/langfuse-exporter.d.mts.map +1 -1
  86. package/esm/exporters/langfuse/langfuse-exporter.mjs +1 -1
  87. package/esm/exporters/langfuse/langfuse-exporter.mjs.map +1 -1
  88. package/esm/exporters/langfuse/langfuse-exporter.type.d.mts +23 -17
  89. package/esm/exporters/langfuse/langfuse-exporter.type.d.mts.map +1 -1
  90. package/esm/exporters/otel/index.d.mts +2 -1
  91. package/esm/exporters/otel/index.mjs +1 -1
  92. package/esm/exporters/otel/otel-api.shim.type.d.mts +6 -7
  93. package/esm/exporters/otel/otel-api.shim.type.d.mts.map +1 -1
  94. package/esm/exporters/otel/otel-exporter.d.mts +2 -3
  95. package/esm/exporters/otel/otel-exporter.d.mts.map +1 -1
  96. package/esm/exporters/otel/otel-exporter.type.d.mts +1 -3
  97. package/esm/exporters/otel/otel-exporter.type.d.mts.map +1 -1
  98. package/esm/exporters/utils/gen-ai-attributes.d.mts +9 -7
  99. package/esm/exporters/utils/gen-ai-attributes.d.mts.map +1 -1
  100. package/esm/exporters/utils/index.d.mts +2 -1
  101. package/esm/exporters/utils/index.mjs +1 -1
  102. package/esm/exporters/utils/total-cost.d.mts +1 -3
  103. package/esm/exporters/utils/total-cost.d.mts.map +1 -1
  104. package/esm/exporters/utils/walk-spans.d.mts +2 -2
  105. package/esm/exporters/utils/walk-spans.d.mts.map +1 -1
  106. package/esm/index.d.mts +10 -1
  107. package/esm/index.mjs +2 -1
  108. package/esm/panoptic/index.d.mts +2 -1
  109. package/esm/panoptic/index.mjs +1 -1
  110. package/esm/panoptic/panoptic-middleware.d.mts +1 -3
  111. package/esm/panoptic/panoptic-middleware.d.mts.map +1 -1
  112. package/esm/panoptic/panoptic-target.type.d.mts +4 -5
  113. package/esm/panoptic/panoptic-target.type.d.mts.map +1 -1
  114. package/esm/panoptic/panoptic.d.mts +1 -3
  115. package/esm/panoptic/panoptic.d.mts.map +1 -1
  116. package/esm/panoptic/panoptic.type.d.mts +8 -7
  117. package/esm/panoptic/panoptic.type.d.mts.map +1 -1
  118. package/esm/store/cache-trace-store.d.mts +4 -6
  119. package/esm/store/cache-trace-store.d.mts.map +1 -1
  120. package/esm/store/cache-trace-store.mjs +1 -4
  121. package/esm/store/cache-trace-store.mjs.map +1 -1
  122. package/esm/store/in-memory-trace-store.d.mts +2 -4
  123. package/esm/store/in-memory-trace-store.d.mts.map +1 -1
  124. package/esm/store/in-memory-trace-store.mjs +1 -4
  125. package/esm/store/in-memory-trace-store.mjs.map +1 -1
  126. package/esm/store/index.d.mts +2 -1
  127. package/esm/store/index.mjs +1 -1
  128. package/esm/store/match-trace.d.mts +1 -3
  129. package/esm/store/match-trace.d.mts.map +1 -1
  130. package/esm/store/match-trace.mjs +1 -0
  131. package/esm/store/match-trace.mjs.map +1 -1
  132. package/esm/store/sum-usage.d.mts +4 -30
  133. package/esm/store/sum-usage.d.mts.map +1 -1
  134. package/esm/store/sum-usage.mjs +6 -49
  135. package/esm/store/sum-usage.mjs.map +1 -1
  136. package/esm/store/trace-aggregate.type.d.mts +12 -9
  137. package/esm/store/trace-aggregate.type.d.mts.map +1 -1
  138. package/esm/store/trace-query.type.d.mts +7 -5
  139. package/esm/store/trace-query.type.d.mts.map +1 -1
  140. package/esm/store/trace-store.contract.d.mts +1 -3
  141. package/esm/store/trace-store.contract.d.mts.map +1 -1
  142. package/llms-full.txt +105 -0
  143. package/package.json +4 -4
  144. package/skills/observe-with-panoptic/SKILL.md +35 -0
  145. package/skills/query-traces/SKILL.md +49 -0
  146. package/skills/use-local-dashboard/SKILL.md +21 -0
@@ -1 +1 @@
1
- {"version":3,"file":"evaluate.type.d.mts","names":[],"sources":["../../../../../../../../packages/ai-panoptic/src/evaluate/evaluate.type.ts"],"mappings":";;;;;AAuBA;;;;;;;;;;;;;;;;AAgBc;AAId;;KApBY,cAAA;EAoB8B;AAAA;;;;;;EAZxC,KAAA,EAAO,aAAA,UAAuB,aAAA,GAAgB,OAAA,CAAQ,aAAA;;;;;;;;EAQtD,YAAA;AAAA;;KAIU,eAAA,GAAkB,YAAY"}
1
+ {"version":3,"file":"evaluate.type.d.mts","names":[],"sources":["../../../../../../../../packages/ai-panoptic/src/evaluate/evaluate.type.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;YAuBY;;;;;;;;EAQV,OAAO,uBAAuB,gBAAgB,QAAQ;;;;;;;;EAQtD;;;YAIU,kBAAkB"}
@@ -1,5 +1,4 @@
1
1
  import { TraceSpan } from "../contracts/trace.type.mjs";
2
-
3
2
  //#region ../../packages/ai-panoptic/src/evaluate/extract-last-system-prompt.d.ts
4
3
  /**
5
4
  * Pull the LAST `{role: "system"}` message off a span's captured `input`.
@@ -13,7 +12,6 @@ import { TraceSpan } from "../contracts/trace.type.mjs";
13
12
  * `undefined` for a tool span, an agent with no system prompt, or when
14
13
  * content capture is off — the caller treats that as "nothing to evaluate."
15
14
  */
16
- declare function extractLastSystemPrompt(span: TraceSpan): string | undefined;
15
+ export declare function extractLastSystemPrompt(span: TraceSpan): string | undefined;
17
16
  //#endregion
18
- export { extractLastSystemPrompt };
19
17
  //# sourceMappingURL=extract-last-system-prompt.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extract-last-system-prompt.d.mts","names":[],"sources":["../../../../../../../../packages/ai-panoptic/src/evaluate/extract-last-system-prompt.ts"],"mappings":";;;;;AAcA;;;;AAAuD;;;;;;iBAAvC,uBAAA,CAAwB,IAAe,EAAT,SAAS"}
1
+ {"version":3,"file":"extract-last-system-prompt.d.mts","names":[],"sources":["../../../../../../../../packages/ai-panoptic/src/evaluate/extract-last-system-prompt.ts"],"mappings":";;;;;;;;;;;;;;wBAcgB,wBAAwB,MAAM"}
@@ -1,8 +1,6 @@
1
1
  import { TraceSpan } from "../contracts/trace.type.mjs";
2
-
3
2
  //#region ../../packages/ai-panoptic/src/evaluate/find-span-by-id.d.ts
4
3
  /** Depth-first search for the span with `spanId` inside a trace's span tree. */
5
- declare function findSpanById(root: TraceSpan, spanId: string): TraceSpan | undefined;
4
+ export declare function findSpanById(root: TraceSpan, spanId: string): TraceSpan | undefined;
6
5
  //#endregion
7
- export { findSpanById };
8
6
  //# sourceMappingURL=find-span-by-id.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"find-span-by-id.d.mts","names":[],"sources":["../../../../../../../../packages/ai-panoptic/src/evaluate/find-span-by-id.ts"],"mappings":";;;;iBAGgB,YAAA,CAAa,IAAA,EAAM,SAAA,EAAW,MAAA,WAAiB,SAAS"}
1
+ {"version":3,"file":"find-span-by-id.d.mts","names":[],"sources":["../../../../../../../../packages/ai-panoptic/src/evaluate/find-span-by-id.ts"],"mappings":";;;wBAGgB,aAAa,MAAM,WAAW,iBAAiB"}
@@ -1,4 +1,5 @@
1
1
  import { EvaluateConfig, EvaluateVerdict } from "./evaluate.type.mjs";
2
2
  import { evaluateSystemPrompt } from "./evaluate-system-prompt.mjs";
3
3
  import { extractLastSystemPrompt } from "./extract-last-system-prompt.mjs";
4
- import { findSpanById } from "./find-span-by-id.mjs";
4
+ import { findSpanById } from "./find-span-by-id.mjs";
5
+ export { type EvaluateConfig, type EvaluateVerdict, evaluateSystemPrompt, extractLastSystemPrompt, findSpanById };
@@ -2,4 +2,4 @@ import { evaluateSystemPrompt } from "./evaluate-system-prompt.mjs";
2
2
  import { extractLastSystemPrompt } from "./extract-last-system-prompt.mjs";
3
3
  import { findSpanById } from "./find-span-by-id.mjs";
4
4
 
5
- export { };
5
+ export { evaluateSystemPrompt, extractLastSystemPrompt, findSpanById };
@@ -1,6 +1,6 @@
1
1
  import { ExporterContract } from "../../contracts/exporter.contract.mjs";
2
+ import "../../contracts/index.mjs";
2
3
  import { ConsoleExporterOptions } from "./console-exporter.type.mjs";
3
-
4
4
  //#region ../../packages/ai-panoptic/src/exporters/console/console-exporter.d.ts
5
5
  /**
6
6
  * Zero-dependency {@link ExporterContract} that prints traces to a
@@ -27,7 +27,6 @@ import { ConsoleExporterOptions } from "./console-exporter.type.mjs";
27
27
  * exporters: [consoleExporter({ tree: true, io: true })],
28
28
  * });
29
29
  */
30
- declare function consoleExporter(options?: ConsoleExporterOptions): ExporterContract;
30
+ export declare function consoleExporter(options?: ConsoleExporterOptions): ExporterContract;
31
31
  //#endregion
32
- export { consoleExporter };
33
32
  //# sourceMappingURL=console-exporter.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"console-exporter.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/console/console-exporter.ts"],"mappings":";;;;;;;AAiCA;;;;;;;;AAAuF;;;;;;;;;;;;;;iBAAvE,eAAA,CAAgB,OAAA,GAAS,sBAAA,GAA8B,gBAAgB"}
1
+ {"version":3,"file":"console-exporter.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/console/console-exporter.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAiCgB,gBAAgB,UAAS,yBAA8B"}
@@ -5,14 +5,14 @@
5
5
  * monkey-patching the global. Only the two levels the exporter uses are
6
6
  * required.
7
7
  */
8
- type ConsoleLike = {
8
+ export type ConsoleLike = {
9
9
  log(...args: unknown[]): void;
10
10
  error(...args: unknown[]): void;
11
11
  };
12
12
  /**
13
13
  * Options for {@link consoleExporter}.
14
14
  */
15
- type ConsoleExporterOptions = {
15
+ export type ConsoleExporterOptions = {
16
16
  /**
17
17
  * Where to write. Defaults to the global `console`. Inject a custom
18
18
  * sink in tests or to redirect to a structured logger.
@@ -47,5 +47,4 @@ type ConsoleExporterOptions = {
47
47
  ioMaxChars?: number;
48
48
  };
49
49
  //#endregion
50
- export { ConsoleExporterOptions, ConsoleLike };
51
50
  //# sourceMappingURL=console-exporter.type.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"console-exporter.type.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/console/console-exporter.type.ts"],"mappings":";;AAMA;;;;;KAAY,WAAA;EACV,GAAA,IAAO,IAAA;EACP,KAAA,IAAS,IAAA;AAAA;AAAI;AAMf;;AANe,KAMH,sBAAA;EAKW;;;;EAArB,OAAA,GAAU,WAAW;EAoBrB;;;AAOU;;EArBV,IAAA;;;;;;EAMA,SAAA;;;;;;;;EAQA,EAAA;;;;;;;EAOA,UAAA;AAAA"}
1
+ {"version":3,"file":"console-exporter.type.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/console/console-exporter.type.ts"],"mappings":";;;;;;;YAMY;EACV,OAAO;EACP,SAAS;;;;;YAMC;;;;;EAKV,UAAU;;;;;;EAMV;;;;;;EAMA;;;;;;;;EAQA;;;;;;;EAOA"}
@@ -1,4 +1,5 @@
1
1
  import { TraceSpan } from "../../contracts/trace.type.mjs";
2
+ import "../../contracts/index.mjs";
2
3
  //#region ../../packages/ai-panoptic/src/exporters/console/format-span-io.d.ts
3
4
  /**
4
5
  * Render a span's captured content ({@link TraceSpan.input} /
@@ -21,7 +22,6 @@ import { TraceSpan } from "../../contracts/trace.type.mjs";
21
22
  * formatSpanIO(toolSpan, 1);
22
23
  * // [' in: {"query":"specialty coffee demand"}', ' out: {"results":[…]}']
23
24
  */
24
- declare function formatSpanIO(span: TraceSpan, depth?: number, maxChars?: number): string[];
25
+ export declare function formatSpanIO(span: TraceSpan, depth?: number, maxChars?: number): string[];
25
26
  //#endregion
26
- export { formatSpanIO };
27
27
  //# sourceMappingURL=format-span-io.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-span-io.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/console/format-span-io.ts"],"mappings":";;;;;AA0BA;;;;;;;;;AAGiC;;;;;;;;;iBAHjB,YAAA,CACd,IAAA,EAAM,SAAS,EACf,KAAA,WACA,QAAA"}
1
+ {"version":3,"file":"format-span-io.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/console/format-span-io.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;wBA0BgB,aACd,MAAM,WACN,gBACA"}
@@ -1,4 +1,5 @@
1
1
  import { TraceSpan } from "../../contracts/trace.type.mjs";
2
+ import "../../contracts/index.mjs";
2
3
  //#region ../../packages/ai-panoptic/src/exporters/console/format-span-line.d.ts
3
4
  /**
4
5
  * Render a single {@link TraceSpan} as one scannable console line:
@@ -11,7 +12,6 @@ import { TraceSpan } from "../../contracts/trace.type.mjs";
11
12
  * formatSpanLine(span, 1);
12
13
  * // ' ok agent "router" — 1240ms, 470 tok, $0.0021'
13
14
  */
14
- declare function formatSpanLine(span: TraceSpan, depth?: number): string;
15
+ export declare function formatSpanLine(span: TraceSpan, depth?: number): string;
15
16
  //#endregion
16
- export { formatSpanLine };
17
17
  //# sourceMappingURL=format-span-line.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-span-line.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/console/format-span-line.ts"],"mappings":";;;;;AAcA;;;;;;;;iBAAgB,cAAA,CAAe,IAAA,EAAM,SAAS,EAAE,KAAA"}
1
+ {"version":3,"file":"format-span-line.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/console/format-span-line.ts"],"mappings":";;;;;;;;;;;;;;wBAcgB,eAAe,MAAM,WAAW"}
@@ -1,4 +1,5 @@
1
1
  import { ConsoleExporterOptions, ConsoleLike } from "./console-exporter.type.mjs";
2
2
  import { consoleExporter } from "./console-exporter.mjs";
3
3
  import { formatSpanLine } from "./format-span-line.mjs";
4
- import { formatSpanIO } from "./format-span-io.mjs";
4
+ import { formatSpanIO } from "./format-span-io.mjs";
5
+ export { type ConsoleExporterOptions, type ConsoleLike, consoleExporter, formatSpanIO, formatSpanLine };
@@ -2,4 +2,4 @@ import { formatSpanIO } from "./format-span-io.mjs";
2
2
  import { formatSpanLine } from "./format-span-line.mjs";
3
3
  import { consoleExporter } from "./console-exporter.mjs";
4
4
 
5
- export { };
5
+ export { consoleExporter, formatSpanIO, formatSpanLine };
@@ -1,6 +1,6 @@
1
1
  import { ExporterContract } from "../../contracts/exporter.contract.mjs";
2
+ import "../../contracts/index.mjs";
2
3
  import { FileExporterOptions } from "./file-exporter.type.mjs";
3
-
4
4
  //#region ../../packages/ai-panoptic/src/exporters/file/file-exporter.d.ts
5
5
  /**
6
6
  * Zero-dependency {@link ExporterContract} that appends completed traces
@@ -17,7 +17,6 @@ import { FileExporterOptions } from "./file-exporter.type.mjs";
17
17
  * // on shutdown:
18
18
  * await collector.shutdown(); // drains the buffer
19
19
  */
20
- declare function fileExporter(options: FileExporterOptions): ExporterContract;
20
+ export declare function fileExporter(options: FileExporterOptions): ExporterContract;
21
21
  //#endregion
22
- export { fileExporter };
23
22
  //# sourceMappingURL=file-exporter.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-exporter.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/file/file-exporter.ts"],"mappings":";;;;;;;AAsBA;;;;;;;;AAA4E;;;;iBAA5D,YAAA,CAAa,OAAA,EAAS,mBAAA,GAAsB,gBAAgB"}
1
+ {"version":3,"file":"file-exporter.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/file/file-exporter.ts"],"mappings":";;;;;;;;;;;;;;;;;;;wBAsBgB,aAAa,SAAS,sBAAsB"}
@@ -1,4 +1,5 @@
1
1
  import { Trace } from "../../contracts/trace.type.mjs";
2
+ import "../../contracts/index.mjs";
2
3
  //#region ../../packages/ai-panoptic/src/exporters/file/file-exporter.type.d.ts
3
4
  /**
4
5
  * One JSON-Lines record the {@link fileExporter} appends per trace. A
@@ -6,15 +7,18 @@ import { Trace } from "../../contracts/trace.type.mjs";
6
7
  * the time the line was written, so a downstream reader can tell records
7
8
  * apart and order them without re-deriving anything from the payload.
8
9
  */
9
- type TraceRecord = {
10
- /** Discriminator for the record format — always `"trace"` today. */type: "trace"; /** ISO-8601 timestamp the exporter wrote this record. */
11
- exportedAt: string; /** The completed trace, verbatim. */
10
+ export type TraceRecord = {
11
+ /** Discriminator for the record format — always `"trace"` today. */
12
+ type: "trace";
13
+ /** ISO-8601 timestamp the exporter wrote this record. */
14
+ exportedAt: string;
15
+ /** The completed trace, verbatim. */
12
16
  trace: Trace;
13
17
  };
14
18
  /**
15
19
  * Options for {@link fileExporter}.
16
20
  */
17
- type FileExporterOptions = {
21
+ export type FileExporterOptions = {
18
22
  /**
19
23
  * Absolute or cwd-relative path of the JSON-Lines file traces are
20
24
  * appended to. The parent directory is created on first write if
@@ -35,5 +39,4 @@ type FileExporterOptions = {
35
39
  pretty?: boolean;
36
40
  };
37
41
  //#endregion
38
- export { FileExporterOptions, TraceRecord };
39
42
  //# sourceMappingURL=file-exporter.type.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-exporter.type.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/file/file-exporter.type.ts"],"mappings":";;;;;AAQA;;;KAAY,WAAA;EAEV,oEAAA,IAAA,WAIA;EAFA,UAAA,UAEY;EAAZ,KAAA,EAAO,KAAK;AAAA;;;;KAMF,mBAAA;EAYV;;;AAMM;;EAZN,IAAA;;;;;;EAMA,UAAA;;;;;;EAMA,MAAA;AAAA"}
1
+ {"version":3,"file":"file-exporter.type.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/file/file-exporter.type.ts"],"mappings":";;;;;;;;;YAQY;;EAEV;;EAEA;;EAEA,OAAO;;;;;YAMG;;;;;;EAMV;;;;;;EAMA;;;;;;EAMA"}
@@ -1,2 +1,3 @@
1
1
  import { FileExporterOptions, TraceRecord } from "./file-exporter.type.mjs";
2
- import { fileExporter } from "./file-exporter.mjs";
2
+ import { fileExporter } from "./file-exporter.mjs";
3
+ export { type FileExporterOptions, type TraceRecord, fileExporter };
@@ -2,12 +2,18 @@ import { ConsoleExporterOptions, ConsoleLike } from "./console/console-exporter.
2
2
  import { consoleExporter } from "./console/console-exporter.mjs";
3
3
  import { formatSpanLine } from "./console/format-span-line.mjs";
4
4
  import { formatSpanIO } from "./console/format-span-io.mjs";
5
+ import "./console/index.mjs";
5
6
  import { FileExporterOptions, TraceRecord } from "./file/file-exporter.type.mjs";
6
7
  import { fileExporter } from "./file/file-exporter.mjs";
8
+ import "./file/index.mjs";
7
9
  import { LangfuseClientLike, LangfuseExporterOptions, LangfuseObservationBody, LangfuseObservationEndBody, LangfuseObservationLevel, LangfuseObservationLike, LangfuseTraceBody, LangfuseTraceLike, LangfuseUsageBody } from "./langfuse/langfuse-exporter.type.mjs";
8
10
  import { langfuseExporter } from "./langfuse/langfuse-exporter.mjs";
11
+ import "./langfuse/index.mjs";
9
12
  import { OtelExporterOptions } from "./otel/otel-exporter.type.mjs";
10
13
  import { otelExporter } from "./otel/otel-exporter.mjs";
14
+ import "./otel/index.mjs";
11
15
  import { AttributeValue, GEN_AI_ATTRIBUTES, WARLOCK_ATTRIBUTES, toGenAiAttributes } from "./utils/gen-ai-attributes.mjs";
12
16
  import { totalCostUsd } from "./utils/total-cost.mjs";
13
- import { walkSpans } from "./utils/walk-spans.mjs";
17
+ import { walkSpans } from "./utils/walk-spans.mjs";
18
+ import "./utils/index.mjs";
19
+ export { type AttributeValue, type ConsoleExporterOptions, type ConsoleLike, type FileExporterOptions, GEN_AI_ATTRIBUTES, type LangfuseClientLike, type LangfuseExporterOptions, type LangfuseObservationBody, type LangfuseObservationEndBody, type LangfuseObservationLevel, type LangfuseObservationLike, type LangfuseTraceBody, type LangfuseTraceLike, type LangfuseUsageBody, type OtelExporterOptions, type TraceRecord, WARLOCK_ATTRIBUTES, consoleExporter, fileExporter, formatSpanIO, formatSpanLine, langfuseExporter, otelExporter, toGenAiAttributes, totalCostUsd, walkSpans };
@@ -12,4 +12,4 @@ import "./langfuse/index.mjs";
12
12
  import { otelExporter } from "./otel/otel-exporter.mjs";
13
13
  import "./otel/index.mjs";
14
14
 
15
- export { };
15
+ export { GEN_AI_ATTRIBUTES, WARLOCK_ATTRIBUTES, consoleExporter, fileExporter, formatSpanIO, formatSpanLine, langfuseExporter, otelExporter, toGenAiAttributes, totalCostUsd, walkSpans };
@@ -1,2 +1,3 @@
1
1
  import { LangfuseClientLike, LangfuseExporterOptions, LangfuseObservationBody, LangfuseObservationEndBody, LangfuseObservationLevel, LangfuseObservationLike, LangfuseTraceBody, LangfuseTraceLike, LangfuseUsageBody } from "./langfuse-exporter.type.mjs";
2
- import { langfuseExporter } from "./langfuse-exporter.mjs";
2
+ import { langfuseExporter } from "./langfuse-exporter.mjs";
3
+ export { type LangfuseClientLike, type LangfuseExporterOptions, type LangfuseObservationBody, type LangfuseObservationEndBody, type LangfuseObservationLevel, type LangfuseObservationLike, type LangfuseTraceBody, type LangfuseTraceLike, type LangfuseUsageBody, langfuseExporter };
@@ -1,3 +1,3 @@
1
1
  import { langfuseExporter } from "./langfuse-exporter.mjs";
2
2
 
3
- export { };
3
+ export { langfuseExporter };
@@ -1,6 +1,6 @@
1
1
  import { ExporterContract } from "../../contracts/exporter.contract.mjs";
2
+ import "../../contracts/index.mjs";
2
3
  import { LangfuseExporterOptions } from "./langfuse-exporter.type.mjs";
3
-
4
4
  //#region ../../packages/ai-panoptic/src/exporters/langfuse/langfuse-exporter.d.ts
5
5
  /**
6
6
  * {@link ExporterContract} that maps Panoptic traces onto Langfuse
@@ -25,7 +25,6 @@ import { LangfuseExporterOptions } from "./langfuse-exporter.type.mjs";
25
25
  * // or reuse an existing client:
26
26
  * collector.use(langfuseExporter({ client: myLangfuse }));
27
27
  */
28
- declare function langfuseExporter(options: LangfuseExporterOptions): ExporterContract;
28
+ export declare function langfuseExporter(options: LangfuseExporterOptions): ExporterContract;
29
29
  //#endregion
30
- export { langfuseExporter };
31
30
  //# sourceMappingURL=langfuse-exporter.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"langfuse-exporter.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/langfuse/langfuse-exporter.ts"],"mappings":";;;;;;;AAqFA;;;;;;;;AAAoF;;;;;;;;;;;;iBAApE,gBAAA,CAAiB,OAAA,EAAS,uBAAA,GAA0B,gBAAgB"}
1
+ {"version":3,"file":"langfuse-exporter.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/langfuse/langfuse-exporter.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqFgB,iBAAiB,SAAS,0BAA0B"}
@@ -175,7 +175,7 @@ function ownUsage(span) {
175
175
  * rolled-up subtree totals next to an own-usage `usage` block. Cost is
176
176
  * omitted for the same reason; Langfuse prices the own tokens itself.
177
177
  */
178
- const LANGFUSE_METADATA_OMIT = new Set([
178
+ const LANGFUSE_METADATA_OMIT = /* @__PURE__ */ new Set([
179
179
  GEN_AI_ATTRIBUTES.usageInputTokens,
180
180
  GEN_AI_ATTRIBUTES.usageOutputTokens,
181
181
  WARLOCK_ATTRIBUTES.totalTokens,
@@ -1 +1 @@
1
- {"version":3,"file":"langfuse-exporter.mjs","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/langfuse/langfuse-exporter.ts"],"sourcesContent":["import type { ExporterContract, Trace, TraceSpan } from \"../../contracts\";\nimport type { AttributeValue } from \"../utils\";\nimport { GEN_AI_ATTRIBUTES, toGenAiAttributes, WARLOCK_ATTRIBUTES } from \"../utils\";\nimport type {\n LangfuseClientLike,\n LangfuseExporterOptions,\n LangfuseObservationBody,\n LangfuseObservationLevel,\n LangfuseObservationLike,\n LangfuseTraceBody,\n LangfuseTraceLike,\n} from \"./langfuse-exporter.type\";\n\nconst EXPORTER_NAME = \"langfuse\";\n\n// ============================================================\n// Lazily-loaded langfuse SDK (OPTIONAL peer)\n// ============================================================\n\nlet LangfuseSdk: typeof import(\"langfuse\");\nlet isModuleExists: boolean | null = null;\nlet loadingPromise: Promise<void> | undefined;\n\nconst LANGFUSE_INSTALL_INSTRUCTIONS = `\nThe Panoptic Langfuse exporter requires the langfuse package.\nInstall it with:\n\n npm install langfuse\n\nOr with your preferred package manager:\n\n pnpm add langfuse\n yarn add langfuse\n`.trim();\n\n/**\n * Settle the lazy import of `langfuse` once, concurrency-safe. Only\n * needed when the caller did not pass a ready `client`. A bare `catch`\n * flips the flag to `false`; the curated install string surfaces at use\n * time, never a raw module-resolution stack trace.\n */\nfunction loadLangfuse(): Promise<void> {\n if (isModuleExists !== null) {\n return Promise.resolve();\n }\n\n if (loadingPromise) {\n return loadingPromise;\n }\n\n loadingPromise = (async () => {\n try {\n LangfuseSdk = await import(\"langfuse\");\n isModuleExists = true;\n } catch {\n isModuleExists = false;\n }\n })();\n\n return loadingPromise;\n}\n\n/**\n * {@link ExporterContract} that maps Panoptic traces onto Langfuse\n * traces and observations. Lazily imports `langfuse` so it stays an\n * OPTIONAL peer — importing this module never forces the SDK to be\n * installed, and a missing SDK surfaces as a curated \"install this\"\n * error when the exporter first needs to build a client.\n *\n * The root {@link TraceSpan} becomes a Langfuse trace AND its top\n * observation (so the root execution's own tokens are metered, not just\n * its children's); every node is an observation — a `generation` when it\n * metered its OWN tokens (LLM-backed agents, supervisors), otherwise a\n * plain `span` (tools, callbacks, and composite nodes whose tokens came\n * only from children). Timing, status, and version map 1:1; each\n * generation reports its own token usage (rolled-up minus children) so\n * the trace total isn't double-counted; non-usage GenAI attributes ride\n * along as metadata, and captured content (under `captureContent`)\n * surfaces as native `input` / `output`.\n *\n * @example\n * collector.use(langfuseExporter({ publicKey: \"pk-...\", secretKey: \"sk-...\" }));\n * // or reuse an existing client:\n * collector.use(langfuseExporter({ client: myLangfuse }));\n */\nexport function langfuseExporter(options: LangfuseExporterOptions): ExporterContract {\n let client: LangfuseClientLike | undefined = options.client;\n\n if (!client) {\n loadLangfuse();\n }\n\n const resolveClient = async (): Promise<LangfuseClientLike> => {\n if (client) {\n return client;\n }\n\n await loadLangfuse();\n\n if (!isModuleExists) {\n throw new Error(LANGFUSE_INSTALL_INSTRUCTIONS);\n }\n\n client = new LangfuseSdk.Langfuse({\n publicKey: options.publicKey,\n secretKey: options.secretKey,\n baseUrl: options.baseUrl,\n }) as unknown as LangfuseClientLike;\n\n return client;\n };\n\n return {\n name: EXPORTER_NAME,\n async export(trace: Trace): Promise<void> {\n const activeClient = await resolveClient();\n emitTrace(activeClient, trace);\n },\n async flush(): Promise<void> {\n if (!client) {\n return;\n }\n\n await client.flushAsync();\n },\n async shutdown(): Promise<void> {\n if (!client) {\n return;\n }\n\n await client.shutdownAsync();\n },\n };\n}\n\n/**\n * Create the Langfuse trace from the root span, then recurse the\n * children into nested observations.\n */\nfunction emitTrace(client: LangfuseClientLike, trace: Trace): void {\n const root = trace.root;\n\n const traceBody: LangfuseTraceBody = {\n id: root.traceId,\n name: root.name,\n sessionId: trace.sessionId,\n version: root.version,\n timestamp: new Date(root.startedAt),\n metadata: langfuseMetadata(root),\n };\n\n // Surface the root's captured content at the TRACE level too — not only on\n // the root observation — so Langfuse's trace Preview shows the top-level\n // input/output instead of \"this trace received no input/output\". Present\n // only under content capture, and only for roots that carry I/O (an agent\n // or tool; a composite root like a planner has none of its own).\n if (root.input !== undefined) {\n traceBody.input = root.input;\n }\n\n if (root.output !== undefined) {\n traceBody.output = root.output;\n }\n\n const langfuseTrace = client.trace(traceBody);\n\n // Emit the ROOT as an observation too — not just its children — so the\n // root execution's OWN tokens are metered. Langfuse derives the trace\n // total by summing observation usage; leaving the root (often the single\n // top-level agent) as trace-only would drop its own spend. Children nest\n // under the root observation, mirroring the execution tree, and own-usage\n // metering telescopes the per-node sums back to the true trace total.\n emitObservation(langfuseTrace, root);\n}\n\n/**\n * Map one {@link TraceSpan} onto a Langfuse observation under `parent`,\n * then recurse its children. Spans that metered their OWN tokens become\n * `generation`s; everything else (tools, callbacks, composite nodes)\n * becomes a plain `span`.\n */\nfunction emitObservation(\n parent: LangfuseTraceLike | LangfuseObservationLike,\n span: TraceSpan,\n): void {\n const body: LangfuseObservationBody = {\n id: span.spanId,\n name: span.name,\n startTime: new Date(span.startedAt),\n endTime: new Date(span.endedAt),\n level: toLevel(span),\n statusMessage: span.error?.message,\n version: span.version,\n metadata: langfuseMetadata(span),\n };\n\n // Captured content (only present under `captureContent`) maps onto\n // Langfuse's native observation input/output.\n if (span.input !== undefined) {\n body.input = span.input;\n }\n\n if (span.output !== undefined) {\n body.output = span.output;\n }\n\n let observation: LangfuseObservationLike;\n\n // Classify + meter on OWN tokens (this node's rolled-up usage minus its\n // children's), not the subtree rollup. A composite node whose tokens\n // came only from descendants has zero own-usage and becomes a plain\n // span — so its children's tokens aren't counted twice in the trace\n // total Langfuse sums across observations.\n const own = ownUsage(span);\n\n if (own.total > 0) {\n body.usage = {\n input: own.input,\n output: own.output,\n total: own.total,\n unit: \"TOKENS\",\n };\n observation = parent.generation(body);\n } else {\n observation = parent.span(body);\n }\n\n for (const child of span.children) {\n emitObservation(observation, child);\n }\n\n // Explicitly end the observation. The body already carries `endTime`,\n // so this is idempotent — but the SDK only finalizes (and flushes) an\n // observation on `end()`, so without it long-lived clients can leave\n // observations open. Safe against the local `LangfuseObservationLike`\n // shape, which declares `end(body?)`.\n observation.end({ endTime: body.endTime });\n}\n\n/**\n * Own token usage for a span — its rolled-up {@link TraceSpan.usage}\n * minus the rolled-up usage of its direct children. `TraceSpan.usage` is\n * the subtree total (this node plus every descendant), so subtracting the\n * children leaves the tokens THIS node alone metered, clamped at zero\n * defensively.\n *\n * Langfuse sums observation usage into the trace total, so reporting\n * own-usage on each generation (rather than the subtree rollup) is what\n * keeps the trace total correct instead of multiply-counting nested\n * spans. A composite node with no own tokens (e.g. a workflow whose\n * tokens all came from agent children) yields `total: 0` and is emitted\n * as a plain span, not a generation.\n */\nfunction ownUsage(span: TraceSpan): { input: number; output: number; total: number } {\n let childInput = 0;\n let childOutput = 0;\n let childTotal = 0;\n\n for (const child of span.children) {\n childInput += child.usage.input;\n childOutput += child.usage.output;\n childTotal += child.usage.total;\n }\n\n return {\n input: Math.max(0, span.usage.input - childInput),\n output: Math.max(0, span.usage.output - childOutput),\n total: Math.max(0, span.usage.total - childTotal),\n };\n}\n\n/**\n * Token-usage + cost keys that the per-observation `usage` block already\n * carries authoritatively (as OWN usage). Omitting them from `metadata`\n * avoids a confusing contradiction — metadata would otherwise show the\n * rolled-up subtree totals next to an own-usage `usage` block. Cost is\n * omitted for the same reason; Langfuse prices the own tokens itself.\n */\nconst LANGFUSE_METADATA_OMIT = new Set<string>([\n GEN_AI_ATTRIBUTES.usageInputTokens,\n GEN_AI_ATTRIBUTES.usageOutputTokens,\n WARLOCK_ATTRIBUTES.totalTokens,\n WARLOCK_ATTRIBUTES.cachedTokens,\n WARLOCK_ATTRIBUTES.reasoningTokens,\n WARLOCK_ATTRIBUTES.costUsd,\n]);\n\n/**\n * Observation metadata — the GenAI attribute set minus the usage/cost\n * keys that live authoritatively on the `usage` block (see\n * {@link LANGFUSE_METADATA_OMIT}). Keeps model identity, report type,\n * version, session id, and any collector-set attributes.\n */\nfunction langfuseMetadata(span: TraceSpan): Record<string, AttributeValue> {\n const all = toGenAiAttributes(span);\n const metadata: Record<string, AttributeValue> = {};\n\n for (const [key, value] of Object.entries(all)) {\n if (!LANGFUSE_METADATA_OMIT.has(key)) {\n metadata[key] = value;\n }\n }\n\n return metadata;\n}\n\n/**\n * Map the Panoptic span status onto a Langfuse observation level —\n * failed/cancelled/incomplete spans surface as `ERROR`, everything else `DEFAULT`.\n */\nfunction toLevel(span: TraceSpan): LangfuseObservationLevel {\n if (span.status === \"failed\" || span.status === \"cancelled\" || span.status === \"incomplete\") {\n return \"ERROR\";\n }\n\n return \"DEFAULT\";\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"langfuse-exporter.mjs","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/langfuse/langfuse-exporter.ts"],"sourcesContent":["import type { ExporterContract, Trace, TraceSpan } from \"../../contracts\";\nimport type { AttributeValue } from \"../utils\";\nimport { GEN_AI_ATTRIBUTES, toGenAiAttributes, WARLOCK_ATTRIBUTES } from \"../utils\";\nimport type {\n LangfuseClientLike,\n LangfuseExporterOptions,\n LangfuseObservationBody,\n LangfuseObservationLevel,\n LangfuseObservationLike,\n LangfuseTraceBody,\n LangfuseTraceLike,\n} from \"./langfuse-exporter.type\";\n\nconst EXPORTER_NAME = \"langfuse\";\n\n// ============================================================\n// Lazily-loaded langfuse SDK (OPTIONAL peer)\n// ============================================================\n\nlet LangfuseSdk: typeof import(\"langfuse\");\nlet isModuleExists: boolean | null = null;\nlet loadingPromise: Promise<void> | undefined;\n\nconst LANGFUSE_INSTALL_INSTRUCTIONS = `\nThe Panoptic Langfuse exporter requires the langfuse package.\nInstall it with:\n\n npm install langfuse\n\nOr with your preferred package manager:\n\n pnpm add langfuse\n yarn add langfuse\n`.trim();\n\n/**\n * Settle the lazy import of `langfuse` once, concurrency-safe. Only\n * needed when the caller did not pass a ready `client`. A bare `catch`\n * flips the flag to `false`; the curated install string surfaces at use\n * time, never a raw module-resolution stack trace.\n */\nfunction loadLangfuse(): Promise<void> {\n if (isModuleExists !== null) {\n return Promise.resolve();\n }\n\n if (loadingPromise) {\n return loadingPromise;\n }\n\n loadingPromise = (async () => {\n try {\n LangfuseSdk = await import(\"langfuse\");\n isModuleExists = true;\n } catch {\n isModuleExists = false;\n }\n })();\n\n return loadingPromise;\n}\n\n/**\n * {@link ExporterContract} that maps Panoptic traces onto Langfuse\n * traces and observations. Lazily imports `langfuse` so it stays an\n * OPTIONAL peer — importing this module never forces the SDK to be\n * installed, and a missing SDK surfaces as a curated \"install this\"\n * error when the exporter first needs to build a client.\n *\n * The root {@link TraceSpan} becomes a Langfuse trace AND its top\n * observation (so the root execution's own tokens are metered, not just\n * its children's); every node is an observation — a `generation` when it\n * metered its OWN tokens (LLM-backed agents, supervisors), otherwise a\n * plain `span` (tools, callbacks, and composite nodes whose tokens came\n * only from children). Timing, status, and version map 1:1; each\n * generation reports its own token usage (rolled-up minus children) so\n * the trace total isn't double-counted; non-usage GenAI attributes ride\n * along as metadata, and captured content (under `captureContent`)\n * surfaces as native `input` / `output`.\n *\n * @example\n * collector.use(langfuseExporter({ publicKey: \"pk-...\", secretKey: \"sk-...\" }));\n * // or reuse an existing client:\n * collector.use(langfuseExporter({ client: myLangfuse }));\n */\nexport function langfuseExporter(options: LangfuseExporterOptions): ExporterContract {\n let client: LangfuseClientLike | undefined = options.client;\n\n if (!client) {\n loadLangfuse();\n }\n\n const resolveClient = async (): Promise<LangfuseClientLike> => {\n if (client) {\n return client;\n }\n\n await loadLangfuse();\n\n if (!isModuleExists) {\n throw new Error(LANGFUSE_INSTALL_INSTRUCTIONS);\n }\n\n client = new LangfuseSdk.Langfuse({\n publicKey: options.publicKey,\n secretKey: options.secretKey,\n baseUrl: options.baseUrl,\n }) as unknown as LangfuseClientLike;\n\n return client;\n };\n\n return {\n name: EXPORTER_NAME,\n async export(trace: Trace): Promise<void> {\n const activeClient = await resolveClient();\n emitTrace(activeClient, trace);\n },\n async flush(): Promise<void> {\n if (!client) {\n return;\n }\n\n await client.flushAsync();\n },\n async shutdown(): Promise<void> {\n if (!client) {\n return;\n }\n\n await client.shutdownAsync();\n },\n };\n}\n\n/**\n * Create the Langfuse trace from the root span, then recurse the\n * children into nested observations.\n */\nfunction emitTrace(client: LangfuseClientLike, trace: Trace): void {\n const root = trace.root;\n\n const traceBody: LangfuseTraceBody = {\n id: root.traceId,\n name: root.name,\n sessionId: trace.sessionId,\n version: root.version,\n timestamp: new Date(root.startedAt),\n metadata: langfuseMetadata(root),\n };\n\n // Surface the root's captured content at the TRACE level too — not only on\n // the root observation — so Langfuse's trace Preview shows the top-level\n // input/output instead of \"this trace received no input/output\". Present\n // only under content capture, and only for roots that carry I/O (an agent\n // or tool; a composite root like a planner has none of its own).\n if (root.input !== undefined) {\n traceBody.input = root.input;\n }\n\n if (root.output !== undefined) {\n traceBody.output = root.output;\n }\n\n const langfuseTrace = client.trace(traceBody);\n\n // Emit the ROOT as an observation too — not just its children — so the\n // root execution's OWN tokens are metered. Langfuse derives the trace\n // total by summing observation usage; leaving the root (often the single\n // top-level agent) as trace-only would drop its own spend. Children nest\n // under the root observation, mirroring the execution tree, and own-usage\n // metering telescopes the per-node sums back to the true trace total.\n emitObservation(langfuseTrace, root);\n}\n\n/**\n * Map one {@link TraceSpan} onto a Langfuse observation under `parent`,\n * then recurse its children. Spans that metered their OWN tokens become\n * `generation`s; everything else (tools, callbacks, composite nodes)\n * becomes a plain `span`.\n */\nfunction emitObservation(\n parent: LangfuseTraceLike | LangfuseObservationLike,\n span: TraceSpan,\n): void {\n const body: LangfuseObservationBody = {\n id: span.spanId,\n name: span.name,\n startTime: new Date(span.startedAt),\n endTime: new Date(span.endedAt),\n level: toLevel(span),\n statusMessage: span.error?.message,\n version: span.version,\n metadata: langfuseMetadata(span),\n };\n\n // Captured content (only present under `captureContent`) maps onto\n // Langfuse's native observation input/output.\n if (span.input !== undefined) {\n body.input = span.input;\n }\n\n if (span.output !== undefined) {\n body.output = span.output;\n }\n\n let observation: LangfuseObservationLike;\n\n // Classify + meter on OWN tokens (this node's rolled-up usage minus its\n // children's), not the subtree rollup. A composite node whose tokens\n // came only from descendants has zero own-usage and becomes a plain\n // span — so its children's tokens aren't counted twice in the trace\n // total Langfuse sums across observations.\n const own = ownUsage(span);\n\n if (own.total > 0) {\n body.usage = {\n input: own.input,\n output: own.output,\n total: own.total,\n unit: \"TOKENS\",\n };\n observation = parent.generation(body);\n } else {\n observation = parent.span(body);\n }\n\n for (const child of span.children) {\n emitObservation(observation, child);\n }\n\n // Explicitly end the observation. The body already carries `endTime`,\n // so this is idempotent — but the SDK only finalizes (and flushes) an\n // observation on `end()`, so without it long-lived clients can leave\n // observations open. Safe against the local `LangfuseObservationLike`\n // shape, which declares `end(body?)`.\n observation.end({ endTime: body.endTime });\n}\n\n/**\n * Own token usage for a span — its rolled-up {@link TraceSpan.usage}\n * minus the rolled-up usage of its direct children. `TraceSpan.usage` is\n * the subtree total (this node plus every descendant), so subtracting the\n * children leaves the tokens THIS node alone metered, clamped at zero\n * defensively.\n *\n * Langfuse sums observation usage into the trace total, so reporting\n * own-usage on each generation (rather than the subtree rollup) is what\n * keeps the trace total correct instead of multiply-counting nested\n * spans. A composite node with no own tokens (e.g. a workflow whose\n * tokens all came from agent children) yields `total: 0` and is emitted\n * as a plain span, not a generation.\n */\nfunction ownUsage(span: TraceSpan): { input: number; output: number; total: number } {\n let childInput = 0;\n let childOutput = 0;\n let childTotal = 0;\n\n for (const child of span.children) {\n childInput += child.usage.input;\n childOutput += child.usage.output;\n childTotal += child.usage.total;\n }\n\n return {\n input: Math.max(0, span.usage.input - childInput),\n output: Math.max(0, span.usage.output - childOutput),\n total: Math.max(0, span.usage.total - childTotal),\n };\n}\n\n/**\n * Token-usage + cost keys that the per-observation `usage` block already\n * carries authoritatively (as OWN usage). Omitting them from `metadata`\n * avoids a confusing contradiction — metadata would otherwise show the\n * rolled-up subtree totals next to an own-usage `usage` block. Cost is\n * omitted for the same reason; Langfuse prices the own tokens itself.\n */\nconst LANGFUSE_METADATA_OMIT = new Set<string>([\n GEN_AI_ATTRIBUTES.usageInputTokens,\n GEN_AI_ATTRIBUTES.usageOutputTokens,\n WARLOCK_ATTRIBUTES.totalTokens,\n WARLOCK_ATTRIBUTES.cachedTokens,\n WARLOCK_ATTRIBUTES.reasoningTokens,\n WARLOCK_ATTRIBUTES.costUsd,\n]);\n\n/**\n * Observation metadata — the GenAI attribute set minus the usage/cost\n * keys that live authoritatively on the `usage` block (see\n * {@link LANGFUSE_METADATA_OMIT}). Keeps model identity, report type,\n * version, session id, and any collector-set attributes.\n */\nfunction langfuseMetadata(span: TraceSpan): Record<string, AttributeValue> {\n const all = toGenAiAttributes(span);\n const metadata: Record<string, AttributeValue> = {};\n\n for (const [key, value] of Object.entries(all)) {\n if (!LANGFUSE_METADATA_OMIT.has(key)) {\n metadata[key] = value;\n }\n }\n\n return metadata;\n}\n\n/**\n * Map the Panoptic span status onto a Langfuse observation level —\n * failed/cancelled/incomplete spans surface as `ERROR`, everything else `DEFAULT`.\n */\nfunction toLevel(span: TraceSpan): LangfuseObservationLevel {\n if (span.status === \"failed\" || span.status === \"cancelled\" || span.status === \"incomplete\") {\n return \"ERROR\";\n }\n\n return \"DEFAULT\";\n}\n"],"mappings":"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"}
@@ -8,7 +8,7 @@
8
8
  * creates nested `span` / `generation` observations, and the client is
9
9
  * drained with `flushAsync` / `shutdownAsync`.
10
10
  */
11
- type LangfuseClientLike = {
11
+ export type LangfuseClientLike = {
12
12
  trace(body: LangfuseTraceBody): LangfuseTraceLike;
13
13
  flushAsync(): Promise<unknown>;
14
14
  shutdownAsync(): Promise<unknown>;
@@ -17,7 +17,7 @@ type LangfuseClientLike = {
17
17
  * A Langfuse trace handle — creates nested observations and carries the
18
18
  * trace-level metadata Panoptic maps the root span onto.
19
19
  */
20
- type LangfuseTraceLike = {
20
+ export type LangfuseTraceLike = {
21
21
  span(body: LangfuseObservationBody): LangfuseObservationLike;
22
22
  generation(body: LangfuseObservationBody): LangfuseObservationLike;
23
23
  };
@@ -25,24 +25,26 @@ type LangfuseTraceLike = {
25
25
  * A Langfuse observation handle (span or generation) — nests further
26
26
  * children and is closed with `end()`.
27
27
  */
28
- type LangfuseObservationLike = {
28
+ export type LangfuseObservationLike = {
29
29
  span(body: LangfuseObservationBody): LangfuseObservationLike;
30
30
  generation(body: LangfuseObservationBody): LangfuseObservationLike;
31
31
  end(body?: LangfuseObservationEndBody): unknown;
32
32
  };
33
33
  /** Subset of the Langfuse trace-creation body Panoptic populates. */
34
- type LangfuseTraceBody = {
34
+ export type LangfuseTraceBody = {
35
35
  id?: string;
36
36
  name?: string;
37
37
  sessionId?: string;
38
38
  version?: string;
39
39
  timestamp?: Date;
40
- metadata?: Record<string, unknown>; /** Root input surfaced at trace level (set only under content capture). */
41
- input?: unknown; /** Root output surfaced at trace level (set only under content capture). */
40
+ metadata?: Record<string, unknown>;
41
+ /** Root input surfaced at trace level (set only under content capture). */
42
+ input?: unknown;
43
+ /** Root output surfaced at trace level (set only under content capture). */
42
44
  output?: unknown;
43
45
  };
44
46
  /** Subset of the Langfuse observation-creation body Panoptic populates. */
45
- type LangfuseObservationBody = {
47
+ export type LangfuseObservationBody = {
46
48
  id?: string;
47
49
  name?: string;
48
50
  startTime?: Date;
@@ -51,25 +53,27 @@ type LangfuseObservationBody = {
51
53
  statusMessage?: string;
52
54
  version?: string;
53
55
  usage?: LangfuseUsageBody;
54
- metadata?: Record<string, unknown>; /** Captured input (prompt / tool args), set only under content capture. */
55
- input?: unknown; /** Captured output (completion / tool result), set only under content capture. */
56
+ metadata?: Record<string, unknown>;
57
+ /** Captured input (prompt / tool args), set only under content capture. */
58
+ input?: unknown;
59
+ /** Captured output (completion / tool result), set only under content capture. */
56
60
  output?: unknown;
57
61
  };
58
62
  /** Body accepted by `observation.end()`. */
59
- type LangfuseObservationEndBody = {
63
+ export type LangfuseObservationEndBody = {
60
64
  endTime?: Date;
61
65
  level?: LangfuseObservationLevel;
62
66
  statusMessage?: string;
63
67
  };
64
68
  /** Langfuse usage block (`input`/`output`/`total` token counts). */
65
- type LangfuseUsageBody = {
69
+ export type LangfuseUsageBody = {
66
70
  input?: number;
67
71
  output?: number;
68
72
  total?: number;
69
73
  unit?: "TOKENS";
70
74
  };
71
75
  /** Langfuse observation severity levels. */
72
- type LangfuseObservationLevel = "DEFAULT" | "DEBUG" | "WARNING" | "ERROR";
76
+ export type LangfuseObservationLevel = "DEFAULT" | "DEBUG" | "WARNING" | "ERROR";
73
77
  /**
74
78
  * Options for {@link langfuseExporter}.
75
79
  *
@@ -78,17 +82,19 @@ type LangfuseObservationLevel = "DEFAULT" | "DEBUG" | "WARNING" | "ERROR";
78
82
  * stays an optional peer that is only imported when this exporter is
79
83
  * actually used).
80
84
  */
81
- type LangfuseExporterOptions = {
85
+ export type LangfuseExporterOptions = {
82
86
  /**
83
87
  * A pre-built Langfuse client (any object matching
84
88
  * {@link LangfuseClientLike}, including a real `Langfuse` instance).
85
89
  * When supplied, the exporter never imports the SDK itself.
86
90
  */
87
- client?: LangfuseClientLike; /** Langfuse public key — used to construct a client when `client` is omitted. */
88
- publicKey?: string; /** Langfuse secret key — used to construct a client when `client` is omitted. */
89
- secretKey?: string; /** Langfuse host base URL. Optional; defaults to the SDK's own default. */
91
+ client?: LangfuseClientLike;
92
+ /** Langfuse public key — used to construct a client when `client` is omitted. */
93
+ publicKey?: string;
94
+ /** Langfuse secret key — used to construct a client when `client` is omitted. */
95
+ secretKey?: string;
96
+ /** Langfuse host base URL. Optional; defaults to the SDK's own default. */
90
97
  baseUrl?: string;
91
98
  };
92
99
  //#endregion
93
- export { LangfuseClientLike, LangfuseExporterOptions, LangfuseObservationBody, LangfuseObservationEndBody, LangfuseObservationLevel, LangfuseObservationLike, LangfuseTraceBody, LangfuseTraceLike, LangfuseUsageBody };
94
100
  //# sourceMappingURL=langfuse-exporter.type.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"langfuse-exporter.type.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/langfuse/langfuse-exporter.type.ts"],"mappings":";;AASA;;;;;;;;KAAY,kBAAA;EACV,KAAA,CAAM,IAAA,EAAM,iBAAA,GAAoB,iBAAA;EAChC,UAAA,IAAc,OAAA;EACd,aAAA,IAAiB,OAAA;AAAA;;;;;KAOP,iBAAA;EACV,IAAA,CAAK,IAAA,EAAM,uBAAA,GAA0B,uBAAA;EACrC,UAAA,CAAW,IAAA,EAAM,uBAAA,GAA0B,uBAAA;AAAA;;;;;KAOjC,uBAAA;EACV,IAAA,CAAK,IAAA,EAAM,uBAAA,GAA0B,uBAAA;EACrC,UAAA,CAAW,IAAA,EAAM,uBAAA,GAA0B,uBAAA;EAC3C,GAAA,CAAI,IAAA,GAAO,0BAAA;AAAA;;KAID,iBAAA;EACV,EAAA;EACA,IAAA;EACA,SAAA;EACA,OAAA;EACA,SAAA,GAAY,IAAA;EACZ,QAAA,GAAW,MAAM,mBAbP;EAeV,KAAA;EAEA,MAAA;AAAA;;KAIU,uBAAA;EACV,EAAA;EACA,IAAA;EACA,SAAA,GAAY,IAAA;EACZ,OAAA,GAAU,IAAA;EACV,KAAA,GAAQ,wBAAA;EACR,aAAA;EACA,OAAA;EACA,KAAA,GAAQ,iBAAA;EACR,QAAA,GAAW,MAAA,mBA5BA;EA8BX,KAAA,YA7BA;EA+BA,MAAA;AAAA;;KAIU,0BAAA;EACV,OAAA,GAAU,IAAA;EACV,KAAA,GAAQ,wBAAwB;EAChC,aAAA;AAAA;;KAIU,iBAAA;EACV,KAAA;EACA,MAAA;EACA,KAAA;EACA,IAAA;AAAA;;KAIU,wBAAA;;;AApCJ;AAIR;;;;;KA0CY,uBAAA;EAlCF;;;;;EAwCR,MAAA,GAAS,kBAAkB,EA7C3B;EA+CA,SAAA,WA9CA;EAgDA,SAAA,WA/CA;EAiDA,OAAA;AAAA"}
1
+ {"version":3,"file":"langfuse-exporter.type.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/langfuse/langfuse-exporter.type.ts"],"mappings":";;;;;;;;;;YASY;EACV,MAAM,MAAM,oBAAoB;EAChC,cAAc;EACd,iBAAiB;;;;;;YAOP;EACV,KAAK,MAAM,0BAA0B;EACrC,WAAW,MAAM,0BAA0B;;;;;;YAOjC;EACV,KAAK,MAAM,0BAA0B;EACrC,WAAW,MAAM,0BAA0B;EAC3C,IAAI,OAAO;;;YAID;EACV;EACA;EACA;EACA;EACA,YAAY;EACZ,WAAW;;EAEX;;EAEA;;;YAIU;EACV;EACA;EACA,YAAY;EACZ,UAAU;EACV,QAAQ;EACR;EACA;EACA,QAAQ;EACR,WAAW;;EAEX;;EAEA;;;YAIU;EACV,UAAU;EACV,QAAQ;EACR;;;YAIU;EACV;EACA;EACA;EACA;;;YAIU;;;;;;;;;YAUA;;;;;;EAMV,SAAS;;EAET;;EAEA;;EAEA"}
@@ -1,2 +1,3 @@
1
1
  import { OtelExporterOptions } from "./otel-exporter.type.mjs";
2
- import { otelExporter } from "./otel-exporter.mjs";
2
+ import { otelExporter } from "./otel-exporter.mjs";
3
+ export { type OtelExporterOptions, otelExporter };
@@ -1,3 +1,3 @@
1
1
  import { otelExporter } from "./otel-exporter.mjs";
2
2
 
3
- export { };
3
+ export { otelExporter };
@@ -19,20 +19,20 @@
19
19
  * not the whole OTel API.
20
20
  */
21
21
  /** Subset of OTel `TimeInput` the exporter passes (epoch millis). */
22
- type OtelTimeInput = number;
22
+ export type OtelTimeInput = number;
23
23
  /** Opaque OTel `Context` — the exporter only threads it through. */
24
- type OtelContext = object;
24
+ export type OtelContext = object;
25
25
  /**
26
26
  * Exception shape accepted by `Span.recordException`. Mirrors the
27
27
  * `Exception` object form OTel accepts (name/message/stack).
28
28
  */
29
- type OtelException = {
29
+ export type OtelException = {
30
30
  name?: string;
31
31
  message?: string;
32
32
  stack?: string;
33
33
  };
34
34
  /** Status object passed to `Span.setStatus`. */
35
- type OtelSpanStatus = {
35
+ export type OtelSpanStatus = {
36
36
  code: number;
37
37
  message?: string;
38
38
  };
@@ -40,7 +40,7 @@ type OtelSpanStatus = {
40
40
  * Subset of OTel `Span` the exporter drives — set attributes/status,
41
41
  * record exceptions, and end with a timestamp.
42
42
  */
43
- type OtelSpan = {
43
+ export type OtelSpan = {
44
44
  setAttributes(attributes: Record<string, unknown>): void;
45
45
  setStatus(status: OtelSpanStatus): void;
46
46
  recordException(exception: OtelException): void;
@@ -50,11 +50,10 @@ type OtelSpan = {
50
50
  * Subset of OTel `Tracer` the exporter calls. `startSpan` is invoked
51
51
  * with a name, a `{ startTime }` options object, and a parent context.
52
52
  */
53
- type OtelTracer = {
53
+ export type OtelTracer = {
54
54
  startSpan(name: string, options: {
55
55
  startTime?: OtelTimeInput;
56
56
  }, context?: OtelContext): OtelSpan;
57
57
  };
58
58
  //#endregion
59
- export { OtelTracer };
60
59
  //# sourceMappingURL=otel-api.shim.type.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"otel-api.shim.type.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/otel/otel-api.shim.type.ts"],"mappings":";;AAqBA;;;;AAAyB;AAGzB;;;;AAAuB;AAMvB;;;;;;;;AAGO;AAAA,KAZK,aAAA;;KAGA,WAAA;;AAeH;AAOT;;KAhBY,aAAA;EACV,IAAA;EACA,OAAA;EACA,KAAA;AAAA;;KAIU,cAAA;EACV,IAAA;EACA,OAAO;AAAA;;;;;KAOG,QAAA;EACV,aAAA,CAAc,UAAA,EAAY,MAAA;EAC1B,SAAA,CAAU,MAAA,EAAQ,cAAA;EAClB,eAAA,CAAgB,SAAA,EAAW,aAAA;EAC3B,GAAA,CAAI,OAAA,GAAU,aAAA;AAAA;AAAa;AAO7B;;;AAP6B,KAOjB,UAAA;EACV,SAAA,CAAU,IAAA,UAAc,OAAA;IAAW,SAAA,GAAY,aAAA;EAAA,GAAiB,OAAA,GAAU,WAAA,GAAc,QAAA;AAAA"}
1
+ {"version":3,"file":"otel-api.shim.type.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/otel/otel-api.shim.type.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;YAqBY;;YAGA;;;;;YAMA;EACV;EACA;EACA;;;YAIU;EACV;EACA;;;;;;YAOU;EACV,cAAc,YAAY;EAC1B,UAAU,QAAQ;EAClB,gBAAgB,WAAW;EAC3B,IAAI,UAAU;;;;;;YAOJ;EACV,UAAU,cAAc;IAAW,YAAY;KAAiB,UAAU,cAAc"}
@@ -1,6 +1,6 @@
1
1
  import { ExporterContract } from "../../contracts/exporter.contract.mjs";
2
+ import "../../contracts/index.mjs";
2
3
  import { OtelExporterOptions } from "./otel-exporter.type.mjs";
3
-
4
4
  //#region ../../packages/ai-panoptic/src/exporters/otel/otel-exporter.d.ts
5
5
  /**
6
6
  * {@link ExporterContract} that maps Panoptic traces onto OpenTelemetry
@@ -23,7 +23,6 @@ import { OtelExporterOptions } from "./otel-exporter.type.mjs";
23
23
  * // app already set up @opentelemetry/sdk-trace-base + a provider
24
24
  * collector.use(otelExporter({ tracerName: "my-app", system: "openai" }));
25
25
  */
26
- declare function otelExporter(options?: OtelExporterOptions): ExporterContract;
26
+ export declare function otelExporter(options?: OtelExporterOptions): ExporterContract;
27
27
  //#endregion
28
- export { otelExporter };
29
28
  //# sourceMappingURL=otel-exporter.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"otel-exporter.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/otel/otel-exporter.ts"],"mappings":";;;;;;;AAuFA;;;;;;;;AAAiF;;;;;;;;;;iBAAjE,YAAA,CAAa,OAAA,GAAS,mBAAA,GAA2B,gBAAgB"}
1
+ {"version":3,"file":"otel-exporter.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/otel/otel-exporter.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;wBAuFgB,aAAa,UAAS,sBAA2B"}
@@ -1,5 +1,4 @@
1
1
  import { OtelTracer } from "./otel-api.shim.type.mjs";
2
-
3
2
  //#region ../../packages/ai-panoptic/src/exporters/otel/otel-exporter.type.d.ts
4
3
  /**
5
4
  * Options for {@link otelExporter}.
@@ -10,7 +9,7 @@ import { OtelTracer } from "./otel-api.shim.type.mjs";
10
9
  * exporter fetch one from the globally registered provider via
11
10
  * `trace.getTracer(name)`.
12
11
  */
13
- type OtelExporterOptions = {
12
+ export type OtelExporterOptions = {
14
13
  /**
15
14
  * A `Tracer` to emit spans on. When omitted, the exporter lazily calls
16
15
  * `trace.getTracer(tracerName, tracerVersion)` against the globally
@@ -39,5 +38,4 @@ type OtelExporterOptions = {
39
38
  system?: string;
40
39
  };
41
40
  //#endregion
42
- export { OtelExporterOptions };
43
41
  //# sourceMappingURL=otel-exporter.type.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"otel-exporter.type.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/otel/otel-exporter.type.ts"],"mappings":";;;;;AAWA;;;;;;;KAAY,mBAAA;EA0BV;;AAAM;;;;;;;EAhBN,MAAA,GAAS,UAAU;;;;;EAKnB,UAAA;;;;;EAKA,aAAA;;;;;;EAMA,MAAA;AAAA"}
1
+ {"version":3,"file":"otel-exporter.type.d.mts","names":[],"sources":["../../../../../../../../../packages/ai-panoptic/src/exporters/otel/otel-exporter.type.ts"],"mappings":";;;;;;;;;;;YAWY;;;;;;;;;;EAUV,SAAS;;;;;EAKT;;;;;EAKA;;;;;;EAMA"}