@blyp/core 0.1.21 → 0.1.22

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 (242) hide show
  1. package/README.md +217 -11
  2. package/STABILITY.md +56 -0
  3. package/dist/ai/anthropic/index.d.ts +3 -0
  4. package/dist/ai/anthropic/normalize.d.ts +9 -0
  5. package/dist/ai/anthropic/stream.d.ts +3 -0
  6. package/dist/ai/anthropic/wrap.d.ts +13 -0
  7. package/dist/ai/anthropic.js +701 -0
  8. package/dist/ai/anthropic.mjs +701 -0
  9. package/dist/ai/fetch.js +701 -0
  10. package/dist/ai/fetch.mjs +701 -0
  11. package/dist/ai/openai/index.d.ts +3 -0
  12. package/dist/ai/openai/normalize.d.ts +10 -0
  13. package/dist/ai/openai/stream.d.ts +3 -0
  14. package/dist/ai/openai/wrap.d.ts +24 -0
  15. package/dist/ai/openai.js +701 -0
  16. package/dist/ai/openai.mjs +701 -0
  17. package/dist/ai/shared/fetch.d.ts +5 -0
  18. package/dist/ai/shared/index.d.ts +2 -0
  19. package/dist/ai/shared/normalize.d.ts +17 -0
  20. package/dist/ai/shared/redaction.d.ts +6 -0
  21. package/dist/ai/shared/stream.d.ts +7 -0
  22. package/dist/ai/shared/trace.d.ts +116 -0
  23. package/dist/ai/shared/types.d.ts +161 -0
  24. package/dist/ai/shared.js +701 -0
  25. package/dist/ai/shared.mjs +701 -0
  26. package/dist/ai/vercel/index.d.ts +3 -0
  27. package/dist/ai/vercel/middleware.d.ts +3 -0
  28. package/dist/ai/vercel/model.d.ts +3 -0
  29. package/dist/ai/vercel.js +701 -0
  30. package/dist/ai/vercel.mjs +701 -0
  31. package/dist/astro.js +618 -4519
  32. package/dist/astro.mjs +618 -4491
  33. package/dist/client.js +1 -1139
  34. package/dist/client.mjs +1 -1132
  35. package/dist/connectors/betterstack.js +9 -1532
  36. package/dist/connectors/betterstack.mjs +9 -1507
  37. package/dist/connectors/databuddy.js +9 -1456
  38. package/dist/connectors/databuddy.mjs +9 -1451
  39. package/dist/connectors/delivery/backoff.d.ts +2 -0
  40. package/dist/connectors/delivery/manager.d.ts +44 -0
  41. package/dist/connectors/delivery/queue-path.d.ts +1 -0
  42. package/dist/connectors/delivery/sqlite-adapter-bun.d.ts +1 -0
  43. package/dist/connectors/delivery/sqlite-adapter-node.d.ts +1 -0
  44. package/dist/connectors/delivery/sqlite-client.d.ts +37 -0
  45. package/dist/connectors/delivery/sqlite-worker.d.ts +1 -0
  46. package/dist/connectors/delivery/studio-queue.d.ts +12 -0
  47. package/dist/connectors/delivery/types.d.ts +98 -0
  48. package/dist/connectors/otlp/index.d.ts +1 -0
  49. package/dist/connectors/otlp.js +9 -1371
  50. package/dist/connectors/otlp.mjs +9 -1368
  51. package/dist/connectors/posthog/properties.d.ts +4 -0
  52. package/dist/connectors/posthog/sender.d.ts +0 -1
  53. package/dist/connectors/posthog.js +10 -1527
  54. package/dist/connectors/posthog.mjs +10 -1522
  55. package/dist/connectors/sentry.js +9 -1380
  56. package/dist/connectors/sentry.mjs +9 -1357
  57. package/dist/core/config.d.ts +7 -2
  58. package/dist/core/log-record.d.ts +5 -4
  59. package/dist/core/logger.d.ts +2 -0
  60. package/dist/core/optional-module.d.ts +1 -0
  61. package/dist/core/pino-pretty-loader.d.ts +4 -0
  62. package/dist/database.js +1 -24
  63. package/dist/database.mjs +1 -21
  64. package/dist/elysia.js +613 -4517
  65. package/dist/elysia.mjs +615 -4491
  66. package/dist/expo.js +1 -726
  67. package/dist/expo.mjs +1 -724
  68. package/dist/express.js +613 -4507
  69. package/dist/express.mjs +615 -4480
  70. package/dist/fastify.js +615 -4526
  71. package/dist/fastify.mjs +617 -4499
  72. package/dist/frameworks/elysia/index.d.ts +1 -1
  73. package/dist/frameworks/elysia/logger.d.ts +2 -35
  74. package/dist/frameworks/nestjs/helpers.d.ts +2 -0
  75. package/dist/frameworks/shared/http.d.ts +3 -2
  76. package/dist/frameworks/shared/index.d.ts +2 -1
  77. package/dist/frameworks/shared/logger.d.ts +2 -0
  78. package/dist/frameworks/shared/request-context.d.ts +2 -0
  79. package/dist/frameworks/shared/trace.d.ts +6 -0
  80. package/dist/hono.js +616 -4496
  81. package/dist/hono.mjs +618 -4470
  82. package/dist/index.d.ts +49 -19
  83. package/dist/index.js +615 -7557
  84. package/dist/index.mjs +618 -7465
  85. package/dist/nestjs.js +626 -4999
  86. package/dist/nestjs.mjs +621 -4966
  87. package/dist/nextjs.js +618 -4525
  88. package/dist/nextjs.mjs +620 -4499
  89. package/dist/nitro.js +617 -4642
  90. package/dist/nitro.mjs +619 -4616
  91. package/dist/nuxt.js +617 -4649
  92. package/dist/nuxt.mjs +619 -4623
  93. package/dist/react-router.js +616 -4559
  94. package/dist/react-router.mjs +618 -4533
  95. package/dist/shared/redaction.d.ts +17 -0
  96. package/dist/standalone.js +606 -3628
  97. package/dist/standalone.mjs +610 -3603
  98. package/dist/sveltekit.js +617 -4523
  99. package/dist/sveltekit.mjs +619 -4497
  100. package/dist/tanstack-start.js +616 -4522
  101. package/dist/tanstack-start.mjs +618 -4496
  102. package/dist/types/core/config.d.ts +57 -0
  103. package/dist/types/core/logger.d.ts +3 -0
  104. package/dist/types/core/structured-log.d.ts +2 -0
  105. package/dist/types/database.d.ts +1 -0
  106. package/dist/types/frameworks/astro.d.ts +1 -0
  107. package/dist/types/frameworks/client.d.ts +2 -0
  108. package/dist/types/frameworks/elysia.d.ts +2 -0
  109. package/dist/types/frameworks/express.d.ts +1 -0
  110. package/dist/types/frameworks/fastify.d.ts +1 -0
  111. package/dist/types/frameworks/hono.d.ts +1 -0
  112. package/dist/types/frameworks/http.d.ts +1 -0
  113. package/dist/types/frameworks/nestjs.d.ts +2 -0
  114. package/dist/types/frameworks/nextjs.d.ts +1 -0
  115. package/dist/types/frameworks/nitro.d.ts +1 -0
  116. package/dist/types/frameworks/react-router.d.ts +2 -0
  117. package/dist/types/frameworks/request-context.d.ts +1 -0
  118. package/dist/types/frameworks/shared.d.ts +4 -1
  119. package/dist/types/frameworks/standalone.d.ts +3 -2
  120. package/dist/types/frameworks/sveltekit.d.ts +1 -0
  121. package/dist/types/frameworks/tanstack-start.d.ts +9 -3
  122. package/dist/types/frameworks/workers.d.ts +3 -0
  123. package/dist/types/shared/client-log.d.ts +1 -0
  124. package/dist/workers.js +2 -626
  125. package/dist/workers.mjs +2 -623
  126. package/package.json +246 -173
  127. package/dist/astro.js.map +0 -1
  128. package/dist/astro.mjs.map +0 -1
  129. package/dist/client.js.map +0 -1
  130. package/dist/client.mjs.map +0 -1
  131. package/dist/connectors/betterstack.js.map +0 -1
  132. package/dist/connectors/betterstack.mjs.map +0 -1
  133. package/dist/connectors/databuddy.js.map +0 -1
  134. package/dist/connectors/databuddy.mjs.map +0 -1
  135. package/dist/connectors/otlp.js.map +0 -1
  136. package/dist/connectors/otlp.mjs.map +0 -1
  137. package/dist/connectors/posthog.js.map +0 -1
  138. package/dist/connectors/posthog.mjs.map +0 -1
  139. package/dist/connectors/sentry.js.map +0 -1
  140. package/dist/connectors/sentry.mjs.map +0 -1
  141. package/dist/database.js.map +0 -1
  142. package/dist/database.mjs.map +0 -1
  143. package/dist/elysia.js.map +0 -1
  144. package/dist/elysia.mjs.map +0 -1
  145. package/dist/expo.js.map +0 -1
  146. package/dist/expo.mjs.map +0 -1
  147. package/dist/express.js.map +0 -1
  148. package/dist/express.mjs.map +0 -1
  149. package/dist/fastify.js.map +0 -1
  150. package/dist/fastify.mjs.map +0 -1
  151. package/dist/hono.js.map +0 -1
  152. package/dist/hono.mjs.map +0 -1
  153. package/dist/index.js.map +0 -1
  154. package/dist/index.mjs.map +0 -1
  155. package/dist/nestjs.js.map +0 -1
  156. package/dist/nestjs.mjs.map +0 -1
  157. package/dist/nextjs.js.map +0 -1
  158. package/dist/nextjs.mjs.map +0 -1
  159. package/dist/nitro.js.map +0 -1
  160. package/dist/nitro.mjs.map +0 -1
  161. package/dist/nuxt.js.map +0 -1
  162. package/dist/nuxt.mjs.map +0 -1
  163. package/dist/react-router.js.map +0 -1
  164. package/dist/react-router.mjs.map +0 -1
  165. package/dist/standalone.js.map +0 -1
  166. package/dist/standalone.mjs.map +0 -1
  167. package/dist/sveltekit.js.map +0 -1
  168. package/dist/sveltekit.mjs.map +0 -1
  169. package/dist/tanstack-start.js.map +0 -1
  170. package/dist/tanstack-start.mjs.map +0 -1
  171. package/dist/workers.js.map +0 -1
  172. package/dist/workers.mjs.map +0 -1
  173. package/exports/client.js +0 -3
  174. package/exports/client.mjs +0 -3
  175. package/exports/connectors/betterstack.js +0 -1
  176. package/exports/connectors/betterstack.mjs +0 -1
  177. package/exports/connectors/databuddy.js +0 -1
  178. package/exports/connectors/databuddy.mjs +0 -1
  179. package/exports/connectors/otlp.js +0 -1
  180. package/exports/connectors/otlp.mjs +0 -1
  181. package/exports/connectors/posthog.js +0 -1
  182. package/exports/connectors/posthog.mjs +0 -1
  183. package/exports/connectors/sentry.js +0 -1
  184. package/exports/connectors/sentry.mjs +0 -1
  185. package/exports/database.js +0 -1
  186. package/exports/database.mjs +0 -1
  187. package/exports/expo.js +0 -1
  188. package/exports/expo.mjs +0 -1
  189. package/exports/frameworks/astro.js +0 -1
  190. package/exports/frameworks/astro.mjs +0 -1
  191. package/exports/frameworks/elysia.js +0 -1
  192. package/exports/frameworks/elysia.mjs +0 -1
  193. package/exports/frameworks/express.js +0 -1
  194. package/exports/frameworks/express.mjs +0 -1
  195. package/exports/frameworks/fastify.js +0 -1
  196. package/exports/frameworks/fastify.mjs +0 -1
  197. package/exports/frameworks/hono.js +0 -1
  198. package/exports/frameworks/hono.mjs +0 -1
  199. package/exports/frameworks/nestjs.js +0 -1
  200. package/exports/frameworks/nestjs.mjs +0 -1
  201. package/exports/frameworks/nextjs.js +0 -1
  202. package/exports/frameworks/nextjs.mjs +0 -1
  203. package/exports/frameworks/nitro.js +0 -1
  204. package/exports/frameworks/nitro.mjs +0 -1
  205. package/exports/frameworks/nuxt.js +0 -1
  206. package/exports/frameworks/nuxt.mjs +0 -1
  207. package/exports/frameworks/react-router.js +0 -1
  208. package/exports/frameworks/react-router.mjs +0 -1
  209. package/exports/frameworks/standalone.js +0 -1
  210. package/exports/frameworks/standalone.mjs +0 -1
  211. package/exports/frameworks/sveltekit.js +0 -1
  212. package/exports/frameworks/sveltekit.mjs +0 -1
  213. package/exports/frameworks/tanstack-start.js +0 -1
  214. package/exports/frameworks/tanstack-start.mjs +0 -1
  215. package/exports/workers.js +0 -1
  216. package/exports/workers.mjs +0 -1
  217. package/types/client.d.ts +0 -34
  218. package/types/connectors/betterstack.d.ts +0 -1
  219. package/types/connectors/databuddy.d.ts +0 -1
  220. package/types/connectors/otlp.d.ts +0 -1
  221. package/types/connectors/posthog.d.ts +0 -1
  222. package/types/connectors/sentry.d.ts +0 -1
  223. package/types/database.d.ts +0 -1
  224. package/types/expo.d.ts +0 -17
  225. package/types/frameworks/astro.d.ts +0 -1
  226. package/types/frameworks/client.d.ts +0 -160
  227. package/types/frameworks/elysia.d.ts +0 -1
  228. package/types/frameworks/expo.d.ts +0 -50
  229. package/types/frameworks/express.d.ts +0 -1
  230. package/types/frameworks/fastify.d.ts +0 -1
  231. package/types/frameworks/hono.d.ts +0 -1
  232. package/types/frameworks/nestjs.d.ts +0 -1
  233. package/types/frameworks/nextjs.d.ts +0 -1
  234. package/types/frameworks/nitro.d.ts +0 -1
  235. package/types/frameworks/nuxt.d.ts +0 -1
  236. package/types/frameworks/react-router.d.ts +0 -1
  237. package/types/frameworks/standalone.d.ts +0 -1
  238. package/types/frameworks/sveltekit.d.ts +0 -1
  239. package/types/frameworks/tanstack-start.d.ts +0 -1
  240. package/types/frameworks/workers.d.ts +0 -115
  241. package/types/index.d.ts +0 -1
  242. package/types/workers.d.ts +0 -13
