@mastra/code-sdk 1.12.1-alpha.0 → 1.12.1-alpha.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.
@@ -168,11 +168,18 @@ async function handleToolSuspended(state, connection, session, event) {
168
168
  const isSandboxAccess = toolName === "request_access" || typeof suspendPayload === "object" && suspendPayload !== null && "kind" in suspendPayload && suspendPayload.kind === "sandbox_access_request";
169
169
  if (isSandboxAccess || toolName === "submit_plan") {
170
170
  state.cancelSuspensions ??= /* @__PURE__ */ new Map();
171
- state.cancelSuspensions.set(toolCallId, () => session.resumeToolCall({
172
- toolCallId,
173
- resumeData: isSandboxAccess ? "No" : { action: "rejected" },
174
- resolveOnToolEnd: true
175
- }));
171
+ state.cancelSuspensions.set(toolCallId, async () => {
172
+ const address = session.suspensions.resolveAddress({
173
+ toolCallId,
174
+ runId: event.runId
175
+ });
176
+ if (!address) return;
177
+ await session.resumeToolCall({
178
+ address,
179
+ resumeData: isSandboxAccess ? "No" : { action: "rejected" },
180
+ resolveOnToolEnd: true
181
+ });
182
+ });
176
183
  }
177
184
  if (state.cancelled) {
178
185
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"event-mapper.js","names":[],"sources":["../../src/acp/event-mapper.ts"],"sourcesContent":["import type { SessionNotification, RequestPermissionRequest, AgentSideConnection } from '@agentclientprotocol/sdk';\nimport type { AgentControllerEvent, Session, TokenUsage } from '@mastra/core/agent-controller';\n\nlet autoApprove = false;\n\n/**\n * Enable or disable automatic tool approval (set via --dangerous-auto-approve CLI flag).\n */\nexport function setAutoApprove(value: boolean): void {\n autoApprove = value;\n}\n\n/**\n * Map a mastracode tool name to an ACP ToolKind.\n */\nfunction mapToolKind(\n toolName: string,\n): 'read' | 'edit' | 'delete' | 'move' | 'search' | 'execute' | 'think' | 'fetch' | 'other' {\n const name = toolName.toLowerCase();\n if (name.includes('edit') || name.includes('write') || name.includes('replace') || name.includes('patch'))\n return 'edit';\n if (name.includes('read') || name.includes('view') || name.includes('list') || name.includes('find')) return 'read';\n if (name.includes('delete') || name.includes('remove')) return 'delete';\n if (name.includes('search') || name.includes('grep') || name.includes('query')) return 'search';\n if (name.includes('execute') || name.includes('run') || name.includes('command') || name.includes('shell'))\n return 'execute';\n if (\n name.includes('fetch') ||\n name.includes('curl') ||\n name.includes('http') ||\n name.includes('browse') ||\n name.includes('navigate')\n )\n return 'fetch';\n if (name.includes('think') || name.includes('reason')) return 'think';\n return 'other';\n}\n\n/**\n * Accumulated state for an active prompt turn.\n */\nexport interface PromptState {\n sessionId: string;\n activeAssistantMessageId?: string;\n usage: TokenUsage;\n error?: Error;\n stopReason?: 'max_tokens' | 'refusal';\n finished?: boolean;\n cancelled?: boolean;\n suspended?: boolean;\n cancelSuspensions?: Map<string, () => Promise<void>>;\n resolve: (reason: 'complete' | 'aborted' | 'error' | 'suspended') => void;\n}\n\n/**\n * Translate an AgentControllerEvent into an ACP SessionNotification and send it\n * via the provided connection. Returns null for events that don't produce\n * a session update.\n */\nexport function handleAgentControllerEvent(\n event: AgentControllerEvent,\n state: PromptState | null,\n connection: AgentSideConnection,\n session: Session,\n): void {\n if (!state || state.finished) return;\n\n switch (event.type) {\n case 'agent_start':\n state.suspended = false;\n // Startup can arm its controller after cancel first called abort().\n if (state.cancelled && !state.cancelSuspensions?.size) session.completeDeferredAbort();\n break;\n\n case 'message_start': {\n if (event.message.role === 'assistant') {\n state.activeAssistantMessageId = event.message.id;\n break;\n }\n break;\n }\n\n case 'message_update':\n if (event.event.type === 'text-delta' && event.id === state.activeAssistantMessageId && event.event.delta) {\n sendUpdate(connection, state.sessionId, {\n sessionUpdate: 'agent_message_chunk',\n content: { type: 'text', text: event.event.delta },\n });\n }\n break;\n\n case 'message_end':\n if (event.id === state.activeAssistantMessageId) {\n state.activeAssistantMessageId = undefined;\n }\n break;\n\n case 'tool_start':\n sendUpdate(connection, state.sessionId, {\n sessionUpdate: 'tool_call',\n toolCallId: event.toolCallId,\n title: event.toolName,\n kind: mapToolKind(event.toolName),\n status: 'in_progress',\n rawInput: JSON.stringify(event.args),\n });\n break;\n\n case 'tool_end':\n sendUpdate(connection, state.sessionId, {\n sessionUpdate: 'tool_call_update',\n toolCallId: event.toolCallId,\n status: event.isError ? 'failed' : 'completed',\n rawOutput: typeof event.result === 'string' ? event.result : JSON.stringify(event.result),\n });\n break;\n\n case 'tool_approval_required':\n void handleToolApproval(state, connection, session, event).catch(err => {\n failTurn(state, session, err);\n });\n break;\n\n case 'tool_suspended':\n void handleToolSuspended(state, connection, session, event).catch(err => {\n failTurn(state, session, err);\n });\n break;\n\n case 'usage_update':\n accumulateUsage(state.usage, event.usage);\n break;\n\n case 'error':\n state.error = event.error;\n if (event.finishReason === 'length') state.stopReason = 'max_tokens';\n else if (event.finishReason === 'content-filter') state.stopReason = 'refusal';\n break;\n\n case 'agent_end':\n // A suspended run continues after the client answers the permission request.\n if (event.reason === 'suspended') {\n state.suspended = true;\n if (state.cancelled && !state.cancelSuspensions?.size) {\n session.stream.detach();\n state.resolve('aborted');\n }\n break;\n }\n state.finished = true;\n state.resolve(event.reason ?? 'complete');\n break;\n\n // Ignored in v1: om_*, subagent_*, workspace_*, task_updated, etc.\n default:\n break;\n }\n}\n\nfunction sendUpdate(connection: AgentSideConnection, sessionId: string, update: SessionNotification['update']): void {\n connection.sessionUpdate({ sessionId, update }).catch(err => {\n process.stderr.write(`[acp] sessionUpdate error: ${err}\\n`);\n });\n}\n\nasync function handleToolApproval(\n state: PromptState,\n connection: AgentSideConnection,\n session: Session,\n event: Extract<AgentControllerEvent, { type: 'tool_approval_required' }>,\n): Promise<void> {\n if (state.cancelled) {\n session.respondToToolApproval({ decision: 'decline', toolCallId: event.toolCallId });\n return;\n }\n // Auto-approve if --dangerous-auto-approve flag is set\n if (autoApprove) {\n session.respondToToolApproval({ decision: 'approve', toolCallId: event.toolCallId });\n return;\n }\n\n const req: RequestPermissionRequest = {\n sessionId: state.sessionId,\n toolCall: {\n toolCallId: event.toolCallId,\n title: event.toolName,\n rawInput: JSON.stringify(event.args),\n },\n options: [\n { optionId: 'approve', name: 'Allow', kind: 'allow_once' },\n { optionId: 'reject', name: 'Reject', kind: 'reject_once' },\n ],\n };\n\n try {\n const resp = await connection.requestPermission(req);\n if (state.finished || state.cancelled) return;\n if (resp.outcome.outcome === 'selected') {\n const decision = resp.outcome.optionId === 'approve' ? 'approve' : 'decline';\n session.respondToToolApproval({ decision, toolCallId: event.toolCallId });\n } else {\n session.respondToToolApproval({ decision: 'decline', toolCallId: event.toolCallId });\n }\n } catch (err) {\n if (state.finished || state.cancelled) return;\n process.stderr.write(`[acp] requestPermission error: ${err}\\n`);\n session.respondToToolApproval({ decision: 'decline', toolCallId: event.toolCallId });\n }\n}\n\nasync function handleToolSuspended(\n state: PromptState,\n connection: AgentSideConnection,\n session: Session,\n event: Extract<AgentControllerEvent, { type: 'tool_suspended' }>,\n): Promise<void> {\n const { toolCallId, toolName, args, suspendPayload } = event;\n\n const isSandboxAccess =\n toolName === 'request_access' ||\n (typeof suspendPayload === 'object' &&\n suspendPayload !== null &&\n 'kind' in suspendPayload &&\n suspendPayload.kind === 'sandbox_access_request');\n if (isSandboxAccess || toolName === 'submit_plan') {\n state.cancelSuspensions ??= new Map();\n state.cancelSuspensions.set(toolCallId, () =>\n session.resumeToolCall({\n toolCallId,\n resumeData: isSandboxAccess ? 'No' : { action: 'rejected' },\n resolveOnToolEnd: true,\n }),\n );\n }\n if (state.cancelled) {\n try {\n await state.cancelSuspensions?.get(toolCallId)?.();\n } finally {\n state.cancelSuspensions?.delete(toolCallId);\n if (!state.finished) {\n session.completeDeferredAbort();\n state.resolve('aborted');\n }\n }\n return;\n }\n if (isSandboxAccess) {\n let approved = autoApprove;\n if (!autoApprove) {\n try {\n const response = await connection.requestPermission({\n sessionId: state.sessionId,\n toolCall: { toolCallId, title: toolName, rawInput: JSON.stringify(args) },\n options: [\n { optionId: 'approve', name: 'Allow access', kind: 'allow_once' },\n { optionId: 'reject', name: 'Deny access', kind: 'reject_once' },\n ],\n });\n approved = response.outcome.outcome === 'selected' && response.outcome.optionId === 'approve';\n } catch {\n approved = false;\n }\n }\n if (state.finished || state.cancelled) return;\n state.cancelSuspensions?.delete(toolCallId);\n await session.respondToToolSuspension({ toolCallId, resumeData: approved ? 'Yes' : 'No' });\n return;\n }\n\n if (toolName === 'submit_plan') {\n // Request permission for plan approval\n const req: RequestPermissionRequest = {\n sessionId: state.sessionId,\n toolCall: {\n toolCallId,\n title: toolName,\n rawInput: JSON.stringify(args),\n },\n options: [\n { optionId: 'approve', name: 'Approve Plan', kind: 'allow_once' },\n { optionId: 'reject', name: 'Reject Plan', kind: 'reject_once' },\n ],\n };\n\n let action: 'approved' | 'rejected' = 'rejected';\n try {\n const resp = await connection.requestPermission(req);\n if (resp.outcome.outcome === 'selected' && resp.outcome.optionId === 'approve') action = 'approved';\n } catch {\n // A missing answer never grants permission.\n }\n if (state.finished || state.cancelled) return;\n state.cancelSuspensions?.delete(toolCallId);\n await session.respondToToolSuspension({ toolCallId, resumeData: { action } });\n return;\n }\n\n throw new Error(`Tool \"${toolName}\" requires an interaction that this ACP server does not support`);\n}\n\nfunction failTurn(state: PromptState, session: Session, error: unknown): void {\n if (state.finished || state.cancelled) return;\n state.error = error instanceof Error ? error : new Error(String(error));\n state.finished = true;\n state.resolve('error');\n session.abort();\n}\n\nfunction accumulateUsage(target: TokenUsage, usage: TokenUsage): void {\n target.promptTokens += usage.promptTokens;\n target.completionTokens += usage.completionTokens;\n target.totalTokens += usage.totalTokens;\n if (usage.reasoningTokens) target.reasoningTokens = (target.reasoningTokens ?? 0) + usage.reasoningTokens;\n if (usage.cachedInputTokens) target.cachedInputTokens = (target.cachedInputTokens ?? 0) + usage.cachedInputTokens;\n if (usage.cacheCreationInputTokens) {\n target.cacheCreationInputTokens = (target.cacheCreationInputTokens ?? 0) + usage.cacheCreationInputTokens;\n }\n}\n"],"mappings":";AAGA,IAAI,cAAc;;;;AAKlB,SAAgB,eAAe,OAAsB;CAC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U,MAAM;IAAe,MAAM;GAAc,CACjE;EACF;EAEA,IAAI,SAAkC;EACtC,IAAI;GACF,MAAM,OAAO,MAAM,WAAW,kBAAkB,GAAG;GACnD,IAAI,KAAK,QAAQ,YAAY,cAAc,KAAK,QAAQ,aAAa,WAAW,SAAS;EAC3F,QAAQ,CAER;EACA,IAAI,MAAM,YAAY,MAAM,WAAW;EACvC,MAAM,mBAAmB,OAAO,UAAU;EAC1C,MAAM,QAAQ,wBAAwB;GAAE;GAAY,YAAY,EAAE,OAAO;EAAE,CAAC;EAC5E;CACF;CAEA,MAAM,IAAI,MAAM,SAAS,SAAS,gEAAgE;AACpG;AAEA,SAAS,SAAS,OAAoB,SAAkB,OAAsB;CAC5E,IAAI,MAAM,YAAY,MAAM,WAAW;CACvC,MAAM,QAAQ,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;CACtE,MAAM,WAAW;CACjB,MAAM,QAAQ,OAAO;CACrB,QAAQ,MAAM;AAChB;AAEA,SAAS,gBAAgB,QAAoB,OAAyB;CACpE,OAAO,gBAAgB,MAAM;CAC7B,OAAO,oBAAoB,MAAM;CACjC,OAAO,eAAe,MAAM;CAC5B,IAAI,MAAM,iBAAiB,OAAO,mBAAmB,OAAO,mBAAmB,KAAK,MAAM;CAC1F,IAAI,MAAM,mBAAmB,OAAO,qBAAqB,OAAO,qBAAqB,KAAK,MAAM;CAChG,IAAI,MAAM,0BACR,OAAO,4BAA4B,OAAO,4BAA4B,KAAK,MAAM;AAErF"}
1
+ {"version":3,"file":"event-mapper.js","names":[],"sources":["../../src/acp/event-mapper.ts"],"sourcesContent":["import type { SessionNotification, RequestPermissionRequest, AgentSideConnection } from '@agentclientprotocol/sdk';\nimport type { AgentControllerEvent, Session, TokenUsage } from '@mastra/core/agent-controller';\n\nlet autoApprove = false;\n\n/**\n * Enable or disable automatic tool approval (set via --dangerous-auto-approve CLI flag).\n */\nexport function setAutoApprove(value: boolean): void {\n autoApprove = value;\n}\n\n/**\n * Map a mastracode tool name to an ACP ToolKind.\n */\nfunction mapToolKind(\n toolName: string,\n): 'read' | 'edit' | 'delete' | 'move' | 'search' | 'execute' | 'think' | 'fetch' | 'other' {\n const name = toolName.toLowerCase();\n if (name.includes('edit') || name.includes('write') || name.includes('replace') || name.includes('patch'))\n return 'edit';\n if (name.includes('read') || name.includes('view') || name.includes('list') || name.includes('find')) return 'read';\n if (name.includes('delete') || name.includes('remove')) return 'delete';\n if (name.includes('search') || name.includes('grep') || name.includes('query')) return 'search';\n if (name.includes('execute') || name.includes('run') || name.includes('command') || name.includes('shell'))\n return 'execute';\n if (\n name.includes('fetch') ||\n name.includes('curl') ||\n name.includes('http') ||\n name.includes('browse') ||\n name.includes('navigate')\n )\n return 'fetch';\n if (name.includes('think') || name.includes('reason')) return 'think';\n return 'other';\n}\n\n/**\n * Accumulated state for an active prompt turn.\n */\nexport interface PromptState {\n sessionId: string;\n activeAssistantMessageId?: string;\n usage: TokenUsage;\n error?: Error;\n stopReason?: 'max_tokens' | 'refusal';\n finished?: boolean;\n cancelled?: boolean;\n suspended?: boolean;\n cancelSuspensions?: Map<string, () => Promise<void>>;\n resolve: (reason: 'complete' | 'aborted' | 'error' | 'suspended') => void;\n}\n\n/**\n * Translate an AgentControllerEvent into an ACP SessionNotification and send it\n * via the provided connection. Returns null for events that don't produce\n * a session update.\n */\nexport function handleAgentControllerEvent(\n event: AgentControllerEvent,\n state: PromptState | null,\n connection: AgentSideConnection,\n session: Session,\n): void {\n if (!state || state.finished) return;\n\n switch (event.type) {\n case 'agent_start':\n state.suspended = false;\n // Startup can arm its controller after cancel first called abort().\n if (state.cancelled && !state.cancelSuspensions?.size) session.completeDeferredAbort();\n break;\n\n case 'message_start': {\n if (event.message.role === 'assistant') {\n state.activeAssistantMessageId = event.message.id;\n break;\n }\n break;\n }\n\n case 'message_update':\n if (event.event.type === 'text-delta' && event.id === state.activeAssistantMessageId && event.event.delta) {\n sendUpdate(connection, state.sessionId, {\n sessionUpdate: 'agent_message_chunk',\n content: { type: 'text', text: event.event.delta },\n });\n }\n break;\n\n case 'message_end':\n if (event.id === state.activeAssistantMessageId) {\n state.activeAssistantMessageId = undefined;\n }\n break;\n\n case 'tool_start':\n sendUpdate(connection, state.sessionId, {\n sessionUpdate: 'tool_call',\n toolCallId: event.toolCallId,\n title: event.toolName,\n kind: mapToolKind(event.toolName),\n status: 'in_progress',\n rawInput: JSON.stringify(event.args),\n });\n break;\n\n case 'tool_end':\n sendUpdate(connection, state.sessionId, {\n sessionUpdate: 'tool_call_update',\n toolCallId: event.toolCallId,\n status: event.isError ? 'failed' : 'completed',\n rawOutput: typeof event.result === 'string' ? event.result : JSON.stringify(event.result),\n });\n break;\n\n case 'tool_approval_required':\n void handleToolApproval(state, connection, session, event).catch(err => {\n failTurn(state, session, err);\n });\n break;\n\n case 'tool_suspended':\n void handleToolSuspended(state, connection, session, event).catch(err => {\n failTurn(state, session, err);\n });\n break;\n\n case 'usage_update':\n accumulateUsage(state.usage, event.usage);\n break;\n\n case 'error':\n state.error = event.error;\n if (event.finishReason === 'length') state.stopReason = 'max_tokens';\n else if (event.finishReason === 'content-filter') state.stopReason = 'refusal';\n break;\n\n case 'agent_end':\n // A suspended run continues after the client answers the permission request.\n if (event.reason === 'suspended') {\n state.suspended = true;\n if (state.cancelled && !state.cancelSuspensions?.size) {\n session.stream.detach();\n state.resolve('aborted');\n }\n break;\n }\n state.finished = true;\n state.resolve(event.reason ?? 'complete');\n break;\n\n // Ignored in v1: om_*, subagent_*, workspace_*, task_updated, etc.\n default:\n break;\n }\n}\n\nfunction sendUpdate(connection: AgentSideConnection, sessionId: string, update: SessionNotification['update']): void {\n connection.sessionUpdate({ sessionId, update }).catch(err => {\n process.stderr.write(`[acp] sessionUpdate error: ${err}\\n`);\n });\n}\n\nasync function handleToolApproval(\n state: PromptState,\n connection: AgentSideConnection,\n session: Session,\n event: Extract<AgentControllerEvent, { type: 'tool_approval_required' }>,\n): Promise<void> {\n if (state.cancelled) {\n session.respondToToolApproval({ decision: 'decline', toolCallId: event.toolCallId });\n return;\n }\n // Auto-approve if --dangerous-auto-approve flag is set\n if (autoApprove) {\n session.respondToToolApproval({ decision: 'approve', toolCallId: event.toolCallId });\n return;\n }\n\n const req: RequestPermissionRequest = {\n sessionId: state.sessionId,\n toolCall: {\n toolCallId: event.toolCallId,\n title: event.toolName,\n rawInput: JSON.stringify(event.args),\n },\n options: [\n { optionId: 'approve', name: 'Allow', kind: 'allow_once' },\n { optionId: 'reject', name: 'Reject', kind: 'reject_once' },\n ],\n };\n\n try {\n const resp = await connection.requestPermission(req);\n if (state.finished || state.cancelled) return;\n if (resp.outcome.outcome === 'selected') {\n const decision = resp.outcome.optionId === 'approve' ? 'approve' : 'decline';\n session.respondToToolApproval({ decision, toolCallId: event.toolCallId });\n } else {\n session.respondToToolApproval({ decision: 'decline', toolCallId: event.toolCallId });\n }\n } catch (err) {\n if (state.finished || state.cancelled) return;\n process.stderr.write(`[acp] requestPermission error: ${err}\\n`);\n session.respondToToolApproval({ decision: 'decline', toolCallId: event.toolCallId });\n }\n}\n\nasync function handleToolSuspended(\n state: PromptState,\n connection: AgentSideConnection,\n session: Session,\n event: Extract<AgentControllerEvent, { type: 'tool_suspended' }>,\n): Promise<void> {\n const { toolCallId, toolName, args, suspendPayload } = event;\n\n const isSandboxAccess =\n toolName === 'request_access' ||\n (typeof suspendPayload === 'object' &&\n suspendPayload !== null &&\n 'kind' in suspendPayload &&\n suspendPayload.kind === 'sandbox_access_request');\n if (isSandboxAccess || toolName === 'submit_plan') {\n state.cancelSuspensions ??= new Map();\n state.cancelSuspensions.set(toolCallId, async () => {\n const address = session.suspensions.resolveAddress({ toolCallId, runId: event.runId });\n if (!address) return;\n await session.resumeToolCall({\n address,\n resumeData: isSandboxAccess ? 'No' : { action: 'rejected' },\n resolveOnToolEnd: true,\n });\n });\n }\n if (state.cancelled) {\n try {\n await state.cancelSuspensions?.get(toolCallId)?.();\n } finally {\n state.cancelSuspensions?.delete(toolCallId);\n if (!state.finished) {\n session.completeDeferredAbort();\n state.resolve('aborted');\n }\n }\n return;\n }\n if (isSandboxAccess) {\n let approved = autoApprove;\n if (!autoApprove) {\n try {\n const response = await connection.requestPermission({\n sessionId: state.sessionId,\n toolCall: { toolCallId, title: toolName, rawInput: JSON.stringify(args) },\n options: [\n { optionId: 'approve', name: 'Allow access', kind: 'allow_once' },\n { optionId: 'reject', name: 'Deny access', kind: 'reject_once' },\n ],\n });\n approved = response.outcome.outcome === 'selected' && response.outcome.optionId === 'approve';\n } catch {\n approved = false;\n }\n }\n if (state.finished || state.cancelled) return;\n state.cancelSuspensions?.delete(toolCallId);\n await session.respondToToolSuspension({ toolCallId, resumeData: approved ? 'Yes' : 'No' });\n return;\n }\n\n if (toolName === 'submit_plan') {\n // Request permission for plan approval\n const req: RequestPermissionRequest = {\n sessionId: state.sessionId,\n toolCall: {\n toolCallId,\n title: toolName,\n rawInput: JSON.stringify(args),\n },\n options: [\n { optionId: 'approve', name: 'Approve Plan', kind: 'allow_once' },\n { optionId: 'reject', name: 'Reject Plan', kind: 'reject_once' },\n ],\n };\n\n let action: 'approved' | 'rejected' = 'rejected';\n try {\n const resp = await connection.requestPermission(req);\n if (resp.outcome.outcome === 'selected' && resp.outcome.optionId === 'approve') action = 'approved';\n } catch {\n // A missing answer never grants permission.\n }\n if (state.finished || state.cancelled) return;\n state.cancelSuspensions?.delete(toolCallId);\n await session.respondToToolSuspension({ toolCallId, resumeData: { action } });\n return;\n }\n\n throw new Error(`Tool \"${toolName}\" requires an interaction that this ACP server does not support`);\n}\n\nfunction failTurn(state: PromptState, session: Session, error: unknown): void {\n if (state.finished || state.cancelled) return;\n state.error = error instanceof Error ? error : new Error(String(error));\n state.finished = true;\n state.resolve('error');\n session.abort();\n}\n\nfunction accumulateUsage(target: TokenUsage, usage: TokenUsage): void {\n target.promptTokens += usage.promptTokens;\n target.completionTokens += usage.completionTokens;\n target.totalTokens += usage.totalTokens;\n if (usage.reasoningTokens) target.reasoningTokens = (target.reasoningTokens ?? 0) + usage.reasoningTokens;\n if (usage.cachedInputTokens) target.cachedInputTokens = (target.cachedInputTokens ?? 0) + usage.cachedInputTokens;\n if (usage.cacheCreationInputTokens) {\n target.cacheCreationInputTokens = (target.cacheCreationInputTokens ?? 0) + usage.cacheCreationInputTokens;\n }\n}\n"],"mappings":";AAGA,IAAI,cAAc;;;;AAKlB,SAAgB,eAAe,OAAsB;CACnD,cAAc;AAChB;;;;AAKA,SAAS,YACP,UAC0F;CAC1F,MAAM,OAAO,SAAS,YAAY;CAClC,IAAI,KAAK,SAAS,MAAM,KAAK,KAAK,SAAS,OAAO,KAAK,KAAK,SAAS,SAAS,KAAK,KAAK,SAAS,OAAO,GACtG,OAAO;CACT,IAAI,KAAK,SAAS,MAAM,KAAK,KAAK,SAAS,MAAM,KAAK,KAAK,SAAS,MAAM,KAAK,KAAK,SAAS,MAAM,GAAG,OAAO;CAC7G,IAAI,KAAK,SAAS,QAAQ,KAAK,KAAK,SAAS,QAAQ,GAAG,OAAO;CAC/D,IAAI,KAAK,SAAS,QAAQ,KAAK,KAAK,SAAS,MAAM,KAAK,KAAK,SAAS,OAAO,GAAG,OAAO;CACvF,IAAI,KAAK,SAAS,SAAS,KAAK,KAAK,SAAS,KAAK,KAAK,KAAK,SAAS,SAAS,KAAK,KAAK,SAAS,OAAO,GACvG,OAAO;CACT,IACE,KAAK,SAAS,OAAO,KACrB,KAAK,SAAS,MAAM,KACpB,KAAK,SAAS,MAAM,KACpB,KAAK,SAAS,QAAQ,KACtB,KAAK,SAAS,UAAU,GAExB,OAAO;CACT,IAAI,KAAK,SAAS,OAAO,KAAK,KAAK,SAAS,QAAQ,GAAG,OAAO;CAC9D,OAAO;AACT;;;;;;AAuBA,SAAgB,2BACd,OACA,OACA,YACA,SACM;CACN,IAAI,CAAC,SAAS,MAAM,UAAU;CAE9B,QAAQ,MAAM,MAAd;EACE,KAAK;GACH,MAAM,YAAY;GAElB,IAAI,MAAM,aAAa,CAAC,MAAM,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AqB,KAAK,MAAM;CAChG,IAAI,MAAM,0BACR,OAAO,4BAA4B,OAAO,4BAA4B,KAAK,MAAM;AAErF"}
@@ -14,15 +14,15 @@ export declare class LazyNotificationsStorage extends NotificationsStorage {
14
14
  private readonly storage;
15
15
  constructor(storage: MastraCompositeStore);
16
16
  private getNotificationsStorage;
17
- createNotification(input: CreateNotificationInput): Promise<import("@mastra/core/notifications").NotificationRecord>;
18
- listNotifications(input: ListNotificationsInput): Promise<import("@mastra/core/notifications").NotificationRecord[]>;
19
- listDueNotifications(input: ListDueNotificationsInput): Promise<import("@mastra/core/notifications").NotificationRecord[]>;
17
+ createNotification(input: CreateNotificationInput): Promise<import("@mastra/core/storage").NotificationRecord>;
18
+ listNotifications(input: ListNotificationsInput): Promise<import("@mastra/core/storage").NotificationRecord[]>;
19
+ listDueNotifications(input: ListDueNotificationsInput): Promise<import("@mastra/core/storage").NotificationRecord[]>;
20
20
  getNotification(input: {
21
21
  threadId: string;
22
22
  id: string;
23
- }): Promise<import("@mastra/core/notifications").NotificationRecord | null>;
24
- updateNotification(input: UpdateNotificationInput): Promise<import("@mastra/core/notifications").NotificationRecord>;
25
- updateNotificationsStatus(input: UpdateNotificationsStatusInput): Promise<import("@mastra/core/notifications").NotificationRecord[]>;
23
+ }): Promise<import("@mastra/core/storage").NotificationRecord | null>;
24
+ updateNotification(input: UpdateNotificationInput): Promise<import("@mastra/core/storage").NotificationRecord>;
25
+ updateNotificationsStatus(input: UpdateNotificationsStatusInput): Promise<import("@mastra/core/storage").NotificationRecord[]>;
26
26
  dangerouslyClearAll(): Promise<void>;
