@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.
- package/dist/chunk-7MILGDAA.js +2191 -0
- package/dist/chunk-7RNT4O5T.js +15198 -0
- package/dist/chunk-AGFOJCSB.js +2191 -0
- package/dist/chunk-F4GSFCM3.js +898 -0
- package/dist/chunk-GWUIYH7I.js +15035 -0
- package/dist/chunk-PZA7YOJE.js +898 -0
- package/dist/chunk-Q3V7VZFQ.js +2191 -0
- package/dist/chunk-RRFB6G6M.js +15198 -0
- package/dist/chunk-VX3VFMVB.js +409 -0
- package/dist/chunk-WRPZCOWC.js +898 -0
- package/dist/cli.js +1 -1
- package/dist/dashboard/pages/agent-detail.js +313 -1
- package/dist/index.js +3 -3
- package/dist/pw-ai-KPETTB25.js +2212 -0
- package/dist/routes-PDHMCIXU.js +6676 -0
- package/dist/runtime-7HW4GX5L.js +48 -0
- package/dist/runtime-GYVO3NF3.js +47 -0
- package/dist/runtime-XXDCZZIK.js +48 -0
- package/dist/server-FMP4BFGW.js +12 -0
- package/dist/server-JRHDUNII.js +12 -0
- package/dist/server-VNW6G4GB.js +12 -0
- package/dist/setup-AANLREEL.js +20 -0
- package/dist/setup-O5FPRLK4.js +20 -0
- package/dist/setup-S4Z4PPIJ.js +20 -0
- package/package.json +15 -2
- package/src/agent-tools/common.ts +25 -0
- package/src/agent-tools/index.ts +4 -0
- package/src/agent-tools/schema/typebox.ts +25 -0
- package/src/agent-tools/tools/browser-tool.schema.ts +112 -0
- package/src/agent-tools/tools/browser-tool.ts +388 -0
- package/src/agent-tools/tools/gateway.ts +126 -0
- package/src/agent-tools/tools/nodes-utils.ts +80 -0
- package/src/browser/bridge-auth-registry.ts +34 -0
- package/src/browser/bridge-server.ts +93 -0
- package/src/browser/cdp.helpers.ts +180 -0
- package/src/browser/cdp.ts +466 -0
- package/src/browser/chrome.executables.ts +625 -0
- package/src/browser/chrome.profile-decoration.ts +198 -0
- package/src/browser/chrome.ts +349 -0
- package/src/browser/client-actions-core.ts +259 -0
- package/src/browser/client-actions-observe.ts +184 -0
- package/src/browser/client-actions-state.ts +284 -0
- package/src/browser/client-actions-types.ts +16 -0
- package/src/browser/client-actions-url.ts +11 -0
- package/src/browser/client-actions.ts +4 -0
- package/src/browser/client-fetch.ts +253 -0
- package/src/browser/client.ts +337 -0
- package/src/browser/config.ts +296 -0
- package/src/browser/constants.ts +8 -0
- package/src/browser/control-auth.ts +94 -0
- package/src/browser/control-service.ts +81 -0
- package/src/browser/csrf.ts +87 -0
- package/src/browser/enterprise-compat.ts +518 -0
- package/src/browser/extension-relay.ts +834 -0
- package/src/browser/http-auth.ts +63 -0
- package/src/browser/navigation-guard.ts +50 -0
- package/src/browser/paths.ts +49 -0
- package/src/browser/profiles-service.ts +187 -0
- package/src/browser/profiles.ts +113 -0
- package/src/browser/proxy-files.ts +41 -0
- package/src/browser/pw-ai-module.ts +52 -0
- package/src/browser/pw-ai-state.ts +9 -0
- package/src/browser/pw-ai.ts +65 -0
- package/src/browser/pw-role-snapshot.ts +434 -0
- package/src/browser/pw-session.ts +810 -0
- package/src/browser/pw-tools-core.activity.ts +68 -0
- package/src/browser/pw-tools-core.downloads.ts +281 -0
- package/src/browser/pw-tools-core.interactions.ts +646 -0
- package/src/browser/pw-tools-core.responses.ts +124 -0
- package/src/browser/pw-tools-core.shared.ts +70 -0
- package/src/browser/pw-tools-core.snapshot.ts +213 -0
- package/src/browser/pw-tools-core.state.ts +209 -0
- package/src/browser/pw-tools-core.storage.ts +128 -0
- package/src/browser/pw-tools-core.trace.ts +37 -0
- package/src/browser/pw-tools-core.ts +8 -0
- package/src/browser/resolved-config-refresh.ts +59 -0
- package/src/browser/routes/agent.act.shared.ts +52 -0
- package/src/browser/routes/agent.act.ts +575 -0
- package/src/browser/routes/agent.debug.ts +149 -0
- package/src/browser/routes/agent.shared.ts +143 -0
- package/src/browser/routes/agent.snapshot.ts +333 -0
- package/src/browser/routes/agent.storage.ts +451 -0
- package/src/browser/routes/agent.ts +13 -0
- package/src/browser/routes/basic.ts +202 -0
- package/src/browser/routes/dispatcher.ts +126 -0
- package/src/browser/routes/index.ts +11 -0
- package/src/browser/routes/path-output.ts +1 -0
- package/src/browser/routes/tabs.ts +217 -0
- package/src/browser/routes/types.ts +26 -0
- package/src/browser/routes/utils.ts +73 -0
- package/src/browser/screenshot.ts +54 -0
- package/src/browser/server-context.ts +688 -0
- package/src/browser/server-context.types.ts +65 -0
- package/src/browser/server-lifecycle.ts +48 -0
- package/src/browser/server-middleware.ts +37 -0
- package/src/browser/server.ts +110 -0
- package/src/browser/target-id.ts +30 -0
- package/src/browser/trash.ts +21 -0
- package/src/dashboard/pages/agent-detail.js +313 -1
- package/src/engine/agent-routes.ts +46 -0
- package/src/security/external-content.ts +299 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentRuntime,
|
|
3
|
+
EmailChannel,
|
|
4
|
+
FollowUpScheduler,
|
|
5
|
+
SessionManager,
|
|
6
|
+
SubAgentManager,
|
|
7
|
+
ToolRegistry,
|
|
8
|
+
callLLM,
|
|
9
|
+
createAgentRuntime,
|
|
10
|
+
createNoopHooks,
|
|
11
|
+
createRuntimeHooks,
|
|
12
|
+
estimateMessageTokens,
|
|
13
|
+
estimateTokens,
|
|
14
|
+
executeTool,
|
|
15
|
+
runAgentLoop,
|
|
16
|
+
toolsToDefinitions
|
|
17
|
+
} from "./chunk-7RNT4O5T.js";
|
|
18
|
+
import "./chunk-TYW5XTOW.js";
|
|
19
|
+
import "./chunk-VX3VFMVB.js";
|
|
20
|
+
import "./chunk-JLSQOQ5L.js";
|
|
21
|
+
import {
|
|
22
|
+
PROVIDER_REGISTRY,
|
|
23
|
+
listAllProviders,
|
|
24
|
+
resolveApiKeyForProvider,
|
|
25
|
+
resolveProvider
|
|
26
|
+
} from "./chunk-67KZYSLU.js";
|
|
27
|
+
import "./chunk-KFQGP6VL.js";
|
|
28
|
+
export {
|
|
29
|
+
AgentRuntime,
|
|
30
|
+
EmailChannel,
|
|
31
|
+
FollowUpScheduler,
|
|
32
|
+
PROVIDER_REGISTRY,
|
|
33
|
+
SessionManager,
|
|
34
|
+
SubAgentManager,
|
|
35
|
+
ToolRegistry,
|
|
36
|
+
callLLM,
|
|
37
|
+
createAgentRuntime,
|
|
38
|
+
createNoopHooks,
|
|
39
|
+
createRuntimeHooks,
|
|
40
|
+
estimateMessageTokens,
|
|
41
|
+
estimateTokens,
|
|
42
|
+
executeTool,
|
|
43
|
+
listAllProviders,
|
|
44
|
+
resolveApiKeyForProvider,
|
|
45
|
+
resolveProvider,
|
|
46
|
+
runAgentLoop,
|
|
47
|
+
toolsToDefinitions
|
|
48
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentRuntime,
|
|
3
|
+
EmailChannel,
|
|
4
|
+
FollowUpScheduler,
|
|
5
|
+
SessionManager,
|
|
6
|
+
SubAgentManager,
|
|
7
|
+
ToolRegistry,
|
|
8
|
+
callLLM,
|
|
9
|
+
createAgentRuntime,
|
|
10
|
+
createNoopHooks,
|
|
11
|
+
createRuntimeHooks,
|
|
12
|
+
estimateMessageTokens,
|
|
13
|
+
estimateTokens,
|
|
14
|
+
executeTool,
|
|
15
|
+
runAgentLoop,
|
|
16
|
+
toolsToDefinitions
|
|
17
|
+
} from "./chunk-GWUIYH7I.js";
|
|
18
|
+
import "./chunk-TYW5XTOW.js";
|
|
19
|
+
import "./chunk-JLSQOQ5L.js";
|
|
20
|
+
import {
|
|
21
|
+
PROVIDER_REGISTRY,
|
|
22
|
+
listAllProviders,
|
|
23
|
+
resolveApiKeyForProvider,
|
|
24
|
+
resolveProvider
|
|
25
|
+
} from "./chunk-67KZYSLU.js";
|
|
26
|
+
import "./chunk-KFQGP6VL.js";
|
|
27
|
+
export {
|
|
28
|
+
AgentRuntime,
|
|
29
|
+
EmailChannel,
|
|
30
|
+
FollowUpScheduler,
|
|
31
|
+
PROVIDER_REGISTRY,
|
|
32
|
+
SessionManager,
|
|
33
|
+
SubAgentManager,
|
|
34
|
+
ToolRegistry,
|
|
35
|
+
callLLM,
|
|
36
|
+
createAgentRuntime,
|
|
37
|
+
createNoopHooks,
|
|
38
|
+
createRuntimeHooks,
|
|
39
|
+
estimateMessageTokens,
|
|
40
|
+
estimateTokens,
|
|
41
|
+
executeTool,
|
|
42
|
+
listAllProviders,
|
|
43
|
+
resolveApiKeyForProvider,
|
|
44
|
+
resolveProvider,
|
|
45
|
+
runAgentLoop,
|
|
46
|
+
toolsToDefinitions
|
|
47
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentRuntime,
|
|
3
|
+
EmailChannel,
|
|
4
|
+
FollowUpScheduler,
|
|
5
|
+
SessionManager,
|
|
6
|
+
SubAgentManager,
|
|
7
|
+
ToolRegistry,
|
|
8
|
+
callLLM,
|
|
9
|
+
createAgentRuntime,
|
|
10
|
+
createNoopHooks,
|
|
11
|
+
createRuntimeHooks,
|
|
12
|
+
estimateMessageTokens,
|
|
13
|
+
estimateTokens,
|
|
14
|
+
executeTool,
|
|
15
|
+
runAgentLoop,
|
|
16
|
+
toolsToDefinitions
|
|
17
|
+
} from "./chunk-RRFB6G6M.js";
|
|
18
|
+
import "./chunk-TYW5XTOW.js";
|
|
19
|
+
import "./chunk-VX3VFMVB.js";
|
|
20
|
+
import "./chunk-JLSQOQ5L.js";
|
|
21
|
+
import {
|
|
22
|
+
PROVIDER_REGISTRY,
|
|
23
|
+
listAllProviders,
|
|
24
|
+
resolveApiKeyForProvider,
|
|
25
|
+
resolveProvider
|
|
26
|
+
} from "./chunk-67KZYSLU.js";
|
|
27
|
+
import "./chunk-KFQGP6VL.js";
|
|
28
|
+
export {
|
|
29
|
+
AgentRuntime,
|
|
30
|
+
EmailChannel,
|
|
31
|
+
FollowUpScheduler,
|
|
32
|
+
PROVIDER_REGISTRY,
|
|
33
|
+
SessionManager,
|
|
34
|
+
SubAgentManager,
|
|
35
|
+
ToolRegistry,
|
|
36
|
+
callLLM,
|
|
37
|
+
createAgentRuntime,
|
|
38
|
+
createNoopHooks,
|
|
39
|
+
createRuntimeHooks,
|
|
40
|
+
estimateMessageTokens,
|
|
41
|
+
estimateTokens,
|
|
42
|
+
executeTool,
|
|
43
|
+
listAllProviders,
|
|
44
|
+
resolveApiKeyForProvider,
|
|
45
|
+
resolveProvider,
|
|
46
|
+
runAgentLoop,
|
|
47
|
+
toolsToDefinitions
|
|
48
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServer
|
|
3
|
+
} from "./chunk-Q3V7VZFQ.js";
|
|
4
|
+
import "./chunk-3SMTCIR4.js";
|
|
5
|
+
import "./chunk-JLSQOQ5L.js";
|
|
6
|
+
import "./chunk-RO537U6H.js";
|
|
7
|
+
import "./chunk-DRXMYYKN.js";
|
|
8
|
+
import "./chunk-67KZYSLU.js";
|
|
9
|
+
import "./chunk-KFQGP6VL.js";
|
|
10
|
+
export {
|
|
11
|
+
createServer
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServer
|
|
3
|
+
} from "./chunk-AGFOJCSB.js";
|
|
4
|
+
import "./chunk-3SMTCIR4.js";
|
|
5
|
+
import "./chunk-JLSQOQ5L.js";
|
|
6
|
+
import "./chunk-RO537U6H.js";
|
|
7
|
+
import "./chunk-DRXMYYKN.js";
|
|
8
|
+
import "./chunk-67KZYSLU.js";
|
|
9
|
+
import "./chunk-KFQGP6VL.js";
|
|
10
|
+
export {
|
|
11
|
+
createServer
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServer
|
|
3
|
+
} from "./chunk-7MILGDAA.js";
|
|
4
|
+
import "./chunk-3SMTCIR4.js";
|
|
5
|
+
import "./chunk-JLSQOQ5L.js";
|
|
6
|
+
import "./chunk-RO537U6H.js";
|
|
7
|
+
import "./chunk-DRXMYYKN.js";
|
|
8
|
+
import "./chunk-67KZYSLU.js";
|
|
9
|
+
import "./chunk-KFQGP6VL.js";
|
|
10
|
+
export {
|
|
11
|
+
createServer
|
|
12
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-WRPZCOWC.js";
|
|
10
|
+
import "./chunk-QDXUZP7Y.js";
|
|
11
|
+
import "./chunk-KFQGP6VL.js";
|
|
12
|
+
export {
|
|
13
|
+
promptCompanyInfo,
|
|
14
|
+
promptDatabase,
|
|
15
|
+
promptDeployment,
|
|
16
|
+
promptDomain,
|
|
17
|
+
promptRegistration,
|
|
18
|
+
provision,
|
|
19
|
+
runSetupWizard
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-F4GSFCM3.js";
|
|
10
|
+
import "./chunk-QDXUZP7Y.js";
|
|
11
|
+
import "./chunk-KFQGP6VL.js";
|
|
12
|
+
export {
|
|
13
|
+
promptCompanyInfo,
|
|
14
|
+
promptDatabase,
|
|
15
|
+
promptDeployment,
|
|
16
|
+
promptDomain,
|
|
17
|
+
promptRegistration,
|
|
18
|
+
provision,
|
|
19
|
+
runSetupWizard
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-PZA7YOJE.js";
|
|
10
|
+
import "./chunk-QDXUZP7Y.js";
|
|
11
|
+
import "./chunk-KFQGP6VL.js";
|
|
12
|
+
export {
|
|
13
|
+
promptCompanyInfo,
|
|
14
|
+
promptDatabase,
|
|
15
|
+
promptDeployment,
|
|
16
|
+
promptDomain,
|
|
17
|
+
promptRegistration,
|
|
18
|
+
provision,
|
|
19
|
+
runSetupWizard
|
|
20
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agenticmail/enterprise",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.80",
|
|
4
4
|
"description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "tsup src/index.ts src/cli.ts src/registry/cli.ts --format esm --external better-sqlite3 --external mongodb --external mysql2 --external @libsql/client --external @aws-sdk/client-dynamodb --external @aws-sdk/lib-dynamodb --external @aws-sdk/client-s3 --external @aws-sdk/s3-request-presigner --external @google-cloud/storage --external @azure/storage-blob --external @mozilla/readability --external imapflow --external nodemailer --external linkedom --external postgres && mkdir -p dist/dashboard/components dist/dashboard/pages dist/dashboard/vendor dist/dashboard/assets dist/registry && cp src/dashboard/index.html dist/dashboard/ && cp src/dashboard/app.js dist/dashboard/ && cp src/dashboard/components/*.js dist/dashboard/components/ && cp src/dashboard/pages/*.js dist/dashboard/pages/ && cp src/dashboard/vendor/*.js dist/dashboard/vendor/ && cp -r src/dashboard/assets/* dist/dashboard/assets/ && cp src/engine/soul-templates.json dist/",
|
|
19
|
+
"build": "tsup src/index.ts src/cli.ts src/registry/cli.ts --format esm --external better-sqlite3 --external mongodb --external mysql2 --external @libsql/client --external @aws-sdk/client-dynamodb --external @aws-sdk/lib-dynamodb --external @aws-sdk/client-s3 --external @aws-sdk/s3-request-presigner --external @google-cloud/storage --external @azure/storage-blob --external @mozilla/readability --external imapflow --external nodemailer --external linkedom --external postgres --external playwright-core --external ws --external express && mkdir -p dist/dashboard/components dist/dashboard/pages dist/dashboard/vendor dist/dashboard/assets dist/registry && cp src/dashboard/index.html dist/dashboard/ && cp src/dashboard/app.js dist/dashboard/ && cp src/dashboard/components/*.js dist/dashboard/components/ && cp src/dashboard/pages/*.js dist/dashboard/pages/ && cp src/dashboard/vendor/*.js dist/dashboard/vendor/ && cp -r src/dashboard/assets/* dist/dashboard/assets/ && cp src/engine/soul-templates.json dist/",
|
|
20
20
|
"dev": "npm run build && node --watch start-live.mjs",
|
|
21
21
|
"rebuild": "npm run build && pm2 restart enterprise"
|
|
22
22
|
},
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"@anthropic-ai/sdk": "^0.73.0",
|
|
45
45
|
"@hono/node-server": "^1.19.9",
|
|
46
46
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
47
|
+
"@sinclair/typebox": "^0.34.48",
|
|
47
48
|
"bcryptjs": "^2.4.3",
|
|
48
49
|
"chalk": "^5.0.0",
|
|
49
50
|
"hono": "^4.0.0",
|
|
@@ -59,5 +60,17 @@
|
|
|
59
60
|
"@types/node": "^22.0.0",
|
|
60
61
|
"tsup": "^8.0.0",
|
|
61
62
|
"typescript": "^5.0.0"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"playwright-core": ">=1.40.0",
|
|
66
|
+
"ws": ">=8.0.0"
|
|
67
|
+
},
|
|
68
|
+
"peerDependenciesMeta": {
|
|
69
|
+
"playwright-core": {
|
|
70
|
+
"optional": true
|
|
71
|
+
},
|
|
72
|
+
"ws": {
|
|
73
|
+
"optional": true
|
|
74
|
+
}
|
|
62
75
|
}
|
|
63
76
|
}
|
|
@@ -230,3 +230,28 @@ export function redactSecrets(
|
|
|
230
230
|
}
|
|
231
231
|
return result;
|
|
232
232
|
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Create an image result from a file path.
|
|
236
|
+
* Reads the file, detects mime type, and wraps in a tool result.
|
|
237
|
+
*/
|
|
238
|
+
export async function imageResultFromFile(params: {
|
|
239
|
+
label: string;
|
|
240
|
+
path: string;
|
|
241
|
+
extraText?: string;
|
|
242
|
+
details?: Record<string, unknown>;
|
|
243
|
+
}): Promise<ToolResult<unknown>> {
|
|
244
|
+
const fs = await import('node:fs/promises');
|
|
245
|
+
const buf = await fs.readFile(params.path);
|
|
246
|
+
const ext = params.path.split('.').pop()?.toLowerCase();
|
|
247
|
+
const mimeMap: Record<string, string> = { png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', gif: 'image/gif', webp: 'image/webp', svg: 'image/svg+xml' };
|
|
248
|
+
const mimeType = mimeMap[ext || ''] || 'image/png';
|
|
249
|
+
return imageResult({
|
|
250
|
+
label: params.label,
|
|
251
|
+
path: params.path,
|
|
252
|
+
base64: buf.toString('base64'),
|
|
253
|
+
mimeType,
|
|
254
|
+
extraText: params.extraText,
|
|
255
|
+
details: params.details,
|
|
256
|
+
});
|
|
257
|
+
}
|
package/src/agent-tools/index.ts
CHANGED
|
@@ -99,6 +99,9 @@ export { createGrepTool } from './tools/grep.js';
|
|
|
99
99
|
export { createWebFetchTool, fetchFirecrawlContent, extractReadableContent } from './tools/web-fetch.js';
|
|
100
100
|
export { createWebSearchTool } from './tools/web-search.js';
|
|
101
101
|
export { createBrowserTool } from './tools/browser.js';
|
|
102
|
+
// Enterprise browser tool — lazy import to avoid pulling in ws/playwright at module load time
|
|
103
|
+
// Use: const { createEnterpriseBrowserTool } = await import('@agenticmail/enterprise/browser-tool');
|
|
104
|
+
export type { EnterpriseBrowserToolConfig } from './tools/browser-tool.js';
|
|
102
105
|
export { createMemoryTool } from './tools/memory.js';
|
|
103
106
|
|
|
104
107
|
// --- Tool creators (agenticmail) ---
|
|
@@ -150,6 +153,7 @@ import { createGrepTool } from './tools/grep.js';
|
|
|
150
153
|
import { createWebFetchTool } from './tools/web-fetch.js';
|
|
151
154
|
import { createWebSearchTool } from './tools/web-search.js';
|
|
152
155
|
import { createBrowserTool } from './tools/browser.js';
|
|
156
|
+
// createEnterpriseBrowserTool is lazy-loaded — not imported at startup
|
|
153
157
|
import { createMemoryTool } from './tools/memory.js';
|
|
154
158
|
|
|
155
159
|
// Enterprise tool creators
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
|
|
3
|
+
type StringEnumOptions<T extends readonly string[]> = {
|
|
4
|
+
description?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
default?: T[number];
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export function stringEnum<T extends readonly string[]>(
|
|
10
|
+
values: T,
|
|
11
|
+
options: StringEnumOptions<T> = {},
|
|
12
|
+
) {
|
|
13
|
+
return Type.Unsafe<T[number]>({
|
|
14
|
+
type: "string",
|
|
15
|
+
enum: [...values],
|
|
16
|
+
...options,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function optionalStringEnum<T extends readonly string[]>(
|
|
21
|
+
values: T,
|
|
22
|
+
options: StringEnumOptions<T> = {},
|
|
23
|
+
) {
|
|
24
|
+
return Type.Optional(stringEnum(values, options));
|
|
25
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { optionalStringEnum, stringEnum } from "../schema/typebox.js";
|
|
3
|
+
|
|
4
|
+
const BROWSER_ACT_KINDS = [
|
|
5
|
+
"click",
|
|
6
|
+
"type",
|
|
7
|
+
"press",
|
|
8
|
+
"hover",
|
|
9
|
+
"drag",
|
|
10
|
+
"select",
|
|
11
|
+
"fill",
|
|
12
|
+
"resize",
|
|
13
|
+
"wait",
|
|
14
|
+
"evaluate",
|
|
15
|
+
"close",
|
|
16
|
+
] as const;
|
|
17
|
+
|
|
18
|
+
const BROWSER_TOOL_ACTIONS = [
|
|
19
|
+
"status",
|
|
20
|
+
"start",
|
|
21
|
+
"stop",
|
|
22
|
+
"profiles",
|
|
23
|
+
"tabs",
|
|
24
|
+
"open",
|
|
25
|
+
"focus",
|
|
26
|
+
"close",
|
|
27
|
+
"snapshot",
|
|
28
|
+
"screenshot",
|
|
29
|
+
"navigate",
|
|
30
|
+
"console",
|
|
31
|
+
"pdf",
|
|
32
|
+
"upload",
|
|
33
|
+
"dialog",
|
|
34
|
+
"act",
|
|
35
|
+
] as const;
|
|
36
|
+
|
|
37
|
+
const BROWSER_TARGETS = ["sandbox", "host", "node"] as const;
|
|
38
|
+
|
|
39
|
+
const BROWSER_SNAPSHOT_FORMATS = ["aria", "ai"] as const;
|
|
40
|
+
const BROWSER_SNAPSHOT_MODES = ["efficient"] as const;
|
|
41
|
+
const BROWSER_SNAPSHOT_REFS = ["role", "aria"] as const;
|
|
42
|
+
|
|
43
|
+
const BROWSER_IMAGE_TYPES = ["png", "jpeg"] as const;
|
|
44
|
+
|
|
45
|
+
// NOTE: Using a flattened object schema instead of Type.Union([Type.Object(...), ...])
|
|
46
|
+
// because Claude API on Vertex AI rejects nested anyOf schemas as invalid JSON Schema.
|
|
47
|
+
// The discriminator (kind) determines which properties are relevant; runtime validates.
|
|
48
|
+
const BrowserActSchema = Type.Object({
|
|
49
|
+
kind: stringEnum(BROWSER_ACT_KINDS),
|
|
50
|
+
// Common fields
|
|
51
|
+
targetId: Type.Optional(Type.String()),
|
|
52
|
+
ref: Type.Optional(Type.String()),
|
|
53
|
+
// click
|
|
54
|
+
doubleClick: Type.Optional(Type.Boolean()),
|
|
55
|
+
button: Type.Optional(Type.String()),
|
|
56
|
+
modifiers: Type.Optional(Type.Array(Type.String())),
|
|
57
|
+
// type
|
|
58
|
+
text: Type.Optional(Type.String()),
|
|
59
|
+
submit: Type.Optional(Type.Boolean()),
|
|
60
|
+
slowly: Type.Optional(Type.Boolean()),
|
|
61
|
+
// press
|
|
62
|
+
key: Type.Optional(Type.String()),
|
|
63
|
+
// drag
|
|
64
|
+
startRef: Type.Optional(Type.String()),
|
|
65
|
+
endRef: Type.Optional(Type.String()),
|
|
66
|
+
// select
|
|
67
|
+
values: Type.Optional(Type.Array(Type.String())),
|
|
68
|
+
// fill - use permissive array of objects
|
|
69
|
+
fields: Type.Optional(Type.Array(Type.Object({}, { additionalProperties: true }))),
|
|
70
|
+
// resize
|
|
71
|
+
width: Type.Optional(Type.Number()),
|
|
72
|
+
height: Type.Optional(Type.Number()),
|
|
73
|
+
// wait
|
|
74
|
+
timeMs: Type.Optional(Type.Number()),
|
|
75
|
+
textGone: Type.Optional(Type.String()),
|
|
76
|
+
// evaluate
|
|
77
|
+
fn: Type.Optional(Type.String()),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// IMPORTANT: OpenAI function tool schemas must have a top-level `type: "object"`.
|
|
81
|
+
// A root-level `Type.Union([...])` compiles to `{ anyOf: [...] }` (no `type`),
|
|
82
|
+
// which OpenAI rejects ("Invalid schema ... type: None"). Keep this schema an object.
|
|
83
|
+
export const BrowserToolSchema = Type.Object({
|
|
84
|
+
action: stringEnum(BROWSER_TOOL_ACTIONS),
|
|
85
|
+
target: optionalStringEnum(BROWSER_TARGETS),
|
|
86
|
+
node: Type.Optional(Type.String()),
|
|
87
|
+
profile: Type.Optional(Type.String()),
|
|
88
|
+
targetUrl: Type.Optional(Type.String()),
|
|
89
|
+
targetId: Type.Optional(Type.String()),
|
|
90
|
+
limit: Type.Optional(Type.Number()),
|
|
91
|
+
maxChars: Type.Optional(Type.Number()),
|
|
92
|
+
mode: optionalStringEnum(BROWSER_SNAPSHOT_MODES),
|
|
93
|
+
snapshotFormat: optionalStringEnum(BROWSER_SNAPSHOT_FORMATS),
|
|
94
|
+
refs: optionalStringEnum(BROWSER_SNAPSHOT_REFS),
|
|
95
|
+
interactive: Type.Optional(Type.Boolean()),
|
|
96
|
+
compact: Type.Optional(Type.Boolean()),
|
|
97
|
+
depth: Type.Optional(Type.Number()),
|
|
98
|
+
selector: Type.Optional(Type.String()),
|
|
99
|
+
frame: Type.Optional(Type.String()),
|
|
100
|
+
labels: Type.Optional(Type.Boolean()),
|
|
101
|
+
fullPage: Type.Optional(Type.Boolean()),
|
|
102
|
+
ref: Type.Optional(Type.String()),
|
|
103
|
+
element: Type.Optional(Type.String()),
|
|
104
|
+
type: optionalStringEnum(BROWSER_IMAGE_TYPES),
|
|
105
|
+
level: Type.Optional(Type.String()),
|
|
106
|
+
paths: Type.Optional(Type.Array(Type.String())),
|
|
107
|
+
inputRef: Type.Optional(Type.String()),
|
|
108
|
+
timeoutMs: Type.Optional(Type.Number()),
|
|
109
|
+
accept: Type.Optional(Type.Boolean()),
|
|
110
|
+
promptText: Type.Optional(Type.String()),
|
|
111
|
+
request: Type.Optional(BrowserActSchema),
|
|
112
|
+
});
|