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
5 changes: 5 additions & 0 deletions .changeset/ai-sdk-quality-pass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@gemstack/ai-sdk": patch
---

Quality pass for ai-sdk: rebrand the error/log message prefix from the migration leftover `[Rudder AI]` to `[ai-sdk]` (108 messages across 38 modules), matching the sibling packages' package-name prefix convention, and fix the "file an issue" URL in the Bedrock provider to point at `gemstack-land/gemstack`. No API or behavior change beyond the message text.
2 changes: 1 addition & 1 deletion packages/ai-sdk/src/agent-run-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export class CachedAgentRunStore implements AgentRunStore {
}
const adapter = mod.CacheRegistry?.get?.()
if (!adapter) {
throw new Error('[Rudder AI] CachedAgentRunStore needs a cache adapter. Install `@rudderjs/cache`, register a driver, or pass `{ cache }` explicitly.')
throw new Error('[ai-sdk] CachedAgentRunStore needs a cache adapter. Install `@rudderjs/cache`, register a driver, or pass `{ cache }` explicitly.')
}
this.resolvedCache = adapter
return adapter
Expand Down
22 changes: 11 additions & 11 deletions packages/ai-sdk/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ export abstract class Agent {
suspendable?: AsToolSuspendableOption
}): ServerToolBuilder<unknown, AgentResponse> {
if (options.suspendable && !options.streaming) {
throw new Error('[Rudder AI] asTool: `suspendable` requires `streaming: true` (or a projector). Silent suspend would leave the parent UI with no progress signal between sub-agent invocations.')
throw new Error('[ai-sdk] asTool: `suspendable` requires `streaming: true` (or a projector). Silent suspend would leave the parent UI with no progress signal between sub-agent invocations.')
}

const schema = options.inputSchema ?? z.object({ prompt: z.string() })
Expand Down Expand Up @@ -621,7 +621,7 @@ export abstract class Agent {
> {
const snapshot = await options.runStore.consume(subRunId)
if (!snapshot) {
throw new Error(`[Rudder AI] resumeAsTool: subRunId "${subRunId}" expired or never existed.`)
throw new Error(`[ai-sdk] resumeAsTool: subRunId "${subRunId}" expired or never existed.`)
}

const pauseKind: SubAgentPauseKind = snapshot.pauseKind ?? 'client_tool'
Expand All @@ -635,10 +635,10 @@ export abstract class Agent {
const seen = new Set<string>()
for (const r of clientToolResults) {
if (!pending.has(r.toolCallId)) {
throw new Error(`[Rudder AI] resumeAsTool: toolCallId "${r.toolCallId}" was not in the pending set.`)
throw new Error(`[ai-sdk] resumeAsTool: toolCallId "${r.toolCallId}" was not in the pending set.`)
}
if (seen.has(r.toolCallId)) {
throw new Error(`[Rudder AI] resumeAsTool: duplicate result for toolCallId "${r.toolCallId}".`)
throw new Error(`[ai-sdk] resumeAsTool: duplicate result for toolCallId "${r.toolCallId}".`)
}
seen.add(r.toolCallId)
}
Expand All @@ -656,22 +656,22 @@ export abstract class Agent {
// Approval-pause resume — clientToolResults must be empty; either an
// approval or a rejection must be supplied for the pending id.
if (clientToolResults.length > 0) {
throw new Error('[Rudder AI] resumeAsTool: snapshot.pauseKind === "approval" but clientToolResults was non-empty. Pass `approvedToolCallIds` or `rejectedToolCallIds` instead.')
throw new Error('[ai-sdk] resumeAsTool: snapshot.pauseKind === "approval" but clientToolResults was non-empty. Pass `approvedToolCallIds` or `rejectedToolCallIds` instead.')
}
const approved = options.approvedToolCallIds ?? []
const rejected = options.rejectedToolCallIds ?? []
for (const id of approved) {
if (!pending.has(id)) {
throw new Error(`[Rudder AI] resumeAsTool: approvedToolCallId "${id}" was not in the pending set.`)
throw new Error(`[ai-sdk] resumeAsTool: approvedToolCallId "${id}" was not in the pending set.`)
}
}
for (const id of rejected) {
if (!pending.has(id)) {
throw new Error(`[Rudder AI] resumeAsTool: rejectedToolCallId "${id}" was not in the pending set.`)
throw new Error(`[ai-sdk] resumeAsTool: rejectedToolCallId "${id}" was not in the pending set.`)
}
}
if (approved.length === 0 && rejected.length === 0) {
throw new Error('[Rudder AI] resumeAsTool: snapshot.pauseKind === "approval" requires `approvedToolCallIds` or `rejectedToolCallIds`.')
throw new Error('[ai-sdk] resumeAsTool: snapshot.pauseKind === "approval" requires `approvedToolCallIds` or `rejectedToolCallIds`.')
}

messages = [...snapshot.messages]
Expand Down Expand Up @@ -1008,7 +1008,7 @@ export class ConversableAgent {
private toSpec(): ConversationalSpec {
if (this._conversationId) return { user: this._userId ?? '', id: this._conversationId }
if (this._userId) return { user: this._userId }
throw new Error('[Rudder AI] ConversableAgent requires forUser() or continue() to be called before prompt().')
throw new Error('[ai-sdk] ConversableAgent requires forUser() or continue() to be called before prompt().')
}
}

Expand Down Expand Up @@ -1774,7 +1774,7 @@ function runAgentLoopStreaming(a: Agent, input: string, options?: AgentPromptOpt
}

if (r._pendingHandoff) {
throw new Error(`[Rudder AI] Exceeded max handoffs (${MAX_HANDOFFS}). Likely a cycle between agents.`)
throw new Error(`[ai-sdk] Exceeded max handoffs (${MAX_HANDOFFS}). Likely a cycle between agents.`)
}

finalResponse = handoffPath.length === 0
Expand All @@ -1784,7 +1784,7 @@ function runAgentLoopStreaming(a: Agent, input: string, options?: AgentPromptOpt
}

if (!finalResponse) {
throw new Error(`[Rudder AI] Exceeded max handoffs (${MAX_HANDOFFS}). Likely a cycle between agents.`)
throw new Error(`[ai-sdk] Exceeded max handoffs (${MAX_HANDOFFS}). Likely a cycle between agents.`)
}
resolveResponse(finalResponse)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ai-sdk/src/attachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class DocumentAttachment {
/** Create from a URL (fetches the content) */
static async fromUrl(url: string): Promise<DocumentAttachment> {
const res = await fetch(url)
if (!res.ok) throw new Error(`[Rudder AI] Failed to fetch document: ${res.status} ${url}`)
if (!res.ok) throw new Error(`[ai-sdk] Failed to fetch document: ${res.status} ${url}`)
const bytes = new Uint8Array(await res.arrayBuffer())
const mimeType = res.headers.get('content-type')?.split(';')[0] ?? 'application/octet-stream'
const name = url.split('/').pop()?.split('?')[0]
Expand Down Expand Up @@ -59,7 +59,7 @@ export class ImageAttachment {
/** Create from a URL (fetches the image) */
static async fromUrl(url: string): Promise<ImageAttachment> {
const res = await fetch(url)
if (!res.ok) throw new Error(`[Rudder AI] Failed to fetch image: ${res.status} ${url}`)
if (!res.ok) throw new Error(`[ai-sdk] Failed to fetch image: ${res.status} ${url}`)
const bytes = new Uint8Array(await res.arrayBuffer())
const mimeType = res.headers.get('content-type')?.split(';')[0] ?? 'image/png'
return new ImageAttachment(toBase64(bytes), mimeType)
Expand Down
4 changes: 2 additions & 2 deletions packages/ai-sdk/src/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class AudioGenerator {

if (!factory.createTts) {
throw new Error(
`[Rudder AI] Provider "${providerName}" does not support text-to-speech. ` +
`[ai-sdk] Provider "${providerName}" does not support text-to-speech. ` +
`Use a provider that implements createTts() (e.g. openai).`,
)
}
Expand Down Expand Up @@ -100,7 +100,7 @@ export class AudioGenerator {
return path
} catch {
throw new Error(
'[Rudder AI] @rudderjs/storage is required for AudioGenerator.store(). ' +
'[ai-sdk] @rudderjs/storage is required for AudioGenerator.store(). ' +
'Install it: pnpm add @rudderjs/storage',
)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ai-sdk/src/budget-orm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ export class BudgetUsageRecord extends Model {
export class OrmBudgetStorage implements BudgetStorage {
async checkAndDebit(opts: BudgetCheckOptions): Promise<BudgetCheckResult> {
if (!Number.isFinite(opts.cap) || opts.cap < 0) {
throw new Error(`[Rudder AI] BudgetStorage: cap must be a non-negative finite number, got ${opts.cap}`)
throw new Error(`[ai-sdk] BudgetStorage: cap must be a non-negative finite number, got ${opts.cap}`)
}
if (!Number.isFinite(opts.costUsd) || opts.costUsd < 0) {
throw new Error(`[Rudder AI] BudgetStorage: costUsd must be a non-negative finite number, got ${opts.costUsd}`)
throw new Error(`[ai-sdk] BudgetStorage: costUsd must be a non-negative finite number, got ${opts.costUsd}`)
}

const now = opts.now ?? new Date()
Expand Down
4 changes: 2 additions & 2 deletions packages/ai-sdk/src/budget/pricing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class UnknownModelPricingError extends Error {
const snapshotDate = sample ? (pricing[sample]?._snapshotDate ?? null) : null
const sampleSuffix = snapshotDate ? ` (catalog snapshot ${snapshotDate})` : ''
super(
`[Rudder AI] No pricing entry for model "${model}"${sampleSuffix}. ` +
`[ai-sdk] No pricing entry for model "${model}"${sampleSuffix}. ` +
`Either the model id is misspelled, or the catalog is stale — ` +
`add an override entry: \`pricing: { ...ModelPricing, "${model}": { inputPer1k, outputPer1k, _snapshotDate } }\`.`,
)
Expand All @@ -215,7 +215,7 @@ export class BudgetExceededError extends Error {

constructor(opts: { userId: string; period: 'daily' | 'monthly'; spent: number; cap: number }) {
super(
`[Rudder AI] ${opts.period} budget of $${opts.cap.toFixed(2)} exceeded for user ${opts.userId} ` +
`[ai-sdk] ${opts.period} budget of $${opts.cap.toFixed(2)} exceeded for user ${opts.userId} ` +
`(spent $${opts.spent.toFixed(4)}).`,
)
this.name = 'BudgetExceededError'
Expand Down
4 changes: 2 additions & 2 deletions packages/ai-sdk/src/commands/ai-eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export function parseArgs(args: string[]): AiEvalOptions {
if (VALUE_FLAGS.has(name)) {
const value = inline ?? args[i + 1]
if (!inline) i++ // consumed the next arg
if (!value) throw new Error(`[Rudder AI] ${name} requires a value`)
if (!value) throw new Error(`[ai-sdk] ${name} requires a value`)
if (name === '--html') opts.html = value
continue
}
Expand Down Expand Up @@ -404,7 +404,7 @@ function parsePattern(pattern: string): { root: string; suffix: string } {
}
if (!postfix.startsWith('*')) {
throw new Error(
`[Rudder AI] Unsupported eval pattern "${pattern}". ` +
`[ai-sdk] Unsupported eval pattern "${pattern}". ` +
`Expected <dir>/**/*<suffix> or *<suffix>.`,
)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ai-sdk/src/computer-use/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class ComputerUseProviderError extends Error {

constructor(model: string) {
super(
`[Rudder AI] computerUseTool is Anthropic-only in v1; got model "${model}". ` +
`[ai-sdk] computerUseTool is Anthropic-only in v1; got model "${model}". ` +
`Use an "anthropic/*" or "bedrock/<region.>?anthropic.*" model, or remove the tool.`,
)
this.name = 'ComputerUseProviderError'
Expand All @@ -50,7 +50,7 @@ export class ComputerUseLimitError extends Error {

constructor(maxActions: number) {
super(
`[Rudder AI] computerUseTool exceeded maxActions cap of ${maxActions}. ` +
`[ai-sdk] computerUseTool exceeded maxActions cap of ${maxActions}. ` +
`Bump the cap with computerUseTool({ page, maxActions: <n> }) if your agent legitimately needs more steps.`,
)
this.name = 'ComputerUseLimitError'
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-sdk/src/continuation-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class ContinuationValidationError extends Error {
readonly code: ContinuationRejectionCode
readonly index: number | undefined
constructor(result: ContinuationValidationResult) {
super(`[Rudder AI] Rejected continuation: ${result.reason ?? result.code ?? 'invalid'}`)
super(`[ai-sdk] Rejected continuation: ${result.reason ?? result.code ?? 'invalid'}`)
this.name = 'ContinuationValidationError'
this.code = result.code ?? 'not-a-prefix'
this.index = result.index
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-sdk/src/conversation-orm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ model AiConversationMessage {
// ─── Helpers ──────────────────────────────────────────────

function notFound(conversationId: string): Error {
return new Error(`[Rudder AI] Conversation "${conversationId}" not found.`)
return new Error(`[ai-sdk] Conversation "${conversationId}" not found.`)
}

function messageToRow(conversationId: string, position: number, m: AiMessage): Record<string, unknown> {
Expand Down
6 changes: 3 additions & 3 deletions packages/ai-sdk/src/conversation-persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async function preparePersistence(
convId = await store.create(undefined, { userId: spec.user, agent: agentKey })
}
} else {
throw new Error('[Rudder AI] ConversationalSpec must include either `user` or `id`.')
throw new Error('[ai-sdk] ConversationalSpec must include either `user` or `id`.')
}

// Snapshot the trusted baseline before any limit slice — the validation
Expand Down Expand Up @@ -169,7 +169,7 @@ export async function runWithPersistence(
inner: (effOptions: AgentPromptOptions | undefined) => Promise<AgentResponse>,
): Promise<AgentResponse> {
const store = storeLookup()
if (!store) throw new Error('[Rudder AI] No ConversationStore registered. Bind one via `setConversationStore()` or the `ai.conversations` DI key.')
if (!store) throw new Error('[ai-sdk] No ConversationStore registered. Bind one via `setConversationStore()` or the `ai.conversations` DI key.')

const ctx = await preparePersistence(spec, agentClassName, store, options?.history)
await runValidation(ctx, options)
Expand Down Expand Up @@ -201,7 +201,7 @@ export function runWithPersistenceStreaming(
async function* outer(): AsyncIterable<StreamChunk> {
const store = storeLookup()
if (!store) {
const err = new Error('[Rudder AI] No ConversationStore registered. Bind one via `setConversationStore()` or the `ai.conversations` DI key.')
const err = new Error('[ai-sdk] No ConversationStore registered. Bind one via `setConversationStore()` or the `ai.conversations` DI key.')
rejectResponse!(err)
throw err
}
Expand Down
6 changes: 3 additions & 3 deletions packages/ai-sdk/src/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ export class MemoryConversationStore implements ConversationStore {

async load(conversationId: string): Promise<AiMessage[]> {
const conv = this.conversations.get(conversationId)
if (!conv) throw new Error(`[Rudder AI] Conversation "${conversationId}" not found.`)
if (!conv) throw new Error(`[ai-sdk] Conversation "${conversationId}" not found.`)
return [...conv.messages]
}

async append(conversationId: string, messages: AiMessage[]): Promise<void> {
const conv = this.conversations.get(conversationId)
if (!conv) throw new Error(`[Rudder AI] Conversation "${conversationId}" not found.`)
if (!conv) throw new Error(`[ai-sdk] Conversation "${conversationId}" not found.`)
conv.messages.push(...messages)
conv.updatedAt = new Date()
}

async setTitle(conversationId: string, title: string): Promise<void> {
const conv = this.conversations.get(conversationId)
if (!conv) throw new Error(`[Rudder AI] Conversation "${conversationId}" not found.`)
if (!conv) throw new Error(`[ai-sdk] Conversation "${conversationId}" not found.`)
conv.title = title
}

Expand Down
2 changes: 1 addition & 1 deletion packages/ai-sdk/src/eval/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export async function readFixture(
const parsed = JSON.parse(raw) as EvalFixture
if (parsed.version !== 1) {
throw new Error(
`[Rudder AI] Fixture ${file} is version ${String(parsed.version)}; expected 1. ` +
`[ai-sdk] Fixture ${file} is version ${String(parsed.version)}; expected 1. ` +
`Re-record with \`pnpm rudder ai:eval --record\`.`,
)
}
Expand Down
6 changes: 3 additions & 3 deletions packages/ai-sdk/src/eval/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ export interface SuiteReport {
* footgun.
*/
export function evalSuite(name: string, spec: EvalSuiteSpec): EvalSuite {
if (!name) throw new Error('[Rudder AI] evalSuite() requires a name.')
if (!name) throw new Error('[ai-sdk] evalSuite() requires a name.')
if (!spec || typeof spec.agent !== 'function') {
throw new Error('[Rudder AI] evalSuite() requires { agent: () => Agent, cases: [...] }.')
throw new Error('[ai-sdk] evalSuite() requires { agent: () => Agent, cases: [...] }.')
}
if (!Array.isArray(spec.cases) || spec.cases.length === 0) {
throw new Error('[Rudder AI] evalSuite() requires at least one case.')
throw new Error('[ai-sdk] evalSuite() requires at least one case.')
}
return Object.freeze({ name, spec })
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-sdk/src/facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class AI {

if (!factory.createEmbedding) {
throw new Error(
`[Rudder AI] Provider "${providerName}" does not support embeddings. ` +
`[ai-sdk] Provider "${providerName}" does not support embeddings. ` +
`Use a provider that implements createEmbedding() (e.g. openai, google, mistral).`,
)
}
Expand Down
Loading
Loading