amfs-adapter-postgres 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (17) hide show
  1. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/PKG-INFO +1 -1
  2. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/pyproject.toml +1 -1
  3. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/src/amfs_postgres/adapter.py +13 -1
  4. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/.gitignore +0 -0
  5. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/src/amfs_postgres/__init__.py +0 -0
  6. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/src/amfs_postgres/_fts.py +0 -0
  7. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/src/amfs_postgres/async_adapter.py +0 -0
  8. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/src/amfs_postgres/migrations/001_initial.sql +0 -0
  9. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/src/amfs_postgres/migrations/002_artifact_refs.sql +0 -0
  10. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/src/amfs_postgres/migrations/002_search_indexes.sql +0 -0
  11. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/src/amfs_postgres/migrations/003_knowledge_graph.sql +0 -0
  12. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/src/amfs_postgres/migrations/004_agent_groups.sql +0 -0
  13. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/src/amfs_postgres/migrations/005_configurable_embedding_dim.sql +0 -0
  14. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/src/amfs_postgres/migrations/006_is_artifact.sql +0 -0
  15. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/src/amfs_postgres/migrations/006_outcome_confidence_semantics.sql +0 -0
  16. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/src/amfs_postgres/schema.sql +0 -0
  17. {amfs_adapter_postgres-0.2.1 → amfs_adapter_postgres-0.2.2}/src/amfs_postgres/tenant_context.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: amfs-adapter-postgres
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: AMFS Postgres adapter with back-propagation triggers
5
5
  License-Expression: Apache-2.0
6
6
  Requires-Python: >=3.11
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "amfs-adapter-postgres"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "AMFS Postgres adapter with back-propagation triggers"
5
5
  requires-python = ">=3.11"
6
6
  license = "Apache-2.0"
@@ -60,6 +60,7 @@ from amfs_core.models import (
60
60
  QueryEvent,
61
61
  SearchQuery,
62
62
  SemanticQuery,
63
+ SessionMetadata,
63
64
  Tag,
64
65
  ToolCall,
65
66
  TraceEntry,
@@ -2595,7 +2596,18 @@ class PostgresAdapter(AdapterABC):
2595
2596
  trace.session_duration_ms,
2596
2597
  json.dumps([e.model_dump(mode="json") for e in trace.error_events]),
2597
2598
  json.dumps(trace.state_diff.model_dump(mode="json")) if trace.state_diff else None,
2598
- json.dumps(trace.session_metadata) if trace.session_metadata else "{}",
2599
+ # Dumped like every other model field on this row. The
2600
+ # field is typed, so anything arriving over
2601
+ # ``POST /api/v1/traces`` is a ``SessionMetadata`` by the
2602
+ # time it reaches here and ``json.dumps`` cannot encode
2603
+ # it — the trace was lost with a 500. A plain dict still
2604
+ # gets through ``model_copy(update=...)``, which does not
2605
+ # validate, so both shapes are accepted.
2606
+ json.dumps(
2607
+ trace.session_metadata.model_dump(mode="json")
2608
+ if isinstance(trace.session_metadata, SessionMetadata)
2609
+ else trace.session_metadata
2610
+ ) if trace.session_metadata else "{}",
2599
2611
  trace.created_at,
2600
2612
  trace.task_input,
2601
2613
  trace.response_text,