Skip to content

The open-source agent harness - the runtime layer that turns an LLM into a working agent.

Implement redis request reply (#8)

Srajan Asthanafded06a1734a
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 53be442d6..d806aa848 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -52,6 +52,7 @@ jobs:
timeout-minutes: 20
permissions:
contents: read
+ pull-requests: read
services:
postgres:
diff --git a/docker-compose.yml b/docker-compose.yml
index 4fef38d53..a74ae98bf 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -15,6 +15,19 @@ services:
retries: 10
restart: unless-stopped
+ # Shared by all server replicas: carries executor peering (cross-replica
+ # turn cancel via request-reply).
+ redis:
+ image: redis:7-alpine
+ ports:
+ - '${REDIS_PORT:-6379}:6379'
+ healthcheck:
+ test: ['CMD', 'redis-cli', 'ping']
+ interval: 5s
+ timeout: 3s
+ retries: 5
+ restart: unless-stopped
+
server:
build:
context: .
@@ -27,6 +40,7 @@ services:
PORT: 8790
# Compose network hostname; credentials still come from env_file.
POSTGRES_HOST: postgres
+ REDIS_URL: redis://redis:6379
# Environment variables (MODEL_API_KEY, POSTGRES_*, etc.) are read from this file.
# Copy packages/server/.env.example to packages/server/.env and fill it in.
env_file:
@@ -39,6 +53,8 @@ services:
depends_on:
postgres:
condition: service_healthy
+ redis:
+ condition: service_healthy
# Probes existing GET / (plain text OK!); node is already in the image.
healthcheck:
test:
diff --git a/packages/harness/package.json b/packages/harness/package.json
index d4d977eb8..b3ae3cc09 100644
--- a/packages/harness/package.json
+++ b/packages/harness/package.json
@@ -25,6 +25,11 @@
"require": "./dist/agent-session/index.js",
"default": "./dist/agent-session/index.mjs"
},
+ "./request-reply": {
+ "types": "./dist/request-reply/index.d.ts",
+ "require": "./dist/request-reply/index.js",
+ "default": "./dist/request-reply/index.mjs"
+ },
"./*.mjs": {
"types": "./dist/*.d.ts",
"default": "./dist/*.mjs"
@@ -69,7 +74,11 @@
"zod": "^3.24.3",
"zod-to-json-schema": "^3.25.1"
},
+ "peerDependencies": {
+ "redis": "^5.10.0"
+ },
"devDependencies": {
+ "redis": "^5.10.0",
"@swc/core": "^1.11.0",
"@swc/jest": "^0.2.37",
"@types/jest": "^29.5.14",
diff --git a/packages/harness/scripts/check-dist.mjs b/packages/harness/scripts/check-dist.mjs
index 44e08fccb..e3282c5ee 100644
--- a/packages/harness/scripts/check-dist.mjs
+++ b/packages/harness/scripts/check-dist.mjs
@@ -13,6 +13,7 @@ const modulePaths = [
'dist/index',
'dist/core/index',
'dist/agent-session/index',
+ 'dist/request-reply/index',
// Deep paths: one class module, one dropped-from-the-barrel internals module.
'dist/core/sandbox/Sandbox',
'dist/core/runtime/contextUtils',
diff --git a/packages/harness/src/agent-session/SessionHandle.ts b/packages/harness/src/agent-session/SessionHandle.ts
index 591a3e252..d83b75e95 100644
--- a/packages/harness/src/agent-session/SessionHandle.ts
+++ b/packages/harness/src/agent-session/SessionHandle.ts
@@ -1,7 +1,6 @@
/**
* Bound session handle: starts turns via {@link SessionHandle.createTurn}.
*/
-import { ulid } from 'ulid';
import { newEventId } from '../core/events/schema';
import type { AgentDefinition } from '../core/runtime/AgentDefinition';
import { AgentThread } from '../core/runtime/AgentThread';
@@ -164,6 +163,7 @@ export class SessionHandle<
* (must exist). Concurrent `'auto'` forks both succeed.
*/
async createTurn(input: {
+ turn_id: string;
input?: TurnInputItem[] | undefined;
/** 'auto'/omitted → session.last_turn_id; null → new root; id → fork from that turn. */
previous_turn_id?: string | null | undefined;
@@ -233,7 +233,7 @@ export class SessionHandle<
const sendBatch = toSendBatch(input.input);
const new_context_appends = await collectContextAppends(orchestrator.send(sendBatch));
- const turnId = ulid().toLowerCase();
+ const turnId = input.turn_id;
const now = new Date().toISOString();
const new_threads: NewThreadInit[] = [];
diff --git a/packages/harness/src/request-reply/client.ts b/packages/harness/src/request-reply/client.ts
new file mode 100644
index 000000000..213d4d76c
--- /dev/null
+++ b/packages/harness/src/request-reply/client.ts
@@ -0,0 +1,90 @@
+import { randomUUID } from 'node:crypto';
+import { performance } from 'node:perf_hooks';
+import type { RedisClientType } from 'redis';
+import { NoResponderError, RequestTimeoutError } from './errors';
+import type { JSONReply, JSONValue, PublishedRequest, RequestEnvelope } from './types';
+import { jsonReplySchema } from './types';
+import { heartbeatKey, replyKey, requestChannel, sleep } from './utils';
+
+export interface SendRequestOptions {
+ /** Max time to wait for a reply after the request is published (ms). */
+ replyTimeoutMs: number;
+ /** Sleep between poll attempts when the reply is not yet present (ms). */
+ pollIntervalMs: number;
+}
+
+const DEFAULT_REPLY_TIMEOUT_MS = 60_000;
+const DEFAULT_POLL_INTERVAL_MS = 500;
+
+function resolveSendRequestOptions(options: Partial<SendRequestOptions> | undefined): SendRequestOptions {
+ return {
+ replyTimeoutMs: options?.replyTimeoutMs ?? DEFAULT_REPLY_TIMEOUT_MS,
+ pollIntervalMs: options?.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS,
+ };
+}
+
+function parseReplyPayload(raw: string) {
+ const parsed: unknown = JSON.parse(raw);
+ return jsonReplySchema.parse(parsed);
+}
+
+async function getDelReply(redisClient: RedisClientType, rKey: string): Promise<JSONReply | null> {
+ const raw = await redisClient.getDel(rKey);
+ if (raw === null) {
+ return null;
+ }
+ return parseReplyPayload(raw);
+}
+
+/**
+ * Publishes the request (JSON) on the worker channel, then polls the reply key with GETDEL
+ * (see https://redis.io/docs/latest/commands/getdel/ ) until a result arrives or the wait
+ * budget is exceeded.
+ */
+export async function redisRequest<T extends JSONValue>({
+ redis: redisClient,
+ executorId,
+ path,
+ request,
+ options,
+}: {
+ redis: RedisClientType;
+ executorId: string;
+ path: string;
+ request: RequestEnvelope<T>;
+ options?: Partial<SendRequestOptions> | undefined;
+}): Promise<JSONReply> {
+ const { replyTimeoutMs, pollIntervalMs } = resolveSendRequestOptions(options);
+ const aliveK = heartbeatKey(executorId);
+ if ((await redisClient.exists(aliveK)) === 0) {
+ throw new NoResponderError(executorId);
+ }
+
+ const requestId = randomUUID();
+ const rKey = replyKey(requestId);
+ const payload: PublishedRequest = {
+ replyKey: rKey,
+ path,
+ body: request.body,
+ headers: request.headers,
+ };
+ const serializedPayload = JSON.stringify(payload);
+ const subscriberCount = await redisClient.publish(requestChannel(executorId), serializedPayload);
+ if (subscriberCount === 0) {
+ throw new NoResponderError(executorId, 'No executor received the published request');
+ }
+
+ const replyDeadline = performance.now() + replyTimeoutMs;
+ // Give the executor a moment to process before the first poll.
+ await sleep(Math.min(200, replyTimeoutMs));
+ for (;;) {
+ const replyPayload = await getDelReply(redisClient, rKey);
+ if (replyPayload) {
+ return replyPayload;
+ }
+ if (performance.now() >= replyDeadline) {
+ throw new RequestTimeoutError(replyTimeoutMs);
+ }
+ await sleep(pollIntervalMs);
+ }
+}
diff --git a/packages/harness/src/request-reply/errors.ts b/packages/harness/src/request-reply/errors.ts
new file mode 100644
index 000000000..05229d549
--- /dev/null
+++ b/packages/harness/src/request-reply/errors.ts
@@ -0,0 +1,39 @@
+/** The target executor's heartbeat is missing or nobody is subscribed (map to HTTP 412). */
+export class NoResponderError extends Error {
+ readonly code = 'NO_RESPONDER' as const;
+ constructor(
+ readonly executorId: string,
+ readonly detail = 'heartbeat not present',
+ ) {
+ super(`No responder for executor: ${executorId} (${detail}).`);
+ this.name = 'NoResponderError';
+ Object.setPrototypeOf(this, new.target.prototype);
+ }
+}
+
+/** No reply arrived within the wait budget (map to HTTP 424). */
+export class RequestTimeoutError extends Error {
+ readonly code = 'REQUEST_TIMEOUT' as const;
+ readonly timeoutMs: number;
+ constructor(timeoutMs: number) {
+ super(`Request timed out after ${String(timeoutMs)}ms`);
+ this.name = 'RequestTimeoutError';
+ this.timeoutMs = timeoutMs;
+ Object.setPrototypeOf(this, new.target.prototype);
+ }
+}
+
+/**
+ * Thrown by route handlers (or the router itself) to reply with a specific
+ * status; the executor converts it to a JSONReply instead of a blanket 500.
+ */
+export class ReplyError extends Error {
+ readonly code = 'REPLY_ERROR' as const;
+ readonly status: number;
+ constructor(status: number, message: string) {
+ super(message);
+ this.name = 'ReplyError';
+ this.status = status;
+ Object.setPrototypeOf(this, new.target.prototype);
+ }
+}
diff --git a/packages/harness/src/request-reply/executor.ts b/packages/harness/src/request-reply/executor.ts
new file mode 100644
index 000000000..76b057dd3
--- /dev/null
+++ b/packages/harness/src/request-reply/executor.ts
@@ -0,0 +1,285 @@
+import { randomUUID } from 'node:crypto';
+import type { RedisClientType } from 'redis';
+import type { Logger } from 'winston';
+import { ReplyError } from './errors';
+import type { JSONReply, RequestHandler } from './types';
+import { publishedRequestSchema } from './types';
+import { heartbeatKey, requestChannel } from './utils';
+
+export interface RunExecutorOptions {
+ /** How often to refresh the heartbeat key (ms). */
+ heartbeatIntervalMs: number;
+ /** TTL for the reply value so abandoned keys are reclaimed (ms). */
+ replyTtlMs: number;
+}
+
+const DEFAULT_HEARTBEAT_INTERVAL_MS = 5_000;
+const DEFAULT_REPLY_TTL_MS = 120_000;
+
+function resolveRunExecutorOptions(options: Partial<RunExecutorOptions> | undefined): RunExecutorOptions {
+ return {
+ heartbeatIntervalMs: options?.heartbeatIntervalMs ?? DEFAULT_HEARTBEAT_INTERVAL_MS,
+ replyTtlMs: options?.replyTtlMs ?? DEFAULT_REPLY_TTL_MS,
+ };
+}
+
+/** Observability hook for subscriber errors, failed SUBSCRIBEs, and malformed messages. */
+export type RequestReplyErrorHandler = (err: Error, context: { executorId: string; channel: string }) => void;
+
+/**
+ * Serving side of the request-reply transport: parses and validates each
+ * published message, dispatches it to the request handler, writes the
+ * JSONReply to the request's reply key, and refreshes the heartbeat key while
+ * subscribed.
+ *
+ * Connection lifecycle stays with the caller: both clients are supplied
+ * connected and are never closed here. `subscriberClient` is the connection to
+ * SUBSCRIBE on — a `duplicate()` for standalone Redis, or the shared client
+ * for Sentinel — and must have a reconnect strategy so a failed connect
+ * self-heals (the executor re-subscribes on every `ready`).
+ */
+export class RequestReplyExecutor {
+ readonly executorId: string;
+ /** `rr:req:<executorId>` — the channel this executor subscribes to. */
+ readonly channel: string;
+ private readonly redis: RedisClientType;
+ private readonly subscriberClient: RedisClientType;
+ private readonly logger: Logger;
+ private readonly heartbeatIntervalMs: number;
+ private readonly heartbeatTtlMs: number;
+ private readonly replyTtlMs: number;
+ private readonly heartbeatKey: string;
+ private readonly requestHandler: RequestHandler;
+ private readonly onError: RequestReplyErrorHandler | undefined;
+ /** Stable reference so node-redis dedupes the listener across re-subscribes. */
+ private readonly subscribeListener = (message: string): void => {
+ this.onMessage(message);
+ };
+
+ private closed = false;
+ private initialized = false;
+ private runningRequests = new Map<string, Promise<void>>();
+ private heartbeatTimer: ReturnType<typeof setInterval> | null = null;
+
+ constructor({
+ executorId,
+ redis,
+ subscriberClient,
+ requestHandler,
+ onError,
+ logger,
+ options,
+ }: {
+ executorId: string;
+ /** Connected command client, used only for SET (reply + heartbeat). Caller owns its lifecycle. */
+ redis: RedisClientType;
+ /** Connected client to SUBSCRIBE on (duplicate or Sentinel). Caller owns its lifecycle. */
+ subscriberClient: RedisClientType;
+ requestHandler: RequestHandler;
+ onError?: RequestReplyErrorHandler | undefined;
+ logger: Logger;
+ options?: Partial<RunExecutorOptions> | undefined;
+ }) {
+ const { heartbeatIntervalMs, replyTtlMs } = resolveRunExecutorOptions(options);
+ this.executorId = executorId;
+ this.redis = redis;
+ this.subscriberClient = subscriberClient;
+ this.logger = logger;
+ this.replyTtlMs = replyTtlMs;
+ this.requestHandler = requestHandler;
+ this.onError = onError;
+ this.channel = requestChannel(executorId);
+ this.heartbeatKey = heartbeatKey(executorId);
+ this.heartbeatIntervalMs = heartbeatIntervalMs;
+ this.heartbeatTtlMs = Math.ceil(this.heartbeatIntervalMs * 1.5);
+ }
+
+ async init(): Promise<void> {
+ if (this.closed || this.initialized) {
+ return;
+ }
+ this.initialized = true;
+
+ this.subscriberClient.on('error', (err: Error) => {
+ this.logger.error('[RequestReplyExecutor] Subscriber error', {
+ executorId: this.executorId,
+ error: err.message,
+ });
+ this.onError?.(err, { executorId: this.executorId, channel: this.channel });
+ this.stopHeartbeat();
+ });
+ this.subscriberClient.on('end', () => {
+ this.logger.warn('[RequestReplyExecutor] Subscriber connection ended', { executorId: this.executorId });
+ this.stopHeartbeat();
+ });
+ // ready fires on the first connect and every reconnect; re-subscribing is
+ // safe because node-redis dedupes the stable listener.
+ this.subscriberClient.on('ready', () => {
+ void this.setupSubscriber();
+ });
+
+ // On stable connections we won't get another ready event — if the caller
+ // already connected the client, subscribe now.
+ if (this.subscriberClient.isReady) {
+ await this.setupSubscriber();
+ }
+ }
+
+ private async setupSubscriber(): Promise<void> {
+ if (this.closed) {
+ return;
+ }
+ try {
+ await this.subscriberClient.subscribe(this.channel, this.subscribeListener);
+ this.logger.info('[RequestReplyExecutor] Subscribed to request channel', { executorId: this.executorId });
+ this.stopHeartbeat();
+ this.startHeartbeat();
+ } catch (err) {
+ const error = err instanceof Error ? err : new Error(String(err), { cause: err });
+ this.logger.error('[RequestReplyExecutor] Error subscribing to request channel', {
+ executorId: this.executorId,
+ error: error.message,
+ });
+ this.onError?.(error, { executorId: this.executorId, channel: this.channel });
+ this.stopHeartbeat();
+ }
+ }
+
+ private async beat(): Promise<void> {
+ this.logger.debug('[RequestReplyExecutor] Beating heartbeat', { executorId: this.executorId });
+ try {
+ await this.redis.set(this.heartbeatKey, '1', { PX: this.heartbeatTtlMs });
+ } catch (err) {
+ const error = err instanceof Error ? err.message : String(err);
+ this.logger.error('[RequestReplyExecutor] Heartbeat error', { executorId: this.executorId, error });
+ }
+ }
+
+ /** Heartbeat only while subscribed. Idempotent (restarts the timer). */
+ private startHeartbeat(): void {
+ if (this.closed) {
+ return;
+ }
+ this.logger.info('[RequestReplyExecutor] Starting heartbeat', { executorId: this.executorId });
+ this.stopHeartbeat();
+ void this.beat();
+ this.heartbeatTimer = setInterval(() => {
+ void this.beat();
+ }, this.heartbeatIntervalMs);
+ }
+
+ /** A stopped heartbeat makes callers fail fast with NoResponderError. */
+ private stopHeartbeat(): void {
+ if (this.heartbeatTimer) {
+ this.logger.info('[RequestReplyExecutor] Stopping heartbeat', { executorId: this.executorId });
+ clearInterval(this.heartbeatTimer);
+ this.heartbeatTimer = null;
+ }
+ }
+
+ private async processRequestFromMessage(message: string): Promise<void> {
+ let raw: unknown;
+ try {
+ raw = JSON.parse(message);
+ } catch (err) {
+ // Drop the request, this should never happen
+ this.logger.warn('[RequestReplyExecutor] Request message is not valid JSON', { executorId: this.executorId });
+ this.onError?.(
+ new Error(`Request message is not valid JSON for executorId: ${this.executorId}, message: ${message}`, {
+ cause: err,
+ }),
+ {
+ executorId: this.executorId,
+ channel: this.channel,
+ },
+ );
+ return;
+ }
+
+ const parsedRequest = publishedRequestSchema.safeParse(raw);
+ if (!parsedRequest.success) {
+ // Drop the request, this should never happen
+ const zodError = parsedRequest.error.flatten();
+ this.logger.warn('[RequestReplyExecutor] Invalid request message shape', {
+ executorId: this.executorId,
+ zod: zodError,
+ });
+ this.onError?.(
+ new Error(
+ `Invalid request message shape for executorId: ${this.executorId}, error: ${JSON.stringify(zodError)}`,
+ { cause: parsedRequest.error },
+ ),
+ { executorId: this.executorId, channel: this.channel },
+ );
+ return;
+ }
+
+ const { replyKey, path, body, headers } = parsedRequest.data;
+ let replyPayload: JSONReply;
+ try {
+ replyPayload = await this.requestHandler(path, { body, headers });
+ } catch (err) {
+ // ReplyError lets handlers choose the reply status; any other throw is an unexpected 500.
+ if (err instanceof ReplyError) {
+ replyPayload = { status: err.status, headers: {}, body: { message: err.message } };
+ } else {
+ const message = err instanceof Error ? err.message : String(err);
+ replyPayload = { status: 500, headers: {}, body: { message } };
+ }
+ }
+
+ try {
+ await this.redis.set(replyKey, JSON.stringify(replyPayload), { PX: this.replyTtlMs });
+ } catch (err) {
+ this.logger.error('[RequestReplyExecutor] Request processing failed', {
+ error: err instanceof Error ? err.message : String(err),
+ executorId: this.executorId,
+ replyKey,
+ });
+ }
+ }
+
+ /** One raw pub/sub payload. Never throws. */
+ private onMessage(message: string): void {
+ this.logger.debug('[RequestReplyExecutor] Received message', { executorId: this.executorId, message });
+ if (!message) {
+ return;
+ }
+ if (this.closed) {
+ this.logger.warn('[RequestReplyExecutor] Received message after executor is closed', {
+ executorId: this.executorId,
+ message,
+ });
+ return;
+ }
+ const pid = randomUUID();
+ const requestPromise = this.processRequestFromMessage(message).finally(() => {
+ this.runningRequests.delete(pid);
+ });
+ this.runningRequests.set(pid, requestPromise);
+ }
+
+ // This function should never throw!
+ // Stops intake: unsubscribe from the channel and stop the heartbeat. Never
+ // closes the clients — the caller owns their lifecycle.
+ async close(): Promise<void> {
+ if (this.closed) {
+ return;
+ }
+ this.logger.info('[RequestReplyExecutor] Closing', { executorId: this.executorId });
+ this.closed = true;
+ try {
+ await this.subscriberClient.unsubscribe(this.channel);
+ } catch {
+ // ignore: connection may already be closed
+ }
+ this.stopHeartbeat();
+ }
+
+ // This function should never throw!
+ // This is called during graceful shutdown
+ async drain(): Promise<void> {
+ await this.close();
+ await Promise.allSettled(Array.from(this.runningRequests.values()));
+ }
+}
diff --git a/packages/harness/src/request-reply/index.ts b/packages/harness/src/request-reply/index.ts
new file mode 100644
index 000000000..f8937ebfc
--- /dev/null
+++ b/packages/harness/src/request-reply/index.ts
@@ -0,0 +1,16 @@
+/**
+ * Redis request-reply transport for executor peering: route a command to the
+ * replica addressed by a plain `executorId`. Hosts own the Redis connection
+ * (inject the node-redis client) and their own id grammar — how an executor
+ * id is embedded in / parsed out of resource ids never enters this module.
+ */
+
+export { redisRequest } from './client';
+export type { SendRequestOptions } from './client';
+export { NoResponderError, ReplyError, RequestTimeoutError } from './errors';
+export { RequestReplyExecutor } from './executor';
+export type { RequestReplyErrorHandler, RunExecutorOptions } from './executor';
+export { RequestReplyRouter } from './router';
+export type { RouteHandler } from './router';
+export { jsonReplySchema } from './types';
+export type { JSONReply, JSONValue, RequestEnvelope, RequestHandler } from './types';
diff --git a/packages/harness/src/request-reply/router.ts b/packages/harness/src/request-reply/router.ts
new file mode 100644
index 000000000..11df9f654
--- /dev/null
+++ b/packages/harness/src/request-reply/router.ts
@@ -0,0 +1,42 @@
+import { ReplyError } from './errors';
+import type { JSONReply, RequestEnvelope, RequestHandler } from './types';
+
+/**
+ * Handlers receive the wire body as unvalidated JSON and must validate it
+ * themselves (the payload crosses process boundaries).
+ */
+export type RouteHandler = (request: RequestEnvelope) => Promise<JSONReply>;
+
+/**
+ * In-process dispatch table keyed by logical path (e.g. `sessions/cancel`).
+ * The host creates one at boot and passes `createRequestHandler()` to the
+ * executor.
+ */
+export class RequestReplyRouter {
+ private readonly routes = new Map<string, RouteHandler>();
+
+ /** Throws if the path is already registered. */
+ registerRoute(path: string, fn: RouteHandler): void {
+ const alreadyAddedFn = this.routes.get(path);
+ if (alreadyAddedFn) {
+ throw new Error(
+ `[RequestReplyRouter] Route ${path} already registered for function ${alreadyAddedFn.name || 'anonymous'}`,
+ );
+ }
+ this.routes.set(path, fn);
+ }
+
+ async dispatchRoute(path: string, request: RequestEnvelope): Promise<JSONReply> {
+ const fn = this.routes.get(path);
+ if (!fn) {
+ // ReplyError carries an explicit status onto the wire (see executor error mapping).
+ throw new ReplyError(500, `Route ${path} not found for executor proxying`);
+ }
+ return fn(request);
+ }
+
+ /** Returns the `requestHandler` callback the executor consumes. */
+ createRequestHandler(): RequestHandler {
+ return (path, request) => this.dispatchRoute(path, request);
+ }
+}
diff --git a/packages/harness/src/request-reply/types.ts b/packages/harness/src/request-reply/types.ts
new file mode 100644
index 000000000..2b0f35904
--- /dev/null
+++ b/packages/harness/src/request-reply/types.ts
@@ -0,0 +1,43 @@
+import { z } from 'zod';
+
+export type JSONValue = string | number | boolean | null | JSONValue[] | { [key: string]: JSONValue };
+
+// Recursive schema (https://zod.dev/api?id=json); z.lazy needs the explicit
+// annotation, so JSONValue cannot be derived with z.infer.
+const jsonSchema: z.ZodType<JSONValue> = z.lazy(() => {
+ return z.union([
+ z.string(),
+ z.number(),
+ z.boolean(),
+ z.null(),
+ z.array(jsonSchema),
+ z.record(z.string(), jsonSchema),
+ ]);
+});
+
+/** Request payload as seen by the caller of redisRequest and by route handlers. */
+export interface RequestEnvelope<T extends JSONValue = JSONValue> {
+ body: T;
+ headers?: Record<string, string> | undefined;
+}
+
+/** Body of a PUBLISH on the executor request channel (JSON string). */
+export const publishedRequestSchema = z.object({
+ replyKey: z.string(),
+ path: z.string(),
+ body: jsonSchema,
+ headers: z.record(z.string(), z.string()).optional(),
+});
+export type PublishedRequest = z.infer<typeof publishedRequestSchema>;
+
+export const jsonReplySchema = z.object({
+ status: z.number().int().min(200).max(599),
+ headers: z.record(z.string(), z.string()).optional(),
+ body: jsonSchema,
+});
+export type JSONReply = z.infer<typeof jsonReplySchema>;
+
+export type RequestHandler<T extends JSONValue = JSONValue> = (
+ path: string,
+ request: RequestEnvelope<T>,
+) => Promise<JSONReply>;
diff --git a/packages/harness/src/request-reply/utils.ts b/packages/harness/src/request-reply/utils.ts
new file mode 100644
index 000000000..12403ae57
--- /dev/null
+++ b/packages/harness/src/request-reply/utils.ts
@@ -0,0 +1,20 @@
+export function sleep(ms: number): Promise<void> {
+ return new Promise(resolve => setTimeout(resolve, ms));
+}
+
+export const KEY_PREFIX = 'rr';
+
+/** Liveness key an executor refreshes; callers check it before publishing. */
+export function heartbeatKey(executorId: string): string {
+ return `${KEY_PREFIX}:hb:${executorId}`;
+}
+
+/** Pub/sub channel: executors subscribe; callers publish the JSON request (see publishedRequestSchema). */
+export function requestChannel(executorId: string): string {
+ return `${KEY_PREFIX}:req:${executorId}`;
+}
+
+/** Per-request key the executor SETs the JSONReply to; the caller polls it with GETDEL. */
+export function replyKey(requestId: string): string {
+ return `${KEY_PREFIX}:reply:${requestId}`;
+}
diff --git a/packages/harness/tests/agent-session/capabilityState.test.ts b/packages/harness/tests/agent-session/capabilityState.test.ts
index 1c173f16b..007855a52 100644
--- a/packages/harness/tests/agent-session/capabilityState.test.ts
+++ b/packages/harness/tests/agent-session/capabilityState.test.ts
@@ -12,7 +12,14 @@ import type { AgentContextProcessorOutput } from '../../src/core/capabilities/Ag
import { AgentThread } from '../../src/core/runtime/AgentThread';
import { InternalEventType } from '../../src/core/runtime/AgentThread.types';
import { NOOP_AGENT_TRACING } from '../../src/core/tracing/NoopAgentTracing';
-import { emptyLlmStream, makeAgentSpec, makeMockILLM, makeSilentLogger, makeTestResolver } from './testHelpers';
+import {
+ emptyLlmStream,
+ makeAgentSpec,
+ makeMockILLM,
+ makeSilentLogger,
+ makeTestResolver,
+ mintTestTurnId,
+} from './testHelpers';
function makePlanShapedCapability(options: {
enabled: boolean;
@@ -64,6 +71,7 @@ describe('capability_state (tfy.plan fixture)', () => {
let loads: JsonValue[] = [];
const turn1 = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'start' }],
previous_turn_id: null,
signal: new AbortController().signal,
@@ -92,6 +100,7 @@ describe('capability_state (tfy.plan fixture)', () => {
loads = [];
const turn2 = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'continue' }],
previous_turn_id: 'auto',
signal: new AbortController().signal,
@@ -133,6 +142,7 @@ describe('capability_state (tfy.plan fixture)', () => {
};
const turn1 = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'start' }],
previous_turn_id: null,
signal: new AbortController().signal,
@@ -164,6 +174,7 @@ describe('capability_state (tfy.plan fixture)', () => {
};
const turn3 = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'no plan' }],
previous_turn_id: 'auto',
signal: new AbortController().signal,
@@ -220,6 +231,7 @@ describe('capability_state (tfy.plan fixture)', () => {
agent_spec: makeAgentSpec(),
});
const turn = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'x' }],
previous_turn_id: null,
signal: new AbortController().signal,
diff --git a/packages/harness/tests/agent-session/sessions.test.ts b/packages/harness/tests/agent-session/sessions.test.ts
index d5c23ce54..97f83f4ae 100644
--- a/packages/harness/tests/agent-session/sessions.test.ts
+++ b/packages/harness/tests/agent-session/sessions.test.ts
@@ -1,7 +1,7 @@
import { EventType } from '../../src/agent-session/schemas/events';
import { Sessions } from '../../src/agent-session/Sessions';
import { InMemorySessionStore } from '../../src/agent-session/store/InMemorySessionStore';
-import { makeAgentSpec, makeTestResolver } from './testHelpers';
+import { makeAgentSpec, makeTestResolver, mintTestTurnId } from './testHelpers';
describe('Sessions / SessionHandle / TurnHandle (storage + createTurn)', () => {
const tenant = 'tenant-1';
@@ -32,6 +32,7 @@ describe('Sessions / SessionHandle / TurnHandle (storage + createTurn)', () => {
agent_spec: makeAgentSpec(),
});
const turn = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'hello' }],
previous_turn_id: null,
signal: new AbortController().signal,
@@ -61,6 +62,7 @@ describe('Sessions / SessionHandle / TurnHandle (storage + createTurn)', () => {
agent_spec: makeAgentSpec(),
});
const t1 = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'one' }],
previous_turn_id: null,
signal: new AbortController().signal,
@@ -70,6 +72,7 @@ describe('Sessions / SessionHandle / TurnHandle (storage + createTurn)', () => {
expect(t1.custom).toEqual({ n: 1 });
const t2 = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'two' }],
previous_turn_id: 'auto',
signal: new AbortController().signal,
@@ -88,6 +91,7 @@ describe('Sessions / SessionHandle / TurnHandle (storage + createTurn)', () => {
agent_spec: makeAgentSpec(),
});
const first = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'one' }],
previous_turn_id: null,
signal: new AbortController().signal,
@@ -98,6 +102,7 @@ describe('Sessions / SessionHandle / TurnHandle (storage + createTurn)', () => {
// drain
}
const root2 = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'fresh root' }],
previous_turn_id: null,
signal: new AbortController().signal,
@@ -118,6 +123,7 @@ describe('Sessions / SessionHandle / TurnHandle (storage + createTurn)', () => {
});
await expect(
session.createTurn({
+ turn_id: mintTestTurnId(),
// Mixed batch — rejected by SessionHandle.toSendBatch / orchestrator validation path.
input: [
{ type: EventType.USER_MESSAGE, content: 'hi' },
@@ -157,6 +163,7 @@ describe('Sessions / SessionHandle / TurnHandle (storage + createTurn)', () => {
const closeOnFailure = jest.fn().mockResolvedValue(undefined);
await expect(
session.createTurn({
+ turn_id: mintTestTurnId(),
// Mixed batch — rejected after sandbox/thread resolution.
input: [
{ type: EventType.USER_MESSAGE, content: 'hi' },
@@ -177,6 +184,7 @@ describe('Sessions / SessionHandle / TurnHandle (storage + createTurn)', () => {
// Success path: run() must NOT close — TurnHandle.stream()'s finally owns it.
const closeOnSuccess = jest.fn().mockResolvedValue(undefined);
const turn = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'hello' }],
previous_turn_id: null,
signal: new AbortController().signal,
diff --git a/packages/harness/tests/agent-session/testHelpers.ts b/packages/harness/tests/agent-session/testHelpers.ts
index ce018ddac..90972c146 100644
--- a/packages/harness/tests/agent-session/testHelpers.ts
+++ b/packages/harness/tests/agent-session/testHelpers.ts
@@ -1,3 +1,4 @@
+import { ulid } from 'ulid';
import type { ITurnResourceResolver } from '../../src/agent-session/ITurnResourceResolver';
import { MAIN_THREAD_ID, type TurnRecord } from '../../src/agent-session/models/TurnRecord';
import { AgentSpecSchema, type AgentSpec } from '../../src/agent-session/schemas/agentSpec';
@@ -14,6 +15,11 @@ import { makeMockILLM, makeSilentLogger } from '../core/harnessMocks';
export { makeMockILLM, makeSilentLogger };
+/** Turn ids are opaque, caller-minted strings; tests only need uniqueness. */
+export function mintTestTurnId(): string {
+ return ulid().toLowerCase();
+}
+
/** Minimal AgentSpec for session/turn tests — interactive builtins off. */
export function makeAgentSpec(
overrides: {
diff --git a/packages/harness/tests/agent-session/turnStream.test.ts b/packages/harness/tests/agent-session/turnStream.test.ts
index ddebbbfae..6d4bd9e7c 100644
--- a/packages/harness/tests/agent-session/turnStream.test.ts
+++ b/packages/harness/tests/agent-session/turnStream.test.ts
@@ -5,7 +5,14 @@ import { InMemorySessionStore } from '../../src/agent-session/store/InMemorySess
import { TurnResourceResolver } from '../../src/agent-session/TurnResourceResolver';
import { RemoteMCP } from '../../src/core/mcp/RemoteMCP';
import { makeStubPublicSandbox } from '../core/harnessMocks';
-import { emptyLlmStream, makeAgentSpec, makeMockILLM, makeSilentLogger, makeTestResolver } from './testHelpers';
+import {
+ emptyLlmStream,
+ makeAgentSpec,
+ makeMockILLM,
+ makeSilentLogger,
+ makeTestResolver,
+ mintTestTurnId,
+} from './testHelpers';
describe('TurnHandle.stream()', () => {
const tenant = 'tenant-1';
@@ -28,6 +35,7 @@ describe('TurnHandle.stream()', () => {
it('run commits running turn; stream is sole terminal writer → done', async () => {
const { store, session } = await createSession();
const turn = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'hello' }],
previous_turn_id: null,
signal: new AbortController().signal,
@@ -58,6 +66,7 @@ describe('TurnHandle.stream()', () => {
it('background drain reaches terminal done', async () => {
const { session } = await createSession();
const turn = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'hello' }],
previous_turn_id: null,
signal: new AbortController().signal,
@@ -75,6 +84,7 @@ describe('TurnHandle.stream()', () => {
it('second stream() call throws', async () => {
const { session } = await createSession();
const turn = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'hello' }],
previous_turn_id: null,
signal: new AbortController().signal,
@@ -98,6 +108,7 @@ describe('TurnHandle.stream()', () => {
const { store, session } = await createSession();
let closeCalls = 0;
const turn = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'hello' }],
previous_turn_id: null,
signal: new AbortController().signal,
@@ -129,6 +140,7 @@ describe('TurnHandle.stream()', () => {
const { store, session } = await createSession();
const controller = new AbortController();
const turn = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'hello' }],
previous_turn_id: null,
signal: controller.signal,
@@ -155,6 +167,7 @@ describe('TurnHandle.stream()', () => {
const { store, session } = await createSession();
const controller = new AbortController();
const turn = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'hello' }],
previous_turn_id: null,
signal: controller.signal,
@@ -183,6 +196,7 @@ describe('TurnHandle.stream()', () => {
const { store, session } = await createSession();
const controller = new AbortController();
const turn = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'hello' }],
previous_turn_id: null,
signal: controller.signal,
@@ -211,6 +225,7 @@ describe('TurnHandle.stream()', () => {
const { store, session } = await createSession();
let closeCalls = 0;
const turn = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'hello' }],
previous_turn_id: null,
signal: new AbortController().signal,
@@ -248,6 +263,7 @@ describe('TurnHandle.stream()', () => {
const { session } = await createSession();
// Spec already has sandbox.enabled from createSession helper.
const turn = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'hello' }],
previous_turn_id: null,
signal: new AbortController().signal,
@@ -323,6 +339,7 @@ describe('TurnResourceResolver caches', () => {
}),
});
const turn = await session.createTurn({
+ turn_id: mintTestTurnId(),
input: [{ type: EventType.USER_MESSAGE, content: 'hi' }],
previous_turn_id: null,
signal: new AbortController().signal,
diff --git a/packages/server/.env.example b/packages/server/.env.example
index 2aee777eb..a073e190e 100644
--- a/packages/server/.env.example
+++ b/packages/server/.env.example
@@ -14,6 +14,11 @@ PORT=8790
# in models.yaml; only its API key lives here.
# REGISTRY_DIR=registry
+# Required. Redis connection URL shared by all server replicas; carries
+# executor peering so a cancel that lands on one replica reaches the replica
+# running the turn. docker-compose provides this automatically.
+REDIS_URL=redis://localhost:6379
+
# Required. Default API key for the OpenAI-compatible API at models.yaml's
# base_url, sent as "Authorization: Bearer <key>" on every model request.
# Per-model overrides use MODEL_{NAME}_API_KEY with the same {NAME} rules as
diff --git a/packages/server/.env.test b/packages/server/.env.test
new file mode 100644
index 000000000..925d119e8
--- /dev/null
+++ b/packages/server/.env.test
@@ -0,0 +1,8 @@
+# Dummy values so config.ts loads in unit tests; no service is contacted.
+POSTGRES_USER=test
+POSTGRES_PASSWORD=test
+POSTGRES_DB=test
+POSTGRES_HOST=localhost
+POSTGRES_PORT=5432
+REDIS_URL=redis://localhost:6379
+MODEL_API_KEY=test
diff --git a/packages/server/package.json b/packages/server/package.json
index 113d38ebf..23bf3be45 100644
--- a/packages/server/package.json
+++ b/packages/server/package.json
@@ -11,7 +11,7 @@
"dev": "tsx --env-file=.env src/main.ts",
"migrate": "tsx --env-file=.env src/db/migrate-cli.ts",
"typecheck": "tsc --noEmit",
- "test": "tsx --test src/**/*.test.ts",
+ "test": "tsx --env-file=.env.test --test src/**/*.test.ts",
"test:store": "jest --config jest.store.config.cjs",
"start": "node dist/main.js"
},
@@ -23,6 +23,7 @@
"hono": "^4.12.31",
"kysely": "^0.29.4",
"pg": "^8.22.0",
+ "redis": "^5.10.0",
"ulid": "^3.0.2",
"winston": "^3.13.0",
"yaml": "^2.9.0",
diff --git a/packages/server/src/apis/sessions.ts b/packages/server/src/apis/sessions.ts
index 6f126fd7a..94ea41eb8 100644
--- a/packages/server/src/apis/sessions.ts
+++ b/packages/server/src/apis/sessions.ts
@@ -5,7 +5,13 @@ import {
SessionStoreConflictError,
SessionStoreNotFoundError,
} from '@truefoundry/utils/agent-session';
+import type { RouteHandler as RequestReplyRouteHandler, RequestReplyRouter } from '@truefoundry/utils/request-reply';
+import { NoResponderError, redisRequest, RequestTimeoutError } from '@truefoundry/utils/request-reply';
+import { HTTPException } from 'hono/http-exception';
+import type { RedisClientType } from 'redis';
import { ulid } from 'ulid';
+import { z } from 'zod';
+import configuration from '../config';
import {
cancelSessionRoute,
createSessionRoute,
@@ -15,6 +21,7 @@ import {
updateSessionRoute,
} from '../routes/sessionRoutes';
import type { ActiveTurnRegistry } from '../runtime/activeTurns';
+import { executorFromTurnId } from '../runtime/peeringIds';
import type { Session } from '../schemas/session';
import type { McpStore } from '../store/McpStore';
import type { ModelStore } from '../store/ModelStore';
@@ -22,6 +29,17 @@ import type { ModelStore } from '../store/ModelStore';
/** The server is single-tenant; every record lives under one fixed tenant scope. */
export const TENANT_ID = 'default';
+/** Request-reply path a replica serves to cancel a turn it owns. */
+export const SESSIONS_CANCEL_PATH = 'sessions/cancel';
+
+/** Wire body of a peer cancel; validated on receipt (it crosses processes via Redis). */
+const CancelPeerBodySchema = z.object({
+ session_id: z.string(),
+ turn_id: z.string(),
+ reason: z.nativeEnum(CancellationReason),
+});
+type CancelPeerBody = z.infer<typeof CancelPeerBodySchema>;
+
export function toWireSession(record: SessionRecord): Session {
return {
id: record.session_id,
@@ -84,6 +102,111 @@ export interface SessionsRouterDeps {
mcpStore: McpStore;
/** Whether a sandbox provider is configured (SANDBOX_SETTINGS); gates spec admission. */
sandboxSupported: boolean;
+ /** Primary Redis client (server-owned); used to reach peer executors. */
+ redis: RedisClientType;
+ /** Request-reply dispatch table this replica serves; cancel registers here. */
+ requestReplyRouter: RequestReplyRouter;
+}
+
+function cancelTurnOnThisExecutor(
+ activeTurns: ActiveTurnRegistry,
+ input: { sessionId: string; turnId: string; reason: CancellationReason },
+): boolean {
+ return activeTurns.cancelIfRunning({
+ sessionId: input.sessionId,
+ turnId: input.turnId,
+ abortReason: input.reason,
+ });
+}
+
+/**
+ * Peer-facing cancel handler (registered in createSessionsRouter): aborts the
+ * turn if it runs in this process. 200 = abort fired, 412 = not running here
+ * (treated by callers as a no-op).
+ */
+export function cancelSessionTurnPeerHandler(activeTurns: ActiveTurnRegistry): RequestReplyRouteHandler {
+ // Synchronous by nature; the transport expects a Promise and require-await
+ // forbids an async fn without awaits.
+ return request => {
+ const parsed = CancelPeerBodySchema.safeParse(request.body);
+ if (!parsed.success) {
+ return Promise.resolve({ status: 400, body: { message: 'Invalid sessions/cancel payload' } });
+ }
+ const found = cancelTurnOnThisExecutor(activeTurns, {
+ sessionId: parsed.data.session_id,
+ turnId: parsed.data.turn_id,
+ reason: parsed.data.reason,
+ });
+ return Promise.resolve(
+ found ? { status: 200, body: {} } : { status: 412, body: { message: 'Turn is not running on this executor' } },
+ );
+ };
+}
+
+/**
+ * Cancels the turn wherever it runs: locally or on the owning peer over Redis
+ * request-reply. Callers state the motive; default is a plain client cancel.
+ * Owner failures throw HTTPException (412 unreachable, 424 timed out).
+ */
+export async function cancelSessionTurn(
+ deps: Pick<SessionsRouterDeps, 'redis' | 'activeTurns' | 'sessionStore'>,
+ input: { sessionId: string; turnId: string; reason?: CancellationReason },
+): Promise<void> {
+ const { sessionId, turnId, reason = CancellationReason.ClientCancelled } = input;
+
+ const turn = await deps.sessionStore.getTurn({
+ tenant_id: TENANT_ID,
+ session_id: sessionId,
+ turn_id: turnId,
+ });
+ if (turn?.state.status !== 'running') {
+ // Missing or already terminal — nothing to cancel.
+ return;
+ }
+
+ const owner = executorFromTurnId(turnId);
+ if (owner !== configuration.EXECUTOR_ID) {
+ try {
+ const reply = await redisRequest<CancelPeerBody>({
+ redis: deps.redis,
+ executorId: owner,
+ path: SESSIONS_CANCEL_PATH,
+ request: {
+ body: { session_id: sessionId, turn_id: turnId, reason },
+ },
+ options: {
+ replyTimeoutMs: configuration.REDIS_REQUEST_REPLY_TIMEOUT_MS,
+ pollIntervalMs: configuration.REDIS_REQUEST_REPLY_POLL_INTERVAL_MS,
+ },
+ });
+ if (reply.status !== 200 && reply.status !== 412) {
+ throw new HTTPException(500, { message: 'Failed to cancel turn on the owning executor', cause: reply });
+ }
+ } catch (error) {
+ if (error instanceof NoResponderError) {
+ throw new HTTPException(412, {
+ message: `Executor owning the running turn is unreachable: ${owner}`,
+ cause: error,
+ });
+ }
+ if (error instanceof RequestTimeoutError) {
+ throw new HTTPException(424, {
+ message: 'Timed out waiting for the owning executor to cancel the turn',
+ cause: error,
+ });
+ }
+ if (error instanceof HTTPException) {
+ throw error;
+ }
+ throw new HTTPException(500, {
+ message: `Unexpected error while cancelling the turn on the owning executor: ${owner}`,
+ cause: error,
+ });
+ }
+ return;
+ }
+
+ cancelTurnOnThisExecutor(deps.activeTurns, { sessionId, turnId, reason });
}
export function createSessionsRouter(deps: SessionsRouterDeps) {
@@ -173,13 +296,12 @@ export function createSessionsRouter(deps: SessionsRouterDeps) {
if (!record) {
return c.json({ error: { message: `Session not found: ${sessionId}` } }, 404);
}
- if (record.last_turn_id) {
- deps.activeTurns.cancelIfRunning({
- sessionId,
- turnId: record.last_turn_id,
- abortReason: CancellationReason.ClientCancelled,
- });
+ const turnId = record.last_turn_id;
+ if (!turnId) {
+ return c.json({}, 200);
}
+
+ await cancelSessionTurn(deps, { sessionId, turnId });
return c.json({}, 200);
};
@@ -214,6 +336,7 @@ export function createSessionsRouter(deps: SessionsRouterDeps) {
router.openapi(updateSessionRoute, updateSessionHandler);
router.openapi(listSessionsRoute, listSessionsHandler);
router.openapi(cancelSessionRoute, cancelSessionHandler);
+ deps.requestReplyRouter.registerRoute(SESSIONS_CANCEL_PATH, cancelSessionTurnPeerHandler(deps.activeTurns));
router.openapi(listSessionEventsRoute, listSessionEventsHandler);
return router;
}
diff --git a/packages/server/src/apis/turns.ts b/packages/server/src/apis/turns.ts
index b6f1bcde9..57d73e576 100644
--- a/packages/server/src/apis/turns.ts
+++ b/packages/server/src/apis/turns.ts
@@ -22,6 +22,7 @@ import type { Logger } from 'winston';
import configuration from '../config';
import { createAndExecuteTurnRoute, getTurnRoute, listTurnEventsRoute, listTurnsRoute } from '../routes/turnRoutes';
import type { ActiveTurnRegistry } from '../runtime/activeTurns';
+import { mintPeeredTurnId } from '../runtime/peeringIds';
import type { McpStore } from '../store/McpStore';
import type { ModelStore } from '../store/ModelStore';
import { TENANT_ID } from './sessions';
@@ -208,6 +209,7 @@ export function createTurnsRouter(deps: TurnsRouterDeps) {
let turn;
try {
turn = await session.createTurn({
+ turn_id: mintPeeredTurnId(configuration.EXECUTOR_ID),
input: body.input,
previous_turn_id: body.previous_turn_id,
signal: abortController.signal,
diff --git a/packages/server/src/app.ts b/packages/server/src/app.ts
index 12277dfc0..6cc486525 100644
--- a/packages/server/src/app.ts
+++ b/packages/server/src/app.ts
@@ -5,7 +5,9 @@
import { swaggerUI } from '@hono/swagger-ui';
import { OpenAPIHono } from '@hono/zod-openapi';
import type { ISessionStore, Sessions, TurnSandboxFactory } from '@truefoundry/utils/agent-session';
+import type { RequestReplyRouter } from '@truefoundry/utils/request-reply';
import { HTTPException } from 'hono/http-exception';
+import type { RedisClientType } from 'redis';
import type { Logger } from 'winston';
import { createCapabilitiesRouter } from './apis/capabilities';
import { createMcpRouter } from './apis/mcp';
@@ -36,6 +38,10 @@ export interface ServerDeps {
activeTurns: ActiveTurnRegistry;
/** Built at boot from SANDBOX_SETTINGS; undefined = sandbox unsupported. */
sandboxFactory?: TurnSandboxFactory;
+ /** Primary Redis client (server-owned); carries executor peering. */
+ redis: RedisClientType;
+ /** Request-reply dispatch table served by this replica's executor. */
+ requestReplyRouter: RequestReplyRouter;
logger: Logger;
}
@@ -57,6 +63,8 @@ export function createServerApp(deps: ServerDeps) {
modelStore: deps.modelStore,
mcpStore: deps.mcpStore,
sandboxSupported: deps.sandboxFactory !== undefined,
+ redis: deps.redis,
+ requestReplyRouter: deps.requestReplyRouter,
}),
);
app.route(
diff --git a/packages/server/src/config.ts b/packages/server/src/config.ts
index 74f0d0f7f..3a1eedf0f 100644
--- a/packages/server/src/config.ts
+++ b/packages/server/src/config.ts
@@ -39,7 +39,7 @@ export const getEnv = (key: string, options?: GetEnvOptions): string | undefined
return options.defaultValue;
}
- if (process.env['NODE_ENV'] !== 'test' && options?.required) {
+ if (options?.required) {
throw new Error(`Environment variable ${key} is required but was not specified.`);
}
@@ -124,6 +124,10 @@ export const parseApiKeysByName = (): Record<string, string> => {
return byName;
};
+function randomAlphanumeric(length: number): string {
+ return Array.from({ length }, () => Math.floor(Math.random() * 36).toString(36)).join('');
+}
+
export const parsePort = (raw: string | undefined): number => {
if (raw === undefined || raw.trim() === '') {
return DEFAULT_PORT;
@@ -152,16 +156,10 @@ export const parsePositiveInt = (options: {
return value;
};
-/**
- * Required non-empty env var. Same `NODE_ENV=test` exemption as `getEnv({ required: true })`,
- * but also rejects blank strings outside tests.
- */
+/** Required env var that also rejects blank strings. */
export const requireNonEmptyEnv = (key: string): string => {
const value = getEnv(key, { required: true });
if (value === undefined || value.trim() === '') {
- if (process.env['NODE_ENV'] === 'test') {
- return '';
- }
throw new Error(`Environment variable ${key} is required but was not specified.`);
}
return value;
@@ -257,6 +255,33 @@ export interface ServerConfiguration {
DATABASE_URL: string;
/** Max connections in the `pg` Pool. Env: `DATABASE_POOL_MAX`. Default 10. */
DATABASE_POOL_MAX: number;
+ /**
+ * Redis connection URL shared by all replicas; carries executor peering
+ * (cross-replica turn cancel). Env: `REDIS_URL` (required).
+ */
+ REDIS_URL: string;
+ /** Unique id of this process. Not an env var. */
+ EXECUTOR_ID: string;
+ /**
+ * Max ms to wait for a peer executor's reply before failing with 424.
+ * Env: `REDIS_REQUEST_REPLY_TIMEOUT_MS`. Default 60000.
+ */
+ REDIS_REQUEST_REPLY_TIMEOUT_MS: number;
+ /**
+ * How often this process refreshes its peering heartbeat key.
+ * Env: `REDIS_REQUEST_REPLY_HEARTBEAT_INTERVAL_MS`. Default 5000.
+ */
+ REDIS_REQUEST_REPLY_HEARTBEAT_INTERVAL_MS: number;
+ /**
+ * TTL for reply values so abandoned reply keys are reclaimed.
+ * Env: `REDIS_REQUEST_REPLY_REPLY_TTL_MS`. Default 120000.
+ */
+ REDIS_REQUEST_REPLY_REPLY_TTL_MS: number;
+ /**
+ * Sleep between reply poll attempts while waiting on a peer.
+ * Env: `REDIS_REQUEST_REPLY_POLL_INTERVAL_MS`. Default 500.
+ */
+ REDIS_REQUEST_REPLY_POLL_INTERVAL_MS: number;
}
// ============================================================================
@@ -316,6 +341,28 @@ const configuration: ServerConfiguration = {
raw: getEnv('DATABASE_POOL_MAX'),
defaultValue: 10,
}),
+ REDIS_URL: requireNonEmptyEnv('REDIS_URL'),
+ EXECUTOR_ID: randomAlphanumeric(6),
+ REDIS_REQUEST_REPLY_TIMEOUT_MS: parsePositiveInt({
+ envKey: 'REDIS_REQUEST_REPLY_TIMEOUT_MS',
+ raw: getEnv('REDIS_REQUEST_REPLY_TIMEOUT_MS'),
+ defaultValue: 60_000,
+ }),
+ REDIS_REQUEST_REPLY_HEARTBEAT_INTERVAL_MS: parsePositiveInt({
+ envKey: 'REDIS_REQUEST_REPLY_HEARTBEAT_INTERVAL_MS',
+ raw: getEnv('REDIS_REQUEST_REPLY_HEARTBEAT_INTERVAL_MS'),
+ defaultValue: 5_000,
+ }),
+ REDIS_REQUEST_REPLY_REPLY_TTL_MS: parsePositiveInt({
+ envKey: 'REDIS_REQUEST_REPLY_REPLY_TTL_MS',
+ raw: getEnv('REDIS_REQUEST_REPLY_REPLY_TTL_MS'),
+ defaultValue: 120_000,
+ }),
+ REDIS_REQUEST_REPLY_POLL_INTERVAL_MS: parsePositiveInt({
+ envKey: 'REDIS_REQUEST_REPLY_POLL_INTERVAL_MS',
+ raw: getEnv('REDIS_REQUEST_REPLY_POLL_INTERVAL_MS'),
+ defaultValue: 500,
+ }),
} as const;
export default configuration;
diff --git a/packages/server/src/main.ts b/packages/server/src/main.ts
index 5831de2c2..f6dc1de1c 100644
--- a/packages/server/src/main.ts
+++ b/packages/server/src/main.ts
@@ -18,6 +18,8 @@ try {
{ Sessions, CancellationReason },
{ ActiveTurnRegistry },
{ createServerSandboxFactory },
+ { connectRedis },
+ { RequestReplyExecutor, RequestReplyRouter },
{ PostgresSessionStore },
] = await Promise.all([
import('./app'),
@@ -30,6 +32,8 @@ try {
import('@truefoundry/utils/agent-session'),
import('./runtime/activeTurns'),
import('./runtime/sandboxFactory'),
+ import('./runtime/redis'),
+ import('@truefoundry/utils/request-reply'),
import('./db/session-store/PostgresSessionStore'),
]);
@@ -48,6 +52,13 @@ try {
const skillStore = SkillStore.load();
const sandboxFactory = createServerSandboxFactory({ logger });
const activeTurns = new ActiveTurnRegistry();
+
+ // Executor peering: this process's identity is embedded into turn ids so
+ // any replica can route a cancel to the owner over Redis request-reply.
+ logger.info(`Executor id: ${configuration.EXECUTOR_ID}`);
+ const redis = await connectRedis({ url: configuration.REDIS_URL, logger });
+ const requestReplyRouter = new RequestReplyRouter();
+
const app = createServerApp({
modelStore: ModelStore.load(),
mcpStore: McpStore.load(),
@@ -56,8 +67,34 @@ try {
sessions: new Sessions({ sessionStore }),
activeTurns,
...(sandboxFactory ? { sandboxFactory } : {}),
+ redis,
+ requestReplyRouter,
+ logger,
+ });
+
+ // After createServerApp so every request-reply route is registered before
+ // the executor starts consuming messages. The executor needs a dedicated
+ // subscriber connection (a subscribed client cannot issue normal commands);
+ // this process owns its lifecycle. Connect before init() so init() awaits
+ // the initial subscribe + heartbeat — the replica is reachable for peering
+ // before the HTTP server starts.
+ const requestReplySubscriber = redis.duplicate();
+ requestReplySubscriber.on('error', (error: Error) => {
+ logger.error('[RedisSubscriber] Client error', { error: error.message });
+ });
+ await requestReplySubscriber.connect();
+ const requestReplyExecutor = new RequestReplyExecutor({
+ executorId: configuration.EXECUTOR_ID,
+ redis,
+ subscriberClient: requestReplySubscriber,
+ requestHandler: requestReplyRouter.createRequestHandler(),
logger,
+ options: {
+ heartbeatIntervalMs: configuration.REDIS_REQUEST_REPLY_HEARTBEAT_INTERVAL_MS,
+ replyTtlMs: configuration.REDIS_REQUEST_REPLY_REPLY_TTL_MS,
+ },
});
+ await requestReplyExecutor.init();
const server = serve({ fetch: app.fetch, port: configuration.PORT }, info => {
console.log(`Agent server listening on http://localhost:${String(info.port)} (docs at /docs)`);
@@ -95,6 +132,19 @@ try {
// closed covers the gap where the registry is empty before that late track().
await activeTurns.shutdownAndWait(CancellationReason.Abandoned);
await closed;
+ // Stop serving peer requests (waits for in-flight replies), then close
+ // the clients this process owns: the subscriber duplicate and the primary.
+ await requestReplyExecutor.drain();
+ await requestReplySubscriber.close().catch((error: unknown) => {
+ logger.warn('[Redis] Error closing subscriber client during shutdown', {
+ error: error instanceof Error ? error.message : String(error),
+ });
+ });
+ await redis.close().catch((error: unknown) => {
+ logger.warn('[Redis] Error closing client during shutdown', {
+ error: error instanceof Error ? error.message : String(error),
+ });
+ });
await db.destroy();
process.exit(0);
};
diff --git a/packages/server/src/routes/sessionRoutes.ts b/packages/server/src/routes/sessionRoutes.ts
index 48165a005..748f9ca7b 100644
--- a/packages/server/src/routes/sessionRoutes.ts
+++ b/packages/server/src/routes/sessionRoutes.ts
@@ -150,7 +150,8 @@ export const cancelSessionRoute = createRoute({
},
412: {
content: { 'application/json': { schema: RequestErrorResponseSchema } },
- description: 'Requested action cannot be performed on the session because it is no longer usable.',
+ description:
+ 'Requested action cannot be performed on the session because it is no longer usable, or the executor owning the running turn is unreachable.',
},
},
});
diff --git a/packages/server/src/runtime/peeringIds.ts b/packages/server/src/runtime/peeringIds.ts
new file mode 100644
index 000000000..a9f74163b
--- /dev/null
+++ b/packages/server/src/runtime/peeringIds.ts
@@ -0,0 +1,20 @@
+import { HTTPException } from 'hono/http-exception';
+import { ulid } from 'ulid';
+
+/**
+ * Mints a peered turn id owned by `executorId`. The server calls this at turn
+ * creation (the id is opaque to the session library); `executorFromTurnId`
+ * is the matching decoder on the routing path.
+ */
+export function mintPeeredTurnId(executorId: string): string {
+ return `${ulid().toLowerCase()}.${executorId}`;
+}
+
+/** Decodes the owning executor; throws 400 for an id outside the grammar. */
+export function executorFromTurnId(turnId: string): string {
+ const parts = turnId.split('.');
+ if (parts.length !== 2 || !parts[0] || !parts[1]) {
+ throw new HTTPException(400, { message: `ID ${turnId} is not a valid turn id` });
+ }
+ return parts[1];
+}
diff --git a/packages/server/src/runtime/redis.ts b/packages/server/src/runtime/redis.ts
new file mode 100644
index 000000000..1f214183b
--- /dev/null
+++ b/packages/server/src/runtime/redis.ts
@@ -0,0 +1,18 @@
+/**
+ * Primary Redis connection, owned by the server: created and connected at
+ * boot, closed last during shutdown. Injected into the request-reply
+ * transport (which duplicates it only for its subscriber).
+ */
+import { createClient, type RedisClientType } from 'redis';
+import type { Logger } from 'winston';
+
+export async function connectRedis(input: { url: string; logger: Logger }): Promise<RedisClientType> {
+ const client: RedisClientType = createClient({ url: input.url });
+ // Without an 'error' listener node-redis crashes the process on emit;
+ // reconnects are automatic, so log and keep running.
+ client.on('error', (error: Error) => {
+ input.logger.error('[Redis] Client error', { error: error.message });
+ });
+ await client.connect();
+ return client;
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index bd5754513..1239f8da0 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -50,19 +50,19 @@ importers:
dependencies:
'@assistant-ui/core':
specifier: 0.2.21
'@assistant-ui/react':
specifier: ^0.14.24
'@assistant-ui/store':
specifier: 0.2.20
'@truefoundry/agent-ui-sdk':
specifier: 0.0.8
- version: 0.0.8(f645c8c3699fdf377e27e4913e1bf82b)
+ version: 0.0.8(6dfffe383ee9b494dc775131178b257f)
'@truefoundry/assistant-ui-runtime':
specifier: 0.1.4
- version: 0.1.4(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected](patch_hash=2dd458ac139d735ffb9d9fadc203e4314f0a0f0c7338c365cc0bb4b4f4c8f6b4))([email protected](@types/[email protected])([email protected])([email protected]([email protected])))
monaco-editor:
specifier: ^0.52.0
version: 0.52.2
@@ -167,6 +167,9 @@ importers:
jest:
specifier: ^29.7.0
+ redis:
+ specifier: ^5.10.0
+ version: 5.12.1(@opentelemetry/[email protected])
tsup:
specifier: ^8.5.0
@@ -197,6 +200,9 @@ importers:
pg:
specifier: ^8.22.0
version: 8.22.0
+ redis:
+ specifier: ^5.10.0
+ version: 5.12.1(@opentelemetry/[email protected])
ulid:
specifier: ^3.0.2
version: 3.0.2
@@ -2508,6 +2514,42 @@ packages:
'@radix-ui/[email protected]':
resolution: {integrity: sha512-JtyZR+mqgBibTo8xea3B6ZRmzZiM/YeVBtUkas6zMuXjAlfIFIW2FgqeM9eLyvEaYX66vr6DJMK+4U6LV0KhNw==}
+ '@redis/[email protected]':
+ resolution: {integrity: sha512-PUUfv+ms7jgPSBVoo/DN4AkPHj4D5TZSd6SbJX7egzBplkYUcKmHRE8RKia7UtZ8bSQbLguLvxVO+asKtQfZWA==}
+ engines: {node: '>= 18.19.0'}
+ peerDependencies:
+ '@redis/client': ^5.12.1
+
+ '@redis/[email protected]':
+ resolution: {integrity: sha512-7aPGWeqA3uFm43o19umzdl16CEjK/JQGtSXVPevplTaOU3VJA/rseBC1QvYUz9lLDIMBimc4SW/zrW4S89BaCA==}
+ engines: {node: '>= 18.19.0'}
+ peerDependencies:
+ '@node-rs/xxhash': ^1.1.0
+ '@opentelemetry/api': '>=1 <2'
+ peerDependenciesMeta:
+ '@node-rs/xxhash':
+ optional: true
+ '@opentelemetry/api':
+ optional: true
+
+ '@redis/[email protected]':
+ resolution: {integrity: sha512-eOze75esLve4vfqDel7aMX08CNaiLLQS2fV8mpRN9NxPe1rVR4vQyYiW/OgtGUysF6QOr9ANhfxABKNOJfXdKg==}
+ engines: {node: '>= 18.19.0'}
+ peerDependencies:
+ '@redis/client': ^5.12.1
+
+ '@redis/[email protected]':
+ resolution: {integrity: sha512-ItlxbxC9cKI6IU1TLWoczwJCRb6TdmkEpWv05UrPawqaAnWGRu3rcIqsc5vN483T2fSociuyV1UkWIL5I4//2w==}
+ engines: {node: '>= 18.19.0'}
+ peerDependencies:
+ '@redis/client': ^5.12.1
+
+ '@redis/[email protected]':
+ resolution: {integrity: sha512-c6JL6E3EcZJuNqKFz+KM+l9l5mpcQiKvTwgA3blt5glWJ8hjDk0yeHN3beE/MpqYIQ8UEX44ItQzgkE/gCBELQ==}
+ engines: {node: '>= 18.19.0'}
+ peerDependencies:
+ '@redis/client': ^5.12.1
+
'@rolldown/[email protected]':
resolution: {integrity: sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==}
@@ -3466,6 +3508,10 @@ packages:
resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}
engines: {node: '>=6'}
+ resolution: {integrity: sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==}
+ engines: {node: '>=0.10.0'}
+
resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==}
engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'}
@@ -5444,6 +5490,10 @@ packages:
react: ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
react-dom: ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+ resolution: {integrity: sha512-LDsoVvb/CpoV9EN3FXvgvSHNJWuCIzl9MiO3ppOevuGLpSGJhwfQjpEwfFJcQvNSddHADDdZaWx0HnmMxRXG7g==}
+ engines: {node: '>= 18.19.0'}
+
resolution: {integrity: sha512-MY9W41IOWxxk31o+YvFCNyNzdkc9M20NoZK5vq6jkv4I/uh2zkWcfudj0Q1fovjUQJrNewS9NMzeTtqPf+n5EA==}
@@ -6248,24 +6298,24 @@ snapshots:
'@alloc/[email protected]': {}
dependencies:
'@assistant-ui/store': 0.2.20(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected])
'@assistant-ui/tap': 0.9.4(@types/[email protected])([email protected])
- assistant-stream: 0.3.26
+ assistant-stream: 0.3.26([email protected](@opentelemetry/[email protected]))
nanoid: 6.0.0
optionalDependencies:
'@types/react': 19.2.17
- assistant-cloud: 0.1.35
+ assistant-cloud: 0.1.35([email protected](@opentelemetry/[email protected]))
react: 19.2.8
transitivePeerDependencies:
- ioredis
- redis
dependencies:
'@assistant-ui/store': 0.2.20(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected])
'@assistant-ui/tap': 0.9.4(@types/[email protected])([email protected])
'@radix-ui/primitive': 1.1.7
@@ -6276,8 +6326,8 @@ snapshots:
'@radix-ui/react-use-callback-ref': 1.1.3(@types/[email protected])([email protected])
'@radix-ui/react-use-controllable-state': 1.2.5(@types/[email protected])([email protected])
'@radix-ui/react-use-escape-keydown': 1.1.4(@types/[email protected])([email protected])
- assistant-cloud: 0.1.35
- assistant-stream: 0.3.26
+ assistant-cloud: 0.1.35([email protected](@opentelemetry/[email protected]))
+ assistant-stream: 0.3.26([email protected](@opentelemetry/[email protected]))
nanoid: 6.0.0
react: 19.2.8
@@ -8810,6 +8860,28 @@ snapshots:
'@radix-ui/[email protected]': {}
+ '@redis/[email protected](@redis/[email protected](@opentelemetry/[email protected]))':
+ dependencies:
+ '@redis/client': 5.12.1(@opentelemetry/[email protected])
+
+ '@redis/[email protected](@opentelemetry/[email protected])':
+ dependencies:
+ cluster-key-slot: 1.1.2
+ optionalDependencies:
+ '@opentelemetry/api': 1.9.1
+
+ '@redis/[email protected](@redis/[email protected](@opentelemetry/[email protected]))':
+ dependencies:
+ '@redis/client': 5.12.1(@opentelemetry/[email protected])
+
+ '@redis/[email protected](@redis/[email protected](@opentelemetry/[email protected]))':
+ dependencies:
+ '@redis/client': 5.12.1(@opentelemetry/[email protected])
+
+ '@redis/[email protected](@redis/[email protected](@opentelemetry/[email protected]))':
+ dependencies:
+ '@redis/client': 5.12.1(@opentelemetry/[email protected])
+
'@rolldown/[email protected]': {}
'@rollup/[email protected]':
@@ -9010,10 +9082,10 @@ snapshots:
'@tabby_ai/[email protected]': {}
- '@truefoundry/[email protected](f645c8c3699fdf377e27e4913e1bf82b)':
+ '@truefoundry/[email protected](6dfffe383ee9b494dc775131178b257f)':
dependencies:
'@emotion/react': 11.14.0(@types/[email protected])([email protected])([email protected])
'@fortawesome/fontawesome-svg-core': 6.7.2
@@ -9023,7 +9095,7 @@ snapshots:
'@openuidev/react-lang': 0.2.8(@modelcontextprotocol/[email protected]([email protected])([email protected]))([email protected])([email protected])
- '@truefoundry/assistant-ui-runtime': 0.1.4(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected](patch_hash=2dd458ac139d735ffb9d9fadc203e4314f0a0f0c7338c365cc0bb4b4f4c8f6b4))([email protected](@types/[email protected])([email protected])([email protected]([email protected])))
+ '@truefoundry/assistant-ui-runtime': 0.1.4(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected](@opentelemetry/[email protected])))([email protected])([email protected](@opentelemetry/[email protected]))([email protected](patch_hash=2dd458ac139d735ffb9d9fadc203e4314f0a0f0c7338c365cc0bb4b4f4c8f6b4))([email protected](@types/[email protected])([email protected])([email protected]([email protected])))
class-variance-authority: 0.7.1
classnames: 2.5.1
clsx: 2.1.1
@@ -9047,9 +9119,9 @@ snapshots:
- zod
- zustand
dependencies:
'@assistant-ui/store': 0.2.20(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected])
react: 19.2.8
truefoundry-gateway-sdk: 0.4.0-rc.2(patch_hash=2dd458ac139d735ffb9d9fadc203e4314f0a0f0c7338c365cc0bb4b4f4c8f6b4)
@@ -9456,18 +9528,20 @@ snapshots:
dependencies:
tslib: 2.8.1
dependencies:
- assistant-stream: 0.3.26
+ assistant-stream: 0.3.26([email protected](@opentelemetry/[email protected]))
transitivePeerDependencies:
- ioredis
- redis
dependencies:
'@standard-schema/spec': 1.1.0
nanoid: 6.0.0
secure-json-parse: 4.1.0
+ optionalDependencies:
+ redis: 5.12.1(@opentelemetry/[email protected])
@@ -9709,6 +9783,8 @@ snapshots:
+
@@ -12261,6 +12337,17 @@ snapshots:
tiny-invariant: 1.3.3
victory-vendor: 36.9.2
+ dependencies:
+ '@redis/bloom': 5.12.1(@redis/[email protected](@opentelemetry/[email protected]))
+ '@redis/client': 5.12.1(@opentelemetry/[email protected])
+ '@redis/json': 5.12.1(@redis/[email protected](@opentelemetry/[email protected]))
+ '@redis/search': 5.12.1(@redis/[email protected](@opentelemetry/[email protected]))
+ '@redis/time-series': 5.12.1(@redis/[email protected](@opentelemetry/[email protected]))
+ transitivePeerDependencies:
+ - '@node-rs/xxhash'
+ - '@opentelemetry/api'
+
dependencies:
hastscript: 6.0.0