Skip to main content

Module ext_resolver

Module ext_resolver 

Source
Expand description

Helper for resolving ext://<id>#component references.

§Resolution flow

  1. Parse the ext://<id>#component ref — error if malformed.
  2. Look up <id> in pack.extensions.json via read_extensions_file.
  3. Acquire the extension’s .gtxpack from its declared file:// or bare local source.
  4. Read component.json from the ZIP to obtain the component asset path and expected digest.
  5. Read the component wasm asset from the ZIP.
  6. Verify SHA-256 digest — error on mismatch.
  7. Return the extracted bytes.

§component.json schema (Phase 2 sidecar)

The resolver reads a packc-owned component.json sidecar at the root of the .gtxpack ZIP. It is written alongside the canonical, store-validated describe.json (describe-v2) manifest, which itself cannot carry this metadata (its schema root is additionalProperties: false).

{
  "component": {
    "id": "greentic.component-http",
    "asset": "component.wasm",
    "digest": "sha256:<hex>"
  }
}

Fields:

  • component.id — the store id; informational (the resolver does not enforce id == extension_id).
  • component.asset — ZIP entry name of the runtime wasm. For a ComponentExtension producer this is component.wasm at the root; other producers may use arbitrary paths such as assets/component-<name>.wasm.
  • component.digestsha256:<hex> digest of the wasm bytes.

The Phase-2 producer (greentic-component store publish) must emit exactly this shape.

Structs§

ExtRef
Parsed form of ext://<id>#component.
GtxpackComponentEntry
Single embedded component entry in component.json.
GtxpackComponentSidecar
Embedded-component descriptor from the component.json sidecar inside a .gtxpack ZIP.
StoreRef
Parsed form of a store://<name>@<version> extension source ref.

Functions§

download_store_artifact
Download the extension .gtxpack from store_base for store_ref, verify the whole-archive x-artifact-sha256 (when advertised), cache it under cache_dir, and return the bytes.
extract_and_verify_bytes
Read the component.json sidecar + the component wasm asset from .gtxpack ZIP zip_bytes, verify the digest, and return (wasm_bytes, verified_digest).
parse_ext_ref
Parse an ext://<id>#component reference.
parse_store_ref
Parse a store://<name>@<version> extension source ref.
read_describe_from_gtxpack
Read the describe.json sidecar from a .gtxpack ZIP.
resolve_agent_tool_requirements
For each tool extension used by the agents, acquire its .gtxpack, read describe.json, and extract the secret requirements of the used tools.
resolve_ext_component
Resolve an ext://<id>#component reference by extracting the wasm from the extension’s .gtxpack and verifying the digest against the component.json sidecar.
resolve_ext_component_with_dist
Cache/handle-aware entry point that resolves an ext://<id>#component ref, acquiring the extension .gtxpack over the network when its declared source is store:// (and, guarded, oci://). file:///bare sources behave exactly as resolve_ext_component.
store_artifact_url
Build the store artifact endpoint URL for an extension (name, version).