This directory contains the single source of truth for the API contract between the Chrome extension and SDKs.
snapshot.schema.json- JSON Schema for snapshot response validationSNAPSHOT_V1.md- Human-readable snapshot API contractsdk-types.md- SDK-level type definitions (ActionResult, WaitResult, TraceStep)
These specifications ensure:
- Consistency: Both Python and TypeScript SDKs implement the same contract
- Validation: SDKs can validate extension responses
- Type Safety: Strong typing in both languages
- Documentation: Clear reference for developers
- Read
SNAPSHOT_V1.mdfor human-readable contract - Use
snapshot.schema.jsonfor JSON Schema validation - Reference
sdk-types.mdfor SDK-level types
- Ensure extension output matches
snapshot.schema.json - Update schema when adding new fields
- Version schema for breaking changes
- v1.0.0: Initial stable version (Day 1)
- Future versions: Increment major version for breaking changes
- SDKs should validate version and handle compatibility
Both SDKs should validate extension responses:
Python:
import jsonschema
from spec.snapshot.schema import load_schema
schema = load_schema()
jsonschema.validate(snapshot_data, schema)TypeScript:
import Ajv from 'ajv';
import schema from './spec/snapshot.schema.json';
const ajv = new Ajv();
const validate = ajv.compile(schema);
validate(snapshot_data);- Validate against real extension output
- Test with edge cases (empty pages, many elements, errors)
- Verify type coercion and defaults
Last Updated: Day 1 Implementation
Status: ✅ Stable