@introspection-sdk/introspection-node 0.4.2 → 0.4.3

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 (151) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-check-types.log +4 -0
  3. package/.turbo/turbo-lint.log +5 -0
  4. package/dist/client.d.ts +42 -132
  5. package/dist/client.d.ts.map +1 -1
  6. package/dist/client.js +67 -366
  7. package/dist/client.js.map +1 -0
  8. package/dist/converters/claude.d.ts +4 -0
  9. package/dist/converters/claude.d.ts.map +1 -1
  10. package/dist/converters/claude.js +7 -0
  11. package/dist/converters/claude.js.map +1 -0
  12. package/dist/converters/gemini.d.ts +90 -0
  13. package/dist/converters/gemini.d.ts.map +1 -0
  14. package/dist/converters/gemini.js +171 -0
  15. package/dist/converters/gemini.js.map +1 -0
  16. package/dist/converters/index.d.ts +1 -1
  17. package/dist/converters/index.d.ts.map +1 -1
  18. package/dist/converters/index.js +2 -1
  19. package/dist/converters/index.js.map +1 -0
  20. package/dist/converters/openai.js +1 -0
  21. package/dist/converters/openai.js.map +1 -0
  22. package/dist/converters/openclaw.d.ts +16 -0
  23. package/dist/converters/openclaw.d.ts.map +1 -0
  24. package/dist/converters/openclaw.js +49 -0
  25. package/dist/converters/openinference.js +1 -0
  26. package/dist/converters/openinference.js.map +1 -0
  27. package/dist/converters/vercel.d.ts.map +1 -1
  28. package/dist/converters/vercel.js +31 -3
  29. package/dist/converters/vercel.js.map +1 -0
  30. package/dist/http.d.ts +36 -0
  31. package/dist/http.d.ts.map +1 -0
  32. package/dist/http.js +145 -0
  33. package/dist/http.js.map +1 -0
  34. package/dist/index.d.ts +24 -27
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +22 -32
  37. package/dist/index.js.map +1 -0
  38. package/dist/otel/anthropic.d.ts +62 -0
  39. package/dist/otel/anthropic.d.ts.map +1 -0
  40. package/dist/otel/anthropic.js +425 -0
  41. package/dist/otel/anthropic.js.map +1 -0
  42. package/dist/otel/claude-hooks.d.ts +346 -0
  43. package/dist/otel/claude-hooks.d.ts.map +1 -0
  44. package/dist/otel/claude-hooks.js +645 -0
  45. package/dist/otel/claude-hooks.js.map +1 -0
  46. package/dist/otel/claude-wrapper.d.ts +93 -0
  47. package/dist/otel/claude-wrapper.d.ts.map +1 -0
  48. package/dist/otel/claude-wrapper.js +155 -0
  49. package/dist/otel/claude-wrapper.js.map +1 -0
  50. package/dist/otel/gemini.d.ts +48 -0
  51. package/dist/otel/gemini.d.ts.map +1 -0
  52. package/dist/otel/gemini.js +297 -0
  53. package/dist/otel/gemini.js.map +1 -0
  54. package/dist/otel/index.d.ts +27 -0
  55. package/dist/otel/index.d.ts.map +1 -0
  56. package/dist/otel/index.js +33 -0
  57. package/dist/otel/index.js.map +1 -0
  58. package/dist/otel/langchain-handler.d.ts +112 -0
  59. package/dist/otel/langchain-handler.d.ts.map +1 -0
  60. package/dist/otel/langchain-handler.js +555 -0
  61. package/dist/otel/langchain-handler.js.map +1 -0
  62. package/dist/otel/logs.d.ts +82 -0
  63. package/dist/otel/logs.d.ts.map +1 -0
  64. package/dist/otel/logs.js +271 -0
  65. package/dist/otel/logs.js.map +1 -0
  66. package/dist/otel/mastra-exporter.d.ts +87 -0
  67. package/dist/otel/mastra-exporter.d.ts.map +1 -0
  68. package/dist/otel/mastra-exporter.js +525 -0
  69. package/dist/otel/mastra-exporter.js.map +1 -0
  70. package/dist/otel/pi.d.ts +59 -0
  71. package/dist/otel/pi.d.ts.map +1 -0
  72. package/dist/otel/pi.js +67 -0
  73. package/dist/otel/pi.js.map +1 -0
  74. package/dist/otel/setup.d.ts +23 -0
  75. package/dist/otel/setup.d.ts.map +1 -0
  76. package/dist/otel/setup.js +127 -0
  77. package/dist/otel/setup.js.map +1 -0
  78. package/dist/otel/span-processor.d.ts +62 -0
  79. package/dist/otel/span-processor.d.ts.map +1 -0
  80. package/dist/otel/span-processor.js +319 -0
  81. package/dist/otel/span-processor.js.map +1 -0
  82. package/dist/otel/tracing-processor.d.ts +139 -0
  83. package/dist/otel/tracing-processor.d.ts.map +1 -0
  84. package/dist/otel/tracing-processor.js +418 -0
  85. package/dist/otel/tracing-processor.js.map +1 -0
  86. package/dist/resources/experiments.d.ts +31 -0
  87. package/dist/resources/experiments.d.ts.map +1 -0
  88. package/dist/resources/experiments.js +133 -0
  89. package/dist/resources/experiments.js.map +1 -0
  90. package/dist/resources/recipes.d.ts +22 -0
  91. package/dist/resources/recipes.d.ts.map +1 -0
  92. package/dist/resources/recipes.js +61 -0
  93. package/dist/resources/recipes.js.map +1 -0
  94. package/dist/resources/runtimes.d.ts +76 -0
  95. package/dist/resources/runtimes.d.ts.map +1 -0
  96. package/dist/resources/runtimes.js +179 -0
  97. package/dist/resources/runtimes.js.map +1 -0
  98. package/dist/runner-resources/files.d.ts +35 -0
  99. package/dist/runner-resources/files.d.ts.map +1 -0
  100. package/dist/runner-resources/files.js +131 -0
  101. package/dist/runner-resources/files.js.map +1 -0
  102. package/dist/runner-resources/tasks.d.ts +39 -0
  103. package/dist/runner-resources/tasks.d.ts.map +1 -0
  104. package/dist/runner-resources/tasks.js +129 -0
  105. package/dist/runner-resources/tasks.js.map +1 -0
  106. package/dist/runner.d.ts +80 -0
  107. package/dist/runner.d.ts.map +1 -0
  108. package/dist/runner.js +159 -0
  109. package/dist/runner.js.map +1 -0
  110. package/dist/streaming.d.ts +8 -0
  111. package/dist/streaming.d.ts.map +1 -0
  112. package/dist/streaming.js +67 -0
  113. package/dist/streaming.js.map +1 -0
  114. package/dist/types/genai.d.ts +165 -0
  115. package/dist/types/genai.d.ts.map +1 -0
  116. package/dist/types/genai.js +82 -0
  117. package/dist/types.js +1 -0
  118. package/dist/types.js.map +1 -0
  119. package/dist/utils.js +1 -0
  120. package/dist/utils.js.map +1 -0
  121. package/dist/version.js +1 -0
  122. package/dist/version.js.map +1 -0
  123. package/package.json +81 -24
  124. package/src/client.ts +76 -473
  125. package/src/converters/claude.ts +10 -0
  126. package/src/converters/gemini.ts +243 -0
  127. package/src/converters/index.ts +13 -7
  128. package/src/converters/vercel.ts +41 -3
  129. package/src/http.ts +163 -0
  130. package/src/index.ts +110 -75
  131. package/src/{anthropic.ts → otel/anthropic.ts} +95 -8
  132. package/src/{claude-hooks.ts → otel/claude-hooks.ts} +119 -20
  133. package/src/{claude-wrapper.ts → otel/claude-wrapper.ts} +1 -1
  134. package/src/otel/gemini.ts +397 -0
  135. package/src/otel/index.ts +80 -0
  136. package/src/{langchain-handler.ts → otel/langchain-handler.ts} +53 -6
  137. package/src/otel/logs.ts +394 -0
  138. package/src/{mastra-exporter.ts → otel/mastra-exporter.ts} +83 -22
  139. package/src/otel/pi.ts +88 -0
  140. package/src/otel/setup.ts +174 -0
  141. package/src/{span-processor.ts → otel/span-processor.ts} +11 -6
  142. package/src/{tracing-processor.ts → otel/tracing-processor.ts} +94 -19
  143. package/src/resources/experiments.ts +170 -0
  144. package/src/resources/recipes.ts +73 -0
  145. package/src/resources/runtimes.ts +231 -0
  146. package/src/runner-resources/files.ts +163 -0
  147. package/src/runner-resources/tasks.ts +156 -0
  148. package/src/runner.ts +194 -0
  149. package/src/streaming.ts +57 -0
  150. package/src/ai-sdk-integration.ts +0 -691
  151. package/src/converters/ai-sdk.ts +0 -323
