adopt-schema 0.3.0__py3-none-any.whl

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.
@@ -0,0 +1,30 @@
1
+ """Manifest loader, four emitters, the additive-only linter, and migrations.
2
+
3
+ `schema/canonical.yaml` is the single source of truth for all 37 tables at
4
+ ``schema_version = 3``. Every realization is generated from it and none is
5
+ hand-edited; ``adopt-schema generate --check`` fails on drift.
6
+
7
+ Invariant carried forward from the implementation spec: the manifest is the only
8
+ schema authority, no emitter reads a database, and there is no version 1 or 2 in
9
+ this schema line.
10
+ """
11
+
12
+ from adopt_schema.manifest import (
13
+ Column,
14
+ EnumDecl,
15
+ Index,
16
+ Manifest,
17
+ ScopeRef,
18
+ Table,
19
+ load_manifest,
20
+ )
21
+
22
+ __all__ = [
23
+ "Column",
24
+ "EnumDecl",
25
+ "Index",
26
+ "Manifest",
27
+ "ScopeRef",
28
+ "Table",
29
+ "load_manifest",
30
+ ]
@@ -0,0 +1,34 @@
1
+ -- Runtime annex, version 1 -- contracts §12, ratified as CR-08 on 2026-08-06.
2
+ --
3
+ -- This file is NOT part of the canonical schema and NOT part of `schema_version`.
4
+ -- It is hand-written on purpose: the manifest is the authority for everything a
5
+ -- client can be handed, and `agent_run` is deliberately not that. It holds
6
+ -- `AgentRunner` idempotency and in-client audit, it is never exported, and no
7
+ -- bundle has a file for it (contracts §11 -- `blobs` is empty at schema
8
+ -- version 3 precisely because `agent_run.output_ref` lives here instead).
9
+ --
10
+ -- It sits under `schema/annex/` rather than `schema/migrations/` so that the
11
+ -- separation is visible in the tree rather than asserted in a comment. Putting
12
+ -- it in the migration chain would fold it into `schema_version`, which is the
13
+ -- one thing CR-08 decided against; putting it inside the package would hide the
14
+ -- only DDL in this repository that no emitter produced.
15
+ --
16
+ -- back-out: drop the annex file. There is nothing to migrate and nothing to
17
+ -- preserve -- an annex row records that a run happened and what it cost, and a
18
+ -- lost annex costs a replay, not a fact about a client's system.
19
+ -- annex-version: 1
20
+
21
+ CREATE TABLE IF NOT EXISTS agent_run (
22
+ id TEXT PRIMARY KEY,
23
+ scope_ref TEXT NOT NULL, -- firm/engagement slugs; not an FK across stores
24
+ idempotency_key TEXT NOT NULL,
25
+ skill_ref TEXT NOT NULL, skill_sha256 TEXT NOT NULL, inputs_sha256 TEXT NOT NULL,
26
+ adapter TEXT NOT NULL, model TEXT NOT NULL, params_hash TEXT NOT NULL,
27
+ status TEXT NOT NULL,
28
+ input_tokens INTEGER, output_tokens INTEGER, cost_usd REAL, wall_ms INTEGER,
29
+ trace_json TEXT NOT NULL,
30
+ output_ref TEXT, -- blob ref; output text is never inlined
31
+ created_at TEXT NOT NULL
32
+ );
33
+
34
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_agent_idem ON agent_run(scope_ref, idempotency_key);