@gibs-dev/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/LICENSE +21 -0
- package/README.md +206 -0
- package/dist/cjs/client.d.ts +151 -0
- package/dist/cjs/client.d.ts.map +1 -0
- package/dist/cjs/client.js +328 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/errors.d.ts +66 -0
- package/dist/cjs/errors.d.ts.map +1 -0
- package/dist/cjs/errors.js +99 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/index.d.ts +21 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +32 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/types.d.ts +163 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +10 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/client.d.ts +151 -0
- package/dist/esm/client.d.ts.map +1 -0
- package/dist/esm/client.js +324 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/errors.d.ts +66 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +90 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/index.d.ts +21 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +22 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types.d.ts +163 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +9 -0
- package/dist/esm/types.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript type definitions for the Gibs compliance API.
|
|
3
|
+
*
|
|
4
|
+
* All types mirror the backend Pydantic schemas exactly.
|
|
5
|
+
*
|
|
6
|
+
* @module types
|
|
7
|
+
*/
|
|
8
|
+
/** Risk classification levels under the EU AI Act. */
|
|
9
|
+
export type RiskLevel = 'prohibited' | 'high' | 'limited' | 'minimal';
|
|
10
|
+
/** Confidence levels for compliance answers. */
|
|
11
|
+
export type ConfidenceLevel = 'high' | 'medium' | 'low';
|
|
12
|
+
/** Supported regulation identifiers. */
|
|
13
|
+
export type Regulation = 'ai_act' | 'gdpr' | 'both';
|
|
14
|
+
/** A source citation linking a claim to a specific legal article. */
|
|
15
|
+
export interface SourceCitation {
|
|
16
|
+
/** Article identifier, e.g., "ai_act_art6". */
|
|
17
|
+
article_id: string;
|
|
18
|
+
/** Article title. */
|
|
19
|
+
title: string;
|
|
20
|
+
/** Relevant excerpt from the article text. */
|
|
21
|
+
text_excerpt: string;
|
|
22
|
+
/** Relevance score between 0.0 and 1.0. */
|
|
23
|
+
relevance_score: number;
|
|
24
|
+
}
|
|
25
|
+
/** A compliance obligation the user must fulfill. */
|
|
26
|
+
export interface Obligation {
|
|
27
|
+
/** Obligation identifier. */
|
|
28
|
+
id: string;
|
|
29
|
+
/** Human-readable description of what must be done. */
|
|
30
|
+
description: string;
|
|
31
|
+
/** Article that defines this obligation, e.g., "Article 9". */
|
|
32
|
+
source_article: string;
|
|
33
|
+
/** Compliance deadline in ISO 8601 format, or null if none. */
|
|
34
|
+
deadline: string | null;
|
|
35
|
+
}
|
|
36
|
+
/** API key metadata (never includes the full key value). */
|
|
37
|
+
export interface KeyInfo {
|
|
38
|
+
/** Key database ID. */
|
|
39
|
+
id: number;
|
|
40
|
+
/** Human-readable key name. */
|
|
41
|
+
name: string;
|
|
42
|
+
/** First 13 characters of the key for identification. */
|
|
43
|
+
key_prefix: string;
|
|
44
|
+
/** Whether this is a test key. */
|
|
45
|
+
is_test: boolean;
|
|
46
|
+
/** ISO 8601 creation timestamp. */
|
|
47
|
+
created_at: string;
|
|
48
|
+
/** ISO 8601 last-used timestamp, or null if never used. */
|
|
49
|
+
last_used_at: string | null;
|
|
50
|
+
/** Total number of requests made with this key. */
|
|
51
|
+
request_count: number;
|
|
52
|
+
}
|
|
53
|
+
/** Request body for `POST /v1/classify`. */
|
|
54
|
+
export interface ClassifyRequest {
|
|
55
|
+
/** Description of the AI system to classify. 10-5000 characters. */
|
|
56
|
+
description: string;
|
|
57
|
+
/** Types of data processed, e.g., ["biometric", "health"]. */
|
|
58
|
+
data_types?: string[];
|
|
59
|
+
/** What decisions the AI system makes or influences. */
|
|
60
|
+
decision_scope?: string;
|
|
61
|
+
/** Industry sector, e.g., "healthcare", "finance", "employment". */
|
|
62
|
+
sector?: string;
|
|
63
|
+
/** Target jurisdiction. Currently only "EU" is supported. */
|
|
64
|
+
jurisdiction?: string;
|
|
65
|
+
}
|
|
66
|
+
/** Response body for `POST /v1/classify`. */
|
|
67
|
+
export interface ClassifyResponse {
|
|
68
|
+
/** AI Act risk classification. */
|
|
69
|
+
risk_level: RiskLevel;
|
|
70
|
+
/** Confidence in the classification (0.0 to 1.0). */
|
|
71
|
+
confidence: number;
|
|
72
|
+
/** Explanation of why this risk level applies. */
|
|
73
|
+
reasoning: string;
|
|
74
|
+
/** Required compliance obligations for this risk level. */
|
|
75
|
+
obligations: Obligation[];
|
|
76
|
+
/** Source citations supporting this classification. */
|
|
77
|
+
sources: SourceCitation[];
|
|
78
|
+
/** Unique request identifier for audit trail. */
|
|
79
|
+
request_id: string;
|
|
80
|
+
/** Version of the legal corpus used. */
|
|
81
|
+
corpus_version: string;
|
|
82
|
+
/** Processing time in milliseconds. */
|
|
83
|
+
processing_time_ms: number;
|
|
84
|
+
}
|
|
85
|
+
/** Request body for `POST /v1/check`. */
|
|
86
|
+
export interface CheckRequest {
|
|
87
|
+
/** Compliance question to answer. 10-2000 characters. */
|
|
88
|
+
question: string;
|
|
89
|
+
/** Optional context about the AI system (key-value pairs). */
|
|
90
|
+
system_context?: Record<string, string>;
|
|
91
|
+
/** Which regulation to check: "ai_act", "gdpr", or "both". Defaults to "both". */
|
|
92
|
+
regulation?: Regulation;
|
|
93
|
+
}
|
|
94
|
+
/** Response body for `POST /v1/check`. */
|
|
95
|
+
export interface CheckResponse {
|
|
96
|
+
/** Answer to the compliance question. */
|
|
97
|
+
answer: string;
|
|
98
|
+
/** Confidence level: "high", "medium", or "low". */
|
|
99
|
+
confidence: ConfidenceLevel;
|
|
100
|
+
/** Source citations supporting this answer. */
|
|
101
|
+
sources: SourceCitation[];
|
|
102
|
+
/** True if the sources don't contain enough information to answer. */
|
|
103
|
+
should_abstain: boolean;
|
|
104
|
+
/** Explanation of why the system abstained, if applicable. */
|
|
105
|
+
abstention_reason?: string | null;
|
|
106
|
+
/** Unique request identifier for audit trail. */
|
|
107
|
+
request_id: string;
|
|
108
|
+
/** Version of the legal corpus used. */
|
|
109
|
+
corpus_version: string;
|
|
110
|
+
/** Processing time in milliseconds. */
|
|
111
|
+
processing_time_ms: number;
|
|
112
|
+
}
|
|
113
|
+
/** Response body for `GET /v1/health`. */
|
|
114
|
+
export interface HealthResponse {
|
|
115
|
+
/** Overall system status: "healthy", "degraded", or "unhealthy". */
|
|
116
|
+
status: string;
|
|
117
|
+
/** Environment name, e.g., "production" or "staging". */
|
|
118
|
+
environment: string;
|
|
119
|
+
/** Version of the legal corpus. */
|
|
120
|
+
corpus_version: string;
|
|
121
|
+
/** Status of individual components. */
|
|
122
|
+
components: Record<string, string>;
|
|
123
|
+
}
|
|
124
|
+
/** Request body for `POST /v1/account/keys`. */
|
|
125
|
+
export interface CreateKeyRequest {
|
|
126
|
+
/** Human-readable name for the key. Defaults to "Default". */
|
|
127
|
+
name?: string;
|
|
128
|
+
}
|
|
129
|
+
/** Response body for `POST /v1/account/keys`. Full key shown only once. */
|
|
130
|
+
export interface KeyCreatedResponse {
|
|
131
|
+
/** Key database ID. */
|
|
132
|
+
id: number;
|
|
133
|
+
/** Full API key value. Store securely -- it cannot be retrieved again. */
|
|
134
|
+
api_key: string;
|
|
135
|
+
/** First 13 characters of the key for identification. */
|
|
136
|
+
key_prefix: string;
|
|
137
|
+
/** Human-readable key name. */
|
|
138
|
+
name: string;
|
|
139
|
+
/** ISO 8601 creation timestamp. */
|
|
140
|
+
created_at: string;
|
|
141
|
+
}
|
|
142
|
+
/** Response body for `DELETE /v1/account/keys/{key_id}`. */
|
|
143
|
+
export interface KeyDeletedResponse {
|
|
144
|
+
/** Status indicator. Always "revoked" on success. */
|
|
145
|
+
status: 'revoked';
|
|
146
|
+
}
|
|
147
|
+
/** Standard error response from the API. */
|
|
148
|
+
export interface ErrorResponseBody {
|
|
149
|
+
/** Error message or detail string. */
|
|
150
|
+
detail: string;
|
|
151
|
+
}
|
|
152
|
+
/** Configuration options for the GibsClient. */
|
|
153
|
+
export interface GibsClientOptions {
|
|
154
|
+
/** API key for authentication (e.g., "gbs_live_xxx"). Required. */
|
|
155
|
+
apiKey: string;
|
|
156
|
+
/** Base URL for the API. Defaults to "https://api.gibs.dev". */
|
|
157
|
+
baseUrl?: string;
|
|
158
|
+
/** Request timeout in milliseconds. Defaults to 120000 (120 seconds). */
|
|
159
|
+
timeout?: number;
|
|
160
|
+
/** Maximum number of retries on transient errors. Defaults to 3. */
|
|
161
|
+
maxRetries?: number;
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,sDAAsD;AACtD,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAEtE,gDAAgD;AAChD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAExD,wCAAwC;AACxC,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpD,qEAAqE;AACrE,MAAM,WAAW,cAAc;IAC7B,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,YAAY,EAAE,MAAM,CAAC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EAAE,MAAM,CAAC;IACX,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,4DAA4D;AAC5D,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,MAAM,EAAE,SAAS,CAAC;CACnB;AAMD,4CAA4C;AAC5C,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AAMD,gDAAgD;AAChD,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TypeScript type definitions for the Gibs compliance API.
|
|
4
|
+
*
|
|
5
|
+
* All types mirror the backend Pydantic schemas exactly.
|
|
6
|
+
*
|
|
7
|
+
* @module types
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gibs API client.
|
|
3
|
+
*
|
|
4
|
+
* Provides typed methods for all Gibs compliance API endpoints.
|
|
5
|
+
* Uses native `fetch` -- works in Node.js 18+, browsers, Deno, and Bun.
|
|
6
|
+
*
|
|
7
|
+
* @module client
|
|
8
|
+
*/
|
|
9
|
+
import type { CheckRequest, CheckResponse, ClassifyRequest, ClassifyResponse, CreateKeyRequest, GibsClientOptions, HealthResponse, KeyCreatedResponse, KeyDeletedResponse, KeyInfo } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Official client for the Gibs multi-regulation compliance API.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { GibsClient } from '@gibs/sdk';
|
|
16
|
+
*
|
|
17
|
+
* const client = new GibsClient({ apiKey: 'gbs_live_xxx' });
|
|
18
|
+
*
|
|
19
|
+
* const result = await client.classify({
|
|
20
|
+
* description: 'Facial recognition system for airport security',
|
|
21
|
+
* });
|
|
22
|
+
* console.log(result.risk_level);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare class GibsClient {
|
|
26
|
+
private readonly apiKey;
|
|
27
|
+
private readonly baseUrl;
|
|
28
|
+
private readonly timeout;
|
|
29
|
+
private readonly maxRetries;
|
|
30
|
+
constructor(options: GibsClientOptions);
|
|
31
|
+
/**
|
|
32
|
+
* Classify an AI system under EU AI Act risk levels.
|
|
33
|
+
*
|
|
34
|
+
* Returns the risk classification, relevant obligations,
|
|
35
|
+
* and source citations from the legal corpus.
|
|
36
|
+
*
|
|
37
|
+
* @param request - Description of the AI system to classify.
|
|
38
|
+
* @returns Classification result with risk level and obligations.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const result = await client.classify({
|
|
43
|
+
* description: 'CV screening tool that ranks job applicants',
|
|
44
|
+
* sector: 'employment',
|
|
45
|
+
* data_types: ['biometric'],
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* console.log(result.risk_level); // "high"
|
|
49
|
+
* console.log(result.obligations); // [{id: "risk_mgmt", ...}, ...]
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
classify(request: ClassifyRequest): Promise<ClassifyResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Ask a compliance question and get a grounded answer with citations.
|
|
55
|
+
*
|
|
56
|
+
* Every claim in the answer is traceable to a specific article
|
|
57
|
+
* in the legal corpus. If the corpus doesn't cover the question,
|
|
58
|
+
* the response indicates abstention with a reason.
|
|
59
|
+
*
|
|
60
|
+
* @param request - The compliance question and optional context.
|
|
61
|
+
* @returns Answer with source citations and confidence level.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const answer = await client.check({
|
|
66
|
+
* question: 'What are the transparency requirements for chatbots under the AI Act?',
|
|
67
|
+
* regulation: 'ai_act',
|
|
68
|
+
* });
|
|
69
|
+
*
|
|
70
|
+
* console.log(answer.answer);
|
|
71
|
+
* console.log(answer.sources);
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
check(request: CheckRequest): Promise<CheckResponse>;
|
|
75
|
+
/**
|
|
76
|
+
* Check API health and component status.
|
|
77
|
+
*
|
|
78
|
+
* Does not require authentication.
|
|
79
|
+
*
|
|
80
|
+
* @returns Health status with component details.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const health = await client.health();
|
|
85
|
+
* console.log(health.status); // "healthy"
|
|
86
|
+
* console.log(health.components); // {api: "healthy", qdrant: "healthy", ...}
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
health(): Promise<HealthResponse>;
|
|
90
|
+
/**
|
|
91
|
+
* List all active API keys for your organization.
|
|
92
|
+
*
|
|
93
|
+
* Returns metadata only -- never includes the full key value.
|
|
94
|
+
*
|
|
95
|
+
* @returns Array of key metadata.
|
|
96
|
+
*/
|
|
97
|
+
listKeys(): Promise<KeyInfo[]>;
|
|
98
|
+
/**
|
|
99
|
+
* Create a new API key for your organization.
|
|
100
|
+
*
|
|
101
|
+
* The full key value is returned exactly once in the response.
|
|
102
|
+
* Store it securely -- it cannot be retrieved again.
|
|
103
|
+
*
|
|
104
|
+
* Maximum 5 active keys per organization.
|
|
105
|
+
*
|
|
106
|
+
* @param request - Optional name for the key.
|
|
107
|
+
* @returns The created key including the full key value (shown once).
|
|
108
|
+
*/
|
|
109
|
+
createKey(request?: CreateKeyRequest): Promise<KeyCreatedResponse>;
|
|
110
|
+
/**
|
|
111
|
+
* Revoke an API key.
|
|
112
|
+
*
|
|
113
|
+
* The key must belong to your organization. You cannot revoke
|
|
114
|
+
* the key that is currently being used for authentication.
|
|
115
|
+
*
|
|
116
|
+
* @param keyId - Database ID of the key to revoke.
|
|
117
|
+
* @returns Confirmation with status "revoked".
|
|
118
|
+
*/
|
|
119
|
+
deleteKey(keyId: number): Promise<KeyDeletedResponse>;
|
|
120
|
+
/**
|
|
121
|
+
* Execute an HTTP request with retries, timeout, and error handling.
|
|
122
|
+
*/
|
|
123
|
+
private _request;
|
|
124
|
+
/**
|
|
125
|
+
* Fetch with an AbortController-based timeout.
|
|
126
|
+
*/
|
|
127
|
+
private _fetchWithTimeout;
|
|
128
|
+
/**
|
|
129
|
+
* Build the correct error class for a given HTTP status code.
|
|
130
|
+
*/
|
|
131
|
+
private _buildError;
|
|
132
|
+
/**
|
|
133
|
+
* Calculate retry delay with exponential backoff and jitter.
|
|
134
|
+
*
|
|
135
|
+
* For rate limit errors, respects the Retry-After header.
|
|
136
|
+
*/
|
|
137
|
+
private _retryDelay;
|
|
138
|
+
/**
|
|
139
|
+
* Extract response headers into a plain object.
|
|
140
|
+
*/
|
|
141
|
+
private _extractHeaders;
|
|
142
|
+
/**
|
|
143
|
+
* Check if an error is a network-level error (no HTTP response received).
|
|
144
|
+
*/
|
|
145
|
+
private _isNetworkError;
|
|
146
|
+
/**
|
|
147
|
+
* Sleep for a given number of milliseconds.
|
|
148
|
+
*/
|
|
149
|
+
private _sleep;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],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"}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gibs API client.
|
|
3
|
+
*
|
|
4
|
+
* Provides typed methods for all Gibs compliance API endpoints.
|
|
5
|
+
* Uses native `fetch` -- works in Node.js 18+, browsers, Deno, and Bun.
|
|
6
|
+
*
|
|
7
|
+
* @module client
|
|
8
|
+
*/
|
|
9
|
+
import { GibsAPIError, GibsAuthError, GibsConnectionError, GibsRateLimitError, GibsTimeoutError, } from './errors.js';
|
|
10
|
+
const VERSION = '0.1.0';
|
|
11
|
+
const DEFAULT_BASE_URL = 'https://api.gibs.dev';
|
|
12
|
+
const DEFAULT_TIMEOUT_MS = 120_000;
|
|
13
|
+
const DEFAULT_MAX_RETRIES = 3;
|
|
14
|
+
/** Initial delay for exponential backoff, in milliseconds. */
|
|
15
|
+
const INITIAL_RETRY_DELAY_MS = 500;
|
|
16
|
+
/** Maximum delay between retries, in milliseconds. */
|
|
17
|
+
const MAX_RETRY_DELAY_MS = 30_000;
|
|
18
|
+
/** HTTP status codes that are safe to retry. */
|
|
19
|
+
const RETRYABLE_STATUS_CODES = new Set([408, 429, 500, 502, 503, 504]);
|
|
20
|
+
/**
|
|
21
|
+
* Official client for the Gibs multi-regulation compliance API.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { GibsClient } from '@gibs/sdk';
|
|
26
|
+
*
|
|
27
|
+
* const client = new GibsClient({ apiKey: 'gbs_live_xxx' });
|
|
28
|
+
*
|
|
29
|
+
* const result = await client.classify({
|
|
30
|
+
* description: 'Facial recognition system for airport security',
|
|
31
|
+
* });
|
|
32
|
+
* console.log(result.risk_level);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export class GibsClient {
|
|
36
|
+
apiKey;
|
|
37
|
+
baseUrl;
|
|
38
|
+
timeout;
|
|
39
|
+
maxRetries;
|
|
40
|
+
constructor(options) {
|
|
41
|
+
if (!options.apiKey) {
|
|
42
|
+
throw new Error('API key is required. Get one at https://gibs.dev');
|
|
43
|
+
}
|
|
44
|
+
this.apiKey = options.apiKey;
|
|
45
|
+
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, '');
|
|
46
|
+
this.timeout = options.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
47
|
+
this.maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
48
|
+
}
|
|
49
|
+
// ==========================================================================
|
|
50
|
+
// Public API Methods
|
|
51
|
+
// ==========================================================================
|
|
52
|
+
/**
|
|
53
|
+
* Classify an AI system under EU AI Act risk levels.
|
|
54
|
+
*
|
|
55
|
+
* Returns the risk classification, relevant obligations,
|
|
56
|
+
* and source citations from the legal corpus.
|
|
57
|
+
*
|
|
58
|
+
* @param request - Description of the AI system to classify.
|
|
59
|
+
* @returns Classification result with risk level and obligations.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const result = await client.classify({
|
|
64
|
+
* description: 'CV screening tool that ranks job applicants',
|
|
65
|
+
* sector: 'employment',
|
|
66
|
+
* data_types: ['biometric'],
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* console.log(result.risk_level); // "high"
|
|
70
|
+
* console.log(result.obligations); // [{id: "risk_mgmt", ...}, ...]
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
async classify(request) {
|
|
74
|
+
return this._request('POST', '/v1/classify', request);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Ask a compliance question and get a grounded answer with citations.
|
|
78
|
+
*
|
|
79
|
+
* Every claim in the answer is traceable to a specific article
|
|
80
|
+
* in the legal corpus. If the corpus doesn't cover the question,
|
|
81
|
+
* the response indicates abstention with a reason.
|
|
82
|
+
*
|
|
83
|
+
* @param request - The compliance question and optional context.
|
|
84
|
+
* @returns Answer with source citations and confidence level.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* const answer = await client.check({
|
|
89
|
+
* question: 'What are the transparency requirements for chatbots under the AI Act?',
|
|
90
|
+
* regulation: 'ai_act',
|
|
91
|
+
* });
|
|
92
|
+
*
|
|
93
|
+
* console.log(answer.answer);
|
|
94
|
+
* console.log(answer.sources);
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
async check(request) {
|
|
98
|
+
return this._request('POST', '/v1/check', request);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Check API health and component status.
|
|
102
|
+
*
|
|
103
|
+
* Does not require authentication.
|
|
104
|
+
*
|
|
105
|
+
* @returns Health status with component details.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* const health = await client.health();
|
|
110
|
+
* console.log(health.status); // "healthy"
|
|
111
|
+
* console.log(health.components); // {api: "healthy", qdrant: "healthy", ...}
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
async health() {
|
|
115
|
+
return this._request('GET', '/v1/health');
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* List all active API keys for your organization.
|
|
119
|
+
*
|
|
120
|
+
* Returns metadata only -- never includes the full key value.
|
|
121
|
+
*
|
|
122
|
+
* @returns Array of key metadata.
|
|
123
|
+
*/
|
|
124
|
+
async listKeys() {
|
|
125
|
+
return this._request('GET', '/v1/account/keys');
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Create a new API key for your organization.
|
|
129
|
+
*
|
|
130
|
+
* The full key value is returned exactly once in the response.
|
|
131
|
+
* Store it securely -- it cannot be retrieved again.
|
|
132
|
+
*
|
|
133
|
+
* Maximum 5 active keys per organization.
|
|
134
|
+
*
|
|
135
|
+
* @param request - Optional name for the key.
|
|
136
|
+
* @returns The created key including the full key value (shown once).
|
|
137
|
+
*/
|
|
138
|
+
async createKey(request) {
|
|
139
|
+
return this._request('POST', '/v1/account/keys', request);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Revoke an API key.
|
|
143
|
+
*
|
|
144
|
+
* The key must belong to your organization. You cannot revoke
|
|
145
|
+
* the key that is currently being used for authentication.
|
|
146
|
+
*
|
|
147
|
+
* @param keyId - Database ID of the key to revoke.
|
|
148
|
+
* @returns Confirmation with status "revoked".
|
|
149
|
+
*/
|
|
150
|
+
async deleteKey(keyId) {
|
|
151
|
+
return this._request('DELETE', `/v1/account/keys/${keyId}`);
|
|
152
|
+
}
|
|
153
|
+
// ==========================================================================
|
|
154
|
+
// Internal HTTP Layer
|
|
155
|
+
// ==========================================================================
|
|
156
|
+
/**
|
|
157
|
+
* Execute an HTTP request with retries, timeout, and error handling.
|
|
158
|
+
*/
|
|
159
|
+
async _request(method, path, body) {
|
|
160
|
+
const url = `${this.baseUrl}${path}`;
|
|
161
|
+
const headers = {
|
|
162
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
163
|
+
'Content-Type': 'application/json',
|
|
164
|
+
'User-Agent': `gibs-sdk-js/${VERSION}`,
|
|
165
|
+
'Accept': 'application/json',
|
|
166
|
+
};
|
|
167
|
+
let lastError = null;
|
|
168
|
+
for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
|
|
169
|
+
// Wait before retrying (skip delay on first attempt)
|
|
170
|
+
if (attempt > 0) {
|
|
171
|
+
const delay = this._retryDelay(attempt, lastError);
|
|
172
|
+
await this._sleep(delay);
|
|
173
|
+
}
|
|
174
|
+
try {
|
|
175
|
+
const response = await this._fetchWithTimeout(url, {
|
|
176
|
+
method,
|
|
177
|
+
headers,
|
|
178
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
179
|
+
});
|
|
180
|
+
// Success -- parse and return
|
|
181
|
+
if (response.ok) {
|
|
182
|
+
return (await response.json());
|
|
183
|
+
}
|
|
184
|
+
// Parse error response
|
|
185
|
+
const responseHeaders = this._extractHeaders(response);
|
|
186
|
+
let errorMessage;
|
|
187
|
+
try {
|
|
188
|
+
const errorBody = await response.json();
|
|
189
|
+
errorMessage = errorBody.detail ?? `HTTP ${response.status}`;
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
errorMessage = `HTTP ${response.status}: ${response.statusText}`;
|
|
193
|
+
}
|
|
194
|
+
// Build the appropriate error
|
|
195
|
+
const error = this._buildError(response.status, errorMessage, responseHeaders);
|
|
196
|
+
// Don't retry non-retryable errors
|
|
197
|
+
if (!RETRYABLE_STATUS_CODES.has(response.status)) {
|
|
198
|
+
throw error;
|
|
199
|
+
}
|
|
200
|
+
lastError = error;
|
|
201
|
+
}
|
|
202
|
+
catch (err) {
|
|
203
|
+
// If it's already one of our errors (non-retryable), rethrow
|
|
204
|
+
if (err instanceof GibsAuthError) {
|
|
205
|
+
throw err;
|
|
206
|
+
}
|
|
207
|
+
if (err instanceof GibsAPIError && !RETRYABLE_STATUS_CODES.has(err.status)) {
|
|
208
|
+
throw err;
|
|
209
|
+
}
|
|
210
|
+
// Timeout
|
|
211
|
+
if (err instanceof GibsTimeoutError) {
|
|
212
|
+
lastError = err;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
// Network errors
|
|
216
|
+
if (this._isNetworkError(err)) {
|
|
217
|
+
lastError = new GibsConnectionError(`Connection failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
// Already a GibsError (retryable API error), keep retrying
|
|
221
|
+
if (err instanceof GibsAPIError) {
|
|
222
|
+
lastError = err;
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
// Unknown error -- don't retry
|
|
226
|
+
throw err;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// All retries exhausted
|
|
230
|
+
throw lastError ?? new GibsConnectionError('Request failed after all retries');
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Fetch with an AbortController-based timeout.
|
|
234
|
+
*/
|
|
235
|
+
async _fetchWithTimeout(url, init) {
|
|
236
|
+
const controller = new AbortController();
|
|
237
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
238
|
+
try {
|
|
239
|
+
const response = await fetch(url, {
|
|
240
|
+
...init,
|
|
241
|
+
signal: controller.signal,
|
|
242
|
+
});
|
|
243
|
+
return response;
|
|
244
|
+
}
|
|
245
|
+
catch (err) {
|
|
246
|
+
if (err instanceof DOMException && err.name === 'AbortError') {
|
|
247
|
+
throw new GibsTimeoutError(this.timeout);
|
|
248
|
+
}
|
|
249
|
+
// Node.js uses a different error type for abort
|
|
250
|
+
if (err instanceof Error && err.name === 'AbortError') {
|
|
251
|
+
throw new GibsTimeoutError(this.timeout);
|
|
252
|
+
}
|
|
253
|
+
throw err;
|
|
254
|
+
}
|
|
255
|
+
finally {
|
|
256
|
+
clearTimeout(timeoutId);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Build the correct error class for a given HTTP status code.
|
|
261
|
+
*/
|
|
262
|
+
_buildError(status, message, headers) {
|
|
263
|
+
switch (status) {
|
|
264
|
+
case 401:
|
|
265
|
+
return new GibsAuthError(message, headers);
|
|
266
|
+
case 429:
|
|
267
|
+
return new GibsRateLimitError(message, headers);
|
|
268
|
+
default:
|
|
269
|
+
return new GibsAPIError(message, status, headers);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Calculate retry delay with exponential backoff and jitter.
|
|
274
|
+
*
|
|
275
|
+
* For rate limit errors, respects the Retry-After header.
|
|
276
|
+
*/
|
|
277
|
+
_retryDelay(attempt, lastError) {
|
|
278
|
+
// Respect Retry-After header for rate limit errors
|
|
279
|
+
if (lastError instanceof GibsRateLimitError && lastError.retryAfter) {
|
|
280
|
+
return lastError.retryAfter * 1000;
|
|
281
|
+
}
|
|
282
|
+
// Exponential backoff: 500ms, 1000ms, 2000ms, ...
|
|
283
|
+
const exponentialDelay = INITIAL_RETRY_DELAY_MS * Math.pow(2, attempt - 1);
|
|
284
|
+
// Add jitter (0-25% of the delay)
|
|
285
|
+
const jitter = exponentialDelay * 0.25 * Math.random();
|
|
286
|
+
return Math.min(exponentialDelay + jitter, MAX_RETRY_DELAY_MS);
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Extract response headers into a plain object.
|
|
290
|
+
*/
|
|
291
|
+
_extractHeaders(response) {
|
|
292
|
+
const headers = {};
|
|
293
|
+
response.headers.forEach((value, key) => {
|
|
294
|
+
headers[key.toLowerCase()] = value;
|
|
295
|
+
});
|
|
296
|
+
return headers;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Check if an error is a network-level error (no HTTP response received).
|
|
300
|
+
*/
|
|
301
|
+
_isNetworkError(err) {
|
|
302
|
+
if (!(err instanceof Error))
|
|
303
|
+
return false;
|
|
304
|
+
// Common network error indicators
|
|
305
|
+
const networkMessages = [
|
|
306
|
+
'fetch failed',
|
|
307
|
+
'network',
|
|
308
|
+
'ECONNREFUSED',
|
|
309
|
+
'ECONNRESET',
|
|
310
|
+
'ENOTFOUND',
|
|
311
|
+
'ETIMEDOUT',
|
|
312
|
+
'EAI_AGAIN',
|
|
313
|
+
];
|
|
314
|
+
const msg = err.message.toLowerCase();
|
|
315
|
+
return networkMessages.some((indicator) => msg.includes(indicator.toLowerCase()));
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Sleep for a given number of milliseconds.
|
|
319
|
+
*/
|
|
320
|
+
_sleep(ms) {
|
|
321
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAcrB,MAAM,OAAO,GAAG,OAAO,CAAC;AACxB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