fix message id range validation error (#300)
* fix: documents message_ids validation error * feat: version bump to 2.5.1 * chore: bump core dependencies to 1.8.0
This commit is contained in:
parent
9c9c37f196
commit
a42252867f
|
|
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [2.5.1] - 2025-12-15
|
||||
|
||||
### Fixed
|
||||
|
||||
- Backwards compatibility for `message_ids` field in documents to handle legacy tuple format
|
||||
|
||||
## [2.5.0] - 2025-12-03
|
||||
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
---
|
||||
|
||||

|
||||

|
||||
[](https://pypi.org/project/honcho-ai/)
|
||||
[](https://npmjs.org/package/@honcho-ai/sdk)
|
||||
[](https://discord.gg/plasticlabs)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ This guide helps you understand which versions of Honcho's API are compatible wi
|
|||
|
||||
## Version Compatibility
|
||||
|
||||
### Honcho API v2.5.0 (Current)
|
||||
### Honcho API v2.5.1 (Current)
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="TypeScript SDK" icon="js">
|
||||
|
|
@ -34,7 +34,8 @@ This guide helps you understand which versions of Honcho's API are compatible wi
|
|||
|
||||
| Honcho API Version | TypeScript SDK | Python SDK |
|
||||
|-------------------|---------------|------------|
|
||||
| v2.5.0 (Current) | v1.6.0 | v1.6.0 |
|
||||
| v2.5.1 (Current) | v1.6.0 | v1.6.0 |
|
||||
| v2.5.0 | v1.6.0 | v1.6.0 |
|
||||
| v2.4.3 | v1.5.0 | v1.5.0 |
|
||||
| v2.4.2 | v1.5.0 | v1.5.0 |
|
||||
| v2.4.1 | v1.5.0 | v1.5.0 |
|
||||
|
|
|
|||
|
|
@ -27,7 +27,13 @@ Welcome to the Honcho changelog! This section documents all notable changes to t
|
|||
### Honcho API and SDK Changelogs
|
||||
<Tabs>
|
||||
<Tab title="Honcho API">
|
||||
<Update label="v2.5.0 (Current)">
|
||||
<Update label="v2.5.1 (Current)">
|
||||
### Fixed
|
||||
|
||||
- Backwards compatibility for `message_ids` field in documents to handle legacy tuple format
|
||||
</Update>
|
||||
|
||||
<Update label="v2.5.0">
|
||||
### Added
|
||||
|
||||
- Message level configurations
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
"navigation": {
|
||||
"versions": [
|
||||
{
|
||||
"version": "v2.5.0",
|
||||
"version": "v2.5.1",
|
||||
"api": {
|
||||
"openapi": [
|
||||
"openapi.json"
|
||||
|
|
|
|||
2318
docs/v2/openapi.json
2318
docs/v2/openapi.json
File diff suppressed because it is too large
Load Diff
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "honcho"
|
||||
version = "2.5.0"
|
||||
version = "2.5.1"
|
||||
description = "Honcho Server"
|
||||
authors = [
|
||||
{name = "Plastic Labs", email = "hello@plasticlabs.ai"},
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ authors = [
|
|||
{ name = "Plastic Labs", email = "hello@plasticlabs.ai" },
|
||||
]
|
||||
dependencies = [
|
||||
"honcho-core>=1.7.0",
|
||||
"honcho-core>=1.8.0",
|
||||
"httpx>=0.28.0, <1",
|
||||
"pydantic>=2.0.0, <3",
|
||||
"typing-extensions>=4.12.0; python_version < \"3.12\"",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"": {
|
||||
"name": "@honcho-ai/sdk",
|
||||
"dependencies": {
|
||||
"@honcho-ai/core": "^1.7.0",
|
||||
"@honcho-ai/core": "^1.8.0",
|
||||
"@types/node": "^24.0.1",
|
||||
"zod": "4.0.0",
|
||||
},
|
||||
|
|
@ -106,7 +106,7 @@
|
|||
|
||||
"@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.3.8", "", { "os": "win32", "cpu": "x64" }, "sha512-RguzimPoZWtBapfKhKjcWXBVI91tiSprqdBYu7tWhgN8pKRZhw24rFeNZTNf6UiBfjCYCi9eFQs/JzJZIhuK4w=="],
|
||||
|
||||
"@honcho-ai/core": ["@honcho-ai/core@1.7.0", "", { "dependencies": { "@types/node": "^18.11.18", "@types/node-fetch": "^2.6.4", "abort-controller": "^3.0.0", "agentkeepalive": "^4.2.1", "form-data-encoder": "1.7.2", "formdata-node": "^4.3.2", "node-fetch": "^2.6.7" } }, "sha512-ZZsRlz0DgXaWj5z81KKcw4dLlwSxHqsxuG/Gb9vaozqJa8SSj09IGMm3kJjRTxNOD/AhHxOxAX3l6WEq4VZL5g=="],
|
||||
"@honcho-ai/core": ["@honcho-ai/core@1.8.0", "", { "dependencies": { "@types/node": "^18.11.18", "@types/node-fetch": "^2.6.4", "abort-controller": "^3.0.0", "agentkeepalive": "^4.2.1", "form-data-encoder": "1.7.2", "formdata-node": "^4.3.2", "node-fetch": "^2.6.7" } }, "sha512-qxBNoXLezH8yx4iBoz4Bsxkm9zp4Gm1fNwuP8gHRdSelxhR0dXpvLffx8B5V0XFWsx+SfPaJFyaKw0X2sYMwLA=="],
|
||||
|
||||
"@istanbuljs/load-nyc-config": ["@istanbuljs/load-nyc-config@1.1.0", "", { "dependencies": { "camelcase": "^5.3.1", "find-up": "^4.1.0", "get-package-type": "^0.1.0", "js-yaml": "^3.13.1", "resolve-from": "^5.0.0" } }, "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ=="],
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
"test:coverage": "jest --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@honcho-ai/core": "^1.7.0",
|
||||
"@honcho-ai/core": "^1.8.0",
|
||||
"@types/node": "^24.0.1",
|
||||
"zod": "4.0.0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ from src.utils.queue_payload import DreamPayload
|
|||
from src.utils.representation import (
|
||||
ExplicitObservation,
|
||||
Representation,
|
||||
flatten_message_ids,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -202,7 +203,7 @@ async def _consolidate_cluster(
|
|||
# NOTE: other kinds of observations here in the future
|
||||
|
||||
metadata = schemas.DocumentMetadata(
|
||||
message_ids=obs.message_ids,
|
||||
message_ids=flatten_message_ids(obs.message_ids),
|
||||
message_created_at=format_datetime_utc(obs.created_at),
|
||||
premises=premises,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ app = FastAPI(
|
|||
title="Honcho API",
|
||||
summary="The Identity Layer for the Agentic World",
|
||||
description="""Honcho is a platform for giving agents user-centric memory and social cognition""",
|
||||
version="2.5.0",
|
||||
version="2.5.1",
|
||||
contact={
|
||||
"name": "Plastic Labs",
|
||||
"url": "https://honcho.dev",
|
||||
|
|
|
|||
|
|
@ -8,6 +8,40 @@ from src import models
|
|||
from src.utils.formatting import parse_datetime_iso
|
||||
|
||||
|
||||
def flatten_message_ids(
|
||||
message_ids: list[int] | list[list[int]] | list[tuple[int, int]],
|
||||
) -> list[int]:
|
||||
"""
|
||||
Flatten message_ids that may be in old tuple format or nested list format.
|
||||
|
||||
This handles backwards compatibility with the old schema where message_ids
|
||||
was list[tuple[int, int]] representing ranges, and the new schema where
|
||||
it's list[int] representing individual message IDs.
|
||||
|
||||
Args:
|
||||
message_ids: Either a flat list of ints, nested list, or list of tuples
|
||||
|
||||
Returns:
|
||||
A flat list of unique message IDs, sorted
|
||||
|
||||
Examples:
|
||||
[1, 2, 3] -> [1, 2, 3]
|
||||
[[1, 2], [3, 4]] -> [1, 2, 3, 4]
|
||||
[(105, 105)] -> [105]
|
||||
[[105, 105]] -> [105]
|
||||
"""
|
||||
result: list[int] = []
|
||||
for item in message_ids:
|
||||
if isinstance(item, (list | tuple)):
|
||||
# Nested list or tuple - flatten it
|
||||
result.extend(item)
|
||||
else:
|
||||
# Already flat
|
||||
result.append(item)
|
||||
# Remove duplicates and sort
|
||||
return sorted(set(result))
|
||||
|
||||
|
||||
class ObservationMetadata(BaseModel):
|
||||
created_at: datetime
|
||||
message_ids: list[int]
|
||||
|
|
@ -267,7 +301,9 @@ class Representation(BaseModel):
|
|||
doc.internal_metadata, doc.created_at
|
||||
),
|
||||
content=doc.content,
|
||||
message_ids=doc.internal_metadata.get("message_ids", []),
|
||||
message_ids=flatten_message_ids(
|
||||
doc.internal_metadata.get("message_ids", [])
|
||||
),
|
||||
session_name=doc.session_name,
|
||||
)
|
||||
for doc in documents
|
||||
|
|
@ -279,7 +315,9 @@ class Representation(BaseModel):
|
|||
doc.internal_metadata, doc.created_at
|
||||
),
|
||||
conclusion=doc.content,
|
||||
message_ids=doc.internal_metadata.get("message_ids", []),
|
||||
message_ids=flatten_message_ids(
|
||||
doc.internal_metadata.get("message_ids", [])
|
||||
),
|
||||
session_name=doc.session_name,
|
||||
premises=doc.internal_metadata.get("premises", []),
|
||||
)
|
||||
|
|
|
|||
12
uv.lock
12
uv.lock
|
|
@ -1,5 +1,5 @@
|
|||
version = 1
|
||||
revision = 2
|
||||
revision = 3
|
||||
requires-python = ">=3.10"
|
||||
resolution-markers = [
|
||||
"python_full_version >= '3.13'",
|
||||
|
|
@ -710,7 +710,7 @@ wheels = [
|
|||
|
||||
[[package]]
|
||||
name = "honcho"
|
||||
version = "2.5.0"
|
||||
version = "2.5.1"
|
||||
source = { virtual = "." }
|
||||
dependencies = [
|
||||
{ name = "alembic" },
|
||||
|
|
@ -826,7 +826,7 @@ dev = [
|
|||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "honcho-core", specifier = ">=1.7.0" },
|
||||
{ name = "honcho-core", specifier = ">=1.8.0" },
|
||||
{ name = "httpx", specifier = ">=0.28.0,<1" },
|
||||
{ name = "pydantic", specifier = ">=2.0.0,<3" },
|
||||
{ name = "typing-extensions", marker = "python_full_version < '3.12'", specifier = ">=4.12.0" },
|
||||
|
|
@ -837,7 +837,7 @@ dev = [{ name = "ruff", specifier = ">=0.11.13" }]
|
|||
|
||||
[[package]]
|
||||
name = "honcho-core"
|
||||
version = "1.7.0"
|
||||
version = "1.8.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
|
|
@ -847,9 +847,9 @@ dependencies = [
|
|||
{ name = "sniffio" },
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/9e/75/0185a8b1c85d6947b3c7fe1a3ee5793fdedb944aec4798a370fcc27ec34f/honcho_core-1.7.0.tar.gz", hash = "sha256:b2eac28bc8b47ef8a1da404a1fce12180f12a8ea014f2bd68ad95d6e37bf90c4", size = 145919, upload-time = "2025-12-10T16:05:09.387Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/c8/ea/c0949bbac5a9f20625bdb152b7da2350e89ffc15b5862cd6094b464cde14/honcho_core-1.8.0.tar.gz", hash = "sha256:ffe0840639651640722ad0ed38d193cc9402b077dac3e6726ac7be551398d952", size = 142469, upload-time = "2025-12-15T19:27:59.555Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/6b/4d/74611a5055116ae683b5b256349f23913b2e35cc2ea2d96c28a5ddf23e76/honcho_core-1.7.0-py3-none-any.whl", hash = "sha256:2d9b31b0439513518e3156a798f5096fd92ab71fe46bc40b4b5507e23dd1116f", size = 148271, upload-time = "2025-12-10T16:05:07.964Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4a/9a/5aba73353c7e70d331a21e01a931c951c5bd8688fb25e5fc318517f2adf9/honcho_core-1.8.0-py3-none-any.whl", hash = "sha256:30a44b7d421328dfac015e8a6ecbe09c89b6cac9f3a913262244e7d15698a8a8", size = 140580, upload-time = "2025-12-15T19:27:58.562Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
Loading…
Reference in New Issue