@narumitw/pi-otel 0.55.0 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narumitw/pi-otel",
3
- "version": "0.55.0",
3
+ "version": "0.55.2",
4
4
  "description": "Pi extension that exports agent, model, and tool traces to OpenTelemetry collectors or Langfuse.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -64,16 +64,16 @@
64
64
  }
65
65
  },
66
66
  "devDependencies": {
67
- "@earendil-works/pi-coding-agent": "1.5.0",
68
- "@earendil-works/pi-durable": "1.5.0",
69
- "@earendil-works/chord": "1.5.0",
67
+ "@earendil-works/pi-coding-agent": "1.6.0",
68
+ "@earendil-works/pi-durable": "1.6.0",
69
+ "@earendil-works/chord": "1.6.0",
70
70
  "@types/node": "26.6.6",
71
71
  "protobufjs": "7.6.5",
72
72
  "typescript": "7.0.2",
73
73
  "esbuild": "0.28.2"
74
74
  },
75
75
  "dependencies": {
76
- "@narumitw/pi-tui-kit": "^0.70.0",
76
+ "@narumitw/pi-tui-kit": "^0.71.0",
77
77
  "@opentelemetry/api": "^1.10.0",
78
78
  "@opentelemetry/exporter-trace-otlp-http": "^0.301.2",
79
79
  "@opentelemetry/otlp-exporter-base": "^0.301.2",
@@ -17,7 +17,7 @@ import {
17
17
 
18
18
  export interface DurableLive {
19
19
  run?: { taskId: TaskId; inputs: readonly SubmissionId[]; afterRun: boolean };
20
- tools: readonly { taskId?: TaskId; callId: string; name: string; status: "pending" | "running" | "done" }[];
20
+ tools: readonly { taskId?: TaskId; callId: string; name: string }[];
21
21
  }
22
22
  export interface DurableSnapshot {
23
23
  entries: readonly EntryRecord[];
@@ -49,11 +49,10 @@ function liveProjection(live: LiveState = {}): DurableLive {
49
49
  ...(live.run
50
50
  ? { run: { taskId: live.run.taskId, inputs: live.run.inputs, afterRun: live.run.afterRun !== undefined } }
51
51
  : {}),
52
- tools: [...(live.tools ?? []), ...(live.nestedTools ?? [])].map(({ taskId, callId, name, status }) => ({
52
+ tools: [...(live.tools ?? []), ...(live.nestedTools ?? [])].map(({ taskId, callId, name }) => ({
53
53
  taskId,
54
54
  callId,
55
55
  name,
56
- status,
57
56
  })),
58
57
  };
59
58
  }
package/src/durable.ts CHANGED
@@ -1,5 +1,4 @@
1
- import type { Context } from "@earendil-works/chord";
2
- import { awaitWithContext, withCancel } from "@earendil-works/chord/context";
1
+ import { awaitWithContext, type Context, withCancel } from "@earendil-works/chord/context";
3
2
  import type {
4
3
  CommitObservation,
5
4
  ConversationId,
package/src/pi-session.ts CHANGED
@@ -311,7 +311,7 @@ export function createPiLangfuseSessionController(
311
311
  const recorder = activeRecorder();
312
312
  if (!recorder) return;
313
313
  lastSnapshot = contextSnapshot(ctx);
314
- ensureActiveRun(recorder, ctx, startRootTrace);
314
+ ensureActiveRun(recorder, ctx, startRootTrace, lastSnapshot);
315
315
  recorder.beginTurn(event.turnIndex);
316
316
  });
317
317
 
@@ -520,13 +520,14 @@ function ensureActiveRun(
520
520
  recorder: TraceRecorder,
521
521
  ctx: ExtensionContext,
522
522
  startRootTrace: (start: (nextRequestId: string | undefined) => void) => void,
523
+ observedSnapshot?: ContextSnapshot,
523
524
  ): void {
524
525
  if (!recorder.hasActiveTrace()) {
525
526
  startRootTrace((nextRequestId) => {
526
527
  recorder.beginAgent({
527
528
  prompt: "[automatic continuation]",
528
529
  model: ctx.model ? { provider: ctx.model.provider, id: ctx.model.id, api: ctx.model.api } : undefined,
529
- snapshot: contextSnapshot(ctx),
530
+ snapshot: observedSnapshot ?? contextSnapshot(ctx),
530
531
  ...(nextRequestId ? { requestId: nextRequestId } : {}),
531
532
  });
532
533
  });