agent-web-interface 4.2.0 → 4.3.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.
Files changed (55) hide show
  1. package/dist/src/index.js +19 -7
  2. package/dist/src/index.js.map +1 -1
  3. package/dist/src/server/mcp-server.d.ts.map +1 -1
  4. package/dist/src/server/mcp-server.js +29 -1
  5. package/dist/src/server/mcp-server.js.map +1 -1
  6. package/dist/src/snapshot/element-resolver.d.ts +35 -14
  7. package/dist/src/snapshot/element-resolver.d.ts.map +1 -1
  8. package/dist/src/snapshot/element-resolver.js +109 -60
  9. package/dist/src/snapshot/element-resolver.js.map +1 -1
  10. package/dist/src/snapshot/index.d.ts +1 -1
  11. package/dist/src/snapshot/index.d.ts.map +1 -1
  12. package/dist/src/snapshot/index.js +1 -1
  13. package/dist/src/snapshot/index.js.map +1 -1
  14. package/dist/src/snapshot/snapshot-compiler.d.ts.map +1 -1
  15. package/dist/src/snapshot/snapshot-compiler.js +31 -1
  16. package/dist/src/snapshot/snapshot-compiler.js.map +1 -1
  17. package/dist/src/snapshot/snapshot.types.d.ts +1 -1
  18. package/dist/src/snapshot/snapshot.types.d.ts.map +1 -1
  19. package/dist/src/snapshot/snapshot.types.js +1 -0
  20. package/dist/src/snapshot/snapshot.types.js.map +1 -1
  21. package/dist/src/state/actionables-filter.d.ts.map +1 -1
  22. package/dist/src/state/actionables-filter.js +1 -0
  23. package/dist/src/state/actionables-filter.js.map +1 -1
  24. package/dist/src/state/state-renderer.d.ts.map +1 -1
  25. package/dist/src/state/state-renderer.js +2 -0
  26. package/dist/src/state/state-renderer.js.map +1 -1
  27. package/dist/src/tools/browser-tools.d.ts +29 -8
  28. package/dist/src/tools/browser-tools.d.ts.map +1 -1
  29. package/dist/src/tools/browser-tools.js +93 -131
  30. package/dist/src/tools/browser-tools.js.map +1 -1
  31. package/dist/src/tools/canvas-tools.d.ts +32 -0
  32. package/dist/src/tools/canvas-tools.d.ts.map +1 -0
  33. package/dist/src/tools/canvas-tools.js +370 -0
  34. package/dist/src/tools/canvas-tools.js.map +1 -0
  35. package/dist/src/tools/form-tools.d.ts +2 -4
  36. package/dist/src/tools/form-tools.d.ts.map +1 -1
  37. package/dist/src/tools/form-tools.js +6 -38
  38. package/dist/src/tools/form-tools.js.map +1 -1
  39. package/dist/src/tools/index.d.ts +6 -4
  40. package/dist/src/tools/index.d.ts.map +1 -1
  41. package/dist/src/tools/index.js +13 -4
  42. package/dist/src/tools/index.js.map +1 -1
  43. package/dist/src/tools/tool-context.d.ts +53 -0
  44. package/dist/src/tools/tool-context.d.ts.map +1 -0
  45. package/dist/src/tools/tool-context.js +119 -0
  46. package/dist/src/tools/tool-context.js.map +1 -0
  47. package/dist/src/tools/tool-result.types.d.ts +16 -1
  48. package/dist/src/tools/tool-result.types.d.ts.map +1 -1
  49. package/dist/src/tools/tool-result.types.js +11 -0
  50. package/dist/src/tools/tool-result.types.js.map +1 -1
  51. package/dist/src/tools/tool-schemas.d.ts +255 -128
  52. package/dist/src/tools/tool-schemas.d.ts.map +1 -1
  53. package/dist/src/tools/tool-schemas.js +85 -3
  54. package/dist/src/tools/tool-schemas.js.map +1 -1
  55. package/package.json +1 -1
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Tool Context
3
+ *
4
+ * Shared plumbing for all tool modules (browser-tools, canvas-tools, form-tools).
5
+ * Centralizes session management, snapshot storage, page resolution, and element lookup.
6
+ */
7
+ import type { SessionManager } from '../browser/session-manager.js';
8
+ import type { PageHandle } from '../browser/page-registry.js';
9
+ import type { BaseSnapshot, ReadableNode } from '../snapshot/snapshot.types.js';
10
+ import type { RuntimeHealth } from '../state/health.types.js';
11
+ import { SnapshotStore } from '../snapshot/index.js';
12
+ /**
13
+ * Initialize shared tool context with a session manager.
14
+ * Must be called once before using any tool handlers.
15
+ */
16
+ export declare function initializeToolContext(manager: SessionManager): void;
17
+ /**
18
+ * Get the session manager, throwing if not initialized.
19
+ */
20
+ export declare function getSessionManager(): SessionManager;
21
+ /**
22
+ * Get the shared snapshot store instance.
23
+ */
24
+ export declare function getSnapshotStore(): SnapshotStore;
25
+ /**
26
+ * Resolve page_id to a PageHandle, throwing if not found.
27
+ * Also touches the page to mark it as MRU.
28
+ */
29
+ export declare function resolveExistingPage(session: SessionManager, page_id: string | undefined): PageHandle;
30
+ export interface CdpSessionResult {
31
+ handle: PageHandle;
32
+ recovered: boolean;
33
+ runtime_health: RuntimeHealth;
34
+ }
35
+ /**
36
+ * Ensure CDP session is healthy, attempting repair if needed.
37
+ * Call this before any CDP operation to auto-repair dead sessions.
38
+ */
39
+ export declare function ensureCdpSession(session: SessionManager, handle: PageHandle): Promise<CdpSessionResult>;
40
+ /**
41
+ * Require snapshot for a page, throwing a consistent error if missing.
42
+ */
43
+ export declare function requireSnapshot(pageId: string): BaseSnapshot;
44
+ /**
45
+ * Resolve element by eid for action tools.
46
+ * Looks up element in registry and finds corresponding node in snapshot.
47
+ * Includes proactive staleness detection before CDP interaction.
48
+ *
49
+ * @throws {ElementNotFoundError} If eid not found in registry
50
+ * @throws {StaleElementError} If eid reference is stale or element not in current snapshot
51
+ */
52
+ export declare function resolveElementByEid(pageId: string, eid: string, snapshot: BaseSnapshot): ReadableNode;
53
+ //# sourceMappingURL=tool-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-context.d.ts","sourceRoot":"","sources":["../../../src/tools/tool-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAUrD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAEnE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAKlD;AAQD;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAEhD;AAMD;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,UAAU,CASZ;AAMD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,aAAa,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAoB3B;AAMD;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAM5D;AAMD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,YAAY,GACrB,YAAY,CAmBd"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Tool Context
3
+ *
4
+ * Shared plumbing for all tool modules (browser-tools, canvas-tools, form-tools).
5
+ * Centralizes session management, snapshot storage, page resolution, and element lookup.
6
+ */
7
+ import { createHealthyRuntime, createRecoveredCdpRuntime } from '../state/health.types.js';
8
+ import { SnapshotStore } from '../snapshot/index.js';
9
+ import { getStateManager } from './execute-action.js';
10
+ import { ElementNotFoundError, StaleElementError, SnapshotRequiredError } from './errors.js';
11
+ // ---------------------------------------------------------------------------
12
+ // Session Manager Singleton
13
+ // ---------------------------------------------------------------------------
14
+ let sessionManager = null;
15
+ /**
16
+ * Initialize shared tool context with a session manager.
17
+ * Must be called once before using any tool handlers.
18
+ */
19
+ export function initializeToolContext(manager) {
20
+ sessionManager = manager;
21
+ }
22
+ /**
23
+ * Get the session manager, throwing if not initialized.
24
+ */
25
+ export function getSessionManager() {
26
+ if (!sessionManager) {
27
+ throw new Error('Tools not initialized. Call initializeToolContext() first.');
28
+ }
29
+ return sessionManager;
30
+ }
31
+ // ---------------------------------------------------------------------------
32
+ // Snapshot Store Singleton
33
+ // ---------------------------------------------------------------------------
34
+ const snapshotStore = new SnapshotStore();
35
+ /**
36
+ * Get the shared snapshot store instance.
37
+ */
38
+ export function getSnapshotStore() {
39
+ return snapshotStore;
40
+ }
41
+ // ---------------------------------------------------------------------------
42
+ // Page Resolution
43
+ // ---------------------------------------------------------------------------
44
+ /**
45
+ * Resolve page_id to a PageHandle, throwing if not found.
46
+ * Also touches the page to mark it as MRU.
47
+ */
48
+ export function resolveExistingPage(session, page_id) {
49
+ const handle = session.resolvePage(page_id);
50
+ if (!handle) {
51
+ throw new Error(page_id ? `Page not found: ${page_id}` : 'No page available. Navigate to a URL first.');
52
+ }
53
+ session.touchPage(handle.page_id);
54
+ return handle;
55
+ }
56
+ /**
57
+ * Ensure CDP session is healthy, attempting repair if needed.
58
+ * Call this before any CDP operation to auto-repair dead sessions.
59
+ */
60
+ export async function ensureCdpSession(session, handle) {
61
+ if (handle.cdp.isActive()) {
62
+ try {
63
+ await handle.cdp.send('Page.getFrameTree', undefined);
64
+ return { handle, recovered: false, runtime_health: createHealthyRuntime() };
65
+ }
66
+ catch (err) {
67
+ const message = err instanceof Error ? err.message : String(err);
68
+ console.warn(`[RECOVERY] CDP probe failed for ${handle.page_id}: ${message}. Attempting rebind`);
69
+ }
70
+ }
71
+ console.warn(`[RECOVERY] CDP session dead for ${handle.page_id}, attempting rebind`);
72
+ const newHandle = await session.rebindCdpSession(handle.page_id);
73
+ return {
74
+ handle: newHandle,
75
+ recovered: true,
76
+ runtime_health: createRecoveredCdpRuntime('HEALTHY'),
77
+ };
78
+ }
79
+ // ---------------------------------------------------------------------------
80
+ // Snapshot Resolution
81
+ // ---------------------------------------------------------------------------
82
+ /**
83
+ * Require snapshot for a page, throwing a consistent error if missing.
84
+ */
85
+ export function requireSnapshot(pageId) {
86
+ const snap = snapshotStore.getByPageId(pageId);
87
+ if (!snap) {
88
+ throw new SnapshotRequiredError(pageId);
89
+ }
90
+ return snap;
91
+ }
92
+ // ---------------------------------------------------------------------------
93
+ // Element Resolution
94
+ // ---------------------------------------------------------------------------
95
+ /**
96
+ * Resolve element by eid for action tools.
97
+ * Looks up element in registry and finds corresponding node in snapshot.
98
+ * Includes proactive staleness detection before CDP interaction.
99
+ *
100
+ * @throws {ElementNotFoundError} If eid not found in registry
101
+ * @throws {StaleElementError} If eid reference is stale or element not in current snapshot
102
+ */
103
+ export function resolveElementByEid(pageId, eid, snapshot) {
104
+ const stateManager = getStateManager(pageId);
105
+ const registry = stateManager.getElementRegistry();
106
+ const elementRef = registry.getByEid(eid);
107
+ if (!elementRef) {
108
+ throw new ElementNotFoundError(eid);
109
+ }
110
+ if (registry.isStale(eid)) {
111
+ throw new StaleElementError(eid);
112
+ }
113
+ const node = snapshot.nodes.find((n) => n.backend_node_id === elementRef.ref.backend_node_id);
114
+ if (!node) {
115
+ throw new StaleElementError(eid);
116
+ }
117
+ return node;
118
+ }
119
+ //# sourceMappingURL=tool-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-context.js","sourceRoot":"","sources":["../../../src/tools/tool-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE7F,8EAA8E;AAC9E,4BAA4B;AAC5B,8EAA8E;AAE9E,IAAI,cAAc,GAA0B,IAAI,CAAC;AAEjD;;;GAGG;AACH,MAAM,UAAU,qBAA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AO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,KAAK,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC9F,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -31,14 +31,29 @@ export interface FileResult {
31
31
  /** Size in bytes */
