Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions apps/api/src/hackproof/integrations/adapters/reflector.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

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 @@ -120,6 +121,10 @@ class ReflectorAdapter(Adapter):
async def observe(
self, http: httpx.AsyncClient, network: Network, contract: ProfileContract
) -> ContractSnapshot | None:
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(
Expand Down
79 changes: 79 additions & 0 deletions apps/api/src/hackproof/integrations/adapters/sources.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
from typing import Any

import httpx
from pydantic import BaseModel, ConfigDict, Field

from hackproof.integrations.catalog import ProfileContract
from hackproof.integrations.chain import ContractSnapshot


class Release(BaseModel):
model_config = ConfigDict(extra="ignore")

versions: dict[str, Any] = Field(default_factory=dict)
time: dict[str, str] = Field(default_factory=dict)
dist_tags: dict[str, str] = Field(default_factory=dict, alias="dist-tags")


class Repository(BaseModel):
model_config = ConfigDict(extra="ignore")

open_issues_count: int = 0
stargazers_count: int = 0
forks_count: int = 0
pushed_at: str = ""
archived: bool = False


async def observe_package(
http: httpx.AsyncClient, contract: ProfileContract
) -> ContractSnapshot | None:
registry = await http.get(
f"https://registry.npmjs.org/{contract.id.replace('/', '%2F')}"
)
if registry.status_code != 200:
return None
release = Release.model_validate(registry.json())
stamps = {
version: stamp
for version, stamp in release.time.items()
if version not in {"created", "modified"}
}
latest_stamp = max(stamps.values()) if stamps else ""
downloads = await http.get(
f"https://api.npmjs.org/downloads/point/last-month/{contract.id}"
)
monthly = (
downloads.json().get("downloads") if downloads.status_code == 200 else None
)
tags = ", ".join(f"{tag} {version}" for tag, version in release.dist_tags.items())
return ContractSnapshot(
facts={
"tags": tags,
"versions": len(release.versions),
"published": latest_stamp[:10],
"downloads_month": monthly,
},
items=sorted(release.versions)[-12:],
)


async def observe_repo(
http: httpx.AsyncClient, contract: ProfileContract
) -> ContractSnapshot | None:
response = await http.get(
f"https://api.github.com/repos/{contract.id}",
headers={"Accept": "application/vnd.github+json"},
)
if response.status_code != 200:
return None
repository = Repository.model_validate(response.json())
return ContractSnapshot(
facts={
"open_issues": repository.open_issues_count,
"stars": repository.stargazers_count,
"forks": repository.forks_count,
"pushed": repository.pushed_at[:10],
"archived": "TRUE" if repository.archived else "FALSE",
}
)
73 changes: 1 addition & 72 deletions apps/api/src/hackproof/integrations/adapters/trustless_work.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

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

Expand Down Expand Up @@ -53,24 +54,6 @@ class Schema(BaseModel):
paths: dict[str, dict[str, Any]] = Field(default_factory=dict)


class Release(BaseModel):
model_config = ConfigDict(extra="ignore")

versions: dict[str, Any] = Field(default_factory=dict)
time: dict[str, str] = Field(default_factory=dict)
dist_tags: dict[str, str] = Field(default_factory=dict, alias="dist-tags")


class Repository(BaseModel):
model_config = ConfigDict(extra="ignore")

open_issues_count: int = 0
stargazers_count: int = 0
forks_count: int = 0
pushed_at: str = ""
archived: bool = False


async def observe_api(
http: httpx.AsyncClient, contract: ProfileContract
) -> ContractSnapshot | None:
Expand Down Expand Up @@ -112,60 +95,6 @@ async def observe_api(
)


async def observe_package(
http: httpx.AsyncClient, contract: ProfileContract
) -> ContractSnapshot | None:
registry = await http.get(
f"https://registry.npmjs.org/{contract.id.replace('/', '%2F')}"
)
if registry.status_code != 200:
return None
release = Release.model_validate(registry.json())
stamps = {
version: stamp
for version, stamp in release.time.items()
if version not in {"created", "modified"}
}
latest_stamp = max(stamps.values()) if stamps else ""
downloads = await http.get(
f"https://api.npmjs.org/downloads/point/last-month/{contract.id}"
)
monthly = (
downloads.json().get("downloads") if downloads.status_code == 200 else None
)
tags = ", ".join(f"{tag} {version}" for tag, version in release.dist_tags.items())
return ContractSnapshot(
facts={
"tags": tags,
"versions": len(release.versions),
"published": latest_stamp[:10],
"downloads_month": monthly,
},
items=sorted(release.versions)[-12:],
)


async def observe_repo(
http: httpx.AsyncClient, contract: ProfileContract
) -> ContractSnapshot | None:
response = await http.get(
f"https://api.github.com/repos/{contract.id}",
headers={"Accept": "application/vnd.github+json"},
)
if response.status_code != 200:
return None
repository = Repository.model_validate(response.json())
return ContractSnapshot(
facts={
"open_issues": repository.open_issues_count,
"stars": repository.stargazers_count,
"forks": repository.forks_count,
"pushed": repository.pushed_at[:10],
"archived": "TRUE" if repository.archived else "FALSE",
}
)


async def observe_wasm(
http: httpx.AsyncClient, network: Network, contract: ProfileContract
) -> ContractSnapshot | None:
Expand Down
6 changes: 3 additions & 3 deletions apps/api/src/hackproof/integrations/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ def add(method: Method, evidence: str, path: str) -> None:
)

