@uselemma/tracing 7.14.0 → 7.15.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 +73 -17
- package/dist/client.d.ts +49 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +204 -73
- package/dist/client.js.map +1 -1
- package/dist/coding-agent-backlog.d.ts +81 -0
- package/dist/coding-agent-backlog.d.ts.map +1 -0
- package/dist/coding-agent-backlog.js +239 -0
- package/dist/coding-agent-backlog.js.map +1 -0
- package/dist/coding-agent-delivery.d.ts +31 -0
- package/dist/coding-agent-delivery.d.ts.map +1 -0
- package/dist/coding-agent-delivery.js +97 -0
- package/dist/coding-agent-delivery.js.map +1 -0
- package/dist/coding-agent-queue.d.ts +74 -0
- package/dist/coding-agent-queue.d.ts.map +1 -0
- package/dist/coding-agent-queue.js +230 -0
- package/dist/coding-agent-queue.js.map +1 -0
- package/dist/coding-agent.d.ts +14 -0
- package/dist/coding-agent.d.ts.map +1 -1
- package/dist/coding-agent.js +52 -15
- package/dist/coding-agent.js.map +1 -1
- package/dist/debug-mode.d.ts.map +1 -1
- package/dist/debug-mode.js +4 -4
- package/dist/debug-mode.js.map +1 -1
- package/dist/delivery.d.ts +50 -7
- package/dist/delivery.d.ts.map +1 -1
- package/dist/delivery.js +117 -21
- package/dist/delivery.js.map +1 -1
- package/dist/env.d.ts +8 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +18 -0
- package/dist/env.js.map +1 -0
- package/dist/error-message.d.ts +10 -0
- package/dist/error-message.d.ts.map +1 -1
- package/dist/error-message.js +14 -0
- package/dist/error-message.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/integration-client.d.ts +20 -0
- package/dist/integration-client.d.ts.map +1 -0
- package/dist/integration-client.js +47 -0
- package/dist/integration-client.js.map +1 -0
- package/dist/langchain-context.d.ts +7 -0
- package/dist/langchain-context.d.ts.map +1 -0
- package/dist/langchain-context.js +28 -0
- package/dist/langchain-context.js.map +1 -0
- package/dist/langchain-eviction.d.ts +42 -0
- package/dist/langchain-eviction.d.ts.map +1 -0
- package/dist/langchain-eviction.js +56 -0
- package/dist/langchain-eviction.js.map +1 -0
- package/dist/langchain.d.ts +31 -13
- package/dist/langchain.d.ts.map +1 -1
- package/dist/langchain.js +74 -109
- package/dist/langchain.js.map +1 -1
- package/dist/mastra.d.ts +9 -11
- package/dist/mastra.d.ts.map +1 -1
- package/dist/mastra.js +40 -25
- package/dist/mastra.js.map +1 -1
- package/dist/openai-agents.d.ts +8 -0
- package/dist/openai-agents.d.ts.map +1 -1
- package/dist/openai-agents.js +17 -14
- package/dist/openai-agents.js.map +1 -1
- package/dist/serialize.d.ts +17 -0
- package/dist/serialize.d.ts.map +1 -0
- package/dist/serialize.js +143 -0
- package/dist/serialize.js.map +1 -0
- package/dist/stream-result.d.ts +33 -0
- package/dist/stream-result.d.ts.map +1 -0
- package/dist/stream-result.js +135 -0
- package/dist/stream-result.js.map +1 -0
- package/dist/vercel-ai-events.d.ts +308 -0
- package/dist/vercel-ai-events.d.ts.map +1 -0
- package/dist/vercel-ai-events.js +340 -0
- package/dist/vercel-ai-events.js.map +1 -0
- package/dist/vercel-ai-run.d.ts +171 -0
- package/dist/vercel-ai-run.d.ts.map +1 -0
- package/dist/vercel-ai-run.js +650 -0
- package/dist/vercel-ai-run.js.map +1 -0
- package/dist/vercel-ai.d.ts +36 -108
- package/dist/vercel-ai.d.ts.map +1 -1
- package/dist/vercel-ai.js +185 -882
- package/dist/vercel-ai.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/examples/vercel-ai-v6.ts +2 -2
- package/examples/vercel-ai-v7.ts +14 -16
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Open-trace TTL for the LangChain handler. A root whose end callback never
|
|
4
|
+
* arrives (an abandoned stream, a cancelled run) would otherwise keep its
|
|
5
|
+
* trace and runs in memory, unsent, for the life of the process.
|
|
6
|
+
*
|
|
7
|
+
* Staleness is idle time, not age: last activity is the latest of the
|
|
8
|
+
* trace's open time, its latest run end and the start of any run still in
|
|
9
|
+
* flight (Python's `last_activity_at`), so a long agent loop that still emits
|
|
10
|
+
* callbacks is not evicted. Sweeps are interval-gated so frequent start
|
|
11
|
+
* callbacks stay cheap.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.IdleTraceSweeper = void 0;
|
|
15
|
+
const DEFAULT_OPEN_TRACE_TTL_MS = 2 * 60 * 60 * 1000;
|
|
16
|
+
const DEFAULT_EVICTION_INTERVAL_MS = 5 * 60 * 1000;
|
|
17
|
+
class IdleTraceSweeper {
|
|
18
|
+
ttlMs;
|
|
19
|
+
intervalMs;
|
|
20
|
+
lastSweepAt = Number.NEGATIVE_INFINITY;
|
|
21
|
+
constructor({ openTraceTtlMs = DEFAULT_OPEN_TRACE_TTL_MS, evictionIntervalMs = DEFAULT_EVICTION_INTERVAL_MS, }) {
|
|
22
|
+
this.ttlMs = openTraceTtlMs;
|
|
23
|
+
this.intervalMs = evictionIntervalMs;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Pass each open trace idle past the TTL to `evict`, with one warning that
|
|
27
|
+
* lists their root run IDs. Runs at most once per interval.
|
|
28
|
+
*/
|
|
29
|
+
sweep(traces, runs, evict) {
|
|
30
|
+
if (this.ttlMs === null)
|
|
31
|
+
return;
|
|
32
|
+
const now = Date.now();
|
|
33
|
+
if (now - this.lastSweepAt < this.intervalMs)
|
|
34
|
+
return;
|
|
35
|
+
this.lastSweepAt = now;
|
|
36
|
+
const latestRunStart = new Map();
|
|
37
|
+
for (const run of runs) {
|
|
38
|
+
const startedAt = run.startedAt.getTime();
|
|
39
|
+
const seen = latestRunStart.get(run.owningTraceId) ?? 0;
|
|
40
|
+
if (startedAt > seen)
|
|
41
|
+
latestRunStart.set(run.owningTraceId, startedAt);
|
|
42
|
+
}
|
|
43
|
+
const cutoff = now - this.ttlMs;
|
|
44
|
+
const stale = Array.from(traces).filter(([id, trace]) => {
|
|
45
|
+
const lastActivity = Math.max(trace.openedAt.getTime(), trace.latestEnd?.getTime() ?? 0, latestRunStart.get(id) ?? 0);
|
|
46
|
+
return !trace.ended && lastActivity < cutoff;
|
|
47
|
+
});
|
|
48
|
+
if (stale.length === 0)
|
|
49
|
+
return;
|
|
50
|
+
console.warn(`@uselemma/tracing: evicting ${stale.length} stale LangChain trace(s) that never received an end event (openTraceTtlMs=${this.ttlMs}); root run IDs: ${stale.map(([id]) => id).join(", ")}`);
|
|
51
|
+
for (const [rootRunId, trace] of stale)
|
|
52
|
+
evict(rootRunId, trace);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.IdleTraceSweeper = IdleTraceSweeper;
|
|
56
|
+
//# sourceMappingURL=langchain-eviction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langchain-eviction.js","sourceRoot":"","sources":["../src/langchain-eviction.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,MAAM,yBAAyB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACrD,MAAM,4BAA4B,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAenD,MAAa,gBAAgB;IACV,KAAK,CAAgB;IACrB,UAAU,CAAS;IAC5B,WAAW,GAAG,MAAM,CAAC,iBAAiB,CAAC;IAE/C,YAAY,EACV,cAAc,GAAG,yBAAyB,EAC1C,kBAAkB,GAAG,4BAA4B,GAChC;QACjB,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,kBAAkB,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,KAAK,CACH,MAA8B,EAC9B,IAA2B,E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AK,oBAAoB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC5L,CAAC;QACF,KAAK,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,KAAK;YAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAClE,CAAC;CACF;AAhDD,4CAgDC"}
|
package/dist/langchain.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Lemma, type LemmaClientOptions } from "./client";
|
|
2
|
+
import { type IdleTraceOptions } from "./langchain-eviction";
|
|
2
3
|
type RunId = string;
|
|
3
4
|
type Serialized = {
|
|
4
5
|
id?: string[];
|
|
@@ -10,7 +11,7 @@ type LLMResult = {
|
|
|
10
11
|
generations?: unknown[][];
|
|
11
12
|
llmOutput?: Record<string, unknown>;
|
|
12
13
|
};
|
|
13
|
-
export type LangChainIntegrationOptions = {
|
|
14
|
+
export type LangChainIntegrationOptions = IdleTraceOptions & {
|
|
14
15
|
lemma?: Lemma;
|
|
15
16
|
apiKey?: LemmaClientOptions["apiKey"];
|
|
16
17
|
projectId?: LemmaClientOptions["projectId"];
|
|
@@ -33,10 +34,18 @@ export declare class LemmaLangChainCallbackHandler {
|
|
|
33
34
|
ignore_chain: boolean;
|
|
34
35
|
ignore_agent: boolean;
|
|
35
36
|
ignore_retriever: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Callbacks only record in memory and schedule delivery, so LangChain runs
|
|
39
|
+
* them inline instead of on its process-wide callback queue (concurrency 1).
|
|
40
|
+
* A root's end callback has therefore run before `invoke()` resolves, and
|
|
41
|
+
* `flush()` sees its send.
|
|
42
|
+
*/
|
|
43
|
+
readonly awaitHandlers = true;
|
|
36
44
|
private lemma;
|
|
37
45
|
private readonly runs;
|
|
38
46
|
private readonly traces;
|
|
39
47
|
private readonly pending;
|
|
48
|
+
private readonly idleTraces;
|
|
40
49
|
constructor(options?: LangChainIntegrationOptions);
|
|
41
50
|
private getLemma;
|
|
42
51
|
private resolveThreadId;
|
|
@@ -60,6 +69,13 @@ export declare class LemmaLangChainCallbackHandler {
|
|
|
60
69
|
private forgetTraceRuns;
|
|
61
70
|
private endStoredRun;
|
|
62
71
|
private finalizeTrace;
|
|
72
|
+
/** Send the partial trace of each root idle past `openTraceTtlMs`, and forget it. */
|
|
73
|
+
private evictIdleTraces;
|
|
74
|
+
/**
|
|
75
|
+
* Send an owner's trace on a later macrotask and track it in `pending`.
|
|
76
|
+
* Callbacks never await delivery, and recordResult(invoke return) can still
|
|
77
|
+
* stamp usage onto generations whose callback event omitted it.
|
|
78
|
+
*/
|
|
63
79
|
private maybeFinalizeOwner;
|
|
64
80
|
/**
|
|
65
81
|
* Copy token usage from an `invoke` / chain result onto generation spans
|
|
@@ -68,23 +84,25 @@ export declare class LemmaLangChainCallbackHandler {
|
|
|
68
84
|
recordResult(result: unknown): number;
|
|
69
85
|
private traceName;
|
|
70
86
|
handleChainStart(serialized: Serialized, inputs: unknown, runId: RunId, parentRunId?: RunId, tags?: string[], metadata?: Record<string, unknown>, runType?: string, name?: string): void;
|
|
71
|
-
handleChainEnd(outputs: unknown, runId: RunId):
|
|
72
|
-
handleChainError(error: unknown, runId: RunId):
|
|
87
|
+
handleChainEnd(outputs: unknown, runId: RunId): void;
|
|
88
|
+
handleChainError(error: unknown, runId: RunId): void;
|
|
73
89
|
handleLLMStart(serialized: Serialized, prompts: string[], runId: RunId, parentRunId?: RunId, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, _runName?: string): void;
|
|
74
90
|
handleChatModelStart(serialized: Serialized, messages: unknown[][], runId: RunId, parentRunId?: RunId, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, _runName?: string): void;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
private finalizeDeferredOwner;
|
|
78
|
-
handleLLMError(error: unknown, runId: RunId): Promise<void>;
|
|
91
|
+
handleLLMEnd(output: LLMResult, runId: RunId): void;
|
|
92
|
+
handleLLMError(error: unknown, runId: RunId): void;
|
|
79
93
|
handleToolStart(serialized: Serialized, input: unknown, runId: RunId, parentRunId?: RunId, tags?: string[], metadata?: Record<string, unknown>, _runName?: string, _toolCallId?: string): void;
|
|
80
|
-
handleToolEnd(output: unknown, runId: RunId):
|
|
81
|
-
handleToolError(error: unknown, runId: RunId):
|
|
94
|
+
handleToolEnd(output: unknown, runId: RunId): void;
|
|
95
|
+
handleToolError(error: unknown, runId: RunId): void;
|
|
82
96
|
handleRetrieverStart(serialized: Serialized, query: string, runId: RunId, parentRunId?: RunId, tags?: string[], metadata?: Record<string, unknown>, _name?: string): void;
|
|
83
|
-
handleRetrieverEnd(documents: unknown[], runId: RunId):
|
|
84
|
-
handleRetrieverError(error: unknown, runId: RunId):
|
|
85
|
-
/**
|
|
97
|
+
handleRetrieverEnd(documents: unknown[], runId: RunId): void;
|
|
98
|
+
handleRetrieverError(error: unknown, runId: RunId): void;
|
|
99
|
+
/**
|
|
100
|
+
* Await delivery of every trace whose root run already ended. One handler
|
|
101
|
+
* serves every concurrent run, so a trace whose root is still running stays
|
|
102
|
+
* open; `shutdown()` sends those.
|
|
103
|
+
*/
|
|
86
104
|
flush(): Promise<void>;
|
|
87
|
-
/** Finalize open
|
|
105
|
+
/** Finalize and send every trace, open ones included, and reset state. */
|
|
88
106
|
shutdown(): Promise<void>;
|
|
89
107
|
}
|
|
90
108
|
export declare const LangChainCallbackHandler: typeof LemmaLangChainCallbackHandler;
|
package/dist/langchain.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langchain.d.ts","sourceRoot":"","sources":["../src/langchain.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"langchain.d.ts","sourceRoot":"","sources":["../src/langchain.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAC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EAAE,KAAK;IAuB5C,oBAAoB,CAClB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,KAAK,EACZ,WAAW,CAAC,EAAE,KAAK,EACnB,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,KAAK,CAAC,EAAE,MAAM;IAyChB,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK;IAqBrD,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK;IAuBjD;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,0EAA0E;IACpE,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAUhC;AAED,eAAO,MAAM,wBAAwB,sCAAgC,CAAC;AAEtE,wBAAgB,SAAS,CAAC,OAAO,GAAE,2BAAgC,iCAElE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,2BAAgC,iCAElE;AAED,MAAM,MAAM,gCAAgC,GAAG,2BAA2B,CAAC;AAC3E,MAAM,MAAM,gCAAgC,GAAG,2BAA2B,CAAC"}
|
package/dist/langchain.js
CHANGED
|
@@ -5,6 +5,8 @@ exports.langChain = langChain;
|
|
|
5
5
|
exports.langGraph = langGraph;
|
|
6
6
|
const client_1 = require("./client");
|
|
7
7
|
const error_message_1 = require("./error-message");
|
|
8
|
+
const langchain_context_1 = require("./langchain-context");
|
|
9
|
+
const langchain_eviction_1 = require("./langchain-eviction");
|
|
8
10
|
const schedule_1 = require("./schedule");
|
|
9
11
|
const tool_result_1 = require("./tool-result");
|
|
10
12
|
const model_1 = require("./model");
|
|
@@ -423,20 +425,6 @@ function llmOutputMessages(result) {
|
|
|
423
425
|
}
|
|
424
426
|
return messages.length ? messages : undefined;
|
|
425
427
|
}
|
|
426
|
-
function hasToolCalls(output) {
|
|
427
|
-
if (!output || typeof output !== "object")
|
|
428
|
-
return false;
|
|
429
|
-
if (Array.isArray(output))
|
|
430
|
-
return output.some((item) => hasToolCalls(item));
|
|
431
|
-
const record = output;
|
|
432
|
-
if (Array.isArray(record.tool_calls) && record.tool_calls.length > 0) {
|
|
433
|
-
return true;
|
|
434
|
-
}
|
|
435
|
-
if (Array.isArray(record.toolCalls) && record.toolCalls.length > 0) {
|
|
436
|
-
return true;
|
|
437
|
-
}
|
|
438
|
-
return false;
|
|
439
|
-
}
|
|
440
428
|
function providerFromId(id) {
|
|
441
429
|
if (!Array.isArray(id))
|
|
442
430
|
return undefined;
|
|
@@ -591,13 +579,23 @@ class LemmaLangChainCallbackHandler {
|
|
|
591
579
|
ignore_chain = false;
|
|
592
580
|
ignore_agent = false;
|
|
593
581
|
ignore_retriever = false;
|
|
582
|
+
/**
|
|
583
|
+
* Callbacks only record in memory and schedule delivery, so LangChain runs
|
|
584
|
+
* them inline instead of on its process-wide callback queue (concurrency 1).
|
|
585
|
+
* A root's end callback has therefore run before `invoke()` resolves, and
|
|
586
|
+
* `flush()` sees its send.
|
|
587
|
+
*/
|
|
588
|
+
awaitHandlers = true;
|
|
594
589
|
lemma;
|
|
595
590
|
runs = new Map();
|
|
596
591
|
traces = new Map();
|
|
597
592
|
pending = new Set();
|
|
593
|
+
idleTraces;
|
|
598
594
|
constructor(options = {}) {
|
|
599
595
|
this.options = options;
|
|
596
|
+
(0, langchain_context_1.ensureLangChainAsyncContext)();
|
|
600
597
|
this.lemma = options.lemma;
|
|
598
|
+
this.idleTraces = new langchain_eviction_1.IdleTraceSweeper(options);
|
|
601
599
|
}
|
|
602
600
|
getLemma() {
|
|
603
601
|
this.lemma ??= new client_1.Lemma({
|
|
@@ -672,7 +670,7 @@ class LemmaLangChainCallbackHandler {
|
|
|
672
670
|
}
|
|
673
671
|
createOwnedTrace(runId, name, input, kind, metadata, tags) {
|
|
674
672
|
const startedAt = new Date();
|
|
675
|
-
const handle = this.getLemma()
|
|
673
|
+
const handle = (0, client_1.startBackgroundTrace)(this.getLemma(), {
|
|
676
674
|
name,
|
|
677
675
|
input: rootTraceInput(input),
|
|
678
676
|
metadata: {
|
|
@@ -767,8 +765,20 @@ class LemmaLangChainCallbackHandler {
|
|
|
767
765
|
});
|
|
768
766
|
}
|
|
769
767
|
async finalizeTrace(owningTraceId, stored) {
|
|
770
|
-
|
|
771
|
-
|
|
768
|
+
// A caller can reuse a root runId (config.runId) before this trace's
|
|
769
|
+
// delayed send runs; the newer trace then owns the key and its runs.
|
|
770
|
+
const ownsRuns = this.traces.get(owningTraceId) === stored;
|
|
771
|
+
if (ownsRuns)
|
|
772
|
+
this.traces.delete(owningTraceId);
|
|
773
|
+
if (!stored.ended && ownsRuns) {
|
|
774
|
+
// LangChain can report a failed run on the chain while a model call
|
|
775
|
+
// still in flight has reported nothing.
|
|
776
|
+
(0, error_message_1.failOpenGenerations)([...this.runs.values()]
|
|
777
|
+
.filter((run) => run.owningTraceId === owningTraceId && run.kind === "llm")
|
|
778
|
+
.map((run) => run.handle), stored.rootError, stored.latestEnd ?? new Date());
|
|
779
|
+
}
|
|
780
|
+
if (ownsRuns)
|
|
781
|
+
this.forgetTraceRuns(owningTraceId);
|
|
772
782
|
if (stored.ended)
|
|
773
783
|
return;
|
|
774
784
|
stored.ended = true;
|
|
@@ -779,42 +789,37 @@ class LemmaLangChainCallbackHandler {
|
|
|
779
789
|
endedAt,
|
|
780
790
|
durationMs: durationMs(startedAt, endedAt),
|
|
781
791
|
};
|
|
782
|
-
if (stored.rootError)
|
|
792
|
+
if (stored.rootError)
|
|
783
793
|
stored.handle.fail(stored.rootError);
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
}
|
|
795
|
-
const promise = stored.handle.end({
|
|
796
|
-
output: stored.rootOutput,
|
|
797
|
-
...timing,
|
|
794
|
+
const output = stored.rootError ? undefined : stored.rootOutput;
|
|
795
|
+
// Tracked so a flush or shutdown that overlaps this one waits for it.
|
|
796
|
+
const sent = stored.handle.end(output === undefined ? timing : { output, ...timing });
|
|
797
|
+
this.trackPending(sent);
|
|
798
|
+
await sent;
|
|
799
|
+
}
|
|
800
|
+
/** Send the partial trace of each root idle past `openTraceTtlMs`, and forget it. */
|
|
801
|
+
evictIdleTraces() {
|
|
802
|
+
this.idleTraces.sweep(this.traces, this.runs.values(), (rootRunId, stored) => {
|
|
803
|
+
void this.finalizeTrace(rootRunId, stored);
|
|
798
804
|
});
|
|
799
|
-
this.trackPending(promise);
|
|
800
|
-
await promise;
|
|
801
805
|
}
|
|
802
|
-
|
|
806
|
+
/**
|
|
807
|
+
* Send an owner's trace on a later macrotask and track it in `pending`.
|
|
808
|
+
* Callbacks never await delivery, and recordResult(invoke return) can still
|
|
809
|
+
* stamp usage onto generations whose callback event omitted it.
|
|
810
|
+
*/
|
|
811
|
+
maybeFinalizeOwner(run) {
|
|
803
812
|
if (!run.ownsTrace)
|
|
804
813
|
return;
|
|
805
814
|
const stored = this.traces.get(run.owningTraceId);
|
|
806
815
|
if (!stored || stored.ended)
|
|
807
816
|
return;
|
|
808
|
-
this.noteBounds(stored, run.startedAt, endedAt);
|
|
809
|
-
// Delay the HTTP send so recordResult(invoke return) can stamp usage
|
|
810
|
-
// onto generations whose callback event omitted it.
|
|
811
817
|
const promise = new Promise((resolve, reject) => {
|
|
812
818
|
(0, schedule_1.scheduleMacrotask)(() => {
|
|
813
819
|
this.finalizeTrace(run.owningTraceId, stored).then(resolve, reject);
|
|
814
820
|
});
|
|
815
821
|
});
|
|
816
822
|
this.trackPending(promise);
|
|
817
|
-
return promise;
|
|
818
823
|
}
|
|
819
824
|
/**
|
|
820
825
|
* Copy token usage from an `invoke` / chain result onto generation spans
|
|
@@ -833,6 +838,7 @@ class LemmaLangChainCallbackHandler {
|
|
|
833
838
|
return this.options.agentName ?? serializedName(serialized, fallback);
|
|
834
839
|
}
|
|
835
840
|
handleChainStart(serialized, inputs, runId, parentRunId, tags, metadata, runType, name) {
|
|
841
|
+
this.evictIdleTraces();
|
|
836
842
|
const startedAt = new Date();
|
|
837
843
|
const chainName = name ?? serializedName(serialized, "langchain-chain");
|
|
838
844
|
const parent = this.parentRun(parentRunId);
|
|
@@ -867,7 +873,7 @@ class LemmaLangChainCallbackHandler {
|
|
|
867
873
|
ownsTrace: false,
|
|
868
874
|
});
|
|
869
875
|
}
|
|
870
|
-
|
|
876
|
+
handleChainEnd(outputs, runId) {
|
|
871
877
|
const run = this.runs.get(runId);
|
|
872
878
|
if (!run)
|
|
873
879
|
return;
|
|
@@ -885,11 +891,9 @@ class LemmaLangChainCallbackHandler {
|
|
|
885
891
|
}
|
|
886
892
|
}
|
|
887
893
|
this.runs.delete(runId);
|
|
888
|
-
|
|
889
|
-
await this.finalizeTrace(run.owningTraceId, stored);
|
|
890
|
-
}
|
|
894
|
+
this.maybeFinalizeOwner(run);
|
|
891
895
|
}
|
|
892
|
-
|
|
896
|
+
handleChainError(error, runId) {
|
|
893
897
|
const run = this.runs.get(runId);
|
|
894
898
|
if (!run)
|
|
895
899
|
return;
|
|
@@ -909,11 +913,10 @@ class LemmaLangChainCallbackHandler {
|
|
|
909
913
|
}
|
|
910
914
|
}
|
|
911
915
|
this.runs.delete(runId);
|
|
912
|
-
|
|
913
|
-
await this.finalizeTrace(run.owningTraceId, stored);
|
|
914
|
-
}
|
|
916
|
+
this.maybeFinalizeOwner(run);
|
|
915
917
|
}
|
|
916
918
|
handleLLMStart(serialized, prompts, runId, parentRunId, extraParams, tags, metadata, _runName) {
|
|
919
|
+
this.evictIdleTraces();
|
|
917
920
|
const startedAt = new Date();
|
|
918
921
|
const attachment = this.resolveAttachment(runId, parentRunId, () => this.createOwnedTrace(runId, this.traceName(serialized, "langchain-llm"), prompts, "llm", metadata, tags));
|
|
919
922
|
// createOwnedTrace already registered the run when ownsTrace; update it.
|
|
@@ -946,6 +949,7 @@ class LemmaLangChainCallbackHandler {
|
|
|
946
949
|
});
|
|
947
950
|
}
|
|
948
951
|
handleChatModelStart(serialized, messages, runId, parentRunId, extraParams, tags, metadata, _runName) {
|
|
952
|
+
this.evictIdleTraces();
|
|
949
953
|
const startedAt = new Date();
|
|
950
954
|
const flatMessages = messages.flat();
|
|
951
955
|
const normalized = normalizeMessages(flatMessages);
|
|
@@ -978,17 +982,7 @@ class LemmaLangChainCallbackHandler {
|
|
|
978
982
|
ownsTrace: attachment.ownsTrace,
|
|
979
983
|
});
|
|
980
984
|
}
|
|
981
|
-
|
|
982
|
-
for (const run of this.runs.values()) {
|
|
983
|
-
if (run.ownsTrace &&
|
|
984
|
-
run.deferFinalize &&
|
|
985
|
-
run.owningTraceId === owningTraceId) {
|
|
986
|
-
return run;
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
return undefined;
|
|
990
|
-
}
|
|
991
|
-
async handleLLMEnd(output, runId) {
|
|
985
|
+
handleLLMEnd(output, runId) {
|
|
992
986
|
const run = this.runs.get(runId);
|
|
993
987
|
if (!run?.handle)
|
|
994
988
|
return;
|
|
@@ -996,7 +990,6 @@ class LemmaLangChainCallbackHandler {
|
|
|
996
990
|
const structured = llmStructuredOutput(output);
|
|
997
991
|
const outputMessages = llmOutputMessages(output);
|
|
998
992
|
const softError = (0, tool_result_1.toolResultError)(structured);
|
|
999
|
-
const awaitingTools = !softError && hasToolCalls(structured);
|
|
1000
993
|
const model = (0, model_1.pickGenerationModelIdentity)(output);
|
|
1001
994
|
this.endStoredRun(run, {
|
|
1002
995
|
output: softError ? undefined : structured,
|
|
@@ -1022,36 +1015,10 @@ class LemmaLangChainCallbackHandler {
|
|
|
1022
1015
|
this.noteRootOutput(stored, structured);
|
|
1023
1016
|
}
|
|
1024
1017
|
}
|
|
1025
|
-
if (awaitingTools) {
|
|
1026
|
-
// Keep the run stub so tool/follow-up generation callbacks can nest
|
|
1027
|
-
// under this generation (whether or not this run owns the root trace).
|
|
1028
|
-
if (run.ownsTrace)
|
|
1029
|
-
run.deferFinalize = true;
|
|
1030
|
-
return;
|
|
1031
|
-
}
|
|
1032
1018
|
this.runs.delete(runId);
|
|
1033
|
-
|
|
1034
|
-
void this.maybeFinalizeOwner(run, endedAt);
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
// Final answer generation under a deferred owned LLM — close that root.
|
|
1038
|
-
const deferred = this.deferredOwnerFor(run.owningTraceId);
|
|
1039
|
-
if (deferred) {
|
|
1040
|
-
this.runs.delete(deferred.rootRunId);
|
|
1041
|
-
void this.maybeFinalizeOwner(deferred, endedAt);
|
|
1042
|
-
}
|
|
1019
|
+
this.maybeFinalizeOwner(run);
|
|
1043
1020
|
}
|
|
1044
|
-
|
|
1045
|
-
const deferred = this.deferredOwnerFor(owningTraceId);
|
|
1046
|
-
if (!deferred)
|
|
1047
|
-
return;
|
|
1048
|
-
const stored = this.storedTrace(deferred.owningTraceId);
|
|
1049
|
-
if (stored && rootError)
|
|
1050
|
-
this.noteRootError(stored, rootError);
|
|
1051
|
-
this.runs.delete(deferred.rootRunId);
|
|
1052
|
-
void this.maybeFinalizeOwner(deferred, endedAt);
|
|
1053
|
-
}
|
|
1054
|
-
async handleLLMError(error, runId) {
|
|
1021
|
+
handleLLMError(error, runId) {
|
|
1055
1022
|
const run = this.runs.get(runId);
|
|
1056
1023
|
if (!run)
|
|
1057
1024
|
return;
|
|
@@ -1070,13 +1037,10 @@ class LemmaLangChainCallbackHandler {
|
|
|
1070
1037
|
this.noteRootError(stored, message);
|
|
1071
1038
|
}
|
|
1072
1039
|
this.runs.delete(runId);
|
|
1073
|
-
|
|
1074
|
-
void this.maybeFinalizeOwner(run, endedAt);
|
|
1075
|
-
return;
|
|
1076
|
-
}
|
|
1077
|
-
void this.finalizeDeferredOwner(run.owningTraceId, endedAt, message);
|
|
1040
|
+
this.maybeFinalizeOwner(run);
|
|
1078
1041
|
}
|
|
1079
1042
|
handleToolStart(serialized, input, runId, parentRunId, tags, metadata, _runName, _toolCallId) {
|
|
1043
|
+
this.evictIdleTraces();
|
|
1080
1044
|
const startedAt = new Date();
|
|
1081
1045
|
const attachment = this.resolveAttachment(runId, parentRunId, () => this.createOwnedTrace(runId, this.traceName(serialized, "langchain-tool"), input, "tool", metadata, tags));
|
|
1082
1046
|
if (attachment.ownsTrace) {
|
|
@@ -1104,7 +1068,7 @@ class LemmaLangChainCallbackHandler {
|
|
|
1104
1068
|
ownsTrace: attachment.ownsTrace,
|
|
1105
1069
|
});
|
|
1106
1070
|
}
|
|
1107
|
-
|
|
1071
|
+
handleToolEnd(output, runId) {
|
|
1108
1072
|
const run = this.runs.get(runId);
|
|
1109
1073
|
if (!run)
|
|
1110
1074
|
return;
|
|
@@ -1136,9 +1100,9 @@ class LemmaLangChainCallbackHandler {
|
|
|
1136
1100
|
}
|
|
1137
1101
|
}
|
|
1138
1102
|
this.runs.delete(runId);
|
|
1139
|
-
|
|
1103
|
+
this.maybeFinalizeOwner(run);
|
|
1140
1104
|
}
|
|
1141
|
-
|
|
1105
|
+
handleToolError(error, runId) {
|
|
1142
1106
|
const run = this.runs.get(runId);
|
|
1143
1107
|
if (!run)
|
|
1144
1108
|
return;
|
|
@@ -1157,13 +1121,10 @@ class LemmaLangChainCallbackHandler {
|
|
|
1157
1121
|
this.noteRootError(stored, message);
|
|
1158
1122
|
}
|
|
1159
1123
|
this.runs.delete(runId);
|
|
1160
|
-
|
|
1161
|
-
void this.maybeFinalizeOwner(run, endedAt);
|
|
1162
|
-
return;
|
|
1163
|
-
}
|
|
1164
|
-
void this.finalizeDeferredOwner(run.owningTraceId, endedAt, message);
|
|
1124
|
+
this.maybeFinalizeOwner(run);
|
|
1165
1125
|
}
|
|
1166
1126
|
handleRetrieverStart(serialized, query, runId, parentRunId, tags, metadata, _name) {
|
|
1127
|
+
this.evictIdleTraces();
|
|
1167
1128
|
const startedAt = new Date();
|
|
1168
1129
|
const attachment = this.resolveAttachment(runId, parentRunId, () => this.createOwnedTrace(runId, this.traceName(serialized, "langchain-retriever"), query, "retriever", metadata, tags));
|
|
1169
1130
|
if (attachment.ownsTrace) {
|
|
@@ -1189,7 +1150,7 @@ class LemmaLangChainCallbackHandler {
|
|
|
1189
1150
|
ownsTrace: attachment.ownsTrace,
|
|
1190
1151
|
});
|
|
1191
1152
|
}
|
|
1192
|
-
|
|
1153
|
+
handleRetrieverEnd(documents, runId) {
|
|
1193
1154
|
const run = this.runs.get(runId);
|
|
1194
1155
|
if (!run)
|
|
1195
1156
|
return;
|
|
@@ -1206,9 +1167,9 @@ class LemmaLangChainCallbackHandler {
|
|
|
1206
1167
|
this.noteRootOutput(stored, documents);
|
|
1207
1168
|
}
|
|
1208
1169
|
this.runs.delete(runId);
|
|
1209
|
-
|
|
1170
|
+
this.maybeFinalizeOwner(run);
|
|
1210
1171
|
}
|
|
1211
|
-
|
|
1172
|
+
handleRetrieverError(error, runId) {
|
|
1212
1173
|
const run = this.runs.get(runId);
|
|
1213
1174
|
if (!run)
|
|
1214
1175
|
return;
|
|
@@ -1227,18 +1188,22 @@ class LemmaLangChainCallbackHandler {
|
|
|
1227
1188
|
this.noteRootError(stored, message);
|
|
1228
1189
|
}
|
|
1229
1190
|
this.runs.delete(runId);
|
|
1230
|
-
|
|
1191
|
+
this.maybeFinalizeOwner(run);
|
|
1231
1192
|
}
|
|
1232
|
-
/**
|
|
1193
|
+
/**
|
|
1194
|
+
* Await delivery of every trace whose root run already ended. One handler
|
|
1195
|
+
* serves every concurrent run, so a trace whose root is still running stays
|
|
1196
|
+
* open; `shutdown()` sends those.
|
|
1197
|
+
*/
|
|
1233
1198
|
async flush() {
|
|
1199
|
+
await Promise.all(this.pending);
|
|
1200
|
+
}
|
|
1201
|
+
/** Finalize and send every trace, open ones included, and reset state. */
|
|
1202
|
+
async shutdown() {
|
|
1234
1203
|
await Promise.all([
|
|
1235
1204
|
...Array.from(this.traces.entries(), ([id, stored]) => this.finalizeTrace(id, stored)),
|
|
1236
1205
|
...Array.from(this.pending),
|
|
1237
1206
|
]);
|
|
1238
|
-
}
|
|
1239
|
-
/** Finalize open traces and reset integration state. */
|
|
1240
|
-
async shutdown() {
|
|
1241
|
-
await this.flush();
|
|
1242
1207
|
this.runs.clear();
|
|
1243
1208
|
this.traces.clear();
|
|
1244
1209
|
}
|