@copilotkit/runtime
Version:
<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />
78 lines (77 loc) • 3.35 kB
text/typescript
import "reflect-metadata";
import { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest } from "./agent-runner.mjs";
import { Observable } from "rxjs";
import { BaseEvent, Message } from "@ag-ui/client";
//#region src/v2/runtime/runner/in-memory.d.ts
/**
* Lightweight thread summary returned by {@link InMemoryAgentRunner.listThreads}.
* Shape matches the Intelligence platform's ThreadRecord so the same HTTP
* response envelope can be used for both backends.
*/
interface InMemoryThread {
id: string;
name: string | null;
agentId: string;
organizationId: "";
createdById: "";
archived: false;
createdAt: string;
updatedAt: string;
}
declare class InMemoryAgentRunner extends AgentRunner {
run(request: AgentRunnerRunRequest): Observable<BaseEvent>;
connect(request: AgentRunnerConnectRequest): Observable<BaseEvent>;
isRunning(request: AgentRunnerIsRunningRequest): Promise<boolean>;
stop(request: AgentRunnerStopRequest): Promise<boolean | undefined>;
/**
* Returns a summary of every thread that has been run through this runner.
*
* This powers the local-dev fallback for `GET /threads` when the Intelligence
* platform is not configured. Each entry mirrors the shape of a platform
* `ThreadRecord` so the HTTP handler can use the same response envelope.
*/
listThreads(): InMemoryThread[];
/**
* Returns all messages for a thread, using the snapshot captured at the end
* of the most recent run.
*
* This powers the local-dev fallback for `GET /threads/:threadId/messages`
* when the Intelligence platform is not configured. The returned `Message[]`
* objects come directly from the ag-ui agent, so their shape is compatible
* with the Intelligence platform's `ThreadMessage` type.
*/
getThreadMessages(threadId: string): Message[];
/**
* Returns all AG-UI events for a thread, compacted across historic runs.
*
* Powers the local-dev fallback for `GET /threads/:threadId/events` when the
* Intelligence platform is not configured. The compaction logic matches
* the connection-replay path in {@link connect}, so the stream a
* late-joining inspector sees matches what this method returns.
*/
getThreadEvents(threadId: string): BaseEvent[];
/**
* Returns the agent state snapshot for a thread.
*
* Derived from the last `STATE_SNAPSHOT` in the compacted event stream. The
* AG-UI `compactEvents` helper consolidates STATE_DELTA events and produces
* a single trailing STATE_SNAPSHOT when state changes exist, so this is a
* faithful view of state at the end of the most recent run.
*
* Returns `null` when the thread has never emitted a STATE_SNAPSHOT.
*/
getThreadState(threadId: string): Record<string, unknown> | null;
/**
* Clears all in-memory thread history.
*
* Powers the local-dev fallback for `POST /threads/clear`, letting consumers
* (e.g. the demo's Clear button) reset to an empty thread list without
* restarting the runtime. Intentionally not exposed on the Intelligence
* platform path: there, thread history lives in a real database and must
* not be wiped this way.
*/
clearThreads(): void;
}
//#endregion
export { InMemoryAgentRunner, InMemoryThread };
//# sourceMappingURL=in-memory.d.mts.map