Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/scout-agent/lib/compaction.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import util from "node:util";
import {
APICallError,
type StreamTextTransform,
Expand Down Expand Up @@ -44,14 +45,19 @@ export function findAPICallError(error: unknown): APICallError | null {

/**
* Check if an error is an out-of-context error based on known patterns.
*
* TODO: the current patterns only really handle anthropic via the vercel
* gateway - we need to test with other providers.
*/
export function isOutOfContextError(error: unknown): boolean {
const apiError = findAPICallError(error);
if (!apiError) {
return false;
}
return OUT_OF_CONTEXT_PATTERNS.some((pattern) =>
pattern.test(apiError.message)
pattern.test(
apiError.responseBody ?? util.inspect(apiError, { depth: null })
)
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/scout-agent/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@blink-sdk/scout-agent",
"description": "A general-purpose AI agent with GitHub, Slack, web search, and compute capabilities built on Blink SDK.",
"version": "0.0.12",
"version": "0.0.13",
"type": "module",
"keywords": [
"blink",
Expand Down