Skip to main content

Zig SDK

The transit_sdk package exports the shared Zig caller modules for consumer applications. It preserves their existing import names and exact type identity; protocol and framework implementation remains in packages/zig/.

Installation​

Use the repository's pinned Zig compiler and a matching Transit checkout. Add a path dependency on its sdks/zig directory in your application's build.zig.zon:

.dependencies = .{
.transit_sdk = .{ .path = "../transit/sdks/zig" },
},

The complete checkout supplies the shared dependency closure. Copying only sdks/zig is insufficient; an independently distributed Zig archive is not provided. Select the same protocol definition as the running authority.

In build.zig, resolve the SDK once and import only the modules your application uses, with your own target and optimization settings:

const sdk = b.dependency("transit_sdk", .{ .target = target, .optimize = optimize });
app.root_module.addImport("transit_client", sdk.module("transit_client"));
app.root_module.addImport("transit_station", sdk.module("transit_station"));

Existing @import("transit_client") and @import("transit_station") statements remain unchanged. Allocators, I/O, credentials, resident bounds and handle lifetimes stay explicit in the owning APIs.

Exported modules​

ModuleAPI owner
transit_clientSigned operations, scoped sessions and exact recovery
transit_protocolPublic values and canonical contracts
transit_stationBehaviors, turns and state helpers
transit_station_documentDocument callers
transit_station_httpRecorded HTTP callers
transit_station_grpcRecorded RPC callers
transit_queryQuery preparation, admission and reads
transit_catalogCatalog declarations and callers
transit_fuzeTyped query plans and execution
transit_station_appApplication declarations and installation

The work-items application has a standalone manifest consuming this SDK. The root example builds use the same SDK modules. The caller reference defines uncertainty, current authorization and cancellation across all supported languages.