mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
feat: checkpointWhen is required on Durable document definitions
Breaking change: defineDoc and defineDocFamily now require an explicit checkpointWhen predicate; no default is supplied. Set policies on built-in documents, examples, tests, and triage state, and document the required API.
This commit is contained in:
parent
e86b054753
commit
5c1736f82d
39 changed files with 231 additions and 16 deletions
|
|
@ -12,6 +12,7 @@ const session = createSession(new MemoryStorage());
|
|||
// looked like when a particular entry was written.
|
||||
// `fork` says what a forked copy of the conversation starts with (see 02-forks.ts).
|
||||
const Notes = defineDoc<{ text: string }>({
|
||||
checkpointWhen: () => false,
|
||||
kind: "example.notes",
|
||||
version: 1,
|
||||
scope: "conversation",
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ const context = BACKGROUND_CONTEXT;
|
|||
const session = createSession(new MemoryStorage());
|
||||
|
||||
const Notes = defineDoc<{ text: string }>({
|
||||
checkpointWhen: () => false,
|
||||
kind: "example.notes",
|
||||
version: 1,
|
||||
scope: "conversation",
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ const Supervisor = defineTask<null, { phase: "ready" }, null>({
|
|||
const AgentRegistry = defineDoc<{
|
||||
agents: Record<string, { conversationId: ConversationId; requestId: string }>;
|
||||
}>({
|
||||
checkpointWhen: () => false,
|
||||
kind: "example.agent-registry",
|
||||
version: 1,
|
||||
scope: "conversation",
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ const context = BACKGROUND_CONTEXT;
|
|||
const session = createSession(new MemoryStorage());
|
||||
|
||||
const Notes = defineDoc<{ text: string }>({
|
||||
checkpointWhen: () => false,
|
||||
kind: "example.notes",
|
||||
version: 1,
|
||||
scope: "conversation",
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ const context = BACKGROUND_CONTEXT;
|
|||
const session = createSession(new MemoryStorage());
|
||||
|
||||
const Notes = defineDoc<{ text: string }>({
|
||||
checkpointWhen: () => false,
|
||||
kind: "example.notes",
|
||||
version: 1,
|
||||
scope: "conversation",
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ registry.install(Files);
|
|||
const harness = await Harness.open(new MemoryStorage(), { models: createModels(), registry }, context);
|
||||
|
||||
const Notes = defineDoc<{ text: string }>({
|
||||
checkpointWhen: () => false,
|
||||
kind: "example.notes",
|
||||
version: 1,
|
||||
scope: "conversation",
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ const context = BACKGROUND_CONTEXT;
|
|||
// A todo list per conversation. Rewindable with `asOf`, so a fork starts with
|
||||
// the todos its parent had at the fork entry.
|
||||
const Todos = defineDoc<{ items: string[] }>({
|
||||
checkpointWhen: () => false,
|
||||
kind: "example.todos",
|
||||
version: 1,
|
||||
scope: "conversation",
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ type Subagent = {
|
|||
reported: EntryId[];
|
||||
};
|
||||
const Subagents = defineDoc<{ agents: Record<string, Subagent>; reporters: Record<string, TaskId> }>({
|
||||
checkpointWhen: () => false,
|
||||
kind: "app.subagents",
|
||||
version: 1,
|
||||
scope: "conversation",
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ const context = BACKGROUND_CONTEXT;
|
|||
|
||||
// The current plan of a conversation. A fork keeps the plan it had at the fork entry.
|
||||
const PlanDoc = defineDoc<{ steps: string[] }>({
|
||||
checkpointWhen: () => false,
|
||||
kind: "app.plan",
|
||||
version: 1,
|
||||
scope: "conversation",
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ const context = BACKGROUND_CONTEXT;
|
|||
|
||||
// Which sandbox a conversation runs in. `fork: "initial"`: a fork gets no sandbox until the app assigns one.
|
||||
const Sandbox = defineDoc<{ path?: string }>({
|
||||
checkpointWhen: () => false,
|
||||
kind: "app.sandbox",
|
||||
version: 1,
|
||||
scope: "conversation",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue