import type { RequestContext } from '@mastra/core/di'; import type { RouteResponse } from '../route-types.generated.js'; import type { ClientOptions, UpdateMemoryThreadParams, ListMemoryThreadMessagesParams, ListMemoryThreadMessagesResponse, CloneMemoryThreadParams, CloneMemoryThreadResponse, TransferMemoryThreadParams } from '../types.js'; import { BaseResource } from './base.js'; /** * Serializes the message-listing filters both memory message routes accept. The network route * takes the same filters under a different path, so the two callers share one serializer. */ export declare const memoryMessagesQuery: ({ agentId, resourceId, page, perPage, orderBy, filter, include, includeSystemReminders, }: ListMemoryThreadMessagesParams) => URLSearchParams; /** * MemoryThread resource for interacting with memory threads. * * `agentId` is optional for read operations (`get`, `listMessages`) — when omitted the server * falls back to the global storage. It is required by the server for write operations * (`update`, `delete`, `deleteMessages`, `clone`) because the server needs to resolve which * agent's memory pipeline to invoke. Pass `agentId` either on the constructor (via * `MastraClient.getMemoryThread({ threadId, agentId })`) or on the per-method params. */ export declare class MemoryThread extends BaseResource { private threadId; private agentId?; constructor(options: ClientOptions, threadId: string, agentId?: string | undefined); /** * Builds the query string for agentId (if provided) */ private getAgentIdQueryParam; /** * Resolves the agentId to use for a write request. Prefers the per-call value, falls back * to the constructor value, and throws if neither is set. */ private requireAgentId; /** * Retrieves the memory thread details * @param requestContext - Optional request context to pass as query parameter * @returns Promise containing thread details including title and metadata */ get(requestContext?: RequestContext | Record): Promise>; /** * Updates the memory thread properties * @param params - Update parameters including title, metadata, and optional request context. * `agentId` is required by the server; pass it here if not supplied on the constructor. * @returns Promise containing updated thread details */ update(params: UpdateMemoryThreadParams): Promise>; /** * Deletes the memory thread * @param opts - Optional `agentId` (required by the server when not supplied on the constructor) * and request context. * @returns Promise containing deletion result */ delete(opts?: { agentId?: string; requestContext?: RequestContext | Record; }): Promise>; /** * Retrieves paginated messages associated with the thread with filtering and ordering options * @param params - Pagination parameters including page, perPage, orderBy, filter, include options, and request context * @returns Promise containing paginated thread messages with pagination metadata (total, page, perPage, hasMore) */ listMessages(params?: ListMemoryThreadMessagesParams & { requestContext?: RequestContext | Record; }): Promise; /** * Deletes one or more messages from the thread * @param messageIds - Can be a single message ID (string), array of message IDs, * message object with id property, or array of message objects * @param opts - Optional `agentId` (required by the server when not supplied on the constructor) * and request context. For backwards compatibility a `RequestContext` may also be * passed directly as the second argument. * @returns Promise containing deletion result */ deleteMessages(messageIds: string | string[] | { id: string; } | { id: string; }[], opts?: { agentId?: string; requestContext?: RequestContext | Record; } | RequestContext | Record): Promise>; /** * Clones the thread with all its messages to a new thread * @param params - Clone parameters including optional new thread ID, title, metadata, and message filters. * `agentId` is required by the server; pass it here if not supplied on the constructor. * @returns Promise containing the cloned thread and copied messages */ clone(params?: CloneMemoryThreadParams): Promise; /** * Transfers ownership of the thread (and all of its messages) to a different resource. * * This is a privileged operation: the server rejects it when the caller is resource-scoped * (i.e. a per-user/tenant context). Unlike `update`, it does not reset the thread's `createdAt`. * @param params - Transfer parameters including the target `resourceId`, optional `agentId`, and request context. * @returns Promise containing the transferred thread with its new `resourceId` */ transfer(params: TransferMemoryThreadParams): Promise>; } //# sourceMappingURL=memory-thread.d.ts.map