package/README.md CHANGED
@@ -19,21 +19,22 @@
19
19
  - **PostHog connector** — Automatic or manual PostHog log forwarding for server, browser, and Expo flows
20
20
  - **Databuddy connector** — Automatic or manual Databuddy log forwarding and handled-error tracking for server, browser, and Expo flows
21
21
  - **OTLP connector** — Automatic or manual OpenTelemetry log forwarding for Grafana, Datadog, Honeycomb, and any OTLP-compatible backend
22
+ - **Connector delivery queue** — Optional server-side memory + SQLite retry queue for connector delivery without Redis
22
23
  - **Standalone usage** — Use without any framework
23
24
  - **Structured file logging** — NDJSON with size-based rotation and gzip archives
24
25
  - **Database logging** — Serverless-friendly persistence with Prisma and Drizzle adapters for Postgres and MySQL
25
26
  - **Client log sync** — Browser logs ingested into your backend stream
27
+ - **AI SDK tracing** — AI SDK middleware-based tracing for `generateText` and `streamText` flows
26
28
 
27
29
  ## Project structure
28
30
 
29
31
  ```
30
32
  blyp/
31
- ├── exports/
32
- │ ├── client.js # Public client entry shim
33
+ ├── dist/ # Published JS and declaration output
33
34
  │ ├── connectors/
34
- │ │ └── posthog.js # Public connector entry shims
35
+ │ │ └── posthog.js # Public connector build output
35
36
  │ └── frameworks/
36
- │ └── elysia.js # Public framework entry shims
37
+ │ └── elysia.js # Public framework build output
37
38
  ├── index.ts # Main source export bridge
38
39
  ├── src/
39
40
  │ ├── core/ # Logger runtime and file logging internals
@@ -46,12 +47,6 @@ blyp/
46
47
  │ │ └── posthog.ts # Connector-specific source types
47
48
  │ └── frameworks/
48
49
  │ └── elysia.ts # Framework-specific source types
49
- ├── types/
50
- │ ├── index.d.ts # Public type entry shim
51
- │ ├── connectors/
52
- │ │ └── posthog.d.ts # Public connector type shims
53
- │ └── frameworks/
54
- │ └── elysia.d.ts # Public framework type shims
55
50
  ├── tests/
56
51
  │ ├── frameworks/ # One test file per server integration
57
52
  │ ├── helpers/ # Shared test utilities
@@ -69,6 +64,10 @@ npx expo install expo-network
69
64
 
70
65
  Also: `npm install @blyp/core` | `yarn add @blyp/core` | `pnpm add @blyp/core`
71
66
 
67
+ ## Stability
68
+
69
+ Blyp publishes a production stability contract in [STABILITY.md](./STABILITY.md). The core logger API, framework adapters, and connector APIs are Stable. Studio UI and CLI commands are Beta. Internal APIs and unexported symbols are Unstable.
70
+
72
71
  ## Usage
73
72
 
74
73
  ### Basic logger
@@ -139,6 +138,34 @@ const app = new Elysia()
139
138
 
140
139
  Inside framework handlers, the imported `createStructuredLog(...)` automatically binds to the active request-scoped logger. Structured logs are emitted only when you call `.emit()`. In framework request loggers, a structured emit replaces that request's normal auto request log. If you mix a request-scoped structured logger with the root `logger` in the same request, Blyp warns once and ignores the root logger call.
141
140
 
141
+ ### Automatic redaction
142
+
143
+ Blyp redacts sensitive values before they reach the console, files, database adapters, connectors, client ingestion, or framework request logs.
144
+
145
+ Default redacted keys:
146
+
147
+ `password`, `passwd`, `pwd`, `secret`, `token`, `api_key`, `apikey`, `api_secret`, `authorization`, `auth`, `x-api-key`, `private_key`, `privatekey`, `access_token`, `refresh_token`, `client_secret`, `session`, `cookie`, `set-cookie`, `ssn`, `credit_card`, `card_number`, `cvv`, `cvc`, `otp`, `pin`
148
+
149
+ Blyp also scans string values for common secret patterns and replaces matches with typed markers such as `[REDACTED:bearer]`, `[REDACTED:jwt]`, `[REDACTED:api_key]`, and `[REDACTED:card]`.
150
+
151
+ ```ts
152
+ export default {
153
+ redact: {
154
+ keys: ['my_custom_secret', 'internal_token'],
155
+ paths: ['user.ssn', 'payment.**.raw'],
156
+ patterns: [/MY_ORG_[A-Z0-9]{32}/],
157
+ disablePatternScanning: false,
158
+ },
159
+ };
160
+ ```
161
+
162
+ Notes:
163
+
164
+ - `redact.paths` supports exact paths, `*`, and `**`
165
+ - regex `patterns` require executable config such as `blyp.config.ts`
166
+ - request headers such as `Authorization`, `Cookie`, `Set-Cookie`, `X-API-Key`, and `X-Auth-Token` are redacted by default
167
+ - Blyp preserves keys and replaces values with `[REDACTED]` or a typed marker
168
+
142
169
  ### Errors
143
170
 
144
171
  ```typescript
