@geometra/mcp 1.19.15 → 1.19.17
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 +7 -6
- package/dist/__tests__/proxy-session-actions.test.js +63 -5
- package/dist/__tests__/server-batch-results.test.js +199 -16
- package/dist/__tests__/session-model.test.js +12 -3
- package/dist/proxy-spawn.d.ts +11 -0
- package/dist/proxy-spawn.js +46 -19
- package/dist/server.js +408 -35
- package/dist/session.d.ts +44 -7
- package/dist/session.js +311 -39
- package/package.json +2 -2
package/dist/session.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ChildProcess } from 'node:child_process';
|
|
2
2
|
import WebSocket from 'ws';
|
|
3
|
+
import { type EmbeddedProxyRuntime } from './proxy-spawn.js';
|
|
3
4
|
/**
|
|
4
5
|
* Parsed accessibility node from the UI tree + computed layout.
|
|
5
6
|
* Mirrors the shape of @geometra/core's AccessibilityNode without importing it
|
|
@@ -27,6 +28,7 @@ export interface A11yNode {
|
|
|
27
28
|
pageUrl?: string;
|
|
28
29
|
scrollX?: number;
|
|
29
30
|
scrollY?: number;
|
|
31
|
+
controlTag?: string;
|
|
30
32
|
};
|
|
31
33
|
bounds: {
|
|
32
34
|
x: number;
|
|
@@ -242,12 +244,16 @@ export interface PageSectionDetail {
|
|
|
242
244
|
textPreview: string[];
|
|
243
245
|
}
|
|
244
246
|
export type FormSchemaFieldKind = 'text' | 'choice' | 'toggle' | 'multi_choice';
|
|
247
|
+
export type FormSchemaChoiceType = 'select' | 'group' | 'listbox';
|
|
248
|
+
export type FormSchemaContextMode = 'auto' | 'always' | 'none';
|
|
245
249
|
export interface FormSchemaField {
|
|
246
250
|
id: string;
|
|
247
251
|
kind: FormSchemaFieldKind;
|
|
248
252
|
label: string;
|
|
249
253
|
required?: boolean;
|
|
250
254
|
invalid?: boolean;
|
|
255
|
+
choiceType?: FormSchemaChoiceType;
|
|
256
|
+
booleanChoice?: boolean;
|
|
251
257
|
controlType?: 'checkbox' | 'radio';
|
|
252
258
|
value?: string;
|
|
253
259
|
valueLength?: number;
|
|
@@ -265,6 +271,14 @@ export interface FormSchemaModel {
|
|
|
265
271
|
invalidCount: number;
|
|
266
272
|
fields: FormSchemaField[];
|
|
267
273
|
}
|
|
274
|
+
export interface FormSchemaBuildOptions {
|
|
275
|
+
formId?: string;
|
|
276
|
+
maxFields?: number;
|
|
277
|
+
onlyRequiredFields?: boolean;
|
|
278
|
+
onlyInvalidFields?: boolean;
|
|
279
|
+
includeOptions?: boolean;
|
|
280
|
+
includeContext?: FormSchemaContextMode;
|
|
281
|
+
}
|
|
268
282
|
export interface UiNodeUpdate {
|
|
269
283
|
before: CompactUiNode;
|
|
270
284
|
after: CompactUiNode;
|
|
@@ -312,6 +326,14 @@ export interface Session {
|
|
|
312
326
|
updateRevision: number;
|
|
313
327
|
/** Present when this session owns a child geometra-proxy process (pageUrl connect). */
|
|
314
328
|
proxyChild?: ChildProcess;
|
|
329
|
+
proxyRuntime?: EmbeddedProxyRuntime;
|
|
330
|
+
proxyReusable?: boolean;
|
|
331
|
+
cachedA11y?: A11yNode | null;
|
|
332
|
+
cachedA11yRevision?: number;
|
|
333
|
+
cachedFormSchemas?: Map<string, {
|
|
334
|
+
revision: number;
|
|
335
|
+
forms: FormSchemaModel[];
|
|
336
|
+
}>;
|
|
315
337
|
}
|
|
316
338
|
export interface UpdateWaitResult {
|
|
317
339
|
status: 'updated' | 'acknowledged' | 'timed_out';
|
|
@@ -319,16 +341,25 @@ export interface UpdateWaitResult {
|
|
|
319
341
|
result?: unknown;
|
|
320
342
|
}
|
|
321
343
|
export type ProxyFillField = {
|
|
344
|
+
kind: 'auto';
|
|
345
|
+
fieldId?: string;
|
|
346
|
+
fieldLabel: string;
|
|
347
|
+
value: string | boolean;
|
|
348
|
+
exact?: boolean;
|
|
349
|
+
} | {
|
|
322
350
|
kind: 'text';
|
|
351
|
+
fieldId?: string;
|
|
323
352
|
fieldLabel: string;
|
|
324
353
|
value: string;
|
|
325
354
|
exact?: boolean;
|
|
326
355
|
} | {
|
|
327
356
|
kind: 'choice';
|
|
357
|
+
fieldId?: string;
|
|
328
358
|
fieldLabel: string;
|
|
329
359
|
value: string;
|
|
330
360
|
query?: string;
|
|
331
361
|
exact?: boolean;
|
|
362
|
+
choiceType?: FormSchemaChoiceType;
|
|
332
363
|
} | {
|
|
333
364
|
kind: 'toggle';
|
|
334
365
|
label: string;
|
|
@@ -337,6 +368,7 @@ export type ProxyFillField = {
|
|
|
337
368
|
controlType?: 'checkbox' | 'radio';
|
|
338
369
|
} | {
|
|
339
370
|
kind: 'file';
|
|
371
|
+
fieldId?: string;
|
|
340
372
|
fieldLabel: string;
|
|
341
373
|
paths: string[];
|
|
342
374
|
exact?: boolean;
|
|
@@ -349,6 +381,8 @@ export declare function connect(url: string, opts?: {
|
|
|
349
381
|
width?: number;
|
|
350
382
|
height?: number;
|
|
351
383
|
skipInitialResize?: boolean;
|
|
384
|
+
closePreviousProxy?: boolean;
|
|
385
|
+
awaitInitialFrame?: boolean;
|
|
352
386
|
}): Promise<Session>;
|
|
353
387
|
/**
|
|
354
388
|
* Start geometra-proxy for `pageUrl`, connect to its WebSocket, and attach the child
|
|
@@ -361,9 +395,12 @@ export declare function connectThroughProxy(options: {
|
|
|
361
395
|
width?: number;
|
|
362
396
|
height?: number;
|
|
363
397
|
slowMo?: number;
|
|
398
|
+
awaitInitialFrame?: boolean;
|
|
364
399
|
}): Promise<Session>;
|
|
365
400
|
export declare function getSession(): Session | null;
|
|
366
|
-
export declare function disconnect(
|
|
401
|
+
export declare function disconnect(opts?: {
|
|
402
|
+
closeProxy?: boolean;
|
|
403
|
+
}): void;
|
|
367
404
|
export declare function waitForUiCondition(session: Session, predicate: () => boolean, timeoutMs: number): Promise<boolean>;
|
|
368
405
|
/**
|
|
369
406
|
* Send a click event at (x, y) and wait for the next frame/patch response.
|
|
@@ -402,11 +439,14 @@ export declare function sendFileUpload(session: Session, paths: string[], opts?:
|
|
|
402
439
|
/** Set a labeled text-like field (`input`, `textarea`, contenteditable, ARIA textbox) semantically. */
|
|
403
440
|
export declare function sendFieldText(session: Session, fieldLabel: string, value: string, opts?: {
|
|
404
441
|
exact?: boolean;
|
|
442
|
+
fieldId?: string;
|
|
405
443
|
}, timeoutMs?: number): Promise<UpdateWaitResult>;
|
|
406
444
|
/** Choose a value for a labeled choice field (select, custom combobox, or radio-style group). */
|
|
407
445
|
export declare function sendFieldChoice(session: Session, fieldLabel: string, value: string, opts?: {
|
|
408
446
|
exact?: boolean;
|
|
409
447
|
query?: string;
|
|
448
|
+
choiceType?: FormSchemaChoiceType;
|
|
449
|
+
fieldId?: string;
|
|
410
450
|
}, timeoutMs?: number): Promise<UpdateWaitResult>;
|
|
411
451
|
/** Fill several semantic form fields in one proxy-side batch. */
|
|
412
452
|
export declare function sendFillFields(session: Session, fields: ProxyFillField[], timeoutMs?: number): Promise<UpdateWaitResult>;
|
|
@@ -438,6 +478,8 @@ export declare function sendWheel(session: Session, deltaY: number, opts?: {
|
|
|
438
478
|
x?: number;
|
|
439
479
|
y?: number;
|
|
440
480
|
}, timeoutMs?: number): Promise<UpdateWaitResult>;
|
|
481
|
+
/** Navigate the proxy page to a new URL while keeping the browser process alive. */
|
|
482
|
+
export declare function sendNavigate(session: Session, url: string, timeoutMs?: number): Promise<UpdateWaitResult>;
|
|
441
483
|
/**
|
|
442
484
|
* Build a flat accessibility tree from the raw UI tree + layout.
|
|
443
485
|
* This is a standalone reimplementation that works with raw JSON —
|
|
@@ -467,12 +509,7 @@ export declare function buildPageModel(root: A11yNode, options?: {
|
|
|
467
509
|
maxPrimaryActions?: number;
|
|
468
510
|
maxSectionsPerKind?: number;
|
|
469
511
|
}): PageModel;
|
|
470
|
-
export declare function buildFormSchemas(root: A11yNode, options?:
|
|
471
|
-
formId?: string;
|
|
472
|
-
maxFields?: number;
|
|
473
|
-
onlyRequiredFields?: boolean;
|
|
474
|
-
onlyInvalidFields?: boolean;
|
|
475
|
-
}): FormSchemaModel[];
|
|
512
|
+
export declare function buildFormSchemas(root: A11yNode, options?: FormSchemaBuildOptions): FormSchemaModel[];
|
|
476
513
|
/**
|
|
477
514
|
* Expand a page-model section by stable ID into richer, on-demand details.
|
|
478
515
|
*/
|