32
32
  readonly sizeBytes: number;
33
33
  }
34
+ /**
35
+ * Composite result - returned as multi-content (text + image).
36
+ * Used when a tool needs to return both structured data and a screenshot.
37
+ */
38
+ export interface CompositeResult {
39
+ readonly type: 'composite';
40
+ /** JSON-encoded structured data (e.g., canvas metadata) */
41
+ readonly text: string;
42
+ /** Annotated screenshot */
43
+ readonly image: ImageResult | FileResult;
44
+ }
34
45
  /**
35
46
  * Discriminated union of all non-text tool result types.
36
47
  */
37
- export type ToolResult = ImageResult | FileResult;
48
+ export type ToolResult = ImageResult | FileResult | CompositeResult;
38
49
  /**
39
50
  * Type guard for ImageResult.
40
51
  */
41
52
  export declare function isImageResult(result: unknown): result is ImageResult;
53
+ /**
54
+ * Type guard for CompositeResult.
55
+ */
56
+ export declare function isCompositeResult(result: unknown): result is CompositeResult;
42
57
  /**
43
58
  * Type guard for FileResult.
44
59
  */
@@ -1 +1 @@
1
- {"version":3,"file":"tool-result.types.d.ts","sourceRoot":"","sources":["../../../src/tools/tool-result.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,gCAAgC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CA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,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2BAA2B;IAC3B,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,UAAU,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,eAAe,CAAC;AAEpE;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,WAAW,CASpE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,eAAe,CAS5E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,UAAU,CASlE"}
@@ -16,6 +16,17 @@ export function isImageResult(result) {
16
16
  'data' in result &&
17
17
  'mimeType' in result);
18
18
  }
