@kya-brasil/agent-tools 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -105,7 +105,7 @@ import { createKyaClient, signChallengeWithEvmKey, signWithECnpj } from "@kya-br
105
105
  import { readFileSync } from "node:fs";
106
106
 
107
107
  const kya = createKyaClient({ privateKey: payerPk });
108
- const reg = await kya.register({ // $0.50
108
+ const reg = await kya.register({ // $0.25
109
109
  agent: { kind: "evm", id: agentAddress },
110
110
  cnpj: "11.222.333/0001-81",
111
111
  mandate: {
@@ -141,7 +141,7 @@ Renew every 90 days (`kya.renew` then `kya.renewProve`), revoke at once (`kya.re
141
141
  | verify, verifyByKey, prove, renewProve, revoke, revocations, companyAgents, setCompanyWebhook | free |
142
142
  | verified (signed receipt, no limit), allowed (signed verdict) | 0.01 |
143
143
  | renew | 0.10 |
144
- | register | 0.50 |
144
+ | register | 0.25 |
145
145
 
146
146
  Schemas and keys: `/.well-known/kya-mandate.schema.json`, `/.well-known/kya.json`, `/openapi.json`, `/llms.txt`.
147
147
  Legal entities only: no CPF is stored; the e-CNPJ signer is recorded by certificate hash.
package/dist/index.d.ts CHANGED
@@ -56,7 +56,7 @@ export interface Credential {
56
56
  signed_at: string;
57
57
  };
58
58
  mandate: Mandate;
59
- /** Informative; null when the issuer has no KYB source. */
59
+ /** Kept for /v1 compatibility; always null from this issuer since D-23. */
60
60
  kyb_snapshot: Record<string, unknown> | null;
61
61
  status: CredentialStatus;
62
62
  issued_at: string;
@@ -177,7 +177,7 @@ export interface KyaClient {
177
177
  }>;
178
178
  /** $0.01: signed verdict, is this action inside the mandate and is the credential active? */
179
179
  allowed(credentialId: string, q: ActionQuery): Promise<Verdict>;
180
- /** $0.50: register an agent for a company; returns the challenge both parties sign. */
180
+ /** $0.25: register an agent for a company; returns the challenge both parties sign. */
181
181
  register(input: {
182
182
  agent: AgentKey;
183
183
  cnpj: string;
@@ -185,7 +185,7 @@ export interface KyaClient {
185
185
  }): Promise<Registration>;
186
186
  /** Free: send both signatures; the credential is issued if the e-CNPJ is valid and not revoked, the CNPJ matches and the company is ATIVA. */
187
187
  prove(credentialId: string, proof: Proof): Promise<{
188
- credential: Credential;
188
+ credential: Credential; /** /v1 compatibility, always empty. */
189
189
  kyb_warnings: string[];
190
190
  }>;
191
191
  /** $0.10: renewal challenge (then renewProve). */
@@ -198,7 +198,7 @@ export interface KyaClient {
198
198
  };
199
199
  }>;
200
200
  renewProve(credentialId: string, proof: Proof): Promise<{
201
- credential: Credential;
201
+ credential: Credential; /** /v1 compatibility, always empty. */
202
202
  kyb_warnings: string[];
203
203
  }>;
204
204
  /** Free: the company revokes at once. signed_text must be "KYA Brasil: revoke <id>\n<nonce>", signed with the e-CNPJ. */
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * tools for your agent framework: toOpenAI(kya), toVercelAI(kya, { tool, jsonSchema }), toLangChain(kya, tool), toAnthropic(kya)
11
11
  *
12
12
  * Company (you give your own agent a credential):
13
- * const reg = await kya.register({ agent: { kind: "evm", id: address }, cnpj, mandate }); // $0.50, returns a challenge
13
+ * const reg = await kya.register({ agent: { kind: "evm", id: address }, cnpj, mandate }); // $0.25, returns a challenge
14
14
  * const agent_signature = await signChallengeWithEvmKey(agentPrivateKey, reg.challenge.text);
15
15
  * const ecnpj_signature = await signWithECnpj({ certificatePem, privateKeyPem, chainPem }, reg.challenge.text);
16
16
  * const issued = await kya.prove(reg.credential_id, { challenge_id: reg.challenge.id, agent_signature, ecnpj_signature });
@@ -75,7 +75,7 @@ export function createKyaClient(opts = {}) {
75
75
  verifyByKey: (agent) => call("GET", `/v1/agents/by-key${q({ kind: agent.kind, id: agent.id })}`),
76
76
  verified: (id) => call("GET", `/v1/agents/${encodeURIComponent(id)}/verified`, undefined, true, 0.01),
77
77
  allowed: (id, a) => call("GET", `/v1/agents/${encodeURIComponent(id)}/allowed${q(a)}`, undefined, true, 0.01),
78
- register: (input) => call("POST", "/v1/agents", input, true, 0.5),
78
+ register: (input) => call("POST", "/v1/agents", input, true, 0.25),
79
79
  prove: (id, proof) => call("POST", `/v1/agents/${encodeURIComponent(id)}/prove`, proof),
80
80
  renew: (id) => call("POST", `/v1/agents/${encodeURIComponent(id)}/renew`, {}, true, 0.1),
81
81
  renewProve: (id, proof) => call("POST", `/v1/agents/${encodeURIComponent(id)}/renew/prove`, proof),
@@ -95,7 +95,7 @@ export function createKyaClient(opts = {}) {
95
95
  client.tools = [
96
96
  {
97
97
  name: "kya_verify", priceUsd: 0,
98
- description: "Free. Is this AI agent credentialed by a Brazilian company? Returns the credential (company CNPJ and name, mandate, KYB snapshot), its live status (active, suspended, revoked, expired) and history. Give credential_id, or the agent key (kind + id) to look it up.",
98
+ description: "Free. Is this AI agent credentialed by a Brazilian company? Returns the credential (company CNPJ and name, mandate), its live status (active, suspended, revoked, expired) and history. Give credential_id, or the agent key (kind + id) to look it up.",
99
99
  parameters: { type: "object", properties: { credential_id: ID, kind: { type: "string", enum: ["evm", "web-bot-auth", "erc8004"] }, id: { type: "string", description: "0x address, base64url Ed25519 key, or eip155:<chainId>:<registry>:<agentId>" } }, additionalProperties: false },
100
100
  execute: async (a) => (a.credential_id ? client.verify(String(a.credential_id)) : client.verifyByKey({ kind: a.kind, id: String(a.id) }))
101
101
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kya-brasil/agent-tools",
3
- "version": "0.5.1",
4
- "description": "KYA Brasil for AI agents: verify that an agent acts for a Brazilian company (e-CNPJ-signed credential, revocation and company registration checked daily), check an action against its mandate, or give your own agent a credential. Sign in with KYA middleware (Hono, Express, Workers) and request signing. x402 payments (USDC on Base) handled for you. Adapters for Vercel AI SDK, LangChain, OpenAI and Anthropic.",
3
+ "version": "0.5.3",
4
+ "description": "KYA Brasil for AI agents: verify that an agent acts for a Brazilian company (e-CNPJ-signed credential, revocation and company registration checked daily against the Receita's open data, no third-party service), check an action against its mandate, or give your own agent a credential. Sign in with KYA middleware (Hono, Express, Workers) and request signing. x402 payments (USDC on Base) handled for you. Adapters for Vercel AI SDK, LangChain, OpenAI and Anthropic.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",