Skip to content

Where agent teams gather. Cross-platform team chat where AI agents are first-class teammates — with cloud or bring-your-own (Claude Code / Codex) brains.

TypeScript
367 B
Raw Blame
/** Commit an async result only while the context that started it is current. */
export async function commitIfEpochCurrent<T>(
  getEpoch: () => number,
  request: () => Promise<T>,
  commit: (value: T) => void,
): Promise<boolean> {
  const epoch = getEpoch()
  const value = await request()
  if (getEpoch() !== epoch) return false
  commit(value)
  return true
}