19
+ /**
20
+ * Type guard for CompositeResult.
21
+ */
22
+ export function isCompositeResult(result) {
23
+ return (typeof result === 'object' &&
24
+ result !== null &&
25
+ 'type' in result &&
26
+ result.type === 'composite' &&
27
+ 'text' in result &&
28
+ 'image' in result);
29
+ }
19
30
  /**
20
31
  * Type guard for FileResult.
21
32
  */
@@ -1 +1 @@
1
- {"version":3,"file":"tool-result.types.js","sourceRoot":"","sources":["../../../src/tools/tool-result.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmCH;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAe;IAC3C,OAAO,CACL,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACf,MAAM,IAAI,MAAM;QACf,MAAkC,CAAC,IAAI,KAAK,OAAO;QACpD,MAAM,IAAI,MAAM;QAChB,UAAU,IAAI,MAAM,CACrB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAAe;IAC1C,OAAO,CACL,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACf,MAAM,IAAI,MAAM;QACf,MAAkC,CAAC,IAAI,KAAK,MAAM;QACnD,MAAM,IAAI,MAAM;QAChB,UAAU,IAAI,MAAM,CACrB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"tool-result.types.js","sourceRoot":"","sources":["../../../src/tools/tool-result.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+CH;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAe;IAC3C,OAAO,CACL,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACf,MAAM,IAAI,MAAM;QACf,MAAkC,CAAC,IAAI,KAAK,OAAO;QACpD,MAAM,IAAI,MAAM;QAChB,UAAU,IAAI,MAAM,CACrB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAe;IAC/C,OAAO,CACL,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACf,MAAM,IAAI,MAAM;QACf,MAAkC,CAAC,IAAI,KAAK,WAAW;QACxD,MAAM,IAAI,MAAM;QAChB,OAAO,IAAI,MAAM,CAClB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAAe;IAC1C,OAAO,CACL,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACf,MAAM,IAAI,MAAM;QACf,MAAkC,CAAC,IAAI,KAAK,MAAM;QACnD,MAAM,IAAI,MAAM;QAChB,UAAU,IAAI,MAAM,CACrB,CAAC;AACJ,CAAC"}