for path, text in files.items():
for contract_id in ids:
if contract_id in text:
add("contract", contract_id, path)
name = PurePosixPath(path).name
if PurePosixPath(path).suffix in PROSE_SUFFIXES or name.lower().startswith(
"readme"
):
continue
for contract_id in ids:
if contract_id in text:
add("contract", contract_id, path)
if not profile.in_context(text):
continue
for signal in profile.signals:
Expand Down
13 changes: 13 additions & 0 deletions apps/api/tests/test_integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,3 +345,16 @@ def test_private_signals_and_checks_never_reach_the_public_profile():
assert public.checks == []
assert "public-api-key" in {item.slug for item in internal.signals}
assert "public-api-key" in catalog.private_signals()["trustless-work"]


def test_a_contract_id_listed_in_prose_is_not_an_integration():
files = {
"README.md": "Feed CCSSOHTBL3LEWUCBBEB5NJFC2OKFRC74OWEIJIZLRJBGAAU4VMU5NV4W",
".agents/skills/ecosystem.md": "CAFJZQWSED6YAWZU3GWRTOCNPPCGBN32L7QV43XX5LZLFTK6JLN34DLN",
}
assert detect(files, get_catalog(), "someone") == []
files = {
".env.testnet": "ORACLE=CCSSOHTBL3LEWUCBBEB5NJFC2OKFRC74OWEIJIZLRJBGAAU4VMU5NV4W"
}
found = {item.method for item in detect(files, get_catalog(), "someone")}
assert "contract" in found
12 changes: 0 additions & 12 deletions data/2026/4ward.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ integrations:
- method: capture
detail: tickers:USD
file_url: https://github.com/ygk94/4ward/blob/HEAD/contracts/mock-oracle/src/lib.rs
- method: contract
detail: CBKGPWGKSKZF52CFHMTRR23TBWTPMRDIYZ4O2P5VS65BMHYH4DXMCJZC
file_url: https://github.com/ygk94/4ward/blob/HEAD/README.fr.md
- method: contract
detail: CCSSOHTBL3LEWUCBBEB5NJFC2OKFRC74OWEIJIZLRJBGAAU4VMU5NV4W
file_url: https://github.com/ygk94/4ward/blob/HEAD/.env.testnet
Expand All @@ -44,15 +41,6 @@ integrations:
file_url: https://github.com/ygk94/4ward/blob/HEAD/scripts/crash.sh
profile:
contracts:
- slug: mainnet-fx
id: CBKGPWGKSKZF52CFHMTRR23TBWTPMRDIYZ4O2P5VS65BMHYH4DXMCJZC
name: Fiat FX
network: mainnet
kind: feed
explorer_url: https://stellar.expert/explorer/public/contract/CBKGPWGKSKZF52CFHMTRR23TBWTPMRDIYZ4O2P5VS65BMHYH4DXMCJZC
attributes:
source: fx
asset_kind: other
- slug: testnet-fx
id: CCSSOHTBL3LEWUCBBEB5NJFC2OKFRC74OWEIJIZLRJBGAAU4VMU5NV4W
name: Fiat FX
Expand Down
29 changes: 0 additions & 29 deletions data/2026/arqueo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,6 @@ integrations:
- method: package
detail: '@creit.tech/stellar-wallets-kit'
file_url: https://github.com/Dabuca/arqueo/blob/HEAD/app-lib/package.json
- slug: reflector
name: Reflector
evidence:
- method: contract
detail: CAFJZQWSED6YAWZU3GWRTOCNPPCGBN32L7QV43XX5LZLFTK6JLN34DLN
file_url: https://github.com/Dabuca/arqueo/blob/HEAD/.agents/skills/standards/ecosystem.md
- method: contract
detail: CALI2BYU2JE6WVRUFYTS6MSBNEHGJ35P4AVCZYF3B6QOE3QKOB2PLE6M
file_url: https://github.com/Dabuca/arqueo/blob/HEAD/.agents/skills/standards/ecosystem.md
profile:
contracts:
- slug: mainnet-exchanges
id: CAFJZQWSED6YAWZU3GWRTOCNPPCGBN32L7QV43XX5LZLFTK6JLN34DLN
name: CEX and DEX
network: mainnet
kind: feed
explorer_url: https://stellar.expert/explorer/public/contract/CAFJZQWSED6YAWZU3GWRTOCNPPCGBN32L7QV43XX5LZLFTK6JLN34DLN
attributes:
source: exchanges
asset_kind: other
- slug: mainnet-stellar-pubnet
id: CALI2BYU2JE6WVRUFYTS6MSBNEHGJ35P4AVCZYF3B6QOE3QKOB2PLE6M
name: Stellar Pubnet DEX
network: mainnet
kind: feed
explorer_url: https://stellar.expert/explorer/public/contract/CALI2BYU2JE6WVRUFYTS6MSBNEHGJ35P4AVCZYF3B6QOE3QKOB2PLE6M
attributes:
source: stellar-pubnet
asset_kind: stellar
tools:
- slug: stellar-scaffold
name: Scaffold Stellar
Expand Down
31 changes: 0 additions & 31 deletions data/2026/atahanyild-koul.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,6 @@ commits_in_window: 2
stack:
soroban-sdk: null
'@stellar/stellar-sdk': 16.0.1
integrations:
- slug: reflector
name: Reflector
evidence:
- method: capture
detail: tickers:USD
file_url: https://github.com/atahanyild/koul/blob/HEAD/contracts/koul_mock_fx/src/lib.rs
- method: contract
detail: CCSSOHTBL3LEWUCBBEB5NJFC2OKFRC74OWEIJIZLRJBGAAU4VMU5NV4W
file_url: https://github.com/atahanyild/koul/blob/HEAD/docs/phase0.md
- method: signal
detail: reads-last-price
file_url: https://github.com/atahanyild/koul/blob/HEAD/contracts/koul_mock_fx/src/lib.rs
profile:
contracts:
- slug: testnet-fx
id: CCSSOHTBL3LEWUCBBEB5NJFC2OKFRC74OWEIJIZLRJBGAAU4VMU5NV4W
name: Fiat FX
network: testnet
kind: feed
explorer_url: https://stellar.expert/explorer/testnet/contract/CCSSOHTBL3LEWUCBBEB5NJFC2OKFRC74OWEIJIZLRJBGAAU4VMU5NV4W
attributes:
source: fx
asset_kind: other
signals:
- slug: reads-last-price
group: read
label: Reads the latest price
captures:
tickers:
- USD
agents:
- slug: claude-code
name: Claude Code
Expand Down
24 changes: 0 additions & 24 deletions data/2026/caravel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ integrations:
- method: capture
detail: tickers:USD
file_url: https://github.com/rcusans-code/Caravel/blob/HEAD/contracts/oracle/src/lib.rs
- method: contract
detail: CAVLP5DH2GJPZMVO7IJY4CVOD5MWEFTJFVPD2YY2FQXOQHRGHK4D6HLP
file_url: https://github.com/rcusans-code/Caravel/blob/HEAD/scripts/README.md
- method: contract
detail: CCSSOHTBL3LEWUCBBEB5NJFC2OKFRC74OWEIJIZLRJBGAAU4VMU5NV4W
file_url: https://github.com/rcusans-code/Caravel/blob/HEAD/scripts/README.md
- method: contract
detail: CCYOZJCOPG34LLQQ7N24YXBM7LL62R7ONMZ3G6WZAAYPB5OYKOMJRN63
file_url: https://github.com/rcusans-code/Caravel/blob/HEAD/.env
Expand All @@ -46,24 +40,6 @@ integrations:
file_url: https://github.com/rcusans-code/Caravel/blob/HEAD/docs/board.html
profile:
contracts:
- slug: testnet-stellar-pubnet
id: CAVLP5DH2GJPZMVO7IJY4CVOD5MWEFTJFVPD2YY2FQXOQHRGHK4D6HLP
name: Stellar Pubnet DEX
network: testnet
kind: feed
explorer_url: https://stellar.expert/explorer/testnet/contract/CAVLP5DH2GJPZMVO7IJY4CVOD5MWEFTJFVPD2YY2FQXOQHRGHK4D6HLP
attributes:
source: stellar-pubnet
asset_kind: stellar
- slug: testnet-fx
id: CCSSOHTBL3LEWUCBBEB5NJFC2OKFRC74OWEIJIZLRJBGAAU4VMU5NV4W
name: Fiat FX
network: testnet
kind: feed
explorer_url: https://stellar.expert/explorer/testnet/contract/CCSSOHTBL3LEWUCBBEB5NJFC2OKFRC74OWEIJIZLRJBGAAU4VMU5NV4W
attributes:
source: fx
asset_kind: other
- slug: testnet-exchanges
id: CCYOZJCOPG34LLQQ7N24YXBM7LL62R7ONMZ3G6WZAAYPB5OYKOMJRN63
name: CEX and DEX
Expand Down
Loading
Loading