@posthog/ai 8.14.1 → 8.14.3

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.
Files changed (48) hide show
  1. package/README.md +35 -1
  2. package/dist/adk/index.cjs +16 -6
  3. package/dist/adk/index.cjs.map +1 -1
  4. package/dist/adk/index.mjs +16 -6
  5. package/dist/adk/index.mjs.map +1 -1
  6. package/dist/anthropic/index.cjs +156 -15
  7. package/dist/anthropic/index.cjs.map +1 -1
  8. package/dist/anthropic/index.d.ts +1 -0
  9. package/dist/anthropic/index.mjs +156 -15
  10. package/dist/anthropic/index.mjs.map +1 -1
  11. package/dist/claude-agent-sdk/index.cjs +111 -37
  12. package/dist/claude-agent-sdk/index.cjs.map +1 -1
  13. package/dist/claude-agent-sdk/index.mjs +111 -37
  14. package/dist/claude-agent-sdk/index.mjs.map +1 -1
  15. package/dist/gemini/index.cjs +175 -39
  16. package/dist/gemini/index.cjs.map +1 -1
  17. package/dist/gemini/index.d.ts +1 -1
  18. package/dist/gemini/index.mjs +175 -39
  19. package/dist/gemini/index.mjs.map +1 -1
  20. package/dist/index.cjs +15 -8
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.mjs +15 -8
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/langchain/index.cjs +15 -5
  25. package/dist/langchain/index.cjs.map +1 -1
  26. package/dist/langchain/index.mjs +15 -5
  27. package/dist/langchain/index.mjs.map +1 -1
  28. package/dist/langchain/middleware/index.cjs +15 -5
  29. package/dist/langchain/middleware/index.cjs.map +1 -1
  30. package/dist/langchain/middleware/index.mjs +15 -5
  31. package/dist/langchain/middleware/index.mjs.map +1 -1
  32. package/dist/openai/index.cjs +181 -21
  33. package/dist/openai/index.cjs.map +1 -1
  34. package/dist/openai/index.mjs +181 -21
  35. package/dist/openai/index.mjs.map +1 -1
  36. package/dist/openai-agents/index.cjs +15 -5
  37. package/dist/openai-agents/index.cjs.map +1 -1
  38. package/dist/openai-agents/index.mjs +15 -5
  39. package/dist/openai-agents/index.mjs.map +1 -1
  40. package/dist/otel/index.cjs +12 -3
  41. package/dist/otel/index.cjs.map +1 -1
  42. package/dist/otel/index.mjs +12 -3
  43. package/dist/otel/index.mjs.map +1 -1
  44. package/dist/vercel/index.cjs +15 -8
  45. package/dist/vercel/index.cjs.map +1 -1
  46. package/dist/vercel/index.mjs +15 -8
  47. package/dist/vercel/index.mjs.map +1 -1
  48. package/package.json +4 -4
@@ -167,17 +167,26 @@ var BinaryContentRedactor = class {
167
167
  this.visited = /* @__PURE__ */ new WeakSet();
168
168
  return this.walk(value, mediaType ? new MediaTypeContext(void 0, void 0, mediaType) : MediaTypeContext.EMPTY);
169
169
  }
170
+ /** Redact one leaf while a caller owns bounded, type-preserving traversal. @internal */
171
+ redactLeaf(value, context) {
172
+ return typeof value === "string" ? this.redactString(value, context) : this.placeholderFor(context.inferMediaType());
173
+ }
170
174
  walk(value, ctx) {
171
175
  if (value === null || value === void 0) return value;
172
- if (typeof value === "string") return this.redactString(value, ctx);
176
+ if (typeof value === "string") return this.redactLeaf(value, ctx);
173
177
  if (typeof value !== "object") return value;
174
- if (typeof Uint8Array !== "undefined" && value instanceof Uint8Array) return this.placeholderFor(ctx.inferMediaType());
178
+ if (typeof Uint8Array !== "undefined" && value instanceof Uint8Array) return this.redactLeaf(value, ctx);
175
179
  if (this.visited.has(value)) return null;
176
180
  this.visited.add(value);
177
181
  if (Array.isArray(value)) return value.map((item) => this.walk(item, ctx));
178
182
  const obj = value;
179
183
  const out = {};
180
- for (const k of Object.keys(obj)) out[k] = this.walk(obj[k], new MediaTypeContext(obj, k));
184
+ for (const k of Object.keys(obj)) Object.defineProperty(out, k, {
185
+ value: this.walk(obj[k], new MediaTypeContext(obj, k)),
186
+ enumerable: true,
187
+ writable: true,
188
+ configurable: true
189
+ });
181
190
  return out;
182
191
  }
183
192
  redactString(value, ctx) {
@@ -252,8 +261,9 @@ const getModelParams = (params, responseServiceTier) => {
252
261
  if (responseServiceTier != null) modelParams.service_tier = responseServiceTier;
253
262
  return modelParams;
254
263
  };
264
+ const isPrivacyModeEnabled = (client, privacyMode) => Boolean(client.privacy_mode || privacyMode);
255
265
  const withPrivacyMode = (client, privacyMode, input) => {
256
- return client.privacy_mode || privacyMode ? null : input;
266
+ return isPrivacyModeEnabled(client, privacyMode) ? null : input;
257
267
  };
258
268
  function sanitizeValues(obj) {
259
269
  if (obj === void 0 || obj === null) return obj;
@@ -265,7 +275,7 @@ function sanitizeValues(obj) {
265
275
  }
266
276
  //#endregion
267
277
  //#region package.json
268
- var version = "8.14.1";
278
+ var version = "8.14.3";
269
279
  //#endregion
270
280
  //#region src/serializeError.ts
271
281
  const DEFAULT_MAX_DEPTH = 3;