@raindrop-ai/deep-agents 0.0.6 → 0.1.1
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 +1 -11
- package/dist/index.d.mts +31 -6
- package/dist/index.d.ts +31 -6
- package/dist/index.js +534 -121
- package/dist/index.mjs +534 -121
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -120,17 +120,7 @@ The `createRaindropDeepAgents()` factory returns:
|
|
|
120
120
|
pnpm test -- tests/handler.test.ts
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
# E2E — requires all three keys
|
|
127
|
-
RAINDROP_WRITE_KEY=xxx \
|
|
128
|
-
OPENAI_API_KEY=sk-... \
|
|
129
|
-
RAINDROP_DASHBOARD_TOKEN=eyJ... \
|
|
130
|
-
pnpm test -- tests/e2e.test.ts
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
The dashboard token comes from `app.raindrop.ai` → DevTools → Network → any `backend.raindrop.ai` request → `Authorization: Bearer ...` (expires every ~30 min, so grab a fresh one immediately before running).
|
|
123
|
+
End-to-end coverage runs through the cross-SDK [conformance harness](https://github.com/invisible-tools/raindrop-sdk-harness). The `deep-agents` conformance driver (`conformance/deep-agents-driver.mjs`) maps the shared scenario corpus onto this package's public API. The fault lane runs locally and on every PR against a fault-injecting fake ingest; the prod lane verifies real ingest through the public Query API readback. See [`conformance/README.md`](../../conformance/README.md) and the harness [README](https://github.com/invisible-tools/raindrop-sdk-harness/blob/main/README.md) / [HOW-IT-WORKS](https://github.com/invisible-tools/raindrop-sdk-harness/blob/main/docs/HOW-IT-WORKS.md).
|
|
134
124
|
|
|
135
125
|
## Python
|
|
136
126
|
|
package/dist/index.d.mts
CHANGED
|
@@ -52,6 +52,10 @@ type IdentifyInput = {
|
|
|
52
52
|
userId: string;
|
|
53
53
|
traits?: Record<string, unknown>;
|
|
54
54
|
};
|
|
55
|
+
type EventUsage = {
|
|
56
|
+
promptTokens?: number;
|
|
57
|
+
completionTokens?: number;
|
|
58
|
+
};
|
|
55
59
|
type Patch = {
|
|
56
60
|
eventName?: string;
|
|
57
61
|
userId?: string;
|
|
@@ -59,7 +63,10 @@ type Patch = {
|
|
|
59
63
|
input?: string;
|
|
60
64
|
output?: string;
|
|
61
65
|
model?: string;
|
|
66
|
+
usage?: EventUsage;
|
|
67
|
+
error?: unknown;
|
|
62
68
|
properties?: Record<string, unknown>;
|
|
69
|
+
featureFlags?: Record<string, string>;
|
|
63
70
|
attachments?: Attachment[];
|
|
64
71
|
isPending?: boolean;
|
|
65
72
|
timestamp?: string;
|
|
@@ -156,12 +163,7 @@ declare class EventShipper {
|
|
|
156
163
|
*/
|
|
157
164
|
private requestOpts;
|
|
158
165
|
patch(eventId: string, patch: Patch): Promise<void>;
|
|
159
|
-
finish(eventId: string, patch:
|
|
160
|
-
output?: string;
|
|
161
|
-
model?: string;
|
|
162
|
-
properties?: Record<string, unknown>;
|
|
163
|
-
userId?: string;
|
|
164
|
-
}): Promise<void>;
|
|
166
|
+
finish(eventId: string, patch: Pick<Patch, "output" | "model" | "usage" | "error" | "properties" | "featureFlags" | "userId">): Promise<void>;
|
|
165
167
|
flush(): Promise<void>;
|
|
166
168
|
shutdown(): Promise<void>;
|
|
167
169
|
trackSignal(signal: SignalInput): Promise<void>;
|
|
@@ -334,6 +336,9 @@ declare class TraceShipper {
|
|
|
334
336
|
spanIdB64: string;
|
|
335
337
|
};
|
|
336
338
|
eventId: string;
|
|
339
|
+
userId?: string;
|
|
340
|
+
convoId?: string;
|
|
341
|
+
eventName?: string;
|
|
337
342
|
operationId?: string;
|
|
338
343
|
attributes?: Array<OtlpKeyValue | undefined>;
|
|
339
344
|
startTimeUnixNano?: string;
|
|
@@ -352,6 +357,9 @@ declare class TraceShipper {
|
|
|
352
357
|
spanIdB64: string;
|
|
353
358
|
};
|
|
354
359
|
eventId: string;
|
|
360
|
+
userId?: string;
|
|
361
|
+
convoId?: string;
|
|
362
|
+
eventName?: string;
|
|
355
363
|
startTimeUnixNano: string;
|
|
356
364
|
endTimeUnixNano: string;
|
|
357
365
|
attributes?: Array<OtlpKeyValue | undefined>;
|
|
@@ -432,6 +440,8 @@ interface RaindropDeepAgentsHandlerOptions {
|
|
|
432
440
|
traceShipper: TraceShipper;
|
|
433
441
|
userId?: string;
|
|
434
442
|
convoId?: string;
|
|
443
|
+
eventName?: string;
|
|
444
|
+
eventId?: () => string;
|
|
435
445
|
traceChains?: boolean;
|
|
436
446
|
}
|
|
437
447
|
declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
|
|
@@ -440,6 +450,8 @@ declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
|
|
|
440
450
|
private traceShipper;
|
|
441
451
|
private userId?;
|
|
442
452
|
private convoId?;
|
|
453
|
+
private eventName?;
|
|
454
|
+
private eventIdSource?;
|
|
443
455
|
private traceChains;
|
|
444
456
|
private spans;
|
|
445
457
|
private rootRunIds;
|
|
@@ -457,6 +469,7 @@ declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
|
|
|
457
469
|
private getParent;
|
|
458
470
|
private cleanup;
|
|
459
471
|
private finalizeEventIfRoot;
|
|
472
|
+
private rootErrorPatch;
|
|
460
473
|
handleLLMStart(llm: Serialized, prompts: string[], runId: string, parentRunId?: string, _extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): Promise<void>;
|
|
461
474
|
handleChatModelStart(llm: Serialized, messages: BaseMessage[][], runId: string, parentRunId?: string, _extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): Promise<void>;
|
|
462
475
|
handleLLMEnd(output: LLMResult, runId: string, _parentRunId?: string): Promise<void>;
|
|
@@ -481,6 +494,18 @@ interface DeepAgentsOptions {
|
|
|
481
494
|
debug?: boolean;
|
|
482
495
|
userId?: string;
|
|
483
496
|
convoId?: string;
|
|
497
|
+
/**
|
|
498
|
+
* Event name stamped on every captured event, replacing core's hardcoded
|
|
499
|
+
* `"ai_generation"` default (DEV-1167).
|
|
500
|
+
*/
|
|
501
|
+
eventName?: string;
|
|
502
|
+
/**
|
|
503
|
+
* Per-call event-id source, invoked once per captured root agent invocation
|
|
504
|
+
* to mint that event's id (and the linked spans' id), replacing the
|
|
505
|
+
* handler-minted UUID (DEV-1174). A throwing/empty/absent source falls back
|
|
506
|
+
* to a random UUID, so telemetry never crashes the caller.
|
|
507
|
+
*/
|
|
508
|
+
eventId?: () => string;
|
|
484
509
|
/**
|
|
485
510
|
* Optional Raindrop project slug. When set, every outbound cloud request
|
|
486
511
|
* carries an `X-Raindrop-Project-Id` header. Unset → no header (the project
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,10 @@ type IdentifyInput = {
|
|
|
52
52
|
userId: string;
|
|
53
53
|
traits?: Record<string, unknown>;
|
|
54
54
|
};
|
|
55
|
+
type EventUsage = {
|
|
56
|
+
promptTokens?: number;
|
|
57
|
+
completionTokens?: number;
|
|
58
|
+
};
|
|
55
59
|
type Patch = {
|
|
56
60
|
eventName?: string;
|
|
57
61
|
userId?: string;
|
|
@@ -59,7 +63,10 @@ type Patch = {
|
|
|
59
63
|
input?: string;
|
|
60
64
|
output?: string;
|
|
61
65
|
model?: string;
|
|
66
|
+
usage?: EventUsage;
|
|
67
|
+
error?: unknown;
|
|
62
68
|
properties?: Record<string, unknown>;
|
|
69
|
+
featureFlags?: Record<string, string>;
|
|
63
70
|
attachments?: Attachment[];
|
|
64
71
|
isPending?: boolean;
|
|
65
72
|
timestamp?: string;
|
|
@@ -156,12 +163,7 @@ declare class EventShipper {
|
|
|
156
163
|
*/
|
|
157
164
|
private requestOpts;
|
|
158
165
|
patch(eventId: string, patch: Patch): Promise<void>;
|
|
159
|
-
finish(eventId: string, patch:
|
|
160
|
-
output?: string;
|
|
161
|
-
model?: string;
|
|
162
|
-
properties?: Record<string, unknown>;
|
|
163
|
-
userId?: string;
|
|
164
|
-
}): Promise<void>;
|
|
166
|
+
finish(eventId: string, patch: Pick<Patch, "output" | "model" | "usage" | "error" | "properties" | "featureFlags" | "userId">): Promise<void>;
|
|
165
167
|
flush(): Promise<void>;
|
|
166
168
|
shutdown(): Promise<void>;
|
|
167
169
|
trackSignal(signal: SignalInput): Promise<void>;
|
|
@@ -334,6 +336,9 @@ declare class TraceShipper {
|
|
|
334
336
|
spanIdB64: string;
|
|
335
337
|
};
|
|
336
338
|
eventId: string;
|
|
339
|
+
userId?: string;
|
|
340
|
+
convoId?: string;
|
|
341
|
+
eventName?: string;
|
|
337
342
|
operationId?: string;
|
|
338
343
|
attributes?: Array<OtlpKeyValue | undefined>;
|
|
339
344
|
startTimeUnixNano?: string;
|
|
@@ -352,6 +357,9 @@ declare class TraceShipper {
|
|
|
352
357
|
spanIdB64: string;
|
|
353
358
|
};
|
|
354
359
|
eventId: string;
|
|
360
|
+
userId?: string;
|
|
361
|
+
convoId?: string;
|
|
362
|
+
eventName?: string;
|
|
355
363
|
startTimeUnixNano: string;
|
|
356
364
|
endTimeUnixNano: string;
|
|
357
365
|
attributes?: Array<OtlpKeyValue | undefined>;
|
|
@@ -432,6 +440,8 @@ interface RaindropDeepAgentsHandlerOptions {
|
|
|
432
440
|
traceShipper: TraceShipper;
|
|
433
441
|
userId?: string;
|
|
434
442
|
convoId?: string;
|
|
443
|
+
eventName?: string;
|
|
444
|
+
eventId?: () => string;
|
|
435
445
|
traceChains?: boolean;
|
|
436
446
|
}
|
|
437
447
|
declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
|
|
@@ -440,6 +450,8 @@ declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
|
|
|
440
450
|
private traceShipper;
|
|
441
451
|
private userId?;
|
|
442
452
|
private convoId?;
|
|
453
|
+
private eventName?;
|
|
454
|
+
private eventIdSource?;
|
|
443
455
|
private traceChains;
|
|
444
456
|
private spans;
|
|
445
457
|
private rootRunIds;
|
|
@@ -457,6 +469,7 @@ declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
|
|
|
457
469
|
private getParent;
|
|
458
470
|
private cleanup;
|
|
459
471
|
private finalizeEventIfRoot;
|
|
472
|
+
private rootErrorPatch;
|
|
460
473
|
handleLLMStart(llm: Serialized, prompts: string[], runId: string, parentRunId?: string, _extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): Promise<void>;
|
|
461
474
|
handleChatModelStart(llm: Serialized, messages: BaseMessage[][], runId: string, parentRunId?: string, _extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): Promise<void>;
|
|
462
475
|
handleLLMEnd(output: LLMResult, runId: string, _parentRunId?: string): Promise<void>;
|
|
@@ -481,6 +494,18 @@ interface DeepAgentsOptions {
|
|
|
481
494
|
debug?: boolean;
|
|
482
495
|
userId?: string;
|
|
483
496
|
convoId?: string;
|
|
497
|
+
/**
|
|
498
|
+
* Event name stamped on every captured event, replacing core's hardcoded
|
|
499
|
+
* `"ai_generation"` default (DEV-1167).
|
|
500
|
+
*/
|
|
501
|
+
eventName?: string;
|
|
502
|
+
/**
|
|
503
|
+
* Per-call event-id source, invoked once per captured root agent invocation
|
|
504
|
+
* to mint that event's id (and the linked spans' id), replacing the
|
|
505
|
+
* handler-minted UUID (DEV-1174). A throwing/empty/absent source falls back
|
|
506
|
+
* to a random UUID, so telemetry never crashes the caller.
|
|
507
|
+
*/
|
|
508
|
+
eventId?: () => string;
|
|
484
509
|
/**
|
|
485
510
|
* Optional Raindrop project slug. When set, every outbound cloud request
|
|
486
511
|
* carries an `X-Raindrop-Project-Id` header. Unset → no header (the project
|