vibezcheck 0.5.0 → 0.5.4

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 (74) hide show
  1. package/README.md +43 -24
  2. package/dist/ai-sdk/index.d.mts +4 -4
  3. package/dist/ai-sdk/index.d.ts +4 -4
  4. package/dist/ai-sdk/index.js +357 -43
  5. package/dist/ai-sdk/index.js.map +1 -1
  6. package/dist/ai-sdk/index.mjs +357 -43
  7. package/dist/ai-sdk/index.mjs.map +1 -1
  8. package/dist/ai-sdk/middleware.d.mts +3 -3
  9. package/dist/ai-sdk/middleware.d.ts +3 -3
  10. package/dist/ai-sdk/middleware.js +316 -44
  11. package/dist/ai-sdk/middleware.js.map +1 -1
  12. package/dist/ai-sdk/middleware.mjs +316 -44
  13. package/dist/ai-sdk/middleware.mjs.map +1 -1
  14. package/dist/billing/index.d.mts +3 -3
  15. package/dist/billing/index.d.ts +3 -3
  16. package/dist/billing/index.js +312 -42
  17. package/dist/billing/index.js.map +1 -1
  18. package/dist/billing/index.mjs +312 -42
  19. package/dist/billing/index.mjs.map +1 -1
  20. package/dist/cli/index.js +103 -29
  21. package/dist/cli/index.js.map +1 -1
  22. package/dist/cli/index.mjs +103 -29
  23. package/dist/cli/index.mjs.map +1 -1
  24. package/dist/{client-CJ2Dj8ID.d.ts → client-BORmJy8s.d.ts} +1 -1
  25. package/dist/{client-Dmwb3hQt.d.mts → client-CbuXmoXz.d.mts} +1 -1
  26. package/dist/compat/stripe-meter.d.mts +4 -4
  27. package/dist/compat/stripe-meter.d.ts +4 -4
  28. package/dist/compat/stripe-meter.js +336 -47
  29. package/dist/compat/stripe-meter.js.map +1 -1
  30. package/dist/compat/stripe-meter.mjs +336 -47
  31. package/dist/compat/stripe-meter.mjs.map +1 -1
  32. package/dist/compat/stripe-provider.d.mts +4 -24
  33. package/dist/compat/stripe-provider.d.ts +4 -24
  34. package/dist/compat/stripe-provider.js +498 -59
  35. package/dist/compat/stripe-provider.js.map +1 -1
  36. package/dist/compat/stripe-provider.mjs +505 -59
  37. package/dist/compat/stripe-provider.mjs.map +1 -1
  38. package/dist/compat/token-meter.d.mts +18 -6
  39. package/dist/compat/token-meter.d.ts +18 -6
  40. package/dist/compat/token-meter.js +343 -35
  41. package/dist/compat/token-meter.js.map +1 -1
  42. package/dist/compat/token-meter.mjs +343 -35
  43. package/dist/compat/token-meter.mjs.map +1 -1
  44. package/dist/customers/index.d.mts +1 -1
  45. package/dist/customers/index.d.ts +1 -1
  46. package/dist/index.d.mts +10 -7
  47. package/dist/index.d.ts +10 -7
  48. package/dist/index.js +672 -47
  49. package/dist/index.js.map +1 -1
  50. package/dist/index.mjs +664 -47
  51. package/dist/index.mjs.map +1 -1
  52. package/dist/meter/index.d.mts +2 -2
  53. package/dist/meter/index.d.ts +2 -2
  54. package/dist/meter/index.js +220 -25
  55. package/dist/meter/index.js.map +1 -1
  56. package/dist/meter/index.mjs +220 -25
  57. package/dist/meter/index.mjs.map +1 -1
  58. package/dist/pricing/index.d.mts +11 -3
  59. package/dist/pricing/index.d.ts +11 -3
  60. package/dist/pricing/index.js +153 -8
  61. package/dist/pricing/index.js.map +1 -1
  62. package/dist/pricing/index.mjs +152 -8
  63. package/dist/pricing/index.mjs.map +1 -1
  64. package/dist/react/index.d.mts +6 -4
  65. package/dist/react/index.d.ts +6 -4
  66. package/dist/react/index.js +420 -200
  67. package/dist/react/index.js.map +1 -1
  68. package/dist/react/index.mjs +420 -200
  69. package/dist/react/index.mjs.map +1 -1
  70. package/dist/{types-BVGqbKnY.d.mts → types-6P71CXAD.d.mts} +10 -6
  71. package/dist/{types-BVGqbKnY.d.ts → types-6P71CXAD.d.ts} +10 -6
  72. package/dist/{with-billing-CDqKIAQ6.d.ts → with-billing-Bj6Ya_Iy.d.ts} +5 -3
  73. package/dist/{with-billing-mci2vtFS.d.mts → with-billing-DndWGxL8.d.mts} +5 -3
  74. package/package.json +10 -10
package/README.md CHANGED
@@ -39,7 +39,7 @@ const model = vibezcheck('openai/gpt-4o', { customer: 'cus_alex' });
39
39
  ## 📦 Installation
40
40
 
41
41
  ```bash
42
- npm install vibezcheck ai @ai-sdk/openai stripe
42
+ npm install vibezcheck ai @ai-sdk/openai @ai-sdk/react stripe
43
43
  ```
44
44
 
45
45
  ---
