@riv-io/sdk 0.1.0 → 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Riv.IO
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
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,7 @@
1
1
  {
2
2
  "name": "@riv-io/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
+ "license": "MIT",
4
5
  "type": "module",
5
6
  "description": "SDK TypeScript do Riv — autorização de gastos e consulta do ledger para agentes de IA.",
6
7
  "main": "./dist/index.cjs",