decixa-sdk 0.1.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 +133 -0
- package/dist/client.d.ts +10 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +51 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +76 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +143 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# @decixa/sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for [Decixa](https://decixa.ai) — The decision layer for AI Agents.
|
|
4
|
+
|
|
5
|
+
Discover, evaluate, and select from 20,000+ x402-enabled APIs programmatically.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @decixa/sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { Decixa } from "@decixa/sdk";
|
|
17
|
+
|
|
18
|
+
const decixa = new Decixa();
|
|
19
|
+
|
|
20
|
+
// Find the best API for a task
|
|
21
|
+
const result = await decixa.resolve({
|
|
22
|
+
capability: "Extract",
|
|
23
|
+
intent: "extract social media posts by keyword",
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
console.log(result.recommended);
|
|
27
|
+
// { name: "Neynar", endpoint: "https://...", pricing: { model: "per_call", usdc_per_call: 0.01 }, ... }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
### `new Decixa(config?)`
|
|
33
|
+
|
|
34
|
+
Create a client instance.
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const decixa = new Decixa({
|
|
38
|
+
baseUrl: "https://api.decixa.ai", // default
|
|
39
|
+
apiKey: "your-api-key", // optional (not required today)
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### `decixa.resolve(params)`
|
|
44
|
+
|
|
45
|
+
Get the top API recommendation for a capability + intent. Returns a ranked recommendation with up to 2 alternatives.
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
const result = await decixa.resolve({
|
|
49
|
+
capability: "Search", // required: Search | Extract | Transform | Analyze | Generate | Modify | Communicate | Transact | Store
|
|
50
|
+
intent: "find news articles about AI",
|
|
51
|
+
constraints: {
|
|
52
|
+
latency: "low", // low | medium | high
|
|
53
|
+
budget: 0.05, // max USDC per call
|
|
54
|
+
agent_ready: true, // only verified APIs
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
result.recommended // top-ranked API or null
|
|
59
|
+
result.alternatives // up to 2 more options
|
|
60
|
+
result.is_fallback // true if constraints were relaxed
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### `decixa.discover(params?)`
|
|
64
|
+
|
|
65
|
+
Browse and search APIs with filters. Supports vector search (semantic matching).
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
const result = await decixa.discover({
|
|
69
|
+
task: "web scraping", // free-text search
|
|
70
|
+
capability: "Extract", // filter by capability
|
|
71
|
+
tag: "Social Media", // filter by tag
|
|
72
|
+
latency_tier: "low",
|
|
73
|
+
pricing_model: "per_call",
|
|
74
|
+
budget: 0.10,
|
|
75
|
+
sort: "trust", // trust | price_asc | price_desc
|
|
76
|
+
limit: 20,
|
|
77
|
+
offset: 0,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
result.total // total matching APIs
|
|
81
|
+
result.apis // array of API summaries with trust scores
|
|
82
|
+
result.next // URL for next page (or null)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### `decixa.detail(id)`
|
|
86
|
+
|
|
87
|
+
Get full metadata for a specific API.
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
const api = await decixa.detail("550e8400-e29b-41d4-a716-446655440000");
|
|
91
|
+
|
|
92
|
+
api.trust_evidence.uptime_7d // 7-day uptime %
|
|
93
|
+
api.trust_evidence.p95_latency_ms // p95 latency
|
|
94
|
+
api.agent_compatibility // latency, execution mode, deterministic
|
|
95
|
+
api.schema // input/output types, OpenAPI spec URL
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Use with AI Agents
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { Decixa } from "@decixa/sdk";
|
|
102
|
+
|
|
103
|
+
const decixa = new Decixa();
|
|
104
|
+
|
|
105
|
+
async function findAndCallApi(task: string) {
|
|
106
|
+
// 1. Resolve the best API
|
|
107
|
+
const { recommended } = await decixa.resolve({
|
|
108
|
+
capability: "Extract",
|
|
109
|
+
intent: task,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
if (!recommended) throw new Error("No API found");
|
|
113
|
+
|
|
114
|
+
// 2. Get full details
|
|
115
|
+
const detail = await decixa.detail(recommended.id);
|
|
116
|
+
|
|
117
|
+
// 3. Call the API (x402 payment handled by your agent)
|
|
118
|
+
const response = await fetch(detail.endpoint, {
|
|
119
|
+
headers: { "X-402-Payment": "..." },
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
return response.json();
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Also Available
|
|
127
|
+
|
|
128
|
+
- **MCP Server**: `npx decixa-mcp` — use Decixa directly in Claude Code
|
|
129
|
+
- **REST API**: `https://api.decixa.ai/api/agent/resolve` — call directly via HTTP
|
|
130
|
+
|
|
131
|
+
## License
|
|
132
|
+
|
|
133
|
+
MIT
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DecixaConfig } from "./types.js";
|
|
2
|
+
export declare class HttpClient {
|
|
3
|
+
private baseUrl;
|
|
4
|
+
private apiKey;
|
|
5
|
+
constructor(config?: DecixaConfig);
|
|
6
|
+
private headers;
|
|
7
|
+
post<T>(path: string, body: unknown): Promise<T>;
|
|
8
|
+
get<T>(path: string, params?: Record<string, string | number | boolean | undefined>): Promise<T>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAK/C,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,GAAE,YAAiB;IAKrC,OAAO,CAAC,OAAO;IAST,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAahD,GAAG,CAAC,CAAC,EACT,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,GAC7D,OAAO,CAAC,CAAC,CAAC;CAmBd"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const DEFAULT_BASE_URL = "https://api.decixa.ai";
|
|
2
|
+
const VERSION = "0.1.0";
|
|
3
|
+
export class HttpClient {
|
|
4
|
+
baseUrl;
|
|
5
|
+
apiKey;
|
|
6
|
+
constructor(config = {}) {
|
|
7
|
+
this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
|
|
8
|
+
this.apiKey = config.apiKey ?? "";
|
|
9
|
+
}
|
|
10
|
+
headers() {
|
|
11
|
+
const h = {
|
|
12
|
+
"Content-Type": "application/json",
|
|
13
|
+
"User-Agent": `decixa-sdk/${VERSION}`,
|
|
14
|
+
};
|
|
15
|
+
if (this.apiKey)
|
|
16
|
+
h["Authorization"] = `Bearer ${this.apiKey}`;
|
|
17
|
+
return h;
|
|
18
|
+
}
|
|
19
|
+
async post(path, body) {
|
|
20
|
+
const res = await fetch(`${this.baseUrl}${path}`, {
|
|
21
|
+
method: "POST",
|
|
22
|
+
headers: this.headers(),
|
|
23
|
+
body: JSON.stringify(body),
|
|
24
|
+
});
|
|
25
|
+
if (!res.ok) {
|
|
26
|
+
const text = await res.text().catch(() => "");
|
|
27
|
+
throw new Error(`Decixa API error ${res.status}: ${text}`);
|
|
28
|
+
}
|
|
29
|
+
return res.json();
|
|
30
|
+
}
|
|
31
|
+
async get(path, params) {
|
|
32
|
+
const url = new URL(`${this.baseUrl}${path}`);
|
|
33
|
+
if (params) {
|
|
34
|
+
for (const [k, v] of Object.entries(params)) {
|
|
35
|
+
if (v !== undefined && v !== null && v !== "") {
|
|
36
|
+
url.searchParams.set(k, String(v));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const res = await fetch(url.toString(), {
|
|
41
|
+
method: "GET",
|
|
42
|
+
headers: this.headers(),
|
|
43
|
+
});
|
|
44
|
+
if (!res.ok) {
|
|
45
|
+
const text = await res.text().catch(() => "");
|
|
46
|
+
throw new Error(`Decixa API error ${res.status}: ${text}`);
|
|
47
|
+
}
|
|
48
|
+
return res.json();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AACjD,MAAM,OAAO,GAAG,OAAO,CAAC;AAExB,MAAM,OAAO,UAAU;IACb,OAAO,CAAS;IAChB,MAAM,CAAS;IAEvB,YAAY,SAAuB,EAAE;QACnC,IAAI,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,gBAAgB,CAAC,CAAC,OAAO,CAAC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I,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;oBAC9C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrC,CAAC;YACH,CAAC;QACH,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE;YACtC,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;SACxB,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO,GAAG,CAAC,IAAI,EAAgB,CAAC;IAClC,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { DecixaConfig, ResolveParams, ResolveResponse, DiscoverParams, DiscoverResponse, ApiDetail } from "./types.js";
|
|
2
|
+
export declare class Decixa {
|
|
3
|
+
private http;
|
|
4
|
+
constructor(config?: DecixaConfig);
|
|
5
|
+
/**
|
|
6
|
+
* Get the top API recommendation for a given capability and intent.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const result = await decixa.resolve({
|
|
11
|
+
* capability: "Extract",
|
|
12
|
+
* intent: "extract social media posts by keyword",
|
|
13
|
+
* });
|
|
14
|
+
* console.log(result.recommended?.name);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
resolve(params: ResolveParams): Promise<ResolveResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Search and browse APIs with filters and pagination.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const result = await decixa.discover({
|
|
24
|
+
* task: "web scraping",
|
|
25
|
+
* sort: "trust",
|
|
26
|
+
* limit: 10,
|
|
27
|
+
* });
|
|
28
|
+
* for (const api of result.apis) {
|
|
29
|
+
* console.log(api.name, api.trust_score);
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
discover(params?: DiscoverParams): Promise<DiscoverResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Get full metadata for a specific API by ID.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const api = await decixa.detail("550e8400-e29b-41d4-a716-446655440000");
|
|
40
|
+
* console.log(api.trust_evidence.uptime_7d);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
detail(id: string): Promise<ApiDetail>;
|
|
44
|
+
}
|
|
45
|
+
export type { DecixaConfig, Capability, LatencyTier, PricingModel, SortOption, Pricing, TrustEvidence, Provider, ResolveParams, ResolveResponse, ResolvedApi, ScoreBreakdown, DiscoverParams, DiscoverResponse, ApiSummary, ApiDetail, } from "./types.js";
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,SAAS,EACV,MAAM,YAAY,CAAC;AAEpB,qBAAa,MAAM;IACjB,OAAO,CAAC,IAAI,CAAa;gBAEb,MAAM,GAAE,YAAiB;IAIrC;;;;;;;;;;;OAWG;IACG,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC;IAI9D;;;;;;;;;;;;;;OAcG;IACG,QAAQ,CAAC,MAAM,GAAE,cAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAiBtE;;;;;;;;OAQG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;CAG7C;AAGD,YAAY,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,OAAO,EACP,aAAa,EACb,QAAQ,EACR,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,SAAS,GACV,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { HttpClient } from "./client.js";
|
|
2
|
+
export class Decixa {
|
|
3
|
+
http;
|
|
4
|
+
constructor(config = {}) {
|
|
5
|
+
this.http = new HttpClient(config);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Get the top API recommendation for a given capability and intent.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const result = await decixa.resolve({
|
|
13
|
+
* capability: "Extract",
|
|
14
|
+
* intent: "extract social media posts by keyword",
|
|
15
|
+
* });
|
|
16
|
+
* console.log(result.recommended?.name);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
async resolve(params) {
|
|
20
|
+
return this.http.post("/api/agent/resolve", params);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Search and browse APIs with filters and pagination.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const result = await decixa.discover({
|
|
28
|
+
* task: "web scraping",
|
|
29
|
+
* sort: "trust",
|
|
30
|
+
* limit: 10,
|
|
31
|
+
* });
|
|
32
|
+
* for (const api of result.apis) {
|
|
33
|
+
* console.log(api.name, api.trust_score);
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
async discover(params = {}) {
|
|
38
|
+
const query = {};
|
|
39
|
+
if (params.task)
|
|
40
|
+
query.task = params.task;
|
|
41
|
+
if (params.capability)
|
|
42
|
+
query.capability = params.capability;
|
|
43
|
+
if (params.tag)
|
|
44
|
+
query.tag = params.tag;
|
|
45
|
+
if (params.agent_ready !== undefined)
|
|
46
|
+
query.agent_ready = String(params.agent_ready);
|
|
47
|
+
if (params.latency_tier)
|
|
48
|
+
query.latency_tier = params.latency_tier;
|
|
49
|
+
if (params.execution_mode)
|
|
50
|
+
query.execution_mode = params.execution_mode;
|
|
51
|
+
if (params.pricing_model)
|
|
52
|
+
query.pricing_model = params.pricing_model;
|
|
53
|
+
if (params.budget !== undefined)
|
|
54
|
+
query.budget = params.budget;
|
|
55
|
+
if (params.sort)
|
|
56
|
+
query.sort = params.sort;
|
|
57
|
+
if (params.limit !== undefined)
|
|
58
|
+
query.limit = params.limit;
|
|
59
|
+
if (params.offset !== undefined)
|
|
60
|
+
query.offset = params.offset;
|
|
61
|
+
return this.http.get("/api/agent/discover", query);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get full metadata for a specific API by ID.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const api = await decixa.detail("550e8400-e29b-41d4-a716-446655440000");
|
|
69
|
+
* console.log(api.trust_evidence.uptime_7d);
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
async detail(id) {
|
|
73
|
+
return this.http.get(`/api/agent/detail/${id}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAUzC,MAAM,OAAO,MAAM;IACT,IAAI,CAAa;IAEzB,YAAY,SAAuB,EAAE;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,UAAU,CA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SAAS;YAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC9D,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAmB,qBAAqB,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAY,qBAAqB,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC;CACF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
export type Capability = "Search" | "Extract" | "Transform" | "Analyze" | "Generate" | "Modify" | "Communicate" | "Transact" | "Store";
|
|
2
|
+
export type LatencyTier = "low" | "medium" | "high";
|
|
3
|
+
export type PricingModel = "per_call" | "subscription" | "hybrid" | "unknown";
|
|
4
|
+
export type SortOption = "trust" | "calls" | "price_asc" | "price_desc";
|
|
5
|
+
export interface Pricing {
|
|
6
|
+
model: string;
|
|
7
|
+
usdc_per_call: number | null;
|
|
8
|
+
}
|
|
9
|
+
export interface TrustEvidence {
|
|
10
|
+
score: number | null;
|
|
11
|
+
uptime_7d: number | null;
|
|
12
|
+
p95_latency_ms: number | null;
|
|
13
|
+
payment_req_parsed: boolean | null;
|
|
14
|
+
last_checked: string | null;
|
|
15
|
+
last_probed_at: string | null;
|
|
16
|
+
}
|
|
17
|
+
export interface Provider {
|
|
18
|
+
name: string;
|
|
19
|
+
website: string | null;
|
|
20
|
+
}
|
|
21
|
+
export interface ResolveParams {
|
|
22
|
+
capability: Capability;
|
|
23
|
+
intent?: string;
|
|
24
|
+
constraints?: {
|
|
25
|
+
latency?: LatencyTier;
|
|
26
|
+
budget?: number;
|
|
27
|
+
agent_ready?: boolean;
|
|
28
|
+
};
|
|
29
|
+
debug?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface ScoreBreakdown {
|
|
32
|
+
total: number;
|
|
33
|
+
latency_score: number;
|
|
34
|
+
price_score: number;
|
|
35
|
+
tag_score: number;
|
|
36
|
+
tag_boost_score: number;
|
|
37
|
+
tiebreak_score: number;
|
|
38
|
+
}
|
|
39
|
+
export interface ResolvedApi {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
endpoint: string | null;
|
|
43
|
+
capability: string | null;
|
|
44
|
+
tags: string[];
|
|
45
|
+
pricing: Pricing;
|
|
46
|
+
latency_tier: string | null;
|
|
47
|
+
agent_ready: boolean;
|
|
48
|
+
detail_url: string;
|
|
49
|
+
ranking_basis: string;
|
|
50
|
+
trust_score: null;
|
|
51
|
+
_score?: ScoreBreakdown;
|
|
52
|
+
}
|
|
53
|
+
export interface ResolveResponse {
|
|
54
|
+
recommended: ResolvedApi | null;
|
|
55
|
+
alternatives: ResolvedApi[];
|
|
56
|
+
is_fallback: boolean;
|
|
57
|
+
fallback_reason: string | null;
|
|
58
|
+
relaxed_constraints: Record<string, string> | null;
|
|
59
|
+
strict_match_count: number;
|
|
60
|
+
fallback_match_count: number;
|
|
61
|
+
}
|
|
62
|
+
export interface DiscoverParams {
|
|
63
|
+
task?: string;
|
|
64
|
+
capability?: Capability;
|
|
65
|
+
tag?: string;
|
|
66
|
+
agent_ready?: boolean;
|
|
67
|
+
latency_tier?: LatencyTier;
|
|
68
|
+
execution_mode?: "sync" | "async";
|
|
69
|
+
pricing_model?: PricingModel;
|
|
70
|
+
budget?: number;
|
|
71
|
+
sort?: SortOption;
|
|
72
|
+
limit?: number;
|
|
73
|
+
offset?: number;
|
|
74
|
+
}
|
|
75
|
+
export interface ApiSummary {
|
|
76
|
+
id: string;
|
|
77
|
+
name: string;
|
|
78
|
+
description: string;
|
|
79
|
+
endpoint: string;
|
|
80
|
+
pricing: Pricing;
|
|
81
|
+
capability: string | null;
|
|
82
|
+
tags: string[];
|
|
83
|
+
agent_ready: boolean;
|
|
84
|
+
latency_tier: string | null;
|
|
85
|
+
execution_mode: string | null;
|
|
86
|
+
data_mode: string | null;
|
|
87
|
+
deterministic: boolean | null;
|
|
88
|
+
input_type: string[];
|
|
89
|
+
output_type: string[];
|
|
90
|
+
use_cases: string[];
|
|
91
|
+
spec_url: string | null;
|
|
92
|
+
trust_score: number;
|
|
93
|
+
trust: TrustEvidence;
|
|
94
|
+
provider: Provider | null;
|
|
95
|
+
detail_url: string;
|
|
96
|
+
}
|
|
97
|
+
export interface DiscoverResponse {
|
|
98
|
+
total: number;
|
|
99
|
+
limit: number;
|
|
100
|
+
offset: number;
|
|
101
|
+
next: string | null;
|
|
102
|
+
prev: string | null;
|
|
103
|
+
apis: ApiSummary[];
|
|
104
|
+
search_mode?: string;
|
|
105
|
+
}
|
|
106
|
+
export interface ApiDetail {
|
|
107
|
+
id: string;
|
|
108
|
+
name: string;
|
|
109
|
+
description: string;
|
|
110
|
+
endpoint: string;
|
|
111
|
+
pricing: Pricing;
|
|
112
|
+
capability: string | null;
|
|
113
|
+
tags: string[];
|
|
114
|
+
agent_compatibility: {
|
|
115
|
+
agent_ready: boolean;
|
|
116
|
+
latency_tier: string | null;
|
|
117
|
+
execution_mode: string | null;
|
|
118
|
+
data_mode: string | null;
|
|
119
|
+
deterministic: boolean | null;
|
|
120
|
+
};
|
|
121
|
+
schema: {
|
|
122
|
+
input_type: string[];
|
|
123
|
+
output_type: string[];
|
|
124
|
+
spec_url: string | null;
|
|
125
|
+
};
|
|
126
|
+
use_cases: string[];
|
|
127
|
+
trust_score: number;
|
|
128
|
+
trust_evidence: TrustEvidence;
|
|
129
|
+
metadata_source: string | null;
|
|
130
|
+
provider: Provider | null;
|
|
131
|
+
decixa_url: string;
|
|
132
|
+
discover_url: string;
|
|
133
|
+
}
|
|
134
|
+
export interface CapabilityInfo {
|
|
135
|
+
name: Capability;
|
|
136
|
+
description: string;
|
|
137
|
+
tags?: string[];
|
|
138
|
+
}
|
|
139
|
+
export interface DecixaConfig {
|
|
140
|
+
baseUrl?: string;
|
|
141
|
+
apiKey?: string;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingUR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,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,mBAAmB,EAAE;QACnB,WAAW,EAAE,OAAO,CAAC;QACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,aAAa,EAAE,OAAO,GAAG,IAAI,CAAC;KAC/B,CAAC;IACF,MAAM,EAAE;QACN,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB,CAAC;IACF,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,aAAa,CAAC;IAC9B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAID,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAID,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,eAAe"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "decixa-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript SDK for Decixa — The decision layer for AI Agents",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"decixa",
|
|
7
|
+
"api-discovery",
|
|
8
|
+
"x402",
|
|
9
|
+
"ai-agents",
|
|
10
|
+
"sdk"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"dev": "tsc --watch"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^22.0.0",
|
|
31
|
+
"typescript": "^5.4.0"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://github.com/koki-socialgist/decixa-sdk.git"
|
|
39
|
+
}
|
|
40
|
+
}
|