@posthog/ai 8.11.2 → 8.12.1
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 +24 -0
- package/dist/adk/index.cjs +1 -1
- package/dist/adk/index.cjs.map +1 -1
- package/dist/adk/index.mjs +1 -1
- package/dist/adk/index.mjs.map +1 -1
- package/dist/anthropic/index.cjs +1 -1
- package/dist/anthropic/index.cjs.map +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/anthropic/index.mjs.map +1 -1
- package/dist/claude-agent-sdk/index.cjs +1142 -0
- package/dist/claude-agent-sdk/index.cjs.map +1 -0
- package/dist/claude-agent-sdk/index.d.ts +148 -0
- package/dist/claude-agent-sdk/index.mjs +1139 -0
- package/dist/claude-agent-sdk/index.mjs.map +1 -0
- package/dist/gemini/index.cjs +1 -1
- package/dist/gemini/index.cjs.map +1 -1
- package/dist/gemini/index.mjs +1 -1
- package/dist/gemini/index.mjs.map +1 -1
- package/dist/index.cjs +11 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.mjs +11 -7
- package/dist/index.mjs.map +1 -1
- package/dist/langchain/index.cjs +1 -1
- package/dist/langchain/index.cjs.map +1 -1
- package/dist/langchain/index.mjs +1 -1
- package/dist/langchain/index.mjs.map +1 -1
- package/dist/langchain/middleware/index.cjs +1 -1
- package/dist/langchain/middleware/index.cjs.map +1 -1
- package/dist/langchain/middleware/index.mjs +1 -1
- package/dist/langchain/middleware/index.mjs.map +1 -1
- package/dist/openai/index.cjs +1 -1
- package/dist/openai/index.cjs.map +1 -1
- package/dist/openai/index.mjs +1 -1
- package/dist/openai/index.mjs.map +1 -1
- package/dist/openai-agents/index.cjs +4 -4
- package/dist/openai-agents/index.cjs.map +1 -1
- package/dist/openai-agents/index.mjs +4 -4
- package/dist/openai-agents/index.mjs.map +1 -1
- package/dist/vercel/index.cjs +4 -4
- package/dist/vercel/index.cjs.map +1 -1
- package/dist/vercel/index.mjs +4 -4
- package/dist/vercel/index.mjs.map +1 -1
- package/package.json +11 -1
package/dist/index.d.ts
CHANGED
|
@@ -192,9 +192,12 @@ declare class Prompts {
|
|
|
192
192
|
* with many prompts can call this once per cache cycle instead of making one
|
|
193
193
|
* `get()` request per prompt.
|
|
194
194
|
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
195
|
+
* Unlike `get()`, there is no `fallback` option, so callers should handle
|
|
196
|
+
* the error themselves.
|
|
197
|
+
*
|
|
198
|
+
* @throws {Error} When the request fails, when the response is malformed,
|
|
199
|
+
* or when the server does not support fetching prompts by label on the list
|
|
200
|
+
* endpoint (PostHog releases from before September 2026).
|
|
198
201
|
*/
|
|
199
202
|
getAll(options: {
|
|
200
203
|
label: string;
|
package/dist/index.mjs
CHANGED
|
@@ -294,13 +294,13 @@ function toSafeString(input) {
|
|
|
294
294
|
return "";
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
|
-
const truncate = (input, client) => {
|
|
297
|
+
const truncate = (input, client, maxBytes = MAX_OUTPUT_SIZE) => {
|
|
298
298
|
const str = toSafeString(input);
|
|
299
299
|
if (str === "") return "";
|
|
300
300
|
if (isFullAiCaptureEnabled(client)) return str;
|
|
301
301
|
const buffer = sharedTextEncoder.encode(str);
|
|
302
|
-
if (buffer.length <=
|
|
303
|
-
const truncatedBuffer = buffer.slice(0,
|
|
302
|
+
if (buffer.length <= maxBytes) return sharedTextDecoder.decode(buffer);
|
|
303
|
+
const truncatedBuffer = buffer.slice(0, maxBytes);
|
|
304
304
|
let truncatedStr = sharedTextDecoder.decode(truncatedBuffer);
|
|
305
305
|
if (truncatedStr.endsWith("�")) truncatedStr = truncatedStr.slice(0, -1);
|
|
306
306
|
return `${truncatedStr}... [truncated]`;
|
|
@@ -395,7 +395,7 @@ function sanitizeValues(obj) {
|
|
|
395
395
|
}
|
|
396
396
|
//#endregion
|
|
397
397
|
//#region package.json
|
|
398
|
-
var version = "8.
|
|
398
|
+
var version = "8.12.1";
|
|
399
399
|
//#endregion
|
|
400
400
|
//#region src/serializeError.ts
|
|
401
401
|
const DEFAULT_MAX_DEPTH = 3;
|
|
@@ -1264,9 +1264,12 @@ var Prompts = class {
|
|
|
1264
1264
|
* with many prompts can call this once per cache cycle instead of making one
|
|
1265
1265
|
* `get()` request per prompt.
|
|
1266
1266
|
*
|
|
1267
|
-
*
|
|
1268
|
-
*
|
|
1269
|
-
*
|
|
1267
|
+
* Unlike `get()`, there is no `fallback` option, so callers should handle
|
|
1268
|
+
* the error themselves.
|
|
1269
|
+
*
|
|
1270
|
+
* @throws {Error} When the request fails, when the response is malformed,
|
|
1271
|
+
* or when the server does not support fetching prompts by label on the list
|
|
1272
|
+
* endpoint (PostHog releases from before September 2026).
|
|
1270
1273
|
*/
|
|
1271
1274
|
async getAll(options) {
|
|
1272
1275
|
const label = options.label;
|
|
@@ -1283,6 +1286,7 @@ var Prompts = class {
|
|
|
1283
1286
|
}
|
|
1284
1287
|
resolvedRows.push(row);
|
|
1285
1288
|
}
|
|
1289
|
+
if (rows.length > 0 && resolvedRows.length === 0) throw new Error(`[PostHog Prompts] The server returned prompts, but none resolve label "${label}". It may not support fetching prompts by label on the list endpoint yet. Upgrade PostHog, or fetch prompts one by one with get().`);
|
|
1286
1290
|
const now = Date.now();
|
|
1287
1291
|
const results = /* @__PURE__ */ new Map();
|
|
1288
1292
|
for (const row of resolvedRows) {
|