@agenticmail/enterprise 0.5.78 → 0.5.80

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 (101) hide show
  1. package/dist/chunk-7MILGDAA.js +2191 -0
  2. package/dist/chunk-7RNT4O5T.js +15198 -0
  3. package/dist/chunk-AGFOJCSB.js +2191 -0
  4. package/dist/chunk-F4GSFCM3.js +898 -0
  5. package/dist/chunk-GWUIYH7I.js +15035 -0
  6. package/dist/chunk-PZA7YOJE.js +898 -0
  7. package/dist/chunk-Q3V7VZFQ.js +2191 -0
  8. package/dist/chunk-RRFB6G6M.js +15198 -0
  9. package/dist/chunk-VX3VFMVB.js +409 -0
  10. package/dist/chunk-WRPZCOWC.js +898 -0
  11. package/dist/cli.js +1 -1
  12. package/dist/dashboard/pages/agent-detail.js +313 -1
  13. package/dist/index.js +3 -3
  14. package/dist/pw-ai-KPETTB25.js +2212 -0
  15. package/dist/routes-PDHMCIXU.js +6676 -0
  16. package/dist/runtime-7HW4GX5L.js +48 -0
  17. package/dist/runtime-GYVO3NF3.js +47 -0
  18. package/dist/runtime-XXDCZZIK.js +48 -0
  19. package/dist/server-FMP4BFGW.js +12 -0
  20. package/dist/server-JRHDUNII.js +12 -0
  21. package/dist/server-VNW6G4GB.js +12 -0
  22. package/dist/setup-AANLREEL.js +20 -0
  23. package/dist/setup-O5FPRLK4.js +20 -0
  24. package/dist/setup-S4Z4PPIJ.js +20 -0
  25. package/package.json +15 -2
  26. package/src/agent-tools/common.ts +25 -0
  27. package/src/agent-tools/index.ts +4 -0
  28. package/src/agent-tools/schema/typebox.ts +25 -0
  29. package/src/agent-tools/tools/browser-tool.schema.ts +112 -0
  30. package/src/agent-tools/tools/browser-tool.ts +388 -0
  31. package/src/agent-tools/tools/gateway.ts +126 -0
  32. package/src/agent-tools/tools/nodes-utils.ts +80 -0
  33. package/src/browser/bridge-auth-registry.ts +34 -0
  34. package/src/browser/bridge-server.ts +93 -0
  35. package/src/browser/cdp.helpers.ts +180 -0
  36. package/src/browser/cdp.ts +466 -0
  37. package/src/browser/chrome.executables.ts +625 -0
  38. package/src/browser/chrome.profile-decoration.ts +198 -0
  39. package/src/browser/chrome.ts +349 -0
  40. package/src/browser/client-actions-core.ts +259 -0
  41. package/src/browser/client-actions-observe.ts +184 -0
  42. package/src/browser/client-actions-state.ts +284 -0
  43. package/src/browser/client-actions-types.ts +16 -0
  44. package/src/browser/client-actions-url.ts +11 -0
  45. package/src/browser/client-actions.ts +4 -0
  46. package/src/browser/client-fetch.ts +253 -0
  47. package/src/browser/client.ts +337 -0
  48. package/src/browser/config.ts +296 -0
  49. package/src/browser/constants.ts +8 -0
  50. package/src/browser/control-auth.ts +94 -0
  51. package/src/browser/control-service.ts +81 -0
  52. package/src/browser/csrf.ts +87 -0
  53. package/src/browser/enterprise-compat.ts +518 -0
  54. package/src/browser/extension-relay.ts +834 -0
  55. package/src/browser/http-auth.ts +63 -0
  56. package/src/browser/navigation-guard.ts +50 -0
  57. package/src/browser/paths.ts +49 -0
  58. package/src/browser/profiles-service.ts +187 -0
  59. package/src/browser/profiles.ts +113 -0
  60. package/src/browser/proxy-files.ts +41 -0
  61. package/src/browser/pw-ai-module.ts +52 -0
  62. package/src/browser/pw-ai-state.ts +9 -0
  63. package/src/browser/pw-ai.ts +65 -0
  64. package/src/browser/pw-role-snapshot.ts +434 -0
  65. package/src/browser/pw-session.ts +810 -0
  66. package/src/browser/pw-tools-core.activity.ts +68 -0
  67. package/src/browser/pw-tools-core.downloads.ts +281 -0
  68. package/src/browser/pw-tools-core.interactions.ts +646 -0
  69. package/src/browser/pw-tools-core.responses.ts +124 -0
  70. package/src/browser/pw-tools-core.shared.ts +70 -0
  71. package/src/browser/pw-tools-core.snapshot.ts +213 -0
  72. package/src/browser/pw-tools-core.state.ts +209 -0
  73. package/src/browser/pw-tools-core.storage.ts +128 -0
  74. package/src/browser/pw-tools-core.trace.ts +37 -0
  75. package/src/browser/pw-tools-core.ts +8 -0
  76. package/src/browser/resolved-config-refresh.ts +59 -0
  77. package/src/browser/routes/agent.act.shared.ts +52 -0
  78. package/src/browser/routes/agent.act.ts +575 -0
  79. package/src/browser/routes/agent.debug.ts +149 -0
  80. package/src/browser/routes/agent.shared.ts +143 -0
  81. package/src/browser/routes/agent.snapshot.ts +333 -0
  82. package/src/browser/routes/agent.storage.ts +451 -0
  83. package/src/browser/routes/agent.ts +13 -0
  84. package/src/browser/routes/basic.ts +202 -0
  85. package/src/browser/routes/dispatcher.ts +126 -0
  86. package/src/browser/routes/index.ts +11 -0
  87. package/src/browser/routes/path-output.ts +1 -0
  88. package/src/browser/routes/tabs.ts +217 -0
  89. package/src/browser/routes/types.ts +26 -0
  90. package/src/browser/routes/utils.ts +73 -0
  91. package/src/browser/screenshot.ts +54 -0
  92. package/src/browser/server-context.ts +688 -0
  93. package/src/browser/server-context.types.ts +65 -0
  94. package/src/browser/server-lifecycle.ts +48 -0
  95. package/src/browser/server-middleware.ts +37 -0
  96. package/src/browser/server.ts +110 -0
  97. package/src/browser/target-id.ts +30 -0
  98. package/src/browser/trash.ts +21 -0
  99. package/src/dashboard/pages/agent-detail.js +313 -1
  100. package/src/engine/agent-routes.ts +46 -0
  101. package/src/security/external-content.ts +299 -0
