Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
fc39f69
refactor: keep the integration engine free of oracle assumptions
devodii Nov 19, 2026
d2fdbf7
feat: let a partner list live surfaces and key observed state by network
devodii Nov 19, 2026
731b080
feat: add the Trustless Work adapter for api, package, repo and code …
devodii Nov 19, 2026
8b57cd9
feat: scan deeper when a repo mentions a deep partner even only in prose
devodii Nov 19, 2026
8508d0f
feat: list which checks each failing project trips and keep older pro…
devodii Nov 19, 2026
f0a0d26
feat: write the api's openapi schema and make its models precise
devodii Nov 19, 2026
9494361
feat: generate the web app's api types from the openapi schema
devodii Nov 19, 2026
1b19d32
feat: redesign the integration page with live surfaces, animated chec…
devodii Nov 19, 2026
ddca6d1
feat: show a few surfaces per group and let the reader expand the rest
devodii Nov 19, 2026
cf9eda1
feat: describe how projects use Trustless Work with signals, captures…
devodii Nov 19, 2026
6aa972d
docs: describe surfaces, scan hints, forbid checks and the generated …
devodii Nov 19, 2026
c10ebec
feat: backfill the project files with the deeper integration evidence
devodii Nov 19, 2026
d8f7ea7
feat: show what projects ask for as animated bars and only claim offe…
devodii Nov 19, 2026
61a1479
fix: keep section labels and links readable on the light theme
devodii Nov 19, 2026
4a80fca
fix: capture only real Trustless Work operations and cover the profil…
devodii Nov 19, 2026
355ff97
feat: backfill the operations projects call with the exact Trustless …
devodii Nov 19, 2026
c9c2f41
refactor: rename AiAgent to AIAgent in the api and the web app
devodii Nov 19, 2026
cb37355
feat: show a plain 404 page outside the layout for unknown routes and…
devodii Nov 19, 2026
e80f303
feat: say which tools have an integration page
devodii Nov 19, 2026
f857dde
feat: add an integrations menu to the header and show the Stellar mar…
devodii Nov 19, 2026
6e6455b
fix: a check with only required signals fails again whenever it applies
devodii Nov 19, 2026
1edd06d
feat: describe how each check is derived and stop returning project n…
devodii Nov 19, 2026
153b03d
feat: keep the checklist and the method off the page, the project car…
devodii Nov 19, 2026
3b3aaee
feat: refresh watched surfaces in the background when they are an hou…
devodii Nov 19, 2026
7e673e8
feat: show surfaces, signals, demand and readings as tables and use m…
devodii Nov 19, 2026
ef3a594
feat: show booleans in the live tables as TRUE and FALSE
devodii Nov 19, 2026
a999988
fix: drop the leftover tone helper from the surface table
devodii Nov 19, 2026
5b80c14
feat: let a profile mark signals and checks private so they stay out …
devodii Nov 19, 2026
ebd48ab
feat: strip the private signals and checks from the project files
devodii Nov 19, 2026
7b754bc
feat: drop the findings count from the hero
devodii Nov 19, 2026
c7f47a4
fix: the browser key signal matches a key variable and not a url vari…
devodii Nov 19, 2026
0e686bd
fix: only count overlap for contracts the profile lists, so watched s…
devodii Nov 19, 2026
82fd0fb
feat: watch Reflector's packages and repos and share the source obser…
devodii Nov 19, 2026
98a83ba
fix: a contract id listed in docs or an agent skill is not an integra…
devodii Nov 19, 2026
5ad7df6
feat: tune Reflector's private checks against the audit so they find …
devodii Nov 19, 2026
1a77f79
feat: backfill Reflector's evidence and drop projects that only list …
devodii Nov 19, 2026
1bc00ac
Merge pull request #80 from devodii/feat/reflector-audit
devodii Nov 19, 2026
117a834
fix: keep the API surface table to the facts that fit
devodii Nov 19, 2026
77e4c59
fix: drop the browser key check, since Trustless Work documents its a…
devodii Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ jobs:
- name: The schema files and the database agree
run: uv run hackproof schema verify
- run: uv run pytest
- name: The openapi schema the web app generates its types from is current
run: |
uv run hackproof openapi
git diff --exit-code -- ../web/openapi.json || {
echo "::error::The API changed but apps/web/openapi.json did not. Run 'pnpm types' and commit the result."
exit 1
}

web:
runs-on: ubuntu-latest
Expand All @@ -70,6 +77,13 @@ jobs:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: The generated api types are current
run: |
pnpm --filter web types
git diff --exit-code -- apps/web/src/lib/api-schema.ts || {
echo "::error::apps/web/openapi.json changed but the generated types did not. Run 'pnpm types' and commit the result."
exit 1
}
- run: pnpm lint
- run: pnpm format:check
- run: pnpm build
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ The README has the commands to run everything locally.

