@mynitorai/sdk 0.2.0 → 0.2.2

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 (2) hide show
  1. package/dist/index.js +9 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -71,7 +71,9 @@ class MyNitor {
71
71
  const err = new Error();
72
72
  const stack = err.stack?.split('\n') || [];
73
73
  for (const line of stack) {
74
- if (!line.includes('mynitor') && !line.includes('Error') && line.includes('/')) {
74
+ // Exclude the SDK's own files, but don't be too broad (e.g. don't skip user's 'mynitor-app')
75
+ const isInternal = line.includes('@mynitorai/sdk') || line.includes('dist/sdk') || line.includes('mynitor/sdk');
76
+ if (!isInternal && !line.includes('Error') && line.includes('/')) {
75
77
  const match = line.match(/at\s+(?:(.+?)\s+\()?(.*?):(\d+):(\d+)\)?/);
76
78
  if (match) {
77
79
  const func = match[1] || 'anonymous';
@@ -138,7 +140,7 @@ class MyNitor {
138
140
  model: result.model || body.model,
139
141
  provider: 'openai',
140
142
  agent: 'default-agent',
141
- workflow: this.config.workflowId || callsite.workflowGuess,
143
+ workflow: self.config.workflowId || callsite.workflowGuess,
142
144
  file: callsite.file,
143
145
  function_name: callsite.functionName,
144
146
  line_number: callsite.line,
@@ -156,7 +158,7 @@ class MyNitor {
156
158
  model: body?.model || 'unknown',
157
159
  provider: 'openai',
158
160
  agent: 'default-agent',
159
- workflow: this.config.workflowId || callsite.workflowGuess,
161
+ workflow: self.config.workflowId || callsite.workflowGuess,
160
162
  file: callsite.file,
161
163
  function_name: callsite.functionName,
162
164
  latency_ms: end - start,
@@ -194,7 +196,7 @@ class MyNitor {
194
196
  model: result.model || body.model,
195
197
  provider: 'anthropic',
196
198
  agent: 'default-agent',
197
- workflow: this.config.workflowId || callsite.workflowGuess,
199
+ workflow: self.config.workflowId || callsite.workflowGuess,
198
200
  file: callsite.file,
199
201
  function_name: callsite.functionName,
200
202
  line_number: callsite.line,
@@ -212,7 +214,7 @@ class MyNitor {
212
214
  model: body?.model || 'unknown',
213
215
  provider: 'anthropic',
214
216
  agent: 'default-agent',
215
- workflow: this.config.workflowId || callsite.workflowGuess,
217
+ workflow: self.config.workflowId || callsite.workflowGuess,
216
218
  file: callsite.file,
217
219
  function_name: callsite.functionName,
218
220
  latency_ms: end - start,
@@ -250,7 +252,7 @@ class MyNitor {
250
252
  model: this.model || 'gemini',
251
253
  provider: 'google',
252
254
  agent: 'default-agent',
253
- workflow: this.config.workflowId || callsite.workflowGuess,
255
+ workflow: self.config.workflowId || callsite.workflowGuess,
254
256
  file: callsite.file,
255
257
  function_name: callsite.functionName,
256
258
  line_number: callsite.line,
@@ -268,7 +270,7 @@ class MyNitor {
268
270
  model: this.model || 'gemini',
269
271
  provider: 'google',
270
272
  agent: 'default-agent',
271
- workflow: this.config.workflowId || callsite.workflowGuess,
273
+ workflow: self.config.workflowId || callsite.workflowGuess,
272
274
  file: callsite.file,
273
275
  function_name: callsite.functionName,
274
276
  latency_ms: end - start,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mynitorai/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Production safety and observability for AI systems.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -30,4 +30,4 @@
30
30
  "openai": "^4.0.0",
31
31
  "@types/node": "^20.0.0"
32
32
  }
33
- }
33
+ }