@@ -0,0 +1,259 @@
1
+ import type {
2
+ BrowserActionOk,
3
+ BrowserActionPathResult,
4
+ BrowserActionTabResult,
5
+ } from "./client-actions-types.js";
6
+ import { buildProfileQuery, withBaseUrl } from "./client-actions-url.js";
7
+ import { fetchBrowserJson } from "./client-fetch.js";
8
+
9
+ export type BrowserFormField = {
10
+ ref: string;
11
+ type: string;
12
+ value?: string | number | boolean;
13
+ };
14
+
15
+ export type BrowserActRequest =
16
+ | {
17
+ kind: "click";
18
+ ref: string;
19
+ targetId?: string;
20
+ doubleClick?: boolean;
21
+ button?: string;
22
+ modifiers?: string[];
23
+ timeoutMs?: number;
24
+ }
25
+ | {
26
+ kind: "type";
27
+ ref: string;
28
+ text: string;
29
+ targetId?: string;
30
+ submit?: boolean;
31
+ slowly?: boolean;
32
+ timeoutMs?: number;
33
+ }
34
+ | { kind: "press"; key: string; targetId?: string; delayMs?: number }
35
+ | { kind: "hover"; ref: string; targetId?: string; timeoutMs?: number }
36
+ | {
37
+ kind: "scrollIntoView";
38
+ ref: string;
39
+ targetId?: string;
40
+ timeoutMs?: number;
41
+ }
42
+ | {
43
+ kind: "drag";
44
+ startRef: string;
45
+ endRef: string;
46
+ targetId?: string;
47
+ timeoutMs?: number;
48
+ }
49
+ | {
50
+ kind: "select";
51
+ ref: string;
52
+ values: string[];
53
+ targetId?: string;
54
+ timeoutMs?: number;
55
+ }
56
+ | {
57
+ kind: "fill";
58
+ fields: BrowserFormField[];
59
+ targetId?: string;
60
+ timeoutMs?: number;
61
+ }
62
+ | { kind: "resize"; width: number; height: number; targetId?: string }
63
+ | {
64
+ kind: "wait";
65
+ timeMs?: number;
66
+ text?: string;
67
+ textGone?: string;
68
+ selector?: string;
69
+ url?: string;
70
+ loadState?: "load" | "domcontentloaded" | "networkidle";
71
+ fn?: string;
72
+ targetId?: string;
73
+ timeoutMs?: number;
74
+ }
75
+ | { kind: "evaluate"; fn: string; ref?: string; targetId?: string; timeoutMs?: number }
76
+ | { kind: "close"; targetId?: string };
77
+
78
+ export type BrowserActResponse = {
79
+ ok: true;
80
+ targetId: string;
81
+ url?: string;
82
+ result?: unknown;
83
+ };
84
+
85
+ export type BrowserDownloadPayload = {
86
+ url: string;
87
+ suggestedFilename: string;
88
+ path: string;
89
+ };
90
+
91
+ type BrowserDownloadResult = { ok: true; targetId: string; download: BrowserDownloadPayload };
92
+
93
+ async function postDownloadRequest(
94
+ baseUrl: string | undefined,
95
+ route: "/wait/download" | "/download",
96
+ body: Record<string, unknown>,
97
+ profile?: string,
98
+ ): Promise<BrowserDownloadResult> {
99
+ const q = buildProfileQuery(profile);
100
+ return await fetchBrowserJson<BrowserDownloadResult>(withBaseUrl(baseUrl, `${route}${q}`), {
101
+ method: "POST",
102
+ headers: { "Content-Type": "application/json" },
103
+ body: JSON.stringify(body),
104
+ timeoutMs: 20000,
105
+ });
106
+ }
107
+
108
+ export async function browserNavigate(
109
+ baseUrl: string | undefined,
110
+ opts: {
111
+ url: string;
112
+ targetId?: string;
113
+ profile?: string;
114
+ },
115
+ ): Promise<BrowserActionTabResult> {
116
+ const q = buildProfileQuery(opts.profile);
117
+ return await fetchBrowserJson<BrowserActionTabResult>(withBaseUrl(baseUrl, `/navigate${q}`), {
118
+ method: "POST",
119
+ headers: { "Content-Type": "application/json" },
120
+ body: JSON.stringify({ url: opts.url, targetId: opts.targetId }),
121
+ timeoutMs: 20000,
122
+ });
123
+ }
124
+
125
+ export async function browserArmDialog(
126
+ baseUrl: string | undefined,
127
+ opts: {
128
+ accept: boolean;
129
+ promptText?: string;
130
+ targetId?: string;
131
+ timeoutMs?: number;
132
+ profile?: string;
133
+ },
134
+ ): Promise<BrowserActionOk> {
135
+ const q = buildProfileQuery(opts.profile);
136
+ return await fetchBrowserJson<BrowserActionOk>(withBaseUrl(baseUrl, `/hooks/dialog${q}`), {
137
+ method: "POST",
138
+ headers: { "Content-Type": "application/json" },
139
+ body: JSON.stringify({
140
+ accept: opts.accept,
141
+ promptText: opts.promptText,
142
+ targetId: opts.targetId,
143
+ timeoutMs: opts.timeoutMs,
144
+ }),
145
+ timeoutMs: 20000,
146
+ });
147
+ }
148
+
149
+ export async function browserArmFileChooser(
150
+ baseUrl: string | undefined,
151
+ opts: {
152
+ paths: string[];
153
+ ref?: string;
154
+ inputRef?: string;
155
+ element?: string;
156
+ targetId?: string;
157
+ timeoutMs?: number;
158
+ profile?: string;
159
+ },
160
+ ): Promise<BrowserActionOk> {
161
+ const q = buildProfileQuery(opts.profile);
162
+ return await fetchBrowserJson<BrowserActionOk>(withBaseUrl(baseUrl, `/hooks/file-chooser${q}`), {
163
+ method: "POST",
164
+ headers: { "Content-Type": "application/json" },
165
+ body: JSON.stringify({
166
+ paths: opts.paths,
167
+ ref: opts.ref,
168
+ inputRef: opts.inputRef,
169
+ element: opts.element,
170
+ targetId: opts.targetId,
171
+ timeoutMs: opts.timeoutMs,
172
+ }),
173
+ timeoutMs: 20000,
174
+ });
175
+ }
176
+
177
+ export async function browserWaitForDownload(
178
+ baseUrl: string | undefined,
179
+ opts: {
180
+ path?: string;
181
+ targetId?: string;
182
+ timeoutMs?: number;
183
+ profile?: string;
184
+ },
185
+ ): Promise<BrowserDownloadResult> {
186
+ return await postDownloadRequest(
187
+ baseUrl,
188
+ "/wait/download",
189
+ {
190
+ targetId: opts.targetId,
191
+ path: opts.path,
192
+ timeoutMs: opts.timeoutMs,
193
+ },
194
+ opts.profile,
195
+ );
196
+ }
197
+
198
+ export async function browserDownload(
199
+ baseUrl: string | undefined,
200
+ opts: {
201
+ ref: string;
202
+ path: string;
203
+ targetId?: string;
204
+ timeoutMs?: number;
205
+ profile?: string;
206
+ },
207
+ ): Promise<BrowserDownloadResult> {
208
+ return await postDownloadRequest(
209
+ baseUrl,
210
+ "/download",
211
+ {
212
+ targetId: opts.targetId,
213
+ ref: opts.ref,
214
+ path: opts.path,
215
+ timeoutMs: opts.timeoutMs,
216
+ },
217
+ opts.profile,
218
+ );
219
+ }
220
+
221
+ export async function browserAct(
222
+ baseUrl: string | undefined,
223
+ req: BrowserActRequest,
224
+ opts?: { profile?: string },
225
+ ): Promise<BrowserActResponse> {
226
+ const q = buildProfileQuery(opts?.profile);
227
+ return await fetchBrowserJson<BrowserActResponse>(withBaseUrl(baseUrl, `/act${q}`), {
228
+ method: "POST",
229
+ headers: { "Content-Type": "application/json" },
230
+ body: JSON.stringify(req),
231
+ timeoutMs: 20000,
232
+ });
233
+ }
234
+
235
+ export async function browserScreenshotAction(
236
+ baseUrl: string | undefined,
237
+ opts: {
238
+ targetId?: string;
239
+ fullPage?: boolean;
240
+ ref?: string;
241
+ element?: string;
242
+ type?: "png" | "jpeg";
243
+ profile?: string;
244
+ },
245
+ ): Promise<BrowserActionPathResult> {
246
+ const q = buildProfileQuery(opts.profile);
247
+ return await fetchBrowserJson<BrowserActionPathResult>(withBaseUrl(baseUrl, `/screenshot${q}`), {
248
+ method: "POST",
249
+ headers: { "Content-Type": "application/json" },
250
+ body: JSON.stringify({
251
+ targetId: opts.targetId,
252
+ fullPage: opts.fullPage,
253
+ ref: opts.ref,
254
+ element: opts.element,
255
+ type: opts.type,
256
+ }),
257
+ timeoutMs: 20000,
258
+ });
259
+ }
@@ -0,0 +1,184 @@
1
+ import type { BrowserActionPathResult, BrowserActionTargetOk } from "./client-actions-types.js";
2
+ import { buildProfileQuery, withBaseUrl } from "./client-actions-url.js";
3
+ import { fetchBrowserJson } from "./client-fetch.js";
4
+ import type {
5
+ BrowserConsoleMessage,
6
+ BrowserNetworkRequest,
7
+ BrowserPageError,
8
+ } from "./pw-session.js";
9
+
10
+ function buildQuerySuffix(params: Array<[string, string | boolean | undefined]>): string {
11
+ const query = new URLSearchParams();
12
+ for (const [key, value] of params) {
13
+ if (typeof value === "boolean") {
14
+ query.set(key, String(value));
15
+ continue;
16
+ }
17
+ if (typeof value === "string" && value.length > 0) {
18
+ query.set(key, value);
19
+ }
20
+ }
21
+ const encoded = query.toString();
22
+ return encoded.length > 0 ? `?${encoded}` : "";
23
+ }
24
+
25
+ export async function browserConsoleMessages(
26
+ baseUrl: string | undefined,
27
+ opts: { level?: string; targetId?: string; profile?: string } = {},
28
+ ): Promise<{ ok: true; messages: BrowserConsoleMessage[]; targetId: string }> {
29
+ const suffix = buildQuerySuffix([
30
+ ["level", opts.level],
31
+ ["targetId", opts.targetId],
32
+ ["profile", opts.profile],
33
+ ]);
34
+ return await fetchBrowserJson<{
35
+ ok: true;
36
+ messages: BrowserConsoleMessage[];
37
+ targetId: string;
38
+ }>(withBaseUrl(baseUrl, `/console${suffix}`), { timeoutMs: 20000 });
39
+ }
40
+
41
+ export async function browserPdfSave(
42
+ baseUrl: string | undefined,
43
+ opts: { targetId?: string; profile?: string } = {},
44
+ ): Promise<BrowserActionPathResult> {
45
+ const q = buildProfileQuery(opts.profile);
46
+ return await fetchBrowserJson<BrowserActionPathResult>(withBaseUrl(baseUrl, `/pdf${q}`), {
47
+ method: "POST",
48
+ headers: { "Content-Type": "application/json" },
49
+ body: JSON.stringify({ targetId: opts.targetId }),
50
+ timeoutMs: 20000,
51
+ });
52
+ }
53
+
54
+ export async function browserPageErrors(
55
+ baseUrl: string | undefined,
56
+ opts: { targetId?: string; clear?: boolean; profile?: string } = {},
57
+ ): Promise<{ ok: true; targetId: string; errors: BrowserPageError[] }> {
58
+ const suffix = buildQuerySuffix([
59
+ ["targetId", opts.targetId],
60
+ ["clear", typeof opts.clear === "boolean" ? opts.clear : undefined],
61
+ ["profile", opts.profile],
62
+ ]);
63
+ return await fetchBrowserJson<{
64
+ ok: true;
65
+ targetId: string;
66
+ errors: BrowserPageError[];
67
+ }>(withBaseUrl(baseUrl, `/errors${suffix}`), { timeoutMs: 20000 });
68
+ }
69
+
70
+ export async function browserRequests(
71
+ baseUrl: string | undefined,
72
+ opts: {
73
+ targetId?: string;
74
+ filter?: string;
75
+ clear?: boolean;
76
+ profile?: string;
77
+ } = {},
78
+ ): Promise<{ ok: true; targetId: string; requests: BrowserNetworkRequest[] }> {
79
+ const suffix = buildQuerySuffix([
80
+ ["targetId", opts.targetId],
81
+ ["filter", opts.filter],
82
+ ["clear", typeof opts.clear === "boolean" ? opts.clear : undefined],
83
+ ["profile", opts.profile],
84
+ ]);
85
+ return await fetchBrowserJson<{
86
+ ok: true;
87
+ targetId: string;
88
+ requests: BrowserNetworkRequest[];
89
+ }>(withBaseUrl(baseUrl, `/requests${suffix}`), { timeoutMs: 20000 });
90
+ }
91
+
92
+ export async function browserTraceStart(
93
+ baseUrl: string | undefined,
94
+ opts: {
95
+ targetId?: string;
96
+ screenshots?: boolean;
97
+ snapshots?: boolean;
98
+ sources?: boolean;
99
+ profile?: string;
100
+ } = {},
101
+ ): Promise<BrowserActionTargetOk> {
102
+ const q = buildProfileQuery(opts.profile);
103
+ return await fetchBrowserJson<BrowserActionTargetOk>(withBaseUrl(baseUrl, `/trace/start${q}`), {
104
+ method: "POST",
105
+ headers: { "Content-Type": "application/json" },
106
+ body: JSON.stringify({
107
+ targetId: opts.targetId,
108
+ screenshots: opts.screenshots,
109
+ snapshots: opts.snapshots,
110
+ sources: opts.sources,
111
+ }),
112
+ timeoutMs: 20000,
113
+ });
114
+ }
115
+
116
+ export async function browserTraceStop(
117
+ baseUrl: string | undefined,
118
+ opts: { targetId?: string; path?: string; profile?: string } = {},
119
+ ): Promise<BrowserActionPathResult> {
120
+ const q = buildProfileQuery(opts.profile);
121
+ return await fetchBrowserJson<BrowserActionPathResult>(withBaseUrl(baseUrl, `/trace/stop${q}`), {
122
+ method: "POST",
123
+ headers: { "Content-Type": "application/json" },
124
+ body: JSON.stringify({ targetId: opts.targetId, path: opts.path }),
125
+ timeoutMs: 20000,
126
+ });
127
+ }
128
+
129
+ export async function browserHighlight(
130
+ baseUrl: string | undefined,
131
+ opts: { ref: string; targetId?: string; profile?: string },
132
+ ): Promise<BrowserActionTargetOk> {
133
+ const q = buildProfileQuery(opts.profile);
134
+ return await fetchBrowserJson<BrowserActionTargetOk>(withBaseUrl(baseUrl, `/highlight${q}`), {
135
+ method: "POST",
136
+ headers: { "Content-Type": "application/json" },
137
+ body: JSON.stringify({ targetId: opts.targetId, ref: opts.ref }),
138
+ timeoutMs: 20000,
139
+ });
140
+ }
141
+
142
+ export async function browserResponseBody(
143
+ baseUrl: string | undefined,
144
+ opts: {
145
+ url: string;
146
+ targetId?: string;
147
+ timeoutMs?: number;
148
+ maxChars?: number;
149
+ profile?: string;
150
+ },
151
+ ): Promise<{
152
+ ok: true;
153
+ targetId: string;
154
+ response: {
155
+ url: string;
156
+ status?: number;
157
+ headers?: Record<string, string>;
158
+ body: string;
159
+ truncated?: boolean;
160
+ };
161
+ }> {
162
+ const q = buildProfileQuery(opts.profile);
163
+ return await fetchBrowserJson<{
164
+ ok: true;
165
+ targetId: string;
166
+ response: {
167
+ url: string;
168
+ status?: number;
169
+ headers?: Record<string, string>;
170
+ body: string;
171
+ truncated?: boolean;
172
+ };
173
+ }>(withBaseUrl(baseUrl, `/response/body${q}`), {
174
+ method: "POST",
175
+ headers: { "Content-Type": "application/json" },
176
+ body: JSON.stringify({
177
+ targetId: opts.targetId,
178
+ url: opts.url,
179
+ timeoutMs: opts.timeoutMs,
180
+ maxChars: opts.maxChars,
181
+ }),
182
+ timeoutMs: 20000,
183
+ });
184
+ }