amalgm 0.1.89 → 0.1.90
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/package.json +1 -1
- package/runtime/scripts/amalgm-mcp/browser/cli.js +10 -5
- package/runtime/scripts/amalgm-mcp/browser/engine.js +290 -146
- package/runtime/scripts/amalgm-mcp/server/core-tools.js +16 -28
- package/runtime/scripts/amalgm-mcp/state/snapshot.js +4 -0
- package/runtime/scripts/amalgm-mcp/tests/browser-routing.test.js +133 -0
- package/runtime/scripts/amalgm-mcp/tests/core-tools.test.js +67 -12
- package/runtime/scripts/amalgm-mcp/toolbox/loadout-context.js +30 -0
- package/runtime/scripts/amalgm-mcp/toolbox/system-catalog.js +6 -2
- package/runtime/scripts/amalgm-mcp/browser/electron-bridge.js +0 -281
package/package.json
CHANGED
|
@@ -90,14 +90,19 @@ function wantsHeaded() {
|
|
|
90
90
|
return true;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
function baseArgs(session, json = true) {
|
|
93
|
+
function baseArgs(session, json = true, cdp = null) {
|
|
94
94
|
const args = [
|
|
95
95
|
'--session', session,
|
|
96
96
|
'--profile', profileDir(session),
|
|
97
97
|
'--screenshot-dir', screenshotDir(),
|
|
98
98
|
];
|
|
99
|
+
// Raw CDP attach (drives an existing chromium — e.g. the Amalgm desktop
|
|
100
|
+
// app's visible webview — instead of launching one). Must be passed on
|
|
101
|
+
// every command: `connect` launches a managed browser, which is not what
|
|
102
|
+
// attached mode wants.
|
|
103
|
+
if (cdp) args.push('--cdp', String(cdp));
|
|
99
104
|
if (json) args.push('--json');
|
|
100
|
-
if (wantsHeaded()) args.push('--headed');
|
|
105
|
+
if (wantsHeaded() && !cdp) args.push('--headed');
|
|
101
106
|
if (process.env.AMALGM_BROWSER_EXECUTABLE_PATH) {
|
|
102
107
|
args.push('--executable-path', process.env.AMALGM_BROWSER_EXECUTABLE_PATH);
|
|
103
108
|
}
|
|
@@ -145,7 +150,7 @@ function runCli(commandArgs, options = {}) {
|
|
|
145
150
|
const json = options.json !== false;
|
|
146
151
|
const timeoutMs = options.timeoutMs || DEFAULT_TIMEOUT_MS;
|
|
147
152
|
const bin = agentBrowserCommand();
|
|
148
|
-
const args = [...bin.prefix, ...baseArgs(session, json), ...commandArgs.map(String)];
|
|
153
|
+
const args = [...bin.prefix, ...baseArgs(session, json, options.cdp || null), ...commandArgs.map(String)];
|
|
149
154
|
|
|
150
155
|
const env = {
|
|
151
156
|
...process.env,
|
|
@@ -196,8 +201,8 @@ function runCli(commandArgs, options = {}) {
|
|
|
196
201
|
});
|
|
197
202
|
}
|
|
198
203
|
|
|
199
|
-
async function readText(commandArgs, session, timeoutMs = 30_000) {
|
|
200
|
-
return asText(await runCli(commandArgs, { session, timeoutMs }));
|
|
204
|
+
async function readText(commandArgs, session, timeoutMs = 30_000, cdp = null) {
|
|
205
|
+
return asText(await runCli(commandArgs, { session, timeoutMs, cdp }));
|
|
201
206
|
}
|
|
202
207
|
|
|
203
208
|
module.exports = {
|