- Python 3.13, uv, ruff and pytest.
- Pydantic models for anything that crosses a module boundary. No dataclasses, NamedTuple or TypedDict.
- A response model with defaulted fields sets `json_schema_serialization_defaults_required=True` so the generated TypeScript marks them required, and uses a `Literal` for any closed set of strings.
- Models for upstream responses use `extra="allow"` so new fields are not lost. Models we derive use `extra="forbid"`.
- Tests run against the scratch Postgres database from `tests/conftest.py` and never touch the live network. Anything that needs an upstream response uses a recorded fixture in `apps/api/tests/fixtures/`.
- New pipeline steps follow the existing shape: a `run_*` job in the relevant package, a subcommand in `cli.py`, and any schema change as files in `db/schema` with a migration from `hackproof schema plan`. SQL goes in `src/hackproof/sql`, loaded with `load_sql`, never in Python strings.

## React

- Vite, TypeScript in strict mode, Tailwind and shadcn/ui.
- Types for API responses are generated from the Pydantic models. Change a model, run `pnpm types` and commit `apps/web/openapi.json` with `apps/web/src/lib/api-schema.ts`. Never write an API type by hand in `lib/types.ts`. CI fails when either file is stale.
- Add shadcn components with the shadcn CLI. Never hand edit `components/ui`.
- Reusable pieces that know nothing about hackathons go in `components/charts` or a similar neutral folder. Pages live in `pages/` and are registered in `App.tsx`.
- Fetch data through `lib/api.ts` and a hook in `hooks/` built on TanStack Query.
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ The tables are not split by event, so each hackathon gets a database of its own,

Any partner or tool in `data/integrations.yaml` can carry a `profile`. It lists the partner's known contract addresses, regex signals that say how the code uses it, values to capture from source, and checks built from those signals. The scan reads more files for a repo that shows the partner and records what it finds as evidence, `/api/integrations/{slug}` and the page at `/integration/{slug}` render it for every partner the same way, and the project files carry a `profile` per integration. A profile with no `adapter` needs no code at all, as Stellar Registry shows. Set `adapter` to a class registered in `integrations/adapters` when the partner's contracts can be read live; Reflector's adapter reads each oracle feed, its assets, when each asset expires, and a live price.

A profile can also list `surfaces`: things the adapter watches that the repos never reference, such as a REST API, an npm package, a GitHub repo or a contract code hash. The adapter decides what each `kind` means and returns plain facts, and the page shows them as live cards without knowing the partner. `hints` tell the scan which paths to read first, and a check can `require` signals, need one of `missing` or fail on any of `forbids`. Trustless Work is the example: its adapter reads the published OpenAPI of three API hosts, npm, GitHub and the ledger.

## Database

