trodo-node 1.2.0 → 2.1.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/README.md +154 -2
- package/dist/cjs/TrodoClient.js +71 -102
- package/dist/cjs/TrodoClient.js.map +1 -1
- package/dist/cjs/api/ApiClient.js +20 -2
- package/dist/cjs/api/ApiClient.js.map +1 -1
- package/dist/cjs/api/endpoints.js +7 -1
- package/dist/cjs/api/endpoints.js.map +1 -1
- package/dist/cjs/index.js +97 -29
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/otel/autoInstrument.js +253 -0
- package/dist/cjs/otel/autoInstrument.js.map +1 -0
- package/dist/cjs/otel/context.js +49 -0
- package/dist/cjs/otel/context.js.map +1 -0
- package/dist/cjs/otel/helpers.js +254 -0
- package/dist/cjs/otel/helpers.js.map +1 -0
- package/dist/cjs/otel/processor.js +129 -0
- package/dist/cjs/otel/processor.js.map +1 -0
- package/dist/cjs/otel/uuid.js +24 -0
- package/dist/cjs/otel/uuid.js.map +1 -0
- package/dist/cjs/otel/wrapAgent.js +399 -0
- package/dist/cjs/otel/wrapAgent.js.map +1 -0
- package/dist/esm/TrodoClient.d.ts +34 -11
- package/dist/esm/TrodoClient.d.ts.map +1 -1
- package/dist/esm/TrodoClient.js +71 -102
- package/dist/esm/TrodoClient.js.map +1 -1
- package/dist/esm/api/ApiClient.d.ts +9 -1
- package/dist/esm/api/ApiClient.d.ts.map +1 -1
- package/dist/esm/api/ApiClient.js +20 -2
- package/dist/esm/api/ApiClient.js.map +1 -1
- package/dist/esm/api/endpoints.d.ts +6 -1
- package/dist/esm/api/endpoints.d.ts.map +1 -1
- package/dist/esm/api/endpoints.js +7 -1
- package/dist/esm/api/endpoints.js.map +1 -1
- package/dist/esm/index.d.ts +84 -19
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +82 -23
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/otel/autoInstrument.d.ts +61 -0
- package/dist/esm/otel/autoInstrument.d.ts.map +1 -0
- package/dist/esm/otel/autoInstrument.js +248 -0
- package/dist/esm/otel/autoInstrument.js.map +1 -0
- package/dist/esm/otel/context.d.ts +26 -0
- package/dist/esm/otel/context.d.ts.map +1 -0
- package/dist/esm/otel/context.js +44 -0
- package/dist/esm/otel/context.js.map +1 -0
- package/dist/esm/otel/helpers.d.ts +119 -0
- package/dist/esm/otel/helpers.d.ts.map +1 -0
- package/dist/esm/otel/helpers.js +244 -0
- package/dist/esm/otel/helpers.js.map +1 -0
- package/dist/esm/otel/processor.d.ts +94 -0
- package/dist/esm/otel/processor.d.ts.map +1 -0
- package/dist/esm/otel/processor.js +125 -0
- package/dist/esm/otel/processor.js.map +1 -0
- package/dist/esm/otel/uuid.d.ts +7 -0
- package/dist/esm/otel/uuid.d.ts.map +1 -0
- package/dist/esm/otel/uuid.js +21 -0
- package/dist/esm/otel/uuid.js.map +1 -0
- package/dist/esm/otel/wrapAgent.d.ts +100 -0
- package/dist/esm/otel/wrapAgent.d.ts.map +1 -0
- package/dist/esm/otel/wrapAgent.js +389 -0
- package/dist/esm/otel/wrapAgent.js.map +1 -0
- package/dist/esm/types/index.d.ts +24 -48
- package/dist/esm/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { TrodoSpanProcessor, TrodoSpan } from './processor.js';
|
|
2
|
+
export interface WrapAgentOptions {
|
|
3
|
+
distinctId?: string | null;
|
|
4
|
+
conversationId?: string | null;
|
|
5
|
+
parentRunId?: string | null;
|
|
6
|
+
metadata?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export interface WrapAgentResult<R> {
|
|
9
|
+
result: R;
|
|
10
|
+
runId: string;
|
|
11
|
+
}
|
|
12
|
+
export interface WithSpanOptions {
|
|
13
|
+
kind?: TrodoSpan['kind'];
|
|
14
|
+
input?: unknown;
|
|
15
|
+
attributes?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export interface JoinRunOptions {
|
|
18
|
+
name?: string;
|
|
19
|
+
kind?: TrodoSpan['kind'];
|
|
20
|
+
input?: unknown;
|
|
21
|
+
attributes?: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
/** Return the currently active run_id, if any. */
|
|
24
|
+
export declare function currentRunId(): string | null;
|
|
25
|
+
/** Return the currently active span_id, if any. */
|
|
26
|
+
export declare function currentSpanId(): string | null;
|
|
27
|
+
/**
|
|
28
|
+
* RunHandle — returned by wrapAgent so callers can set input/output after
|
|
29
|
+
* inspecting the arguments / result. Mirrors the Python RunHandle API.
|
|
30
|
+
*/
|
|
31
|
+
export declare class RunHandle {
|
|
32
|
+
readonly runId: string;
|
|
33
|
+
readonly agentName: string;
|
|
34
|
+
input?: string;
|
|
35
|
+
output?: string;
|
|
36
|
+
metadata: Record<string, unknown>;
|
|
37
|
+
constructor(runId: string, agentName: string);
|
|
38
|
+
setInput(value: unknown): void;
|
|
39
|
+
setOutput(value: unknown): void;
|
|
40
|
+
setMetadata(extra: Record<string, unknown>): void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* SpanHandle — returned by withSpan / joinRun. Collect LLM model/token/cost
|
|
44
|
+
* info and tool name here; the processor picks them up at span close.
|
|
45
|
+
*/
|
|
46
|
+
export declare class SpanHandle {
|
|
47
|
+
readonly spanId: string;
|
|
48
|
+
readonly name: string;
|
|
49
|
+
input?: string;
|
|
50
|
+
output?: string;
|
|
51
|
+
attributes: Record<string, unknown>;
|
|
52
|
+
model?: string;
|
|
53
|
+
provider?: string;
|
|
54
|
+
inputTokens?: number;
|
|
55
|
+
outputTokens?: number;
|
|
56
|
+
cost?: number;
|
|
57
|
+
temperature?: number;
|
|
58
|
+
toolName?: string;
|
|
59
|
+
constructor(spanId: string, name: string);
|
|
60
|
+
setInput(value: unknown): void;
|
|
61
|
+
setOutput(value: unknown): void;
|
|
62
|
+
setAttribute(key: string, value: unknown): void;
|
|
63
|
+
setLlm(opts: {
|
|
64
|
+
model?: string;
|
|
65
|
+
provider?: string;
|
|
66
|
+
inputTokens?: number;
|
|
67
|
+
outputTokens?: number;
|
|
68
|
+
cost?: number;
|
|
69
|
+
temperature?: number;
|
|
70
|
+
}): void;
|
|
71
|
+
setTool(name: string): void;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Wrap an async function as an agent run. Every OTel span (or withSpan call)
|
|
75
|
+
* created inside `fn` is auto-nested under the run via AsyncLocalStorage.
|
|
76
|
+
*
|
|
77
|
+
* The callback receives a RunHandle so it can call `handle.setInput(...)` /
|
|
78
|
+
* `handle.setOutput(...)`. Old-style callbacks (no arg) still work.
|
|
79
|
+
*/
|
|
80
|
+
export declare function wrapAgent<R>(processor: TrodoSpanProcessor, teamSiteId: string, agentName: string, fn: (handle: RunHandle) => Promise<R> | R, options?: WrapAgentOptions): Promise<WrapAgentResult<R>>;
|
|
81
|
+
/**
|
|
82
|
+
* Create a nested span for non-auto-instrumented work (KB lookups, custom
|
|
83
|
+
* tools, computation). Requires an enclosing wrapAgent/joinRun.
|
|
84
|
+
*
|
|
85
|
+
* The callback receives a SpanHandle so the caller can record LLM tokens /
|
|
86
|
+
* tool name / output inside the function body.
|
|
87
|
+
*/
|
|
88
|
+
export declare function withSpan<R>(_processor: TrodoSpanProcessor, name: string, fn: (handle: SpanHandle) => Promise<R> | R, options?: WithSpanOptions): Promise<R>;
|
|
89
|
+
/**
|
|
90
|
+
* Join an existing agent run owned by a remote service. Opens a SPAN (not a
|
|
91
|
+
* run) under ``parentSpanId``; every span produced inside ``fn`` — including
|
|
92
|
+
* OTel auto-instrumented LLM spans — flushes to the backend as a child of
|
|
93
|
+
* the caller's run via append_spans. We never ingest a run here.
|
|
94
|
+
*
|
|
95
|
+
* Typical use: Express/FastAPI middleware detects ``X-Trodo-Run-Id`` +
|
|
96
|
+
* ``X-Trodo-Parent-Span-Id`` on an inbound request and wraps the handler
|
|
97
|
+
* with joinRun so the handler's work nests under the caller's run.
|
|
98
|
+
*/
|
|
99
|
+
export declare function joinRun<R>(processor: TrodoSpanProcessor, teamSiteId: string, runId: string, parentSpanId: string | null, fn: (handle: SpanHandle) => Promise<R> | R, options?: JoinRunOptions): Promise<R>;
|
|
100
|
+
//# sourceMappingURL=wrapAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapAgent.d.ts","sourceRoot":"","sources":["../../../src/otel/wrapAgent.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAY,MAAM,gBAAgB,CAAC;AAE9E,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAoBD,kDAAkD;AAClD,wBAAgB,YAAY,IAAI,MAAM,GAAG,IAAI,CAE5C;AAED,mDAAmD;AACnD,wBAAgB,aAAa,IAAI,MAAM,GAAG,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wrapAgent / withSpan / joinRun — user-facing surface for agent tracking.
|
|
3
|
+
*
|
|
4
|
+
* Users never generate IDs. The SDK creates run_id on wrapAgent, threads a
|
|
5
|
+
* span_id through AsyncLocalStorage, and any nested withSpan (or OTel
|
|
6
|
+
* auto-instrumented span from Anthropic/OpenAI/Vercel AI SDK/LangChain)
|
|
7
|
+
* inherits the current span as its parent.
|
|
8
|
+
*
|
|
9
|
+
* joinRun is for downstream microservices: opens a SPAN (not a run) in the
|
|
10
|
+
* context of the caller's run_id, flushing each span to the backend via
|
|
11
|
+
* append_spans. The originating service owns run lifecycle.
|
|
12
|
+
*/
|
|
13
|
+
import { uuidv4 } from './uuid.js';
|
|
14
|
+
import { getActiveContext, runWithContextAsync, } from './context.js';
|
|
15
|
+
function nowIso() {
|
|
16
|
+
return new Date().toISOString();
|
|
17
|
+
}
|
|
18
|
+
function truncate(value, max = 64000) {
|
|
19
|
+
if (value == null)
|
|
20
|
+
return undefined;
|
|
21
|
+
const str = typeof value === 'string' ? value : safeJson(value);
|
|
22
|
+
return str.length > max ? str.slice(0, max) : str;
|
|
23
|
+
}
|
|
24
|
+
function safeJson(v) {
|
|
25
|
+
try {
|
|
26
|
+
return JSON.stringify(v);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return String(v);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** Return the currently active run_id, if any. */
|
|
33
|
+
export function currentRunId() {
|
|
34
|
+
return getActiveContext()?.runId ?? null;
|
|
35
|
+
}
|
|
36
|
+
/** Return the currently active span_id, if any. */
|
|
37
|
+
export function currentSpanId() {
|
|
38
|
+
return getActiveContext()?.spanId ?? null;
|
|
39
|
+
}
|
|
40
|
+
function aggregate(spans) {
|
|
41
|
+
let totalIn = 0;
|
|
42
|
+
let totalOut = 0;
|
|
43
|
+
let totalCost = 0;
|
|
44
|
+
let toolCount = 0;
|
|
45
|
+
let errorCount = 0;
|
|
46
|
+
for (const s of spans) {
|
|
47
|
+
if (s.input_tokens)
|
|
48
|
+
totalIn += Number(s.input_tokens);
|
|
49
|
+
if (s.output_tokens)
|
|
50
|
+
totalOut += Number(s.output_tokens);
|
|
51
|
+
if (s.cost)
|
|
52
|
+
totalCost += Number(s.cost);
|
|
53
|
+
if (s.kind === 'tool')
|
|
54
|
+
toolCount += 1;
|
|
55
|
+
if (s.status === 'error')
|
|
56
|
+
errorCount += 1;
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
total_tokens_in: totalIn,
|
|
60
|
+
total_tokens_out: totalOut,
|
|
61
|
+
total_cost: totalCost ? Math.round(totalCost * 1e8) / 1e8 : 0,
|
|
62
|
+
span_count: spans.length,
|
|
63
|
+
tool_count: toolCount,
|
|
64
|
+
error_count: errorCount,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* RunHandle — returned by wrapAgent so callers can set input/output after
|
|
69
|
+
* inspecting the arguments / result. Mirrors the Python RunHandle API.
|
|
70
|
+
*/
|
|
71
|
+
export class RunHandle {
|
|
72
|
+
constructor(runId, agentName) {
|
|
73
|
+
this.metadata = {};
|
|
74
|
+
this.runId = runId;
|
|
75
|
+
this.agentName = agentName;
|
|
76
|
+
}
|
|
77
|
+
setInput(value) {
|
|
78
|
+
this.input = truncate(value);
|
|
79
|
+
}
|
|
80
|
+
setOutput(value) {
|
|
81
|
+
this.output = truncate(value);
|
|
82
|
+
}
|
|
83
|
+
setMetadata(extra) {
|
|
84
|
+
Object.assign(this.metadata, extra);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* SpanHandle — returned by withSpan / joinRun. Collect LLM model/token/cost
|
|
89
|
+
* info and tool name here; the processor picks them up at span close.
|
|
90
|
+
*/
|
|
91
|
+
export class SpanHandle {
|
|
92
|
+
constructor(spanId, name) {
|
|
93
|
+
this.attributes = {};
|
|
94
|
+
this.spanId = spanId;
|
|
95
|
+
this.name = name;
|
|
96
|
+
}
|
|
97
|
+
setInput(value) {
|
|
98
|
+
this.input = truncate(value);
|
|
99
|
+
}
|
|
100
|
+
setOutput(value) {
|
|
101
|
+
this.output = truncate(value);
|
|
102
|
+
}
|
|
103
|
+
setAttribute(key, value) {
|
|
104
|
+
this.attributes[key] = value;
|
|
105
|
+
}
|
|
106
|
+
setLlm(opts) {
|
|
107
|
+
if (opts.model !== undefined)
|
|
108
|
+
this.model = opts.model;
|
|
109
|
+
if (opts.provider !== undefined)
|
|
110
|
+
this.provider = opts.provider;
|
|
111
|
+
if (opts.inputTokens !== undefined)
|
|
112
|
+
this.inputTokens = Number(opts.inputTokens);
|
|
113
|
+
if (opts.outputTokens !== undefined)
|
|
114
|
+
this.outputTokens = Number(opts.outputTokens);
|
|
115
|
+
if (opts.cost !== undefined)
|
|
116
|
+
this.cost = Number(opts.cost);
|
|
117
|
+
if (opts.temperature !== undefined)
|
|
118
|
+
this.temperature = Number(opts.temperature);
|
|
119
|
+
}
|
|
120
|
+
setTool(name) {
|
|
121
|
+
this.toolName = name;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Wrap an async function as an agent run. Every OTel span (or withSpan call)
|
|
126
|
+
* created inside `fn` is auto-nested under the run via AsyncLocalStorage.
|
|
127
|
+
*
|
|
128
|
+
* The callback receives a RunHandle so it can call `handle.setInput(...)` /
|
|
129
|
+
* `handle.setOutput(...)`. Old-style callbacks (no arg) still work.
|
|
130
|
+
*/
|
|
131
|
+
export async function wrapAgent(processor, teamSiteId, agentName, fn, options = {}) {
|
|
132
|
+
const runId = uuidv4();
|
|
133
|
+
const rootSpanId = uuidv4();
|
|
134
|
+
const startedAt = nowIso();
|
|
135
|
+
const startedMs = Date.now();
|
|
136
|
+
const handle = new RunHandle(runId, agentName);
|
|
137
|
+
const ctx = {
|
|
138
|
+
runId,
|
|
139
|
+
spanId: rootSpanId,
|
|
140
|
+
parentSpanId: null,
|
|
141
|
+
teamSiteId,
|
|
142
|
+
processor,
|
|
143
|
+
};
|
|
144
|
+
let status = 'ok';
|
|
145
|
+
let output;
|
|
146
|
+
let errorSummary;
|
|
147
|
+
let result;
|
|
148
|
+
try {
|
|
149
|
+
result = await runWithContextAsync(ctx, async () => fn(handle));
|
|
150
|
+
output = handle.output ?? truncate(result);
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
status = 'error';
|
|
154
|
+
errorSummary = truncate(err?.message ?? String(err), 4000);
|
|
155
|
+
const pending = processor.getPending(runId);
|
|
156
|
+
const agg = aggregate(pending);
|
|
157
|
+
const run = {
|
|
158
|
+
run_id: runId,
|
|
159
|
+
agent_name: agentName,
|
|
160
|
+
distinct_id: options.distinctId ?? null,
|
|
161
|
+
conversation_id: options.conversationId ?? null,
|
|
162
|
+
parent_run_id: options.parentRunId ?? null,
|
|
163
|
+
status,
|
|
164
|
+
input: handle.input,
|
|
165
|
+
started_at: startedAt,
|
|
166
|
+
ended_at: nowIso(),
|
|
167
|
+
duration_ms: Date.now() - startedMs,
|
|
168
|
+
error_summary: errorSummary,
|
|
169
|
+
metadata: { ...(options.metadata || {}), ...handle.metadata },
|
|
170
|
+
total_tokens_in: agg.total_tokens_in,
|
|
171
|
+
total_tokens_out: agg.total_tokens_out,
|
|
172
|
+
total_cost: agg.total_cost,
|
|
173
|
+
span_count: agg.span_count,
|
|
174
|
+
tool_count: agg.tool_count,
|
|
175
|
+
error_count: agg.error_count,
|
|
176
|
+
};
|
|
177
|
+
await processor.ingestRun(run);
|
|
178
|
+
throw err;
|
|
179
|
+
}
|
|
180
|
+
const pending = processor.getPending(runId);
|
|
181
|
+
const agg = aggregate(pending);
|
|
182
|
+
const run = {
|
|
183
|
+
run_id: runId,
|
|
184
|
+
agent_name: agentName,
|
|
185
|
+
distinct_id: options.distinctId ?? null,
|
|
186
|
+
conversation_id: options.conversationId ?? null,
|
|
187
|
+
parent_run_id: options.parentRunId ?? null,
|
|
188
|
+
status,
|
|
189
|
+
input: handle.input,
|
|
190
|
+
output,
|
|
191
|
+
started_at: startedAt,
|
|
192
|
+
ended_at: nowIso(),
|
|
193
|
+
duration_ms: Date.now() - startedMs,
|
|
194
|
+
metadata: { ...(options.metadata || {}), ...handle.metadata },
|
|
195
|
+
total_tokens_in: agg.total_tokens_in,
|
|
196
|
+
total_tokens_out: agg.total_tokens_out,
|
|
197
|
+
total_cost: agg.total_cost,
|
|
198
|
+
span_count: agg.span_count,
|
|
199
|
+
tool_count: agg.tool_count,
|
|
200
|
+
error_count: agg.error_count,
|
|
201
|
+
};
|
|
202
|
+
await processor.ingestRun(run);
|
|
203
|
+
return { result, runId };
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Create a nested span for non-auto-instrumented work (KB lookups, custom
|
|
207
|
+
* tools, computation). Requires an enclosing wrapAgent/joinRun.
|
|
208
|
+
*
|
|
209
|
+
* The callback receives a SpanHandle so the caller can record LLM tokens /
|
|
210
|
+
* tool name / output inside the function body.
|
|
211
|
+
*/
|
|
212
|
+
export async function withSpan(_processor, name, fn, options = {}) {
|
|
213
|
+
const active = getActiveContext();
|
|
214
|
+
const spanId = uuidv4();
|
|
215
|
+
const handle = new SpanHandle(spanId, name);
|
|
216
|
+
if (options.input !== undefined)
|
|
217
|
+
handle.setInput(options.input);
|
|
218
|
+
if (options.attributes)
|
|
219
|
+
Object.assign(handle.attributes, options.attributes);
|
|
220
|
+
if (!active) {
|
|
221
|
+
// Outside of a run — execute but skip tracking (don't crash user code).
|
|
222
|
+
return Promise.resolve(fn(handle));
|
|
223
|
+
}
|
|
224
|
+
const startedAt = nowIso();
|
|
225
|
+
const startedMs = Date.now();
|
|
226
|
+
const child = {
|
|
227
|
+
runId: active.runId,
|
|
228
|
+
spanId,
|
|
229
|
+
parentSpanId: active.spanId,
|
|
230
|
+
teamSiteId: active.teamSiteId,
|
|
231
|
+
processor: active.processor,
|
|
232
|
+
};
|
|
233
|
+
let status = 'ok';
|
|
234
|
+
let errorType;
|
|
235
|
+
let errorMessage;
|
|
236
|
+
try {
|
|
237
|
+
const result = await runWithContextAsync(child, async () => fn(handle));
|
|
238
|
+
if (handle.output === undefined)
|
|
239
|
+
handle.setOutput(result);
|
|
240
|
+
const span = {
|
|
241
|
+
span_id: spanId,
|
|
242
|
+
run_id: active.runId,
|
|
243
|
+
parent_span_id: active.spanId,
|
|
244
|
+
kind: options.kind || 'generic',
|
|
245
|
+
name,
|
|
246
|
+
status,
|
|
247
|
+
started_at: startedAt,
|
|
248
|
+
ended_at: nowIso(),
|
|
249
|
+
duration_ms: Date.now() - startedMs,
|
|
250
|
+
input: handle.input,
|
|
251
|
+
output: handle.output,
|
|
252
|
+
model: handle.model,
|
|
253
|
+
provider: handle.provider,
|
|
254
|
+
input_tokens: handle.inputTokens,
|
|
255
|
+
output_tokens: handle.outputTokens,
|
|
256
|
+
cost: handle.cost,
|
|
257
|
+
temperature: handle.temperature,
|
|
258
|
+
tool_name: handle.toolName,
|
|
259
|
+
attributes: Object.keys(handle.attributes).length ? handle.attributes : undefined,
|
|
260
|
+
};
|
|
261
|
+
active.processor.enqueueSpan(span);
|
|
262
|
+
return result;
|
|
263
|
+
}
|
|
264
|
+
catch (err) {
|
|
265
|
+
status = 'error';
|
|
266
|
+
errorType = err?.name || 'Error';
|
|
267
|
+
errorMessage = truncate(err?.message ?? String(err), 4000);
|
|
268
|
+
const span = {
|
|
269
|
+
span_id: spanId,
|
|
270
|
+
run_id: active.runId,
|
|
271
|
+
parent_span_id: active.spanId,
|
|
272
|
+
kind: options.kind || 'generic',
|
|
273
|
+
name,
|
|
274
|
+
status,
|
|
275
|
+
started_at: startedAt,
|
|
276
|
+
ended_at: nowIso(),
|
|
277
|
+
duration_ms: Date.now() - startedMs,
|
|
278
|
+
input: handle.input,
|
|
279
|
+
output: handle.output,
|
|
280
|
+
error_type: errorType,
|
|
281
|
+
error_message: errorMessage,
|
|
282
|
+
model: handle.model,
|
|
283
|
+
provider: handle.provider,
|
|
284
|
+
input_tokens: handle.inputTokens,
|
|
285
|
+
output_tokens: handle.outputTokens,
|
|
286
|
+
cost: handle.cost,
|
|
287
|
+
temperature: handle.temperature,
|
|
288
|
+
tool_name: handle.toolName,
|
|
289
|
+
attributes: Object.keys(handle.attributes).length ? handle.attributes : undefined,
|
|
290
|
+
};
|
|
291
|
+
active.processor.enqueueSpan(span);
|
|
292
|
+
throw err;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Join an existing agent run owned by a remote service. Opens a SPAN (not a
|
|
297
|
+
* run) under ``parentSpanId``; every span produced inside ``fn`` — including
|
|
298
|
+
* OTel auto-instrumented LLM spans — flushes to the backend as a child of
|
|
299
|
+
* the caller's run via append_spans. We never ingest a run here.
|
|
300
|
+
*
|
|
301
|
+
* Typical use: Express/FastAPI middleware detects ``X-Trodo-Run-Id`` +
|
|
302
|
+
* ``X-Trodo-Parent-Span-Id`` on an inbound request and wraps the handler
|
|
303
|
+
* with joinRun so the handler's work nests under the caller's run.
|
|
304
|
+
*/
|
|
305
|
+
export async function joinRun(processor, teamSiteId, runId, parentSpanId, fn, options = {}) {
|
|
306
|
+
const spanId = uuidv4();
|
|
307
|
+
const name = options.name || 'remote.handler';
|
|
308
|
+
const kind = options.kind || 'agent';
|
|
309
|
+
const handle = new SpanHandle(spanId, name);
|
|
310
|
+
if (options.input !== undefined)
|
|
311
|
+
handle.setInput(options.input);
|
|
312
|
+
if (options.attributes)
|
|
313
|
+
Object.assign(handle.attributes, options.attributes);
|
|
314
|
+
processor.markJoined(runId);
|
|
315
|
+
const startedAt = nowIso();
|
|
316
|
+
const startedMs = Date.now();
|
|
317
|
+
const ctx = {
|
|
318
|
+
runId,
|
|
319
|
+
spanId,
|
|
320
|
+
parentSpanId: parentSpanId ?? null,
|
|
321
|
+
teamSiteId,
|
|
322
|
+
processor,
|
|
323
|
+
};
|
|
324
|
+
let status = 'ok';
|
|
325
|
+
let errorType;
|
|
326
|
+
let errorMessage;
|
|
327
|
+
try {
|
|
328
|
+
const result = await runWithContextAsync(ctx, async () => fn(handle));
|
|
329
|
+
if (handle.output === undefined)
|
|
330
|
+
handle.setOutput(result);
|
|
331
|
+
const span = {
|
|
332
|
+
span_id: spanId,
|
|
333
|
+
run_id: runId,
|
|
334
|
+
parent_span_id: parentSpanId ?? null,
|
|
335
|
+
kind,
|
|
336
|
+
name,
|
|
337
|
+
status,
|
|
338
|
+
started_at: startedAt,
|
|
339
|
+
ended_at: nowIso(),
|
|
340
|
+
duration_ms: Date.now() - startedMs,
|
|
341
|
+
input: handle.input,
|
|
342
|
+
output: handle.output,
|
|
343
|
+
model: handle.model,
|
|
344
|
+
provider: handle.provider,
|
|
345
|
+
input_tokens: handle.inputTokens,
|
|
346
|
+
output_tokens: handle.outputTokens,
|
|
347
|
+
cost: handle.cost,
|
|
348
|
+
temperature: handle.temperature,
|
|
349
|
+
tool_name: handle.toolName,
|
|
350
|
+
attributes: Object.keys(handle.attributes).length ? handle.attributes : undefined,
|
|
351
|
+
};
|
|
352
|
+
await processor.appendSpans(runId, [span]);
|
|
353
|
+
return result;
|
|
354
|
+
}
|
|
355
|
+
catch (err) {
|
|
356
|
+
status = 'error';
|
|
357
|
+
errorType = err?.name || 'Error';
|
|
358
|
+
errorMessage = truncate(err?.message ?? String(err), 4000);
|
|
359
|
+
const span = {
|
|
360
|
+
span_id: spanId,
|
|
361
|
+
run_id: runId,
|
|
362
|
+
parent_span_id: parentSpanId ?? null,
|
|
363
|
+
kind,
|
|
364
|
+
name,
|
|
365
|
+
status,
|
|
366
|
+
started_at: startedAt,
|
|
367
|
+
ended_at: nowIso(),
|
|
368
|
+
duration_ms: Date.now() - startedMs,
|
|
369
|
+
input: handle.input,
|
|
370
|
+
output: handle.output,
|
|
371
|
+
error_type: errorType,
|
|
372
|
+
error_message: errorMessage,
|
|
373
|
+
model: handle.model,
|
|
374
|
+
provider: handle.provider,
|
|
375
|
+
input_tokens: handle.inputTokens,
|
|
376
|
+
output_tokens: handle.outputTokens,
|
|
377
|
+
cost: handle.cost,
|
|
378
|
+
temperature: handle.temperature,
|
|
379
|
+
tool_name: handle.toolName,
|
|
380
|
+
attributes: Object.keys(handle.attributes).length ? handle.attributes : undefined,
|
|
381
|
+
};
|
|
382
|
+
await processor.appendSpans(runId, [span]);
|
|
383
|
+
throw err;
|
|
384
|
+
}
|
|
385
|
+
finally {
|
|
386
|
+
processor.unmarkJoined(runId);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
//# sourceMappingURL=wrapAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapAgent.js","sourceRoot":"","sources":["../../../src/otel/wrapAgent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EACL,gBAAgB,EAEhB,mBAAmB,GAEpB,MAAM,cAAc,CAAC;AA4BtB,SAAS,MAAM;IACb,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,GAAG,GAAG,KAAM;IAC5C,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,SAAS,CAAC;IACpC,MAAM,GAAG,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChE,OAAO,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACpD,CAAC;AAED,SAAS,QAAQ,CAAC,CAAU;IAC1B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;AACH,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,YAAY;IAC1B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AAC,KAAK,CAAC,CAAC;IAChC,CAAC;AACH,CAAC"}
|
|
@@ -22,6 +22,13 @@ export interface TrodoConfig {
|
|
|
22
22
|
onError?: (error: Error) => void;
|
|
23
23
|
/** Log API calls and errors to stderr. Default: false */
|
|
24
24
|
debug?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Enable OpenTelemetry auto-instrumentation for agent runs. When true, the
|
|
27
|
+
* SDK will register OTel instrumentations (if installed) for Anthropic,
|
|
28
|
+
* OpenAI, LangChain, etc. so their LLM/tool calls become spans under the
|
|
29
|
+
* current wrapAgent run automatically.
|
|
30
|
+
*/
|
|
31
|
+
autoInstrument?: boolean;
|
|
25
32
|
}
|
|
26
33
|
export interface ForUserOptions {
|
|
27
34
|
/**
|
|
@@ -80,54 +87,24 @@ export interface ResetResult {
|
|
|
80
87
|
distinctId?: string;
|
|
81
88
|
error?: string;
|
|
82
89
|
}
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Feedback attached to a run. `runId` is returned by `wrapAgent` — users never
|
|
92
|
+
* mint IDs themselves. All fields optional except one of satisfaction / rating
|
|
93
|
+
* / comment must be present (server validates).
|
|
94
|
+
*/
|
|
95
|
+
export interface FeedbackProps {
|
|
96
|
+
/** Thumbs-up / thumbs-down reaction. */
|
|
97
|
+
satisfaction?: 'positive' | 'negative';
|
|
98
|
+
/** Numeric score on whatever scale you use (1–5, NPS, etc.). */
|
|
99
|
+
rating?: number;
|
|
100
|
+
/** Free-text comment. */
|
|
101
|
+
comment?: string;
|
|
102
|
+
/** Alias of `comment` — accepted for ergonomic compatibility. */
|
|
103
|
+
feedback?: string;
|
|
104
|
+
/** Optional distinct_id for attribution; usually inherited from the run. */
|
|
92
105
|
distinctId?: string;
|
|
93
|
-
/**
|
|
94
|
-
|
|
95
|
-
/** Extra properties stored in the JSONB column */
|
|
96
|
-
[key: string]: unknown;
|
|
97
|
-
}
|
|
98
|
-
export interface AgentCallProps extends AgentIdentifiers {
|
|
99
|
-
prompt?: string;
|
|
100
|
-
model?: string;
|
|
101
|
-
temperature?: number;
|
|
102
|
-
systemPromptVersion?: string;
|
|
103
|
-
provider?: string;
|
|
104
|
-
}
|
|
105
|
-
export interface ToolUseProps extends AgentIdentifiers {
|
|
106
|
-
/** Tool name — required */
|
|
107
|
-
toolName: string;
|
|
108
|
-
/** Tool input payload (stored in properties.input) */
|
|
109
|
-
input?: unknown;
|
|
110
|
-
/** Tool output payload (stored in properties.output) */
|
|
111
|
-
output?: unknown;
|
|
112
|
-
latencyMs?: number;
|
|
113
|
-
status?: 'success' | 'failure';
|
|
114
|
-
}
|
|
115
|
-
export interface AgentResponseProps extends AgentIdentifiers {
|
|
116
|
-
output?: string;
|
|
117
|
-
model?: string;
|
|
118
|
-
completionTokens?: number;
|
|
119
|
-
promptTokens?: number;
|
|
120
|
-
totalTokens?: number;
|
|
121
|
-
finishReason?: string;
|
|
122
|
-
}
|
|
123
|
-
export interface AgentErrorProps extends AgentIdentifiers {
|
|
124
|
-
errorType?: string;
|
|
125
|
-
errorMessage?: string;
|
|
126
|
-
failedTool?: string;
|
|
127
|
-
traceback?: string;
|
|
128
|
-
}
|
|
129
|
-
export interface FeedbackProps extends AgentIdentifiers {
|
|
130
|
-
feedback: 'positive' | 'negative' | 'unreact';
|
|
106
|
+
/** Free-form metadata. */
|
|
107
|
+
metadata?: Record<string, unknown>;
|
|
131
108
|
}
|
|
132
109
|
export interface PeopleInterface {
|
|
133
110
|
set(properties: Record<string, unknown>): Promise<ApiResult>;
|
|
@@ -156,5 +133,4 @@ export interface ApiResult {
|
|
|
156
133
|
error?: string;
|
|
157
134
|
[key: string]: unknown;
|
|
158
135
|
}
|
|
159
|
-
export {};
|
|
160
136
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,WAAW;IAC1B,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,yDAAyD;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,WAAW;IAC1B,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,yDAAyD;IACzD,KAAK,CA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