leonard_grid_assets library

Lenny's grid assets — the *_grid_assets pack for the lenny repo.

The package vends the station-driven selfdrive and leonard-e2e circuits, their capabilities and work-policy resolvers, and the standalone e2e Command. Later Lenny assets are added to this same package rather than creating a second package identity.

Classes

E2eChildProcess
Observable handle for a long-lived process.
E2eCommand
e2e — run one generic session or the private sample suite.
E2eHttpResponse
HTTP response data used by swift-infer model preflight.
E2eInspectCapability
Performs the only circuit verdict conversion from typed inspection.
E2eLaunchCapability
Holds the fresh Flutter process as the circuit's daemon lease.
E2eLaunchHandle
A held Flutter launch used as the circuit's daemon lease.
E2eObservationExpectation
A route and/or semantics assertion over the final typed observation.
E2eOrder
A validated E2E order decoded from bead metadata.
E2ePreflight
Cleared inputs returned by preflight.
E2ePreflightCapability
Runs the same deterministic preflight used by E2eService.runSession.
E2eProcessResult
Completed process data.
E2eRunCapability
Invokes Leonard and publishes its status as receipt data even when nonzero.
E2eRunReceipt
Receipt from invoking the outer Leonard driver.
E2eRuntime
Every IO operation needed by E2eService.
E2eScenario
One pinned sample-suite scenario.
E2eScenarioVerdict
One named scenario result.
E2eService
Reusable single-session and sample-suite E2E service.
E2eSessionRequest
One immutable live-device session request.
E2eSuiteVerdict
Aggregate result of an ordered sample-suite selection.
E2eVerdict
Structured deterministic result of one Leonard E2E session.
FlutterDevice
One device decoded from flutter devices --machine.
GridAssetsPack
The leonard_grid_assets asset pack.
HarnessLaunchRequest
The values required to launch a harness.
HarnessProcess
The observable surface of a launched harness process.
LeonardCapabilityRegistry
Resolves this pack before falling through to the station's code registry.
OuterDriverCapability
Runs one outer driver against the endpoint published by the harness.
PanelHarnessCapability
Acquires the live harness and reports ready only after all four URIs exist.
PanelHarnessLease
A held lease over the live harness and its run directory.
PreflightCleared
Both requested ids are equal and served.
PreflightRefused
The model pair was refused.
PreflightVerdict
A preflight verdict.
ScenarioPatterns
Scenario-declared completion gates.
SelfdriveOrder
A self-drive order decoded as a value from a work bead.
SelfdrivePreflightCapability
Refuses an invalid model pair before the process-bearing steps can launch.
SelfdriveUriLedger
Folds the harness's four URI publications into a readiness ledger.
SelfdriveVerifyCapability
Runs the established verifier and appends its station-derived receipt.
SystemE2eRuntime
Production dart:io and HTTP implementation of E2eRuntime.

Enums

E2eFailureCode
Stable machine-readable reasons a session did not pass.
E2eModel
Leonard's supported provider tiers.
E2eVerdictStatus
Overall session status.

Constants

kDefaultQwenModelId → const String
Default swift-infer model used when no request or environment id is set.
kE2eAppDirKey → const String
Required absolute application directory metadata key.
kE2eCircuit → const Circuit
Preflight → launch → run → inspect.
kE2eCircuitId → const String
Circuit id and registry key.
kE2eCliKey → const String
Optional CLI prefix metadata key.
kE2eDeviceKey → const String
Optional device metadata key.
kE2eDeviceResultKey → const String
Result key carrying the selected device.
kE2eDoneEvidencePatternKey → const String
Optional done-evidence pattern metadata key.
kE2eDoneReasonPatternKey → const String
Optional done-reason pattern metadata key.
kE2eDriverStatusResultKey → const String
Result key carrying the decimal Leonard exit status.
kE2eExpectLabelKey → const String
Optional final semantics label metadata key.
kE2eExpectRouteKey → const String
Optional final route metadata key.
kE2eExpectStateKey → const String
Optional final semantics state metadata key.
kE2eExtensionsKey → const String
Optional comma-separated extensions metadata key.
kE2eGoalKey → const String
Required goal metadata key.
kE2eInspectCapabilityId → const String
Inspect capability id.
kE2eInspectStep → const String
Terminal inspect circuit step id.
kE2eLaunchCapabilityId → const String
Launch capability id.
kE2eLaunchStep → const String
Launch circuit step id.
kE2eModelIdKey → const String
Optional exact model id metadata key.
kE2eModelIdResultKey → const String
Result key carrying the exact resolved model id.
kE2eModelKey → const String
Optional provider tier metadata key.
kE2ePreflightCapabilityId → const String
Preflight capability id.
kE2ePreflightStep → const String
Preflight circuit step id.
kE2eRunCapabilityId → const String
Run capability id.
kE2eRunDirResultKey → const String
Result key carrying the artifact directory.
kE2eRunStep → const String
Run circuit step id.
kE2eTrajectoryResultKey → const String
Result key carrying the trajectory path.
kE2eVerdictJsonResultKey → const String
Result key carrying the terminal structured verdict.
kE2eVmUriResultKey → const String
Result key carrying the Flutter VM-service URI.
kLeonardCapabilityIds → const Set<String>
All capability ids owned by this pack.
kLeonardSampleAppDir → const String
Sample application path relative to the repository root.
kLeonardSampleSuite → const List<E2eScenario>
The four ordered lenny sample-app scenarios.
kPanelDwdsUriKey → const String
The panel endpoint consumed by the outer driver.
kSelfdriveCapabilityIds → const Set<String>
Capability ids owned by this pack.
kSelfdriveCircuit → const Circuit
Preflight → panel-harness → outer-driver → verify.
kSelfdriveCircuitId → const String
The circuit id, also used as its registry key.
kSelfdriveClearedModelKey → const String
Payload key carrying the one model id cleared for both harnesses.
kSelfdriveDeviceKey → const String
Optional bead metadata key for the sample-app device.
kSelfdriveDriverStatusKey → const String
Result key under which the driver publishes its own exit-status file.
kSelfdriveInnerModelKey → const String
Bead metadata key for the inner model id.
kSelfdriveOuterDriverStep → const String
The outer leonard_cli driver.
kSelfdriveOuterModelKey → const String
Bead metadata key for the outer model id.
kSelfdrivePanelHarnessStep → const String
The long-lived panel and sample-app harness.
kSelfdrivePreflightStep → const String
Resolves and pins both model ids before any process starts.
kSelfdriveRunDirKey → const String
Result key under which the harness publishes its run directory.
kSelfdriveScenarioKey → const String
Bead metadata key for the scenario path.
kSelfdriveTrajectoryKey → const String
Result key under which the driver publishes its trajectory.
kSelfdriveUriKeys → const List<String>
The four URI publications required for harness readiness.
kSelfdriveVerifyStep → const String
The terminal receipt verifier.

