/**
 * Persisted session entries plus the `RuntimeSessionStore` interface the
 * runtime uses to read and append them.
 */
/** Type guard: does the value satisfy the AgentMessage shape required by the runtime? */
function isRuntimeSessionMessage(value) {
    if (!value || typeof value !== 'object') {
        return false;
    }
    const candidate = value;
    if (typeof candidate.role !== 'string') {
        return false;
    }
    if (typeof candidate.content !== 'string' && !Array.isArray(candidate.content)) {
        return false;
    }
    return candidate.timestamp === undefined || typeof candidate.timestamp === 'number';
}
/** Type guard validating that an unknown value matches the AgentSessionContext shape. */
export function isAgentSessionContext(value) {
    if (!value || typeof value !== 'object') {
        return false;
    }
    const candidate = value;
    if (!Array.isArray(candidate.messages) ||
        !candidate.messages.every((message) => isRuntimeSessionMessage(message)) ||
        typeof candidate.thinkingLevel !== 'string') {
        return false;
    }
    if (candidate.messageEntryIds !== undefined &&
        (!Array.isArray(candidate.messageEntryIds) ||
            candidate.messageEntryIds.length !== candidate.messages.length ||
            !candidate.messageEntryIds.every((id) => typeof id === 'string'))) {
        return false;
    }
    return (candidate.model === null ||
        candidate.model === undefined ||
        (typeof candidate.model === 'object' &&
            candidate.model !== null &&
            typeof candidate.model.provider === 'string' &&
            typeof candidate.model.modelId === 'string'));
}
//# sourceMappingURL=agent-session-store.js.map