@cognipeer/agent-sdk 0.17.0 → 0.18.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,6 +2351,10 @@ 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.
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 ones (foldSupersededSpans).
2095
2358
  */
2096
2359
  status: "success" | "error" | "skipped" | "retry" | "pending";
2097
2360
  durationMs?: number;
@@ -2118,12 +2381,45 @@ type TraceEventRecord = {
2118
2381
  responseBytes?: number;
2119
2382
  model?: string;
2120
2383
  provider?: string;
2384
+ /** The provider's response id (`ai_call`). */
2385
+ responseId?: string;
2386
+ /** The model that actually answered, which may differ from the one requested (`ai_call`). */
2387
+ responseModel?: string;
2388
+ /** The provider's own stop reason (`end_turn`, `STOP`, `tool_calls`), before normalisation (`ai_call`). */
2389
+ rawFinishReason?: string;
2390
+ /** Tokens written to the provider's prompt cache (`ai_call`, `summarization`). */
2391
+ cacheWriteTokens?: number;
2392
+ /**
2393
+ * How the provider counts: whether `inputTokens` leaves the cache read/write
2394
+ * tokens out (Anthropic, Bedrock) and whether `outputTokens` leaves the
2395
+ * reasoning tokens out (Vertex). Exporters use it to report totals the way
2396
+ * the OpenTelemetry GenAI conventions define them.
2397
+ */
2398
+ usageBasis?: {
2399
+ inputExcludesCache?: boolean;
2400
+ outputExcludesReasoning?: boolean;
2401
+ };
2402
+ /** True when the model call was streamed (`ai_call`). */
2403
+ streaming?: boolean;
2404
+ /** `json` when the call asked for structured output, else `text` (`ai_call`). */
2405
+ outputType?: "text" | "json";
2406
+ /** The id the PROVIDER gave this tool call (`tool_call`); absent for ids the SDK made up. */
2407
+ toolCallId?: string;
2408
+ /**
2409
+ * Why a call that never ran is recorded: `blocked` (a plugin refused the model
2410
+ * call), `short_circuit` (a plugin or cache answered), `denied` (a policy
2411
+ * refused the tool), `skipped` (a limit or circuit breaker), `cancelled` (the
2412
+ * caller stopped the run).
2413
+ */
2414
+ skipReason?: "blocked" | "short_circuit" | "denied" | "skipped" | "cancelled";
2121
2415
  toolDetails?: TraceToolDetails;
2122
2416
  toolExecutionId?: string;
2123
2417
  retryOf?: string;
2418
+ /** `type` is the error's class name (`RateLimitError`) when it has one. */
2124
2419
  error?: {
2125
2420
  message: string;
2126
2421
  stack?: string;
2422
+ type?: string;
2127
2423
  } | null;
2128
2424
  data?: {
2129
2425
  sections: TraceDataSection[];
@@ -2135,6 +2431,8 @@ type TraceErrorRecord = {
2135
2431
  message: string;
2136
2432
  stack?: string;
2137
2433
  type?: string;
2434
+ /** Class name of the error behind a session-level failure. */
2435
+ errorName?: string;
2138
2436
  timestamp?: string;
2139
2437
  };
2140
2438
  type TraceSessionSummary = {
@@ -2181,6 +2479,23 @@ type TraceContinuation = {
2181
2479
  /** Totals so far — a continued session reports cumulative totals. */
2182
2480
  summary: TraceSessionSummary;
2183
2481
  errors: TraceErrorRecord[];
2482
+ /**
2483
+ * The remote parent of the root span (`TracingConfig.parent` /
2484
+ * `InvokeConfig.traceParent`), kept so a later leg exports under the same
2485
+ * parent without the caller passing it again. Plain data: no credentials.
2486
+ */
2487
+ parent?: {
2488
+ spanId: string;
2489
+ flags: number;
2490
+ traceState?: string;
2491
+ };
2492
+ /**
2493
+ * Sub-agent spans recorded `pending` that no later record has finished, with
2494
+ * their identity sections only. The OTLP export withholds a pending span until
2495
+ * the run ends; if the run is abandoned instead (`closeTraceContinuation`) the
2496
+ * closing export writes them, so the spans of the earlier legs keep a parent.
2497
+ */
2498
+ pendingSpans?: TraceEventRecord[];
2184
2499
  };
2185
2500
  type TraceSinkSnapshot = {
2186
2501
  type: "file";
@@ -2254,6 +2569,7 @@ type ResolvedTraceSink = {
2254
2569
  type: "otlp";
2255
2570
  endpoint: string;
2256
2571
  headers?: Record<string, string>;
2572
+ exporter: OtlpExporter;
2257
2573
  };
2258
2574
  type ResolvedTraceConfig = {
2259
2575
  enabled: boolean;
@@ -2288,6 +2604,11 @@ type TraceSessionRuntime = {
2288
2604
  sequenceOffset?: number;
2289
2605
  /** 1-based part number; 1 for a session that starts with this invoke. */
2290
2606
  part?: number;
2607
+ /**
2608
+ * Pending sub-agent spans earlier parts recorded (see `TraceContinuation.pendingSpans`).
2609
+ * Not in `events`: only the OTLP export reads them.
2610
+ */
2611
+ carriedSpans?: TraceEventRecord[];
2291
2612
  /**
2292
2613
  * Set once the session has been handed to its sink. A closed session takes no
2293
2614
  * more events: they would never be delivered (and, on a session continued by
@@ -2296,6 +2617,26 @@ type TraceSessionRuntime = {
2296
2617
  closed?: boolean;
2297
2618
  fileBaseDir?: string;
2298
2619
  fileSessionDir?: string;
2620
+ /**
2621
+ * Exporters contributed by plugins (`AgentPlugin.traceExporters`), run next to
2622
+ * the `otlp` sink when the session is finalized.
2623
+ */
2624
+ exporters?: OtlpExporter[];
2625
+ /** What each exporter did when the session was finalized, in run order. */
2626
+ exportReports?: OtlpExportReport[];
2627
+ /** Where the trace came from, when this run is part of a larger trace. */
2628
+ parent?: TraceParent;
2629
+ /**
2630
+ * True when some OTLP exporter asked for prompt/response content. Only then
2631
+ * does `recordTraceEvent` build the content it holds on the record's
2632
+ * non-enumerable side channel. Runtime only.
2633
+ */
2634
+ captureContent?: boolean;
2635
+ /** What `recordTraceEvent` keeps of captured content: the widest message cap among the exporters that want it, and their string cap with headroom. */
2636
+ captureLimits?: {
2637
+ maxStringChars: number;
2638
+ maxMessages: number;
2639
+ };
2299
2640
  };
2300
2641
  type HandoffDescriptor<TParsed = any> = {
2301
2642
  type: "handoff";
@@ -2796,6 +3137,13 @@ type InvokeConfig = RunnableConfig & {
2796
3137
  limits?: Partial<AgentLimits>;
2797
3138
  onStateChange?: (state: SmartState) => boolean;
2798
3139
  checkpointReason?: string;
3140
+ /**
3141
+ * W3C trace context of the request that started this run (a `traceparent`
3142
+ * header value, or `{ traceparent, tracestate }`). The exported root span is
3143
+ * made a child of it. Wins over `TracingConfig.parent`; a run that continues a
3144
+ * paused trace keeps the parent it started with.
3145
+ */
3146
+ traceParent?: TraceParentInput;
2799
3147
  /**
2800
3148
  * Keys of `skills` to open deterministically at the start of this invoke,
2801
3149
  * before the first model call. Each one is opened through the real
@@ -2909,6 +3257,18 @@ type ToolCallContext = {
2909
3257
  * nest under it. Absent when the run is not traced.
2910
3258
  */
2911
3259
  traceSpanId?: string;
3260
+ /**
3261
+ * Trace id of the run this call belongs to. With `traceSpanId` it is what a
3262
+ * downstream call (an HTTP request, an MCP `_meta`) needs to join the trace:
3263
+ * `traceparentOf(ctx)` builds the `traceparent` header. Absent when the run is
3264
+ * not traced.
3265
+ */
3266
+ traceId?: string;
3267
+ /**
3268
+ * The W3C trace-flags byte of an incoming `traceparent`, when the run has one;
3269
+ * `traceparentOf` passes it on unchanged. Absent means sampled (`01`).
3270
+ */
3271
+ traceFlags?: number;
2912
3272
  };
2913
3273
  type SmartToolFn = (args: any, context?: ToolCallContext) => Promise<any> | any;
2914
3274
  type ToolCachePolicy = {
@@ -4960,39 +5320,35 @@ declare function defaultBuildPayload(events: LangfuseEvent[], ctx: LangfuseBuild
4960
5320
  declare function langfuseTracing(config?: LangfuseTracingConfig): AgentPlugin;
4961
5321
 
4962
5322
  /**
4963
- * OTLP/HTTP export of a finished run, driven by a hook instead of by a sink.
5323
+ * OTLP export of a run to a collector, declared next to the other plugins.
4964
5324
  *
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.
5325
+ * `plugins: [cognipeerGuardrail(), otelTracing({ endpoint })]` keeps tracing and
5326
+ * policy in one array instead of two unrelated config blocks. The plugin does
5327
+ * not build or send anything itself: it contributes an exporter
5328
+ * (`AgentPlugin.traceExporters`) and the SDK runs it inside
5329
+ * `finalizeTraceSession`, the same path the `otlpSink` uses. That is what makes
5330
+ * the output identical to the sink's: the SDK knows which leg ends the run (the
5331
+ * root span goes out once, with that leg), the plugin never has to.
4971
5332
  *
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.
5333
+ * The `sessionEnd` observer only reports. It reads what the exporter did for
5334
+ * this run and surfaces it (a `metadata` event, a warning on failure). It also
5335
+ * says so out loud when there is no trace session at all: a silent no-op in an
5336
+ * observability tool is discovered days later, when someone goes looking for
5337
+ * the traces, so `tracing: { enabled: true }` is called out by name.
4977
5338
  *
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.
5339
+ * A sub-agent inherits this plugin but records into its parent's session, which
5340
+ * is still being written. Only a root session finalizes and exports, so the
5341
+ * observer returns early for a child run.
4983
5342
  */
4984
5343
 
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. */
5344
+ type OtelTracingConfig = OtlpExportOptions & {
5345
+ /**
5346
+ * Plugin name, when exporting to more than one collector at once. Defaults to
5347
+ * `otel-tracing`.
5348
+ */
4993
5349
  name?: string;
4994
5350
  };
4995
- declare function otelTracing(config: OtelTracingConfig): AgentPlugin;
5351
+ declare function otelTracing(config?: OtelTracingConfig): AgentPlugin;
4996
5352
 
4997
5353
  /**
4998
5354
  * Webhook-backed human-in-the-loop transport for the `approvalTransport` slot.
@@ -5541,6 +5897,41 @@ declare function prepareStrictToolMenu<T extends object>(tools: T[]): {
5541
5897
  restorers: StrictRestorers;
5542
5898
  };
5543
5899
 
5900
+ /**
5901
+ * Prompt / response content for GenAI spans (`gen_ai.input.messages`,
5902
+ * `gen_ai.output.messages`, `gen_ai.system_instructions`, `gen_ai.tool.definitions`,
5903
+ * `gen_ai.tool.call.arguments`, `gen_ai.tool.call.result`).
5904
+ *
5905
+ * Content is OFF unless an exporter asks for it, and it is two steps:
5906
+ *
5907
+ * 1. At RECORD time (`buildCapturedContent`, called by `recordTraceEvent` only when
5908
+ * some exporter wants content): the messages, response, tool menu and tool
5909
+ * arguments / result are copied into a plain, bounded structure. A copy, because
5910
+ * the transcript is mutated and rewritten after the call; reasoning parts and
5911
+ * binary payloads never make it in. It rides on the record under a
5912
+ * NON-ENUMERABLE symbol key, so the file sink, the custom sink's JSON clones,
5913
+ * the cognipeer / http sinks and anything persisted never see it.
5914
+ * 2. At EXPORT time (`contentAttributes`): per exporter, the redact hook runs
5915
+ * first, then the caps (whole messages are dropped, oldest first; JSON is never
5916
+ * cut in the middle), then the encoding.
5917
+ */
5918
+
5919
+ type CaptureSource = {
5920
+ /** The messages as they went to the provider. */
5921
+ input?: unknown[];
5922
+ /** The provider's answer. */
5923
+ output?: unknown;
5924
+ toolDefinitions?: Array<{
5925
+ name: string;
5926
+ description?: string;
5927
+ parameters?: unknown;
5928
+ }>;
5929
+ toolArguments?: unknown;
5930
+ /** Set (even to undefined) only when the tool completed. */
5931
+ toolResult?: unknown;
5932
+ hasToolResult?: boolean;
5933
+ };
5934
+
5544
5935
  declare function fileSink(path?: string): TraceSinkConfig;
5545
5936
  type CustomSinkArg = ((event: TraceEventRecord) => void | Promise<void>) | {
5546
5937
  onEvent?: (event: TraceEventRecord) => void | Promise<void>;
@@ -5551,16 +5942,28 @@ declare function cognipeerSink(apiKey: string): TraceSinkConfig;
5551
5942
  declare function cognipeerSink(url: string | undefined, apiKey: string): TraceSinkConfig;
5552
5943
  declare function httpSink(url: string, headers?: Record<string, string>): TraceSinkConfig;
5553
5944
  /**
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")
5945
+ * Create an OTLP/HTTP sink that exports traces in OpenTelemetry format (JSON or
5946
+ * protobuf; GenAI and `cognipeer.*` attributes side by side by default).
5947
+ * @param endpoint OTLP traces endpoint (e.g. "https://console.cognipeer.com/api/client/v1/traces").
5948
+ * Leave it out to configure the exporter from the standard `OTEL_EXPORTER_OTLP_*` environment variables.
5556
5949
  * @param headers Optional headers (e.g. { Authorization: "Bearer ..." })
5950
+ * @param options Protocol, compression, timeout, retry, semconv, service name.
5557
5951
  */
5558
- declare function otlpSink(endpoint: string, headers?: Record<string, string>): TraceSinkConfig;
5952
+ declare function otlpSink(endpoint?: string, headers?: Record<string, string>, options?: Omit<OtlpExportOptions, "endpoint" | "headers">): TraceSinkConfig;
5953
+ declare function otlpSink(options: OtlpExportOptions): TraceSinkConfig;
5559
5954
  /**
5560
- * Convert a complete TraceSessionFile into an OTLP ExportTraceServiceRequest (JSON).
5561
- * Produces a root span for the session and child spans for each event.
5955
+ * Convert a TraceSessionFile into an OTLP ExportTraceServiceRequest (JSON model).
5956
+ * The root span is part of it only when the file ends the session: a `paused` or
5957
+ * `in_progress` file holds one leg of a longer run and yields its own spans only.
5562
5958
  */
5563
- declare function traceSessionToOtlp(session: TraceSessionFile): Record<string, unknown>;
5959
+ declare function traceSessionToOtlp(session: TraceSessionFile, options?: Partial<Omit<OtlpConvertOptions, "content">> & {
5960
+ /**
5961
+ * As on `otlpSink`: off unless given. A stored file holds the payload sections
5962
+ * (prompts, replies, tool arguments and results); they are in `cognipeer.sections`
5963
+ * only when this is on, through its `redact` and caps.
5964
+ */
5965
+ content?: boolean | OtlpContentOptions;
5966
+ }): OtlpExportTraceServiceRequest;
5564
5967
  /** Generate a W3C-compatible trace ID (32 hex chars / 128-bit). */
5565
5968
  declare function generateTraceId(): string;
5566
5969
  /** Generate an OTel span ID (16 hex chars / 64-bit). */
@@ -5628,13 +6031,32 @@ declare function recordTraceEvent(session: TraceSessionRuntime | undefined, even
5628
6031
  responseBytes?: number;
5629
6032
  model?: string;
5630
6033
  provider?: string;
6034
+ /** What the provider said about the response; see TraceEventRecord. Left out when unknown. */
6035
+ responseId?: string;
6036
+ responseModel?: string;
6037
+ rawFinishReason?: string;
6038
+ cacheWriteTokens?: number;
6039
+ usageBasis?: TraceEventRecord["usageBasis"];
6040
+ streaming?: boolean;
6041
+ outputType?: TraceEventRecord["outputType"];
6042
+ /** The id the PROVIDER gave a tool call; never one the SDK made up. */
6043
+ toolCallId?: string;
6044
+ skipReason?: TraceEventRecord["skipReason"];
5631
6045
  toolDetails?: TraceEventRecord["toolDetails"];
5632
6046
  toolExecutionId?: string;
5633
6047
  retryOf?: string;
5634
6048
  error?: {
5635
6049
  message: string;
5636
6050
  stack?: string;
6051
+ type?: string;
5637
6052
  } | null;
6053
+ /**
6054
+ * Content for exporters that ask for it (OTLP `content`), copied into a
6055
+ * non-enumerable side channel on the record at once: later changes to the
6056
+ * transcript cannot reach it, and no sink but those exporters ever sees it.
6057
+ * Ignored unless some exporter wants content.
6058
+ */
6059
+ capture?: CaptureSource;
5638
6060
  messageList?: any[];
5639
6061
  /** Pre-built sections to use instead of auto-converting messageList */
5640
6062
  sections?: TraceDataSection[];
@@ -5671,6 +6093,26 @@ type DeferredTraceEvent = Parameters<typeof recordTraceEvent>[1];
5671
6093
  * to the sink, and the next leg has not opened one yet.
5672
6094
  */
5673
6095
  declare function isTraceSessionOpen(session: TraceSessionRuntime | undefined): session is TraceSessionRuntime;
6096
+ /**
6097
+ * The records a reader should draw. A sub-agent that pauses for a human (an
6098
+ * approval or a question) and later resumes is ONE run recorded in several
6099
+ * segments, and records are append-only: each pause records the run's agent span
6100
+ * `pending`, and the segment that ends the run records it again under the SAME
6101
+ * `spanId`, finished, with `durationMs` covering the run from its first segment
6102
+ * (so the span is drawn over its children from every segment, the wait included). The rule for a
6103
+ * reader: for each `spanId` the record with the highest `sequence` wins, and an
6104
+ * earlier record of that id is dropped only when it is `pending`. Nothing else is
6105
+ * ever dropped, so a repeated id on records that are not `pending` comes back
6106
+ * untouched. Order is preserved.
6107
+ *
6108
+ * The session summary is not rewritten: `eventCounts` keeps counting every record
6109
+ * that was written, which is what the file holds.
6110
+ */
6111
+ declare function foldSupersededSpans<T extends {
6112
+ spanId?: string;
6113
+ sequence?: number;
6114
+ status?: string;
6115
+ }>(events: readonly T[]): T[];
5674
6116
  /**
5675
6117
  * Records `event` into the open session on `ctx`, or — when there is none —
5676
6118
  * returns a copy of `ctx` holding it for the next invoke to record. Returns
@@ -5686,6 +6128,100 @@ declare function recordOrDeferTraceEvent(ctx: Record<string, any> | undefined, e
5686
6128
  * previous leg recorded, before anything this one does.
5687
6129
  */
5688
6130
  declare function replayDeferredTraceEvents(session: TraceSessionRuntime | undefined, deferred: unknown): void;
6131
+ /**
6132
+ * Closes the trace of a run whose last leg paused (or bounced for summarization)
6133
+ * and will not be resumed: the root span, held back until a leg ends the
6134
+ * session, is exported now. Only the OTLP exporters are called (the `otlp` sink
6135
+ * from `tracing`, and `exporters`); the file, cognipeer, http and custom sinks
6136
+ * already have everything this session recorded.
6137
+ *
6138
+ * `events` are trace events that were held for a next leg that never came
6139
+ * (see `recordOrDeferTraceEvent`); they are recorded before the close.
6140
+ * Returns undefined when `continuation` is not one, or nothing would export it.
6141
+ */
6142
+ declare function closeTraceContinuation(continuation: unknown, params?: {
6143
+ tracing?: SmartAgentTracingConfig;
6144
+ exporters?: OtlpExporter[];
6145
+ /** How the run ended. Default `partial`: it stopped before an answer. */
6146
+ status?: "success" | "partial" | "error";
6147
+ error?: {
6148
+ message?: string;
6149
+ stack?: string;
6150
+ name?: string;
6151
+ } | null;
6152
+ agentRuntime?: AgentRuntimeConfig;
6153
+ events?: unknown;
6154
+ }): Promise<TraceSessionFile | undefined>;
6155
+
6156
+ /**
6157
+ * The OTLP/HTTP exporter: converts a trace session file, encodes it (JSON or
6158
+ * protobuf), optionally gzips it and POSTs it, with bounded retries.
6159
+ *
6160
+ * It never throws: a failure comes back as `{ ok: false, error }` and the caller
6161
+ * decides what that means (a sink marks the session partial, a plugin warns).
6162
+ * Retries follow the OTLP specification: 429, 502, 503, 504 and transport errors
6163
+ * or timeouts are retried with full-jitter exponential back-off (a server's
6164
+ * Retry-After wins); every other status is final, 404 and 500 included.
6165
+ *
6166
+ * `globalThis.fetch` is read when an export runs, not when the module loads or
6167
+ * the exporter is created, and the response is treated as the minimum a fetch
6168
+ * mock may offer (`ok`, `status`, `statusText`, `text`, `headers.get`).
6169
+ */
6170
+
6171
+ declare function createOtlpExporter(options?: OtlpExportOptions & {
6172
+ name?: string;
6173
+ }): OtlpExporter;
6174
+
6175
+ /**
6176
+ * W3C Trace Context helpers: reading the `traceparent` / `tracestate` a caller
6177
+ * passes in, and writing one for a downstream call (an HTTP request, an MCP
6178
+ * `_meta`) a tool makes from inside a traced run.
6179
+ */
6180
+
6181
+ type ParsedTraceparent = {
6182
+ traceId: string;
6183
+ spanId: string;
6184
+ /** The trace-flags byte, unchanged. */
6185
+ flags: number;
6186
+ sampled: boolean;
6187
+ };
6188
+ /**
6189
+ * Reads a `traceparent` header. Returns undefined for anything the W3C
6190
+ * specification calls invalid: upper case, wrong lengths, version `ff`,
6191
+ * all-zero ids, extra fields on version 00.
6192
+ */
6193
+ declare function parseTraceparent(header: unknown): ParsedTraceparent | undefined;
6194
+ /**
6195
+ * Writes a version 00 `traceparent`. `flags` is the trace-flags byte (default
6196
+ * `01`, sampled); pass the incoming byte to propagate a decision unchanged.
6197
+ */
6198
+ declare function formatTraceparent(parts: {
6199
+ traceId: string;
6200
+ spanId: string;
6201
+ sampled?: boolean;
6202
+ flags?: number;
6203
+ }): string;
6204
+ /**
6205
+ * The `traceparent` for a call a tool makes inside a traced run: the tool call's
6206
+ * own span is the parent. Takes the `ToolCallContext` a tool receives, and is
6207
+ * undefined when the run is not traced (there is nothing to propagate).
6208
+ */
6209
+ declare function traceparentOf(ctx: {
6210
+ traceId?: string;
6211
+ traceSpanId?: string;
6212
+ traceFlags?: number;
6213
+ } | undefined): string | undefined;
6214
+
6215
+ /**
6216
+ * The OpenTelemetry GenAI vocabulary the exporter speaks, in one place.
6217
+ *
6218
+ * Pinned to open-telemetry/semantic-conventions-genai at commit 547934a (status
6219
+ * "development": names may still change upstream). No `schemaUrl` is set on the
6220
+ * exported scope because the version that commit belongs to is unpublished;
6221
+ * the commit is recorded here and in the docs instead.
6222
+ */
6223
+
6224
+ declare const GENAI_SEMCONV_COMMIT = "547934a";
5689
6225
 
5690
6226
  /** True when the model's rule uses `thinking:{type:"adaptive"}` + `output_config.effort` (Claude 4.6+ / 5.x). */
5691
6227
  declare function supportsAdaptiveThinking(model: unknown): boolean;
@@ -6006,4 +6542,4 @@ declare class ModelRequestError extends ProviderError {
6006
6542
  constructor(init: ModelRequestErrorInit);
6007
6543
  }
6008
6544
 
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 };
6545
+ 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 };