Files
t3code/packages/client-runtime/src/platform/orchestrationCache.ts
T
Julius Marminge f456ee9630 Complete orchestration V2 frontend cutover
- Migrate web and mobile state, commands, and persistence to V2 projections
- Render conversations from authoritative visible turn items
- Harden runtime policy, launch handling, attachments, and cache invalidation
2026-08-15 16:49:33 +02:00

33 lines
1.1 KiB
TypeScript

import {
EnvironmentId,
OrchestrationV2ShellSnapshot,
OrchestrationV2ThreadProjection,
ThreadId,
} from "@t3tools/contracts";
import * as Effect from "effect/Effect";
import * as Option from "effect/Option";
import * as Schema from "effect/Schema";
export const ORCHESTRATION_CACHE_SCHEMA_VERSION = 2 as const;
export const StoredOrchestrationShellSnapshot = Schema.Struct({
schemaVersion: Schema.Literal(ORCHESTRATION_CACHE_SCHEMA_VERSION),
environmentId: EnvironmentId,
snapshot: OrchestrationV2ShellSnapshot,
});
export const StoredOrchestrationThreadSnapshot = Schema.Struct({
schemaVersion: Schema.Literal(ORCHESTRATION_CACHE_SCHEMA_VERSION),
environmentId: EnvironmentId,
threadId: ThreadId,
thread: OrchestrationV2ThreadProjection,
});
/** Invalid orchestration caches are disposable and must never block live synchronization. */
export function decodeOrDiscardOrchestrationCache<A, E, R, E2, R2>(
decode: Effect.Effect<Option.Option<A>, E, R>,
discard: Effect.Effect<void, E2, R2>,
) {
return decode.pipe(Effect.catch(() => discard.pipe(Effect.as(Option.none<A>()))));
}