Functions

buildLeonardRegistry(WorkNoteAppender appendNote, {HarnessLauncher launcher = launchPanelHarness, ServedModelSource models = fetchServedModelIds, ShellRunner shell = const SystemShellRunner(), E2eService? e2eService, CapabilityRegistry? base}) → CapabilityRegistry
Builds the complete Leonard registry over the ordinary code registry.
buildSelfdriveRegistry(WorkNoteAppender appendNote, {HarnessLauncher launcher = launchPanelHarness, ServedModelSource models = fetchServedModelIds, ShellRunner shell = const SystemShellRunner(), CapabilityRegistry? base}) → CapabilityRegistry
Builds the pack registry under its original selfdrive entry point.
e2eCircuitFor(Bead bead) → Circuit?
Returns the E2E circuit only for a complete, valid E2E order.
failingAssertion(String verifierOutput) String
The verifier's failed assertion as it printed it, or none when the verifier refused nothing.
fetchServedModelIds(Uri gatewayBase, String token) Future<Set<String>>
Reads the gateway's OpenAI-compatible /v1/models catalog.
findLeonardSampleAppDir(E2eRuntime runtime, {String? startingDirectory}) Future<String?>
Locates the sample app beneath the nearest ancestor that contains it.
judgeSelfdriveModels({required String outerModelId, required String innerModelId, required Set<String> servedModelIds}) PreflightVerdict
Judges a model pair against the served model catalog.
launchPanelHarness(HarnessLaunchRequest request) Future<HarnessProcess>
Launches the existing panel self-drive harness script.
outerDriverShellCommand({required String repoRoot, required String scenarioPath, required String panelDwdsUri, required String trajectoryPath, required String driverLogPath, required String probeArtifactPath, required String driverStatusPath, required ScenarioPatterns patterns, int turnBudget = 180, int coreBudgetBytes = 131072}) String
Builds the bounded outer-driver command used by the station process step.
parseE2eCliPrefix(String source) List<String>
Splits a shell-style executable prefix into argv without invoking a shell.
parseReceiptFields(String output) Map<String, String>
Parses upper-snake KEY=value lines from verifier output.
performE2eLaunch(E2eRuntime runtime, E2eSessionRequest request, E2ePreflight preflight, {Duration readyTimeout = const Duration(minutes: 5)}) Future<E2eLaunchHandle>
Kills stale launchers, reinstalls the app, and waits for its VM-service URI.
performE2ePreflight(E2eRuntime runtime, E2eSessionRequest request) Future<E2ePreflight>
Runs all deterministic checks before a Flutter process starts.
performE2eRun(E2eRuntime runtime, E2eSessionRequest request, {required Uri vmUri, required String runDir, String? resolvedModelId}) Future<E2eRunReceipt>
Invokes Leonard with an explicit trajectory and preserves its exit status.
performE2eSampleSuite(E2eService service, {required String appDir, required E2eModel model, String? modelId, String? device, required List<String> extensions, required List<String> cliPrefix, required List<E2eScenario> scenarios}) Future<E2eSuiteVerdict>
Sequentially runs scenarios through E2eService.runSession.
scenarioPatterns(String scenarioText) ScenarioPatterns
Reads both required completion gates from scenario markdown.
selfdriveCircuitFor(Bead bead) → Circuit?
Returns the self-drive circuit only for a complete self-drive order.
selfdriveReceiptLines({required String runHead, required String runDir, required String requestedModelId, required String scenarioExitStatus, required int verifierExitStatus, required String failingAssertionText, required Map<String, String> verifierFields, required Map<String, String> metrics}) List<String>
Builds the exact receipt block appended to the work bead by the station.
shellQuote(String value) String
Quotes one POSIX shell word.
trajectoryMetrics(String trajectoryJsonl) Map<String, String>
Derives station-owned metrics from an outer trajectory.

Typedefs

EnvLookup = String? Function(String name)
Injectable environment lookup.
HarnessLauncher = Future<HarnessProcess> Function(HarnessLaunchRequest request)
Injectable process-launch seam.
SelfdriveCapabilityRegistry = LeonardCapabilityRegistry
Compatibility name for callers that previously composed only selfdrive.
ServedModelSource = Future<Set<String>> Function(Uri gatewayBase, String token)
Injectable source of model ids served by a gateway.

Exceptions / Errors

E2ePhaseFailure
A typed failure raised by a public phase and folded by runSession.