27
27
  }
28
28
  export type PostToolObserver = (context: ToolAfterHookContext) => void | Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/code-sdk",
3
- "version": "1.12.1-alpha.0",
3
+ "version": "1.12.1-alpha.2",
4
4
  "description": "Mastra Code SDK: the agent core behind Mastra Code (everything except the TUI) — build your own UIs and surfaces on top of it",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -63,19 +63,19 @@
63
63
  "yaml": "^2.7.1",
64
64
  "zod": "^4.6.4",
65
65
  "@mastra/agent-browser": "0.5.3",
66
+ "@mastra/core": "1.77.0-alpha.2",
66
67
  "@mastra/duckdb": "1.14.0",
67
68
  "@mastra/fastembed": "1.3.3-alpha.0",
69
+ "@mastra/mcp": "2.4.0-alpha.0",
68
70
  "@mastra/github-signals": "0.5.1",
69
71
  "@mastra/libsql": "1.26.1-alpha.0",
70
- "@mastra/mcp": "2.3.0",
71
- "@mastra/observability": "1.19.0",
72
- "@mastra/core": "1.77.0-alpha.0",
72
+ "@mastra/observability": "1.20.0-alpha.0",
73
73
  "@mastra/parallel": "0.1.2",
74
- "@mastra/memory": "1.37.1-alpha.0",
74
+ "@mastra/memory": "1.37.1-alpha.2",
75
75
  "@mastra/pg": "1.31.1-alpha.0",
76
- "@mastra/schema-compat": "1.3.13",
77
76
  "@mastra/stagehand": "0.3.5",
78
- "@mastra/tavily": "1.1.2"
77
+ "@mastra/tavily": "1.1.2",
78
+ "@mastra/schema-compat": "1.3.13"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@libsql/client": "^0.18.0",
@@ -87,8 +87,8 @@
87
87
  "typescript-eslint": "^8.57.0",
88
88
  "vitest": "4.1.11",
89
89
  "@internal/workspace-test-utils": "0.0.86",
90
- "@internal/lint": "0.0.142",
91
- "@internal/types-builder": "0.0.117"
90
+ "@internal/types-builder": "0.0.117",
91
+ "@internal/lint": "0.0.142"
92
92
  },
93
93
  "engines": {
94
94
  "node": ">=22.19.0"