@cognipeer/agent-sdk 0.17.0 → 0.19.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/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ZodError, ZodSchema, z, ZodTypeAny } from 'zod';
2
2
  import { JSONSchema7 } from 'json-schema';
3
- import { P as ProviderType, M as ModelRuleLearnedEvent, E as EmbeddingRequest, a as EmbeddingResponse, C as ChatCompletionRequest, b as ChatCompletionResponse, c as ChatCompletionChunk, J as JevProviderConfig, O as OpenAICompatibleProviderConfig, d as OpenAIProviderConfig, R as RulePatch, U as UnifiedMessage, T as ToolDefinition, e as TokenUsage, A as AnthropicProviderConfig, f as AzureProviderConfig, B as BedrockProviderConfig, V as VertexProviderConfig, g as ReasoningRequestConfig, h as ProviderConfig, i as ProviderError } from './model-rules-Bg9nSqyN.cjs';
4
- export { a4 as AudioContent, I as EffortMapping, a0 as EmbeddingInputType, $ as EmbeddingUsage, a3 as FileContent, Z as FinishReason, a2 as ImageContent, v as MAX_ADJUSTMENTS, k as MODEL_RULES, W as MaxTokensParam, D as ModelRule, F as ModelRules, Q as OffMechanism, Y as ParsedModelError, _ as ProviderResponseFields, a5 as ProviderToolCall, a6 as ProviderTransportConfig, H as ReasoningEffort, N as ReasoningStyle, G as ResolvedModelRule, K as RuleFamily, L as RuleSource, X as SamplingField, S as TemperatureRule, a1 as TextContent, n as allowsSampling, o as applyDropParams, u as asModelRequestError, z as clearLearnedModelRules, p as effortBudget, j as emptyUsage, x as getLearnedModelRulePatch, w as listLearnedModelRules, m as mapReasoningEffort, q as mergeRulePatch, l as modelIdCandidates, s as parseModelError, y as rememberModelRulePatch, r as resolveModelRule, t as runWithModelAdjustments } from './model-rules-Bg9nSqyN.cjs';
3
+ import { P as ProviderType, M as ModelRuleLearnedEvent, E as EmbeddingRequest, a as EmbeddingResponse, C as ChatCompletionRequest, b as ChatCompletionResponse, c as ChatCompletionChunk, J as JevProviderConfig, O as OpenAICompatibleProviderConfig, d as OpenAIProviderConfig, R as RulePatch, U as UnifiedMessage, T as ToolDefinition, e as TokenUsage, A as AnthropicProviderConfig, f as AzureProviderConfig, B as BedrockProviderConfig, V as VertexProviderConfig, g as ReasoningRequestConfig, h as ProviderConfig, i as ProviderError } from './model-rules--welxWDw.cjs';
4
+ export { a4 as AudioContent, I as EffortMapping, a0 as EmbeddingInputType, $ as EmbeddingUsage, a3 as FileContent, Z as FinishReason, a2 as ImageContent, v as MAX_ADJUSTMENTS, k as MODEL_RULES, W as MaxTokensParam, D as ModelRule, F as ModelRules, Q as OffMechanism, Y as ParsedModelError, _ as ProviderResponseFields, a5 as ProviderToolCall, a6 as ProviderTransportConfig, H as ReasoningEffort, N as ReasoningStyle, G as ResolvedModelRule, K as RuleFamily, L as RuleSource, X as SamplingField, S as TemperatureRule, a1 as TextContent, n as allowsSampling, o as applyDropParams, u as asModelRequestError, z as clearLearnedModelRules, p as effortBudget, j as emptyUsage, x as getLearnedModelRulePatch, w as listLearnedModelRules, m as mapReasoningEffort, q as mergeRulePatch, l as modelIdCandidates, s as parseModelError, y as rememberModelRulePatch, r as resolveModelRule, t as runWithModelAdjustments } from './model-rules--welxWDw.cjs';
5
5
 
6
6
  /** Describes what a model/provider natively supports. */
7
7
  type ModelCapabilities = {
@@ -75,6 +75,7 @@ interface BaseChatMessage {
75
75
  arguments: string;
76
76
  };
77
77
  thoughtSignature?: string;
78
+ idSynthesized?: boolean;
78
79
  }>;
79
80
  tool_call_id?: string;
80
81
  usage?: any;
