@riv-io/sdk 0.1.1 → 0.2.0

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
@@ -31,10 +31,11 @@ emitida ao conectar o agente no painel do Riv.
31
31
  ### `new Riv(options)`
32
32
 
33
33
  - `apiKey` (obrigatória) — credencial `riv_` do agente.
34
- - `baseUrl` (opcional) — base da API do Riv. Default: `http://localhost:3000`.
34
+ - `baseUrl` (opcional) — base da API do Riv. Default: `http://localhost:3000`
35
+ (dev local); em produção, `https://riv-io.vercel.app`.
35
36
  - `timeoutMs` (opcional) — timeout por chamada. Sem default (sem timeout).
36
37
 
37
- ### `riv.authorize({ amount, currency, description? })`
38
+ ### `riv.authorize({ amount, currency, description?, category? })`
38
39
 
39
40
  Pergunta ao Riv se uma transação é permitida **antes** de executá-la. Retorna:
40
41
 
@@ -46,6 +47,10 @@ Pergunta ao Riv se uma transação é permitida **antes** de executá-la. Retorn
46
47
  decide o que fazer (parar, ou aguardar aprovação humana). O SDK **nunca faz
47
48
  retry automático** de `authorize`: cada chamada grava uma entrada no ledger.
48
49
 
50
+ `category` (opcional) classifica o gasto (ex.: `"inference"`, `"saas"`) —
51
+ mandatos por categoria limitam o acumulado daquela categoria. Normalizada
52
+ (lowercase) no servidor.
53
+
49
54
  ### `riv.activity(activityId)`
50
55
 
51
56
  Consulta pontual: o registro de uma autorização no ledger (use o `activityId`
@@ -56,6 +61,12 @@ pertencer a outro agente.
56
61
 
57
62
  Extrato: as atividades mais recentes do agente (padrão 10, máx. 50).
58
63
 
64
+ Valores de `status` nas atividades: `approved` (conta no gasto acumulado),
65
+ `pending` (aguardando humano), `blocked` (veredito do motor) e `rejected`
66
+ (humano negou a aprovação — não conta no gasto). Um `pending` muda para
67
+ `approved` ou `rejected` quando alguém resolve no painel do Riv — consulte a
68
+ atividade de novo para ver o desfecho.
69
+
59
70
  ## Erros
60
71
 
61
72
  Falhas reais da chamada lançam subclasses de `RivError` (com `.code` e
@@ -100,7 +111,7 @@ try {
100
111
  riv_mcp = StdioServerParameters(
101
112
  command="node",
102
113
  args=["/caminho/para/riv/mcp/dist/index.js"],
103
- env={"RIV_API_KEY": "riv_...", "RIV_API_URL": "https://sua-instancia-riv"},
114
+ env={"RIV_API_KEY": "riv_...", "RIV_API_URL": "https://riv-io.vercel.app"},
104
115
  )
105
116
 
106
117
  with MCPServerAdapter(riv_mcp) as tools:
package/dist/index.d.cts CHANGED
@@ -6,6 +6,11 @@ type AuthorizeInput = {
6
6
  currency: string;
7
7
  /** Descrição opcional, registrada no ledger para auditoria. */
8
8
  description?: string;
9
+ /**
10
+ * Categoria de gasto opcional (ex.: "inference", "saas") — mandatos por
11
+ * categoria usam isto. Normalizada (lowercase) no servidor.
12
+ */
13
+ category?: string;
9
14
  };
10
15
  type AuthorizeResult = {
11
16
  decision: Decision;
@@ -21,6 +26,8 @@ type Activity = {
21
26
  rail: string | null;
22
27
  status: string;
23
28
  description: string | null;
29
+ /** Categoria de gasto informada no authorize; null = sem categoria. */
30
+ category: string | null;
24
31
  /** ISO 8601. */
25
32
  createdAt: string;
26
33
  };
package/dist/index.d.ts CHANGED
@@ -6,6 +6,11 @@ type AuthorizeInput = {
6
6
  currency: string;
7
7
  /** Descrição opcional, registrada no ledger para auditoria. */
8
8
  description?: string;
9
+ /**
10
+ * Categoria de gasto opcional (ex.: "inference", "saas") — mandatos por
11
+ * categoria usam isto. Normalizada (lowercase) no servidor.
12
+ */
13
+ category?: string;
9
14
  };
10
15
  type AuthorizeResult = {
11
16
  decision: Decision;
@@ -21,6 +26,8 @@ type Activity = {
21
26
  rail: string | null;
22
27
  status: string;
23
28
  description: string | null;
29
+ /** Categoria de gasto informada no authorize; null = sem categoria. */
30
+ category: string | null;
24
31
  /** ISO 8601. */
25
32
  createdAt: string;
26
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riv-io/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "SDK TypeScript do Riv — autorização de gastos e consulta do ledger para agentes de IA.",