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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amalgm",
3
- "version": "0.1.89",
3
+ "version": "0.1.90",
4
4
  "description": "Amalgm local computer runtime: login, MCP, chat, events, previews, and tunnels.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -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 = {