@@ -0,0 +1,165 @@
1
+ /**
2
+ * OTel Gen AI Semantic Convention types.
3
+ *
4
+ * These types represent the standardized format for gen_ai.input.messages
5
+ * and gen_ai.output.messages attributes as per OpenTelemetry Gen AI semantic conventions.
6
+ *
7
+ * @see https://opentelemetry.io/docs/specs/semconv/gen-ai/
8
+ */
9
+ /**
10
+ * A text content part in a message.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const part: TextPart = { type: "text", content: "Hello" };
15
+ * ```
16
+ */
17
+ export interface TextPart {
18
+ /** Discriminator — always `"text"`. */
19
+ type: "text";
20
+ /** The text body of this part. */
21
+ content: string;
22
+ }
23
+ /**
24
+ * A tool / function-call request part in a message.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const part: ToolCallRequestPart = { type: "tool_call", name: "get_weather", arguments: { city: "SF" } };
29
+ * ```
30
+ */
31
+ export interface ToolCallRequestPart {
32
+ /** Discriminator — always `"tool_call"`. */
33
+ type: "tool_call";
34
+ /** Function / tool name. */
35
+ name: string;
36
+ /** Correlation ID linking request to response. */
37
+ id?: string;
38
+ /** Arguments passed to the tool. */
39
+ arguments?: unknown;
40
+ }
41
+ /**
42
+ * A tool / function-call response part in a message.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const part: ToolCallResponsePart = { type: "tool_call_response", response: "72°F" };
47
+ * ```
48
+ */
49
+ export interface ToolCallResponsePart {
50
+ /** Discriminator — always `"tool_call_response"`. */
51
+ type: "tool_call_response";
52
+ /** The value returned by the tool. */
53
+ response: unknown;
54
+ /** Correlation ID linking response to request. */
55
+ id?: string;
56
+ }
57
+ /**
58
+ * A reasoning / thinking content part in a message.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * const part: ReasoningPart = { type: "thinking", content: "Let me think through this..." };
63
+ * ```
64
+ */
65
+ export interface ReasoningPart {
66
+ /** Discriminator — always `"thinking"`. */
67
+ type: "thinking";
68
+ /** The reasoning / thinking summary content. */
69
+ content?: string;
70
+ /** Encrypted reasoning signature (maps to OpenAI encrypted_content, Anthropic signature/redacted_thinking data). */
71
+ signature?: string;
72
+ /** Provider that produced this thinking block (e.g. `"anthropic"`, `"openai"`). Used to reconstruct the correct wire format on replay. */
73
+ provider_name?: string;
74
+ }
75
+ /** Union of all possible message-part shapes. */
76
+ export type MessagePart = TextPart | ToolCallRequestPart | ToolCallResponsePart | ReasoningPart;
77
+ /**
78
+ * A system instruction entry for `gen_ai.system_instructions`.
79
+ */
80
+ export interface SystemInstruction {
81
+ /** Part type — always `"text"`. */
82
+ type: "text";
83
+ /** The instruction text content. */
84
+ content: string;
85
+ }
86
+ /**
87
+ * An input message in OTel Gen AI semantic convention format.
88
+ *
89
+ * Used for the `gen_ai.input.messages` span attribute.
90
+ */
91
+ export interface InputMessage {
92
+ /** The role of the message sender. */
93
+ role: "system" | "user" | "assistant" | "tool";
94
+ /** Ordered content parts that compose this message. */
95
+ parts: MessagePart[];
96
+ /** Optional tool name when `role` is `"tool"`. */
97
+ name?: string;
98
+ }
99
+ /**
100
+ * An output message in OTel Gen AI semantic convention format.
101
+ *
102
+ * Used for the `gen_ai.output.messages` span attribute.
103
+ */
104
+ export interface OutputMessage {
105
+ /** The role of the message sender. */
106
+ role: "system" | "user" | "assistant" | "tool";
107
+ /** Ordered content parts that compose this message. */
108
+ parts: MessagePart[];
109
+ /** Model-reported finish reason (e.g. `"stop"`, `"end_turn"`). */
110
+ finish_reason?: string;
111
+ /** Optional tool name when `role` is `"tool"`. */
112
+ name?: string;
113
+ }
114
+ /**
115
+ * A tool definition for the `gen_ai.tool.definitions` attribute.
116
+ *
117
+ * @example
118
+ * ```ts
119
+ * const def: ToolDefinition = { name: "get_weather", description: "Get current weather" };
120
+ * ```
121
+ */
122
+ export interface ToolDefinition {
123
+ /** Tool / function name. */
124
+ name: string;
125
+ /** Human-readable description of what the tool does. */
126
+ description?: string;
127
+ /** JSON Schema describing the tool's parameters. */
128
+ parameters?: Record<string, unknown>;
129
+ }
130
+ /**
131
+ * GenAI semantic convention attributes.
132
+ *
133
+ * This interface represents the standardized GenAI attributes that can be
134
+ * converted to OpenTelemetry semantic convention format (gen_ai.* with dots).
135
+ *
136
+ * All properties use camelCase following TypeScript conventions.
137
+ */
138
+ export interface GenAiAttributes {
139
+ /** Model name (gen_ai.request.model) */
140
+ requestModel?: string;
141
+ /** System prompt (gen_ai.system) */
142
+ system?: string;
143
+ /** Operation name (gen_ai.operation.name) */
144
+ operationName?: string;
145
+ /** Tool definitions (gen_ai.tool.definitions) — serialized to JSON by {@link toAttributes}. */
146
+ toolDefinitions?: ToolDefinition[];
147
+ /** Input messages (gen_ai.input.messages) — serialized to JSON by {@link toAttributes}. */
148
+ inputMessages?: InputMessage[];
149
+ /** Output messages (gen_ai.output.messages) — serialized to JSON by {@link toAttributes}. */
150
+ outputMessages?: OutputMessage[];
151
+ /** System instructions (gen_ai.system_instructions) — serialized to JSON by {@link toAttributes}. */
152
+ systemInstructions?: SystemInstruction[];
153
+ /** Response ID (gen_ai.response.id) */
154
+ responseId?: string;
155
+ /** Input token count (gen_ai.usage.input_tokens) */
156
+ inputTokens?: number;
157
+ /** Output token count (gen_ai.usage.output_tokens) */
158
+ outputTokens?: number;
159
+ /** Cache creation input tokens (gen_ai.usage.cache_creation_input_tokens) */
160
+ cacheCreationInputTokens?: number;
161
+ /** Cache read input tokens (gen_ai.usage.cache_read_input_tokens) */
162
+ cacheReadInputTokens?: number;
163
+ }
164
+ export declare function toAttributes(attrs: GenAiAttributes): Record<string, string | number>;
165
+ //# sourceMappingURL=genai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genai.d.ts","sourceRoot":"","sources":["../../src/types/genai.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,IAAI,EAAE,WAAW,CAAC;IAClB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,qDAAqD;IACrD,IAAI,EAAE,oBAAoB,CAAC;IAC3B,sCAAsC;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;I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AAC,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+FAA+F;IAC/F,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,2FAA2F;IAC3F,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,6FAA6F;IAC7F,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;IACjC,qGAAqG;IACrG,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACzC,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qEAAqE;IACrE,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAmCD,wBAAgB,YAAY,CAC1B,KAAK,EAAE,eAAe,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAkDjC"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * OTel Gen AI Semantic Convention types.
3
+ *
4
+ * These types represent the standardized format for gen_ai.input.messages
5
+ * and gen_ai.output.messages attributes as per OpenTelemetry Gen AI semantic conventions.
6
+ *
7
+ * @see https://opentelemetry.io/docs/specs/semconv/gen-ai/
8
+ */
9
+ /**
10
+ * Convert a {@link GenAiAttributes} object to an OTel-compatible attributes
11
+ * dictionary with `gen_ai.*` dot-notation keys.
12
+ *
13
+ * Properties that are `undefined` are omitted from the result.
14
+ *
15
+ * @param attrs - The camelCase {@link GenAiAttributes} to convert.
16
+ * @returns A flat `Record<string, string | number>` with OTel semconv keys.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const otel = toAttributes({ requestModel: "gpt-4", inputTokens: 42 });
21
+ * // { "gen_ai.request.model": "gpt-4", "gen_ai.usage.input_tokens": 42 }
22
+ * ```
23
+ */
24
+ /**
25
+ * Recursively strip `undefined` and `null` values from an object before
26
+ * JSON serialization. Equivalent to Python's `model_dump(exclude_none=True)`.
27
+ */
28
+ function stripNullish(obj) {
29
+ if (Array.isArray(obj))
30
+ return obj.map(stripNullish);
31
+ if (obj !== null && typeof obj === "object") {
32
+ const out = {};
33
+ for (const [key, value] of Object.entries(obj)) {
34
+ if (value !== undefined && value !== null) {
35
+ out[key] = stripNullish(value);
36
+ }
37
+ }
38
+ return out;
39
+ }
40
+ return obj;
41
+ }
42
+ export function toAttributes(attrs) {
43
+ const result = {};
44
+ if (attrs.requestModel !== undefined) {
45
+ result["gen_ai.request.model"] = attrs.requestModel;
46
+ }
47
+ if (attrs.system !== undefined) {
48
+ result["gen_ai.system"] = attrs.system;
49
+ }
50
+ if (attrs.operationName !== undefined) {
51
+ result["gen_ai.operation.name"] = attrs.operationName;
52
+ }
53
+ if (attrs.toolDefinitions !== undefined) {
54
+ result["gen_ai.tool.definitions"] = JSON.stringify(stripNullish(attrs.toolDefinitions));
55
+ }
56
+ if (attrs.inputMessages !== undefined) {
57
+ result["gen_ai.input.messages"] = JSON.stringify(stripNullish(attrs.inputMessages));
58
+ }
59
+ if (attrs.outputMessages !== undefined) {
60
+ result["gen_ai.output.messages"] = JSON.stringify(stripNullish(attrs.outputMessages));
61
+ }
62
+ if (attrs.systemInstructions !== undefined) {
63
+ result["gen_ai.system_instructions"] = JSON.stringify(stripNullish(attrs.systemInstructions));
64
+ }
65
+ if (attrs.responseId !== undefined) {
66
+ result["gen_ai.response.id"] = attrs.responseId;
67
+ }
68
+ if (attrs.inputTokens !== undefined) {
69
+ result["gen_ai.usage.input_tokens"] = attrs.inputTokens;
70
+ }
71
+ if (attrs.outputTokens !== undefined) {
72
+ result["gen_ai.usage.output_tokens"] = attrs.outputTokens;
73
+ }
74
+ if (attrs.cacheCreationInputTokens !== undefined) {
75
+ result["gen_ai.usage.cache_creation.input_tokens"] =
76
+ attrs.cacheCreationInputTokens;
77
+ }
78
+ if (attrs.cacheReadInputTokens !== undefined) {
79
+ result["gen_ai.usage.cache_read.input_tokens"] = attrs.cacheReadInputTokens;
80
+ }
81
+ return result;
82
+ }
package/dist/types.js CHANGED
@@ -1 +1,2 @@
1
1
  export { generateEventId } from "@introspection-sdk/types";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/utils.js CHANGED
