@meiti/healer-sdk 0.3.0 → 0.3.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/README.md CHANGED
@@ -95,6 +95,15 @@ for (const p of r.pages) console.log(p.path, p.state, p.expectations.map((e) =>
95
95
 
96
96
  Each page comes back LOADED, DID NOT LOAD (with the reason) or NOT THE EXPECTED PAGE. On a page that did not load, a `not_exists` answers CANNOT PROVE, never a false yes.
97
97
 
98
+ `startCommand`, `port` and `pages` are optional. Without them Healer finds how to start the app (`.healer.json` `"screen"`, the command that worked last time for this `appId`, or `package.json` / the Python entry file) and checks `/`. `r.start` says which command ran, where it came from (`declared`, `repo_config`, `remembered`, `detected`) and whether the app answered:
99
+
100
+ ```ts
101
+ const r = await healer.reviewScreen({ files });
102
+ console.log(r.start); // { command: 'npx vite --host 0.0.0.0 --port 5173 --strictPort', port: 5173, source: 'detected', detail: 'package.json: the "dev" script runs Vite', verified: true }
103
+ ```
104
+
105
+ To fix the command for every agent, declare it once in `.healer.json`: `{ "screen": { "start_command": "npm start", "port": 3000, "pages": [{ "path": "/" }] } }`.
106
+
98
107
  ### Partial delivery
99
108
 
100
109
  When some failures were fixed and others remain, `status` stays `"unresolved"` but the result carries
package/dist/types.d.ts CHANGED
@@ -233,10 +233,15 @@ export interface ScreenReviewRequest {
233
233
  files?: Record<string, string>;
234
234
  repositoryUrl?: string;
235
235
  commitSha?: string;
236
- /** The command that starts the app (it must listen on 0.0.0.0). */
237
- startCommand: string;
238
- port: number;
239
- pages: ScreenPage[];
236
+ /**
237
+ * The command that starts the app (it must listen on 0.0.0.0). Optional: without it Healer finds it (.healer.json "screen",
238
+ * the command that worked last time for this appId, or package.json / the Python entry file). See ScreenReviewResult.start.
239
+ */
240
+ startCommand?: string;
241
+ /** Optional, like startCommand. */
242
+ port?: number;
243
+ /** Optional: default [{ path: "/" }] (or the pages in .healer.json "screen"). */
244
+ pages?: ScreenPage[];
240
245
  appId?: string;
241
246
  }
242
247
  /** The result of a screen review: Healer started the app in its sandbox and checked each page. Nothing was repaired. */
@@ -244,13 +249,30 @@ export interface ScreenReviewResult {
244
249
  tipo: 'pantalla';
245
250
  status: 'checked' | 'did_not_start' | 'unsupported_stack';
246
251
  message: string;
252
+ /**
253
+ * How the app was started. source: declared (you sent it), repo_config (.healer.json), remembered (worked last time for
254
+ * this appId), detected (read from package.json or the Python files). verified: the app answered on that port. null when
255
+ * Healer could not find how to start it (message says what is needed).
256
+ */
257
+ /** The last lines the app's server printed, when it did not start or a page did not load. */
258
+ server_log?: string;
259
+ start: {
260
+ command: string;
261
+ port: number;
262
+ source: 'declared' | 'repo_config' | 'remembered' | 'detected';
263
+ detail: string;
264
+ verified: boolean;
265
+ } | null;
247
266
  pages: {
248
267
  path: string;
249
268
  state: 'LOADED' | 'DID NOT LOAD' | 'STILL LOADING' | 'NOT THE EXPECTED PAGE';
250
269
  reasons: string[];
251
270
  http: number | null;
252
271
  title: string;
272
+ /** HTTP 4xx/5xx answers, and "NO RESPONSE ..." for requests that got no answer at all (backend down, wrong address, CORS). */
253
273
  failed_requests: string[];
274
+ /** Console errors and uncaught exceptions while the page loaded: usually why a page stays blank. */
275
+ page_errors: string[];
254
276
  visual_issues: {
255
277
  type: string;
256
278
  element: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meiti/healer-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.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",