@aiassesstech/sdk 0.7.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 +29 -0
- package/README.md +350 -0
- package/dist/__tests__/__mocks__/node-fetch.d.ts +6 -0
- package/dist/__tests__/__mocks__/node-fetch.js +7 -0
- package/dist/__tests__/setup.d.ts +3 -0
- package/dist/__tests__/setup.js +13 -0
- package/dist/api.d.ts +55 -0
- package/dist/api.js +78 -0
- package/dist/cli.d.ts +28 -0
- package/dist/cli.js +182 -0
- package/dist/client.d.ts +146 -0
- package/dist/client.js +393 -0
- package/dist/environment.d.ts +18 -0
- package/dist/environment.js +137 -0
- package/dist/errors.d.ts +87 -0
- package/dist/errors.js +140 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +39 -0
- package/dist/types.d.ts +317 -0
- package/dist/types.js +9 -0
- package/package.json +62 -0
package/dist/errors.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AI Assess Tech SDK - Error Classes
|
|
4
|
+
*
|
|
5
|
+
* Custom error types for better error handling
|
|
6
|
+
*
|
|
7
|
+
* @version 0.7.0
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AuthenticationError = exports.HealthCheckError = exports.RateLimitError = exports.NetworkError = exports.OverallTimeoutError = exports.QuestionTimeoutError = exports.AssessmentError = exports.ValidationError = exports.SDKError = exports.ErrorCode = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* Error codes for SDK errors
|
|
13
|
+
*/
|
|
14
|
+
var ErrorCode;
|
|
15
|
+
(function (ErrorCode) {
|
|
16
|
+
// Authentication
|
|
17
|
+
ErrorCode["INVALID_KEY"] = "INVALID_KEY";
|
|
18
|
+
ErrorCode["KEY_EXPIRED"] = "KEY_EXPIRED";
|
|
19
|
+
ErrorCode["KEY_REVOKED"] = "KEY_REVOKED";
|
|
20
|
+
ErrorCode["MISSING_KEY"] = "MISSING_KEY";
|
|
21
|
+
// Rate Limiting
|
|
22
|
+
ErrorCode["RATE_LIMITED"] = "RATE_LIMITED";
|
|
23
|
+
ErrorCode["QUOTA_EXCEEDED"] = "QUOTA_EXCEEDED";
|
|
24
|
+
// Validation
|
|
25
|
+
ErrorCode["INVALID_RESPONSE"] = "INVALID_RESPONSE";
|
|
26
|
+
ErrorCode["INVALID_BODY"] = "INVALID_BODY";
|
|
27
|
+
// Timeout
|
|
28
|
+
ErrorCode["QUESTION_TIMEOUT"] = "QUESTION_TIMEOUT";
|
|
29
|
+
ErrorCode["OVERALL_TIMEOUT"] = "OVERALL_TIMEOUT";
|
|
30
|
+
// Assessment
|
|
31
|
+
ErrorCode["QUESTION_FAILED"] = "QUESTION_FAILED";
|
|
32
|
+
ErrorCode["ASSESSMENT_FAILED"] = "ASSESSMENT_FAILED";
|
|
33
|
+
// Network
|
|
34
|
+
ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
|
|
35
|
+
ErrorCode["SERVER_ERROR"] = "SERVER_ERROR";
|
|
36
|
+
})(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
|
|
37
|
+
/**
|
|
38
|
+
* Base SDK error class
|
|
39
|
+
*/
|
|
40
|
+
class SDKError extends Error {
|
|
41
|
+
constructor(message, code, details) {
|
|
42
|
+
super(message);
|
|
43
|
+
this.code = code;
|
|
44
|
+
this.details = details;
|
|
45
|
+
this.name = "SDKError";
|
|
46
|
+
// Maintains proper stack trace for where error was thrown (Node.js)
|
|
47
|
+
if (Error.captureStackTrace) {
|
|
48
|
+
Error.captureStackTrace(this, this.constructor);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.SDKError = SDKError;
|
|
53
|
+
/**
|
|
54
|
+
* Error for validation issues (invalid key, invalid response, etc.)
|
|
55
|
+
*/
|
|
56
|
+
class ValidationError extends SDKError {
|
|
57
|
+
constructor(message, code = ErrorCode.INVALID_RESPONSE) {
|
|
58
|
+
super(message, code);
|
|
59
|
+
this.name = "ValidationError";
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.ValidationError = ValidationError;
|
|
63
|
+
/**
|
|
64
|
+
* Error for assessment failures
|
|
65
|
+
*/
|
|
66
|
+
class AssessmentError extends SDKError {
|
|
67
|
+
constructor(message, code, details) {
|
|
68
|
+
super(message, code, details);
|
|
69
|
+
this.name = "AssessmentError";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.AssessmentError = AssessmentError;
|
|
73
|
+
/**
|
|
74
|
+
* Error for individual question timeout
|
|
75
|
+
*/
|
|
76
|
+
class QuestionTimeoutError extends SDKError {
|
|
77
|
+
constructor(message, questionId) {
|
|
78
|
+
super(message, ErrorCode.QUESTION_TIMEOUT, { questionId });
|
|
79
|
+
this.questionId = questionId;
|
|
80
|
+
this.name = "QuestionTimeoutError";
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.QuestionTimeoutError = QuestionTimeoutError;
|
|
84
|
+
/**
|
|
85
|
+
* Error for overall assessment timeout
|
|
86
|
+
*/
|
|
87
|
+
class OverallTimeoutError extends SDKError {
|
|
88
|
+
constructor(message, details) {
|
|
89
|
+
super(message, ErrorCode.OVERALL_TIMEOUT, details);
|
|
90
|
+
this.name = "OverallTimeoutError";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.OverallTimeoutError = OverallTimeoutError;
|
|
94
|
+
/**
|
|
95
|
+
* Error for network issues
|
|
96
|
+
*/
|
|
97
|
+
class NetworkError extends SDKError {
|
|
98
|
+
constructor(message, statusCode) {
|
|
99
|
+
super(message, ErrorCode.NETWORK_ERROR, { statusCode });
|
|
100
|
+
this.statusCode = statusCode;
|
|
101
|
+
this.name = "NetworkError";
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.NetworkError = NetworkError;
|
|
105
|
+
/**
|
|
106
|
+
* Error for rate limiting
|
|
107
|
+
*/
|
|
108
|
+
class RateLimitError extends SDKError {
|
|
109
|
+
constructor(message, retryAfterMs) {
|
|
110
|
+
super(message, ErrorCode.RATE_LIMITED, { retryAfterMs });
|
|
111
|
+
this.retryAfterMs = retryAfterMs;
|
|
112
|
+
this.name = "RateLimitError";
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.RateLimitError = RateLimitError;
|
|
116
|
+
// ============================================
|
|
117
|
+
// Legacy error classes for backward compatibility
|
|
118
|
+
// ============================================
|
|
119
|
+
/**
|
|
120
|
+
* @deprecated Use SDKError instead
|
|
121
|
+
*/
|
|
122
|
+
class HealthCheckError extends Error {
|
|
123
|
+
constructor(message, statusCode, details) {
|
|
124
|
+
super(message);
|
|
125
|
+
this.statusCode = statusCode;
|
|
126
|
+
this.details = details;
|
|
127
|
+
this.name = "HealthCheckError";
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.HealthCheckError = HealthCheckError;
|
|
131
|
+
/**
|
|
132
|
+
* @deprecated Use ValidationError with ErrorCode.INVALID_KEY instead
|
|
133
|
+
*/
|
|
134
|
+
class AuthenticationError extends HealthCheckError {
|
|
135
|
+
constructor(message = "Invalid API key") {
|
|
136
|
+
super(message, 401);
|
|
137
|
+
this.name = "AuthenticationError";
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.AuthenticationError = AuthenticationError;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Assess Tech SDK for TypeScript
|
|
3
|
+
*
|
|
4
|
+
* Assess AI systems for ethical alignment across 4 dimensions:
|
|
5
|
+
* Lying, Cheating, Stealing, and Harm.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
* @version 0.7.0
|
|
9
|
+
*/
|
|
10
|
+
export { AIAssessClient, withRetry, HealthCheckClient } from "./client";
|
|
11
|
+
export type { ClientConfig, AICallback, AssessOptions, BlockUntilPassOptions, AssessProgress, AssessmentResult, AssessmentArray, ServerConfig, ClientEnvironment, HealthCheckConfig, TestConfig, TargetAI, Framework, FrameworkAxis, TestStatus, TestResult, VerificationResult, TestSummary, HistoryResponse, HistoryFilters, } from "./types";
|
|
12
|
+
export { SDKError, ValidationError, AssessmentError, QuestionTimeoutError, OverallTimeoutError, NetworkError, RateLimitError, ErrorCode, HealthCheckError, AuthenticationError, } from "./errors";
|
|
13
|
+
export { detectEnvironment, isCI } from "./environment";
|
|
14
|
+
export { fetchConfig, submitResponses } from "./api";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AI Assess Tech SDK for TypeScript
|
|
4
|
+
*
|
|
5
|
+
* Assess AI systems for ethical alignment across 4 dimensions:
|
|
6
|
+
* Lying, Cheating, Stealing, and Harm.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
* @version 0.7.0
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.submitResponses = exports.fetchConfig = exports.isCI = exports.detectEnvironment = exports.AuthenticationError = exports.HealthCheckError = exports.ErrorCode = exports.RateLimitError = exports.NetworkError = exports.OverallTimeoutError = exports.QuestionTimeoutError = exports.AssessmentError = exports.ValidationError = exports.SDKError = exports.HealthCheckClient = exports.withRetry = exports.AIAssessClient = void 0;
|
|
13
|
+
// Main client
|
|
14
|
+
var client_1 = require("./client");
|
|
15
|
+
Object.defineProperty(exports, "AIAssessClient", { enumerable: true, get: function () { return client_1.AIAssessClient; } });
|
|
16
|
+
Object.defineProperty(exports, "withRetry", { enumerable: true, get: function () { return client_1.withRetry; } });
|
|
17
|
+
Object.defineProperty(exports, "HealthCheckClient", { enumerable: true, get: function () { return client_1.HealthCheckClient; } });
|
|
18
|
+
// Errors
|
|
19
|
+
var errors_1 = require("./errors");
|
|
20
|
+
// v0.7.0 errors
|
|
21
|
+
Object.defineProperty(exports, "SDKError", { enumerable: true, get: function () { return errors_1.SDKError; } });
|
|
22
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return errors_1.ValidationError; } });
|
|
23
|
+
Object.defineProperty(exports, "AssessmentError", { enumerable: true, get: function () { return errors_1.AssessmentError; } });
|
|
24
|
+
Object.defineProperty(exports, "QuestionTimeoutError", { enumerable: true, get: function () { return errors_1.QuestionTimeoutError; } });
|
|
25
|
+
Object.defineProperty(exports, "OverallTimeoutError", { enumerable: true, get: function () { return errors_1.OverallTimeoutError; } });
|
|
26
|
+
Object.defineProperty(exports, "NetworkError", { enumerable: true, get: function () { return errors_1.NetworkError; } });
|
|
27
|
+
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return errors_1.RateLimitError; } });
|
|
28
|
+
Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function () { return errors_1.ErrorCode; } });
|
|
29
|
+
// Legacy errors (deprecated)
|
|
30
|
+
Object.defineProperty(exports, "HealthCheckError", { enumerable: true, get: function () { return errors_1.HealthCheckError; } });
|
|
31
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return errors_1.AuthenticationError; } });
|
|
32
|
+
// Environment detection
|
|
33
|
+
var environment_1 = require("./environment");
|
|
34
|
+
Object.defineProperty(exports, "detectEnvironment", { enumerable: true, get: function () { return environment_1.detectEnvironment; } });
|
|
35
|
+
Object.defineProperty(exports, "isCI", { enumerable: true, get: function () { return environment_1.isCI; } });
|
|
36
|
+
// API functions (for advanced usage)
|
|
37
|
+
var api_1 = require("./api");
|
|
38
|
+
Object.defineProperty(exports, "fetchConfig", { enumerable: true, get: function () { return api_1.fetchConfig; } });
|
|
39
|
+
Object.defineProperty(exports, "submitResponses", { enumerable: true, get: function () { return api_1.submitResponses; } });
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Assess Tech SDK - TypeScript Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Type-safe interfaces for the SDK
|
|
5
|
+
*
|
|
6
|
+
* @version 0.7.0
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Configuration for the AI Assess Tech client
|
|
10
|
+
*/
|
|
11
|
+
export interface ClientConfig {
|
|
12
|
+
/** Health Check Key (format: hck_...) */
|
|
13
|
+
healthCheckKey: string;
|
|
14
|
+
/** Base URL override (default: https://www.aiassesstech.com) */
|
|
15
|
+
baseUrl?: string;
|
|
16
|
+
/** Per-question timeout in milliseconds (default: 30000 = 30s) */
|
|
17
|
+
perQuestionTimeoutMs?: number;
|
|
18
|
+
/** Overall assessment timeout in milliseconds (default: 360000 = 6 min) */
|
|
19
|
+
overallTimeoutMs?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Callback function type that the developer implements
|
|
23
|
+
* v0.7.0: Simple single-question callback
|
|
24
|
+
*/
|
|
25
|
+
export type AICallback = (question: string) => Promise<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Options for the assessment
|
|
28
|
+
* NOTE: Test mode, framework, thresholds are SERVER-CONTROLLED via Health Check Key
|
|
29
|
+
*/
|
|
30
|
+
export interface AssessOptions {
|
|
31
|
+
/** Callback for progress updates */
|
|
32
|
+
onProgress?: (progress: AssessProgress) => void;
|
|
33
|
+
/** Optional metadata to store with the assessment */
|
|
34
|
+
metadata?: Record<string, unknown>;
|
|
35
|
+
/** Dry run mode - only 5 questions, returns mock scores */
|
|
36
|
+
dryRun?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Options for blocking startup mode
|
|
40
|
+
*/
|
|
41
|
+
export interface BlockUntilPassOptions extends AssessOptions {
|
|
42
|
+
/** Maximum retry attempts (default: 3) */
|
|
43
|
+
maxRetries?: number;
|
|
44
|
+
/** Delay between retries in milliseconds (default: 60000 = 1 min) */
|
|
45
|
+
retryDelayMs?: number;
|
|
46
|
+
/** Exit process on failure (default: false) */
|
|
47
|
+
exitOnFailure?: boolean;
|
|
48
|
+
/** Callback on each failed attempt */
|
|
49
|
+
onFailure?: (result: AssessmentResult, attempt: number) => void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Progress update during assessment
|
|
53
|
+
*/
|
|
54
|
+
export interface AssessProgress {
|
|
55
|
+
/** Current question number (1-120) */
|
|
56
|
+
current: number;
|
|
57
|
+
/** Total questions */
|
|
58
|
+
total: number;
|
|
59
|
+
/** Percentage complete (0-100) */
|
|
60
|
+
percentage: number;
|
|
61
|
+
/** Current dimension being tested */
|
|
62
|
+
dimension: "Lying" | "Cheating" | "Stealing" | "Harm";
|
|
63
|
+
/** Elapsed time in milliseconds */
|
|
64
|
+
elapsedMs: number;
|
|
65
|
+
/** Estimated time remaining in milliseconds */
|
|
66
|
+
estimatedRemainingMs: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Auto-detected client environment
|
|
70
|
+
*/
|
|
71
|
+
export interface ClientEnvironment {
|
|
72
|
+
nodeVersion?: string;
|
|
73
|
+
platform?: "linux" | "darwin" | "win32";
|
|
74
|
+
arch?: "x64" | "arm64" | "arm";
|
|
75
|
+
ciProvider?: string;
|
|
76
|
+
ciJobId?: string;
|
|
77
|
+
gitCommit?: string;
|
|
78
|
+
gitBranch?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Configuration returned by GET /api/sdk/config
|
|
82
|
+
* Determined by the Health Check Key
|
|
83
|
+
*/
|
|
84
|
+
export interface ServerConfig {
|
|
85
|
+
/** Test mode (determined by key configuration) */
|
|
86
|
+
testMode: "ISOLATED" | "CONVERSATIONAL" | "SDK";
|
|
87
|
+
/** Framework ID */
|
|
88
|
+
frameworkId: string;
|
|
89
|
+
/** Question set version for traceability */
|
|
90
|
+
questionSetVersion: string;
|
|
91
|
+
/** Pass thresholds per dimension */
|
|
92
|
+
thresholds: {
|
|
93
|
+
lying: number;
|
|
94
|
+
cheating: number;
|
|
95
|
+
stealing: number;
|
|
96
|
+
harm: number;
|
|
97
|
+
};
|
|
98
|
+
/** Questions to ask (fetched, not bundled) */
|
|
99
|
+
questions: Array<{
|
|
100
|
+
id: string;
|
|
101
|
+
text: string;
|
|
102
|
+
dimension: "Lying" | "Cheating" | "Stealing" | "Harm";
|
|
103
|
+
answers: [string, string, string, string];
|
|
104
|
+
}>;
|
|
105
|
+
/** Key metadata */
|
|
106
|
+
keyName: string;
|
|
107
|
+
organizationName: string;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Assessment result with 8 data points + traceability
|
|
111
|
+
*/
|
|
112
|
+
export interface AssessmentResult {
|
|
113
|
+
/** Server-generated Run ID for verification/history lookup */
|
|
114
|
+
runId: string;
|
|
115
|
+
/** Client-generated SDK Session ID for traceability */
|
|
116
|
+
sdkSessionId: string;
|
|
117
|
+
/** Scores for each dimension (0-10 scale, higher = more ethical) */
|
|
118
|
+
scores: {
|
|
119
|
+
lying: number;
|
|
120
|
+
cheating: number;
|
|
121
|
+
stealing: number;
|
|
122
|
+
harm: number;
|
|
123
|
+
};
|
|
124
|
+
/** Pass/fail for each dimension */
|
|
125
|
+
passed: {
|
|
126
|
+
lying: boolean;
|
|
127
|
+
cheating: boolean;
|
|
128
|
+
stealing: boolean;
|
|
129
|
+
harm: boolean;
|
|
130
|
+
};
|
|
131
|
+
/** Overall pass (all dimensions must pass) */
|
|
132
|
+
overallPassed: boolean;
|
|
133
|
+
/** Thresholds used (from server configuration) */
|
|
134
|
+
thresholds: {
|
|
135
|
+
lying: number;
|
|
136
|
+
cheating: number;
|
|
137
|
+
stealing: number;
|
|
138
|
+
harm: number;
|
|
139
|
+
};
|
|
140
|
+
/** Classification label */
|
|
141
|
+
classification: "Well Adjusted" | "Misguided" | "Manipulative" | "Psychopath";
|
|
142
|
+
/** Verification URL */
|
|
143
|
+
verifyUrl: string;
|
|
144
|
+
/** Timestamp */
|
|
145
|
+
completedAt: string;
|
|
146
|
+
/** Version information */
|
|
147
|
+
versions: {
|
|
148
|
+
sdkVersion: string;
|
|
149
|
+
questionSetVersion: string;
|
|
150
|
+
};
|
|
151
|
+
/** Key that was used */
|
|
152
|
+
keyName: string;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Simplified array format
|
|
156
|
+
* [LyingScore, CheatingScore, StealingScore, HarmScore,
|
|
157
|
+
* LyingPassed, CheatingPassed, StealingPassed, HarmPassed]
|
|
158
|
+
*/
|
|
159
|
+
export type AssessmentArray = [
|
|
160
|
+
number,
|
|
161
|
+
number,
|
|
162
|
+
number,
|
|
163
|
+
number,
|
|
164
|
+
boolean,
|
|
165
|
+
boolean,
|
|
166
|
+
boolean,
|
|
167
|
+
boolean
|
|
168
|
+
];
|
|
169
|
+
/**
|
|
170
|
+
* @deprecated Use ClientConfig instead
|
|
171
|
+
*/
|
|
172
|
+
export interface HealthCheckConfig {
|
|
173
|
+
apiKey: string;
|
|
174
|
+
baseUrl?: string;
|
|
175
|
+
timeout?: number;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* @deprecated Use AICallback instead
|
|
179
|
+
*/
|
|
180
|
+
export interface TargetAI {
|
|
181
|
+
provider: "anthropic" | "openai" | "custom";
|
|
182
|
+
model: string;
|
|
183
|
+
apiKey: string;
|
|
184
|
+
endpoint?: string;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* @deprecated Use AssessOptions instead
|
|
188
|
+
*/
|
|
189
|
+
export interface TestConfig {
|
|
190
|
+
targetAi: TargetAI;
|
|
191
|
+
frameworkId?: string;
|
|
192
|
+
metadata?: Record<string, unknown>;
|
|
193
|
+
webhookUrl?: string;
|
|
194
|
+
notificationEmail?: string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* @deprecated Use ServerConfig.questions instead
|
|
198
|
+
*/
|
|
199
|
+
export interface Framework {
|
|
200
|
+
id: string;
|
|
201
|
+
name: string;
|
|
202
|
+
version: string;
|
|
203
|
+
description: string;
|
|
204
|
+
axes: FrameworkAxis[];
|
|
205
|
+
active: boolean;
|
|
206
|
+
createdAt: string;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* @deprecated Use ServerConfig.questions instead
|
|
210
|
+
*/
|
|
211
|
+
export interface FrameworkAxis {
|
|
212
|
+
id: string;
|
|
213
|
+
name: string;
|
|
214
|
+
description: string;
|
|
215
|
+
sortOrder: number;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* @deprecated Use AssessmentResult instead
|
|
219
|
+
*/
|
|
220
|
+
export interface TestStatus {
|
|
221
|
+
runId: string;
|
|
222
|
+
status: "queued" | "running" | "completed" | "failed";
|
|
223
|
+
progress?: {
|
|
224
|
+
current: number;
|
|
225
|
+
total: number;
|
|
226
|
+
percentage: number;
|
|
227
|
+
};
|
|
228
|
+
startedAt: string;
|
|
229
|
+
completedAt?: string;
|
|
230
|
+
errorMessage?: string;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* @deprecated Use AssessmentResult instead
|
|
234
|
+
*/
|
|
235
|
+
export interface TestResult {
|
|
236
|
+
runId: string;
|
|
237
|
+
organizationId: string;
|
|
238
|
+
framework: {
|
|
239
|
+
id: string;
|
|
240
|
+
name: string;
|
|
241
|
+
version: string;
|
|
242
|
+
};
|
|
243
|
+
targetAi: {
|
|
244
|
+
provider: string;
|
|
245
|
+
model: string;
|
|
246
|
+
};
|
|
247
|
+
scores: {
|
|
248
|
+
[axisName: string]: number;
|
|
249
|
+
};
|
|
250
|
+
classification: string;
|
|
251
|
+
passed: boolean;
|
|
252
|
+
threshold: number;
|
|
253
|
+
metadata?: Record<string, unknown>;
|
|
254
|
+
verification: {
|
|
255
|
+
resultHash: string;
|
|
256
|
+
responsesHash: string;
|
|
257
|
+
verifyUrl: string;
|
|
258
|
+
};
|
|
259
|
+
startedAt: string;
|
|
260
|
+
completedAt: string;
|
|
261
|
+
locked: boolean;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* @deprecated
|
|
265
|
+
*/
|
|
266
|
+
export interface VerificationResult {
|
|
267
|
+
runId: string;
|
|
268
|
+
verified: boolean;
|
|
269
|
+
resultHash: string;
|
|
270
|
+
responsesHash: string;
|
|
271
|
+
calculatedResultHash: string;
|
|
272
|
+
calculatedResponsesHash: string;
|
|
273
|
+
message: string;
|
|
274
|
+
verifiedAt: string;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* @deprecated
|
|
278
|
+
*/
|
|
279
|
+
export interface TestSummary {
|
|
280
|
+
runId: string;
|
|
281
|
+
frameworkId: string;
|
|
282
|
+
frameworkName: string;
|
|
283
|
+
targetAiProvider: string;
|
|
284
|
+
targetAiModel: string;
|
|
285
|
+
status: "queued" | "running" | "completed" | "failed";
|
|
286
|
+
passed?: boolean;
|
|
287
|
+
classification?: string;
|
|
288
|
+
startedAt: string;
|
|
289
|
+
completedAt?: string;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* @deprecated
|
|
293
|
+
*/
|
|
294
|
+
export interface HistoryResponse {
|
|
295
|
+
tests: TestSummary[];
|
|
296
|
+
pagination: {
|
|
297
|
+
page: number;
|
|
298
|
+
pageSize: number;
|
|
299
|
+
totalTests: number;
|
|
300
|
+
totalPages: number;
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* @deprecated
|
|
305
|
+
*/
|
|
306
|
+
export interface HistoryFilters {
|
|
307
|
+
frameworkId?: string;
|
|
308
|
+
provider?: string;
|
|
309
|
+
status?: "queued" | "running" | "completed" | "failed";
|
|
310
|
+
passed?: boolean;
|
|
311
|
+
startDate?: Date | string;
|
|
312
|
+
endDate?: Date | string;
|
|
313
|
+
page?: number;
|
|
314
|
+
pageSize?: number;
|
|
315
|
+
sortBy?: "startedAt" | "completedAt";
|
|
316
|
+
sortOrder?: "asc" | "desc";
|
|
317
|
+
}
|
package/dist/types.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aiassesstech/sdk",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "AI Assess Tech SDK for ethical AI assessment - Test AI systems across 4 dimensions: Lying, Cheating, Stealing, and Harm",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"test": "jest",
|
|
10
|
+
"test:watch": "jest --watch",
|
|
11
|
+
"test:e2e": "jest --config e2e/jest.e2e.config.js",
|
|
12
|
+
"test:all": "npm run test && npm run test:e2e",
|
|
13
|
+
"lint": "eslint src --ext .ts",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"ai",
|
|
18
|
+
"ethics",
|
|
19
|
+
"assessment",
|
|
20
|
+
"sdk",
|
|
21
|
+
"ai-safety",
|
|
22
|
+
"testing",
|
|
23
|
+
"4d-framework",
|
|
24
|
+
"lying",
|
|
25
|
+
"cheating",
|
|
26
|
+
"stealing",
|
|
27
|
+
"harm",
|
|
28
|
+
"ethical-ai",
|
|
29
|
+
"responsible-ai"
|
|
30
|
+
],
|
|
31
|
+
"author": "AI Assess Tech",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/aiassesstech/sdk-ts.git"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://www.aiassesstech.com/docs",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/aiassesstech/sdk-ts/issues"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"dist",
|
|
43
|
+
"README.md",
|
|
44
|
+
"LICENSE"
|
|
45
|
+
],
|
|
46
|
+
"dependencies": {},
|
|
47
|
+
"peerDependencies": {},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@jest/test-sequencer": "^29.7.0",
|
|
50
|
+
"@types/jest": "^29.5.11",
|
|
51
|
+
"@types/node": "^20.10.6",
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^6.17.0",
|
|
53
|
+
"@typescript-eslint/parser": "^6.17.0",
|
|
54
|
+
"eslint": "^8.56.0",
|
|
55
|
+
"jest": "^29.7.0",
|
|
56
|
+
"ts-jest": "^29.1.1",
|
|
57
|
+
"typescript": "^5.3.3"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=18.0.0"
|
|
61
|
+
}
|
|
62
|
+
}
|