The schema lives in `apps/api/db/schema`, one file per table, index, view and function, and is applied with [pgschema](https://github.com/pgplex/pgschema). Queries live in `apps/api/src/hackproof/sql`. Run from `apps/api`.
Expand All @@ -71,3 +73,5 @@ To change the schema, edit the files in `db/schema`, run `schema plan`, and comm
cd apps/api && uv run ruff check . && uv run ruff format --check . && uv run sqlfluff lint db/schema src/hackproof/sql && uv run pytest
pnpm lint && pnpm format:check && pnpm build
```

The web app's API types are generated. After changing a response model run `pnpm types` and commit `apps/web/openapi.json` and `apps/web/src/lib/api-schema.ts`; CI fails when they are stale.
4 changes: 4 additions & 0 deletions apps/api/db/migrations/000004.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE integration_contracts DROP CONSTRAINT integration_contracts_pkey;

ALTER TABLE integration_contracts
ADD CONSTRAINT integration_contracts_pkey PRIMARY KEY (partner, network, contract_id);
2 changes: 1 addition & 1 deletion apps/api/db/schema/tables/integration_contracts.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ CREATE TABLE integration_contracts (
network text NOT NULL,
snapshot jsonb NOT NULL,
observed_at timestamptz NOT NULL,
CONSTRAINT integration_contracts_pkey PRIMARY KEY (partner, contract_id)
CONSTRAINT integration_contracts_pkey PRIMARY KEY (partner, network, contract_id)
);
7 changes: 7 additions & 0 deletions apps/api/src/hackproof/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from hackproof.indexer.sync import run_sync
from hackproof.integrations.observe import run_observe
from hackproof.linking.reconcile import run_reconcile
from hackproof.openapi import write as write_openapi
from hackproof.pipeline import Options, WrongEvent, run_pipeline, select, stages


Expand Down Expand Up @@ -153,6 +154,10 @@ def main() -> None:
action="store_true",
help="allow a database that is not on this machine",
)
commands.add_parser(
"openapi",
help="write the api's openapi schema where the web app generates its types from",
)
commands.add_parser(
"check",
help="check, read-only, that the database matches the committed data files",
Expand Down Expand Up @@ -202,6 +207,8 @@ def main() -> None:
asyncio.run(run_export())
case "import":
raise SystemExit(run_restore(args))
case "openapi":
write_openapi()
case "check":
raise SystemExit(asyncio.run(run_check()))
case "schema":
Expand Down
14 changes: 8 additions & 6 deletions apps/api/src/hackproof/export/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from hackproof.export.models import (
Account,
AgentEvidence,
AiAgent,
AIAgent,
Chain,
Contract,
Contributor,
Expand Down Expand Up @@ -60,10 +60,12 @@ def _group(


def _found(
rows: list[asyncpg.Record], key: str, repo_url: str
rows: list[asyncpg.Record], key: str, repo_url: str, private: dict[str, set[str]]
) -> dict[str, list[IntegrationEvidence]]:
found: dict[str, list[IntegrationEvidence]] = defaultdict(list)
for row in rows:
if row["method"] == "signal" and row["evidence"] in private.get(row[key], ()):
continue
found[row[key]].append(
IntegrationEvidence(
method=row["method"],
Expand All @@ -76,7 +78,7 @@ def _found(

def _agents(
catalog: Catalog, rows: list[asyncpg.Record], repo_url: str
) -> list[AiAgent]:
) -> list[AIAgent]:
found: dict[str, list[AgentEvidence]] = defaultdict(list)
for row in rows:
found[row["agent"]].append(
Expand All @@ -89,7 +91,7 @@ def _agents(
)
)
return [
AiAgent(
AIAgent(
slug=agent.slug,
name=agent.name,
website=agent.site,
Expand All @@ -103,7 +105,7 @@ def _agents(
def _tools(
catalog: Catalog, rows: list[asyncpg.Record], repo_url: str
) -> list[EcosystemTool]:
found = _found(rows, "tool", repo_url)
found = _found(rows, "tool", repo_url, catalog.private_signals())
raw = defaultdict(list)
for row in rows:
raw[row["tool"]].append((row["method"], row["evidence"]))
Expand All @@ -123,7 +125,7 @@ def _tools(
def _partners(
catalog: Catalog, rows: list[asyncpg.Record], repo_url: str
) -> list[IntegrationPartner]:
found = _found(rows, "partner", repo_url)
found = _found(rows, "partner", repo_url, catalog.private_signals())
raw = defaultdict(list)
for row in rows:
raw[row["partner"]].append((row["method"], row["evidence"]))
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/hackproof/export/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class AgentEvidence(Model):
)


class AiAgent(Model):
class AIAgent(Model):
slug: str = Field(description="Stable agent id, listed in data/integrations.yaml")
name: str = Field(description="Agent name")
website: str = Field(description="Agent website")
Expand Down Expand Up @@ -235,7 +235,7 @@ class Project(Model):
ecosystem_tools: list[EcosystemTool] = Field(
description="Stellar developer tools the repo builds with, such as Scaffold Stellar"
)
ai_agents: list[AiAgent] = Field(
ai_agents: list[AIAgent] = Field(
description="AI coding agents the repo shows traces of, such as Claude Code or Cursor"
)
owner: Owner
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/hackproof/github/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class Ref(BaseModel):


class DependencyFingerprint(BaseModel):
model_config = ConfigDict(json_schema_serialization_defaults_required=True)

ecosystems: list[str] = Field(default_factory=list)
packages: dict[str, str | None] = Field(default_factory=dict)

Expand Down
45 changes: 19 additions & 26 deletions apps/api/src/hackproof/github/scan.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import hashlib
import re
from collections.abc import Iterable
from pathlib import PurePosixPath

import asyncpg
Expand All @@ -16,8 +17,12 @@
from hackproof.github.track import declared_track
from hackproof.hackathon import Discovery, Window
from hackproof.integrations.catalog import Catalog, get_catalog
from hackproof.integrations.detect import detect, detect_agents, detect_tools
from hackproof.integrations.models import Detection
from hackproof.integrations.detect import (
depth_hints,
detect,
detect_agents,
detect_tools,
)
from hackproof.sql_loader import load_sql

TEXT_SUFFIXES = {
Expand All @@ -35,16 +40,6 @@
MAX_TEXT_FILES = 60
MAX_WASM_FILES = 5
MAX_DEEP_FILES = 150
DEEP_HINTS = (
"oracle",
"price",
"reflector",
"feed",
"rate",
"quote",
"contract",
"lib",
)
MAX_TEXT_BYTES = 512_000
MAX_WASM_BYTES = 5_000_000
DEMO_URL = re.compile(
Expand Down Expand Up @@ -102,12 +97,15 @@ def select_files(entries: list[dict]) -> tuple[list[str], list[str]]:
return texts[:MAX_TEXT_FILES], wasms[:MAX_WASM_FILES]


def select_deep(entries: list[dict], fetched: set[str]) -> list[str]:
def select_deep(
entries: list[dict], fetched: set[str], hints: Iterable[str]
) -> list[str]:
needles = [hint.lower() for hint in hints]
paths, _ = select_files_uncapped(entries)
wanted = [path for path in paths if path not in fetched]
wanted.sort(
key=lambda path: (
0 if any(hint in path.lower() for hint in DEEP_HINTS) else 1,
0 if any(hint in path.lower() for hint in needles) else 1,
len(PurePosixPath(path).parts),
path,
)
Expand All @@ -131,14 +129,6 @@ def __init__(
self._catalog = catalog or get_catalog()
self._files = asyncio.Semaphore(FILE_CONCURRENCY)

def _wants_depth(self, detections: list[Detection]) -> bool:
deep = {
item.slug
for item in [*self._catalog.partners, *self._catalog.tools]
if item.profile
}
return any(item.slug in deep for item in detections)

async def _wasm_ref(self, repo: Candidate, branch: str, path: str) -> Ref | None:
async with self._files:
content = await self._github.raw(
Expand Down Expand Up @@ -184,10 +174,13 @@ async def scan(self, repo: Candidate) -> RepoScan | None:
else None
)
integrations = detect(files, self._catalog, repo.owner)
if self._wants_depth(
integrations + detect_tools(files, self._catalog, repo.owner)
):
extra = select_deep(tree["tree"], set(files))
hints = depth_hints(
files,
self._catalog,
integrations + detect_tools(files, self._catalog, repo.owner),
)
if hints is not None:
extra = select_deep(tree["tree"], set(files), hints)
files = files | await fetch_texts(
self._github, repo.full_name, branch, extra
)
Expand Down
3 changes: 2 additions & 1 deletion apps/api/src/hackproof/integrations/adapters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from hackproof.integrations.adapters.base import Adapter
from hackproof.integrations.adapters.reflector import ReflectorAdapter
from hackproof.integrations.adapters.trustless_work import TrustlessWorkAdapter

ADAPTERS: dict[str, Adapter] = {
adapter.name: adapter for adapter in (ReflectorAdapter(),)
adapter.name: adapter for adapter in (ReflectorAdapter(), TrustlessWorkAdapter())
}
7 changes: 4 additions & 3 deletions apps/api/src/hackproof/integrations/adapters/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from abc import ABC, abstractmethod
from typing import ClassVar

from hackproof.indexer.rpc import SorobanRpc
import httpx

from hackproof.integrations.catalog import Network, ProfileContract
from hackproof.integrations.chain import ContractSnapshot, Reading

Expand All @@ -11,12 +12,12 @@ class Adapter(ABC):

@abstractmethod
async def observe(
self, rpc: SorobanRpc, network: Network, contract: ProfileContract
self, http: httpx.AsyncClient, network: Network, contract: ProfileContract
) -> ContractSnapshot | None: ...

async def probe(
self,
rpc: SorobanRpc,
http: httpx.AsyncClient,
network: Network,
contract: ProfileContract,
subject: str,
Expand Down
20 changes: 16 additions & 4 deletions apps/api/src/hackproof/integrations/adapters/reflector.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
from decimal import Decimal
from typing import Any

import httpx
from stellar_sdk import StrKey, scval, xdr

from hackproof.indexer.rpc import SorobanRpc
from hackproof.integrations.adapters.base import Adapter
from hackproof.integrations.adapters.sources import observe_package, observe_repo
from hackproof.integrations.catalog import Network, ProfileContract
from hackproof.integrations.chain import ContractSnapshot, Reading
from hackproof.integrations.soroban import view
Expand Down Expand Up @@ -117,16 +119,26 @@ class ReflectorAdapter(Adapter):
name = "reflector"

async def observe(
self, rpc: SorobanRpc, network: Network, contract: ProfileContract
self, http: httpx.AsyncClient, network: Network, contract: ProfileContract
) -> ContractSnapshot | None:
return await observe(rpc, network, contract)
if contract.kind == "package":
return await observe_package(http, contract)
if contract.kind == "repo":
return await observe_repo(http, contract)
return await observe(SorobanRpc(http, network.rpc_url), network, contract)

async def probe(
self,
rpc: SorobanRpc,
http: httpx.AsyncClient,
network: Network,
contract: ProfileContract,
subject: str,
params: dict[str, int],
) -> Reading | None:
return await quote(rpc, network, contract, subject, params.get("age_factor", 2))
return await quote(
SorobanRpc(http, network.rpc_url),
network,
contract,
subject,
params.get("age_factor", 2),
)
Loading
Loading