caelum0x a3b1ef8de1 feat(sdk): Python + TS clients for invariants and analyze
Completes the "go all" reach: the standalone `invariants` command and the new
one-shot `analyze` are now first-class in both SDKs.

python/lawsynth analysis.py: invariants() and analyze() methods + frozen
dataclasses (Invariant/InvariantReport, Skipped, AnalyzeReport). _parse_analyze
composes the existing _parse_stability/_parse_lyapunov/_parse_invariants over the
sub-objects (asserted identical to the standalone parsers) and narrows a
{skipped:true} slot to Skipped. analyze/invariants attached to Study/
DiscoveryResult. test_analysis 66 passed; full suite 160 passed / 9 skipped.

packages/world-schema + api-client: InvariantReport + AnalyzeReport interfaces,
parseInvariantReport/parseAnalyzeReport (+ validators, isSkipped guard).
parseAnalyzeReport reuses the standalone validators and re-paths child issues.
api-client 34 pass; world-schema green.

Keys confirmed against crates/lawsynth-cli/src/{invariants,analyze}.rs render_json
AND verbatim CLI capture. Honest note: invariants --box is a single shared LO:HI
interval (vs analyze's per-state box) — the clients encode each correctly.
2026-08-18 22:59:17 +03:00
..
2026-08-16 22:04:11 +03:00
2026-08-16 22:04:11 +03:00
2026-08-16 22:04:11 +03:00
2026-08-16 22:04:11 +03:00
2026-08-16 22:04:11 +03:00

@lawsynth/api-client

The TypeScript client owns HTTP request construction, response decoding, error normalization, cursor pagination, idempotency headers, and incremental SSE parsing. It uses the platform Fetch API and has no runtime dependency beyond @lawsynth/world-schema for World import typing.

import { BearerTokenAuth, LawSynthClient } from "@lawsynth/api-client";

const client = new LawSynthClient({
  baseUrl: "https://service.example",
  auth: new BearerTokenAuth(() => process.env.LAWSYNTH_TOKEN ?? ""),
});
const project = await client.projects.create({ name: "orbital-model" }, "create-project-0001");

The transport retries only replay-safe requests and writes with an explicit idempotency key. SSE is exposed only by client.events(runId). Endpoint availability and authentication semantics are determined by the deployed service; this package does not manufacture a server implementation.

Run npm test inside this directory to build the client and exercise it against local HTTP servers.