@@ -68,3 +68,4 @@ class IntrospectionLogger {
68
68
  }
69
69
  }
70
70
  export const logger = new IntrospectionLogger();
71
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,SAAS,gBAAgB;IACvB,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,SAAS,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAmB,OAAU;IAC7D,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,IAAI,CAAC,QAAQ;QAAE,OAAO,OAAO,CAAC;IAE9B,OAAO;QACL,GAAG,OAAO;QACV,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI,eAAe,CAAC,QAAQ,CAAC;KACjD,CAAC;AACT,CAAC;AAED;;;GAGG;AACH,MAAM,mBAAmB;IACf,QAAQ,CAAe;IAE/B;QACE,MAAM,WAAW,GAAG,CAClB,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,MAAM,CAC9C,CAAC,WAAW,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,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OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,IAAI,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,IAAe;QACxB,IAAI,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;YACzC,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,IAAI,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,mBAAmB,EAAE,CAAC"}
package/dist/version.js CHANGED
@@ -1,2 +1,3 @@
1
1
  /** Version information for introspection-sdk package. */
2
2
  export const VERSION = "0.1.0";
3
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@introspection-sdk/introspection-node",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Introspection observability SDK for Node.js",
6
6
  "type": "module",
@@ -11,26 +11,42 @@
11
11
  "types": "./dist/index.d.ts",
