risicare 0.1.0
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 +99 -0
- package/dist/index.cjs +1268 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +564 -0
- package/dist/index.d.ts +564 -0
- package/dist/index.js +1193 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/anthropic/index.cjs +237 -0
- package/dist/providers/anthropic/index.cjs.map +1 -0
- package/dist/providers/anthropic/index.d.cts +23 -0
- package/dist/providers/anthropic/index.d.ts +23 -0
- package/dist/providers/anthropic/index.js +210 -0
- package/dist/providers/anthropic/index.js.map +1 -0
- package/dist/providers/openai/index.cjs +296 -0
- package/dist/providers/openai/index.cjs.map +1 -0
- package/dist/providers/openai/index.d.cts +27 -0
- package/dist/providers/openai/index.d.ts +27 -0
- package/dist/providers/openai/index.js +269 -0
- package/dist/providers/openai/index.js.map +1 -0
- package/dist/providers/vercel-ai/index.cjs +245 -0
- package/dist/providers/vercel-ai/index.cjs.map +1 -0
- package/dist/providers/vercel-ai/index.d.cts +33 -0
- package/dist/providers/vercel-ai/index.d.ts +33 -0
- package/dist/providers/vercel-ai/index.js +218 -0
- package/dist/providers/vercel-ai/index.js.map +1 -0
- package/package.json +101 -0
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Risicare
|
|
2
|
+
|
|
3
|
+
Self-healing observability for AI agents. Captures decision-level traces, diagnoses failures, and deploys fixes — automatically.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/risicare)
|
|
6
|
+
[](https://www.npmjs.com/package/risicare)
|
|
7
|
+
|
|
8
|
+
## Quick Start
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install risicare
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import { init } from 'risicare';
|
|
16
|
+
|
|
17
|
+
init({
|
|
18
|
+
apiKey: 'rsk-...',
|
|
19
|
+
endpoint: 'https://app.risicare.ai',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// That's it. LLM calls are now traced automatically.
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Provider Instrumentation
|
|
26
|
+
|
|
27
|
+
Wrap your provider client to auto-capture all LLM calls:
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { patchOpenAI } from 'risicare/openai';
|
|
31
|
+
import OpenAI from 'openai';
|
|
32
|
+
|
|
33
|
+
const openai = patchOpenAI(new OpenAI());
|
|
34
|
+
// All chat.completions.create and embeddings calls are now traced.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Supported Providers
|
|
38
|
+
|
|
39
|
+
| Provider | Import |
|
|
40
|
+
|----------|--------|
|
|
41
|
+
| OpenAI | `risicare/openai` |
|
|
42
|
+
| Anthropic | `risicare/anthropic` |
|
|
43
|
+
| Vercel AI SDK | `risicare/vercel-ai` |
|
|
44
|
+
|
|
45
|
+
## Decorators
|
|
46
|
+
|
|
47
|
+
Structure your traces with agent identity and decision phases:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { agent, session, traceThink, traceDecide, traceAct } from 'risicare';
|
|
51
|
+
|
|
52
|
+
const myAgent = agent({ name: 'planner', role: 'coordinator' }, async (input) => {
|
|
53
|
+
const analysis = await traceThink('analyze', async () => {
|
|
54
|
+
return await openai.chat.completions.create({ ... });
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const decision = await traceDecide('choose-action', async () => {
|
|
58
|
+
return pickBestAction(analysis);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return await traceAct('execute', async () => {
|
|
62
|
+
return executeAction(decision);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Wrap in a session for user-level tracking
|
|
67
|
+
const result = await session({ userId: 'user-123' }, () => myAgent(input));
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Features
|
|
71
|
+
|
|
72
|
+
- **Zero runtime dependencies** — no bloat in your node_modules
|
|
73
|
+
- **Dual CJS/ESM** — works with CommonJS `require()` and ES module `import`
|
|
74
|
+
- **Full TypeScript** — strict types, generics, and IntelliSense out of the box
|
|
75
|
+
- **Non-blocking** — async batch export with circuit breaker and retry
|
|
76
|
+
- **Context propagation** — automatic across `async/await`, `Promise`, `setTimeout`, and `EventEmitter`
|
|
77
|
+
- **Zero overhead when disabled** — frozen NOOP_SPAN singleton, no allocations
|
|
78
|
+
|
|
79
|
+
## Progressive Integration
|
|
80
|
+
|
|
81
|
+
| Tier | Effort | What You Get |
|
|
82
|
+
|------|--------|-------------|
|
|
83
|
+
| **Tier 0** | `RISICARE_TRACING=true` (env var) | Auto-instrument all LLM calls |
|
|
84
|
+
| **Tier 1** | `import { init } from 'risicare'` | Explicit config, custom endpoint |
|
|
85
|
+
| **Tier 2** | `agent()` wrapper | Agent identity and hierarchy |
|
|
86
|
+
| **Tier 3** | `session()` wrapper | User session tracking |
|
|
87
|
+
| **Tier 4** | `traceThink / traceDecide / traceAct` | Decision phase visibility |
|
|
88
|
+
| **Tier 5** | `traceMessage / traceDelegate` | Multi-agent communication |
|
|
89
|
+
|
|
90
|
+
## Requirements
|
|
91
|
+
|
|
92
|
+
- Node.js >= 18.0.0
|
|
93
|
+
- TypeScript >= 5.0 (optional, for type checking)
|
|
94
|
+
|
|
95
|
+
## Links
|
|
96
|
+
|
|
97
|
+
- [Documentation](https://risicare.ai/docs)
|
|
98
|
+
- [Dashboard](https://app.risicare.ai)
|
|
99
|
+
- [Python SDK](https://pypi.org/project/risicare/)
|