@@ -74,38 +74,47 @@ export async function POST(req: Request) {
74
74
 
75
75
  ```tsx
76
76
  'use client';
77
- import { useChat } from 'ai/react';
77
+
78
+ import { useChat } from '@ai-sdk/react';
79
+ import { useState } from 'react';
78
80
  import { VibezCheck } from 'vibezcheck/ui';
79
81
 
80
- export default function ChatPage() {
81
- const { messages, input, handleInputChange, handleSubmit } = useChat();
82
+ export default function Chat() {
83
+ const [input, setInput] = useState('');
84
+ const { messages, sendMessage } = useChat();
82
85
 
83
86
  return (
84
- <main className="max-w-2xl mx-auto p-6 space-y-4">
85
- <div className="space-y-3">
86
- {messages.map((m) => (
87
- <div key={m.id} className="p-3 rounded-lg bg-slate-100 dark:bg-slate-800">
88
- <strong>{m.role}: </strong>
89
- <span>{m.content}</span>
90
- </div>
91
- ))}
92
- </div>
93
-
94
- <form onSubmit={handleSubmit} className="flex gap-2">
87
+ <div className="flex flex-col w-full max-w-md py-24 mx-auto stretch">
88
+ {messages.map(message => (
89
+ <div key={message.id} className="whitespace-pre-wrap">
90
+ {message.role === 'user' ? 'User: ' : 'AI: '}
91
+ {message.parts.map((part, i) => {
92
+ switch (part.type) {
93
+ case 'text':
94
+ return <div key={`${message.id}-${i}`}>{part.text}</div>;
95
+ }
96
+ })}
97
+ </div>
98
+ ))}
99
+
100
+ <form
101
+ onSubmit={e => {
102
+ e.preventDefault();
103
+ sendMessage({ text: input });
104
+ setInput('');
105
+ }}
106
+ >
95
107
  <input
108
+ className="fixed dark:bg-zinc-900 bottom-0 w-full max-w-md p-2 mb-8 border border-zinc-300 dark:border-zinc-800 rounded shadow-xl"
96
109
  value={input}
97
- onChange={handleInputChange}
98
- placeholder="Ask anything..."
99
- className="flex-1 p-2 border rounded-lg"
110
+ placeholder="Say something..."
111
+ onChange={e => setInput(e.currentTarget.value)}
100
112
  />
101
- <button type="submit" className="px-4 py-2 bg-blue-600 text-white rounded-lg">
102
- Send
103
- </button>
104
113
  </form>
105
114
 
106
- {/* ✦ 1-Line HUD: Works with zero database & zero Stripe in Dev Mode */}
107
- <VibezCheck messages={messages} model="gpt-4o-mini" margin={1.3} />
108
- </main>
115
+ {/* ✦ 1-Line Token Meter & Financial HUD: Works with zero database & zero Stripe in Dev Mode */}
116
+ <VibezCheck messages={messages} />
117
+ </div>
109
118
  );
110
119
  }
111
120
  ```
@@ -225,6 +234,16 @@ npx vibezcheck audit --ci
225
234
 
226
235
  ---
227
236
 
237
+ ## 📂 Examples
238
+
239
+ * **[Next.js App Router + OpenAI](examples/nextjs-app-router-openai)**: Direct implementation of the official [AI SDK Next.js App Router Tutorial](https://ai-sdk.dev/docs/getting-started/nextjs-app-router) with 1-line VibezCheck token metering.
240
+ * **[Next.js 15 AI SaaS Starter](examples/nextjs-saas-starter)**: Complete SaaS template with Stripe Checkout, Top-Up Modal, and `<VibezReceipt />`.
241
+ * **[Local Cost Meter](examples/01-local-cost-meter.ts)**: Offline micro-transaction calculations with BigInt Nano-USD precision.
242
+ * **[Native OpenAI Streaming](examples/03-native-openai-stream.ts)**: Zero-latency stream wrapper for the official `openai` Node SDK.
243
+ * **[Claude 3.7 Reasoning Tokens](examples/04-claude-thinking.ts)**: Tracking hidden thought tokens with Anthropic SDK.
244
+
245
+ ---
246
+
228
247
  ## 📄 License
229
248
 
230
249
  MIT © [VibezCheck](https://vibezcheck.xyz)
@@ -1,7 +1,7 @@
1
- import { W as WithBillingOptions } from '../with-billing-mci2vtFS.mjs';
2
- export { m as meteredModel, w as withBilling } from '../with-billing-mci2vtFS.mjs';
3
- import { C as CustomerParam } from '../types-BVGqbKnY.mjs';
4
- import { V as VibezMeter } from '../client-Dmwb3hQt.mjs';
1
+ import { W as WithBillingOptions } from '../with-billing-DndWGxL8.mjs';
2
+ export { m as meteredModel, w as withBilling } from '../with-billing-DndWGxL8.mjs';
3
+ import { C as CustomerParam } from '../types-6P71CXAD.mjs';
4
+ import { V as VibezMeter } from '../client-CbuXmoXz.mjs';
5
5
  import 'stripe';
6
6
 
7
7
  interface VibezCheckModelOptions extends WithBillingOptions {
@@ -1,7 +1,7 @@
1
- import { W as WithBillingOptions } from '../with-billing-CDqKIAQ6.js';
2
- export { m as meteredModel, w as withBilling } from '../with-billing-CDqKIAQ6.js';
3
- import { C as CustomerParam } from '../types-BVGqbKnY.js';
4
- import { V as VibezMeter } from '../client-CJ2Dj8ID.js';
1
+ import { W as WithBillingOptions } from '../with-billing-Bj6Ya_Iy.js';
2
+ export { m as meteredModel, w as withBilling } from '../with-billing-Bj6Ya_Iy.js';
3
+ import { C as CustomerParam } from '../types-6P71CXAD.js';
4
+ import { V as VibezMeter } from '../client-BORmJy8s.js';
5
5
  import 'stripe';
6
6
 
7
7
  interface VibezCheckModelOptions extends WithBillingOptions {