12
12
  "default": "./dist/index.js"
13
13
  },
14
+ "./otel": {
15
+ "types": "./dist/otel/index.d.ts",
16
+ "default": "./dist/otel/index.js"
17
+ },
14
18
  "./mastra": {
15
- "types": "./dist/mastra-exporter.d.ts",
16
- "default": "./dist/mastra-exporter.js"
19
+ "types": "./dist/otel/mastra-exporter.d.ts",
20
+ "default": "./dist/otel/mastra-exporter.js"
17
21
  },
18
22
  "./langchain": {
19
- "types": "./dist/langchain-handler.d.ts",
20
- "default": "./dist/langchain-handler.js"
23
+ "types": "./dist/otel/langchain-handler.d.ts",
24
+ "default": "./dist/otel/langchain-handler.js"
21
25
  }
22
26
  },
23
27
  "devDependencies": {
24
- "@openai/agents": "^0.11.4",
25
- "@types/node": "^22.15.3",
26
- "eslint": "^9.39.1",
27
- "@langchain/core": "^1.1.46",
28
- "@mastra/core": "^1.33.0",
29
- "@mastra/observability": "^1.12.0",
30
- "openai": "^6.37.0",
28
+ "@openai/agents": "^0.11.5",
29
+ "@opentelemetry/api-logs": "^0.218.0",
30
+ "@opentelemetry/context-async-hooks": "^2.7.1",
31
+ "@opentelemetry/core": "^2.7.1",
32
+ "@opentelemetry/exporter-logs-otlp-proto": "^0.218.0",
33
+ "@opentelemetry/exporter-trace-otlp-proto": "^0.218.0",
34
+ "@opentelemetry/resources": "^2.7.1",
35
+ "@opentelemetry/sdk-logs": "^0.218.0",
36
+ "@opentelemetry/sdk-trace-base": "^2.7.1",
37
+ "@opentelemetry/sdk-trace-node": "^2.7.1",
38
+ "@opentelemetry/semantic-conventions": "^1.41.1",
39
+ "@types/node": "^22.19.19",
40
+ "eslint": "^9.39.4",
41
+ "@langchain/core": "^1.1.48",
42
+ "@mastra/core": "^1.37.1",
43
+ "@mastra/observability": "^1.14.0",
44
+ "@mariozechner/pi-agent-core": "^0.73.1",
45
+ "@mariozechner/pi-ai": "^0.73.1",
46
+ "openai": "^6.39.1",
31
47
  "typescript": "5.9.3",
32
- "@repo/eslint-config": "0.0.0",
33
- "@repo/typescript-config": "0.0.0"
48
+ "@repo/typescript-config": "0.0.0",
49
+ "@repo/eslint-config": "0.0.0"
34
50
  },
