@meiti/healer-sdk 0.6.0 → 0.8.1

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/client.d.ts CHANGED
@@ -14,6 +14,10 @@ export declare class HealerNeedsConfirmationError extends Error {
14
14
  readonly options: string[];
15
15
  constructor(body: any);
16
16
  }
17
+ export declare class HealerCoveredByWatchError extends Error {
18
+ readonly repo: string;
19
+ constructor(body: any);
20
+ }
17
21
  export declare class HealerTimeoutError extends Error {
18
22
  constructor(jobId: string, timeoutMs: number);
19
23
  }
@@ -40,6 +44,12 @@ export declare class HealerClient {
40
44
  * a que termine. Usar junto a getRepair() para armar tu propio loop de consulta, o preferir
41
45
  * repair() si alcanza con esperar el resultado final. */
42
46
  submitRepair(request: SolicitudReparacion): Promise<EnvioAceptado>;
47
+ /** ¿Healer ya vigila este repo de GitHub (owner/repo) para tu organización? Con la vigilancia encendida, una revisión sin IA
48
+ * del mismo repo sobra: la vigilancia lo revisa después de cada push, con IA. */
49
+ watch(repo: string): Promise<{
50
+ repo: string;
51
+ watched: boolean;
52
+ }>;
43
53
  /** Un solo chequeo de estado — "queued"/"running" mientras corre, o el resultado final. */
44
54
  getRepair(jobId: string): Promise<EstadoJob>;
45
55
  /** Le cuenta a Healer qué archivos de su reparación se aplicaron y cuáles se dejaron afuera (desde 2026-11-11).
package/dist/client.js CHANGED
@@ -24,6 +24,16 @@ export class HealerNeedsConfirmationError extends Error {
24
24
  this.options = Array.isArray(body?.options) ? body.options : ['confirm_free'];
25
25
  }
26
26
  }
27
+ // 🧭 [2026-11-26] Una revisión sin IA (reviewOnly) de un repo que Healer ya vigila no se encola: la vigilancia revisa ese cambio
28
+ // después del push, y con IA. Sin ejecuciones dobles. Solo puede pasar si el pedido trae `repo`.
29
+ export class HealerCoveredByWatchError extends Error {
30
+ repo;
31
+ constructor(body) {
32
+ super(body?.message || 'Healer already watches this repository, so this review was not queued.');
33
+ this.name = 'HealerCoveredByWatchError';
34
+ this.repo = String(body?.repo || '');
35
+ }
36
+ }
27
37
  // Se agota esperando un job que nunca termina (proveedor de IA caído en serio, servidor caído a
28
38
  // mitad de camino, etc.) — nunca cuelga la llamada de "repair()" para siempre.
29
39
  export class HealerTimeoutError extends Error {
@@ -35,6 +45,7 @@ export class HealerTimeoutError extends Error {
35
45
  function cuerpoHttp(request) {
36
46
  return {
37
47
  files: request.files,
48
+ binary_files: request.binaryFiles,
38
49
  repository_url: request.repositoryUrl,
39
50
  commit_sha: request.commitSha,
40
51
  app_id: request.appId,
@@ -46,7 +57,9 @@ function cuerpoHttp(request) {
46
57
  ai_level: request.aiLevel,
47
58
  confirm_free: request.confirmFree,
48
59
  review_only: request.reviewOnly,
49
- bug_report: request.bugReport
60
+ repo: request.repo,
61
+ bug_report: request.bugReport,
62
+ omitted_files: request.omittedFiles
50
63
  };
51
64
  }
52
65
  // 🎓 [SDK OFICIAL, 2026-09-16, pedido explícito: "vender el pipeline vía API... entre menos
@@ -93,7 +106,15 @@ export class HealerClient {
93
106
  * a que termine. Usar junto a getRepair() para armar tu propio loop de consulta, o preferir
94
107
  * repair() si alcanza con esperar el resultado final. */
95
108
  async submitRepair(request) {
96
- return this.pedir('POST', '/v1/repair', cuerpoHttp(request));
109
+ const r = await this.pedir('POST', '/v1/repair', cuerpoHttp(request));
110
+ if (r.status === 'covered_by_watch')
111
+ throw new HealerCoveredByWatchError(r);
112
+ return r;
113
+ }
114
+ /** ¿Healer ya vigila este repo de GitHub (owner/repo) para tu organización? Con la vigilancia encendida, una revisión sin IA
115
+ * del mismo repo sobra: la vigilancia lo revisa después de cada push, con IA. */
116
+ async watch(repo) {
117
+ return this.pedir('GET', `/v1/watch?repo=${encodeURIComponent(repo)}`);
97
118
  }
98
119
  /** Un solo chequeo de estado — "queued"/"running" mientras corre, o el resultado final. */
99
120
  async getRepair(jobId) {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { HealerClient, HealerApiError, HealerTimeoutError, HealerNeedsConfirmationError } from './client.js';
1
+ export { HealerClient, HealerApiError, HealerTimeoutError, HealerNeedsConfirmationError, HealerCoveredByWatchError } from './client.js';
2
2
  export type { HealerClientOptions } from './client.js';
3
3
  export { verificarBase, aplicarReparacion, ErrorBaseModificada, HealerNeedsAcceptanceError } from './aplicar.js';
4
4
  export type { VerificacionBase } from './aplicar.js';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { HealerClient, HealerApiError, HealerTimeoutError, HealerNeedsConfirmationError } from './client.js';
1
+ export { HealerClient, HealerApiError, HealerTimeoutError, HealerNeedsConfirmationError, HealerCoveredByWatchError } from './client.js';
2
2
  export { verificarBase, aplicarReparacion, ErrorBaseModificada, HealerNeedsAcceptanceError } from './aplicar.js';
package/dist/types.d.ts CHANGED
@@ -35,10 +35,35 @@ export interface HallazgoPentagono {
35
35
  linea?: number;
36
36
  mensaje: string;
37
37
  }
38
+ /** One part of the quality score: how many points it took off (up to its cap) and its findings. */
39
+ export interface PartePentagono {
40
+ parte: 'quality' | 'dead_code' | 'dependencies';
41
+ tools: string[];
42
+ deducted: number;
43
+ cap: number;
44
+ at_cap: boolean;
45
+ findings: number;
46
+ by_severity: Record<string, number>;
47
+ top: {
48
+ tool: string;
49
+ severity: string;
50
+ file?: string;
51
+ line?: number;
52
+ package?: string;
53
+ message: string;
54
+ }[];
55
+ }
38
56
  export interface ReportePentagono {
39
57
  puntaje: number;
40
58
  critico: boolean;
41
59
  hallazgos: HallazgoPentagono[];
60
+ /** Where the points went, part by part (quality, dead code, dependencies). */
61
+ desglose?: PartePentagono[];
62
+ /** Vulnerabilities accepted in .healer.json: shown with their reason, they do not deduct. */
63
+ aceptados?: (HallazgoPentagono & {
64
+ motivo: string;
65
+ hasta: string | null;
66
+ })[];
42
67
  }
43
68
  export interface EventoReparacion {
44
69
  error: string;
@@ -55,9 +80,11 @@ export interface Cobertura {
55
80
  export interface ResultadoReparacion {
56
81
  status: 'production_ready' | 'unresolved' | 'unsupported_stack';
57
82
  not_accepted?: {
58
- reason_code: 'requires_source_build' | 'dependencies_unavailable' | 'declared_test_not_found' | 'tests_did_not_run';
83
+ reason_code: 'requires_source_build' | 'dependencies_unavailable' | 'declared_test_not_found' | 'tests_did_not_run' | 'private_needs_pro';
59
84
  reason: string;
60
85
  };
86
+ /** Files that were not part of this run (the client left them out), with the reason. The checks ran without them. */
87
+ files_left_out?: ArchivoOmitido[];
61
88
  counts_in_stats?: boolean;
62
89
  cobertura: Cobertura;
63
90
  mensaje?: string;
@@ -183,9 +210,18 @@ export interface EstadoJobConError {
183
210
  error: string;
184
211
  }
185
212
  export type EstadoJob = EstadoJobEnCurso | EstadoJobConError | ResultadoReparacion;
213
+ /** A file that did not go in a submission, and why. */
214
+ export interface ArchivoOmitido {
215
+ path: string;
216
+ reason: 'too_large' | 'total_limit' | 'binary_type' | 'binary_too_large';
217
+ bytes: number;
218
+ }
186
219
  export interface SolicitudReparacion {
187
220
  /** Objeto { rutaRelativa: contenido } — alternativa a repositoryUrl, no se pueden usar los dos. */
188
221
  files?: Record<string, string>;
222
+ /** Binarios que leen los tests (imágenes, fixtures, datos): { rutaRelativa: contenido en base64 }. Sin ellos, un test que lee un
223
+ * archivo binario falla en Healer aunque en tu máquina pase. Rutas distintas de las de files. */
224
+ binaryFiles?: Record<string, string>;
189
225
  /** URL de un repositorio git público — alternativa a files. */
190
226
  repositoryUrl?: string;
191
227
  commitSha?: string;
@@ -210,6 +246,12 @@ export interface SolicitudReparacion {
210
246
  confirmFree?: boolean;
211
247
  /** Revisar sin reparar y sin IA (compilación, tests y seguridad). */
212
248
  reviewOnly?: boolean;
249
+ /** The GitHub repository of this code (owner/repo). With reviewOnly, if Healer already watches it, the review is not queued
250
+ * (no double runs): submitRepair and repair throw HealerCoveredByWatchError. */
251
+ repo?: string;
252
+ /** Files you left out of `files` (too large, did not fit, binary). Healer does not need them to run, but it lists them in the
253
+ * result (files_left_out) so nobody reads a green result as "everything was checked". */
254
+ omittedFiles?: ArchivoOmitido[];
213
255
  /**
214
256
  * The bug as the user tells it (what they did, what they expected, what happened). Healer first writes a test that
215
257
  * reproduces it and checks that it fails with the current code; only then repairs, and that test must pass after.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meiti/healer-sdk",
3
- "version": "0.6.0",
3
+ "version": "0.8.1",
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",