@nuanu-ai/agentbrowse 0.2.0 → 0.2.2
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 +6 -3
- package/dist/agentpay-gateway.d.ts +1 -0
- package/dist/agentpay-gateway.d.ts.map +1 -1
- package/dist/agentpay-gateway.js +6 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,6 +28,7 @@ agentbrowse launch https://example.com
|
|
|
28
28
|
- Node.js 18+
|
|
29
29
|
- a Chrome-compatible browser runtime available on the machine
|
|
30
30
|
- an Anthropic API key for browsing commands
|
|
31
|
+
- an AgentPay API key for CLI startup
|
|
31
32
|
|
|
32
33
|
## Commands
|
|
33
34
|
|
|
@@ -88,17 +89,19 @@ Optional model override:
|
|
|
88
89
|
export AGENTBROWSE_MODEL=anthropic/claude-haiku-4-5-20251001
|
|
89
90
|
```
|
|
90
91
|
|
|
91
|
-
`
|
|
92
|
-
|
|
92
|
+
`agentbrowse` also requires an AgentPay API key at startup so the CLI stays on
|
|
93
|
+
the same gateway-backed contract as the rest of the toolchain.
|
|
93
94
|
|
|
94
95
|
## Runtime model
|
|
95
96
|
|
|
96
97
|
- `agentbrowse` persists the active browser session under `~/.agentpay`
|
|
97
98
|
- browsing commands require `ANTHROPIC_API_KEY`
|
|
98
|
-
-
|
|
99
|
+
- all commands require `AGENTPAY_API_KEY`
|
|
99
100
|
- `solve-captcha` requires both:
|
|
100
101
|
- a session with captcha-solving capability
|
|
101
102
|
- AgentPay gateway configuration
|
|
102
103
|
|
|
103
104
|
Human-readable progress is written to `stderr`. Command results are written to
|
|
104
105
|
`stdout`.
|
|
106
|
+
|
|
107
|
+
Releases are published automatically from `main` after checks pass.
|
|
@@ -5,4 +5,5 @@ export interface AgentpayGatewayConfig {
|
|
|
5
5
|
export declare function tryResolveAgentpayGatewayConfig(): AgentpayGatewayConfig | null;
|
|
6
6
|
export declare function resolveAgentpayGatewayConfig(): AgentpayGatewayConfig;
|
|
7
7
|
export declare function applyAgentpayGatewayEnv(gateway: AgentpayGatewayConfig): void;
|
|
8
|
+
export declare function preflightAgentpayGateway(): Promise<AgentpayGatewayConfig>;
|
|
8
9
|
//# sourceMappingURL=agentpay-gateway.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentpay-gateway.d.ts","sourceRoot":"","sources":["../src/agentpay-gateway.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAiCD,wBAAgB,+BAA+B,IAAI,qBAAqB,GAAG,IAAI,CAoB9E;AAED,wBAAgB,4BAA4B,IAAI,qBAAqB,CAMpE;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAG5E"}
|
|
1
|
+
{"version":3,"file":"agentpay-gateway.d.ts","sourceRoot":"","sources":["../src/agentpay-gateway.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAiCD,wBAAgB,+BAA+B,IAAI,qBAAqB,GAAG,IAAI,CAoB9E;AAED,wBAAgB,4BAA4B,IAAI,qBAAqB,CAMpE;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAG5E;AAED,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAI/E"}
|
package/dist/agentpay-gateway.js
CHANGED
|
@@ -48,7 +48,7 @@ export function tryResolveAgentpayGatewayConfig() {
|
|
|
48
48
|
export function resolveAgentpayGatewayConfig() {
|
|
49
49
|
const gateway = tryResolveAgentpayGatewayConfig();
|
|
50
50
|
if (!gateway) {
|
|
51
|
-
throw new Error('
|
|
51
|
+
throw new Error('AgentPay API key is required.');
|
|
52
52
|
}
|
|
53
53
|
return gateway;
|
|
54
54
|
}
|
|
@@ -56,3 +56,8 @@ export function applyAgentpayGatewayEnv(gateway) {
|
|
|
56
56
|
process.env.AGENTPAY_API_KEY = gateway.apiKey;
|
|
57
57
|
process.env.AGENTPAY_API_URL = gateway.apiUrl;
|
|
58
58
|
}
|
|
59
|
+
export async function preflightAgentpayGateway() {
|
|
60
|
+
const gateway = resolveAgentpayGatewayConfig();
|
|
61
|
+
applyAgentpayGatewayEnv(gateway);
|
|
62
|
+
return gateway;
|
|
63
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAgLA,iBAAe,IAAI,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsGhE;AAED,OAAO,EAAE,IAAI,EAAE,CAAC;AAEhB,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAWzF"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { config as loadEnv } from 'dotenv';
|
|
3
|
+
import { realpathSync } from 'node:fs';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
3
5
|
loadEnv();
|
|
6
|
+
import { preflightAgentpayGateway } from './agentpay-gateway.js';
|
|
4
7
|
import { browseCommand, browseCommandName } from './command-name.js';
|
|
5
8
|
import { loadSession } from './session.js';
|
|
6
9
|
import { outputError, fatal, info } from './output.js';
|
|
@@ -32,8 +35,8 @@ Options:
|
|
|
32
35
|
Environment:
|
|
33
36
|
ANTHROPIC_API_KEY Required for browsing commands
|
|
34
37
|
AGENTBROWSE_MODEL Optional model override for browsing commands
|
|
35
|
-
AGENTPAY_API_KEY Required
|
|
36
|
-
AGENTPAY_API_URL Optional API base URL override
|
|
38
|
+
AGENTPAY_API_KEY Required for CLI start
|
|
39
|
+
AGENTPAY_API_URL Optional API base URL override`;
|
|
37
40
|
}
|
|
38
41
|
const KNOWN_COMMANDS = new Set([
|
|
39
42
|
'launch',
|
|
@@ -46,8 +49,8 @@ const KNOWN_COMMANDS = new Set([
|
|
|
46
49
|
'status',
|
|
47
50
|
'close',
|
|
48
51
|
]);
|
|
49
|
-
function getCommand() {
|
|
50
|
-
const rawArgs =
|
|
52
|
+
function getCommand(argv = process.argv) {
|
|
53
|
+
const rawArgs = argv.slice(2);
|
|
51
54
|
if (rawArgs.length === 0 || rawArgs[0] === '--help') {
|
|
52
55
|
info(usageText());
|
|
53
56
|
process.exit(0);
|
|
@@ -137,14 +140,20 @@ function requireSession() {
|
|
|
137
140
|
// Caller will handle connection errors.
|
|
138
141
|
return 'ws://localhost:9222';
|
|
139
142
|
}
|
|
140
|
-
async function main() {
|
|
141
|
-
const parsed = getCommand();
|
|
143
|
+
async function main(argv = process.argv) {
|
|
144
|
+
const parsed = getCommand(argv);
|
|
142
145
|
if (!parsed)
|
|
143
146
|
process.exit(1);
|
|
144
147
|
const { command, args } = parsed;
|
|
145
148
|
if (!KNOWN_COMMANDS.has(command)) {
|
|
146
149
|
outputError(`Unknown command: ${command}\n\n${usageText()}`);
|
|
147
150
|
}
|
|
151
|
+
try {
|
|
152
|
+
await preflightAgentpayGateway();
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
outputError(err instanceof Error ? err.message : String(err));
|
|
156
|
+
}
|
|
148
157
|
switch (command) {
|
|
149
158
|
case 'launch': {
|
|
150
159
|
const { launch } = await import('./commands/launch.js');
|
|
@@ -225,6 +234,21 @@ async function main() {
|
|
|
225
234
|
}
|
|
226
235
|
}
|
|
227
236
|
}
|
|
228
|
-
main
|
|
229
|
-
|
|
230
|
-
|
|
237
|
+
export { main };
|
|
238
|
+
export function isDirectExecution(metaUrl, argv = process.argv) {
|
|
239
|
+
const entry = argv[1];
|
|
240
|
+
if (!entry) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
try {
|
|
244
|
+
return realpathSync(entry) === realpathSync(fileURLToPath(metaUrl));
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (isDirectExecution(import.meta.url)) {
|
|
251
|
+
main().catch((err) => {
|
|
252
|
+
fatal(err instanceof Error ? err.message : String(err));
|
|
253
|
+
});
|
|
254
|
+
}
|