@smithers-orchestrator/observability 0.20.4 → 0.22.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithers-orchestrator/observability",
3
- "version": "0.20.4",
3
+ "version": "0.22.0",
4
4
  "description": "Concrete Smithers metrics, logging, tracing, and observability integrations",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -29,7 +29,7 @@
29
29
  "@effect/platform": "^0.96.0",
30
30
  "@effect/platform-bun": "^0.89.0",
31
31
  "effect": "^3.21.1",
32
- "@smithers-orchestrator/agents": "0.20.4"
32
+ "@smithers-orchestrator/agents": "0.22.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/bun": "latest",
@@ -11,5 +11,12 @@ import { mergeCorrelationContext } from "./mergeCorrelationContext.js";
11
11
  */
12
12
  export function withCorrelationContext(effect, patch) {
13
13
  const next = mergeCorrelationContext(correlationStorage.getStore(), patch);
14
- return next ? effect.pipe(Effect.locally(correlationContextFiberRef, next)) : effect;
14
+ if (!next)
15
+ return effect;
16
+ const located = effect.pipe(Effect.locally(correlationContextFiberRef, next));
17
+ return Effect.acquireUseRelease(Effect.sync(() => {
18
+ const previous = correlationStorage.getStore();
19
+ correlationStorage.enterWith(next);
20
+ return previous;
21
+ }), () => located, (previous) => Effect.sync(() => correlationStorage.enterWith(previous)));
15
22
  }
@@ -1,6 +1,6 @@
1
1
  import { readFile, readdir, stat } from "node:fs/promises";
2
2
  import { homedir } from "node:os";
3
- import { join } from "node:path";
3
+ import { basename, join } from "node:path";
4
4
 
5
5
  /**
6
6
  * @param {string} dir
@@ -111,7 +111,7 @@ export async function resolveClaudeSessionFile(agent, cwd, sessionId) {
111
111
  if (info.isFile()) return direct;
112
112
  } catch {}
113
113
  const files = await listJsonlFiles(root);
114
- const match = files.find((file) => file.endsWith(`/${sessionId}.jsonl`));
114
+ const match = files.find((file) => basename(file) === `${sessionId}.jsonl`);
115
115
  if (match) return match;
116
116
  }
117
117
  return null;
@@ -124,8 +124,13 @@ export async function resolveClaudeSessionFile(agent, cwd, sessionId) {
124
124
  * @returns {Promise<string | null>}
125
125
  */
126
126
  export async function resolveCodexSessionFile(agent, cwd, startedAtMs) {
127
- const day = new Date(startedAtMs);
128
- const dayRoots = buildCodexSessionRoots(agent).map((root) => join(root, String(day.getUTCFullYear()), String(day.getUTCMonth() + 1).padStart(2, "0"), String(day.getUTCDate()).padStart(2, "0")));
127
+ const dayFolders = new Set();
128
+ for (const offset of [-1, 0, 1]) {
129
+ const day = new Date(startedAtMs + offset * 24 * 60 * 60 * 1000);
130
+ dayFolders.add(join(String(day.getUTCFullYear()), String(day.getUTCMonth() + 1).padStart(2, "0"), String(day.getUTCDate()).padStart(2, "0")));
131
+ dayFolders.add(join(String(day.getFullYear()), String(day.getMonth() + 1).padStart(2, "0"), String(day.getDate()).padStart(2, "0")));
132
+ }
133
+ const dayRoots = buildCodexSessionRoots(agent).flatMap((root) => [...dayFolders].map((folder) => join(root, folder)));
129
134
  const candidates = (await Promise.all(dayRoots.map((root) => listJsonlFiles(root)))).flat();
130
135
  /** @type {{ file: string; delta: number } | null} */
131
136
  let best = null;
@@ -363,7 +363,7 @@ export function normalizeStructuredEventForFamily(agentFamily, parsed, rawType)
363
363
  const normalized = normalizeClaudeStructuredEvent(parsed, rawType);
364
364
  if (normalized) return normalized;
365
365
  }
