refactor(agent): share session register key helper

This commit is contained in:
David Brailovsky 2026-08-14 12:49:49 +02:00
parent 7edcfe25e4
commit a2fd9783f5
2 changed files with 2 additions and 6 deletions

View file

@ -1,7 +1,7 @@
import { type Usage, uuidv7 } from "@earendil-works/pi-ai";
import type { AgentMessage } from "../../types.ts";
import { StorageBackedSession } from "./session.ts";
import { StorageState, type StorageStateSnapshot } from "./storage-state.ts";
import { registerKey, StorageState, type StorageStateSnapshot } from "./storage-state.ts";
import type {
BranchScan,
CommitResult,
@ -37,10 +37,6 @@ export interface MemorySessionRepoOptions {
now?: () => number;
}
function registerKey(namespace: RegisterNamespace, key: string): string {
return `${namespace}\u0000${key}`;
}
function isRegisterNamespace<TNamespace extends RegisterNamespace>(
register: Register,
namespace: TNamespace,

View file

@ -32,7 +32,7 @@ export interface StorageStateSnapshot {
nextSeq: number;
}
function registerKey(namespace: RegisterNamespace, key: string): string {
export function registerKey(namespace: RegisterNamespace, key: string): string {
return `${namespace}\u0000${key}`;
}