@@ -163,6 +190,19 @@ const app = new Elysia()
163
190
  .listen(3000);
164
191
  ```
165
192
 
193
+ Framework HTTP loggers also support path filtering:
194
+
195
+ ```typescript
196
+ import { createLogger } from '@blyp/core/express';
197
+
198
+ app.use(createLogger({
199
+ includePaths: ['/api/**'],
200
+ ignorePaths: ['/api/internal/**'],
201
+ }));
202
+ ```
203
+
204
+ `includePaths` works as an allowlist for automatic `http_request` and `http_error` logs. It uses the same wildcard matching as `ignorePaths`. When both are configured, Blyp logs only included paths and then removes any path that also matches `ignorePaths`.
205
+
166
206
  For other frameworks, client logging, advanced configuration, and utilities, see [Full documentation](docs/README.md).
167
207
 
168
208
  ### Expo
@@ -179,6 +219,125 @@ logger.info('app mounted');
179
219
 
180
220
  Expo uses the runtime `fetch` implementation for delivery and `expo-network` for connectivity metadata. Install `expo-network` in your app and use an absolute ingestion URL.
181
221
 
222
+ ### Durable connector retries
223
+
224
+ Server-side connector delivery can be queued and retried with an internal Blyp-managed SQLite file. This is opt-in, uses at-least-once delivery semantics, and currently applies to server connector log forwarding only.
225
+
226
+ ```typescript
227
+ import { createStandaloneLogger } from '@blyp/core/standalone';
228
+
229
+ const logger = createStandaloneLogger({
230
+ connectors: {
231
+ betterstack: {
232
+ enabled: true,
233
+ sourceToken: process.env.BETTERSTACK_TOKEN,
234
+ ingestingHost: 'https://in.logs.betterstack.com',
235
+ },
236
+ delivery: {
237
+ enabled: true,
238
+ durableQueuePath: '.blyp/connectors.sqlite',
239
+ retry: {
240
+ maxAttempts: 8,
241
+ initialBackoffMs: 500,
242
+ maxBackoffMs: 30000,
243
+ },
244
+ },
245
+ },
246
+ });
247
+ ```
248
+
249
+ Notes:
250
+
251
+ - Blyp stores the durable queue in its own SQLite file, not your app database.
252
+ - Blyp uses an in-memory hot buffer first, then persists retryable connector failures to SQLite.
253
+ - Older runtimes without built-in SQLite support fall back to memory-only retries with a warning.
254
+ - Exception capture remains best-effort direct delivery in this first version.
255
+
256
+ ### AI tracing
257
+
258
+ Use `@blyp/core/ai/vercel` for Vercel AI SDK middleware, or the provider wrappers when you want direct SDK instrumentation without a universal LLM abstraction.
259
+
260
+ Common case:
261
+
262
+ ```typescript
263
+ import { streamText } from 'ai';
264
+ import { anthropic } from '@ai-sdk/anthropic';
265
+ import { blypModel } from '@blyp/core/ai/vercel';
266
+
267
+ const model = blypModel(anthropic('claude-sonnet-4-5'), {
268
+ operation: 'support_chat',
269
+ });
270
+
271
+ const result = streamText({
272
+ model,
273
+ prompt: 'Write a refund reply for this customer',
274
+ });
275
+ ```
276
+
277
+ Advanced middleware usage:
278
+
279
+ ```typescript
280
+ import { wrapLanguageModel } from 'ai';
281
+ import { anthropic } from '@ai-sdk/anthropic';
282
+ import { blypMiddleware } from '@blyp/core/ai/vercel';
283
+
284
+ const model = wrapLanguageModel({
285
+ model: anthropic('claude-sonnet-4-5'),
286
+ middleware: blypMiddleware({
287
+ operation: 'support_chat',
288
+ }),
289
+ });
290
+ ```
291
+
292
+ By default Blyp logs one structured `ai_trace` record per AI SDK call with provider, model, operation, token usage, finish reason, timing, and best-effort tool events. Prompt, response, reasoning, tool input, tool output, and stream chunk capture are off by default. When Blyp request context is active, AI traces inherit the active request-scoped logger automatically.
293
+
294
+ Direct provider wrappers:
295
+
296
+ ```typescript
297
+ import OpenAI from 'openai';
298
+ import Anthropic from '@anthropic-ai/sdk';
299
+ import { wrapOpenAI } from '@blyp/core/ai/openai';
300
+ import { wrapAnthropic } from '@blyp/core/ai/anthropic';
301
+
302
+ const openai = wrapOpenAI(new OpenAI({ apiKey: process.env.OPENAI_API_KEY }), {
303
+ operation: 'draft_blog_intro',
304
+ });
305
+
306
+ const anthropic = wrapAnthropic(new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY }), {
307
+ operation: 'summarize_ticket',
308
+ });
309
+ ```
310
+
311
+ OpenRouter is supported through the OpenAI-compatible path:
312
+
313
+ ```typescript
314
+ import OpenAI from 'openai';
315
+ import { wrapOpenAI } from '@blyp/core/ai/openai';
316
+
317
+ const client = wrapOpenAI(
318
+ new OpenAI({
319
+ apiKey: process.env.OPENROUTER_API_KEY,
320
+ baseURL: 'https://openrouter.ai/api/v1',
321
+ }),
322
+ {
323
+ provider: 'openrouter',
324
+ operation: 'route_experiment',
325
+ }
326
+ );
327
+ ```
328
+
329
+ Optional transport tracing:
330
+
331
+ ```typescript
332
+ import OpenAI from 'openai';
333
+ import { blypFetch } from '@blyp/core/ai/fetch';
334
+
335
+ const client = new OpenAI({
336
+ apiKey: process.env.OPENAI_API_KEY,
337
+ fetch: blypFetch(fetch),
338
+ });
339
+ ```
340
+
182
341
  ### Database logging
183
342
 
184
343
  Use `destination: 'database'` when you cannot rely on filesystem writes, such as serverless deployments. Database mode requires an executable config file like `blyp.config.ts` because Prisma and Drizzle adapters are runtime objects.
@@ -235,6 +394,12 @@ blyp logs init --adapter drizzle --dialect mysql
235
394
 
236
395
  Use `connectors.betterstack` when you want Blyp logs forwarded into Better Stack through `@logtail/node`:
237
396
 
397
+ Install the optional peer dependencies for this connector when you enable it:
398
+
399
+ ```bash
400
+ bun add @logtail/node @sentry/node
401
+ ```
402
+
238
403
  ```typescript
