Persona: compile fixes and the regenerated wire schemas

The jsonschema error kind lives in jsonschema::error; the eureka-state tool
closures own their input; huginn.mind_request/response.v1 carry the persona
operations (derived by the existing published_wire_schemas test).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-10 05:47:00 +02:00
commit 6fde91fe0a
4 changed files with 224 additions and 4 deletions

View file

@ -260,7 +260,7 @@ impl EurekaState {
description = "Admit one batch of pipeline documents into the mind, whole or not at all. Returns the outcome: committed with a receipt, already admitted, conflict, or a typed refusal. The instance is this server's configuration; do not pass one."
)]
async fn admit(&self, Parameters(input): Parameters<AdmitInput>) -> CallToolResult {
self.answer(|instance| {
self.answer(move |instance| {
HuginnMindRequest::Admit(PipelineAdmissionBatch {
instance,
provenance: PipelineProvenance {
@ -277,14 +277,14 @@ impl EurekaState {
#[tool(description = "Read one document by id, with its admission facts and status. null when the mind has no such document.")]
async fn view(&self, Parameters(input): Parameters<ViewInput>) -> CallToolResult {
self.answer(|instance| HuginnMindRequest::View { instance, id: input.id }).await
self.answer(move |instance| HuginnMindRequest::View { instance, id: input.id }).await
}
#[tool(
description = "Query the mind with a CultNet typed selection, optionally ranked by semantic nearness. Returns one page; pass its cursor back in the selection for the next."
)]
async fn query(&self, Parameters(input): Parameters<QueryInput>) -> CallToolResult {
self.answer(|instance| HuginnMindRequest::Query {
self.answer(move |instance| HuginnMindRequest::Query {
instance,
selection: input.selection,
semantic: input.semantic,

View file

@ -13,7 +13,8 @@ use std::sync::OnceLock;
use cultcache_rs::{CultCacheEnvelope, DatabaseEntry};
use jsonschema::paths::LocationSegment;
use jsonschema::{ValidationErrorKind, Validator};
use jsonschema::error::ValidationErrorKind;
use jsonschema::Validator;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_json::Value;

View file

@ -78,6 +78,60 @@
"required": [
"Query"
]
},
{
"description": "The mind's persona document, if one is stored.",
"type": "object",
"properties": {
"PersonaGet": {
"type": "object",
"properties": {
"instance": {
"$ref": "#/$defs/Slug"
}
},
"required": [
"instance"
]
}
},
"additionalProperties": false,
"required": [
"PersonaGet"
]
},
{
"description": "Replaces the mind's persona document whole. `expected_updated_at` is\nthe stored document's `updatedAt`, none for the first put. The\nprovenance is the asker's, as for `Admit`.",
"type": "object",
"properties": {
"PersonaPut": {
"type": "object",
"properties": {
"expected_updated_at": {
"type": [
"string",
"null"
]
},
"instance": {
"$ref": "#/$defs/Slug"
},
"provenance": {
"$ref": "#/$defs/PipelineProvenance"
},
"state": true
},
"required": [
"instance",
"provenance",
"state"
]
}
},
"additionalProperties": false,
"required": [
"PersonaPut"
]
}
],
"$defs": {

View file

@ -70,6 +70,37 @@
"Refused"
]
},
{
"type": "object",
"properties": {
"Persona": {
"anyOf": [
{
"$ref": "#/$defs/PersonaStateView"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false,
"required": [
"Persona"
]
},
{
"type": "object",
"properties": {
"PersonaPut": {
"$ref": "#/$defs/PersonaPutOutcome"
}
},
"additionalProperties": false,
"required": [
"PersonaPut"
]
},
{
"description": "The answer did not fit one send and is being held for the client to\nfetch. Nothing in a mind produces this: the daemon's serve module does,\nin place of an answer, and the answer it stands for is the named\nMessagePack of the `HuginnMindResponse` the mind gave.",
"type": "object",
@ -1360,6 +1391,78 @@
"NotStewarded"
]
},
{
"description": "The persona document fails the published schema: `path` is the\ndocument location (a key the schema does not declare is `*`) and\n`message` the schema keyword that failed. Never the offending value.",
"type": "object",
"properties": {
"PersonaInvalid": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"path": {
"type": "string"
}
},
"required": [
"path",
"message"
]
}
},
"additionalProperties": false,
"required": [
"PersonaInvalid"
]
},
{
"description": "The document's `personaId` is not this mind's instance, which is\n`instance`.",
"type": "object",
"properties": {
"PersonaForeign": {
"type": "object",
"properties": {
"instance": {
"type": "string"
}
},
"required": [
"instance"
]
}
},
"additionalProperties": false,
"required": [
"PersonaForeign"
]
},
{
"description": "The put's `expected_updated_at` is not the stored document's\n`updatedAt`, which is `stored` (none when no persona is stored).",
"type": "object",
"properties": {
"PersonaStale": {
"type": "object",
"properties": {
"stored": {
"type": [
"string",
"null"
]
}
}
}
},
"additionalProperties": false,
"required": [
"PersonaStale"
]
},
{
"description": "The document's `provenance.authority` is not `canonical`: a projection\nor an import is not the mind's persona.",
"type": "string",
"const": "PersonaNotCanonical"
},
{
"description": "A run claims work another run in force already holds: `item` is the\nclaimed document's id and `run` the id of the run that holds it.",
"type": "object",
@ -1504,6 +1607,13 @@
"instance": {
"$ref": "#/$defs/Slug"
},
"persona": {
"description": "The stored persona document's `updatedAt`; none until the first put.",
"type": [
"string",
"null"
]
},
"receipts": {
"type": "integer",
"format": "uint32",
@ -1582,6 +1692,61 @@
"type": "string",
"maxLength": 4000
},
"PersonaPutOutcome": {
"description": "How a put ended. A refusal is an answer, as for `admit`.",
"oneOf": [
{
"type": "object",
"properties": {
"Committed": {
"type": "object",
"properties": {
"receipt_id": {
"type": "string"
}
},
"required": [
"receipt_id"
]
}
},
"additionalProperties": false,
"required": [
"Committed"
]
},
{
"type": "object",
"properties": {
"Refused": {
"$ref": "#/$defs/MindRefusal"
}
},
"additionalProperties": false,
"required": [
"Refused"
]
}
]
},
"PersonaStateView": {
"description": "What `PersonaGet` answers: the stored document, its `updatedAt`, and the\nreceipt of the put that wrote it.",
"type": "object",
"properties": {
"receipt_id": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"value": true
},
"required": [
"value",
"updated_at",
"receipt_id"
]
},
"PipelineAdmissionOutcome": {
"description": "How admission ended. `Committed.writes` names every document the batch\nlanded, derived writes included; Cut 11 indexes from it after `admit`\nreturns, and never inside it.",
"oneOf": [