@chanl/eval-sdk 0.4.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/dist/client.d.ts +75 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +124 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +32 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +51 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/chat.d.ts +32 -0
- package/dist/modules/chat.d.ts.map +1 -0
- package/dist/modules/chat.js +41 -0
- package/dist/modules/chat.js.map +1 -0
- package/dist/modules/datasets.d.ts +114 -0
- package/dist/modules/datasets.d.ts.map +1 -0
- package/dist/modules/datasets.js +93 -0
- package/dist/modules/datasets.js.map +1 -0
- package/dist/modules/executions.d.ts +54 -0
- package/dist/modules/executions.d.ts.map +1 -0
- package/dist/modules/executions.js +119 -0
- package/dist/modules/executions.js.map +1 -0
- package/dist/modules/generation.d.ts +82 -0
- package/dist/modules/generation.d.ts.map +1 -0
- package/dist/modules/generation.js +32 -0
- package/dist/modules/generation.js.map +1 -0
- package/dist/modules/personas.d.ts +43 -0
- package/dist/modules/personas.d.ts.map +1 -0
- package/dist/modules/personas.js +98 -0
- package/dist/modules/personas.js.map +1 -0
- package/dist/modules/prompts.d.ts +17 -0
- package/dist/modules/prompts.d.ts.map +1 -0
- package/dist/modules/prompts.js +48 -0
- package/dist/modules/prompts.js.map +1 -0
- package/dist/modules/scenarios.d.ts +47 -0
- package/dist/modules/scenarios.d.ts.map +1 -0
- package/dist/modules/scenarios.js +100 -0
- package/dist/modules/scenarios.js.map +1 -0
- package/dist/modules/scorecards.d.ts +83 -0
- package/dist/modules/scorecards.d.ts.map +1 -0
- package/dist/modules/scorecards.js +154 -0
- package/dist/modules/scorecards.js.map +1 -0
- package/dist/modules/settings.d.ts +13 -0
- package/dist/modules/settings.d.ts.map +1 -0
- package/dist/modules/settings.js +29 -0
- package/dist/modules/settings.js.map +1 -0
- package/dist/modules/tool-fixtures.d.ts +39 -0
- package/dist/modules/tool-fixtures.d.ts.map +1 -0
- package/dist/modules/tool-fixtures.js +77 -0
- package/dist/modules/tool-fixtures.js.map +1 -0
- package/dist/types.d.ts +583 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/package.json +30 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Datasets Module
|
|
4
|
+
*
|
|
5
|
+
* SDK module for generating and exporting training datasets from conversation executions.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.DatasetsModule = void 0;
|
|
9
|
+
const client_1 = require("../client");
|
|
10
|
+
class DatasetsModule {
|
|
11
|
+
constructor(http) {
|
|
12
|
+
this.http = http;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* List all dataset batches with aggregated stats.
|
|
16
|
+
*/
|
|
17
|
+
async list() {
|
|
18
|
+
const response = await this.http.get('/datasets');
|
|
19
|
+
return (0, client_1.unwrapResponse)(response);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get paginated conversations within a batch.
|
|
23
|
+
*/
|
|
24
|
+
async conversations(batchId, pagination) {
|
|
25
|
+
const params = {};
|
|
26
|
+
if (pagination?.page)
|
|
27
|
+
params.page = pagination.page;
|
|
28
|
+
if (pagination?.limit)
|
|
29
|
+
params.limit = pagination.limit;
|
|
30
|
+
const response = await this.http.get(`/datasets/${batchId}/conversations`, { params });
|
|
31
|
+
return (0, client_1.unwrapResponse)(response);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Generate a batch of conversations for dataset creation.
|
|
35
|
+
*/
|
|
36
|
+
async generate(options) {
|
|
37
|
+
const response = await this.http.post('/datasets/generate', options);
|
|
38
|
+
return (0, client_1.unwrapResponse)(response);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get the status of a batch generation run.
|
|
42
|
+
*/
|
|
43
|
+
async generationStatus(batchId) {
|
|
44
|
+
const response = await this.http.get(`/datasets/generate/${batchId}/status`);
|
|
45
|
+
return (0, client_1.unwrapResponse)(response);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Wait for a batch generation to complete.
|
|
49
|
+
*/
|
|
50
|
+
async waitForBatch(batchId, options) {
|
|
51
|
+
const interval = options?.pollIntervalMs ?? 3000;
|
|
52
|
+
const timeout = options?.timeoutMs ?? 600_000; // 10 minutes
|
|
53
|
+
const deadline = Date.now() + timeout;
|
|
54
|
+
while (Date.now() < deadline) {
|
|
55
|
+
const status = await this.generationStatus(batchId);
|
|
56
|
+
if (status.status !== 'running')
|
|
57
|
+
return status;
|
|
58
|
+
await new Promise((r) => setTimeout(r, interval));
|
|
59
|
+
}
|
|
60
|
+
throw new Error(`Batch ${batchId} timed out after ${timeout}ms`);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Export executions as a training data file (returns raw response for streaming).
|
|
64
|
+
*/
|
|
65
|
+
async export(options) {
|
|
66
|
+
const response = await this.http.post('/datasets/export', options, {
|
|
67
|
+
responseType: 'text',
|
|
68
|
+
});
|
|
69
|
+
return response.data;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Preview what an export would contain without downloading.
|
|
73
|
+
*/
|
|
74
|
+
async preview(format, filters) {
|
|
75
|
+
const params = {};
|
|
76
|
+
if (format)
|
|
77
|
+
params.format = format;
|
|
78
|
+
if (filters?.scenarioIds?.length)
|
|
79
|
+
params.scenarioIds = filters.scenarioIds.join(',');
|
|
80
|
+
if (filters?.personaIds?.length)
|
|
81
|
+
params.personaIds = filters.personaIds.join(',');
|
|
82
|
+
if (filters?.minScore !== undefined)
|
|
83
|
+
params.minScore = filters.minScore;
|
|
84
|
+
if (filters?.status)
|
|
85
|
+
params.status = filters.status;
|
|
86
|
+
if (filters?.batchId)
|
|
87
|
+
params.batchId = filters.batchId;
|
|
88
|
+
const response = await this.http.get('/datasets/export/preview', { params });
|
|
89
|
+
return (0, client_1.unwrapResponse)(response);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.DatasetsModule = DatasetsModule;
|
|
93
|
+
//# sourceMappingURL=datasets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasets.js","sourceRoot":"","sources":["../../src/modules/datasets.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,sCAA2C;AA+E3C,MAAa,cAAc;IACzB,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAClD,OAAO,IAAA,uBAAc,EAAiB,QAAQ,CAAC,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CACjB,OAAe,EACf,UAA8C;QAE9C,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,IAAI,UAAU,EAAE,IAAI;YAAE,MAAM,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QACpD,IAAI,UAAU,EAAE,KAAK;YAAE,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QACvD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,OAAO,gBAAgB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACvF,OAAO,IAAA,uBAAc,EAA6B,QAAQ,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,OAA+B;QAC5C,MAAM,QAAQ,GAAG,MAA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C,IAAc,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CACX,MAAe,EACf,OAAyC;QAEzC,MAAM,MAAM,GAAoC,EAAE,CAAC;QACnD,IAAI,MAAM;YAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QACnC,IAAI,OAAO,EAAE,WAAW,EAAE,MAAM;YAAE,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrF,IAAI,OAAO,EAAE,UAAU,EAAE,MAAM;YAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClF,IAAI,OAAO,EAAE,QAAQ,KAAK,SAAS;YAAE,MAAM,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACxE,IAAI,OAAO,EAAE,MAAM;YAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QACpD,IAAI,OAAO,EAAE,OAAO;YAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAEvD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,0BAA0B,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAC7E,OAAO,IAAA,uBAAc,EAAwB,QAAQ,CAAC,CAAC;IACzD,CAAC;CACF;AAzFD,wCAyFC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executions Module
|
|
3
|
+
*
|
|
4
|
+
* SDK module for managing scenario executions.
|
|
5
|
+
*/
|
|
6
|
+
import type { AxiosInstance } from 'axios';
|
|
7
|
+
import type { Execution, ListExecutionsParams, ListExecutionsResponse, WaitForCompletionOptions, EvaluateExecutionRequest, ScorecardEvaluationResult } from '../types';
|
|
8
|
+
export declare class ExecutionsModule {
|
|
9
|
+
private readonly http;
|
|
10
|
+
constructor(http: AxiosInstance);
|
|
11
|
+
/**
|
|
12
|
+
* Get an execution by ID.
|
|
13
|
+
*/
|
|
14
|
+
get(id: string): Promise<Execution>;
|
|
15
|
+
/**
|
|
16
|
+
* List executions with optional filters.
|
|
17
|
+
*/
|
|
18
|
+
list(params?: ListExecutionsParams): Promise<ListExecutionsResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Cancel an execution.
|
|
21
|
+
*/
|
|
22
|
+
cancel(id: string): Promise<{
|
|
23
|
+
deleted: boolean;
|
|
24
|
+
message: string;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Retry a failed execution.
|
|
28
|
+
*/
|
|
29
|
+
retry(id: string, options?: {
|
|
30
|
+
reason?: string;
|
|
31
|
+
parameters?: Record<string, any>;
|
|
32
|
+
}): Promise<Execution>;
|
|
33
|
+
/**
|
|
34
|
+
* Evaluate a completed execution against a scorecard.
|
|
35
|
+
*
|
|
36
|
+
* @param id - Execution ID (MongoDB ObjectId or exec_uuid format)
|
|
37
|
+
* @param data - Scorecard ID and optional API key for the LLM judge
|
|
38
|
+
* @returns The evaluation results embedded in the execution
|
|
39
|
+
*/
|
|
40
|
+
evaluate(id: string, data: EvaluateExecutionRequest): Promise<{
|
|
41
|
+
execution: Execution;
|
|
42
|
+
scorecardResults: ScorecardEvaluationResult;
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Poll an execution until it reaches a terminal status (completed or failed).
|
|
46
|
+
*
|
|
47
|
+
* @param id - Execution ID to poll
|
|
48
|
+
* @param options - Polling configuration
|
|
49
|
+
* @returns The execution in its terminal state
|
|
50
|
+
* @throws EvalTimeoutError if the execution does not complete within the timeout
|
|
51
|
+
*/
|
|
52
|
+
waitForCompletion(id: string, options?: WaitForCompletionOptions): Promise<Execution>;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=executions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executions.d.ts","sourceRoot":"","sources":["../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+
*
|
|
5
|
+
* SDK module for managing scenario executions.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ExecutionsModule = void 0;
|
|
9
|
+
const client_1 = require("../client");
|
|
10
|
+
const errors_1 = require("../errors");
|
|
11
|
+
const DEFAULT_POLL_INTERVAL_MS = 2000;
|
|
12
|
+
const DEFAULT_TIMEOUT_MS = 300_000; // 5 minutes
|
|
13
|
+
class ExecutionsModule {
|
|
14
|
+
constructor(http) {
|
|
15
|
+
this.http = http;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get an execution by ID.
|
|
19
|
+
*/
|
|
20
|
+
async get(id) {
|
|
21
|
+
const response = await this.http.get(`/scenarios/executions/${id}`);
|
|
22
|
+
const data = (0, client_1.unwrapResponse)(response);
|
|
23
|
+
return data.execution || data;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* List executions with optional filters.
|
|
27
|
+
*/
|
|
28
|
+
async list(params) {
|
|
29
|
+
const queryParams = {};
|
|
30
|
+
if (params?.scenarioId)
|
|
31
|
+
queryParams.scenarioId = params.scenarioId;
|
|
32
|
+
if (params?.promptId)
|
|
33
|
+
queryParams.promptId = params.promptId;
|
|
34
|
+
if (params?.personaId)
|
|
35
|
+
queryParams.personaId = params.personaId;
|
|
36
|
+
if (params?.status)
|
|
37
|
+
queryParams.status = params.status;
|
|
38
|
+
if (params?.triggerId)
|
|
39
|
+
queryParams.triggerId = params.triggerId;
|
|
40
|
+
if (params?.triggeredBy)
|
|
41
|
+
queryParams.triggeredBy = params.triggeredBy;
|
|
42
|
+
if (params?.fromDate)
|
|
43
|
+
queryParams.fromDate = params.fromDate;
|
|
44
|
+
if (params?.toDate)
|
|
45
|
+
queryParams.toDate = params.toDate;
|
|
46
|
+
if (params?.page)
|
|
47
|
+
queryParams.page = params.page;
|
|
48
|
+
if (params?.limit)
|
|
49
|
+
queryParams.limit = params.limit;
|
|
50
|
+
const response = await this.http.get('/scenarios/executions', { params: queryParams });
|
|
51
|
+
const data = (0, client_1.unwrapResponse)(response);
|
|
52
|
+
return {
|
|
53
|
+
executions: data.executions || [],
|
|
54
|
+
total: data.total || 0,
|
|
55
|
+
pagination: data.pagination,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Cancel an execution.
|
|
60
|
+
*/
|
|
61
|
+
async cancel(id) {
|
|
62
|
+
const response = await this.http.delete(`/scenarios/executions/${id}`);
|
|
63
|
+
return (0, client_1.unwrapResponse)(response);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Retry a failed execution.
|
|
67
|
+
*/
|
|
68
|
+
async retry(id, options) {
|
|
69
|
+
const response = await this.http.post(`/scenarios/executions/${id}/retry`, options || {});
|
|
70
|
+
const data = (0, client_1.unwrapResponse)(response);
|
|
71
|
+
return data.execution || data;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Evaluate a completed execution against a scorecard.
|
|
75
|
+
*
|
|
76
|
+
* @param id - Execution ID (MongoDB ObjectId or exec_uuid format)
|
|
77
|
+
* @param data - Scorecard ID and optional API key for the LLM judge
|
|
78
|
+
* @returns The evaluation results embedded in the execution
|
|
79
|
+
*/
|
|
80
|
+
async evaluate(id, data) {
|
|
81
|
+
const response = await this.http.post(`/scenarios/executions/${id}/evaluate`, data);
|
|
82
|
+
const result = (0, client_1.unwrapResponse)(response);
|
|
83
|
+
const execution = result.execution || result;
|
|
84
|
+
return {
|
|
85
|
+
execution,
|
|
86
|
+
scorecardResults: execution.scorecardResults,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Poll an execution until it reaches a terminal status (completed or failed).
|
|
91
|
+
*
|
|
92
|
+
* @param id - Execution ID to poll
|
|
93
|
+
* @param options - Polling configuration
|
|
94
|
+
* @returns The execution in its terminal state
|
|
95
|
+
* @throws EvalTimeoutError if the execution does not complete within the timeout
|
|
96
|
+
*/
|
|
97
|
+
async waitForCompletion(id, options) {
|
|
98
|
+
const intervalMs = options?.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
99
|
+
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
100
|
+
const startTime = Date.now();
|
|
101
|
+
const terminalStatuses = new Set(['completed', 'failed', 'cancelled', 'error']);
|
|
102
|
+
while (true) {
|
|
103
|
+
const execution = await this.get(id);
|
|
104
|
+
if (terminalStatuses.has(execution.status)) {
|
|
105
|
+
return execution;
|
|
106
|
+
}
|
|
107
|
+
const elapsed = Date.now() - startTime;
|
|
108
|
+
if (elapsed >= timeoutMs) {
|
|
109
|
+
throw new errors_1.EvalTimeoutError(id, timeoutMs);
|
|
110
|
+
}
|
|
111
|
+
await sleep(intervalMs);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.ExecutionsModule = ExecutionsModule;
|
|
116
|
+
function sleep(ms) {
|
|
117
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=executions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executions.js","sourceRoot":"","sources":["../../src/modules/executions.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,sCAA2C;AAC3C,sCAA6C;AAU7C,MAAM,wBAAwB,GAAG,IAAI,CAAC;AACtC,MAAM,kBAAkB,GAAG,OAAO,CAAC,CAAC,YAAY;AAEhD,MAAa,gBAAgB;IAC3B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC;QACpE,MAAM,IAAI,GAAG,IAAA,uBAAc,EAAM,QAAQ,CAAC,CAAC;QAC3C,OA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SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;QAEhF,OAAO,IAAI,EAAE,CAAC;YACZ,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAErC,IAAI,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC3C,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;YACvC,IAAI,OAAO,IAAI,SAAS,EAAE,CAAC;gBACzB,MAAM,IAAI,yBAAgB,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;YAC5C,CAAC;YAED,MAAM,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;CACF;AArGD,4CAqGC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generation Module
|
|
3
|
+
*
|
|
4
|
+
* SDK module for auto-generating test suites from agent system prompts.
|
|
5
|
+
*/
|
|
6
|
+
import type { AxiosInstance } from 'axios';
|
|
7
|
+
export interface GenerateOptions {
|
|
8
|
+
systemPrompt: string;
|
|
9
|
+
count?: number;
|
|
10
|
+
difficulties?: ('easy' | 'medium' | 'hard')[];
|
|
11
|
+
includeAdversarial?: boolean;
|
|
12
|
+
domain?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface GeneratedScenario {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
prompt: string;
|
|
18
|
+
category: string;
|
|
19
|
+
difficulty: string;
|
|
20
|
+
tags: string[];
|
|
21
|
+
context?: {
|
|
22
|
+
situation?: string;
|
|
23
|
+
objective?: string;
|
|
24
|
+
background?: string;
|
|
25
|
+
constraints?: string[];
|
|
26
|
+
};
|
|
27
|
+
groundTruth?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface GeneratedPersona {
|
|
30
|
+
name: string;
|
|
31
|
+
gender: string;
|
|
32
|
+
emotion: string;
|
|
33
|
+
description: string;
|
|
34
|
+
backstory: string;
|
|
35
|
+
behavior: {
|
|
36
|
+
personality: string;
|
|
37
|
+
cooperationLevel: string;
|
|
38
|
+
patience: string;
|
|
39
|
+
communicationStyle: string;
|
|
40
|
+
};
|
|
41
|
+
tags: string[];
|
|
42
|
+
}
|
|
43
|
+
export interface GeneratedCriterion {
|
|
44
|
+
key: string;
|
|
45
|
+
name: string;
|
|
46
|
+
description: string;
|
|
47
|
+
type: string;
|
|
48
|
+
settings: Record<string, any>;
|
|
49
|
+
threshold?: Record<string, any>;
|
|
50
|
+
}
|
|
51
|
+
export interface GeneratedScorecard {
|
|
52
|
+
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
criteria: GeneratedCriterion[];
|
|
55
|
+
}
|
|
56
|
+
export interface GeneratedSuite {
|
|
57
|
+
scenarios: GeneratedScenario[];
|
|
58
|
+
personas: GeneratedPersona[];
|
|
59
|
+
scorecard: GeneratedScorecard;
|
|
60
|
+
summary: string;
|
|
61
|
+
domain: string;
|
|
62
|
+
}
|
|
63
|
+
export interface PersistResult {
|
|
64
|
+
scenarioIds: string[];
|
|
65
|
+
personaIds: string[];
|
|
66
|
+
scorecardId: string | null;
|
|
67
|
+
summary: string;
|
|
68
|
+
domain: string;
|
|
69
|
+
}
|
|
70
|
+
export declare class GenerationModule {
|
|
71
|
+
private readonly http;
|
|
72
|
+
constructor(http: AxiosInstance);
|
|
73
|
+
/**
|
|
74
|
+
* Generate a test suite preview without saving to the database.
|
|
75
|
+
*/
|
|
76
|
+
preview(options: GenerateOptions): Promise<GeneratedSuite>;
|
|
77
|
+
/**
|
|
78
|
+
* Generate and persist a full test suite (scenarios + personas + scorecard).
|
|
79
|
+
*/
|
|
80
|
+
fromPrompt(options: GenerateOptions): Promise<PersistResult>;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=generation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generation.d.ts","sourceRoot":"","sources":["../../src/modules/generation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3C,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC;IAC9C,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,CAAC,EAAE;QACR,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB,CAAC;IACF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SA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OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;CAKnE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generation Module
|
|
4
|
+
*
|
|
5
|
+
* SDK module for auto-generating test suites from agent system prompts.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.GenerationModule = void 0;
|
|
9
|
+
const client_1 = require("../client");
|
|
10
|
+
class GenerationModule {
|
|
11
|
+
constructor(http) {
|
|
12
|
+
this.http = http;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Generate a test suite preview without saving to the database.
|
|
16
|
+
*/
|
|
17
|
+
async preview(options) {
|
|
18
|
+
const response = await this.http.post('/generation/preview', options);
|
|
19
|
+
const data = (0, client_1.unwrapResponse)(response);
|
|
20
|
+
return data.suite;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Generate and persist a full test suite (scenarios + personas + scorecard).
|
|
24
|
+
*/
|
|
25
|
+
async fromPrompt(options) {
|
|
26
|
+
const response = await this.http.post('/generation/from-prompt', options);
|
|
27
|
+
const data = (0, client_1.unwrapResponse)(response);
|
|
28
|
+
return data.result;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.GenerationModule = GenerationModule;
|
|
32
|
+
//# sourceMappingURL=generation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generation.js","sourceRoot":"","sources":["../../src/modules/generation.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,sCAA2C;AAwE3C,MAAa,gBAAgB;IAC3B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,OAAwB;QACpC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;QACtE,MAAM,IAAI,GAAG,IAAA,uBAAc,EAAM,QAAQ,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,OAAwB;QACvC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC;QAC1E,MAAM,IAAI,GAAG,IAAA,uBAAc,EAAM,QAAQ,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AApBD,4CAoBC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Personas Module
|
|
3
|
+
*
|
|
4
|
+
* SDK module for managing test personas.
|
|
5
|
+
*/
|
|
6
|
+
import type { AxiosInstance } from 'axios';
|
|
7
|
+
import type { Persona, CreatePersonaDto, UpdatePersonaDto, ListPersonasParams, ListPersonasResponse } from '../types';
|
|
8
|
+
export declare class PersonasModule {
|
|
9
|
+
private readonly http;
|
|
10
|
+
constructor(http: AxiosInstance);
|
|
11
|
+
/**
|
|
12
|
+
* List personas with optional filters.
|
|
13
|
+
*/
|
|
14
|
+
list(params?: ListPersonasParams): Promise<ListPersonasResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Get a persona by ID.
|
|
17
|
+
*/
|
|
18
|
+
get(id: string): Promise<Persona>;
|
|
19
|
+
/**
|
|
20
|
+
* Create a new persona.
|
|
21
|
+
*/
|
|
22
|
+
create(dto: CreatePersonaDto): Promise<Persona>;
|
|
23
|
+
/**
|
|
24
|
+
* Update a persona.
|
|
25
|
+
*/
|
|
26
|
+
update(id: string, dto: UpdatePersonaDto): Promise<Persona>;
|
|
27
|
+
/**
|
|
28
|
+
* Delete a persona.
|
|
29
|
+
*/
|
|
30
|
+
remove(id: string): Promise<{
|
|
31
|
+
deleted: boolean;
|
|
32
|
+
message: string;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Get default personas.
|
|
36
|
+
*/
|
|
37
|
+
getDefaults(): Promise<Persona[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Create default personas for a workspace.
|
|
40
|
+
*/
|
|
41
|
+
createDefaults(): Promise<Persona[]>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=personas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personas.d.ts","sourceRoot":"","sources":["../../src/modules/personas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EACV,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAElB,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEhD;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAuBtE;;OAEG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMvC;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAMrD;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAMjE;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAKxE;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAMvC;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;CAK3C"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Personas Module
|
|
4
|
+
*
|
|
5
|
+
* SDK module for managing test personas.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.PersonasModule = void 0;
|
|
9
|
+
const client_1 = require("../client");
|
|
10
|
+
class PersonasModule {
|
|
11
|
+
constructor(http) {
|
|
12
|
+
this.http = http;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* List personas with optional filters.
|
|
16
|
+
*/
|
|
17
|
+
async list(params) {
|
|
18
|
+
const queryParams = {};
|
|
19
|
+
if (params?.emotion)
|
|
20
|
+
queryParams.emotion = params.emotion;
|
|
21
|
+
if (params?.language)
|
|
22
|
+
queryParams.language = params.language;
|
|
23
|
+
if (params?.gender)
|
|
24
|
+
queryParams.gender = params.gender;
|
|
25
|
+
if (params?.accent)
|
|
26
|
+
queryParams.accent = params.accent;
|
|
27
|
+
if (params?.isActive !== undefined)
|
|
28
|
+
queryParams.isActive = params.isActive;
|
|
29
|
+
if (params?.isDefault !== undefined)
|
|
30
|
+
queryParams.isDefault = params.isDefault;
|
|
31
|
+
if (params?.tags)
|
|
32
|
+
queryParams.tags = params.tags;
|
|
33
|
+
if (params?.page)
|
|
34
|
+
queryParams.page = params.page;
|
|
35
|
+
if (params?.limit)
|
|
36
|
+
queryParams.limit = params.limit;
|
|
37
|
+
if (params?.sortBy)
|
|
38
|
+
queryParams.sortBy = params.sortBy;
|
|
39
|
+
if (params?.sortOrder)
|
|
40
|
+
queryParams.sortOrder = params.sortOrder;
|
|
41
|
+
const response = await this.http.get('/personas', { params: queryParams });
|
|
42
|
+
const data = (0, client_1.unwrapResponse)(response);
|
|
43
|
+
return {
|
|
44
|
+
personas: data.personas || [],
|
|
45
|
+
total: data.total || 0,
|
|
46
|
+
pagination: data.pagination,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get a persona by ID.
|
|
51
|
+
*/
|
|
52
|
+
async get(id) {
|
|
53
|
+
const response = await this.http.get(`/personas/${id}`);
|
|
54
|
+
const data = (0, client_1.unwrapResponse)(response);
|
|
55
|
+
return data.persona || data;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Create a new persona.
|
|
59
|
+
*/
|
|
60
|
+
async create(dto) {
|
|
61
|
+
const response = await this.http.post('/personas', dto);
|
|
62
|
+
const data = (0, client_1.unwrapResponse)(response);
|
|
63
|
+
return data.persona || data;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Update a persona.
|
|
67
|
+
*/
|
|
68
|
+
async update(id, dto) {
|
|
69
|
+
const response = await this.http.patch(`/personas/${id}`, dto);
|
|
70
|
+
const data = (0, client_1.unwrapResponse)(response);
|
|
71
|
+
return data.persona || data;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Delete a persona.
|
|
75
|
+
*/
|
|
76
|
+
async remove(id) {
|
|
77
|
+
const response = await this.http.delete(`/personas/${id}`);
|
|
78
|
+
return (0, client_1.unwrapResponse)(response);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get default personas.
|
|
82
|
+
*/
|
|
83
|
+
async getDefaults() {
|
|
84
|
+
const response = await this.http.get('/personas/defaults');
|
|
85
|
+
const data = (0, client_1.unwrapResponse)(response);
|
|
86
|
+
return data.personas || [];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Create default personas for a workspace.
|
|
90
|
+
*/
|
|
91
|
+
async createDefaults() {
|
|
92
|
+
const response = await this.http.post('/personas/defaults');
|
|
93
|
+
const data = (0, client_1.unwrapResponse)(response);
|
|
94
|
+
return data.personas || [];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.PersonasModule = PersonasModule;
|
|
98
|
+
//# sourceMappingURL=personas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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,CAAC,EAAU;QACrB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;QAC3D,OAAO,IAAA,uBAAc,EAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW;QACf,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAC3D,MAAM,IAAI,GAAG,IAAA,uBAAc,EAAM,QAAQ,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc;QAClB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAC5D,MAAM,IAAI,GAAG,IAAA,uBAAc,EAAM,QAAQ,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;IAC7B,CAAC;CACF;AAjFD,wCAiFC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompts Module — CRUD for agent system prompts.
|
|
3
|
+
*/
|
|
4
|
+
import type { AxiosInstance } from 'axios';
|
|
5
|
+
import type { Prompt, CreatePromptDto, UpdatePromptDto, ListPromptsParams, ListPromptsResponse } from '../types';
|
|
6
|
+
export declare class PromptsModule {
|
|
7
|
+
private readonly http;
|
|
8
|
+
constructor(http: AxiosInstance);
|
|
9
|
+
list(params?: ListPromptsParams): Promise<ListPromptsResponse>;
|
|
10
|
+
get(id: string): Promise<Prompt>;
|
|
11
|
+
create(dto: CreatePromptDto): Promise<Prompt>;
|
|
12
|
+
update(id: string, dto: UpdatePromptDto): Promise<Prompt>;
|
|
13
|
+
remove(id: string): Promise<{
|
|
14
|
+
deleted: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/modules/prompts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EACV,MAAM,EACN,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAElB,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAE1C,IAAI,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAc9D,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAMhC,MAAM,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAM7C,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAMzD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAIxD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Prompts Module — CRUD for agent system prompts.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PromptsModule = void 0;
|
|
7
|
+
const client_1 = require("../client");
|
|
8
|
+
class PromptsModule {
|
|
9
|
+
constructor(http) {
|
|
10
|
+
this.http = http;
|
|
11
|
+
}
|
|
12
|
+
async list(params) {
|
|
13
|
+
const queryParams = {};
|
|
14
|
+
if (params?.page)
|
|
15
|
+
queryParams.page = params.page;
|
|
16
|
+
if (params?.limit)
|
|
17
|
+
queryParams.limit = params.limit;
|
|
18
|
+
if (params?.status)
|
|
19
|
+
queryParams.status = params.status;
|
|
20
|
+
const response = await this.http.get('/prompts', { params: queryParams });
|
|
21
|
+
const data = (0, client_1.unwrapResponse)(response);
|
|
22
|
+
return {
|
|
23
|
+
prompts: data.prompts || [],
|
|
24
|
+
total: data.total || 0,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
async get(id) {
|
|
28
|
+
const response = await this.http.get(`/prompts/${id}`);
|
|
29
|
+
const data = (0, client_1.unwrapResponse)(response);
|
|
30
|
+
return data.prompt || data;
|
|
31
|
+
}
|
|
32
|
+
async create(dto) {
|
|
33
|
+
const response = await this.http.post('/prompts', dto);
|
|
34
|
+
const data = (0, client_1.unwrapResponse)(response);
|
|
35
|
+
return data.prompt || data;
|
|
36
|
+
}
|
|
37
|
+
async update(id, dto) {
|
|
38
|
+
const response = await this.http.put(`/prompts/${id}`, dto);
|
|
39
|
+
const data = (0, client_1.unwrapResponse)(response);
|
|
40
|
+
return data.prompt || data;
|
|
41
|
+
}
|
|
42
|
+
async remove(id) {
|
|
43
|
+
const response = await this.http.delete(`/prompts/${id}`);
|
|
44
|
+
return (0, client_1.unwrapResponse)(response);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.PromptsModule = PromptsModule;
|
|
48
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/modules/prompts.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAGH,sCAA2C;AAS3C,MAAa,aAAa;IACxB,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD,KAAK,CAAC,IAAI,CAAC,MAA0B;QACnC,MAAM,WAAW,GAAoC,EAAE,CAAC;QACxD,IAAI,MAAM,EAAE,IAAI;YAAE,WAAW,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACjD,IAAI,MA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