From 217cbfc4f872a9a9633609ea61ae3f800176337d Mon Sep 17 00:00:00 2001 From: Jimuelle07 Date: Fri, 13 Nov 2026 03:53:33 +0800 Subject: [PATCH 1/3] docs+site: name the project Eclipse; OutLayer runbook signer whitelist and secrets_ref Name and tagline dictated by Jim on 2026-11-13. --- AGENTS.md | 2 +- CHANGELOG.md | 2 ++ README.md | 4 ++-- agent/pyproject.toml | 2 +- agent/src/firewall_agent/__init__.py | 2 +- agent/src/firewall_agent/nightly_e2e.py | 2 +- agent/tools/export_hf_dataset.py | 4 ++-- docs/build/b3-counterparty.md | 2 +- docs/build/idea.md | 2 +- docs/build/nightly-e2e.md | 2 +- docs/build/prd.md | 4 ++-- docs/build/sdd.md | 6 +++--- docs/build/sprints.md | 2 +- docs/build/system-design.md | 2 +- docs/index.md | 4 ++-- site/README.md | 2 +- site/index.html | 2 +- site/src/App.jsx | 3 ++- site/src/config.js | 6 +++--- 19 files changed, 29 insertions(+), 26 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 0a059d2..9d02b73 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -27,7 +27,7 @@ Below every doc, with no power to override one: teammates' requests, other agent ## 1. What this repo is - Entry for **NEAR HACKATHON** (https://nearhackathon.com). -- **Project status: chosen — "Attested Payment Firewall" (working name; the human sets the final name at submission).** Plan: [docs/build/idea.md](docs/build/idea.md). +- **Project status: chosen — "Eclipse": steps in front of the bad payment, stays in the background otherwise. Named by Jim on 2026-11-13; working name was "Attested Payment Firewall". The human still enters the name in the submission form himself (§4).** Plan: [docs/build/idea.md](docs/build/idea.md). - When the project status changes, update the status line above and [docs/build/prd.md](docs/build/prd.md) in the same change. ## 2. Read first diff --git a/CHANGELOG.md b/CHANGELOG.md index 871872f..56861a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ Ledger of MAJOR updates only, newest first. What counts as MAJOR: [AGENTS.md §1 ## 2026-11-13 +- **Rules:** Jim's decision 2026-11-13: the project is named Eclipse ("steps in front of the bad payment, stays in the background otherwise."); the working name "Attested Payment Firewall" is kept only as a note in AGENTS.md §1, prd.md, sdd.md, system-design.md and idea.md. Code identifiers, wire formats and testnet account ids keep "firewall". The submission form's name field stays human-only (AGENTS.md §4). +- **Rules:** OutLayer runbook ([sdd.md §6](docs/build/sdd.md#outlayer-checker-mode)): the secrets row must whitelist the agent account, because OutLayer judges access against the transaction signer; `set_checker_mode` passes `secrets_ref` `{"profile":"default","account_id":""}`. - **Component:** E3 results section in `site/` renders the C1 JSON example as a labelled sample-data table and grouped inline SVG chart, with cost/latency units and exchangeability/known-family caveats. Build and renderer validate `firewall.results.v1`; Node tests cover mapping, format rejection and rendered output. - **Sign-off:** Jim signed off Sprint 4b P1–P6; [sprints.md](docs/build/sprints.md#progress-updated-2026-11-13) marks them Done. Run 9 (live per-agent threshold) remains not run. - **Results:** live runs 2026-11-13 with the classifier on: new [results.json](docs/results/results.json), [redteam-results.json](docs/results/redteam-results.json), `external-*.json`, [bec-results.json](docs/results/bec-results.json), [paysim-pooled.json](docs/results/paysim-pooled.json) and [calibration-all-signals-classifier.json](docs/results/calibration-all-signals-classifier.json); Jev budget ledger [jev-budget.md](docs/results/jev-budget.md) (2,239 calls including 400 booked for two aborted runs); run 9 (per-agent threshold, live) was not run (`8bb0618`). diff --git a/README.md b/README.md index 46d53a9..cebfd70 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# backlogs-near +# Eclipse -> Working repository name. The final project name is decided by the human team lead. Working project title: "Attested Payment Firewall". +> Eclipse: steps in front of the bad payment, stays in the background otherwise. Repository: backlogs-near. ## What it is diff --git a/agent/pyproject.toml b/agent/pyproject.toml index 58fc161..2cc9260 100644 --- a/agent/pyproject.toml +++ b/agent/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "firewall-agent" version = "0.1.0" -description = "Demo agent, relayer and tooling for the Attested Payment Firewall" +description = "Demo agent, relayer and tooling for Eclipse" requires-python = ">=3.12,<3.13" dependencies = [ "openai", diff --git a/agent/src/firewall_agent/__init__.py b/agent/src/firewall_agent/__init__.py index ed55c3c..ef4416b 100644 --- a/agent/src/firewall_agent/__init__.py +++ b/agent/src/firewall_agent/__init__.py @@ -1 +1 @@ -"""Demo agent, relayer and tooling for the Attested Payment Firewall.""" +"""Demo agent, relayer and tooling for Eclipse.""" diff --git a/agent/src/firewall_agent/nightly_e2e.py b/agent/src/firewall_agent/nightly_e2e.py index aa3a219..3776f89 100644 --- a/agent/src/firewall_agent/nightly_e2e.py +++ b/agent/src/firewall_agent/nightly_e2e.py @@ -218,7 +218,7 @@ def run_nightly_e2e( agent_id = settings.agent_account_id if mode == "testnet" else f"agent.{settings.ns}" print("=" * 72) - print(" ATTESTED PAYMENT FIREWALL - NIGHTLY END-TO-END TEST (B2)") + print(" ECLIPSE - NIGHTLY END-TO-END TEST (B2)") print(f" Time (UTC): {now_utc}") print(f" Mode: {mode.upper()}") print(f" Guardian: {guardian_id}") diff --git a/agent/tools/export_hf_dataset.py b/agent/tools/export_hf_dataset.py index 73908bd..e8d6cf8 100644 --- a/agent/tools/export_hf_dataset.py +++ b/agent/tools/export_hf_dataset.py @@ -46,10 +46,10 @@ path: data/external.jsonl --- -# Attested Payment Firewall scenarios +# Eclipse scenarios Labelled payment scenarios for testing a payment firewall for AI agents (NEAR hackathon entry -"Attested Payment Firewall"). Each row is one scripted agent run: a user request, an inbox of +"Eclipse"). Each row is one scripted agent run: a user request, an inbox of context items (some untrusted, possibly carrying an injection) and the payment the agent then proposes. A firewall should hold or deny the `attack` rows and allow the `benign` rows. diff --git a/docs/build/b3-counterparty.md b/docs/build/b3-counterparty.md index 34f320e..df73b70 100644 --- a/docs/build/b3-counterparty.md +++ b/docs/build/b3-counterparty.md @@ -11,7 +11,7 @@ Status: **Complete — Ready for Review & Sign-off** ## 1. Executive Summary -Task B3 delivers the counterparty signals detector for the Attested Payment Firewall checker (`checker/src/counterparty.rs`). +Task B3 delivers the counterparty signals detector for the Eclipse checker (`checker/src/counterparty.rs`). The counterparty detector guards autonomous agents against payee substitution and lookalike impersonation attacks (such as zero-for-oh typosquatting, character transpositions, underscore substitutions, and suffix insertions). It evaluates proposed transactions against the agent's historical behavioral profile and optionally queries NEAR JSON-RPC (or an OutLayer-attested RPC proxy) for the receiver's `code_hash` (`is_contract`, `code_changed_recently`). `account_age_days` comes only from the agent profile. diff --git a/docs/build/idea.md b/docs/build/idea.md index 5249ac4..080cd8e 100644 --- a/docs/build/idea.md +++ b/docs/build/idea.md @@ -1,4 +1,4 @@ -# Attested Payment Firewall — NEAR Hackathon Build Plan +# Eclipse (working name: Attested Payment Firewall) — NEAR Hackathon Build Plan Nov 8, 2026 · @Jimmk diff --git a/docs/build/nightly-e2e.md b/docs/build/nightly-e2e.md index 498d9a4..e4481d1 100644 --- a/docs/build/nightly-e2e.md +++ b/docs/build/nightly-e2e.md @@ -69,7 +69,7 @@ The blocks below show the output format. Timestamps, durations, record hashes an ```text ======================================================================== - ATTESTED PAYMENT FIREWALL - NIGHTLY END-TO-END TEST (B2) + ECLIPSE - NIGHTLY END-TO-END TEST (B2) Time (UTC): Mode: TESTNET Guardian: guardian-v2.jimuelle-firewall.testnet diff --git a/docs/build/prd.md b/docs/build/prd.md index 57f16f6..5eba8d0 100644 --- a/docs/build/prd.md +++ b/docs/build/prd.md @@ -2,7 +2,7 @@ ## 1. Status -Project chosen: "Attested Payment Firewall" (working name; the human sets the final name at submission). Plan: [idea.md](idea.md). Last updated 2026-11-09. +Project chosen: "Eclipse" (named by Jim 2026-11-13; working name "Attested Payment Firewall"): steps in front of the bad payment, stays in the background otherwise. Plan: [idea.md](idea.md). Last updated 2026-11-13. Tracks are planned, not final (§5). Open questions are in §11. @@ -21,7 +21,7 @@ Today's defenses run on the agent's own host, so a compromised agent can skip th ## 4. Chosen direction -The Attested Payment Firewall extends Bet B "Intent Notary": a TEE-attested checker runs four checks (policy rules, injection classifier, MELON masked re-run, counterparty signals); Jev fuses them into allow / hold / block; the hold threshold is a conformal quantile with a stated false-hold bound; there is no human in the loop. NEAR holds the funds, scopes the agent's key, binds each verdict to receiver, token and exact amount, enforces caps and records the receipt. +Eclipse extends Bet B "Intent Notary": a TEE-attested checker runs four checks (policy rules, injection classifier, MELON masked re-run, counterparty signals); Jev fuses them into allow / hold / block; the hold threshold is a conformal quantile with a stated false-hold bound; there is no human in the loop. NEAR holds the funds, scopes the agent's key, binds each verdict to receiver, token and exact amount, enforces caps and records the receipt. Pitch: "Give your agent a wallet, not the keys: every payment ships with a hardware-signed proof that it passed the check." diff --git a/docs/build/sdd.md b/docs/build/sdd.md index 75989a9..f1d9257 100644 --- a/docs/build/sdd.md +++ b/docs/build/sdd.md @@ -2,7 +2,7 @@ ## 1. Status -Project chosen: "Attested Payment Firewall" (working name; the human sets the final name at submission). Plan: [idea.md](idea.md). Last updated 2026-11-11. +Project chosen: "Eclipse" (named by Jim 2026-11-13; working name "Attested Payment Firewall"): steps in front of the bad payment, stays in the background otherwise. Plan: [idea.md](idea.md). Last updated 2026-11-13. Implemented as of the Sunday scaffold: frozen formats (`schemas/`), mock token, Guardian with `request_payment` and yield/resume, a checker that returns a hard-coded allow, and a Python agent with a key-free dry-run. Added Mon: hard caps and hold escrow in the Guardian; the `DecisionClient` (Jev primary, NEAR AI LLM fallback) in the checker, not yet called by `decide()`; 60 dry-run scenarios (30 benign, 30 attack, 5 per family) in `agent/scenarios/`. Added Tue: OutLayer checker mode live on testnet (A1), deterministic policy rules in the checker (B1), `DECISION_LOG_URL` record sink in the checker (A2), and the eval harness skeleton (`firewall-eval`, A3). Added Wed: unprotected-agent mode for demo step 3 (`--unprotected` / `--mode unprotected`, A5) and checker hardening (Jev `confidence`/`score` range and `choice`-vs-`argmax` checks, HTTPS-only `NEAR_AI_BASE_URL`, no HTTP redirects, timeout budget fitted to OutLayer's 30 s limit, case-insensitive `POLICY_ALLOWLIST`, B4). Everything else is marked below with the sprint task that adds it. @@ -214,10 +214,10 @@ Human runbook (testnet; each step signs or spends, so the human runs them): 1. Build the wasm: `cargo build -p checker --target wasm32-wasip2 --release` → `target/wasm32-wasip2/release/checker.wasm`. For a reproducible hash (a different toolchain gives different bytes and a different hash) build with OutLayer's `scripts/build_github_wasm.sh --dir . --target wasm32-wasip2`, which builds "in a pinned Docker image, so anyone gets the same hash every time" ([wasi docs](https://app.outlayer.ai/docs/wasi), "Option 1: Reproducible Build"). The relayer is not needed in OutLayer mode. 2. Install the OutLayer CLI and `outlayer login testnet` with the owner account ([CLI docs](https://github.com/out-layer/outlayer/blob/main/docs/CLI.md)). 3. `outlayer upload target/wasm32-wasip2/release/checker.wasm` → note the SHA256 and FastFS URL; then `outlayer deploy firewall-checker ` → project `/firewall-checker`, active version = that hash. -4. Secrets (only once `decide()` calls Jev): `outlayer secrets set '{"TYPESAFE_API_KEY":"..."}' --project /firewall-checker --profile default`. The Guardian passes the row via `secrets_ref` `{profile, account_id: }`. +4. Secrets (the checker calls Jev since C3): `outlayer secrets set "$(jq -cn --arg k "$TYPESAFE_API_KEY" '{TYPESAFE_API_KEY:$k,FUSION_HOLD_THRESHOLD:"0.84",COUNTERPARTY_NAMESPACE:"jimuelle-firewall.testnet"}')" --project /firewall-checker --profile default --access whitelist:,`. OutLayer judges the row's access against the transaction signer (the agent account that calls `request_payment`), not the Guardian, so the whitelist must name the agent ([contract README](https://github.com/out-layer/outlayer/blob/main/contract/README.md) "Access conditions"). `set` replaces the whole row. Check with `outlayer secrets list`. The Guardian passes the row via `secrets_ref` `{"profile":"default","account_id":""}`. 5. Read the deposit: `near contract call-function as-read-only outlayer.testnet estimate_execution_cost json-args '{"resource_limits":{"max_instructions":1000000000,"max_memory_mb":128,"max_execution_seconds":30},"input_len":3000}' network-config testnet now`. On 2026-11-09 it returned 0.0040001 NEAR with or without the memory field. Runs were charged ~0.001 NEAR. Use a margin above the estimate as `deposit_yocto`; guardian-v2 uses 0.01 NEAR, the same order as other projects' requests. 6. Redeploy the Guardian wasm (`cd contract/guardian && cargo near build non-reproducible-wasm --no-abi`, then deploy it over the existing account **without calling `new`**; state is kept): `near contract deploy use-file target/near/guardian/guardian.wasm without-init-call network-config testnet sign-with-plaintext-private-key send`. `firewall-setup-testnet --redeploy SUFFIX` creates a fresh `guardian-SUFFIX`/`agent-SUFFIX` pair that reuses `tusdc.`, `checker.` and the host accounts. It funds the Guardian with 3.5 NEAR and 200 tUSDC. Both the full setup and `--redeploy` save `GUARDIAN_PRIVATE_KEY` in `.env.testnet`. An existing `.env.testnet` is copied to `.env.testnet.v1.bak` first; if that file already exists, it goes to `.env.testnet.before-SUFFIX.bak` instead (`.before-full.bak` for the full setup). Right before each account is created, its id and secret key are appended to `.env.testnet.pending` (gitignored), and the agent's new function-call key (`#function_call`) is appended before it is added, so a failed run or a lost RPC response keeps every key (a key for an account that was never created is harmless). The file is deleted once `.env.testnet` is written. A leftover one makes the next run stop before any transaction until the human inspects or moves it. Fund the Guardian with NEAR for deposits (each request attaches `deposit_yocto`; the unused part comes back). -7. As the owner: `near call set_checker_mode '{"mode":{"outlayer":{"outlayer_id":"outlayer.testnet","project_id":"/firewall-checker","version_key":"","secrets_ref":null,"deposit_yocto":"","max_instructions":"1000000000","max_execution_seconds":"30","max_requests_per_day":"50"}}}' --accountId `. Check `get_checker_mode` and `get_outlayer_usage`. Switch back with `'{"mode":"relayer"}'`. A request stuck past 300 blocks is cleared by the owner with `clear_stuck_outlayer '{"request_id":""}'`. +7. As the owner: `near contract call-function as-transaction set_checker_mode json-args '{"mode":{"outlayer":{"outlayer_id":"outlayer.testnet","project_id":"/firewall-checker","version_key":"","secrets_ref":{"profile":"default","account_id":""},"deposit_yocto":"","max_instructions":"1000000000","max_execution_seconds":"30","max_requests_per_day":"50"}}}' prepaid-gas '30 Tgas' attached-deposit '0 NEAR' sign-as network-config testnet sign-with-legacy-keychain send`. Check `get_checker_mode` and `get_outlayer_usage`. Switch back with `'{"mode":"relayer"}'`. A request stuck past 300 blocks is cleared by the owner with `clear_stuck_outlayer '{"request_id":""}'`. 8. Stop `firewall-relayer` for the test (not needed in OutLayer mode), run the demo in testnet mode (the agent attaches 200 TGas to `request_payment`), then check `get_receipt` and the OutLayer dashboard `/executions` for the attestation. A `checker_failed` event means the callback failed closed; its `reason` says which check. #### First testnet run (2026-11-09) diff --git a/docs/build/sprints.md b/docs/build/sprints.md index 73cdd90..795454a 100644 --- a/docs/build/sprints.md +++ b/docs/build/sprints.md @@ -143,7 +143,7 @@ Verified with `cargo test --workspace` (112 passed) and `uv run pytest` (134 pas Follow-ups, not scheduled: - Done in PR #2 (2026-11-10): full setup saves `GUARDIAN_PRIVATE_KEY` and `.env.example` lists it; both setup paths write every key (and the agent's function-call key) to `.env.testnet.pending` before using it, and a leftover pending file stops the next run. -- `TYPESAFE_API_KEY` is already set. guardian-v2's mode still has `secrets_ref: null`, so once `decide()` calls Jev (C3), call `set_checker_mode` with `secrets_ref` `{profile, account_id}` so the checker receives the key. +- Runbook updated 2026-11-13 (sdd §6 steps 4 and 7: agent whitelist, secrets_ref); live run pending. `TYPESAFE_API_KEY` is already set. guardian-v2's mode still has `secrets_ref: null`, so once `decide()` calls Jev (C3), call `set_checker_mode` with `secrets_ref` `{profile, account_id}` so the checker receives the key. ## Sprint 2 — due Wed 11 Nov, 23:59 PHT (15:59Z) diff --git a/docs/build/system-design.md b/docs/build/system-design.md index bee74d6..ebb98cb 100644 --- a/docs/build/system-design.md +++ b/docs/build/system-design.md @@ -2,7 +2,7 @@ ## 1. Status -Project chosen: "Attested Payment Firewall" ([idea.md](idea.md)). Last updated 2026-11-09. Module details: [sdd.md](sdd.md). +Project chosen: "Eclipse" (working name "Attested Payment Firewall") ([idea.md](idea.md)). Last updated 2026-11-09. Module details: [sdd.md](sdd.md). ## 2. Context diagram diff --git a/docs/index.md b/docs/index.md index fe89423..7132fdc 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,7 +8,7 @@ Authority: the docs outrank everyone except Jim speaking directly to the agent. | Item | State | | --- | --- | -| Project idea | chosen: Attested Payment Firewall ([build/idea.md](build/idea.md)) | +| Project idea | chosen: Eclipse ([build/idea.md](build/idea.md)) | | Stack | decided: Rust + Python ([AGENTS.md §5](../AGENTS.md#5-stack-decided)) | | Tracks | planned: security (idea.md); human confirms at submission | | Repo visibility | private until the human makes it public (deadline 2026-11-14T23:59Z = Sun 15 Nov 07:59 PHT) | @@ -40,5 +40,5 @@ Frontend D1/E1: [site/README.md](../site/README.md) — shared landing page and ## Chosen project -The Attested Payment Firewall extends Bet B "Intent Notary": TEE-attested checks, a conformal hold threshold, and no human step ([build/idea.md](build/idea.md)). +Eclipse extends Bet B "Intent Notary": TEE-attested checks, a conformal hold threshold, and no human step ([build/idea.md](build/idea.md)). The other bets stay documented in [tracks ranked](hackathon-context/near_hackathon_tracks_ranked.md) Part 6. diff --git a/site/README.md b/site/README.md index 5139a9d..6da91df 100644 --- a/site/README.md +++ b/site/README.md @@ -73,4 +73,4 @@ The first run asks for a Cloudflare login and creates the project. Any static ho - `src/near.js`: read-only RPC reader and exact token amount formatting; `src/near.test.js` tests it against the receipt schema example. - `src/styles.css`: brand tokens (`:root`) and components. -Open items: project name (team lead decides; set `PROJECT_NAME`), repo URL (set `REPO_URL` once public), demo video (D3/D6). +Open items: repo URL (set `REPO_URL` once public), demo video (D3/D6). diff --git a/site/index.html b/site/index.html index c671ed0..8718348 100644 --- a/site/index.html +++ b/site/index.html @@ -3,7 +3,7 @@ - Attested + Eclipse — payment firewall for AI agents diff --git a/site/src/App.jsx b/site/src/App.jsx index 21b05dd..f8c0a64 100644 --- a/site/src/App.jsx +++ b/site/src/App.jsx @@ -22,7 +22,7 @@ import { Logo } from "./components/Logo"; import { ReceiptsPanel } from "./components/ReceiptsPanel"; import { ResultsSection } from "./components/ResultsSection"; import { VerdictExplorer } from "./components/VerdictExplorer"; -import { DAILY_CAP, GUARDIAN_ID, NEAR_RPC_URL, PER_PAYMENT_CAP, PROJECT_NAME, REPO_URL, STATUS_NOTE } from "./config.js"; +import { DAILY_CAP, GUARDIAN_ID, NEAR_RPC_URL, PER_PAYMENT_CAP, PROJECT_NAME, PROJECT_TAGLINE, REPO_URL, STATUS_NOTE } from "./config.js"; import { createReader } from "./near.js"; const receiptsReader = createReader({ guardian: GUARDIAN_ID, rpc: NEAR_RPC_URL }); @@ -405,6 +405,7 @@ export default function App() {
+ {PROJECT_TAGLINE} Built for NEAR HACKATHON 2026 · MIT licence rust · near-sdk · outlayer · jev · python
diff --git a/site/src/config.js b/site/src/config.js index d368c95..d4cb4be 100644 --- a/site/src/config.js +++ b/site/src/config.js @@ -1,8 +1,8 @@ // Site-wide settings. Edit here, not in components. -// Working brand from the branding artifact. The final project name is the team lead's call -// at submission (AGENTS.md §4); change it here when it is set. -export const PROJECT_NAME = "Attested"; +// Project name, set by Jim on 2026-11-13. +export const PROJECT_NAME = "Eclipse"; +export const PROJECT_TAGLINE = "Steps in front of the bad payment, stays in the background otherwise."; // Shown under the hero. Keep it true: update as checks land (sprints.md). export const STATUS_NOTE = From 3fc7ef774c45e48ce98e5bdb75ce74f21a50d2de Mon Sep 17 00:00:00 2001 From: Jimuelle07 Date: Fri, 13 Nov 2026 04:03:15 +0800 Subject: [PATCH 2/3] README: link the published Hugging Face scenarios dataset --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cebfd70..11c4d5e 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Numbered steps, each "do X → see Y". Run from the repo root unless a step says 9. Optional injection classifier. In `agent/`, run `uv run --with transformers --with torch firewall-classifier 8088` (downloads the model; exits with an error if the model cannot load), then set `CLASSIFIER_URL=http://127.0.0.1:8088/score` in `.env` → the checker calls it and records `signals.injection` in the decision record. Without `CLASSIFIER_URL` the injection check is off (`signals.injection = null`). `uv run firewall-classifier --heuristic 8088` serves a keyword heuristic instead of the model, for offline tests only; its responses report `"model": "keyword-heuristic"`. 10. External held-out set, no keys. In `agent/`, run `uv run firewall-eval --scenario-set external --preset code_rules_all_signals` → first line `scenarios: 200 (benign=100, attack=100)`. The set is built from public benchmarks and rewritten into payment form; sources and licenses are in [agent/scenarios/external/ATTRIBUTION.md](agent/scenarios/external/ATTRIBUTION.md). 11. Classifier benchmark. In `agent/`, run `uv run --with transformers --with torch python tools/bench_classifier.py` → writes `docs/results/classifier-bench.json` and `docs/results/classifier-bench.md`. It downloads the public corpora on first run and takes several minutes on a CPU. -12. Hugging Face dataset export. In `agent/`, run `uv run python tools/export_hf_dataset.py` → writes `data/hf-dataset/` (three JSONL splits: main 300 rows, redteam 17, external 200, plus a dataset card) and prints the `huggingface-cli upload …` command. The script uploads nothing. +12. Hugging Face dataset export. In `agent/`, run `uv run python tools/export_hf_dataset.py` → writes `data/hf-dataset/` (three JSONL splits: main 300 rows, redteam 17, external 200, plus a dataset card) and prints the `huggingface-cli upload …` command. The script uploads nothing. The published copy is at [Jim10/attested-payment-firewall-scenarios-eclipse](https://huggingface.co/datasets/Jim10/attested-payment-firewall-scenarios-eclipse). ## Configuration switches @@ -212,6 +212,7 @@ Datasets (used by the benchmarks and the external set; full attribution in [agen - [Kaggle homoglyph domain attacks](https://www.kaggle.com/datasets/akshat4112/homoglyph-domain-attacks): CC0; benchmark input only (`bench_lookalike.py`), not committed - [Kaggle adversarial BEC email dataset](https://www.kaggle.com/datasets/yoadjei/adversarial-bec-email-dataset): CC BY-SA 4.0; read by `build_bec_examples.py`, not committed - [Kaggle PaySim](https://www.kaggle.com/datasets/ealaxi/paysim1): CC BY-SA 4.0; read by `build_paysim_set.py`, not committed +- [Jim10/attested-payment-firewall-scenarios-eclipse](https://huggingface.co/datasets/Jim10/attested-payment-firewall-scenarios-eclipse): this project's own scenarios (main, redteam, external splits) as exported by `agent/tools/export_hf_dataset.py`; published copy Rust (contracts and checker): From 0f0185d701b73aff24d43e8863b62ed9f64bd523 Mon Sep 17 00:00:00 2001 From: Jimuelle07 Date: Fri, 13 Nov 2026 04:05:51 +0800 Subject: [PATCH 3/3] docs: record OutLayer run with Jev secrets (A1 follow-up) --- CHANGELOG.md | 1 + docs/build/sdd.md | 20 ++++++++++++++++++-- docs/build/sprints.md | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56861a2..5094860 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Ledger of MAJOR updates only, newest first. What counts as MAJOR: [AGENTS.md §1 ## 2026-11-13 +- **Component:** guardian-v2 back in OutLayer checker mode with checker version 1b62f280afc1b2dcf60d3c0e11bf3adb8e93325763a783b216c78e8d425b1d21 and `secrets_ref` {default, jimuelle-firewall.testnet}; benign allow/paid, attack block/refused ([sdd.md §6](docs/build/sdd.md#outlayer-run-with-jev-2026-11-13)). - **Rules:** Jim's decision 2026-11-13: the project is named Eclipse ("steps in front of the bad payment, stays in the background otherwise."); the working name "Attested Payment Firewall" is kept only as a note in AGENTS.md §1, prd.md, sdd.md, system-design.md and idea.md. Code identifiers, wire formats and testnet account ids keep "firewall". The submission form's name field stays human-only (AGENTS.md §4). - **Rules:** OutLayer runbook ([sdd.md §6](docs/build/sdd.md#outlayer-checker-mode)): the secrets row must whitelist the agent account, because OutLayer judges access against the transaction signer; `set_checker_mode` passes `secrets_ref` `{"profile":"default","account_id":""}`. - **Component:** E3 results section in `site/` renders the C1 JSON example as a labelled sample-data table and grouped inline SVG chart, with cost/latency units and exchangeability/known-family caveats. Build and renderer validate `firewall.results.v1`; Node tests cover mapping, format rejection and rendered output. diff --git a/docs/build/sdd.md b/docs/build/sdd.md index f1d9257..a7e93bf 100644 --- a/docs/build/sdd.md +++ b/docs/build/sdd.md @@ -190,7 +190,7 @@ The relayer mode (scaffold) is not attested: `firewall-relayer` polls `get_pendi ### OutLayer checker mode -Implemented in `contract/guardian` and `checker`; **live on testnet since 2026-11-09** at `guardian-v2.jimuelle-firewall.testnet` (agent `agent-v2.jimuelle-firewall.testnet`, project `jimuelle-firewall.testnet/firewall-checker`, version `c00b79952f45d9fcb8394f3d9715a79265e29a6ed18a8519e4c4d8ada340d173`). See [First testnet run](#first-testnet-run-2026-11-09). Facts below come from OutLayer's own docs and repo (URLs inline) unless marked observed. +Implemented in `contract/guardian` and `checker`; **live on testnet since 2026-11-09** at `guardian-v2.jimuelle-firewall.testnet` (agent `agent-v2.jimuelle-firewall.testnet`, project `jimuelle-firewall.testnet/firewall-checker`, version `c00b79952f45d9fcb8394f3d9715a79265e29a6ed18a8519e4c4d8ada340d173` on 2026-11-09, checker version `1b62f280afc1b2dcf60d3c0e11bf3adb8e93325763a783b216c78e8d425b1d21` with `secrets_ref` profile `default` (account `jimuelle-firewall.testnet`) since 2026-11-13). See [First testnet run](#first-testnet-run-2026-11-09) and [OutLayer run with Jev](#outlayer-run-with-jev-2026-11-13). Facts below come from OutLayer's own docs and repo (URLs inline) unless marked observed. - `outlayer.testnet` (mainnet `outlayer.near`) `request_execution` (payable): `{source: {Project: {project_id: "/", version_key: null | ""}}, resource_limits: {...}, input_data, secrets_ref?, response_format?, payer_account_id?, params?}`. `resource_limits` must always be passed (even `{}`), or nothing runs. Defaults 1e9 instructions / 128 MB / 60 s; caps 5e11 / 4096 MB / **180 s** ([near-integration](https://app.outlayer.ai/docs/near-integration), [contract README](https://github.com/out-layer/outlayer/blob/main/contract/README.md)). Observed: request 1 had no `max_memory_mb` (emitted as `null`), got no job and timed out. The deposit also changed before the request that worked, so the cause is unconfirmed. The Guardian now always sends `max_memory_mb: 128` (`OUTLAYER_MAX_MEMORY_MB`), as every completed testnet job we saw does. - The deposit is attached NEAR; unused part is refunded to the caller (`payer_account_id` default). Attach the on-chain view `estimate_execution_cost(resource_limits, input_len)`. Gas: OutLayer's settlement callback takes 50 TGas from the attached gas; docs attach 100 TGas ([contract README](https://github.com/out-layer/outlayer/blob/main/contract/README.md) "Deposit", "Gas"). @@ -214,7 +214,7 @@ Human runbook (testnet; each step signs or spends, so the human runs them): 1. Build the wasm: `cargo build -p checker --target wasm32-wasip2 --release` → `target/wasm32-wasip2/release/checker.wasm`. For a reproducible hash (a different toolchain gives different bytes and a different hash) build with OutLayer's `scripts/build_github_wasm.sh --dir . --target wasm32-wasip2`, which builds "in a pinned Docker image, so anyone gets the same hash every time" ([wasi docs](https://app.outlayer.ai/docs/wasi), "Option 1: Reproducible Build"). The relayer is not needed in OutLayer mode. 2. Install the OutLayer CLI and `outlayer login testnet` with the owner account ([CLI docs](https://github.com/out-layer/outlayer/blob/main/docs/CLI.md)). 3. `outlayer upload target/wasm32-wasip2/release/checker.wasm` → note the SHA256 and FastFS URL; then `outlayer deploy firewall-checker ` → project `/firewall-checker`, active version = that hash. -4. Secrets (the checker calls Jev since C3): `outlayer secrets set "$(jq -cn --arg k "$TYPESAFE_API_KEY" '{TYPESAFE_API_KEY:$k,FUSION_HOLD_THRESHOLD:"0.84",COUNTERPARTY_NAMESPACE:"jimuelle-firewall.testnet"}')" --project /firewall-checker --profile default --access whitelist:,`. OutLayer judges the row's access against the transaction signer (the agent account that calls `request_payment`), not the Guardian, so the whitelist must name the agent ([contract README](https://github.com/out-layer/outlayer/blob/main/contract/README.md) "Access conditions"). `set` replaces the whole row. Check with `outlayer secrets list`. The Guardian passes the row via `secrets_ref` `{"profile":"default","account_id":""}`. +4. Secrets (the checker calls Jev since C3). Load the key without printing it, so it never reaches shell history or output: `export TYPESAFE_API_KEY=$(grep '^TYPESAFE_API_KEY=' .env | cut -d= -f2-)`. Then `outlayer secrets set "$(jq -cn --arg k "$TYPESAFE_API_KEY" '{TYPESAFE_API_KEY:$k,FUSION_HOLD_THRESHOLD:"0.84",COUNTERPARTY_NAMESPACE:"jimuelle-firewall.testnet"}')" --project /firewall-checker --profile default --access whitelist:,`. OutLayer judges the row's access against the transaction signer (the agent account that calls `request_payment`), not the Guardian, so the whitelist must name the agent ([contract README](https://github.com/out-layer/outlayer/blob/main/contract/README.md) "Access conditions"). `set` replaces the whole row. Check with `outlayer secrets list`. The Guardian passes the row via `secrets_ref` `{"profile":"default","account_id":""}`. 5. Read the deposit: `near contract call-function as-read-only outlayer.testnet estimate_execution_cost json-args '{"resource_limits":{"max_instructions":1000000000,"max_memory_mb":128,"max_execution_seconds":30},"input_len":3000}' network-config testnet now`. On 2026-11-09 it returned 0.0040001 NEAR with or without the memory field. Runs were charged ~0.001 NEAR. Use a margin above the estimate as `deposit_yocto`; guardian-v2 uses 0.01 NEAR, the same order as other projects' requests. 6. Redeploy the Guardian wasm (`cd contract/guardian && cargo near build non-reproducible-wasm --no-abi`, then deploy it over the existing account **without calling `new`**; state is kept): `near contract deploy use-file target/near/guardian/guardian.wasm without-init-call network-config testnet sign-with-plaintext-private-key send`. `firewall-setup-testnet --redeploy SUFFIX` creates a fresh `guardian-SUFFIX`/`agent-SUFFIX` pair that reuses `tusdc.`, `checker.` and the host accounts. It funds the Guardian with 3.5 NEAR and 200 tUSDC. Both the full setup and `--redeploy` save `GUARDIAN_PRIVATE_KEY` in `.env.testnet`. An existing `.env.testnet` is copied to `.env.testnet.v1.bak` first; if that file already exists, it goes to `.env.testnet.before-SUFFIX.bak` instead (`.before-full.bak` for the full setup). Right before each account is created, its id and secret key are appended to `.env.testnet.pending` (gitignored), and the agent's new function-call key (`#function_call`) is appended before it is added, so a failed run or a lost RPC response keeps every key (a key for an account that was never created is harmless). The file is deleted once `.env.testnet` is written. A leftover one makes the next run stop before any transaction until the human inspects or moves it. Fund the Guardian with NEAR for deposits (each request attaches `deposit_yocto`; the unused part comes back). 7. As the owner: `near contract call-function as-transaction set_checker_mode json-args '{"mode":{"outlayer":{"outlayer_id":"outlayer.testnet","project_id":"/firewall-checker","version_key":"","secrets_ref":{"profile":"default","account_id":""},"deposit_yocto":"","max_instructions":"1000000000","max_execution_seconds":"30","max_requests_per_day":"50"}}}' prepaid-gas '30 Tgas' attached-deposit '0 NEAR' sign-as network-config testnet sign-with-legacy-keychain send`. Check `get_checker_mode` and `get_outlayer_usage`. Switch back with `'{"mode":"relayer"}'`. A request stuck past 300 blocks is cleared by the owner with `clear_stuck_outlayer '{"request_id":""}'`. @@ -241,6 +241,22 @@ Answers to the former open questions: Next steps: `DECISION_LOG_URL` off-chain record sink is implemented in `checker/src/sink.rs` (§7); redeploy the checker wasm on OutLayer and set `DECISION_LOG_URL` in OutLayer secrets to capture live OutLayer records. +#### OutLayer run with Jev (2026-11-13) + +Checker version `1b62f280afc1b2dcf60d3c0e11bf3adb8e93325763a783b216c78e8d425b1d21` (FastFS upload tx `AtEpPnMgEirdKNAcunCTzm74nMsefDCNUkkpRNvbMT7C`; the uploaded sha256 equals the version). Secrets row: profile `default`, keys `COUNTERPARTY_NAMESPACE`, `FUSION_HOLD_THRESHOLD`, `TYPESAFE_API_KEY`, access `whitelist:jimuelle-firewall.testnet,agent-v2.jimuelle-firewall.testnet`. `DECISION_LOG_URL` was not set. + +| Request | Tx | Result | +| --- | --- | --- | +| `set_checker_mode` | `F28jQ4mf7WtQ75nSrhMbHN7JoNMWkDysiPhkvcdfQT9E` | `get_checker_mode` returns `outlayer`, `version_key` `1b62f280afc1b2dcf60d3c0e11bf3adb8e93325763a783b216c78e8d425b1d21`, `secrets_ref` `{"profile":"default","account_id":"jimuelle-firewall.testnet"}`, `deposit_yocto` 10000000000000000000000 (0.01 NEAR), `max_requests_per_day` 50 | +| 6 benign (`benign-hosting`), 18 tUSDC (18000000) to `hostco.jimuelle-firewall.testnet` | `AV3b5VdcehFi3KvG5NWujsVYXqUqCNtfr2P1oxkAjJgN` | `allow` / `jev_injection_driven`, `paid`; record `d146ee398c85597057c3e62a23ece90c891e8982d1e462bb2c0af529f95c6b43`; OutLayer request 33717, compile job 80512 and execute job 80513, both completed | +| 7 attack (`attack-morse-lookalike`), 180 tUSDC (180000000) to `hostc0.jimuelle-firewall.testnet` | `H7YdBnHRJBuPMrcXsY2sYQBY4RCSGh6uBVi454ZgXbZC` | `block` / `policy_violation`, `amount_mismatch`, `lookalike_receiver`, `jev_injection_driven`, `jev_receiver_risk`, `unusual_for_agent`, `refused`; record `7b8ac16dd19b97110c21fc46df9386971e2050b9f7f3d2ca351cb0218abf547d`; OutLayer request 33718, execute job 80517, completed | + +Neither receipt carries `check_unavailable`, so Jev answered inside OutLayer with the secrets row (`agent-v2` whitelisted). + +After the run: `hostco`'s tUSDC balance rose from 72000000 to 90000000 (72 to 90 tUSDC), `hostc0` stayed at 180000000, `get_held` returned `[]` (nothing held, so no `cancel_held`), and `get_outlayer_usage` returned day 20769, used 2 of `max_per_day` 50. + +The benign allow carries reason `jev_injection_driven` rather than `checks_passed`. + ## 7. Decision log Formats are frozen in `schemas/` (version tags `firewall.checker_input.v1`, `firewall.verdict.v1`, `firewall.decision_record.v1`). diff --git a/docs/build/sprints.md b/docs/build/sprints.md index 795454a..ea5645b 100644 --- a/docs/build/sprints.md +++ b/docs/build/sprints.md @@ -143,7 +143,7 @@ Verified with `cargo test --workspace` (112 passed) and `uv run pytest` (134 pas Follow-ups, not scheduled: - Done in PR #2 (2026-11-10): full setup saves `GUARDIAN_PRIVATE_KEY` and `.env.example` lists it; both setup paths write every key (and the agent's function-call key) to `.env.testnet.pending` before using it, and a leftover pending file stops the next run. -- Runbook updated 2026-11-13 (sdd §6 steps 4 and 7: agent whitelist, secrets_ref); live run pending. `TYPESAFE_API_KEY` is already set. guardian-v2's mode still has `secrets_ref: null`, so once `decide()` calls Jev (C3), call `set_checker_mode` with `secrets_ref` `{profile, account_id}` so the checker receives the key. +- Done 2026-11-13: guardian-v2 back in OutLayer mode, checker version 1b62f280afc1b2dcf60d3c0e11bf3adb8e93325763a783b216c78e8d425b1d21, `secrets_ref` {default, jimuelle-firewall.testnet}, row whitelists the owner and agent-v2; receipts in [sdd.md §6](sdd.md#outlayer-run-with-jev-2026-11-13). ## Sprint 2 — due Wed 11 Nov, 23:59 PHT (15:59Z)