@economic/agents 3.2.1 → 3.3.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.mts +21 -0
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -12,6 +12,7 @@ import { EventEmitter } from "node:events";
|
|
|
12
12
|
import { TaskHandlers, TaskStep, TaskValue } from "agents/tasks";
|
|
13
13
|
import { JSONWebKeySet, JWTPayload } from "jose";
|
|
14
14
|
import { ReadableSpan } from "@opentelemetry/sdk-trace-base";
|
|
15
|
+
import { Context, Span, SpanOptions, Tracer } from "@opentelemetry/api";
|
|
15
16
|
import { Observability, ObservabilityEvent } from "agents/observability";
|
|
16
17
|
import { Streams } from "agents/streams";
|
|
17
18
|
//#region src/extensions/types.d.ts
|
|
@@ -13359,4 +13360,24 @@ export declare class AnalyticsHandler implements TracingHandler {
|
|
|
13359
13360
|
handle(event: TracingEvent): Promise<void>;
|
|
13360
13361
|
private _events;
|
|
13361
13362
|
}
|
|
13363
|
+
export declare const TURN_SPAN_NAME = "ai.streamText";
|
|
13364
|
+
/**
|
|
13365
|
+
* Starts every span of a turn as a child of the turn's `ai.streamText` span.
|
|
13366
|
+
*
|
|
13367
|
+
* The `ai` SDK takes a span's parent from OpenTelemetry's active context, and
|
|
13368
|
+
* nothing tracks that here, so each of its spans would otherwise start a trace
|
|
13369
|
+
* of its own. A tracer is created per turn, so the turn span is known. With a
|
|
13370
|
+
* `parent`, the turn span itself starts under that span, e.g. the first turn
|
|
13371
|
+
* of the exchange it continues.
|
|
13372
|
+
*/
|
|
13373
|
+
export declare class TurnTracer implements Tracer {
|
|
13374
|
+
private readonly tracer;
|
|
13375
|
+
private readonly parent?;
|
|
13376
|
+
private turnSpan?;
|
|
13377
|
+
constructor(tracer: Tracer, parent?: SpanIds | undefined);
|
|
13378
|
+
startSpan(name: string, options?: SpanOptions, ctx?: Context): Span;
|
|
13379
|
+
startActiveSpan<F extends (span: Span) => unknown>(name: string, fn: F): ReturnType<F>;
|
|
13380
|
+
startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, fn: F): ReturnType<F>;
|
|
13381
|
+
startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, ctx: Context, fn: F): ReturnType<F>;
|
|
13382
|
+
}
|
|
13362
13383
|
export { type Action, type ActionContext, type AgentConfig, type AgentConnectionStatus, type AgentConnectionType, type AgentEnv, type Auth, type Authenticator, type Claims, type Credential, type CredentialProvider, type Identity, type InvocableSkill, type JwtAuthenticatorOptions, type JwtOptions, type RegisteredAction, type RunResult, type Skill, type SkillActivation, type SkillInvoked, type SkillSource, type TokenExchangeOptions, type Tool, type ToolContext, type ToolSet, type TracedFeedback, type TracedSpan, type TracedTurn, type TracingEvent, type TracingHandler, type TurnEnded, type TurnInspection, type TurnSnapshot, type TurnStarted, type UnauthorizedPolicy, getCurrentAgent };
|
package/dist/index.mjs
CHANGED
|
@@ -69881,7 +69881,7 @@ var TurnTracer = class {
|
|
|
69881
69881
|
this.parent = parent;
|
|
69882
69882
|
}
|
|
69883
69883
|
startSpan(name, options, ctx = context.active()) {
|
|
69884
|
-
if (name ===
|
|
69884
|
+
if (name === "ai.streamText") {
|
|
69885
69885
|
const parent = this.parent && {
|
|
69886
69886
|
traceId: this.parent.traceId,
|
|
69887
69887
|
spanId: this.parent.spanId,
|
|
@@ -74311,4 +74311,4 @@ function createEvent(event, payload) {
|
|
|
74311
74311
|
actorId: event.actorId
|
|
74312
74312
|
};
|
|
74313
74313
|
}
|
|
74314
|
-
export { Agent, AnalyticsHandler, Assistant, AuditLogHandler, AuthenticationError, ChatAgent, TokenExchange, TokenExchangeError, UserStore, action, bearerToken, file, getCurrentAgent, jwtAuthenticator, routeAgentRequest, skill, tool, verifyJwt };
|
|
74314
|
+
export { Agent, AnalyticsHandler, Assistant, AuditLogHandler, AuthenticationError, ChatAgent, TURN_SPAN_NAME, TokenExchange, TokenExchangeError, TurnTracer, UserStore, action, bearerToken, file, getCurrentAgent, jwtAuthenticator, routeAgentRequest, skill, tool, verifyJwt };
|