Skip to main content

greentic_ext_runtime/
host_bindings.rs

1#![allow(warnings)]
2
3// Bind against the design-extension world from the component's perspective.
4// wasmtime bindgen! generates:
5//   - add_to_linker() for `import` items (host implements these for the component)
6//   - typed export accessors for `export` items (host calls these on the component)
7//
8// NOTE: wasmtime appends a version suffix to package module names when multiple
9// versions of the same package namespace coexist in wit/deps (required for v2
10// dual-support). The unversioned paths that existed before Task 1 become:
11//   greentic::extension_design  ->  exports::greentic::extension_design0_2_0
12//   greentic::extension_base    ->  greentic::extension_base0_1_0
13// Callers in runtime*.rs use these versioned paths directly.
14wasmtime::component::bindgen!({
15    path: "wit",
16    world: "greentic:extension-design/design-extension@0.2.0",
17});
18
19// ---------------------------------------------------------------------------
20// Deploy-extension bindings
21//
22// Generated in a sibling `mod deploy` to keep the type namespace isolated
23// from the design-extension bindings above. Both worlds share
24// `greentic:extension-base` + `greentic:extension-host/*`, so generating
25// them in the root module would cause duplicate-type errors.
26// ---------------------------------------------------------------------------
27pub mod deploy {
28    wasmtime::component::bindgen!({
29        path: "wit",
30        world: "greentic:extension-deploy/deploy-extension@0.1.0",
31    });
32}
33
34// ---------------------------------------------------------------------------
35// Bundle-extension bindings
36//
37// Same pattern as deploy: isolated submodule because all three worlds share
38// `extension-base` + `extension-host` types and re-binding them at the root
39// would conflict. The bundle world exports `recipes` and `bundling` (the
40// host calls `bundling.render(...)` in `runtime::render_bundle`); it imports
41// the standard host triplet (logging / i18n / broker), wired through the
42// shared `add_to_linker` helpers.
43// ---------------------------------------------------------------------------
44pub mod bundle {
45    wasmtime::component::bindgen!({
46        path: "wit",
47        world: "greentic:extension-bundle/bundle-extension@0.1.0",
48    });
49}
50
51// ---------------------------------------------------------------------------
52// DW-Composer-extension bindings
53//
54// Isolated submodule for the `greentic:dw-composer/dw-composer-extension`
55// world. Composer extensions export a domain-specific `composer` interface
56// (`greentic:dw-composer/composer@0.1.0`) instead of the generic
57// `greentic:extension-design/tools` interface. Keeping them in their own
58// submodule avoids duplicate-type conflicts with the design-extension
59// bindings above.
60// ---------------------------------------------------------------------------
61pub mod dw_composer {
62    wasmtime::component::bindgen!({
63        path: "wit",
64        world: "greentic:dw-composer/dw-composer-extension@0.1.0",
65    });
66}
67
68// ---------------------------------------------------------------------------
69// v2-contract bindings (unified 6-variant extension-error, spec
70// 2026-06-07-extension-response-envelope-design.md). Old-world modules above
71// stay for extensions built against the previous WIT; the runtime resolves
72// per-extension at dispatch time (see runtime::resolve_iface_versions).
73// ---------------------------------------------------------------------------
74pub mod design_v03 {
75    wasmtime::component::bindgen!({
76        path: "wit",
77        world: "greentic:extension-design/design-extension@0.3.0",
78    });
79}
80
81// ---------------------------------------------------------------------------
82// design-extension @0.4.0 bindings.
83//
84// Identical to the @0.3.0 world plus one additive import:
85// `greentic:oauth-broker/broker-v1@1.0.0`. The version bump (rather than an
86// in-place edit of @0.3.0) keeps the world signature versioned, so a component
87// compiled against the broker-capable world is distinguishable from one that is
88// not. This is the only world that generates the oauth-broker host bindings;
89// the broker `Host` impl (host_state.rs) and linker wiring (loaded.rs) target
90// this module. Registering broker-v1 once in the shared linker covers every
91// instantiated component regardless of the world version it targets.
92// ---------------------------------------------------------------------------
93pub mod design_v04 {
94    wasmtime::component::bindgen!({
95        path: "wit",
96        world: "greentic:extension-design/design-extension@0.4.0",
97    });
98}
99
100pub mod deploy_v02 {
101    wasmtime::component::bindgen!({
102        path: "wit",
103        world: "greentic:extension-deploy/deploy-extension@0.2.0",
104    });
105}
106
107pub mod bundle_v02 {
108    wasmtime::component::bindgen!({
109        path: "wit",
110        world: "greentic:extension-bundle/bundle-extension@0.2.0",
111    });
112}
113
114pub mod dw_composer_v02 {
115    wasmtime::component::bindgen!({
116        path: "wit",
117        world: "greentic:dw-composer/dw-composer-extension@0.2.0",
118    });
119}