@meiti/healer-sdk 0.4.0 → 0.5.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/dist/aplicar.d.ts +7 -0
- package/dist/aplicar.js +16 -0
- package/dist/client.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/types.d.ts +27 -0
- package/package.json +1 -1
package/dist/aplicar.d.ts
CHANGED
|
@@ -23,8 +23,15 @@ export declare function verificarBase(archivosActuales: Record<string, string>,
|
|
|
23
23
|
* Con { archivos: [...] } aplica solo esos (de changed_files) y deja los demás como estaban: para cuando
|
|
24
24
|
* la persona aprueba algunos arreglos y otros no. Un archivo que Healer no cambió tira un error.
|
|
25
25
|
*/
|
|
26
|
+
/** The result needs the user's acceptance of a lower quality score (see requires_acceptance). */
|
|
27
|
+
export declare class HealerNeedsAcceptanceError extends Error {
|
|
28
|
+
readonly requiresAcceptance: NonNullable<ResultadoReparacion['requires_acceptance']>;
|
|
29
|
+
readonly files: string[];
|
|
30
|
+
constructor(requiresAcceptance: NonNullable<ResultadoReparacion['requires_acceptance']>, files: string[]);
|
|
31
|
+
}
|
|
26
32
|
export declare function aplicarReparacion(archivosActuales: Record<string, string>, resultado: ResultadoReparacion, opciones?: {
|
|
27
33
|
forzar?: boolean;
|
|
28
34
|
incluirSoporte?: boolean;
|
|
29
35
|
archivos?: string[];
|
|
36
|
+
aceptarPuntajeMenor?: boolean;
|
|
30
37
|
}): Record<string, string>;
|
package/dist/aplicar.js
CHANGED
|
@@ -49,6 +49,17 @@ export function verificarBase(archivosActuales, resultado) {
|
|
|
49
49
|
* Con { archivos: [...] } aplica solo esos (de changed_files) y deja los demás como estaban: para cuando
|
|
50
50
|
* la persona aprueba algunos arreglos y otros no. Un archivo que Healer no cambió tira un error.
|
|
51
51
|
*/
|
|
52
|
+
/** The result needs the user's acceptance of a lower quality score (see requires_acceptance). */
|
|
53
|
+
export class HealerNeedsAcceptanceError extends Error {
|
|
54
|
+
requiresAcceptance;
|
|
55
|
+
files;
|
|
56
|
+
constructor(requiresAcceptance, files) {
|
|
57
|
+
super(`Needs the user's acceptance before applying: ${requiresAcceptance.reason} Quality score ${requiresAcceptance.pentagono_before} → ${requiresAcceptance.pentagono_after}. Pass { aceptarPuntajeMenor: true } if they accept, or leave out ${files.join(', ')}.`);
|
|
58
|
+
this.requiresAcceptance = requiresAcceptance;
|
|
59
|
+
this.files = files;
|
|
60
|
+
this.name = 'HealerNeedsAcceptanceError';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
52
63
|
export function aplicarReparacion(archivosActuales, resultado, opciones = {}) {
|
|
53
64
|
if (opciones.archivos?.length) {
|
|
54
65
|
const ajenos = opciones.archivos.filter((a) => !(resultado.changed_files ?? []).includes(a));
|
|
@@ -70,6 +81,11 @@ export function aplicarReparacion(archivosActuales, resultado, opciones = {}) {
|
|
|
70
81
|
const salida = { ...archivosActuales };
|
|
71
82
|
const soporte = opciones.incluirSoporte === false ? resultado.support_updates ?? [] : [];
|
|
72
83
|
const elegidos = opciones.archivos?.length ? opciones.archivos : resultado.changed_files ?? [];
|
|
84
|
+
// ⚖️ [2026-11-16] Una dependencia que baja el puntaje solo con el sí del usuario (misma regla que Healer).
|
|
85
|
+
const ra = resultado.requires_acceptance;
|
|
86
|
+
const tocados = ra && !opciones.aceptarPuntajeMenor ? ra.files.filter((r) => elegidos.includes(r) && !soporte.includes(r)) : [];
|
|
87
|
+
if (ra && tocados.length)
|
|
88
|
+
throw new HealerNeedsAcceptanceError(ra, tocados);
|
|
73
89
|
for (const ruta of elegidos.filter((r) => !soporte.includes(r))) {
|
|
74
90
|
const reparado = resultado.files[ruta];
|
|
75
91
|
if (reparado !== undefined)
|
package/dist/client.js
CHANGED
|
@@ -45,7 +45,8 @@ function cuerpoHttp(request) {
|
|
|
45
45
|
port: request.port,
|
|
46
46
|
ai_level: request.aiLevel,
|
|
47
47
|
confirm_free: request.confirmFree,
|
|
48
|
-
review_only: request.reviewOnly
|
|
48
|
+
review_only: request.reviewOnly,
|
|
49
|
+
bug_report: request.bugReport
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
52
|
// 🎓 [SDK OFICIAL, 2026-09-16, pedido explícito: "vender el pipeline vía API... entre menos
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { HealerClient, HealerApiError, HealerTimeoutError, HealerNeedsConfirmationError } from './client.js';
|
|
2
2
|
export type { HealerClientOptions } from './client.js';
|
|
3
|
-
export { verificarBase, aplicarReparacion, ErrorBaseModificada } from './aplicar.js';
|
|
3
|
+
export { verificarBase, aplicarReparacion, ErrorBaseModificada, HealerNeedsAcceptanceError } from './aplicar.js';
|
|
4
4
|
export type { VerificacionBase } from './aplicar.js';
|
|
5
5
|
export type { SolicitudReparacion, ResultadoReparacion, EnvioAceptado, EstadoJob, ProgresoJob, EventoReparacion, ReporteAuditoriaSeguridad, HallazgoSeguridad, HallazgoPendiente, ReporteUsoReal, ProblemaUsoReal, ItemNoProbado, ReportePentagono, HallazgoPentagono, Cobertura, Stack, HealerReport, PendingKind, ScreenPage, ScreenReviewRequest, ScreenReviewResult, HealerInfo } from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { HealerClient, HealerApiError, HealerTimeoutError, HealerNeedsConfirmationError } from './client.js';
|
|
2
|
-
export { verificarBase, aplicarReparacion, ErrorBaseModificada } from './aplicar.js';
|
|
2
|
+
export { verificarBase, aplicarReparacion, ErrorBaseModificada, HealerNeedsAcceptanceError } from './aplicar.js';
|
package/dist/types.d.ts
CHANGED
|
@@ -78,6 +78,27 @@ export interface ResultadoReparacion {
|
|
|
78
78
|
* la app corra en el runtime actual), no la reparación del bug. Son opcionales: ver aplicarReparacion().
|
|
79
79
|
*/
|
|
80
80
|
support_updates?: string[];
|
|
81
|
+
/**
|
|
82
|
+
* The repair is verified, but Healer added a dependency so the tests could run and it lowers the quality score
|
|
83
|
+
* (known vulnerabilities or the Pentagon). Apply it only if the user accepts: aplicarReparacion needs
|
|
84
|
+
* { aceptarPuntajeMenor: true } when these files are included.
|
|
85
|
+
*/
|
|
86
|
+
requires_acceptance?: {
|
|
87
|
+
reason: string;
|
|
88
|
+
files: string[];
|
|
89
|
+
pentagono_before: number;
|
|
90
|
+
pentagono_after: number;
|
|
91
|
+
};
|
|
92
|
+
/** Only with bugReport: whether Healer reproduced the bug with a test before repairing, and whether it passes after. */
|
|
93
|
+
reproduction?: {
|
|
94
|
+
status: "reproduced" | "not_reproduced" | "could_not_write" | "unsupported";
|
|
95
|
+
test_file?: string;
|
|
96
|
+
test_content?: string;
|
|
97
|
+
attempts: number;
|
|
98
|
+
log?: string;
|
|
99
|
+
message: string;
|
|
100
|
+
passes_after?: boolean;
|
|
101
|
+
};
|
|
81
102
|
/**
|
|
82
103
|
* Failures found and fixed. Each failing check counts once; each auditor bug fixed and delivered counts
|
|
83
104
|
* one. Checks stop at the first failure, so "sin_correr" means others may not have run yet.
|
|
@@ -184,6 +205,12 @@ export interface SolicitudReparacion {
|
|
|
184
205
|
confirmFree?: boolean;
|
|
185
206
|
/** Revisar sin reparar y sin IA (compilación, tests y seguridad). */
|
|
186
207
|
reviewOnly?: boolean;
|
|
208
|
+
/**
|
|
209
|
+
* The bug as the user tells it (what they did, what they expected, what happened). Healer first writes a test that
|
|
210
|
+
* reproduces it and checks that it fails with the current code; only then repairs, and that test must pass after.
|
|
211
|
+
* If it does not reproduce, nothing is repaired blindly (see reproduction in the result). Needs files, not repositoryUrl.
|
|
212
|
+
*/
|
|
213
|
+
bugReport?: string;
|
|
187
214
|
}
|
|
188
215
|
export interface EnvioAceptado {
|
|
189
216
|
job_id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meiti/healer-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Official SDK for Healer: send code, get it back repaired or unchanged, never worse. Thin layer over the REST API with polling, safe apply and partial delivery.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|