35
51
  "peerDependencies": {
36
52
  "@openai/agents": ">=0.0.1",
@@ -38,7 +54,19 @@
38
54
  "ai": ">=4.0.0",
39
55
  "@mastra/core": ">=1.0.0",
40
56
  "@mastra/observability": ">=1.0.0",
41
- "@langchain/core": ">=0.3.0"
57
+ "@langchain/core": ">=0.3.0",
58
+ "@mariozechner/pi-agent-core": ">=0.70.0",
59
+ "@mariozechner/pi-ai": ">=0.70.0",
60
+ "@opentelemetry/api-logs": ">=0.50.0",
61
+ "@opentelemetry/context-async-hooks": ">=1.20.0 || >=2.0.0",
62
+ "@opentelemetry/core": ">=1.20.0 || >=2.0.0",
63
+ "@opentelemetry/exporter-logs-otlp-proto": ">=0.50.0",
64
+ "@opentelemetry/exporter-trace-otlp-proto": ">=0.50.0",
65
+ "@opentelemetry/resources": ">=1.20.0 || >=2.0.0",
66
+ "@opentelemetry/sdk-logs": ">=0.50.0",
67
+ "@opentelemetry/sdk-trace-base": ">=1.20.0 || >=2.0.0",
68
+ "@opentelemetry/sdk-trace-node": ">=1.20.0 || >=2.0.0",
69
+ "@opentelemetry/semantic-conventions": ">=1.20.0"
42
70
  },
