augur-schema 0.2.0__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.
- augur_schema-0.2.0/.gitignore +40 -0
- augur_schema-0.2.0/CHANGELOG.md +67 -0
- augur_schema-0.2.0/PKG-INFO +50 -0
- augur_schema-0.2.0/README.md +25 -0
- augur_schema-0.2.0/VERSIONING.md +91 -0
- augur_schema-0.2.0/package.json +24 -0
- augur_schema-0.2.0/pyproject.toml +50 -0
- augur_schema-0.2.0/src/augur_schema/__init__.py +23 -0
- augur_schema-0.2.0/src/augur_schema/_loader.py +102 -0
- augur_schema-0.2.0/src/augur_schema/json/__init__.py +1 -0
- augur_schema-0.2.0/src/augur_schema/json/capture_mode.schema.json +18 -0
- augur_schema-0.2.0/src/augur_schema/json/coordinate_space.schema.json +19 -0
- augur_schema-0.2.0/src/augur_schema/json/debug_session.schema.json +83 -0
- augur_schema-0.2.0/src/augur_schema/json/decision_event.schema.json +48 -0
- augur_schema-0.2.0/src/augur_schema/json/diagnostic_finding.schema.json +40 -0
- augur_schema-0.2.0/src/augur_schema/json/failure_class.schema.json +21 -0
- augur_schema-0.2.0/src/augur_schema/json/manifest.schema.json +111 -0
- augur_schema-0.2.0/src/augur_schema/json/modelio.schema.json +101 -0
- augur_schema-0.2.0/src/augur_schema/json/observation.schema.json +90 -0
- augur_schema-0.2.0/src/augur_schema/json/preference.schema.json +84 -0
- augur_schema-0.2.0/src/augur_schema/json/prior_steps.schema.json +54 -0
- augur_schema-0.2.0/src/augur_schema/json/provenance.schema.json +14 -0
- augur_schema-0.2.0/src/augur_schema/json/replay_fixture.schema.json +84 -0
- augur_schema-0.2.0/src/augur_schema/json/step_trace.schema.json +170 -0
- augur_schema-0.2.0/src/augur_schema/json/trace.schema.json +16 -0
- augur_schema-0.2.0/src/augur_schema/py.typed +0 -0
- augur_schema-0.2.0/ts/index.ts +182 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.venv/
|
|
6
|
+
venv/
|
|
7
|
+
.pytest_cache/
|
|
8
|
+
.mypy_cache/
|
|
9
|
+
.ruff_cache/
|
|
10
|
+
dist/
|
|
11
|
+
build/
|
|
12
|
+
|
|
13
|
+
# Node
|
|
14
|
+
node_modules/
|
|
15
|
+
.next/
|
|
16
|
+
.turbo/
|
|
17
|
+
.pnpm-store/
|
|
18
|
+
.parcel-cache/
|
|
19
|
+
out/
|
|
20
|
+
|
|
21
|
+
# Editors
|
|
22
|
+
.vscode/
|
|
23
|
+
.idea/
|
|
24
|
+
*.swp
|
|
25
|
+
.DS_Store
|
|
26
|
+
|
|
27
|
+
# Secrets / env
|
|
28
|
+
.env
|
|
29
|
+
.env.local
|
|
30
|
+
.env.*.local
|
|
31
|
+
|
|
32
|
+
# Bundles and artifacts (samples may opt back in)
|
|
33
|
+
*.bundle/
|
|
34
|
+
artifacts/
|
|
35
|
+
out/
|
|
36
|
+
tmp/
|
|
37
|
+
|
|
38
|
+
# Logs (but the sample bundle keeps its own)
|
|
39
|
+
*.log
|
|
40
|
+
!examples/**/*.log
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# augur-schema changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0 (2026-05-23)
|
|
4
|
+
|
|
5
|
+
First standalone published release. Establishes `augur-schema` as a
|
|
6
|
+
PyPI + npm package consumable by external CUA adapter authors. Rolls up
|
|
7
|
+
all additive changes since `0.1.0` (previously tracked as unreleased
|
|
8
|
+
`0.1.1` and `0.1.2`).
|
|
9
|
+
|
|
10
|
+
### Packaging
|
|
11
|
+
|
|
12
|
+
- Published to PyPI as `augur-schema` via Trusted Publisher OIDC from the
|
|
13
|
+
platform repo. Closes #96.
|
|
14
|
+
- Published to npm as `@augur/schema` in lockstep with the Python version.
|
|
15
|
+
- Schema versioning policy documented in `VERSIONING.md` — semver, breaking
|
|
16
|
+
changes allowed across `0.x` minors, additive changes bump patch.
|
|
17
|
+
- `CHANGELOG.md` discipline enforced in CI on every schema-touching PR.
|
|
18
|
+
|
|
19
|
+
### Additive (back-compat) — capture-mode
|
|
20
|
+
|
|
21
|
+
- `step_trace.schema.json`: new optional `capture_mode` field
|
|
22
|
+
(per-step override of the manifest's capture mode). Lets producers
|
|
23
|
+
upgrade or downgrade the active capture mode mid-run (e.g. switch
|
|
24
|
+
from `metadata` to `screenshots` after the first failed verifier
|
|
25
|
+
check). Absence inherits the manifest mode. Closes #36.
|
|
26
|
+
|
|
27
|
+
### Additive (back-compat) — training-data substrate
|
|
28
|
+
|
|
29
|
+
- **`modelio.schema.json` (new)**: canonical record shape for one
|
|
30
|
+
model call's full input + output. Loaded under short name
|
|
31
|
+
`modelio`. Designed to be stored at
|
|
32
|
+
`modelio/<step_index:04d>-<layer>-<seq>.json`. Closes #56.
|
|
33
|
+
- `step_trace.schema.json`: new optional `costs` object
|
|
34
|
+
(total_usd, model_usd, gpu_usd, proxy_usd, tokens_in, tokens_out,
|
|
35
|
+
cache_hit_tokens). Closes part of #58.
|
|
36
|
+
- `step_trace.schema.json`: new optional `latency` object
|
|
37
|
+
(planner_ms, grounding_ms, dispatch_ms, verifier_ms, recovery_ms,
|
|
38
|
+
total_ms). Closes part of #58.
|
|
39
|
+
- `step_trace.schema.json` → `verdict`: new optional `score` (0..1),
|
|
40
|
+
`score_components` (open object), `comparator` (enum:
|
|
41
|
+
verifier|model-judge|exact-match|human). Closes #59.
|
|
42
|
+
- `debug_session.schema.json`: new optional `costs` object with the
|
|
43
|
+
same shape as the step-level one. Run-level rollup. Closes part of #58.
|
|
44
|
+
|
|
45
|
+
## 0.1.0 (2026-05-19)
|
|
46
|
+
|
|
47
|
+
Initial schema package. Records:
|
|
48
|
+
|
|
49
|
+
- `manifest.schema.json` — bundle envelope.
|
|
50
|
+
- `trace.schema.json` — combined session + steps document.
|
|
51
|
+
- `debug_session.schema.json` — top-level run record.
|
|
52
|
+
- `step_trace.schema.json` — one step.
|
|
53
|
+
- `observation.schema.json` — screenshot + viewport metadata.
|
|
54
|
+
- `decision_event.schema.json` — planner / verifier / recovery decisions.
|
|
55
|
+
- `replay_fixture.schema.json` — replay seed.
|
|
56
|
+
- `diagnostic_finding.schema.json` — output of the diagnostic rules engine.
|
|
57
|
+
|
|
58
|
+
Enums:
|
|
59
|
+
|
|
60
|
+
- `capture_mode.schema.json`
|
|
61
|
+
- `coordinate_space.schema.json`
|
|
62
|
+
- `provenance.schema.json`
|
|
63
|
+
- `failure_class.schema.json` (open string with examples)
|
|
64
|
+
|
|
65
|
+
Sample bundle: `examples/sample-bundle/` (5 steps, exercises every record).
|
|
66
|
+
|
|
67
|
+
Per `docs/versioning.md`, breaking changes are allowed across `0.x` minors.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: augur-schema
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Augur schema package — canonical JSON Schemas for CUA debugger records.
|
|
5
|
+
Project-URL: Homepage, https://github.com/mercurialsolo/augur
|
|
6
|
+
Project-URL: Issues, https://github.com/mercurialsolo/augur/issues
|
|
7
|
+
Project-URL: Changelog, https://github.com/mercurialsolo/augur/blob/main/packages/schema/CHANGELOG.md
|
|
8
|
+
Author-email: Augur Authors <barada@gmail.com>
|
|
9
|
+
License: Apache-2.0
|
|
10
|
+
Keywords: computer-use-agent,cua,debugger,json-schema,observability,schema
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Requires-Dist: jsonschema>=4.22
|
|
23
|
+
Requires-Dist: referencing>=0.35
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# augur-schema
|
|
27
|
+
|
|
28
|
+
Canonical JSON Schemas for the Augur CUA debugger.
|
|
29
|
+
|
|
30
|
+
`json/` is the source of truth. Python and TypeScript types are hand-written mirrors
|
|
31
|
+
in `src/augur_schema/` and `ts/` — kept in sync by `tests/test_schema_roundtrip.py`.
|
|
32
|
+
|
|
33
|
+
Records:
|
|
34
|
+
|
|
35
|
+
- `manifest.schema.json` — bundle envelope
|
|
36
|
+
- `debug_session.schema.json` — top-level run/session record
|
|
37
|
+
- `step_trace.schema.json` — one step
|
|
38
|
+
- `observation.schema.json` — screenshot + viewport metadata
|
|
39
|
+
- `decision_event.schema.json` — ordered planner/verifier/recovery decisions
|
|
40
|
+
- `replay_fixture.schema.json` — replay seed for a step
|
|
41
|
+
- `diagnostic_finding.schema.json` — output of the diagnostic rules engine
|
|
42
|
+
|
|
43
|
+
Enums (separate files so they can be `$ref`d):
|
|
44
|
+
|
|
45
|
+
- `coordinate_space.schema.json`
|
|
46
|
+
- `provenance.schema.json`
|
|
47
|
+
- `capture_mode.schema.json`
|
|
48
|
+
- `failure_class.schema.json`
|
|
49
|
+
|
|
50
|
+
Schema version: see [`docs/versioning.md`](../../docs/versioning.md). Current: `0.1`.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# augur-schema
|
|
2
|
+
|
|
3
|
+
Canonical JSON Schemas for the Augur CUA debugger.
|
|
4
|
+
|
|
5
|
+
`json/` is the source of truth. Python and TypeScript types are hand-written mirrors
|
|
6
|
+
in `src/augur_schema/` and `ts/` — kept in sync by `tests/test_schema_roundtrip.py`.
|
|
7
|
+
|
|
8
|
+
Records:
|
|
9
|
+
|
|
10
|
+
- `manifest.schema.json` — bundle envelope
|
|
11
|
+
- `debug_session.schema.json` — top-level run/session record
|
|
12
|
+
- `step_trace.schema.json` — one step
|
|
13
|
+
- `observation.schema.json` — screenshot + viewport metadata
|
|
14
|
+
- `decision_event.schema.json` — ordered planner/verifier/recovery decisions
|
|
15
|
+
- `replay_fixture.schema.json` — replay seed for a step
|
|
16
|
+
- `diagnostic_finding.schema.json` — output of the diagnostic rules engine
|
|
17
|
+
|
|
18
|
+
Enums (separate files so they can be `$ref`d):
|
|
19
|
+
|
|
20
|
+
- `coordinate_space.schema.json`
|
|
21
|
+
- `provenance.schema.json`
|
|
22
|
+
- `capture_mode.schema.json`
|
|
23
|
+
- `failure_class.schema.json`
|
|
24
|
+
|
|
25
|
+
Schema version: see [`docs/versioning.md`](../../docs/versioning.md). Current: `0.1`.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# augur-schema versioning policy
|
|
2
|
+
|
|
3
|
+
This package is the canonical contract between Augur producers (the SDK, third-party
|
|
4
|
+
CUA adapters) and Augur consumers (the server, viewer, CLI, diagnostic rule packs).
|
|
5
|
+
Stability of the schema directly affects the cost of upgrading either side, so
|
|
6
|
+
versioning is treated as a load-bearing decision, not a release-time afterthought.
|
|
7
|
+
|
|
8
|
+
## Semver discipline
|
|
9
|
+
|
|
10
|
+
The package follows [semver](https://semver.org/) with one caveat for the pre-1.0
|
|
11
|
+
phase, consistent with semver §4.
|
|
12
|
+
|
|
13
|
+
- **Pre-1.0** (current): a **minor** bump (`0.x.0 → 0.{x+1}.0`) is allowed to
|
|
14
|
+
contain breaking changes. A **patch** bump (`0.x.y → 0.x.{y+1}`) is reserved for
|
|
15
|
+
additive, backward-compatible changes.
|
|
16
|
+
- **Post-1.0**: standard semver. Breaking changes require a **major** bump
|
|
17
|
+
(`x.y.z → {x+1}.0.0`). Additive changes bump minor.
|
|
18
|
+
|
|
19
|
+
The Python package (`augur-schema` on PyPI) and the TypeScript package
|
|
20
|
+
(`@augur/schema` on npm) always carry the **same version number** and ship from the
|
|
21
|
+
same git tag (`schema-vX.Y.Z`). Pinning one is equivalent to pinning the other.
|
|
22
|
+
|
|
23
|
+
## What counts as breaking
|
|
24
|
+
|
|
25
|
+
Breaking, in either direction:
|
|
26
|
+
|
|
27
|
+
- **Removed field** on any record (producers depending on emitting it break;
|
|
28
|
+
consumers depending on reading it break).
|
|
29
|
+
- **Type narrowing** on an existing field (e.g. `string → enum`, `number → integer`).
|
|
30
|
+
- **Required-field addition** to an existing record (producers without it break
|
|
31
|
+
validation).
|
|
32
|
+
- **Required-field downgrade-then-removal** (counts as removal).
|
|
33
|
+
- **Semantic change** to an existing field's meaning, even if the type is
|
|
34
|
+
unchanged (e.g. `costs.total_usd` changing from "step cost" to "cumulative
|
|
35
|
+
cost"). When in doubt, treat semantic changes as breaking.
|
|
36
|
+
- **Enum variant removal**.
|
|
37
|
+
- **Renaming** a record, a field, or an enum variant. Use deprecation, ship the
|
|
38
|
+
new name as additive, then remove the old in a later breaking bump.
|
|
39
|
+
- **Coordinate-space or unit changes** on numeric fields.
|
|
40
|
+
|
|
41
|
+
## What counts as additive
|
|
42
|
+
|
|
43
|
+
Additive, backward-compatible:
|
|
44
|
+
|
|
45
|
+
- **New optional field** on an existing record.
|
|
46
|
+
- **New enum variant** in an open enum (i.e. one documented as accepting
|
|
47
|
+
unknown values for forward-compatibility — most Augur enums are open).
|
|
48
|
+
- **New schema file** (a wholly new record type).
|
|
49
|
+
- **Loosening a numeric range** (e.g. `0..1 → 0..2`).
|
|
50
|
+
- **Loosening a required field to optional**.
|
|
51
|
+
|
|
52
|
+
Additive changes still get a CHANGELOG entry — the policy is "every PR that
|
|
53
|
+
touches `packages/schema/src/augur_schema/json/` updates `CHANGELOG.md`",
|
|
54
|
+
enforced in CI.
|
|
55
|
+
|
|
56
|
+
## Release flow
|
|
57
|
+
|
|
58
|
+
1. Schema PR lands on `main` with the change + CHANGELOG entry.
|
|
59
|
+
2. When ready to release, bump version in lockstep:
|
|
60
|
+
- `packages/schema/pyproject.toml`
|
|
61
|
+
- `packages/schema/package.json`
|
|
62
|
+
3. Tag: `schema-vX.Y.Z`. Push the tag.
|
|
63
|
+
4. `.github/workflows/release-schema.yml` runs: validates tag/CHANGELOG/pyproject
|
|
64
|
+
coherence, builds, publishes to PyPI via Trusted Publisher OIDC, creates a
|
|
65
|
+
GitHub Release with the CHANGELOG entry as the body.
|
|
66
|
+
|
|
67
|
+
The release workflow refuses to publish if:
|
|
68
|
+
|
|
69
|
+
- the tag version does not match both `pyproject.toml` and `package.json`;
|
|
70
|
+
- the CHANGELOG has no entry for the tag version;
|
|
71
|
+
- any schema fails to parse;
|
|
72
|
+
- the sample bundle does not validate against the current schemas.
|
|
73
|
+
|
|
74
|
+
## Pinning guidance for consumers
|
|
75
|
+
|
|
76
|
+
- **Python**: `augur-schema>=0.2,<0.3` until 1.0. Tight bounds are appropriate
|
|
77
|
+
during pre-1.0 because breaking changes ship in minor bumps.
|
|
78
|
+
- **TypeScript**: `"@augur/schema": "^0.2.0"` works under npm semver semantics
|
|
79
|
+
for pre-1.0 (npm treats `^0.x.y` as `>=0.x.y <0.x+1.0`), giving you patch
|
|
80
|
+
updates without surprise breakage.
|
|
81
|
+
- **Lock files**: commit `uv.lock` / `pnpm-lock.yaml` in consumer repos. Schema
|
|
82
|
+
upgrades become explicit PRs that can be reviewed.
|
|
83
|
+
|
|
84
|
+
## Stability promise
|
|
85
|
+
|
|
86
|
+
- **0.x**: pre-stable. Expect a small number of breaking changes per quarter
|
|
87
|
+
while the SDK side fills out the Sentry-for-CUA primitive set (see SPEC §2.1).
|
|
88
|
+
- **1.0**: target after the schema additions for primitives #3, #5, #9, and #10
|
|
89
|
+
have shipped and been exercised by at least one non-Mantis adapter.
|
|
90
|
+
- **Post-1.0**: breaking changes only on major bumps. Deprecation cycles of at
|
|
91
|
+
least one minor before removal.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@augur/schema",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Augur schema package — canonical JSON Schemas for CUA debugger records.",
|
|
5
|
+
"private": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./ts/index.js",
|
|
8
|
+
"types": "./ts/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./ts/index.d.ts",
|
|
12
|
+
"default": "./ts/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./json/*": "./src/augur_schema/json/*"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"ts/",
|
|
18
|
+
"src/augur_schema/json/"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "echo 'schema: json sources only, nothing to build'",
|
|
22
|
+
"test": "echo 'schema: see Python tests'"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "augur-schema"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "Augur schema package — canonical JSON Schemas for CUA debugger records."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
license = { text = "Apache-2.0" }
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "Augur Authors", email = "barada@gmail.com" },
|
|
10
|
+
]
|
|
11
|
+
keywords = [
|
|
12
|
+
"cua",
|
|
13
|
+
"computer-use-agent",
|
|
14
|
+
"debugger",
|
|
15
|
+
"schema",
|
|
16
|
+
"json-schema",
|
|
17
|
+
"observability",
|
|
18
|
+
]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 4 - Beta",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"License :: OSI Approved :: Apache Software License",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
29
|
+
"Typing :: Typed",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"jsonschema>=4.22",
|
|
33
|
+
"referencing>=0.35",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://github.com/mercurialsolo/augur"
|
|
38
|
+
Issues = "https://github.com/mercurialsolo/augur/issues"
|
|
39
|
+
Changelog = "https://github.com/mercurialsolo/augur/blob/main/packages/schema/CHANGELOG.md"
|
|
40
|
+
|
|
41
|
+
[build-system]
|
|
42
|
+
requires = ["hatchling"]
|
|
43
|
+
build-backend = "hatchling.build"
|
|
44
|
+
|
|
45
|
+
[tool.hatch.build.targets.wheel]
|
|
46
|
+
packages = ["src/augur_schema"]
|
|
47
|
+
|
|
48
|
+
[tool.hatch.build.targets.wheel.shared-data]
|
|
49
|
+
# JSON schemas ship with the package; no extra include rules needed because
|
|
50
|
+
# they live under src/augur_schema/json/.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Augur schema package.
|
|
2
|
+
|
|
3
|
+
Canonical JSON Schemas live under `augur_schema/json/`. This module exposes
|
|
4
|
+
loaders and a small validation helper.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from augur_schema._loader import (
|
|
8
|
+
SCHEMA_VERSION,
|
|
9
|
+
SchemaError,
|
|
10
|
+
list_schemas,
|
|
11
|
+
load_schema,
|
|
12
|
+
schemas_dir,
|
|
13
|
+
validator_for,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"SCHEMA_VERSION",
|
|
18
|
+
"SchemaError",
|
|
19
|
+
"list_schemas",
|
|
20
|
+
"load_schema",
|
|
21
|
+
"schemas_dir",
|
|
22
|
+
"validator_for",
|
|
23
|
+
]
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""Schema loader.
|
|
2
|
+
|
|
3
|
+
The JSON Schemas are the source of truth. This loader caches them and
|
|
4
|
+
returns a `jsonschema` validator that resolves cross-schema `$ref`s against
|
|
5
|
+
the on-disk schema directory.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import json
|
|
11
|
+
from functools import cache
|
|
12
|
+
from importlib import resources
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from typing import Any
|
|
15
|
+
|
|
16
|
+
from jsonschema import Draft202012Validator
|
|
17
|
+
from jsonschema.exceptions import ValidationError
|
|
18
|
+
from referencing import Registry, Resource
|
|
19
|
+
from referencing.jsonschema import DRAFT202012
|
|
20
|
+
|
|
21
|
+
SCHEMA_VERSION = "0.1"
|
|
22
|
+
|
|
23
|
+
# Map short names → schema filenames. Keep names stable; consumers depend on them.
|
|
24
|
+
_SCHEMA_FILES: dict[str, str] = {
|
|
25
|
+
"manifest": "manifest.schema.json",
|
|
26
|
+
"trace": "trace.schema.json",
|
|
27
|
+
"debug_session": "debug_session.schema.json",
|
|
28
|
+
"step_trace": "step_trace.schema.json",
|
|
29
|
+
"observation": "observation.schema.json",
|
|
30
|
+
"decision_event": "decision_event.schema.json",
|
|
31
|
+
"replay_fixture": "replay_fixture.schema.json",
|
|
32
|
+
"prior_steps": "prior_steps.schema.json",
|
|
33
|
+
"modelio": "modelio.schema.json",
|
|
34
|
+
"preference": "preference.schema.json",
|
|
35
|
+
"diagnostic_finding": "diagnostic_finding.schema.json",
|
|
36
|
+
"coordinate_space": "coordinate_space.schema.json",
|
|
37
|
+
"provenance": "provenance.schema.json",
|
|
38
|
+
"capture_mode": "capture_mode.schema.json",
|
|
39
|
+
"failure_class": "failure_class.schema.json",
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class SchemaError(Exception):
|
|
44
|
+
"""Wraps schema lookup and validation failures."""
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def schemas_dir() -> Path:
|
|
48
|
+
"""Return the on-disk path to the bundled JSON Schemas."""
|
|
49
|
+
return Path(resources.files("augur_schema") / "json") # type: ignore[arg-type]
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def list_schemas() -> list[str]:
|
|
53
|
+
"""Return the supported schema short names."""
|
|
54
|
+
return sorted(_SCHEMA_FILES)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@cache
|
|
58
|
+
def load_schema(name: str) -> dict[str, Any]:
|
|
59
|
+
"""Load a schema by short name (e.g. `manifest`) or filename."""
|
|
60
|
+
filename = _SCHEMA_FILES.get(name, name)
|
|
61
|
+
path = schemas_dir() / filename
|
|
62
|
+
if not path.exists():
|
|
63
|
+
raise SchemaError(f"unknown schema: {name!r}")
|
|
64
|
+
with path.open() as f:
|
|
65
|
+
loaded: dict[str, Any] = json.load(f)
|
|
66
|
+
return loaded
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@cache
|
|
70
|
+
def _registry() -> Registry:
|
|
71
|
+
"""Registry that lets cross-schema `$ref`s resolve against bundled files.
|
|
72
|
+
|
|
73
|
+
Schemas use relative refs like `coordinate_space.schema.json`. Draft 2020-12
|
|
74
|
+
resolves those against the base URI of the containing schema's `$id`. We
|
|
75
|
+
pre-register every schema under both its `$id` and its plain filename so
|
|
76
|
+
relative refs work no matter which one a producer used.
|
|
77
|
+
"""
|
|
78
|
+
resources_list: list[tuple[str, Resource[Any]]] = []
|
|
79
|
+
for short, filename in _SCHEMA_FILES.items():
|
|
80
|
+
schema = load_schema(short)
|
|
81
|
+
resource = DRAFT202012.create_resource(schema)
|
|
82
|
+
if "$id" in schema:
|
|
83
|
+
resources_list.append((schema["$id"], resource))
|
|
84
|
+
resources_list.append((filename, resource))
|
|
85
|
+
return Registry().with_resources(resources_list)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def validator_for(name: str) -> Draft202012Validator:
|
|
89
|
+
"""Return a Draft 2020-12 validator for the named schema."""
|
|
90
|
+
schema = load_schema(name)
|
|
91
|
+
return Draft202012Validator(schema, registry=_registry())
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
__all__ = [
|
|
95
|
+
"SCHEMA_VERSION",
|
|
96
|
+
"SchemaError",
|
|
97
|
+
"ValidationError",
|
|
98
|
+
"list_schemas",
|
|
99
|
+
"load_schema",
|
|
100
|
+
"schemas_dir",
|
|
101
|
+
"validator_for",
|
|
102
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""JSON Schemas (data). Imported via importlib.resources, not as Python."""
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://augur.dev/schemas/0.1/capture_mode.schema.json",
|
|
4
|
+
"title": "CaptureMode",
|
|
5
|
+
"description": "Augur capture mode (spec §7). Ordered from least to most coverage.",
|
|
6
|
+
"type": "string",
|
|
7
|
+
"enum": [
|
|
8
|
+
"off",
|
|
9
|
+
"metadata",
|
|
10
|
+
"trace",
|
|
11
|
+
"screenshots",
|
|
12
|
+
"video",
|
|
13
|
+
"model_io",
|
|
14
|
+
"dispatch",
|
|
15
|
+
"replay",
|
|
16
|
+
"full"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://augur.dev/schemas/0.1/coordinate_space.schema.json",
|
|
4
|
+
"title": "CoordinateSpace",
|
|
5
|
+
"description": "Coordinate space registry (spec §4, §9, issue #9). Every coordinate MUST be tagged with one of these spaces so viewers can render overlays correctly across viewport sizes and device pixel ratios.",
|
|
6
|
+
"type": "string",
|
|
7
|
+
"enum": [
|
|
8
|
+
"viewport_css_px",
|
|
9
|
+
"device_px",
|
|
10
|
+
"screenshot_px",
|
|
11
|
+
"dom_client_rect"
|
|
12
|
+
],
|
|
13
|
+
"x-conversions": {
|
|
14
|
+
"note": "Conversion rules are non-normative here. See packages/sdk-python/src/augur_sdk/coordinates.py for the reference impl.",
|
|
15
|
+
"viewport_css_px<->device_px": "multiply by device_scale_factor on the source observation",
|
|
16
|
+
"viewport_css_px<->screenshot_px": "screenshots are captured at viewport scale by default; otherwise multiply by screenshot_scale",
|
|
17
|
+
"dom_client_rect": "Diagnostic-only space. MUST be paired with provenance=dom. Never a runtime input (spec §4)."
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://augur.dev/schemas/0.1/debug_session.schema.json",
|
|
4
|
+
"title": "DebugSession",
|
|
5
|
+
"description": "One CUA run from the debugger's point of view. Spec §8.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"schema_version",
|
|
9
|
+
"debug_session_id",
|
|
10
|
+
"run_id",
|
|
11
|
+
"client",
|
|
12
|
+
"capture_mode",
|
|
13
|
+
"started_at",
|
|
14
|
+
"status"
|
|
15
|
+
],
|
|
16
|
+
"additionalProperties": false,
|
|
17
|
+
"properties": {
|
|
18
|
+
"schema_version": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Augur schema version that this record conforms to. See docs/versioning.md.",
|
|
21
|
+
"pattern": "^[0-9]+\\.[0-9]+(\\.[0-9]+)?$"
|
|
22
|
+
},
|
|
23
|
+
"debug_session_id": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"pattern": "^dbg_[A-Za-z0-9_\\-]+$"
|
|
26
|
+
},
|
|
27
|
+
"run_id": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Adapter-supplied run id. Often `run_<uuid>` but the format is not enforced."
|
|
30
|
+
},
|
|
31
|
+
"client": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"required": ["name"],
|
|
34
|
+
"additionalProperties": false,
|
|
35
|
+
"properties": {
|
|
36
|
+
"name": {"type": "string", "description": "Adapter name, e.g. `mantis`."},
|
|
37
|
+
"version": {"type": "string"},
|
|
38
|
+
"git_sha": {"type": "string"}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"capture_mode": {"$ref": "capture_mode.schema.json"},
|
|
42
|
+
"started_at": {"type": "string", "format": "date-time"},
|
|
43
|
+
"ended_at": {"type": ["string", "null"], "format": "date-time"},
|
|
44
|
+
"status": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"enum": ["running", "succeeded", "failed", "cancelled", "halted"]
|
|
47
|
+
},
|
|
48
|
+
"artifact_root": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"description": "URI to the artifact root. file:// for local bundles, s3:// or https:// otherwise."
|
|
51
|
+
},
|
|
52
|
+
"trace_uri": {"type": "string"},
|
|
53
|
+
"live": {
|
|
54
|
+
"type": ["object", "null"],
|
|
55
|
+
"description": "Live attach endpoints. Only populated while the run is active (spec §7, Phase 4).",
|
|
56
|
+
"additionalProperties": false,
|
|
57
|
+
"properties": {
|
|
58
|
+
"status_url": {"type": "string"},
|
|
59
|
+
"video_url": {"type": "string"},
|
|
60
|
+
"reasoning_url": {"type": "string"}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"tags": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"additionalProperties": {"type": "string"},
|
|
66
|
+
"description": "Free-form key/value tags (tenant, environment, plan signature, etc.)."
|
|
67
|
+
},
|
|
68
|
+
"costs": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"additionalProperties": false,
|
|
71
|
+
"description": "Run-level cost rollup. Producers MAY also stamp `cost_usd` as a string in `tags` for back-compat with the runs-list display path; servers/viewers prefer this structured form when present. Closes #58.",
|
|
72
|
+
"properties": {
|
|
73
|
+
"total_usd": {"type": "number", "minimum": 0},
|
|
74
|
+
"model_usd": {"type": "number", "minimum": 0},
|
|
75
|
+
"gpu_usd": {"type": "number", "minimum": 0},
|
|
76
|
+
"proxy_usd": {"type": "number", "minimum": 0},
|
|
77
|
+
"tokens_in": {"type": "integer", "minimum": 0},
|
|
78
|
+
"tokens_out": {"type": "integer", "minimum": 0},
|
|
79
|
+
"cache_hit_tokens": {"type": "integer", "minimum": 0}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://augur.dev/schemas/0.1/decision_event.schema.json",
|
|
4
|
+
"title": "DecisionEvent",
|
|
5
|
+
"description": "An ordered record from planner, verifier, recovery, routing, or dispatch layers (spec §8). Stored one-per-line in JSONL files under events/.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["ts", "layer", "kind", "summary"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"ts": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"format": "date-time",
|
|
13
|
+
"description": "ISO-8601 UTC timestamp."
|
|
14
|
+
},
|
|
15
|
+
"step_index": {
|
|
16
|
+
"type": "integer",
|
|
17
|
+
"minimum": 0,
|
|
18
|
+
"description": "Optional — events MAY be associated with a step or stand alone."
|
|
19
|
+
},
|
|
20
|
+
"layer": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"enum": [
|
|
23
|
+
"planner",
|
|
24
|
+
"grounding",
|
|
25
|
+
"model",
|
|
26
|
+
"dispatch",
|
|
27
|
+
"verifier",
|
|
28
|
+
"step_recovery",
|
|
29
|
+
"routing",
|
|
30
|
+
"runner",
|
|
31
|
+
"adapter"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"kind": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"enum": ["decision", "observation", "error", "info", "metric"]
|
|
37
|
+
},
|
|
38
|
+
"summary": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"description": "One-line human summary. The detail object carries the structured payload."
|
|
41
|
+
},
|
|
42
|
+
"detail": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"description": "Layer-specific structured payload. Schema is intentionally open here; adapters MAY define their own shapes.",
|
|
45
|
+
"additionalProperties": true
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|