@telaro/idolly-acp-hook
v0.1.0
Published
Drop-in Telaro hook for @idolly/acp-sdk. Gates job creation by on-chain bond + score. Auto-records evaluator decisions.
Maintainers
Readme
@telaro/idolly-acp-hook
Drop-in Telaro hook for @idolly/acp-sdk.
Replaces idolly-acp's off-chain reputation accumulator with Telaro's
on-chain bond + score primitive. No fork. No Anchor program change.
Why
idolly-acp's README states:
mpl-agent-reputation프로그램: devnet 미배포. Off-chain accumulator로 대체.
Telaro IS deployed on devnet at 3DUrvVWEziYLtEbiDtfxqh1ioXRFX6DNvV4iTsGed2rs.
This package wires the two together via idolly-acp's existing Hook
system — the same way subscriptionFeeWaiver and
autoRecordValidation plug in.
Install
npm install @telaro/idolly-acp-hook @telaro/sdk @idolly/acp-sdk @solana/web3.jsThree hooks, three layers
import { IdollyAcpClient } from "@idolly/acp-sdk";
import {
telaroTrustGate,
telaroAutoRecord,
telaroSlashOnReject,
} from "@telaro/idolly-acp-hook";
const client = new IdollyAcpClient({...});
// 1. Buyers refuse to escrow USDC with under-bonded providers.
client.useHook(telaroTrustGate({
minBond: 10_000_000n, // 10 USDC
minScore: 700, // out of 1000
telaroApiBase: "https://telaro.xyz",
}));
// 2. Every evaluator decision auto-records on Telaro.
// (returns an array of two hooks — release + reject)
for (const h of telaroAutoRecord({
signer: evaluatorKeypair,
connection,
})) {
client.useHook(h);
}
// 3. (optional) Reject → file a Telaro claim against the provider.
client.useHook(telaroSlashOnReject({
connection,
buyer: buyerKeypair,
bondMint: USDC_MINT,
}));What each hook does
telaroTrustGate
Phase: before create_job.
Looks up the offering's provider via Telaro REST API. If bond <
minBond or score < minScore or frozen, aborts the
create_job before any USDC moves into escrow.
Aborts the call (idolly-acp's hook contract supports abort:
{reason}). The buyer gets a clear error and never signs the
escrow tx.
telaroAutoRecord
Phase: after evaluator_release and evaluator_reject.
Calls recordAction on Telaro with:
kind: ActionKind.Customoutcome: Success(release) orFailed(reject)valueAtomic: the escrow amount
The agent's score recomputes from Telaro's 128-action ring buffer.
telaroSlashOnReject
Phase: after evaluator_reject.
Files an on-chain Telaro submit_claim against the provider for
the rejected escrow amount. Provider has 7 days to respond. If
they don't, the bond auto-pays the buyer.
Failure-tolerant: if the claim filing fails, the rejection itself still succeeds. Slashing is best-effort.
Comparison to alternative integration paths
| Approach | Effort | Trust gate | Slashing | Anchor change |
|---|---|---|---|---|
| This package | 1 hour | ✓ before escrow | ✓ on reject | none |
| Fork + CPI in initiate_escrow_with_offering | 1 week | ✓ atomic in tx | ✓ atomic in tx | yes (audit) |
| Manual TelaroClient calls | per call | manual | manual | none |
Use this package for the demo and v1 production. Move to CPI gate for v2 when atomicity within the same tx becomes load-bearing.
What's NOT covered
subscribeandclaim_periodhooks. Subscription tier gating by Verxio Loyalty tier is a separate package (planned).register_offeringhook. Provider-tier gating ("only Gold+ providers can register premium offerings") is also out of scope here — subject of the v2 integration.- Anchor-level CPI gate. See
docs/integrations/idolly-acp.mdfor the v2 design where the trust gate moves intoinitiate_escrow_with_offeringfor atomicity.
