@narumitw/pi-otel 0.55.1 → 0.55.2
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/CHANGELOG.md +8 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +2 -2
- package/dist/index.ts +3 -3
- package/dist/index.ts.map +2 -2
- package/package.json +2 -2
- package/src/pi-session.ts +3 -2
package/dist/index.ts
CHANGED
|
@@ -1322,7 +1322,7 @@ function createPiLangfuseSessionController(options) {
|
|
|
1322
1322
|
const recorder = activeRecorder();
|
|
1323
1323
|
if (!recorder) return;
|
|
1324
1324
|
lastSnapshot = contextSnapshot(ctx);
|
|
1325
|
-
ensureActiveRun(recorder, ctx, startRootTrace);
|
|
1325
|
+
ensureActiveRun(recorder, ctx, startRootTrace, lastSnapshot);
|
|
1326
1326
|
recorder.beginTurn(event.turnIndex);
|
|
1327
1327
|
});
|
|
1328
1328
|
pi.on("before_provider_request", (event, ctx) => {
|
|
@@ -1497,13 +1497,13 @@ function snapshotSessionOptions(options) {
|
|
|
1497
1497
|
...options.metadata ? { metadata: { ...options.metadata } } : {}
|
|
1498
1498
|
};
|
|
1499
1499
|
}
|
|
1500
|
-
function ensureActiveRun(recorder, ctx, startRootTrace) {
|
|
1500
|
+
function ensureActiveRun(recorder, ctx, startRootTrace, observedSnapshot) {
|
|
1501
1501
|
if (!recorder.hasActiveTrace()) {
|
|
1502
1502
|
startRootTrace((nextRequestId) => {
|
|
1503
1503
|
recorder.beginAgent({
|
|
1504
1504
|
prompt: "[automatic continuation]",
|
|
1505
1505
|
model: ctx.model ? { provider: ctx.model.provider, id: ctx.model.id, api: ctx.model.api } : void 0,
|
|
1506
|
-
snapshot: contextSnapshot(ctx),
|
|
1506
|
+
snapshot: observedSnapshot ?? contextSnapshot(ctx),
|
|
1507
1507
|
...nextRequestId ? { requestId: nextRequestId } : {}
|
|
1508
1508
|
});
|
|
1509
1509
|
});
|