pynydus.engine.hatcher¶
Hatching pipeline: transforms an Egg into a target runtime. Spec 13.
Two modes: rebuild (default): render from structured egg modules via connector passthrough: replay redacted raw/ snapshot verbatim
Pipeline steps: 1. Version check: verify min_nydus_version compatibility 2. Build file dict: connector.render() (rebuild) or raw snapshot (passthrough) 3. LLM polish: adapt/polish on placeholder’d content (no real secrets) 4. Secrets IN: substitute {{SECRET_NNN}} / {{PII_NNN}} with real values 5. Write connector (agent) files to output/agent/ 6. Write standard artifacts (AGENTS.md, agent-card.json, apm.yml, mcp.json) to output root 7. Hatch log: write hatch_log.json to output/logs/
The LLM never sees real secrets: only placeholder tokens. Real values are injected as the last transformation before writing to disk.
Module Contents¶
Functions¶
Run the full hatching pipeline (see module docstring for steps). |
|
Replace all {{SECRET_NNN}} / {{PII_NNN}} placeholders with real values. |
|
Write egg-level standard artifacts to the output root. |
|
Write all file entries to disk. Returns list of created filenames. |
|
Write hatch_log.json to the output directory’s logs/ folder. |
|
Return the hatcher connector for the given agent type. |
|
Parse a .env file into a dict of key=value pairs. |
|
Build placeholder -> value mapping, raising if required secrets are missing. |
|
Reject eggs that require a newer Nydus version than we have. |
Data¶
API¶
- pynydus.engine.hatcher.logger¶
‘getLogger(…)’
- pynydus.engine.hatcher.hatch(egg: pynydus.api.schemas.Egg, *, target: pynydus.common.enums.AgentType, output_dir: pathlib.Path | None = None, secrets_path: pathlib.Path | None = None, mode: pynydus.common.enums.HatchMode = HatchMode.REBUILD, llm_config: pynydus.llm.LLMTierConfig | None = None, spawn_log: list[dict] | None = None, raw_artifacts: dict[str, str] | None = None) pynydus.api.schemas.HatchResult¶
Run the full hatching pipeline (see module docstring for steps).
Args: egg: Egg to hatch (typically from :func:
~pynydus.engine.packager.load). target: Destination runtime (openclaw,zeroclaw,letta). output_dir: Directory for output files. default./[target]/. secrets_path:.envfile for placeholder substitution (secrets IN). mode:rebuild(structuredrender()) orpassthrough(raw snapshot). llm_config: Optional LLM tier for refinement (spawn and hatch). spawn_log: Spawn log entries forwarded to the hatch LLM. defaults toegg.spawn_log. raw_artifacts: Redactedraw/files. defaults toegg.raw_artifacts. If the egg was loaded withinclude_raw=False,egg.raw_artifactsis empty. pass the result of :func:~pynydus.engine.packager.read_raw_artifactsor reload withinclude_raw=Truefor passthrough.Returns:
HatchResultwith output path, files written, warnings, and hatch log.
- pynydus.engine.hatcher._substitute_secrets(files: dict[str, str], placeholder_map: dict[str, str]) dict[str, str]¶
Replace all {{SECRET_NNN}} / {{PII_NNN}} placeholders with real values.
- pynydus.engine.hatcher._write_standard_artifacts(egg: pynydus.api.schemas.Egg, output_dir: pathlib.Path, hatch_log: list[dict]) list[str]¶
Write egg-level standard artifacts to the output root.
- pynydus.engine.hatcher._write_files(files: dict[str, str], output_dir: pathlib.Path) list[str]¶
Write all file entries to disk. Returns list of created filenames.
- pynydus.engine.hatcher._write_hatch_log(result: pynydus.api.schemas.HatchResult) None¶
Write hatch_log.json to the output directory’s logs/ folder.
- pynydus.engine.hatcher._get_hatcher(target: pynydus.common.enums.AgentType)¶
Return the hatcher connector for the given agent type.
- pynydus.engine.hatcher._parse_env_file(secrets_path: pathlib.Path) dict[str, str]¶
Parse a .env file into a dict of key=value pairs.
- pynydus.engine.hatcher._build_placeholder_map(egg: pynydus.api.schemas.Egg, env_vars: dict[str, str], secrets_path: pathlib.Path) dict[str, str]¶
Build placeholder -> value mapping, raising if required secrets are missing.
- pynydus.engine.hatcher._check_version_compat(egg: pynydus.api.schemas.Egg) None¶
Reject eggs that require a newer Nydus version than we have.