366
- if (agentFamily === "gemini") {
366
+ if (agentFamily === "gemini" || agentFamily === "antigravity") {
367
367
  const normalized = normalizeGeminiStructuredEvent(parsed, rawType);
368
368
  if (normalized) return normalized;
369
369
  }
package/src/agentTrace.ts CHANGED
@@ -2,6 +2,7 @@ export type AgentFamily =
2
2
  | "pi"
3
3
  | "codex"
4
4
  | "claude-code"
5
+ | "antigravity"
5
6
  | "gemini"
6
7
  | "kimi"
7
8
  | "openai"
@@ -44,6 +44,19 @@ export const agentTraceCapabilities = {
44
44
  rawStderrDiagnostics: true,
45
45
  persistedSessionArtifact: false,
46
46
  },
47
+ antigravity: {
48
+ sessionMetadata: false,
49
+ assistantTextDeltas: false,
50
+ visibleThinkingDeltas: false,
51
+ finalAssistantMessage: true,
52
+ toolExecutionStart: false,
53
+ toolExecutionUpdate: false,
54
+ toolExecutionEnd: false,
55
+ retryEvents: false,
56
+ compactionEvents: false,
57
+ rawStderrDiagnostics: true,
58
+ persistedSessionArtifact: false,
59
+ },
47
60
  gemini: {
48
61
  sessionMetadata: false,
49
62
  assistantTextDeltas: false,
@@ -5,14 +5,38 @@ import { getCurrentCorrelationContext as getCoreCurrentCorrelationContext, merge
5
5
 
6
6
  export { correlationContextFiberRef, correlationContextToLogAnnotations, CorrelationContextLive, CorrelationContextService, getCurrentCorrelationContext, getCurrentCorrelationContextEffect, mergeCorrelationContext, runWithCorrelationContext, withCorrelationContext, withCurrentCorrelationContext, } from "./_coreCorrelation/index.js";
7
7
  /**
8
+ * Temporary compatibility shim for legacy, non-Effect callers.
9
+ *
10
+ * Unlike the FiberRef-based core implementation
11
+ * ({@link import("./_coreCorrelation/updateCurrentCorrelationContext.js").updateCurrentCorrelationContext}),
12
+ * which returns an Effect and sets a fresh merged context on the
13
+ * `correlationContextFiberRef`, this shim runs synchronously and applies the
14
+ * patch by **mutating the current context object in place** via
15
+ * `Object.assign(current, next)`. Any references already holding the current
16
+ * context object will observe the mutation. This in-place semantics is
17
+ * intentional and exists only to preserve behavior for callers that captured a
18
+ * context reference before the Effect-based API existed.
19
+ *
20
+ * If there is no current context, the patch is a no-op (nothing is created).
21
+ *
22
+ * @deprecated Prefer the Effect-returning
23
+ * `updateCurrentCorrelationContext` from
24
+ * `@smithers-orchestrator/observability` (the `_coreCorrelation` version),
25
+ * which does not mutate shared state. This shim will be removed once legacy
26
+ * callers migrate.
27
+ *
8
28
  * @param {CorrelationPatch} patch
29
+ * @returns {void}
9
30
  */
10
31
  export function updateCurrentCorrelationContext(patch) {
11
32
  const current = getCoreCurrentCorrelationContext();
12
33
  if (!current)
13
34
  return;
14
- // TODO: replace this compatibility shim once legacy callers adopt the
15
- // Effect-returning updateCurrentCorrelationContext from @smithers-orchestrator/observability.
35
+ // Compatibility shim: mutate the current context in place rather than
36
+ // setting a new FiberRef value. See the JSDoc above — this preserves
37
+ // behavior for legacy callers and is intentional, not a bug. Remove once
38
+ // those callers adopt the Effect-returning core
39
+ // updateCurrentCorrelationContext.
16
40
  const next = mergeCoreCorrelationContext(current, patch);
17
41
  if (!next)
18
42
  return;
@@ -12,6 +12,7 @@ export function detectAgentFamily(agent) {
12
12
  const name = constructorName && constructorName !== "object"
13
13
  ? `${constructorName} ${idName}`
14
14
  : idName;
15
+ if (name.includes("antigravity") || name.includes("agy")) return "antigravity";
15
16
  if (name.includes("codex")) return "codex";
16
17
  if (name.includes("claude")) return "claude-code";
17
18
  if (name.includes("gemini")) return "gemini";
package/src/index.d.ts CHANGED
@@ -342,6 +342,7 @@ type SmithersEvent$2 = {
342
342
  nodeId: string;
343
343
  iteration: number;
344
344
  attempt: number;
345
+ toolCallId: string;
345
346
  toolName: string;
346
347
  seq: number;
347
348
  timestampMs: number;
@@ -351,6 +352,7 @@ type SmithersEvent$2 = {
351
352
  nodeId: string;
352
353
  iteration: number;
353
354
  attempt: number;
355
+ toolCallId: string;
354
356
  toolName: string;
355
357
  seq: number;
356
358
  status: "success" | "error";
@@ -37,7 +37,7 @@ export function resolveAgentTraceCapabilities(agentFamily, captureMode) {
37
37
  toolExecutionEnd: captureMode === "cli-json-stream",
38
38
  };
39
39
  }
40
- if (agentFamily === "gemini") {
40
+ if (agentFamily === "gemini" || agentFamily === "antigravity") {
41
41
  return {
42
42
  ...base,
43
43
  assistantTextDeltas: captureMode === "cli-json-stream",