239
404
  export default {
240
405
  connectors: {
@@ -303,6 +468,12 @@ The browser and Expo connector flow still posts to Blyp first. Blyp forwards to
303
468
 
304
469
  Use `blyp.config.ts` when you want to read the PostHog project key from the environment:
305
470
 
471
+ Install the optional peer dependencies for this connector when you enable it:
472
+
473
+ ```bash
474
+ bun add posthog-node @opentelemetry/api-logs @opentelemetry/exporter-logs-otlp-http @opentelemetry/resources @opentelemetry/sdk-logs
475
+ ```
476
+
306
477
  ```typescript
307
478
  export default {
308
479
  connectors: {
@@ -359,6 +530,12 @@ The client and Expo connector flow still posts to Blyp first. Blyp forwards to P
359
530
 
360
531
  Use `connectors.databuddy` when you want Blyp logs and handled errors forwarded into Databuddy:
361
532
 
533
+ Install the optional peer dependency for this connector when you enable it:
534
+
535
+ ```bash
536
+ bun add @databuddy/sdk
537
+ ```
538
+
362
539
  ```typescript
363
540
  export default {
364
541
  connectors: {
@@ -411,6 +588,12 @@ Client `error` and `critical` logs requested through the Databuddy connector are
411
588
 
412
589
  Use `connectors.sentry` when you want Blyp logs forwarded into Sentry Logs:
413
590
 
591
+ Install the optional peer dependency for this connector when you enable it:
592
+
593
+ ```bash
594
+ bun add @sentry/node
595
+ ```
596
+
414
597
  ```typescript
415
598
  export default {
416
599
  connectors: {
@@ -465,6 +648,12 @@ The browser and Expo Sentry flow still posts to Blyp first. Blyp forwards to Sen
465
648
 
466
649
  Use `connectors.otlp` when you want to send logs to named OTLP-compatible backends such as Grafana Cloud, Datadog, Honeycomb, or a self-hosted OpenTelemetry Collector:
467
650
 
651
+ Install the optional peer dependencies for this connector when you enable it:
652
+
653
+ ```bash
654
+ bun add @opentelemetry/api-logs @opentelemetry/exporter-logs-otlp-http @opentelemetry/resources @opentelemetry/sdk-logs
655
+ ```
656
+
468
657
  ```typescript
469
658
  export default {
470
659
  connectors: {
@@ -560,7 +749,23 @@ bun run type-check
560
749
 
561
750
  ## Publishing
562
751
 
563
- GitHub Actions publishes the package to npm when a GitHub Release is published. Add an `NPM_TOKEN` repository secret before using the workflow.
752
+ GitHub Actions publishes the package to npm when a GitHub Release is published. Add an `NPM_TOKEN` repository secret before using the workflow. The publish workflow uses npm provenance attestation, and maintainers should rotate `NPM_TOKEN` every 90 days.
753
+
754
+ ## Security
755
+
756
+ Security issues should be reported through GitHub's private advisory flow for this repository. Public issue reports are not the right channel for suspected vulnerabilities. Security details and disclosure expectations are in [SECURITY.md](SECURITY.md).
757
+
758
+ ## Runtime dependencies
759
+
760
+ Blyp keeps its shipped runtime dependency surface small and documents each direct dependency:
761
+
762
+ - `pino`: core structured logger engine
763
+ - `pino-pretty`: human-readable local and development console output when `pretty` mode is enabled
764
+ - `jiti`: runtime loading for `blyp.config.*` files and optional first-party subpath modules
765
+ - `fflate`: gzip compression and decompression for archived log files and log reading
766
+ - `zod`: runtime validation for shared and client payloads
767
+
768
+ Optional connectors stay in `peerDependencies` so regular installs do not pull large connector-specific transitive trees by default.
564
769
 
565
770
  ## Contributing
566
771
 
@@ -579,6 +784,7 @@ This project is licensed under the MIT License — see the [LICENSE](LICENSE) fi
579
784
  - [GitHub Repository](https://github.com/Blyphq/blyp)
580
785
  - [NPM Package](https://www.npmjs.com/package/@blyp/core)
581
786
  - [Documentation](docs/README.md)
787
+ - [Security Policy](SECURITY.md)
582
788
  - [Issues](https://github.com/Blyphq/blyp/issues)
583
789
 
584
790
  ---
package/STABILITY.md ADDED
@@ -0,0 +1,56 @@
1
+ # Stability
2
+
3
+ This document is Blyp's canonical compatibility contract for production adopters.
4
+
5
+ ## Why this exists
6
+
7
+ During Blyp's early releases, the npm package name changed from `blyp-js` to `@blyp/core`, the CLI executable changed from `blyphq` to `blyp`, and TypeScript subpath declaration shims were fixed after release. Those changes created uncertainty about what production users can rely on.
8
+
9
+ This file defines the stability guarantees for Blyp's public surfaces going forward.
10
+
11
+ ## Stability tiers
12
+
13
+ | Area | Tier | Guarantee |
14
+ | --- | --- | --- |
15
+ | Core logger API (`logger.*`, `createStructuredLog`, `createError`) | Stable | No breaking changes without a major version bump |
16
+ | Framework adapters (`@blyp/core/hono`, `/nextjs`, etc.) | Stable | Same guarantee |
17
+ | Connector APIs | Stable | Same guarantee |
18
+ | Studio UI | Beta | May change between minor versions |
19
+ | CLI commands | Beta | Commands may be added/changed with minor version |
20
+ | Internal APIs / unexported symbols | Unstable | No guarantees |
21
+
22
+ ## Deprecation policy
23
+
24
+ - Stable APIs are deprecated before removal.
25
+ - Deprecations are called out in GitHub release notes and changelog entries.
26
+ - Deprecated Stable APIs remain available for at least one minor release before removal.
27
+ - Removing a Stable API is a breaking change and therefore requires a major version bump.
28
+ - Beta surfaces may change in a minor release without a deprecation window.
29
+ - Unstable and internal surfaces may change at any time.
30
+
31
+ ## How breaking changes are communicated
32
+
33
+ Blyp communicates breaking changes through these channels:
34
+
35
+ - GitHub Releases in `Blyphq/blyp` are the authoritative release-note channel for package changes.
36
+ - Changelog entries, including the docs changelog, provide the human-readable running history.
37
+ - Migration notes are included when a release changes common adoption paths or requires user action.
38
+
39
+ ## Bun vs Node support
40
+
41
+ "Blyp-first" means Blyp is designed around Bun as the primary optimization target while maintaining feature parity for Stable documented APIs on Bun and supported Node versions.
42
+
43
+ - Stable documented APIs are intended to work on Bun and supported Node versions.
44
+ - Bun may receive earlier runtime-specific optimizations or validation when runtime behavior differs.
45
+ - Node support is not best effort for Stable surfaces.
46
+ - If a documented capability cannot ship with Stable parity on Node, it must be documented as Beta or explicitly scoped to Bun before release.
47
+
48
+ ## Out of scope
49
+
50
+ This contract does not cover:
51
+
52
+ - private helpers
53
+ - unexported symbols
54
+ - internal file layout
55
+ - undocumented implementation details
56
+ - behavior that is present in source but not documented as part of a public API
@@ -0,0 +1,3 @@
1
+ export { wrapAnthropic } from './wrap';
2
+ export { blypFetch } from '../shared/fetch';
3
+ export type { AIToolCallRecord, BlypLLMEventPart, BlypLLMTrace, BlypProviderOptions, BlypSDKContext, } from '../shared/types';
@@ -0,0 +1,9 @@
1
+ import { normalizeTokenUsage } from '../shared/normalize';
2
+ import type { AIToolCallRecord } from '../shared/types';
3
+ export declare function normalizeAnthropicResponse(response: unknown): {
4
+ model?: string;
5
+ usage?: ReturnType<typeof normalizeTokenUsage>;
6
+ finishReason?: string;
7
+ output?: unknown;
8
+ toolCalls: AIToolCallRecord[];
9
+ };
@@ -0,0 +1,3 @@
1
+ import { markSDKFirstChunk } from '../shared/trace';
2
+ import type { BlypSDKContext } from '../shared/types';
3
+ export declare function consumeAnthropicStreamChunk(state: Parameters<typeof markSDKFirstChunk>[0], context: BlypSDKContext, chunk: unknown): Promise<void>;
@@ -0,0 +1,13 @@
1
+ import type { BlypProviderOptions } from '../shared/types';
2
+ type AnthropicMessagesCreateParams = {
3
+ model?: string;
4
+ messages?: unknown;
5
+ stream?: boolean;
6
+ };
7
+ type WrappedAnthropicClient = {
8
+ messages?: {
9
+ create?: (params: AnthropicMessagesCreateParams, ...rest: unknown[]) => Promise<unknown>;
10
+ };
11
+ };
12
+ export declare function wrapAnthropic<TClient extends WrappedAnthropicClient>(client: TClient, options?: BlypProviderOptions): TClient;
13
+ export {};