@redplanethq/corebrain 2.5.0 → 2.5.1
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/commands/browser/status.d.ts.map +1 -1
- package/dist/commands/browser/status.js +5 -3
- package/dist/commands/browser/status.js.map +1 -1
- package/dist/utils/browser-use.js +1 -1
- package/dist/utils/browser-use.js.map +1 -1
- package/package.json +1 -1
- package/dist/commands/browser/create-profile.d.ts +0 -10
- package/dist/commands/browser/create-profile.d.ts.map +0 -1
- package/dist/commands/browser/create-profile.js +0 -35
- package/dist/commands/browser/create-profile.js.map +0 -1
- package/dist/commands/browser/delete-profile.d.ts +0 -10
- package/dist/commands/browser/delete-profile.d.ts.map +0 -1
- package/dist/commands/browser/delete-profile.js +0 -34
- package/dist/commands/browser/delete-profile.js.map +0 -1
- package/dist/commands/coding/[agent]/config.d.ts +0 -18
- package/dist/commands/coding/[agent]/config.d.ts.map +0 -1
- package/dist/commands/coding/[agent]/config.js +0 -91
- package/dist/commands/coding/[agent]/config.js.map +0 -1
- package/dist/commands/coding/index.d.ts +0 -8
- package/dist/commands/coding/index.d.ts.map +0 -1
- package/dist/commands/coding/index.js +0 -42
- package/dist/commands/coding/index.js.map +0 -1
- package/dist/commands/gateway/index.d.ts +0 -14
- package/dist/commands/gateway/index.d.ts.map +0 -1
- package/dist/commands/gateway/index.js +0 -10
- package/dist/commands/gateway/index.js.map +0 -1
- package/dist/commands/gateway/off.d.ts +0 -8
- package/dist/commands/gateway/off.d.ts.map +0 -1
- package/dist/commands/gateway/off.js +0 -60
- package/dist/commands/gateway/off.js.map +0 -1
- package/dist/commands/gateway/on.d.ts +0 -8
- package/dist/commands/gateway/on.d.ts.map +0 -1
- package/dist/commands/gateway/on.js +0 -106
- package/dist/commands/gateway/on.js.map +0 -1
- package/dist/commands/gateway/uninstall.d.ts +0 -8
- package/dist/commands/gateway/uninstall.d.ts.map +0 -1
- package/dist/commands/gateway/uninstall.js +0 -68
- package/dist/commands/gateway/uninstall.js.map +0 -1
- package/dist/commands/server.d.ts +0 -10
- package/dist/commands/server.d.ts.map +0 -1
- package/dist/commands/server.js +0 -60
- package/dist/commands/server.js.map +0 -1
- package/dist/server/gateway.d.ts +0 -5
- package/dist/server/gateway.d.ts.map +0 -1
- package/dist/server/gateway.js +0 -136
- package/dist/server/gateway.js.map +0 -1
- package/dist/utils/agent-browser.d.ts +0 -46
- package/dist/utils/agent-browser.d.ts.map +0 -1
- package/dist/utils/agent-browser.js +0 -233
- package/dist/utils/agent-browser.js.map +0 -1
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { useApp } from 'ink';
|
|
3
|
-
import * as p from '@clack/prompts';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
import zod from 'zod';
|
|
6
|
-
import { getConfig } from '../../config/index.js';
|
|
7
|
-
import { getPreferences, updatePreferences } from '../../config/preferences.js';
|
|
8
|
-
import { getConfigPath } from '../../config/paths.js';
|
|
9
|
-
import { homedir } from 'node:os';
|
|
10
|
-
import { join, dirname } from 'node:path';
|
|
11
|
-
import { fileURLToPath } from 'node:url';
|
|
12
|
-
import { installService, getServiceStatus, startService, getServiceName, getServiceType, getServicePid, } from '../../utils/service-manager/index.js';
|
|
13
|
-
export const options = zod.object({});
|
|
14
|
-
function getGatewayEntryPath() {
|
|
15
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
-
const __dirname = dirname(__filename);
|
|
17
|
-
return join(__dirname, '..', '..', 'server', 'gateway-entry.js');
|
|
18
|
-
}
|
|
19
|
-
async function runGatewayOn() {
|
|
20
|
-
const spinner = p.spinner();
|
|
21
|
-
// Check platform support
|
|
22
|
-
const serviceType = getServiceType();
|
|
23
|
-
if (serviceType === 'none') {
|
|
24
|
-
p.log.error('Service management not supported on this platform. Only macOS (launchd) and Linux (systemd) are supported.');
|
|
25
|
-
process.exitCode = 1;
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
// Check if authenticated
|
|
29
|
-
spinner.start('Checking configuration...');
|
|
30
|
-
const config = getConfig();
|
|
31
|
-
if (!config.auth?.apiKey || !config.auth?.url) {
|
|
32
|
-
spinner.stop(chalk.red('Not authenticated'));
|
|
33
|
-
p.log.error('Not authenticated. Run `corebrain login` first.');
|
|
34
|
-
process.exitCode = 1;
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
// Check if gateway is configured
|
|
38
|
-
const prefs = getPreferences();
|
|
39
|
-
if (!prefs.gateway?.id || !prefs.gateway?.name) {
|
|
40
|
-
spinner.stop(chalk.red('Not configured'));
|
|
41
|
-
p.log.error('Gateway not configured. Run `corebrain gateway config` first.');
|
|
42
|
-
process.exitCode = 1;
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const serviceName = getServiceName();
|
|
46
|
-
// Check if already running
|
|
47
|
-
const currentStatus = await getServiceStatus(serviceName);
|
|
48
|
-
if (currentStatus === 'running') {
|
|
49
|
-
spinner.stop(chalk.green('Gateway is already running'));
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
// Install/update the service
|
|
53
|
-
spinner.message('Installing gateway service...');
|
|
54
|
-
const gatewayEntryPath = getGatewayEntryPath();
|
|
55
|
-
const logDir = join(getConfigPath(), 'logs');
|
|
56
|
-
const serviceConfig = {
|
|
57
|
-
name: serviceName,
|
|
58
|
-
displayName: 'CoreBrain Gateway',
|
|
59
|
-
command: process.execPath,
|
|
60
|
-
args: [gatewayEntryPath],
|
|
61
|
-
port: 0,
|
|
62
|
-
workingDirectory: homedir(),
|
|
63
|
-
logPath: join(logDir, 'gateway-stdout.log'),
|
|
64
|
-
errorLogPath: join(logDir, 'gateway-stderr.log'),
|
|
65
|
-
};
|
|
66
|
-
await installService(serviceConfig);
|
|
67
|
-
// Start the service
|
|
68
|
-
spinner.message('Starting gateway service...');
|
|
69
|
-
await startService(serviceName);
|
|
70
|
-
// Wait a moment for the service to start and get the PID
|
|
71
|
-
await new Promise(resolve => setTimeout(resolve, 500));
|
|
72
|
-
const pid = getServicePid(serviceName);
|
|
73
|
-
// Update preferences with actual PID
|
|
74
|
-
updatePreferences({
|
|
75
|
-
gateway: {
|
|
76
|
-
...getPreferences().gateway,
|
|
77
|
-
port: 0,
|
|
78
|
-
pid: pid ?? 0,
|
|
79
|
-
startedAt: Date.now(),
|
|
80
|
-
serviceInstalled: true,
|
|
81
|
-
serviceType: serviceType,
|
|
82
|
-
serviceName: serviceName,
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
spinner.stop(chalk.green('Gateway service started'));
|
|
86
|
-
p.note([
|
|
87
|
-
'The gateway is now running in the background.',
|
|
88
|
-
"Use 'corebrain gateway status' to check status.",
|
|
89
|
-
"Use 'corebrain gateway off' to stop.",
|
|
90
|
-
].join('\n'), 'Gateway Started');
|
|
91
|
-
}
|
|
92
|
-
export default function GatewayOn(_props) {
|
|
93
|
-
const { exit } = useApp();
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
runGatewayOn()
|
|
96
|
-
.catch((err) => {
|
|
97
|
-
p.log.error(`Gateway error: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
98
|
-
process.exitCode = 1;
|
|
99
|
-
})
|
|
100
|
-
.finally(() => {
|
|
101
|
-
setTimeout(() => exit(), 100);
|
|
102
|
-
});
|
|
103
|
-
}, [exit]);
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=on.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"on.js","sourceRoot":"","sources":["../../../src/commands/gateway/on.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,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AC,CAAC,GAAG,CAAC,KAAK,CAAC,kBAAkB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;YACtF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACtB,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACb,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import zod from 'zod';
|
|
2
|
-
export declare const options: zod.ZodObject<{}, zod.core.$strip>;
|
|
3
|
-
type Props = {
|
|
4
|
-
options: zod.infer<typeof options>;
|
|
5
|
-
};
|
|
6
|
-
export default function GatewayUninstall(_props: Props): null;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=uninstall.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../src/commands/gateway/uninstall.tsx"],"names":[],"mappings":"AAIA,OAAO,GAAG,MAAM,KAAK,CAAC;AAWtB,eAAO,MAAM,OAAO,oCAAiB,CAAC;AAEtC,KAAK,KAAK,GAAG;IACZ,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CACnC,CAAC;AA8DF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,MAAM,EAAE,KAAK,QAcrD"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { useApp } from 'ink';
|
|
3
|
-
import * as p from '@clack/prompts';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
import zod from 'zod';
|
|
6
|
-
import { getPreferences, updatePreferences } from '../../config/preferences.js';
|
|
7
|
-
import { getServiceType, getServiceName, uninstallService, isServiceInstalled, stopService, getServiceStatus, } from '../../utils/service-manager/index.js';
|
|
8
|
-
export const options = zod.object({});
|
|
9
|
-
async function runGatewayUninstall() {
|
|
10
|
-
const spinner = p.spinner();
|
|
11
|
-
const serviceType = getServiceType();
|
|
12
|
-
if (serviceType === 'none') {
|
|
13
|
-
p.log.error('Service management not supported on this platform.');
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
spinner.start('Checking service...');
|
|
17
|
-
const serviceName = getServiceName();
|
|
18
|
-
const installed = await isServiceInstalled(serviceName);
|
|
19
|
-
if (!installed) {
|
|
20
|
-
// Clean up preferences if needed
|
|
21
|
-
const prefs = getPreferences();
|
|
22
|
-
if (prefs.gateway?.serviceInstalled) {
|
|
23
|
-
const { gateway, ...rest } = prefs;
|
|
24
|
-
updatePreferences(rest);
|
|
25
|
-
}
|
|
26
|
-
spinner.stop(chalk.yellow('Not installed'));
|
|
27
|
-
p.log.warning('Gateway is not installed');
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
// Stop if running
|
|
31
|
-
const serviceStatus = await getServiceStatus(serviceName);
|
|
32
|
-
if (serviceStatus === 'running') {
|
|
33
|
-
spinner.message('Stopping gateway...');
|
|
34
|
-
try {
|
|
35
|
-
await stopService(serviceName);
|
|
36
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
// Continue anyway
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
// Uninstall
|
|
43
|
-
spinner.message('Removing service...');
|
|
44
|
-
await uninstallService(serviceName);
|
|
45
|
-
// Clean up preferences
|
|
46
|
-
const prefs = getPreferences();
|
|
47
|
-
const { gateway, ...rest } = prefs;
|
|
48
|
-
updatePreferences(rest);
|
|
49
|
-
spinner.stop(chalk.green('Gateway service removed'));
|
|
50
|
-
p.note([
|
|
51
|
-
'The gateway will no longer auto-start.',
|
|
52
|
-
'To reinstall: corebrain gateway on',
|
|
53
|
-
].join('\n'), 'Gateway Uninstalled');
|
|
54
|
-
}
|
|
55
|
-
export default function GatewayUninstall(_props) {
|
|
56
|
-
const { exit } = useApp();
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
runGatewayUninstall()
|
|
59
|
-
.catch((err) => {
|
|
60
|
-
p.log.error(`Failed to uninstall: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
61
|
-
})
|
|
62
|
-
.finally(() => {
|
|
63
|
-
setTimeout(() => exit(), 100);
|
|
64
|
-
});
|
|
65
|
-
}, [exit]);
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=uninstall.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/commands/gateway/uninstall.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EACN,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,gBAAgB,GAChB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAMtC,KAAK,UAAU,mBAAmB;IACjC,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;IAE5B,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,IAAI,WAAW,KAAK,MAAM,EAAE,CAAC;QAC5B,CAAC,CAAC,GAAG,CAAC,KAAK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EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACnC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAExB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC,CAAC;IAErD,CAAC,CAAC,IAAI,CACL;QACC,wCAAwC;QACxC,oCAAoC;KACpC,CAAC,IAAI,CAAC,IAAI,CAAC,EACZ,qBAAqB,CACrB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,MAAa;IACrD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAE1B,SAAS,CAAC,GAAG,EAAE;QACd,mBAAmB,EAAE;aACnB,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACd,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,wBAAwB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QAC7F,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACb,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import zod from 'zod';
|
|
2
|
-
export declare const options: zod.ZodObject<{
|
|
3
|
-
port: zod.ZodOptional<zod.ZodNumber>;
|
|
4
|
-
}, zod.core.$strip>;
|
|
5
|
-
type Props = {
|
|
6
|
-
options: zod.infer<typeof options>;
|
|
7
|
-
};
|
|
8
|
-
export default function Server({ options }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.tsx"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,KAAK,CAAC;AAKtB,eAAO,MAAM,OAAO;;mBAElB,CAAC;AAEH,KAAK,KAAK,GAAG;IACZ,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,2CA+DhD"}
|
package/dist/commands/server.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import { Text } from 'ink';
|
|
4
|
-
import zod from 'zod';
|
|
5
|
-
import { startGatewayServer } from '../server/gateway.js';
|
|
6
|
-
const DEFAULT_PORT = 3456;
|
|
7
|
-
export const options = zod.object({
|
|
8
|
-
port: zod.number().optional().describe('Port for the gateway server'),
|
|
9
|
-
});
|
|
10
|
-
export default function Server({ options }) {
|
|
11
|
-
const [status, setStatus] = useState('starting');
|
|
12
|
-
const [error, setError] = useState('');
|
|
13
|
-
const port = options.port || DEFAULT_PORT;
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
let cancelled = false;
|
|
16
|
-
let server = null;
|
|
17
|
-
(async () => {
|
|
18
|
-
try {
|
|
19
|
-
const result = await startGatewayServer(port);
|
|
20
|
-
server = result.server;
|
|
21
|
-
if (!cancelled) {
|
|
22
|
-
setStatus('running');
|
|
23
|
-
}
|
|
24
|
-
// Handle graceful shutdown
|
|
25
|
-
const shutdown = () => {
|
|
26
|
-
if (server) {
|
|
27
|
-
server.close(() => {
|
|
28
|
-
process.exit(0);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
process.exit(0);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
process.on('SIGTERM', shutdown);
|
|
36
|
-
process.on('SIGINT', shutdown);
|
|
37
|
-
}
|
|
38
|
-
catch (err) {
|
|
39
|
-
if (!cancelled) {
|
|
40
|
-
setError(err instanceof Error ? err.message : 'Unknown error');
|
|
41
|
-
setStatus('error');
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
})();
|
|
45
|
-
return () => {
|
|
46
|
-
cancelled = true;
|
|
47
|
-
if (server) {
|
|
48
|
-
server.close();
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}, [port]);
|
|
52
|
-
if (status === 'starting') {
|
|
53
|
-
return _jsxs(Text, { dimColor: true, children: ["Starting gateway server on port ", port, "..."] });
|
|
54
|
-
}
|
|
55
|
-
if (status === 'error') {
|
|
56
|
-
return _jsxs(Text, { color: "red", children: ["Error: ", error] });
|
|
57
|
-
}
|
|
58
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Text, { color: "green", children: ["Gateway server running on port ", port] }), _jsxs(Text, { dimColor: true, children: ["PID: ", process.pid] }), _jsx(Text, { dimColor: true, children: "Press Ctrl+C to stop" })] }));
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/commands/server.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,YAAY,GAAG,IAAI,CAAC;AAE1B,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CACrE,CAAC,CAAC;AAM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C,eAAe,CAAC,CAAC;oBAC/D,SAAS,CAAC,OAAO,CAAC,CAAC;gBACpB,CAAC;YACF,CAAC;QACF,CAAC,CAAC,EAAE,CAAC;QAEL,OAAO,GAAG,EAAE;YACX,SAAS,GAAG,IAAI,CAAC;YACjB,IAAI,MAAM,EAAE,CAAC;gBACZ,MAAM,CAAC,KAAK,EAAE,CAAC;YAChB,CAAC;QACF,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,IAAI,MAAM,KAAK,UAAU,EAAE,CAAC;QAC3B,OAAO,MAAC,IAAI,IAAC,QAAQ,uDAAkC,IAAI,WAAW,CAAC;IACxE,CAAC;IAED,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QACxB,OAAO,MAAC,IAAI,IAAC,KAAK,EAAC,KAAK,wBAAS,KAAK,IAAQ,CAAC;IAChD,CAAC;IAED,OAAO,CACN,8BACC,MAAC,IAAI,IAAC,KAAK,EAAC,OAAO,gDAAiC,IAAI,IAAQ,EAChE,MAAC,IAAI,IAAC,QAAQ,4BAAO,OAAO,CAAC,GAAG,IAAQ,EACxC,KAAC,IAAI,IAAC,QAAQ,2CAA4B,IACxC,CACH,CAAC;AACH,CAAC"}
|
package/dist/server/gateway.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../src/server/gateway.ts"],"names":[],"mappings":"AA0JA,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAWvF"}
|
package/dist/server/gateway.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { createServer } from 'node:http';
|
|
2
|
-
import { createSession, killSession, getSessionContent, listSessions, sessionExists } from '../utils/tmux.js';
|
|
3
|
-
// In-memory session tracking
|
|
4
|
-
const sessions = new Map();
|
|
5
|
-
function parseBody(req) {
|
|
6
|
-
return new Promise((resolve, reject) => {
|
|
7
|
-
let body = '';
|
|
8
|
-
req.on('data', chunk => { body += chunk.toString(); });
|
|
9
|
-
req.on('end', () => {
|
|
10
|
-
try {
|
|
11
|
-
resolve(body ? JSON.parse(body) : {});
|
|
12
|
-
}
|
|
13
|
-
catch (err) {
|
|
14
|
-
reject(err);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
req.on('error', reject);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function sendJSON(res, statusCode, data) {
|
|
21
|
-
res.writeHead(statusCode, { 'Content-Type': 'application/json' });
|
|
22
|
-
res.end(JSON.stringify(data));
|
|
23
|
-
}
|
|
24
|
-
function generateSessionId() {
|
|
25
|
-
return `claude-code-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
26
|
-
}
|
|
27
|
-
async function handleRequest(req, res) {
|
|
28
|
-
const url = new URL(req.url || '/', `http://${req.headers.host}`);
|
|
29
|
-
const method = req.method || 'GET';
|
|
30
|
-
const pathname = url.pathname;
|
|
31
|
-
// CORS headers
|
|
32
|
-
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
33
|
-
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, DELETE, OPTIONS');
|
|
34
|
-
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
|
|
35
|
-
if (method === 'OPTIONS') {
|
|
36
|
-
res.writeHead(204);
|
|
37
|
-
res.end();
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
try {
|
|
41
|
-
// Health check
|
|
42
|
-
if (pathname === '/health' && method === 'GET') {
|
|
43
|
-
sendJSON(res, 200, { status: 'ok', timestamp: Date.now() });
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
// List sessions
|
|
47
|
-
if (pathname === '/sessions' && method === 'GET') {
|
|
48
|
-
const tmuxSessions = await listSessions();
|
|
49
|
-
const activeSessions = Array.from(sessions.entries())
|
|
50
|
-
.filter(([id]) => tmuxSessions.includes(id))
|
|
51
|
-
.map(([id, info]) => ({ ...info }));
|
|
52
|
-
sendJSON(res, 200, { sessions: activeSessions });
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
// Create session
|
|
56
|
-
if (pathname === '/sessions' && method === 'POST') {
|
|
57
|
-
const body = await parseBody(req);
|
|
58
|
-
const { workingDir = process.cwd(), command = 'claude' } = body;
|
|
59
|
-
const sessionId = generateSessionId();
|
|
60
|
-
const sessionInfo = {
|
|
61
|
-
id: sessionId,
|
|
62
|
-
workingDir,
|
|
63
|
-
command,
|
|
64
|
-
createdAt: Date.now(),
|
|
65
|
-
};
|
|
66
|
-
// Create tmux session with claude-code
|
|
67
|
-
const fullCommand = `cd "${workingDir}" && ${command}`;
|
|
68
|
-
await createSession(sessionId, fullCommand);
|
|
69
|
-
sessions.set(sessionId, sessionInfo);
|
|
70
|
-
sendJSON(res, 201, {
|
|
71
|
-
success: true,
|
|
72
|
-
session: sessionInfo
|
|
73
|
-
});
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
// Get session details
|
|
77
|
-
const sessionMatch = pathname.match(/^\/sessions\/([^\/]+)$/);
|
|
78
|
-
if (sessionMatch && method === 'GET') {
|
|
79
|
-
const sessionId = sessionMatch[1];
|
|
80
|
-
const info = sessions.get(sessionId);
|
|
81
|
-
if (!info) {
|
|
82
|
-
sendJSON(res, 404, { error: 'Session not found' });
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
const exists = await sessionExists(sessionId);
|
|
86
|
-
if (!exists) {
|
|
87
|
-
sessions.delete(sessionId);
|
|
88
|
-
sendJSON(res, 404, { error: 'Session no longer active' });
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
const content = await getSessionContent(sessionId);
|
|
92
|
-
sendJSON(res, 200, {
|
|
93
|
-
session: info,
|
|
94
|
-
content,
|
|
95
|
-
active: true
|
|
96
|
-
});
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
// Delete session
|
|
100
|
-
if (sessionMatch && method === 'DELETE') {
|
|
101
|
-
const sessionId = sessionMatch[1];
|
|
102
|
-
const info = sessions.get(sessionId);
|
|
103
|
-
if (!info) {
|
|
104
|
-
sendJSON(res, 404, { error: 'Session not found' });
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const exists = await sessionExists(sessionId);
|
|
108
|
-
if (exists) {
|
|
109
|
-
await killSession(sessionId);
|
|
110
|
-
}
|
|
111
|
-
sessions.delete(sessionId);
|
|
112
|
-
sendJSON(res, 200, { success: true, message: 'Session killed' });
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
// 404
|
|
116
|
-
sendJSON(res, 404, { error: 'Not found' });
|
|
117
|
-
}
|
|
118
|
-
catch (error) {
|
|
119
|
-
console.error('Gateway error:', error);
|
|
120
|
-
sendJSON(res, 500, {
|
|
121
|
-
error: 'Internal server error',
|
|
122
|
-
message: error instanceof Error ? error.message : 'Unknown error'
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
export function startGatewayServer(port) {
|
|
127
|
-
return new Promise((resolve, reject) => {
|
|
128
|
-
const server = createServer(handleRequest);
|
|
129
|
-
server.on('error', reject);
|
|
130
|
-
server.listen(port, () => {
|
|
131
|
-
console.log(`Gateway server listening on port ${port}`);
|
|
132
|
-
resolve({ server, port });
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
//# sourceMappingURL=gateway.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../../src/server/gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAmC,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAS1G,6BAA6B;AAC7B,MAAM,QAAQ,GAAG,IA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;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;QACvC,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE;YAClB,KAAK,EAAE,uBAAuB;YAC9B,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SACjE,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC9C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,MAAM,MAAM,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;QAE3C,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAE3B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;YACxB,OAAO,CAAC,GAAG,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAC;YACxD,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export interface CommandResult {
|
|
2
|
-
stdout: string;
|
|
3
|
-
stderr: string;
|
|
4
|
-
code: number;
|
|
5
|
-
}
|
|
6
|
-
export declare function clearBinaryPathCache(): void;
|
|
7
|
-
export declare function isAgentBrowserInstalled(): Promise<boolean>;
|
|
8
|
-
export declare function installAgentBrowser(): Promise<CommandResult>;
|
|
9
|
-
export declare function createProfile(name: string): {
|
|
10
|
-
success: boolean;
|
|
11
|
-
path: string;
|
|
12
|
-
error?: string;
|
|
13
|
-
};
|
|
14
|
-
export declare function deleteProfile(name: string): {
|
|
15
|
-
success: boolean;
|
|
16
|
-
error?: string;
|
|
17
|
-
};
|
|
18
|
-
export declare function listProfiles(): string[];
|
|
19
|
-
export declare function getProfilesDir(): string;
|
|
20
|
-
export declare function profileExists(name: string): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Open a browser with URL using the specified profile
|
|
23
|
-
*/
|
|
24
|
-
export declare function browserOpen(url: string, profile?: string): Promise<CommandResult>;
|
|
25
|
-
/**
|
|
26
|
-
* Close a browser for the specified profile
|
|
27
|
-
*/
|
|
28
|
-
export declare function browserClose(profile: string): Promise<CommandResult>;
|
|
29
|
-
/**
|
|
30
|
-
* Check if a command is blocked
|
|
31
|
-
*/
|
|
32
|
-
export declare function isBlockedCommand(command: string): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Execute a generic browser command on a profile
|
|
35
|
-
* Blocks: open, close, cookies, storage, network, trace, highlight, console, errors, state, download
|
|
36
|
-
*/
|
|
37
|
-
export declare function browserCommand(profile: string, command: string, args?: string[]): Promise<CommandResult>;
|
|
38
|
-
/**
|
|
39
|
-
* Get all available profiles
|
|
40
|
-
*/
|
|
41
|
-
export declare function browserGetProfiles(): string[];
|
|
42
|
-
/**
|
|
43
|
-
* Close a browser for the specified profile
|
|
44
|
-
*/
|
|
45
|
-
export declare function browserCloseAll(): Promise<void>;
|
|
46
|
-
//# sourceMappingURL=agent-browser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-browser.d.ts","sourceRoot":"","sources":["../../src/utils/agent-browser.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACb;AAgCD,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC,CAEhE;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,aAAa,CAAC,CAKlE;AAyFD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG;IAC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