Publish Foundry Preview (foundry-001-dev-00 & foundry-002-dev-00 Harbor 0.26 bundles, allowlisted verifier, 3-lab calibration)
fe0ff58 verified Download preview/core/plugin_base.py from zero-trust-physics/zero-trust-physics-foundry-preview: direct link, hf CLI and curl.
- Browser
- Download file 2.66 kB
-
https://huggingface.co/datasets/zero-trust-physics/zero-trust-physics-foundry-preview/resolve/main/preview/core/plugin_base.py
- Command line
-
hf download hf://datasets/zero-trust-physics/zero-trust-physics-foundry-preview/preview/core/plugin_base.py
-
curl -L -o plugin_base.py https://huggingface.co/datasets/zero-trust-physics/zero-trust-physics-foundry-preview/resolve/main/preview/core/plugin_base.py
2.66 kB
| """Base abstractions for stateful closed-loop/fault plugins and task evaluators.""" | |
| from __future__ import annotations | |
| from abc import ABC, abstractmethod | |
| from dataclasses import dataclass, field | |
| from typing import Any | |
| class VerifiedCall: | |
| """One SHA-384 verified and fresh-recomputed engine call recovered from `call_ledger.jsonl`.""" | |
| submitted_seal: str | |
| model_id: str | |
| tool: str | |
| args: dict[str, Any] | |
| answer: dict[str, Any] | |
| raw_text: str | |
| answer_sha384: str | |
| receipt_sha384: str | |
| primary_seal: str | |
| class TaskEvaluatorContext: | |
| """Runtime context handed to each per-task `evaluator.py:grade(submission, ctx)`.""" | |
| task_id: str | |
| task_dir: str | |
| task_spec: dict[str, Any] | |
| pack_dir: str | |
| client: Any | |
| seal_bin: str | None = None | |
| vault: dict[str, Any] = field(default_factory=dict) | |
| ledger_records: list[dict[str, Any]] = field(default_factory=list) | |
| ledger_audit: dict[str, Any] | None = None | |
| resolved_seals: list[VerifiedCall] = field(default_factory=list) | |
| verified_by_model: dict[str, list[VerifiedCall]] = field(default_factory=dict) | |
| plugin_episodes: list[dict[str, Any]] = field(default_factory=list) | |
| class StatefulPlantPlugin(ABC): | |
| """Base class for stateful `CLC` / `FLT` plugins executed inside root `core/daemon.py`.""" | |
| def __init__(self, task_spec: dict[str, Any], engine_client: Any, vault: dict[str, Any] | None = None): | |
| self.task_spec = task_spec | |
| self.client = engine_client | |
| self.vault = vault or {} | |
| def tool_definitions(self) -> list[dict[str, Any]]: | |
| """Return MCP JSON tool schemas exposed to the unprivileged agent.""" | |
| def tool_category(self, tool_name: str) -> str | None: | |
| """Return `'discovery'`, `'sim'`, `'exempt'`, or `None` if not handled by this plugin.""" | |
| def handle_tool(self, tool_name: str, args: dict[str, Any]) -> dict[str, Any]: | |
| """Execute a plugin tool call. | |
| Returns a dict: | |
| - `text`: JSON string returned to the agent | |
| - `isError`: bool | |
| - `step_call_records`: optional list of `{"tool": ..., "model_id": ..., "args": ..., "raw_text": ...}` | |
| for daemon ledger recording & post-run cryptographic recomputation. | |
| - `episode_record`: optional snapshot stored on finalize or step. | |
| """ | |
| def budget_extras(self) -> dict[str, Any]: | |
| """Optional status counters injected into `budget_status`.""" | |
| return {} | |
| def close(self) -> None: | |
| """Optional cleanup hook called when daemon shuts down.""" | |
| return None | |