retrace-sdk 0.2.1 → 0.2.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/README.md CHANGED
@@ -101,6 +101,10 @@ configure({ apiKey: "rt_live_...", sampleRate: 0.1 }); // Record 10% of traces
101
101
 
102
102
  ## Changelog
103
103
 
104
+ ### 0.2.2
105
+
106
+ - **Fixed** — OpenAI interceptor no longer creates dummy client instance to find prototype
107
+
104
108
  ### 0.2.1
105
109
 
106
110
  - **Offline buffer** — stores up to 1000 messages when WebSocket disconnects, flushes on reconnect
@@ -40,13 +40,13 @@ export function installOpenAIInterceptor(onSpan) {
40
40
  const mod = openaiMod;
41
41
  const proto = mod?.OpenAI?.Chat?.Completions?.prototype || mod?.default?.Chat?.Completions?.prototype;
42
42
  if (!proto?.create) {
43
- // Try alternative path
43
+ // Try accessing prototype chain without instantiation
44
44
  const OpenAI = mod?.OpenAI || mod?.default;
45
- if (OpenAI) {
46
- const instance = Object.getPrototypeOf(new OpenAI({ apiKey: "dummy" }).chat.completions);
47
- if (instance?.create) {
48
- originalCreate = instance.create;
49
- instance.create = createPatchedCreate();
45
+ if (OpenAI?.prototype?.chat) {
46
+ const chatProto = Object.getPrototypeOf(Object.getPrototypeOf(OpenAI.prototype.chat)?.completions || {});
47
+ if (chatProto?.create) {
48
+ originalCreate = chatProto.create;
49
+ chatProto.create = createPatchedCreate();
50
50
  installed = true;
51
51
  }
52
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "retrace-sdk",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "The execution replay engine for AI agents. Record, replay, fork, and share agent executions.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",