@raindrop-ai/deep-agents 0.1.2 → 0.1.3

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
@@ -139,7 +139,7 @@ The `createRaindropDeepAgents()` factory returns:
139
139
  - **Streaming**: Token-by-token streaming events are not captured individually; only the final aggregated response is tracked.
140
140
  - **Subagent isolation**: When using the `task` tool for subagent delegation, each subagent's callbacks fire independently.
141
141
  - **Concurrent invocations on a shared handler**: A single handler instance keeps one in-flight span map at a time. Running multiple `agent.invoke(...)` calls **concurrently with the same handler** (e.g. `Promise.all([agent.invoke(...), agent.invoke(...)])` with the same `raindrop.handler`) can scramble the linkage between events and traces. Instantiate one `createRaindropDeepAgents()` per concurrent request; sequential invocations on a shared handler are fully supported.
142
- - **Long chain inputs/outputs are truncated**: Chain-level `input` and `output` captured on the root event are truncated to ~8 KB to stay within the SDK's payload-size limit. Per-LLM child events still carry full prompts. Tool payloads are pruned to their cap _before_ JSON serialization, so a multi-MB tool output costs the cap — not the payload — on your event loop (truncated values carry a `...[truncated by raindrop]` marker).
142
+ - **Long inputs/outputs are truncated at `maxTextFieldChars`**: The root event's `input` is the latest user message and its `output` the final response, each capped at the configured `maxTextFieldChars` (default 1,000,000 chars), the same cap the other JavaScript integrations use; the full conversation history lives on the LLM span (`ai.prompt.messages`). Tool payloads are pruned to the cap _before_ JSON serialization, so a multi-MB tool output costs the cap — not the payload — on your event loop (truncated values carry a `...[truncated by raindrop]` marker).
143
143
 
144
144
  ## Testing
145
145
 
package/dist/index.d.mts CHANGED
@@ -517,6 +517,15 @@ interface RaindropDeepAgentsHandlerOptions {
517
517
  eventName?: string;
518
518
  eventId?: () => string;
519
519
  traceChains?: boolean;
520
+ /**
521
+ * Per-field caps this handler captures against, fixed for its lifetime:
522
+ * `maxTextFieldChars` for span attributes (further reduced by
523
+ * `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` as each span is captured, the
524
+ * way the trace shipper applies it), `eventMaxTextFieldChars` for event
525
+ * `input`/`output`. Default to the module-wide cap at construction.
526
+ */
527
+ maxTextFieldChars?: number;
528
+ eventMaxTextFieldChars?: number;
520
529
  }
521
530
  declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
522
531
  name: string;
@@ -527,6 +536,8 @@ declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
527
536
  private eventName?;
528
537
  private eventIdSource?;
529
538
  private traceChains;
539
+ private readonly configuredSpanMaxChars;
540
+ private readonly eventMaxChars;
530
541
  private spans;
531
542
  private rootRunIds;
532
543
  private eventIds;
@@ -539,6 +550,7 @@ declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
539
550
  */
540
551
  _lastRootEventId: string | undefined;
541
552
  constructor(opts: RaindropDeepAgentsHandlerOptions);
553
+ private get spanMaxChars();
542
554
  private getEventId;
543
555
  private getParent;
544
556
  private cleanup;
@@ -587,6 +599,15 @@ interface DeepAgentsOptions {
587
599
  */
588
600
  projectId?: string;
589
601
  traceChains?: boolean;
602
+ /**
603
+ * Per-field character cap for captured text and JSON (`ai.prompt.messages`,
604
+ * `ai.toolCall.args` / `ai.toolCall.result`, event `input` / `output`).
605
+ * A history that does not fit is cut at message boundaries, stays valid
606
+ * JSON and is flagged with `ai.prompt.messages.truncated`. Module-wide,
607
+ * shared with the underlying shippers; omitting it leaves the current cap
608
+ * unchanged. Defaults to 1,000,000.
609
+ */
610
+ maxTextFieldChars?: number;
590
611
  /** Application Git identity. Auto-detects commit SHA by default; pass `false` to disable. */
591
612
  appGit?: AppGitOptions | false;
592
613
  }
package/dist/index.d.ts CHANGED
@@ -517,6 +517,15 @@ interface RaindropDeepAgentsHandlerOptions {
517
517
  eventName?: string;
518
518
  eventId?: () => string;
519
519
  traceChains?: boolean;
520
+ /**
521
+ * Per-field caps this handler captures against, fixed for its lifetime:
522
+ * `maxTextFieldChars` for span attributes (further reduced by
523
+ * `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` as each span is captured, the
524
+ * way the trace shipper applies it), `eventMaxTextFieldChars` for event
525
+ * `input`/`output`. Default to the module-wide cap at construction.
526
+ */
527
+ maxTextFieldChars?: number;
528
+ eventMaxTextFieldChars?: number;
520
529
  }
521
530
  declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
522
531
  name: string;
@@ -527,6 +536,8 @@ declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
527
536
  private eventName?;
528
537
  private eventIdSource?;
529
538
  private traceChains;
539
+ private readonly configuredSpanMaxChars;
540
+ private readonly eventMaxChars;
530
541
  private spans;
531
542
  private rootRunIds;
532
543
  private eventIds;
@@ -539,6 +550,7 @@ declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
539
550
  */
540
551
  _lastRootEventId: string | undefined;
541
552
  constructor(opts: RaindropDeepAgentsHandlerOptions);
553
+ private get spanMaxChars();
542
554
  private getEventId;
543
555
  private getParent;
544
556
  private cleanup;
@@ -587,6 +599,15 @@ interface DeepAgentsOptions {
587
599
  */
588
600
  projectId?: string;
589
601
  traceChains?: boolean;
602
+ /**
603
+ * Per-field character cap for captured text and JSON (`ai.prompt.messages`,
604
+ * `ai.toolCall.args` / `ai.toolCall.result`, event `input` / `output`).
605
+ * A history that does not fit is cut at message boundaries, stays valid
606
+ * JSON and is flagged with `ai.prompt.messages.truncated`. Module-wide,
607
+ * shared with the underlying shippers; omitting it leaves the current cap
608
+ * unchanged. Defaults to 1,000,000.
609
+ */
610
+ maxTextFieldChars?: number;
590
611
  /** Application Git identity. Auto-detects commit SHA by default; pass `false` to disable. */
591
612
  appGit?: AppGitOptions | false;
592
613
  }