Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,5 @@ const table = sqliteTable("session", {
- Keep delivery vocabulary explicit. Prompts steer by default and promote at the next safe step boundary while the current drain requires continuation. An explicit `queue` input remains pending until the Session would otherwise become idle; promote one queued input at that boundary, then reevaluate continuation before promoting another. Promoting any new user input resets the selected agent's step allowance; a batch of steers resets it once.
- One step is one logical LLM call; its durable record covers only the model-visible span. Do not write "provider turn", and do not use bare "turn" for a single call: "turn" is reserved for the future assistant-turn unit containing all steps from prompt promotion until the session would go idle.
- Keep EventV2 replay owner claims separate from clustered Session execution ownership.
- Keep the Instructions algebra and built-ins in `src/instructions`; keep instruction producers with their observed domains, and keep Session History selection plus `InstructionCheckpoint` and `InstructionEntry` persistence Session-owned. `InstructionDiscovery` observes ambient global and upward-project instructions. The runner composes built-ins, discovery, guidance, and entries explicitly in `loadInstructions`; there is no instruction registry.
- The durable `Instructions.Applied` record is what the model was last told, per instruction source. Reconciliation narrates drift through `session.instructions.updated` and never rewrites the baseline; only completed compaction rebaselines, while Session movement or committed revert resets the `InstructionCheckpoint`. Unavailable sources keep the model's prior belief, blocking only a Session's first instruction baseline.
- Keep the Instructions algebra and built-ins in `src/instructions`; keep instruction producers with their observed domains, and keep Session History selection plus `InstructionState` and `InstructionEntry` persistence Session-owned. `InstructionDiscovery` observes ambient global and upward-project instructions. The runner composes built-ins, discovery, guidance, and entries explicitly in `loadInstructions`; there is no instruction registry.
- `session.instructions.updated` stores only changed source keys and content hashes. Blob values live once in `instruction_blob`; `instruction_state` is a rebuildable fold cache, never primary state. Render initial instructions and chronological updates from values during request assembly. Completed compaction moves the instruction epoch; Session movement and committed revert clear it. Unavailable sources retain the last value and block only the initial complete delta.
62 changes: 31 additions & 31 deletions CONTEXT.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/client/src/promise/generated/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ export function make(options: ClientOptions) {
path: `/api/session/${encodeURIComponent(input.sessionID)}/instructions/entries/${encodeURIComponent(input.key)}`,
body: { value: input["value"] },
successStatus: 204,
declaredStatuses: [404, 400, 401],
declaredStatuses: [404, 413, 400, 401],
empty: true,
},
requestOptions,
Expand Down
28 changes: 20 additions & 8 deletions packages/client/src/promise/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ export type UnknownError = {
export const isUnknownError = (value: unknown): value is UnknownError =>
typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "UnknownError"

export type InstructionEntryValueTooLargeError = {
readonly _tag: "InstructionEntryValueTooLargeError"
readonly actualBytes: number
readonly maxBytes: number
readonly message: string
}
export const isInstructionEntryValueTooLargeError = (value: unknown): value is InstructionEntryValueTooLargeError =>
typeof value === "object" &&
value !== null &&
"_tag" in value &&
value["_tag"] === "InstructionEntryValueTooLargeError"

export type ProviderNotFoundError = {
readonly _tag: "ProviderNotFoundError"
readonly providerID: string
Expand Down Expand Up @@ -1250,9 +1262,9 @@ export type SessionLogOutput =
created: number
metadata?: { [x: string]: unknown }
type: "session.forked"
durable: { aggregateID: string; seq: number; version: 1 }
durable: { aggregateID: string; seq: number; version: 2 }
location?: { directory: string; workspaceID?: string }
data: { sessionID: string; parentID: string; from?: string }
data: { sessionID: string; parentID: string; parentSeq: number; from?: string }
}
| {
id: string
Expand Down Expand Up @@ -1339,9 +1351,9 @@ export type SessionLogOutput =
created: number
metadata?: { [x: string]: unknown }
type: "session.instructions.updated"
durable: { aggregateID: string; seq: number; version: 1 }
durable: { aggregateID: string; seq: number; version: 2 }
location?: { directory: string; workspaceID?: string }
data: { sessionID: string; text: string }
data: { sessionID: string; delta: { [x: string]: string | "removed" } }
}
| {
id: string
Expand Down Expand Up @@ -4734,9 +4746,9 @@ export type EventSubscribeOutput =
created: number
metadata?: { [x: string]: unknown }
type: "session.forked"
durable: { aggregateID: string; seq: number; version: 1 }
durable: { aggregateID: string; seq: number; version: 2 }
location?: { directory: string; workspaceID?: string }
data: { sessionID: string; parentID: string; from?: string }
data: { sessionID: string; parentID: string; parentSeq: number; from?: string }
}
| {
id: string
Expand Down Expand Up @@ -4823,9 +4835,9 @@ export type EventSubscribeOutput =
created: number
metadata?: { [x: string]: unknown }
type: "session.instructions.updated"
durable: { aggregateID: string; seq: number; version: 1 }
durable: { aggregateID: string; seq: number; version: 2 }
location?: { directory: string; workspaceID?: string }
data: { sessionID: string; text: string }
data: { sessionID: string; delta: { [x: string]: string | "removed" } }
}
| {
id: string
Expand Down
Loading
Loading