feat(session): define explicit fork boundaries

This commit is contained in:
Dax Raad 2026-07-29 09:49:35 -04:00
commit fc11ed3838
29 changed files with 821 additions and 386 deletions

View file

@ -1145,7 +1145,14 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/InvalidRequestError"
"anyOf": [
{
"$ref": "#/components/schemas/InvalidRequestError1"
},
{
"$ref": "#/components/schemas/InvalidRequestError"
}
]
}
}
}
@ -1181,7 +1188,7 @@
}
}
},
"description": "Create a child session by copying projected history from the parent. When messageID is supplied, copy messages before that boundary.",
"description": "Create a child session by copying projected history through or before a message boundary.",
"summary": "Fork session",
"requestBody": {
"content": {
@ -1189,22 +1196,13 @@
"schema": {
"type": "object",
"properties": {
"messageID": {
"anyOf": [
{
"type": "string",
"allOf": [
{
"pattern": "^msg_"
}
]
},
{
"type": "null"
}
]
"boundary": {
"$ref": "#/components/schemas/Session.ForkRequestBoundary"
}
},
"required": [
"boundary"
],
"additionalProperties": false
}
}
@ -12223,6 +12221,58 @@
],
"additionalProperties": false
},
"Session.ForkBoundary": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"before"
]
},
"messageID": {
"type": "string",
"allOf": [
{
"pattern": "^msg_"
}
]
}
},
"required": [
"type",
"messageID"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"through"
]
},
"messageID": {
"type": "string",
"allOf": [
{
"pattern": "^msg_"
}
]
}
},
"required": [
"type",
"messageID"
],
"additionalProperties": false
}
]
},
"Money.USD": {
"type": "number"
},
@ -12385,17 +12435,13 @@
}
]
},
"messageID": {
"type": "string",
"allOf": [
{
"pattern": "^msg_"
}
]
"boundary": {
"$ref": "#/components/schemas/Session.ForkBoundary"
}
},
"required": [
"sessionID"
"sessionID",
"boundary"
],
"additionalProperties": false
},
@ -12595,6 +12641,49 @@
],
"additionalProperties": false
},
"Session.ForkRequestBoundary": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"before"
]
},
"messageID": {
"type": "string",
"allOf": [
{
"pattern": "^msg_"
}
]
}
},
"required": [
"type",
"messageID"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"through"
]
}
},
"required": [
"type"
],
"additionalProperties": false
}
]
},
"MessageNotFoundError": {
"type": "object",
"properties": {
@ -12783,14 +12872,6 @@
"SessionPending.User": {
"type": "object",
"properties": {
"admittedSeq": {
"type": "integer",
"allOf": [
{
"minimum": 0
}
]
},
"id": {
"type": "string",
"allOf": [
@ -12828,7 +12909,6 @@
}
},
"required": [
"admittedSeq",
"id",
"sessionID",
"timeCreated",
@ -12957,14 +13037,6 @@
"SessionPending.Synthetic": {
"type": "object",
"properties": {
"admittedSeq": {
"type": "integer",
"allOf": [
{
"minimum": 0
}
]
},
"id": {
"type": "string",
"allOf": [
@ -13002,7 +13074,6 @@
}
},
"required": [
"admittedSeq",
"id",
"sessionID",
"timeCreated",
@ -13015,14 +13086,6 @@
"SessionPending.Compaction": {
"type": "object",
"properties": {
"admittedSeq": {
"type": "integer",
"allOf": [
{
"minimum": 0
}
]
},
"id": {
"type": "string",
"allOf": [
@ -13050,7 +13113,6 @@
}
},
"required": [
"admittedSeq",
"id",
"sessionID",
"timeCreated",
@ -13705,7 +13767,14 @@
"type": "string"
},
"name": {
"type": "string"
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
@ -13715,7 +13784,7 @@
],
"additionalProperties": false
},
"LLM.ToolContent": {
"Tool.Content": {
"anyOf": [
{
"$ref": "#/components/schemas/Tool.TextContent"
@ -13741,12 +13810,12 @@
"type": "array",
"prefixItems": [
{
"$ref": "#/components/schemas/LLM.ToolContent"
"$ref": "#/components/schemas/Tool.Content"
}
],
"minItems": 1,
"items": {
"$ref": "#/components/schemas/LLM.ToolContent"
"$ref": "#/components/schemas/Tool.Content"
}
},
"metadata": {
@ -13795,12 +13864,12 @@
"type": "array",
"prefixItems": [
{
"$ref": "#/components/schemas/LLM.ToolContent"
"$ref": "#/components/schemas/Tool.Content"
}
],
"minItems": 1,
"items": {
"$ref": "#/components/schemas/LLM.ToolContent"
"$ref": "#/components/schemas/Tool.Content"
}
},
"metadata": {
@ -14829,27 +14898,27 @@
}
]
},
"parentSeq": {
"type": "integer",
"allOf": [
{
"minimum": -1
}
]
"boundary": {
"$ref": "#/components/schemas/Session.ForkBoundary"
},
"from": {
"type": "string",
"allOf": [
{
"pattern": "^msg_"
"instructions": {
"type": "object",
"patternProperties": {
"^[a-z0-9][a-z0-9._-]*\\/[a-z0-9][a-z0-9._/-]*$": {
"type": "string",
"allOf": [
{
"pattern": "^[a-f0-9]{64}$"
}
]
}
]
}
}
},
"required": [
"sessionID",
"parentID",
"parentSeq"
"boundary"
],
"additionalProperties": false
}
@ -17114,6 +17183,49 @@
],
"additionalProperties": false
},
"Tool.FileContent1": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"file"
]
},
"uri": {
"type": "string"
},
"mime": {
"type": "string"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"uri",
"mime"
],
"additionalProperties": false
},
"Tool.Content1": {
"anyOf": [
{
"$ref": "#/components/schemas/Tool.TextContent"
},
{
"$ref": "#/components/schemas/Tool.FileContent1"
}
]
},
"Session.Message.ProviderState8": {
"type": "object"
},
@ -17197,12 +17309,12 @@
"type": "array",
"prefixItems": [
{
"$ref": "#/components/schemas/LLM.ToolContent"
"$ref": "#/components/schemas/Tool.Content1"
}
],
"minItems": 1,
"items": {
"$ref": "#/components/schemas/LLM.ToolContent"
"$ref": "#/components/schemas/Tool.Content1"
}
},
"metadata": {
@ -17320,12 +17432,12 @@
"type": "array",
"prefixItems": [
{
"$ref": "#/components/schemas/LLM.ToolContent"
"$ref": "#/components/schemas/Tool.Content1"
}
],
"minItems": 1,
"items": {
"$ref": "#/components/schemas/LLM.ToolContent"
"$ref": "#/components/schemas/Tool.Content1"
}
},
"metadata": {