@@ -278,6 +279,227 @@ declare function replaceTextContent(content: string | ContentPart[] | unknown, t
278
279
  /** Every non-text part of a message, normalized for policy code. */
279
280
  declare function collectAttachments(content: string | ContentPart[] | unknown): MediaAttachment[];
280
281
 
282
+ /**
283
+ * Types of the OTLP trace pipeline: the OTLP/JSON wire model the converter
284
+ * produces, and the public option / result types of the exporter.
285
+ */
286
+ type OtlpAnyValue = {
287
+ stringValue?: string;
288
+ boolValue?: boolean;
289
+ /** int64 travels as a decimal string in OTLP/JSON. */
290
+ intValue?: string;
291
+ doubleValue?: number;
292
+ arrayValue?: {
293
+ values: OtlpAnyValue[];
294
+ };
295
+ kvlistValue?: {
296
+ values: OtlpKeyValue[];
297
+ };
298
+ /** Base64 in OTLP/JSON. */
299
+ bytesValue?: string;
300
+ };
301
+ type OtlpKeyValue = {
302
+ key: string;
303
+ value: OtlpAnyValue;
304
+ };
305
+ type OtlpSpanEvent = {
306
+ timeUnixNano: string;
307
+ name: string;
308
+ attributes: OtlpKeyValue[];
309
+ };
310
+ type OtlpSpan = {
311
+ traceId: string;
312
+ spanId: string;
313
+ /** Empty string for a root. */
314
+ parentSpanId: string;
315
+ traceState?: string;
316
+ /** W3C trace flags plus the OTLP "has/is remote parent" bits (0x100 / 0x200). */
317
+ flags: number;
318
+ name: string;
319
+ /** 1 INTERNAL, 2 SERVER, 3 CLIENT. */
320
+ kind: number;
321
+ startTimeUnixNano: string;
322
+ endTimeUnixNano: string;
323
+ attributes: OtlpKeyValue[];
324
+ events?: OtlpSpanEvent[];
325
+ status: {
326
+ code: number;
327
+ message?: string;
328
+ };
329
+ };
330
+ type OtlpExportTraceServiceRequest = {
331
+ resourceSpans: Array<{
332
+ resource: {
333
+ attributes: OtlpKeyValue[];
334
+ };
335
+ scopeSpans: Array<{
336
+ scope: {
337
+ name: string;
338
+ version: string;
339
+ };
340
+ spans: OtlpSpan[];
341
+ }>;
342
+ schemaUrl?: string;
343
+ }>;
344
+ };
345
+ /**
346
+ * Which attribute vocabulary the spans carry. `cognipeer` is the SDK's own
347
+ * `cognipeer.*` keys, `gen_ai` the OpenTelemetry GenAI semantic conventions,
348
+ * `both` (the default) emits the two side by side.
349
+ */
350
+ type OtlpSemconv = "cognipeer" | "gen_ai" | "both";
351
+ type OtlpProtocol = "http/json" | "http/protobuf";
352
+ type OtlpRetryOptions = {
353
+ /** Attempts in total, the first included. Default 3. */
354
+ maxAttempts?: number;
355
+ /** First back-off ceiling. Default 250 ms. */
356
+ initialDelayMs?: number;
357
+ /** Back-off ceiling, also the cap on a server's Retry-After. Default 4000 ms. */
358
+ maxDelayMs?: number;
359
+ /** Budget for the whole export, attempts and waits included. Default 25000 ms. */
360
+ maxElapsedMs?: number;
361
+ };
362
+ type OtlpExportOptions = {
363
+ /**
364
+ * Full traces endpoint (e.g. `https://collector:4318/v1/traces`). Leave it out
365
+ * to configure the exporter from the standard `OTEL_EXPORTER_OTLP_*`
366
+ * environment variables.
367
+ */
368
+ endpoint?: string;
369
+ headers?: Record<string, string>;
370
+ /** Default `http/json` with an explicit endpoint, `http/protobuf` in env-driven mode. */
371
+ protocol?: OtlpProtocol;
372
+ /** Default `none`. */
373
+ compression?: "gzip" | "none";
374
+ /** Per attempt. Default 10000 ms. */
375
+ timeoutMs?: number;
376
+ /** `false` sends once. */
377
+ retry?: false | OtlpRetryOptions;
378
+ /** Default `both`. */
379
+ semconv?: OtlpSemconv;
380
+ /** `service.name` on the resource. */
381
+ serviceName?: string;
382
+ resourceAttributes?: Record<string, string>;
383
+ /**
384
+ * Prompt, response, tool-definition and tool argument/result content on the
385
+ * spans (`gen_ai.input.messages` and friends). OFF by default and independent
386
+ * of `tracing.logData`. `true` turns it on with the defaults.
387
+ */
388
+ content?: boolean | OtlpContentOptions;
389
+ /** Injectable for tests; defaults to `globalThis.fetch`, read at export time. */
390
+ fetch?: (input: string, init?: any) => Promise<any>;
391
+ };
392
+ /** What a span's content attributes are made of; `include` picks from this list. */
393
+ type OtlpContentField = "system" | "input" | "output" | "tools" | "toolArgs" | "toolResults" | "sections";
394
+ type OtlpContentRedactInfo = {
395
+ field: OtlpContentField;
396
+ eventType: string;
397
+ spanId?: string;
398
+ toolName?: string;
399
+ model?: string;
400
+ };
401
+ type OtlpContentOptions = {
402
+ /** Default false. */
403
+ enabled?: boolean;
404
+ /** Default: every field. */
405
+ include?: OtlpContentField[];
406
+ /** Longer text is cut and marked `...[truncated N chars]`. Default 4096. */
407
+ maxStringChars?: number;
408
+ /** A message list keeps its most recent messages. Default 32. */
409
+ maxMessages?: number;
410
+ /**
411
+ * An attribute whose JSON exceeds this is made smaller by dropping whole
412
+ * messages (oldest first) or, failing that, replaced by `{"truncated":true}`.
413
+ * JSON is never cut in the middle. Default 32768.
414
+ */
415
+ maxAttributeBytes?: number;
416
+ /**
417
+ * Runs on each captured field BEFORE the caps apply. Return the (possibly
418
+ * masked) value, or `null` / `undefined` to leave the field out. A throw
419
+ * leaves it out too (fail closed). It gets a private copy: mutating it does
420
+ * not change the trace the file and other sinks hold.
421
+ */
422
+ redact?: (value: unknown, info: OtlpContentRedactInfo) => unknown;
423
+ /** `json` (default): a JSON string. `structured`: OTLP AnyValue arrays and maps. */
424
+ encoding?: "json" | "structured";
425
+ };
426
+ /** Content options with every default filled in. */
427
+ type ResolvedOtlpContent = Required<Omit<OtlpContentOptions, "redact">> & {
428
+ redact?: OtlpContentOptions["redact"];
429
+ };
430
+ /** A W3C parent of the root span: where the trace came from. */
431
+ type TraceParent = {
432
+ traceId: string;
433
+ spanId: string;
434
+ /** The incoming trace-flags byte, carried unchanged (bit 0 is `sampled`). */
435
+ flags: number;
436
+ sampled: boolean;
437
+ /** True when the parent lives in another process (the usual case for a traceparent). */
438
+ remote: boolean;
439
+ traceState?: string;
440
+ };
441
+ /** A `traceparent` header value, or the pair of W3C headers. */
442
+ type TraceParentInput = string | {
443
+ traceparent: string;
444
+ tracestate?: string;
445
+ };
446
+ type OtlpConvertOptions = {
447
+ semconv: OtlpSemconv;
448
+ serviceName?: string;
449
+ resourceAttributes?: Record<string, string>;
450
+ /** True when this file ends the session: only then is the root span exported. */
451
+ terminal: boolean;
452
+ /** The run was cancelled: the root reports `partial`. */
453
+ cancelled?: boolean;
454
+ parent?: Pick<TraceParent, "spanId" | "remote" | "traceState"> & {
455
+ flags?: number;
456
+ sampled?: boolean;
457
+ };
458
+ /** Content capture; absent or disabled means none leaves the process. */
459
+ content?: ResolvedOtlpContent;
460
+ };
461
+ type OtlpExportResult = {
462
+ ok: boolean;
463
+ attempts: number;
464
+ status?: number;
465
+ /** Spans in the request (0 when the export was skipped). */
466
+ spans: number;
467
+ /** Size of the body that was sent. */
468
+ bytes: number;
469
+ error?: string;
470
+ /** True when nothing was sent: no spans, or exporting is disabled by the environment. */
471
+ skipped?: boolean;
472
+ reason?: string;
473
+ partialSuccess?: {
474
+ rejectedSpans: number;
475
+ message?: string;
476
+ };
477
+ };
478
+ type OtlpExporter = {
479
+ name: string;
480
+ endpoint: string;
481
+ semconv: OtlpSemconv;
482
+ protocol: OtlpProtocol;
483
+ /** True when this exporter asks for prompt/response content to be captured. */
484
+ wantsContent: boolean;
485
+ /** The content options behind `wantsContent`, defaults filled in. */
486
+ contentOptions?: ResolvedOtlpContent;
487
+ exportSession(file: TraceSessionFile, options: {
488
+ terminal: boolean;
489
+ cancelled?: boolean;
490
+ parent?: OtlpConvertOptions["parent"];
491
+ }): Promise<OtlpExportResult>;
492
+ };
493
+ /** What one exporter did when a session was finalized. */
494
+ type OtlpExportReport = {
495
+ exporter: string;
496
+ endpoint: string;
497
+ /** True for the exporter derived from `tracing.sink`, false for a plugin's. */
498
+ sink: boolean;
499
+ terminal: boolean;
500
+ result: OtlpExportResult;
501
+ };
502
+
281
503
  /**
282
504
  * Plugin layer — type surface.
283
505
  *
@@ -768,6 +990,13 @@ type AgentPlugin = {
768
990
  tools?: ToolInterface[] | ((ctx: PluginSetupContext) => MaybePromise<ToolInterface[]>);
769
991
  systemPrompt?: string | ((current: string, ctx: PluginSetupContext) => string);
770
992
  toolDescriptions?: Record<string, string | ((defaultDescription: string) => string)>;
993
+ /**
994
+ * OTLP exporters the SDK runs when a trace session is finalized, next to the
995
+ * `otlp` sink. This is how a plugin ships traces to a collector without a
996
+ * hook of its own: the SDK knows which leg ends the run, the plugin does not.
997
+ * Requires `tracing: { enabled: true }`.
998
+ */
999
+ traceExporters?: OtlpExporter[];
771
1000
  wrapModel?: (model: unknown, ctx: PluginSetupContext) => unknown;
772
1001
  provides?: PluginProvides;
773
1002
  /** Bridge for v1 guardrails carried inside a plugin. */
@@ -779,6 +1008,8 @@ type AgentPlugin = {
779
1008
  type PluginContributions = {
780
1009
  tools: ToolInterface[];
781
1010
  toolDescriptions: Record<string, string | ((defaultDescription: string) => string)>;
1011
+ /** Trace exporters contributed by plugins, in plugin priority order. */
1012
+ traceExporters: OtlpExporter[];
782
1013
  guardrails: ConversationGuardrail[];
783
1014
  /** Applied in priority order, before any legacy `promptHooks.transformSystemPrompt`. */
784
1015
  applySystemPrompt: (base: string) => string;
@@ -1067,6 +1298,16 @@ type SubagentPendingRecord = {
1067
1298
  spawnId?: string;
1068
1299
  /** Iterations the child had opened when it paused; the resumed run numbers on from there. */
1069
1300
  iterations?: number;
1301
+ /**
1302
+ * The run's agent span id in the trace. Every segment of the run (the first,
1303
+ * and each resume) records under this one id, so the trace shows one group.
1304
+ * Absent on a record written by 0.17.0: its resume gets a fresh id.
1305
+ */
1306
+ agentSpanId?: string;
1307
+ /** Epoch ms the run's first segment started; the span reports the run from here. */
1308
+ startedAt?: number;
1309
+ /** Segments run so far: 1 once it has paused for the first time. */
1310
+ segments?: number;
1070
1311
  };
1071
1312
  type SubagentToolNames = {
1072
1313
  delegate: string;
@@ -1360,11 +1601,14 @@ type TraceSinkHttpConfig = {
1360
1601
  url: string;
1361
1602
  headers?: Record<string, string>;
1362
1603
  };
1604
+ /**
1605
+ * OTLP/HTTP trace export. `endpoint` is the full traces URL; leave it out to
1606
+ * configure the exporter from the standard `OTEL_EXPORTER_OTLP_*` environment
1607
+ * variables (see the OpenTelemetry guide).
1608
+ */
1363
1609
  type TraceSinkOtlpConfig = {
1364
1610
  type: "otlp";
1365
- endpoint: string;
1366
- headers?: Record<string, string>;
1367
- };
1611
+ } & OtlpExportOptions;
1368
1612
  type TracingMode = "batched" | "streaming";
1369
1613
  type TraceSinkConfig = TraceSinkFileConfig | TraceSinkCustomConfig | TraceSinkCognipeerConfig | TraceSinkHttpConfig | TraceSinkOtlpConfig;
1370
1614
  type TracingConfig = {
@@ -1391,6 +1635,15 @@ type TracingConfig = {
1391
1635
  * attribution/reporting; not interpreted by the SDK itself.
1392
1636
  */
1393
1637
  metadata?: Record<string, string>;
1638
+ /**
1639
+ * W3C trace context of the caller (a `traceparent` header value, or
1640
+ * `{ traceparent, tracestate }`): the exported root span becomes a child of
1641
+ * that span and joins its trace. A static value for every run of this agent;
1642
+ * `InvokeConfig.traceParent` sets it per request and wins. An upstream
1643
+ * `sampled=0` flag suppresses the OTLP export only (file, cognipeer, http and
1644
+ * custom sinks still record). Invalid values are ignored with one warning.
1645
+ */
1646
+ parent?: TraceParentInput;
1394
1647
  };
1395
1648
  type SmartAgentTracingConfig = TracingConfig;
1396
1649
  type AgentOptions = {
@@ -2019,6 +2272,12 @@ type TraceMetadataSection = {
2019
2272
  kind: "metadata";
2020
2273
  label: string;
2021
2274
  data: Record<string, any>;
2275
+ /**
2276
+ * Set on the sections a caller records with `alwaysSections`: ids, status and
2277
+ * timestamps that stay when `logData` is off and that an OTLP export carries
2278
+ * whether or not content capture is on. Never prompt text or arguments.
2279
+ */
2280
+ identity?: boolean;
2022
2281
  };
2023
2282
  /** One tool of the menu offered to the model on a single call. */
2024
2283
  type TraceToolDefinition = {
@@ -2092,8 +2351,15 @@ type TraceEventRecord = {
2092
2351
  * `pending`: a step that is waiting on someone outside the run — a tool
2093
2352
  * approval or a question to the user that was asked when the run paused.
2094
2353
  * The answer is recorded as a separate event when the run resumes.
2095
- */
2096
- status: "success" | "error" | "skipped" | "retry" | "pending";
2354
+ * A sub-agent's span (type span, actor.role subagent) is also pending while its
2355
+ * run waits; the segment that ends the run records it again under the SAME
2356
+ * spanId, finished. Draw one record per spanId: the highest sequence, dropping
2357
+ * earlier pending and running ones (foldSupersededSpans).
2358
+ * `running`: a sub-agent's span recorded when a segment of its run starts, so a
2359
+ * reader of a trace streamed while the run goes has the group its steps point
2360
+ * at. The record that ends (or pauses) the segment supersedes it.
2361
+ */
2362
+ status: "success" | "error" | "skipped" | "retry" | "pending" | "running";
2097
2363
  durationMs?: number;
2098
2364
  inputTokens?: number;
2099
2365
  outputTokens?: number;
@@ -2118,12 +2384,45 @@ type TraceEventRecord = {
2118
2384
  responseBytes?: number;
2119
2385
  model?: string;
2120
2386
  provider?: string;
2387
+ /** The provider's response id (`ai_call`). */
2388
+ responseId?: string;
2389
+ /** The model that actually answered, which may differ from the one requested (`ai_call`). */
2390
+ responseModel?: string;
2391
+ /** The provider's own stop reason (`end_turn`, `STOP`, `tool_calls`), before normalisation (`ai_call`). */
2392
+ rawFinishReason?: string;
2393
+ /** Tokens written to the provider's prompt cache (`ai_call`, `summarization`). */
2394
+ cacheWriteTokens?: number;
2395
+ /**
2396
+ * How the provider counts: whether `inputTokens` leaves the cache read/write
2397
+ * tokens out (Anthropic, Bedrock) and whether `outputTokens` leaves the
2398
+ * reasoning tokens out (Vertex). Exporters use it to report totals the way
2399
+ * the OpenTelemetry GenAI conventions define them.
2400
+ */
2401
+ usageBasis?: {
2402
+ inputExcludesCache?: boolean;
2403
+ outputExcludesReasoning?: boolean;
2404
+ };
2405
+ /** True when the model call was streamed (`ai_call`). */
2406
+ streaming?: boolean;
2407
+ /** `json` when the call asked for structured output, else `text` (`ai_call`). */
2408
+ outputType?: "text" | "json";
2409
+ /** The id the PROVIDER gave this tool call (`tool_call`); absent for ids the SDK made up. */
2410
+ toolCallId?: string;
2411
+ /**
2412
+ * Why a call that never ran is recorded: `blocked` (a plugin refused the model
2413
+ * call), `short_circuit` (a plugin or cache answered), `denied` (a policy
2414
+ * refused the tool), `skipped` (a limit or circuit breaker), `cancelled` (the
2415
+ * caller stopped the run).
2416
+ */
2417
+ skipReason?: "blocked" | "short_circuit" | "denied" | "skipped" | "cancelled";
2121
2418
  toolDetails?: TraceToolDetails;
2122
2419
  toolExecutionId?: string;
2123
2420
  retryOf?: string;
2421
+ /** `type` is the error's class name (`RateLimitError`) when it has one. */
2124
2422
  error?: {
2125
2423
  message: string;
2126
2424
  stack?: string;
2425
+ type?: string;
2127
2426
  } | null;
2128
2427
  data?: {
2129
2428
  sections: TraceDataSection[];
@@ -2135,6 +2434,8 @@ type TraceErrorRecord = {
2135
2434
  message: string;
2136
2435
  stack?: string;
2137
2436
  type?: string;
2437
+ /** Class name of the error behind a session-level failure. */
2438
+ errorName?: string;
2138
2439
  timestamp?: string;
2139
2440
  };
2140
2441
  type TraceSessionSummary = {
@@ -2181,6 +2482,23 @@ type TraceContinuation = {
2181
2482
  /** Totals so far — a continued session reports cumulative totals. */
2182
2483
  summary: TraceSessionSummary;
2183
2484
  errors: TraceErrorRecord[];
2485
+ /**
2486
+ * The remote parent of the root span (`TracingConfig.parent` /
2487
+ * `InvokeConfig.traceParent`), kept so a later leg exports under the same
2488
+ * parent without the caller passing it again. Plain data: no credentials.
2489
+ */
2490
+ parent?: {
2491
+ spanId: string;
2492
+ flags: number;
2493
+ traceState?: string;
2494
+ };
2495
+ /**
2496
+ * Sub-agent spans recorded `pending` that no later record has finished, with
2497
+ * their identity sections only. The OTLP export withholds a pending span until
2498
+ * the run ends; if the run is abandoned instead (`closeTraceContinuation`) the
2499
+ * closing export writes them, so the spans of the earlier legs keep a parent.
2500
+ */
2501
+ pendingSpans?: TraceEventRecord[];
2184
2502
  };
2185
2503
  type TraceSinkSnapshot = {
2186
2504
  type: "file";
@@ -2254,6 +2572,7 @@ type ResolvedTraceSink = {
2254
2572
  type: "otlp";
2255
2573
  endpoint: string;
2256
2574
  headers?: Record<string, string>;
2575
+ exporter: OtlpExporter;
2257
2576
  };
2258
2577
  type ResolvedTraceConfig = {
2259
2578
  enabled: boolean;
@@ -2288,6 +2607,11 @@ type TraceSessionRuntime = {
2288
2607
  sequenceOffset?: number;
2289
2608
  /** 1-based part number; 1 for a session that starts with this invoke. */
2290
2609
  part?: number;
2610
+ /**
2611
+ * Pending sub-agent spans earlier parts recorded (see `TraceContinuation.pendingSpans`).
2612
+ * Not in `events`: only the OTLP export reads them.
2613
+ */
2614
+ carriedSpans?: TraceEventRecord[];
2291
2615
  /**
2292
2616
  * Set once the session has been handed to its sink. A closed session takes no
2293
2617
  * more events: they would never be delivered (and, on a session continued by
@@ -2296,6 +2620,26 @@ type TraceSessionRuntime = {
2296
2620
  closed?: boolean;
2297
2621
  fileBaseDir?: string;
2298
2622
  fileSessionDir?: string;
2623
+ /**
2624
+ * Exporters contributed by plugins (`AgentPlugin.traceExporters`), run next to
2625
+ * the `otlp` sink when the session is finalized.
2626
+ */
2627
+ exporters?: OtlpExporter[];
2628
+ /** What each exporter did when the session was finalized, in run order. */
2629
+ exportReports?: OtlpExportReport[];
2630
+ /** Where the trace came from, when this run is part of a larger trace. */
2631
+ parent?: TraceParent;
2632
+ /**
2633
+ * True when some OTLP exporter asked for prompt/response content. Only then
2634
+ * does `recordTraceEvent` build the content it holds on the record's
2635
+ * non-enumerable side channel. Runtime only.
2636
+ */
2637
+ captureContent?: boolean;
2638
+ /** What `recordTraceEvent` keeps of captured content: the widest message cap among the exporters that want it, and their string cap with headroom. */
2639
+ captureLimits?: {
2640
+ maxStringChars: number;
2641
+ maxMessages: number;
2642
+ };
2299
2643
  };
2300
2644
  type HandoffDescriptor<TParsed = any> = {
2301
2645
  type: "handoff";
@@ -2796,6 +3140,13 @@ type InvokeConfig = RunnableConfig & {
2796
3140
  limits?: Partial<AgentLimits>;
2797
3141
  onStateChange?: (state: SmartState) => boolean;
2798
3142
  checkpointReason?: string;
3143
+ /**
3144
+ * W3C trace context of the request that started this run (a `traceparent`
3145
+ * header value, or `{ traceparent, tracestate }`). The exported root span is
3146
+ * made a child of it. Wins over `TracingConfig.parent`; a run that continues a
3147
+ * paused trace keeps the parent it started with.
3148
+ */
3149
+ traceParent?: TraceParentInput;
2799
3150
  /**
2800
3151
  * Keys of `skills` to open deterministically at the start of this invoke,
2801
3152
  * before the first model call. Each one is opened through the real
@@ -2909,6 +3260,18 @@ type ToolCallContext = {
2909
3260
  * nest under it. Absent when the run is not traced.
2910
3261
  */
2911
3262
  traceSpanId?: string;
3263
+ /**
3264
+ * Trace id of the run this call belongs to. With `traceSpanId` it is what a
3265
+ * downstream call (an HTTP request, an MCP `_meta`) needs to join the trace:
3266
+ * `traceparentOf(ctx)` builds the `traceparent` header. Absent when the run is
3267
+ * not traced.
3268
+ */
3269
+ traceId?: string;
3270
+ /**
3271
+ * The W3C trace-flags byte of an incoming `traceparent`, when the run has one;
3272
+ * `traceparentOf` passes it on unchanged. Absent means sampled (`01`).
3273
+ */
3274
+ traceFlags?: number;
2912
3275
  };
2913
3276
  type SmartToolFn = (args: any, context?: ToolCallContext) => Promise<any> | any;
2914
3277
  type ToolCachePolicy = {
@@ -4960,39 +5323,35 @@ declare function defaultBuildPayload(events: LangfuseEvent[], ctx: LangfuseBuild
4960
5323
  declare function langfuseTracing(config?: LangfuseTracingConfig): AgentPlugin;
4961
5324
 
4962
5325
  /**
4963
- * OTLP/HTTP export of a finished run, driven by a hook instead of by a sink.
5326
+ * OTLP export of a run to a collector, declared next to the other plugins.
4964
5327
  *
4965
- * The SDK already ships `otlpSink(endpoint, headers)`, and when observability
4966
- * is configured on its own that remains the right tool — it is wired straight
4967
- * into `finalizeTraceSession` and needs no plugin at all. This plugin exists
4968
- * for the product that wants one array: `plugins: [cognipeerGuardrail(),
4969
- * otelTracing({ endpoint })]`, with tracing and policy declared side by side
4970
- * rather than in two unrelated config blocks.
5328
+ * `plugins: [cognipeerGuardrail(), otelTracing({ endpoint })]` keeps tracing and
5329
+ * policy in one array instead of two unrelated config blocks. The plugin does
5330
+ * not build or send anything itself: it contributes an exporter
5331
+ * (`AgentPlugin.traceExporters`) and the SDK runs it inside
5332
+ * `finalizeTraceSession`, the same path the `otlpSink` uses. That is what makes
5333
+ * the output identical to the sink's: the SDK knows which leg ends the run (the
5334
+ * root span goes out once, with that leg), the plugin never has to.
4971
5335
  *
4972
- * It does NOT re-implement the sink. The conversion is `traceSessionToOtlp`,
4973
- * the same function `otlpSink` uses, applied to the same session object — so a
4974
- * span tree exported through this plugin and one exported through the sink are
4975
- * the same spans. What the plugin adds is placement: it runs on the hook chain,
4976
- * next to the guardrails, and can therefore be turned on and off with them.
5336
+ * The `sessionEnd` observer only reports. It reads what the exporter did for
5337
+ * this run and surfaces it (a `metadata` event, a warning on failure). It also
5338
+ * says so out loud when there is no trace session at all: a silent no-op in an
5339
+ * observability tool is discovered days later, when someone goes looking for
5340
+ * the traces, so `tracing: { enabled: true }` is called out by name.
4977
5341
  *
4978
- * Because it reads the SDK's trace session, it needs `tracing: { enabled: true }`
4979
- * on the agent. Without it there is no session to export and the plugin says so
4980
- * out loud (a `metadata` event plus a warning) rather than doing nothing: a
4981
- * silent no-op in an observability tool is the failure that costs the most,
4982
- * because it is discovered days later when someone goes looking for the traces.
5342
+ * A sub-agent inherits this plugin but records into its parent's session, which
5343
+ * is still being written. Only a root session finalizes and exports, so the
5344
+ * observer returns early for a child run.
4983
5345
  */
4984
5346
 
4985
- type OtelTracingConfig = {
4986
- /** OTLP/HTTP JSON traces endpoint, e.g. `https://collector.example.com/v1/traces`. */
4987
- endpoint: string;
4988
- /** Auth and tenancy headers for the collector. */
4989
- headers?: Record<string, string>;
4990
- /** `service.name` on the exported resource. Defaults to the agent's name. */
4991
- serviceName?: string;
4992
- /** Plugin name, when exporting to more than one collector at once. */
5347
+ type OtelTracingConfig = OtlpExportOptions & {
5348
+ /**
5349
+ * Plugin name, when exporting to more than one collector at once. Defaults to
5350
+ * `otel-tracing`.
5351
+ */
4993
5352
  name?: string;
4994
5353
  };
4995
- declare function otelTracing(config: OtelTracingConfig): AgentPlugin;
5354
+ declare function otelTracing(config?: OtelTracingConfig): AgentPlugin;
4996
5355
 
4997
5356
  /**
4998
5357
  * Webhook-backed human-in-the-loop transport for the `approvalTransport` slot.
@@ -5541,6 +5900,41 @@ declare function prepareStrictToolMenu<T extends object>(tools: T[]): {
5541
5900
  restorers: StrictRestorers;
5542
5901
  };
5543
5902
 
5903
+ /**
5904
+ * Prompt / response content for GenAI spans (`gen_ai.input.messages`,
5905
+ * `gen_ai.output.messages`, `gen_ai.system_instructions`, `gen_ai.tool.definitions`,
5906
+ * `gen_ai.tool.call.arguments`, `gen_ai.tool.call.result`).
5907
+ *
5908
+ * Content is OFF unless an exporter asks for it, and it is two steps:
5909
+ *
5910
+ * 1. At RECORD time (`buildCapturedContent`, called by `recordTraceEvent` only when
5911
+ * some exporter wants content): the messages, response, tool menu and tool
5912
+ * arguments / result are copied into a plain, bounded structure. A copy, because
5913
+ * the transcript is mutated and rewritten after the call; reasoning parts and
5914
+ * binary payloads never make it in. It rides on the record under a
5915
+ * NON-ENUMERABLE symbol key, so the file sink, the custom sink's JSON clones,
5916
+ * the cognipeer / http sinks and anything persisted never see it.
5917
+ * 2. At EXPORT time (`contentAttributes`): per exporter, the redact hook runs
5918
+ * first, then the caps (whole messages are dropped, oldest first; JSON is never
5919
+ * cut in the middle), then the encoding.
5920
+ */
5921
+
5922
+ type CaptureSource = {
5923
+ /** The messages as they went to the provider. */
5924
+ input?: unknown[];
5925
+ /** The provider's answer. */
5926
+ output?: unknown;
5927
+ toolDefinitions?: Array<{
5928
+ name: string;
5929
+ description?: string;
5930
+ parameters?: unknown;
5931
+ }>;
5932
+ toolArguments?: unknown;
5933
+ /** Set (even to undefined) only when the tool completed. */
5934
+ toolResult?: unknown;
5935
+ hasToolResult?: boolean;
5936
+ };
5937
+
5544
5938
  declare function fileSink(path?: string): TraceSinkConfig;
5545
5939
  type CustomSinkArg = ((event: TraceEventRecord) => void | Promise<void>) | {
5546
5940
  onEvent?: (event: TraceEventRecord) => void | Promise<void>;
@@ -5551,16 +5945,28 @@ declare function cognipeerSink(apiKey: string): TraceSinkConfig;
5551
5945
  declare function cognipeerSink(url: string | undefined, apiKey: string): TraceSinkConfig;
5552
5946
  declare function httpSink(url: string, headers?: Record<string, string>): TraceSinkConfig;
5553
5947
  /**
5554
- * Create an OTLP/HTTP JSON sink that exports traces in OpenTelemetry format.
5555
- * @param endpoint OTLP endpoint URL (e.g. "https://console.cognipeer.com/api/client/v1/traces")
5948
+ * Create an OTLP/HTTP sink that exports traces in OpenTelemetry format (JSON or
5949
+ * protobuf; GenAI and `cognipeer.*` attributes side by side by default).
5950
+ * @param endpoint OTLP traces endpoint (e.g. "https://console.cognipeer.com/api/client/v1/traces").
5951
+ * Leave it out to configure the exporter from the standard `OTEL_EXPORTER_OTLP_*` environment variables.
5556
5952
  * @param headers Optional headers (e.g. { Authorization: "Bearer ..." })
5953
+ * @param options Protocol, compression, timeout, retry, semconv, service name.
5557
5954
  */
5558
- declare function otlpSink(endpoint: string, headers?: Record<string, string>): TraceSinkConfig;
5955
+ declare function otlpSink(endpoint?: string, headers?: Record<string, string>, options?: Omit<OtlpExportOptions, "endpoint" | "headers">): TraceSinkConfig;
5956
+ declare function otlpSink(options: OtlpExportOptions): TraceSinkConfig;
5559
5957
  /**
5560
- * Convert a complete TraceSessionFile into an OTLP ExportTraceServiceRequest (JSON).
5561
- * Produces a root span for the session and child spans for each event.
5958
+ * Convert a TraceSessionFile into an OTLP ExportTraceServiceRequest (JSON model).
5959
+ * The root span is part of it only when the file ends the session: a `paused` or
5960
+ * `in_progress` file holds one leg of a longer run and yields its own spans only.
5562
5961
  */
5563
- declare function traceSessionToOtlp(session: TraceSessionFile): Record<string, unknown>;
5962
+ declare function traceSessionToOtlp(session: TraceSessionFile, options?: Partial<Omit<OtlpConvertOptions, "content">> & {
5963
+ /**
5964
+ * As on `otlpSink`: off unless given. A stored file holds the payload sections
5965
+ * (prompts, replies, tool arguments and results); they are in `cognipeer.sections`
5966
+ * only when this is on, through its `redact` and caps.
5967
+ */
5968
+ content?: boolean | OtlpContentOptions;
5969
+ }): OtlpExportTraceServiceRequest;
5564
5970
  /** Generate a W3C-compatible trace ID (32 hex chars / 128-bit). */
5565
5971
  declare function generateTraceId(): string;
5566
5972
  /** Generate an OTel span ID (16 hex chars / 64-bit). */
@@ -5628,13 +6034,32 @@ declare function recordTraceEvent(session: TraceSessionRuntime | undefined, even
5628
6034
  responseBytes?: number;
5629
6035
  model?: string;
5630
6036
  provider?: string;
6037
+ /** What the provider said about the response; see TraceEventRecord. Left out when unknown. */
6038
+ responseId?: string;
6039
+ responseModel?: string;
6040
+ rawFinishReason?: string;
6041
+ cacheWriteTokens?: number;
6042
+ usageBasis?: TraceEventRecord["usageBasis"];
6043
+ streaming?: boolean;
6044
+ outputType?: TraceEventRecord["outputType"];
6045
+ /** The id the PROVIDER gave a tool call; never one the SDK made up. */
6046
+ toolCallId?: string;
6047
+ skipReason?: TraceEventRecord["skipReason"];
5631
6048
  toolDetails?: TraceEventRecord["toolDetails"];
5632
6049
  toolExecutionId?: string;
5633
6050
  retryOf?: string;
5634
6051
  error?: {
5635
6052
  message: string;
5636
6053
  stack?: string;
6054
+ type?: string;
5637
6055
  } | null;
6056
+ /**
6057
+ * Content for exporters that ask for it (OTLP `content`), copied into a
6058
+ * non-enumerable side channel on the record at once: later changes to the
6059
+ * transcript cannot reach it, and no sink but those exporters ever sees it.
6060
+ * Ignored unless some exporter wants content.
6061
+ */
6062
+ capture?: CaptureSource;
5638
6063
  messageList?: any[];
5639
6064
  /** Pre-built sections to use instead of auto-converting messageList */
5640
6065
  sections?: TraceDataSection[];
@@ -5671,6 +6096,28 @@ type DeferredTraceEvent = Parameters<typeof recordTraceEvent>[1];
5671
6096
  * to the sink, and the next leg has not opened one yet.
5672
6097
  */
5673
6098
  declare function isTraceSessionOpen(session: TraceSessionRuntime | undefined): session is TraceSessionRuntime;
6099
+ /**
6100
+ * The records a reader should draw. A sub-agent that pauses for a human (an
6101
+ * approval or a question) and later resumes is ONE run recorded in several
6102
+ * segments, and records are append-only: each pause records the run's agent span
6103
+ * `pending`, and the segment that ends the run records it again under the SAME
6104
+ * `spanId`, finished, with `durationMs` covering the run from its first segment
6105
+ * (so the span is drawn over its children from every segment, the wait included).
6106
+ * Each segment also opens with a `running` record of the span, so a trace read
6107
+ * while the run goes (a streamed one) has the group the child's steps point at
6108
+ * before the run ends. The rule for a reader: for each `spanId` the record with
6109
+ * the highest `sequence` wins, and an earlier record of that id is dropped only
6110
+ * when it is `pending` or `running`. Nothing else is ever dropped, so a repeated
6111
+ * id on records that are neither comes back untouched. Order is preserved.
6112
+ *
6113
+ * The session summary is not rewritten: `eventCounts` keeps counting every record
6114
+ * that was written, which is what the file holds.
6115
+ */
6116
+ declare function foldSupersededSpans<T extends {
6117
+ spanId?: string;
6118
+ sequence?: number;
6119
+ status?: string;
6120
+ }>(events: readonly T[]): T[];
5674
6121
  /**
5675
6122
  * Records `event` into the open session on `ctx`, or — when there is none —
5676
6123
  * returns a copy of `ctx` holding it for the next invoke to record. Returns
@@ -5686,6 +6133,100 @@ declare function recordOrDeferTraceEvent(ctx: Record<string, any> | undefined, e
5686
6133
  * previous leg recorded, before anything this one does.
5687
6134
  */
5688
6135
  declare function replayDeferredTraceEvents(session: TraceSessionRuntime | undefined, deferred: unknown): void;
6136
+ /**
6137
+ * Closes the trace of a run whose last leg paused (or bounced for summarization)
6138
+ * and will not be resumed: the root span, held back until a leg ends the
6139
+ * session, is exported now. Only the OTLP exporters are called (the `otlp` sink
6140
+ * from `tracing`, and `exporters`); the file, cognipeer, http and custom sinks
6141
+ * already have everything this session recorded.
6142
+ *
6143
+ * `events` are trace events that were held for a next leg that never came
6144
+ * (see `recordOrDeferTraceEvent`); they are recorded before the close.
6145
+ * Returns undefined when `continuation` is not one, or nothing would export it.
6146
+ */
6147
+ declare function closeTraceContinuation(continuation: unknown, params?: {
6148
+ tracing?: SmartAgentTracingConfig;
6149
+ exporters?: OtlpExporter[];
6150
+ /** How the run ended. Default `partial`: it stopped before an answer. */
6151
+ status?: "success" | "partial" | "error";
6152
+ error?: {
6153
+ message?: string;
6154
+ stack?: string;
6155
+ name?: string;
6156
+ } | null;
6157
+ agentRuntime?: AgentRuntimeConfig;
6158
+ events?: unknown;
6159
+ }): Promise<TraceSessionFile | undefined>;
6160
+
6161
+ /**
6162
+ * The OTLP/HTTP exporter: converts a trace session file, encodes it (JSON or
6163
+ * protobuf), optionally gzips it and POSTs it, with bounded retries.
6164
+ *
6165
+ * It never throws: a failure comes back as `{ ok: false, error }` and the caller
6166
+ * decides what that means (a sink marks the session partial, a plugin warns).
6167
+ * Retries follow the OTLP specification: 429, 502, 503, 504 and transport errors
6168
+ * or timeouts are retried with full-jitter exponential back-off (a server's
6169
+ * Retry-After wins); every other status is final, 404 and 500 included.
6170
+ *
6171
+ * `globalThis.fetch` is read when an export runs, not when the module loads or
6172
+ * the exporter is created, and the response is treated as the minimum a fetch
6173
+ * mock may offer (`ok`, `status`, `statusText`, `text`, `headers.get`).
6174
+ */
6175
+
6176
+ declare function createOtlpExporter(options?: OtlpExportOptions & {
6177
+ name?: string;
6178
+ }): OtlpExporter;
6179
+
6180
+ /**
6181
+ * W3C Trace Context helpers: reading the `traceparent` / `tracestate` a caller
6182
+ * passes in, and writing one for a downstream call (an HTTP request, an MCP
6183
+ * `_meta`) a tool makes from inside a traced run.
6184
+ */
6185
+
6186
+ type ParsedTraceparent = {
6187
+ traceId: string;
6188
+ spanId: string;
6189
+ /** The trace-flags byte, unchanged. */
6190
+ flags: number;
6191
+ sampled: boolean;
6192
+ };
6193
+ /**
6194
+ * Reads a `traceparent` header. Returns undefined for anything the W3C
6195
+ * specification calls invalid: upper case, wrong lengths, version `ff`,
6196
+ * all-zero ids, extra fields on version 00.
6197
+ */
6198
+ declare function parseTraceparent(header: unknown): ParsedTraceparent | undefined;
6199
+ /**
6200
+ * Writes a version 00 `traceparent`. `flags` is the trace-flags byte (default
6201
+ * `01`, sampled); pass the incoming byte to propagate a decision unchanged.
6202
+ */
6203
+ declare function formatTraceparent(parts: {
6204
+ traceId: string;
6205
+ spanId: string;
6206
+ sampled?: boolean;
6207
+ flags?: number;
6208
+ }): string;
6209
+ /**
6210
+ * The `traceparent` for a call a tool makes inside a traced run: the tool call's
6211
+ * own span is the parent. Takes the `ToolCallContext` a tool receives, and is
6212
+ * undefined when the run is not traced (there is nothing to propagate).
6213
+ */
6214
+ declare function traceparentOf(ctx: {
6215
+ traceId?: string;
6216
+ traceSpanId?: string;
6217
+ traceFlags?: number;
6218
+ } | undefined): string | undefined;
6219
+
6220
+ /**
6221
+ * The OpenTelemetry GenAI vocabulary the exporter speaks, in one place.
6222
+ *
6223
+ * Pinned to open-telemetry/semantic-conventions-genai at commit 547934a (status
6224
+ * "development": names may still change upstream). No `schemaUrl` is set on the
6225
+ * exported scope because the version that commit belongs to is unpublished;
6226
+ * the commit is recorded here and in the docs instead.
6227
+ */
6228
+
6229
+ declare const GENAI_SEMCONV_COMMIT = "547934a";
5689
6230
 
5690
6231
  /** True when the model's rule uses `thinking:{type:"adaptive"}` + `output_config.effort` (Claude 4.6+ / 5.x). */
5691
6232
  declare function supportsAdaptiveThinking(model: unknown): boolean;
@@ -6006,4 +6547,4 @@ declare class ModelRequestError extends ProviderError {
6006
6547
  constructor(init: ModelRequestErrorInit);
6007
6548
  }
6008
6549
 
6009
- export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentPlugin, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, AnthropicProviderConfig, type ApprovalTransport, type AuditEntry, type AuditLogConfig, type AzureContentSafetyConfig, AzureProvider, AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, type BedrockGuardrailConfig, BedrockProvider, BedrockProviderConfig, type BudgetGuardConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONSOLE_HOOK_MAP, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type CapabilityStatus, ChatCompletionChunk, ChatCompletionRequest, ChatCompletionResponse, type CheckpointPluginConfig, type CheckpointStore, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CognipeerGuardrailConfig, type CompressToolOutputParams, type ContextBuilder, type ContextPilotCCRConfig, type ContextPilotCacheAlignmentConfig, type ContextPilotCompressionConfig, type ContextPilotCompressionStats, type ContextPilotCompressorKind, type ContextPilotConfig, type ContextPilotDedupConfig, type ContextPilotDiffCompressionConfig, type ContextPilotJsonCompressionConfig, type ContextPilotLogCompressionConfig, type ContextPilotResult, type ContextPilotRuntime, type ContextPilotSearchCompressionConfig, type ContextPilotTextCompressionConfig, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type ConversationPluginConfig, type ConversationStore, type CostEstimator, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, type DeferredTraceEvent, type DelegationEventStamp, type DelegationMode, type DroppedDirective, EmbeddingRequest, EmbeddingResponse, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, type GateResult, type GuardrailCallContext, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailJudgeEngine, type GuardrailOutcome, GuardrailPhase, type GuardrailPhaseName, type GuardrailPluginOptions, type GuardrailRequest, type GuardrailRule, type GuardrailRuleResult, type GuardrailTransport, type GuardrailVerdict, type GuardrailViolation, HOOK_CONTRACT_VERSION, HOOK_NAMES, type HandoffDescriptor, type HandoffEvent, type HookContext, type HookDecision, type HookHandler, type HookMap, type HookName, type HookRegistrations, HookTimeoutError, type HttpGuardrailOptions, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, InMemoryMemoryStore, type InjectionScan, type InvokeConfig, type JevClientLike, type JevEngineOptions, type JevNoulAnswer, JevProvider, JevProviderConfig, type JevQuestion, type JevSystemOneRequest, type JevSystemOneResult, type JsonGuardrailOptions, type JsonSchemaRuleOptions, LAST_SUMMARIZATION_CALL_KEY, type LangfuseBuildContext, type LangfuseEvent, type LangfuseEventKind, type LangfuseTracingConfig, type LanguageGuardConfig, type LoadSkillsOptions, type MaybePromise, type McpConfig, type McpConnection, type MediaAttachment, type MediaKind$1 as MediaKind, type MediaPolicyConfig, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MessageUsage, type MetadataEvent, type ModelCapabilities, ModelRequestError, type ModelRequestErrorCode, type ModelRequestErrorInit, ModelRuleLearnedEvent, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, OpenAICompatibleProviderConfig, type OpenAIModerationConfig, OpenAIProvider, OpenAIProviderConfig, type OtelTracingConfig, type OutputGuardConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PiiDetector, type PiiEntity, type PiiRedactionConfig, type PlanEvent, type PlanStepRecord, type PlanningMode, type PluginContributions, type PluginEvent, type PluginFailureMode, type PluginHost, type PluginHostOptions, type PluginLogger, type PluginProvides, type PluginRunHost, type PluginSetupContext, type PortkeyGatewayConfig, type PortkeyGuardrailConfig, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type PromptInjectionFamily, type PromptInjectionGuardConfig, type PromptSource, ProviderConfig, ProviderError, ToolDefinition as ProviderToolDefinition, ProviderType, type RateLimitConfig, type ReasoningConfig, type ReasoningLevel, type RedactionResult, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailConfig, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type ResponseCacheConfig, type RestoreSnapshotOptions, RulePatch, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SdkCapabilities, type SerializableSmartState, type SessionMetrics, type SessionMetricsConfig, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillSource, type SkillToolDeps, type SkillToolHeader, type SlotName, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StrictRestorers, type StrictTransform, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SubagentDef, type SubagentEvent, type SubagentMode, type SubagentPendingRecord, type SubagentPolicy, type SubagentRegistryRef, type SubagentResult, type SubagentStatus, type SubagentToolDeps, type SubagentToolNames, type SubagentUsage, type SummarizationEvent, type SummarizationMode, type SummarizerInput, type SummarizerResult, type SummarizerStrategy, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TokenCounter, TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallContext, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolPolicyConfig, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type ToolRule, type TraceContinuation, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessagePart, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolDefinition, type TraceToolDefinitionsSection, type TraceToolDetails, type TraceToolResponseSection, type TraceToolResultSection, type TracingConfig, type TracingMode, UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, type WebhookApprovalConfig, agentVerdictRule, appendBoundTools, auditLog, azureContentSafety, bedrockGuardrail, budgetGuard, buildHandoffTools, buildResponseFormatSection, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, checkpointing, codePresenceRule, coerceToolArgs, cognipeerGuardrail, cognipeerSink, collectAttachments, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, contentPartToText, contentToString, conversationHistory, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createGuardrailPlugin, createJsonGuardrail, createManageTodoListAliasTool, createManageTodoTool, createOpenSkillTool, createParallelTool, createPluginHost, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customGuardrail, customSink, dedupeToolsByName, defaultTokenCounter, defineHook, definePlugin, describeContentPart, detectLanguage, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, evaluateGuardrails, extractLatestUserQuery, extractMessageText, fileCheckpointStore, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasMediaPart, hasToolResponseRecoveryReference, httpGuardrail, httpSink, inMemoryCheckpointStore, inMemoryConversationStore, isHookImplemented, isOpenAIHostedEndpoint, isSmartModel, isTraceSessionOpen, isValidIban, isValidLuhn, isValidTckn, jsonSchemaRule, defaultBuildPayload as langfuseDefaultPayload, langfuseTracing, languageGuard, loadSkillsFromDisk, mapConsoleHookVerdict, mapTextParts, mcp, mediaKindOf, mediaPolicy, normalizeSmartAgentOptions, normalizeVerdicts, openAIModeration, otelTracing, otlpSink, outputGuard, parseApprovalDecision, parseSkillFrontmatter, pathSandbox, piiRedaction, pluginCapabilities, portkeyGateway, portkeyGuardrail, preopenSkills, preopenToolCallId, prepareStrictToolMenu, promptInjectionGuard, rateLimit, readMemoryFacts, readTraceContinuation, recordOrDeferTraceEvent, redactText, regexGuardrail, regexRule, replaceTextContent, replayDeferredTraceEvents, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, responseCache, restoreSnapshot, restoreToolCalls, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, sessionMetrics, setTokenCounter, startStreamingSession, summarizeObject, supportsAdaptiveThinking, textFromContent, toMessageUsage, toModelResult, toStrictCompatible, toStrictToolSchema, tokenize, toolPolicy, traceContinuationOf, traceSectionsFromMessages, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, webhookApproval, withTools, withinDepth, writeSummaryFactsToMemory };
6550
+ export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentPlugin, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, AnthropicProviderConfig, type ApprovalTransport, type AuditEntry, type AuditLogConfig, type AzureContentSafetyConfig, AzureProvider, AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, type BedrockGuardrailConfig, BedrockProvider, BedrockProviderConfig, type BudgetGuardConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONSOLE_HOOK_MAP, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type CapabilityStatus, ChatCompletionChunk, ChatCompletionRequest, ChatCompletionResponse, type CheckpointPluginConfig, type CheckpointStore, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CognipeerGuardrailConfig, type CompressToolOutputParams, type ContextBuilder, type ContextPilotCCRConfig, type ContextPilotCacheAlignmentConfig, type ContextPilotCompressionConfig, type ContextPilotCompressionStats, type ContextPilotCompressorKind, type ContextPilotConfig, type ContextPilotDedupConfig, type ContextPilotDiffCompressionConfig, type ContextPilotJsonCompressionConfig, type ContextPilotLogCompressionConfig, type ContextPilotResult, type ContextPilotRuntime, type ContextPilotSearchCompressionConfig, type ContextPilotTextCompressionConfig, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type ConversationPluginConfig, type ConversationStore, type CostEstimator, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, type DeferredTraceEvent, type DelegationEventStamp, type DelegationMode, type DroppedDirective, EmbeddingRequest, EmbeddingResponse, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, GENAI_SEMCONV_COMMIT, type GateResult, type GuardrailCallContext, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailJudgeEngine, type GuardrailOutcome, GuardrailPhase, type GuardrailPhaseName, type GuardrailPluginOptions, type GuardrailRequest, type GuardrailRule, type GuardrailRuleResult, type GuardrailTransport, type GuardrailVerdict, type GuardrailViolation, HOOK_CONTRACT_VERSION, HOOK_NAMES, type HandoffDescriptor, type HandoffEvent, type HookContext, type HookDecision, type HookHandler, type HookMap, type HookName, type HookRegistrations, HookTimeoutError, type HttpGuardrailOptions, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, InMemoryMemoryStore, type InjectionScan, type InvokeConfig, type JevClientLike, type JevEngineOptions, type JevNoulAnswer, JevProvider, JevProviderConfig, type JevQuestion, type JevSystemOneRequest, type JevSystemOneResult, type JsonGuardrailOptions, type JsonSchemaRuleOptions, LAST_SUMMARIZATION_CALL_KEY, type LangfuseBuildContext, type LangfuseEvent, type LangfuseEventKind, type LangfuseTracingConfig, type LanguageGuardConfig, type LoadSkillsOptions, type MaybePromise, type McpConfig, type McpConnection, type MediaAttachment, type MediaKind$1 as MediaKind, type MediaPolicyConfig, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MessageUsage, type MetadataEvent, type ModelCapabilities, ModelRequestError, type ModelRequestErrorCode, type ModelRequestErrorInit, ModelRuleLearnedEvent, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, OpenAICompatibleProviderConfig, type OpenAIModerationConfig, OpenAIProvider, OpenAIProviderConfig, type OtelTracingConfig, type OtlpContentField, type OtlpContentOptions, type OtlpContentRedactInfo, type OtlpExportOptions, type OtlpExportResult, type OtlpExportTraceServiceRequest, type OtlpExporter, type OtlpProtocol, type OtlpRetryOptions, type OtlpSemconv, type OutputGuardConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PiiDetector, type PiiEntity, type PiiRedactionConfig, type PlanEvent, type PlanStepRecord, type PlanningMode, type PluginContributions, type PluginEvent, type PluginFailureMode, type PluginHost, type PluginHostOptions, type PluginLogger, type PluginProvides, type PluginRunHost, type PluginSetupContext, type PortkeyGatewayConfig, type PortkeyGuardrailConfig, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type PromptInjectionFamily, type PromptInjectionGuardConfig, type PromptSource, ProviderConfig, ProviderError, ToolDefinition as ProviderToolDefinition, ProviderType, type RateLimitConfig, type ReasoningConfig, type ReasoningLevel, type RedactionResult, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailConfig, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type ResponseCacheConfig, type RestoreSnapshotOptions, RulePatch, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SdkCapabilities, type SerializableSmartState, type SessionMetrics, type SessionMetricsConfig, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillSource, type SkillToolDeps, type SkillToolHeader, type SlotName, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StrictRestorers, type StrictTransform, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SubagentDef, type SubagentEvent, type SubagentMode, type SubagentPendingRecord, type SubagentPolicy, type SubagentRegistryRef, type SubagentResult, type SubagentStatus, type SubagentToolDeps, type SubagentToolNames, type SubagentUsage, type SummarizationEvent, type SummarizationMode, type SummarizerInput, type SummarizerResult, type SummarizerStrategy, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TokenCounter, TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallContext, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolPolicyConfig, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type ToolRule, type TraceContinuation, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessagePart, type TraceMessageSection, type TraceMetadataSection, type TraceParent, type TraceParentInput, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolDefinition, type TraceToolDefinitionsSection, type TraceToolDetails, type TraceToolResponseSection, type TraceToolResultSection, type TracingConfig, type TracingMode, UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, type WebhookApprovalConfig, agentVerdictRule, appendBoundTools, auditLog, azureContentSafety, bedrockGuardrail, budgetGuard, buildHandoffTools, buildResponseFormatSection, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, checkpointing, closeTraceContinuation, codePresenceRule, coerceToolArgs, cognipeerGuardrail, cognipeerSink, collectAttachments, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, contentPartToText, contentToString, conversationHistory, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createGuardrailPlugin, createJsonGuardrail, createManageTodoListAliasTool, createManageTodoTool, createOpenSkillTool, createOtlpExporter, createParallelTool, createPluginHost, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customGuardrail, customSink, dedupeToolsByName, defaultTokenCounter, defineHook, definePlugin, describeContentPart, detectLanguage, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, evaluateGuardrails, extractLatestUserQuery, extractMessageText, fileCheckpointStore, fileSink, findSubagent, foldSupersededSpans, formatTraceparent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasMediaPart, hasToolResponseRecoveryReference, httpGuardrail, httpSink, inMemoryCheckpointStore, inMemoryConversationStore, isHookImplemented, isOpenAIHostedEndpoint, isSmartModel, isTraceSessionOpen, isValidIban, isValidLuhn, isValidTckn, jsonSchemaRule, defaultBuildPayload as langfuseDefaultPayload, langfuseTracing, languageGuard, loadSkillsFromDisk, mapConsoleHookVerdict, mapTextParts, mcp, mediaKindOf, mediaPolicy, normalizeSmartAgentOptions, normalizeVerdicts, openAIModeration, otelTracing, otlpSink, outputGuard, parseApprovalDecision, parseSkillFrontmatter, parseTraceparent, pathSandbox, piiRedaction, pluginCapabilities, portkeyGateway, portkeyGuardrail, preopenSkills, preopenToolCallId, prepareStrictToolMenu, promptInjectionGuard, rateLimit, readMemoryFacts, readTraceContinuation, recordOrDeferTraceEvent, redactText, regexGuardrail, regexRule, replaceTextContent, replayDeferredTraceEvents, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, responseCache, restoreSnapshot, restoreToolCalls, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, sessionMetrics, setTokenCounter, startStreamingSession, summarizeObject, supportsAdaptiveThinking, textFromContent, toMessageUsage, toModelResult, toStrictCompatible, toStrictToolSchema, tokenize, toolPolicy, traceContinuationOf, traceSectionsFromMessages, traceSessionToOtlp, traceparentOf, validateReasoningConfig, validateToolArgs, webhookApproval, withTools, withinDepth, writeSummaryFactsToMemory };