Files
t3code/packages/contracts/src/threadUsage.ts
T
Julius Marminge ca41079cd9 Tighten thread activity schemas and context window usage
- Model orchestration activities with typed payloads
- Drop obsolete provider runtime event mappings
- Improve context window snapshot derivation
2026-03-26 00:12:12 -07:00

23 lines
998 B
TypeScript

import { Schema } from "effect";
import { NonNegativeInt, PositiveInt } from "./baseSchemas";
export const ThreadTokenUsageSnapshot = Schema.Struct({
usedTokens: NonNegativeInt,
totalProcessedTokens: Schema.optional(NonNegativeInt),
maxTokens: Schema.optional(PositiveInt),
inputTokens: Schema.optional(NonNegativeInt),
cachedInputTokens: Schema.optional(NonNegativeInt),
outputTokens: Schema.optional(NonNegativeInt),
reasoningOutputTokens: Schema.optional(NonNegativeInt),
lastUsedTokens: Schema.optional(NonNegativeInt),
lastInputTokens: Schema.optional(NonNegativeInt),
lastCachedInputTokens: Schema.optional(NonNegativeInt),
lastOutputTokens: Schema.optional(NonNegativeInt),
lastReasoningOutputTokens: Schema.optional(NonNegativeInt),
toolUses: Schema.optional(NonNegativeInt),
durationMs: Schema.optional(NonNegativeInt),
compactsAutomatically: Schema.optional(Schema.Boolean),
});
export type ThreadTokenUsageSnapshot = typeof ThreadTokenUsageSnapshot.Type;