43
71
  "peerDependenciesMeta": {
44
72
  "@openai/agents": {
@@ -58,20 +86,49 @@
58
86
  },
59
87
  "@langchain/core": {
60
88
  "optional": true
89
+ },
90
+ "@mariozechner/pi-agent-core": {
91
+ "optional": true
92
+ },
93
+ "@mariozechner/pi-ai": {
94
+ "optional": true
95
+ },
96
+ "@opentelemetry/api-logs": {
97
+ "optional": true
98
+ },
99
+ "@opentelemetry/context-async-hooks": {
100
+ "optional": true
101
+ },
102
+ "@opentelemetry/core": {
103
+ "optional": true
104
+ },
105
+ "@opentelemetry/exporter-logs-otlp-proto": {
106
+ "optional": true
107
+ },
108
+ "@opentelemetry/exporter-trace-otlp-proto": {
109
+ "optional": true
110
+ },
111
+ "@opentelemetry/resources": {
112
+ "optional": true
113
+ },
114
+ "@opentelemetry/sdk-logs": {
115
+ "optional": true
116
+ },
117
+ "@opentelemetry/sdk-trace-base": {
118
+ "optional": true
119
+ },
120
+ "@opentelemetry/sdk-trace-node": {
121
+ "optional": true
122
+ },
123
+ "@opentelemetry/semantic-conventions": {
124
+ "optional": true
61
125
  }
62
126
  },
63
127
  "dependencies": {
64
128
  "@opentelemetry/api": "^1.9.1",
65
- "@opentelemetry/api-logs": "^0.217.0",
66
- "@opentelemetry/core": "^2.7.1",
67
- "@opentelemetry/exporter-logs-otlp-proto": "^0.217.0",
68
- "@opentelemetry/exporter-trace-otlp-proto": "^0.217.0",
69
- "@opentelemetry/resources": "^2.7.1",
70
- "@opentelemetry/sdk-logs": "^0.217.0",
71
- "@opentelemetry/sdk-trace-base": "^2.7.1",
72
- "@opentelemetry/semantic-conventions": "^1.41.1",
73
129
  "https-proxy-agent": "^7.0.6",
74
- "@introspection-sdk/types": "0.4.2"
130
+ "@introspection-sdk/types": "0.4.3",
131
+ "@introspection-sdk/introspection-pi": "0.4.3"
75
132
  },
76
133
  "scripts": {
77
134
  "lint": "eslint . --max-warnings 0",