@sentro/sdk 0.1.1 → 0.1.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.
package/README.md CHANGED
@@ -99,6 +99,12 @@ const sentro = new Sentro({
99
99
  | `maxBatchSize` | number | `100` | Max events per batch before immediate flush |
100
100
  | `defaultTags` | Record\<string, string\> | — | Tags merged into every event |
101
101
 
102
+ ## Security Considerations
103
+
104
+ - Set `capturePrompts: false` (the default) to avoid storing LLM prompt/response bodies that may contain PII
105
+ - DSN tokens are API keys — treat them like passwords, don't commit them to source control
106
+ - Tool call inputs/outputs are stored as-is — avoid passing sensitive data (API keys, passwords) through traced tool calls
107
+
102
108
  ## Graceful Shutdown
103
109
 
104
110
  ```typescript
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Sentro integration for Vercel AI SDK.
3
+ *
4
+ * Usage:
5
+ * import { Sentro } from '@sentro/sdk';
6
+ * import { sentroMiddleware } from '@sentro/sdk/vercel-ai';
7
+ *
8
+ * const sentro = new Sentro({ dsn: '...' });
9
+ *
10
+ * const result = await generateText({
11
+ * model: openai('gpt-4o'),
12
+ * prompt: 'Hello!',
13
+ * experimental_telemetry: sentroMiddleware(sentro),
14
+ * });
15
+ */
16
+ import type { Sentro } from '../client';
17
+ interface TelemetrySettings {
18
+ isEnabled: boolean;
19
+ functionId?: string;
20
+ metadata?: Record<string, string>;
21
+ tracer?: {
22
+ startSpan: (name: string, options?: Record<string, unknown>) => Span;
23
+ };
24
+ }
25
+ interface Span {
26
+ setAttribute(key: string, value: string | number | boolean): void;
27
+ setStatus(status: {
28
+ code: number;
29
+ message?: string;
30
+ }): void;
31
+ end(): void;
32
+ }
33
+ interface SentroMiddlewareOptions {
34
+ agentName?: string;
35
+ }
36
+ export declare function sentroMiddleware(client: Sentro, options?: SentroMiddlewareOptions): TelemetrySettings;
37
+ export {};
38
+ //# sourceMappingURL=vercel-ai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vercel-ai.d.ts","sourceRoot":"","sources":["../../src/integrations/vercel-ai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,UAAU,iBAAiB;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,MAAM,CAAC,EAAE;QACP,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;KACtE,CAAC;CACH;AAED,UAAU,IAAI;IACZ,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IAClE,SAAS,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC5D,GAAG,IAAI,IAAI,CAAC;CACb;AAED,UAAU,uBAAuB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,uBAA4B,GACpC,iBAAiB,CAoDnB"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Sentro integration for Vercel AI SDK.
3
+ *
4
+ * Usage:
5
+ * import { Sentro } from '@sentro/sdk';
6
+ * import { sentroMiddleware } from '@sentro/sdk/vercel-ai';
7
+ *
8
+ * const sentro = new Sentro({ dsn: '...' });
9
+ *
10
+ * const result = await generateText({
11
+ * model: openai('gpt-4o'),
12
+ * prompt: 'Hello!',
13
+ * experimental_telemetry: sentroMiddleware(sentro),
14
+ * });
15
+ */
16
+ export function sentroMiddleware(client, options = {}) {
17
+ const agentName = options.agentName ?? 'vercel-ai-agent';
18
+ return {
19
+ isEnabled: true,
20
+ functionId: agentName,
21
+ tracer: {
22
+ startSpan(name, spanOptions) {
23
+ const attributes = {};
24
+ const span = {
25
+ setAttribute(key, value) {
26
+ attributes[key] = String(value);
27
+ // Capture LLM call data when available
28
+ if (key === 'ai.model.id') {
29
+ const step = client._currentStep;
30
+ if (step) {
31
+ const llm = step.llmCall({ model: String(value) });
32
+ span._llmCall = llm;
33
+ }
34
+ }
35
+ if (key === 'ai.usage.promptTokens' && span._llmCall) {
36
+ span._promptTokens = Number(value);
37
+ }
38
+ if (key === 'ai.usage.completionTokens' && span._llmCall) {
39
+ span._completionTokens = Number(value);
40
+ }
41
+ },
42
+ setStatus(status) {
43
+ attributes['status.code'] = status.code;
44
+ if (status.message)
45
+ attributes['status.message'] = status.message;
46
+ },
47
+ end() {
48
+ const llmCall = span._llmCall;
49
+ if (llmCall) {
50
+ llmCall.end({
51
+ promptTokens: span._promptTokens,
52
+ completionTokens: span._completionTokens,
53
+ });
54
+ }
55
+ },
56
+ };
57
+ return span;
58
+ },
59
+ },
60
+ };
61
+ }
62
+ //# sourceMappingURL=vercel-ai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vercel-ai.js","sourceRoot":"","sources":["../../src/integrations/vercel-ai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAuBH,MAAM,UAAU,gBAAgB,CAC9B,MAAc,EACd,UAAmC,EAAE;IAErC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,iBAAiB,CAAC;IAEzD,OAAO;QACL,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE;YACN,SAAS,CAAC,IAAY,EAAE,WAAqC;gBAC3D,MAAM,UAAU,GAAoC,EAAE,CAAC;gBAEvD,MAAM,IAAI,GAAS;oBACjB,YAAY,CAAC,GAAW,EAAE,KAAgC;wBACxD,UAAU,CAAC,GAAG,CAAC,GAAG,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ro/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Error tracking and agent observability for AI agents — TypeScript SDK for Sentro",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "files": ["dist", "README.md"],
8
- "keywords": ["sentro", "observability", "error-tracking", "ai-agents", "llm", "tracing", "sentry-alternative"],
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./vercel-ai": {
13
+ "types": "./dist/integrations/vercel-ai.d.ts",
14
+ "default": "./dist/integrations/vercel-ai.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md"
20
+ ],
21
+ "keywords": [
22
+ "sentro",
23
+ "observability",
24
+ "error-tracking",
25
+ "ai-agents",
26
+ "llm",
27
+ "tracing",
28
+ "sentry-alternative"
29
+ ],
9
30
  "license": "MIT",
10
31
  "repository": {
11
32
  "type": "git",
@@ -17,10 +38,12 @@
17
38
  "scripts": {
18
39
  "build": "tsc",
19
40
  "test": "vitest run",
41
+ "test:coverage": "vitest run --coverage",
20
42
  "test:watch": "vitest",
21
43
  "dev": "tsc --watch"
22
44
  },
23
45
  "devDependencies": {
46
+ "@vitest/coverage-v8": "^3.2.4",
24
47
  "typescript": "^5.7.0",
25
48
  "vitest": "^3.1.0"
26
49
  }