magpie-gemini-web 0.4.0 → 0.5.0

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,7 +1,7 @@
1
1
  {
2
2
  "name": "magpie-gemini-web",
3
- "version": "0.4.0",
4
- "description": "Gemini Web provider for Magpie, backed by gemini-web2api-go",
3
+ "version": "0.5.0",
4
+ "description": "Gemini Web and Google AI Studio provider for Magpie, backed by gemini-web2api-go and AIStudio2API",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",
7
7
  "exports": "./index.mjs",
@@ -22,6 +22,9 @@
22
22
  "lib/",
23
23
  "scripts/backend.mjs",
24
24
  "scripts/backend-argon.mjs",
25
+ "scripts/backend-release.mjs",
26
+ "scripts/studio-smoke.mjs",
27
+ "scripts/studio.mjs",
25
28
  "patches/",
26
29
  "native-task/lib/",
27
30
  "native-task/bridge/",
@@ -32,6 +35,7 @@
32
35
  "native-task/LICENSE",
33
36
  "README.md",
34
37
  "README.en.md",
38
+ "docs/backend-release.md",
35
39
  "LICENSE",
36
40
  "LICENSE-UPSTREAM"
37
41
  ],
@@ -50,11 +54,20 @@
50
54
  "scripts": {
51
55
  "test": "node --test test/*.test.mjs native-task/test/*.test.mjs",
52
56
  "backend:install": "node scripts/backend.mjs install",
57
+ "backend:install:upstream": "node scripts/backend.mjs install-upstream",
58
+ "backend:release:build": "node scripts/backend-release.mjs --verify",
53
59
  "backend:start": "node scripts/backend.mjs start",
54
60
  "backend:status": "node scripts/backend.mjs status",
55
61
  "backend:build:argon": "node scripts/backend-argon.mjs build",
56
62
  "backend:install:argon": "node scripts/backend-argon.mjs install",
57
- "backend:start:argon": "node scripts/backend-argon.mjs start"
63
+ "backend:start:argon": "node scripts/backend-argon.mjs start",
64
+ "studio:install": "node scripts/studio.mjs install",
65
+ "studio:start": "node scripts/studio.mjs start",
66
+ "studio:status": "node scripts/studio.mjs status",
67
+ "studio:stop": "node scripts/studio.mjs stop",
68
+ "studio:login": "node scripts/studio.mjs login",
69
+ "studio:relogin": "node scripts/studio.mjs relogin",
70
+ "studio:smoke": "node scripts/studio-smoke.mjs"
58
71
  },
59
72
  "magpie": {
60
73
  "maxConcurrency": 1
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env node
2
+ // Build from a clean, pinned upstream tree plus the checked-in patch. The developer's
3
+ // backend-source working tree is never changed or included in release artifacts.
4
+ import fs from 'node:fs';
5
+ import os from 'node:os';
6
+ import path from 'node:path';
7
+ import crypto from 'node:crypto';
8
+ import { execFileSync } from 'node:child_process';
9
+ import { fileURLToPath } from 'node:url';
10
+
11
+ const root = fileURLToPath(new URL('..', import.meta.url));
12
+ const pinPath = path.join(root, 'lib/backend-release.json');
13
+ const release = JSON.parse(fs.readFileSync(pinPath, 'utf8'));
14
+ const args = process.argv.slice(2);
15
+ const writePins = args.includes('--write-pins');
16
+ const verify = args.includes('--verify');
17
+ const requested = args.find(arg => arg.startsWith('--target='))?.slice('--target='.length);
18
+ for (const arg of args) {
19
+ if (!['--write-pins', '--verify'].includes(arg) && !arg.startsWith('--target=')) throw new Error(`Unknown argument: ${arg}`);
20
+ }
21
+ const platforms = {
22
+ 'darwin-arm64': ['darwin', 'arm64'],
23
+ 'darwin-x64': ['darwin', 'amd64'],
24
+ 'linux-x64': ['linux', 'amd64'],
25
+ 'linux-arm64': ['linux', 'arm64'],
26
+ 'win32-x64': ['windows', 'amd64'],
27
+ 'win32-arm64': ['windows', 'arm64']
28
+ };
29
+ const target = requested === 'host' ? `${process.platform}-${process.arch}` : requested;
30
+ if (target && !platforms[target]) throw new Error(`Unsupported target: ${target}`);
31
+ if (writePins && (target || verify)) throw new Error('--write-pins requires a full build without --verify');
32
+ const targets = target ? [target] : Object.keys(platforms);
33
+ const output = path.join(root, 'backend-build', 'release');
34
+ fs.mkdirSync(output, { recursive: true });
35
+ const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'magpie-backend-build-'));
36
+ const source = path.join(scratch, 'source');
37
+ fs.mkdirSync(source);
38
+ const env = { ...process.env, CGO_ENABLED: '0', GOFLAGS: '', GOEXPERIMENT: '',
39
+ GOTOOLCHAIN: `go${release.goVersion}`, GOAMD64: 'v1', GOARM64: 'v8.0' };
40
+ for (const name of ['ARGON_PROBE_COOKIE', 'GW2A_UPLOAD_PROBE', 'SQL_DSN', 'GOOS', 'GOARCH']) delete env[name];
41
+ const go = (argv, extraEnv = {}) => execFileSync('go', argv, { cwd: source, env: { ...env, ...extraEnv }, stdio: 'inherit' });
42
+ const hash = bytes => crypto.createHash('sha256').update(bytes).digest('hex');
43
+ const patchPath = path.join(root, 'patches/argon.patch');
44
+ const flags = ['-trimpath', '-buildvcs=false', '-ldflags=-s -w'];
45
+
46
+ try {
47
+ let upstream = path.join(root, 'backend-source');
48
+ try {
49
+ execFileSync('git', ['-C', upstream, 'cat-file', '-e', `${release.upstream.commit}^{commit}`], { stdio: 'pipe' });
50
+ } catch {
51
+ upstream = path.join(scratch, 'upstream');
52
+ execFileSync('git', ['init', '-q', upstream]);
53
+ execFileSync('git', ['-C', upstream, 'fetch', '--depth=1', release.upstream.repository, release.upstream.commit], { stdio: 'inherit' });
54
+ }
55
+ const archive = path.join(scratch, 'upstream.tar');
56
+ execFileSync('git', ['-C', upstream, 'archive', '--format=tar', `--output=${archive}`, release.upstream.commit]);
57
+ // Relative archive paths also work with Git for Windows' tar, which otherwise
58
+ // treats the drive letter in C:\\... as a remote archive host.
59
+ execFileSync('tar', ['-xf', 'upstream.tar', '-C', 'source'], { cwd: scratch });
60
+ execFileSync('git', ['apply', '--check', patchPath], { cwd: source, stdio: 'inherit' });
61
+ execFileSync('git', ['apply', patchPath], { cwd: source, stdio: 'inherit' });
62
+ const versionPath = path.join(source, 'internal/app/server.go');
63
+ const server = fs.readFileSync(versionPath, 'utf8');
64
+ const versionLine = /^const Version = "[^"]+"$/m;
65
+ if (!versionLine.test(server)) throw new Error('Backend version declaration not found');
66
+ fs.writeFileSync(versionPath, server.replace(versionLine, `const Version = ${JSON.stringify(release.version)}`));
67
+ console.log(`Testing ${release.version} from ${release.upstream.commit} with patches/argon.patch`);
68
+ go(['version']);
69
+ go(['test', './...', '-count=1']);
70
+
71
+ const binaries = {};
72
+ for (const key of targets) {
73
+ const [goos, goarch] = platforms[key];
74
+ const asset = `gemini-web2api-go_v${release.version}_${goos}_${goarch}${goos === 'windows' ? '.exe' : ''}`;
75
+ const file = path.join(output, asset);
76
+ console.log(`Building ${key}: ${asset}`);
77
+ go(['build', ...flags, '-o', file, '.'], { GOOS: goos, GOARCH: goarch });
78
+ const bytes = fs.readFileSync(file);
79
+ const sha256 = hash(bytes);
80
+ if (verify && (release.binaries[key]?.sha256 !== sha256 || release.binaries[key]?.asset !== asset)) {
81
+ throw new Error(`Release pin mismatch for ${key}: built ${sha256}`);
82
+ }
83
+ binaries[key] = { asset, sha256 };
84
+ if (key === `${process.platform}-${process.arch}`) {
85
+ const version = execFileSync(file, ['--version'], { encoding: 'utf8' }).trim();
86
+ if (version !== `gemini-web2api-go ${release.version}`) throw new Error(`Unexpected binary version: ${version}`);
87
+ console.log(version);
88
+ }
89
+ }
90
+
91
+ if (!target) {
92
+ const sourceName = `gemini-web2api-go_v${release.version}_source.tar.gz`;
93
+ const sourceArchive = fs.openSync(path.join(output, sourceName), 'w');
94
+ try {
95
+ execFileSync('tar', ['-czf', '-', '.'], { cwd: source, stdio: ['ignore', sourceArchive, 'inherit'] });
96
+ } finally {
97
+ fs.closeSync(sourceArchive);
98
+ }
99
+ fs.copyFileSync(path.join(root, 'LICENSE-UPSTREAM'), path.join(output, 'LICENSE-UPSTREAM'));
100
+ const build = { version: release.version, upstream: release.upstream, goVersion: release.goVersion,
101
+ patch: 'patches/argon.patch', patchSha256: hash(fs.readFileSync(patchPath)),
102
+ versionOverride: release.version, cgoEnabled: false, flags, binaries };
103
+ fs.writeFileSync(path.join(output, 'build.json'), `${JSON.stringify(build, null, 2)}\n`);
104
+ const assets = [...Object.values(binaries).map(b => b.asset), sourceName, 'LICENSE-UPSTREAM', 'build.json'].sort();
105
+ fs.writeFileSync(path.join(output, 'SHA256SUMS.txt'), assets.map(name => `${hash(fs.readFileSync(path.join(output, name)))} ${name}\n`).join(''));
106
+ if (writePins) fs.writeFileSync(pinPath, `${JSON.stringify({ ...release, binaries }, null, 2)}\n`);
107
+ }
108
+ console.log(`Release artifacts ready: ${output}`);
109
+ } finally {
110
+ fs.rmSync(scratch, { recursive: true, force: true });
111
+ }
@@ -8,6 +8,9 @@ async function main() {
8
8
  case 'install':
9
9
  await installBackend();
10
10
  break;
11
+ case 'install-upstream':
12
+ await installBackend({ channel: 'upstream' });
13
+ break;
11
14
  case 'start':
12
15
  startBackend();
13
16
  break;
@@ -15,7 +18,7 @@ async function main() {
15
18
  await statusBackend();
16
19
  break;
17
20
  default:
18
- console.error('Usage: node scripts/backend.mjs <install|start|status>');
21
+ console.error('Usage: node scripts/backend.mjs <install|install-upstream|start|status>');
19
22
  process.exit(1);
20
23
  }
21
24
  }
@@ -0,0 +1,195 @@
1
+ // Opt-in live acceptance probe. Sends synthetic prompts to the local Magpie gateway.
2
+ // Never run by npm test; never executes a model-requested tool or shell command.
3
+ import fs from 'node:fs';
4
+ import path from 'node:path';
5
+ import assert from 'node:assert/strict';
6
+ import { execFileSync } from 'node:child_process';
7
+ import { localStudio, studioAdmin, stopStudio } from '../lib/studio-native.mjs';
8
+
9
+ const args = process.argv.slice(2);
10
+ function option(name, fallback) {
11
+ const i = args.indexOf(name);
12
+ if (i < 0) return fallback;
13
+ if (!args[i + 1] || args[i + 1].startsWith('--')) throw new Error(`Missing ${name} value`);
14
+ return args[i + 1];
15
+ }
16
+ const gateway = new URL(option('--gateway', 'http://127.0.0.1:3425/v1'));
17
+ assert.ok(['127.0.0.1', 'localhost', '[::1]'].includes(gateway.hostname), 'live probe requires a local gateway');
18
+ assert.ok(['http:', 'https:'].includes(gateway.protocol));
19
+ assert.ok(!gateway.username && !gateway.password && !gateway.search && !gateway.hash);
20
+ const base = gateway.href.replace(/\/$/, '');
21
+ const model = option('--model', 'ai-studio/gemini-4-argon');
22
+ assert.ok(model.startsWith('ai-studio/'), 'only the AI Studio provider may be tested');
23
+ const outputDir = path.resolve(option('--out', 'evidence/studio-acceptance'));
24
+ fs.mkdirSync(outputDir, { recursive: true, mode: 0o700 });
25
+ const resultPath = path.join(outputDir, 'results.json');
26
+ const headers = { 'Content-Type': 'application/json', ...(process.env.MAGPIE_GATEWAY_KEY ? { Authorization: `Bearer ${process.env.MAGPIE_GATEWAY_KEY}` } : {}) };
27
+ const report = { startedAt: new Date().toISOString(), gateway: base, model, checks: [], status: 'running', requestCount: 0 };
28
+ const local = localStudio();
29
+ assert.ok(local, 'install and sign in to the managed AI Studio backend first');
30
+ function save() { fs.writeFileSync(resultPath, JSON.stringify(report, null, 2) + '\n', { mode: 0o600 }); }
31
+ async function check(name, fn) {
32
+ const start = performance.now();
33
+ try {
34
+ const evidence = await fn();
35
+ report.checks.push({ name, status: 'pass', elapsedMs: Math.round(performance.now() - start), ...evidence });
36
+ console.log(`PASS ${name}`); save(); return evidence;
37
+ } catch (error) {
38
+ report.checks.push({ name, status: 'fail', elapsedMs: Math.round(performance.now() - start), error: String(error.message).slice(0, 2000) });
39
+ console.error(`FAIL ${name}: ${String(error.message).slice(0, 1000)}`); save(); throw error;
40
+ }
41
+ }
42
+ function browserProcesses() {
43
+ if (process.platform === 'win32') return null;
44
+ return execFileSync('ps', ['-axo', 'pid=,comm='], { encoding: 'utf8' }).split('\n').filter(l => /camoufox|firefox/i.test(l));
45
+ }
46
+ async function chat(payload, options = {}) {
47
+ report.requestCount++;
48
+ const started = performance.now();
49
+ const signal = options.signal || AbortSignal.timeout(180000);
50
+ const response = await fetch(base + '/chat/completions', { method: 'POST', headers, body: JSON.stringify({ model, ...payload }), signal, redirect: 'error' });
51
+ assert.equal(response.status, 200, `HTTP ${response.status}: ${response.ok ? '' : (await response.text()).slice(0, 1500)}`);
52
+ if (!payload.stream) {
53
+ const body = await response.json();
54
+ assert.ok(!body.error, JSON.stringify(body.error));
55
+ return { id: body.id, content: body.choices?.[0]?.message?.content ?? '', finish: body.choices?.[0]?.finish_reason, elapsedMs: Math.round(performance.now() - started) };
56
+ }
57
+ assert.match(response.headers.get('content-type') || '', /text\/event-stream/);
58
+ const reader = response.body.getReader();
59
+ const decoder = new TextDecoder();
60
+ let pending = '', content = '', finish = null, id, done = false, contentMs = null, chunkCount = 0;
61
+ const calls = new Map();
62
+ function parse() {
63
+ pending = pending.replace(/\r\n/g, '\n');
64
+ let boundary;
65
+ while ((boundary = pending.indexOf('\n\n')) >= 0) {
66
+ const event = pending.slice(0, boundary); pending = pending.slice(boundary + 2);
67
+ const data = event.split('\n').filter(l => l.startsWith('data:')).map(l => l.slice(5).trimStart()).join('\n');
68
+ if (!data) continue;
69
+ if (data === '[DONE]') { done = true; continue; }
70
+ const c = JSON.parse(data);
71
+ assert.ok(!c.error, JSON.stringify(c.error));
72
+ id = c.id ?? id;
73
+ const choice = c.choices?.find(choice => choice.index === 0);
74
+ if (!choice) continue;
75
+ chunkCount++;
76
+ const delta = choice.delta ?? {};
77
+ if (delta.content || delta.tool_calls?.length) contentMs ??= Math.round(performance.now() - started);
78
+ content += delta.content ?? '';
79
+ finish = choice.finish_reason ?? finish;
80
+ for (const t of delta.tool_calls ?? []) {
81
+ const prior = calls.get(t.index) ?? { id: '', type: 'function', function: { name: '', arguments: '' } };
82
+ if (t.id) prior.id = t.id;
83
+ if (t.function?.name) prior.function.name += t.function.name;
84
+ if (t.function?.arguments) prior.function.arguments += t.function.arguments;
85
+ if (t.extra_content) prior.extra_content = t.extra_content;
86
+ calls.set(t.index, prior);
87
+ }
88
+ }
89
+ }
90
+ try {
91
+ for (;;) {
92
+ const r = await reader.read();
93
+ if (r.done) break;
94
+ pending += decoder.decode(r.value, { stream: true }); parse();
95
+ }
96
+ pending += decoder.decode(); parse();
97
+ assert.ok(done, 'missing SSE [DONE]');
98
+ return { id, content, finish, calls: [...calls.values()], firstContentOrToolMs: contentMs, chunkCount, elapsedMs: Math.round(performance.now() - started) };
99
+ } finally { await reader.cancel().catch(() => {}); }
100
+ }
101
+ const tools = [
102
+ { type: 'function', function: { name: 'read_probe', description: 'Return the token for a synthetic test key.', parameters: { type: 'object', properties: { key: { type: 'string', enum: ['first'] } }, required: ['key'], additionalProperties: false } } },
103
+ { type: 'function', function: { name: 'verify_probe', description: 'Return a receipt for the exact token from read_probe.', parameters: { type: 'object', properties: { token: { type: 'string' } }, required: ['token'], additionalProperties: false } } },
104
+ ];
105
+ const messages = [{ role: 'user', content: 'First call read_probe with key first. Then call verify_probe using the exact token returned by read_probe. After verify_probe returns, reply with its receipt exactly, with no formatting or extra text. Preserve every character of the receipt, including brackets.' }];
106
+ // Deliberately simulate an OpenAI client/SDK that drops provider extension fields.
107
+ function clientCall(t) { return { id: t.id, type: 'function', function: { ...t.function } }; }
108
+ function toolEvidence(out, name, expected) {
109
+ assert.equal(out.calls.length, 1);
110
+ const call = out.calls[0];
111
+ assert.ok(call.id); assert.equal(call.function.name, name);
112
+ assert.deepEqual(JSON.parse(call.function.arguments), expected);
113
+ assert.equal(out.finish, 'tool_calls');
114
+ return { requestId: out.id, function: name, arguments: expected, signatureExposedByGateway: !!call.extra_content?.google?.thought_signature, firstContentOrToolMs: out.firstContentOrToolMs, elapsedMs: out.elapsedMs };
115
+ }
116
+ try {
117
+ await check('Go backend ready without a login browser', async () => {
118
+ const state = await studioAdmin(local, 'GET', '/api/status');
119
+ assert.equal(state.ready, true); assert.ok(state.accounts.total >= 1);
120
+ const browsers = browserProcesses(); if (browsers) assert.equal(browsers.length, 0);
121
+ return { state: state.state, readyAccounts: state.accounts.ready, browserProcesses: browsers };
122
+ });
123
+ await check('first native tool call through Magpie, medium effort', async () => {
124
+ const out = await chat({ messages, tools, tool_choice: { type: 'function', function: { name: 'read_probe' } }, reasoning_effort: 'medium', stream: true });
125
+ const evidence = toolEvidence(out, 'read_probe', { key: 'first' });
126
+ messages.push({ role: 'assistant', content: out.content || null, tool_calls: out.calls.map(clientCall) }, { role: 'tool', tool_call_id: out.calls[0].id, content: '{"token":"studio-token-8214"}' });
127
+ return evidence;
128
+ });
129
+ await check('second tool call uses first result without echoed signature', async () => {
130
+ const out = await chat({ messages, tools, tool_choice: { type: 'function', function: { name: 'verify_probe' } }, reasoning_effort: 'medium', stream: true });
131
+ const evidence = toolEvidence(out, 'verify_probe', { token: 'studio-token-8214' });
132
+ messages.push({ role: 'assistant', content: out.content || null, tool_calls: out.calls.map(clientCall) }, { role: 'tool', tool_call_id: out.calls[0].id, content: '{"receipt":"STUDIO_CITATION_[cite: 1]_8214"}' });
133
+ return evidence;
134
+ });
135
+ await check('tool continuation preserves literal citation text', async () => {
136
+ const out = await chat({ messages, tools, tool_choice: 'none', reasoning_effort: 'medium', stream: true });
137
+ assert.equal(out.content.trim(), 'STUDIO_CITATION_[cite: 1]_8214'); assert.equal(out.finish, 'stop');
138
+ assert.equal(out.calls.length, 0); messages.push({ role: 'assistant', content: out.content });
139
+ return { requestId: out.id, content: out.content, firstContentOrToolMs: out.firstContentOrToolMs, elapsedMs: out.elapsedMs };
140
+ });
141
+ await check('next user turn retains both tool results', async () => {
142
+ const out = await chat({ messages: [...messages, { role: 'user', content: 'Reply with the token returned by read_probe, then a vertical bar, then the receipt returned by verify_probe. Preserve all characters; no extra text or spaces around the vertical bar.' }], stream: false });
143
+ assert.equal(out.content.trim(), 'studio-token-8214|STUDIO_CITATION_[cite: 1]_8214');
144
+ return { requestId: out.id, content: out.content, elapsedMs: out.elapsedMs };
145
+ });
146
+ await check('cancel an active Magpie request', async () => {
147
+ const controller = new AbortController();
148
+ let rejected = false, sawActive = false, requestError;
149
+ const pending = chat({ messages: [{ role: 'user', content: 'Write a numbered list of the integers 1 through 2000, with each integer written also as an English word. Continue until the whole list is complete.' }], stream: true, reasoning_effort: 'medium' }, { signal: controller.signal }).catch(error => { if (!controller.signal.aborted) requestError = error; else rejected = true; });
150
+ try {
151
+ const deadline = Date.now() + 15000;
152
+ while (Date.now() < deadline) {
153
+ const state = await studioAdmin(local, 'GET', '/api/status');
154
+ if (state.active_requests > 0) { sawActive = true; break; }
155
+ await new Promise(resolve => setTimeout(resolve, 200));
156
+ }
157
+ } finally { controller.abort(new DOMException('Acceptance probe cancellation', 'AbortError')); }
158
+ await pending; if (requestError) throw requestError;
159
+ assert.ok(sawActive, 'request never became active in Studio'); assert.ok(rejected, 'client did not observe cancellation');
160
+ const deadline = Date.now() + 15000;
161
+ let active;
162
+ do {
163
+ active = (await studioAdmin(local, 'GET', '/api/status')).active_requests;
164
+ if (!active) break;
165
+ await new Promise(resolve => setTimeout(resolve, 250));
166
+ } while (Date.now() < deadline);
167
+ assert.equal(active, 0, 'cancelled request still occupies upstream slot');
168
+ return { sawActive, clientAborted: rejected, activeAfterCancellation: active };
169
+ });
170
+ await check('request succeeds after cancellation', async () => {
171
+ const out = await chat({ messages: [{ role: 'user', content: 'Reply with exactly STUDIO_AFTER_CANCEL_8214 and nothing else.' }], stream: false });
172
+ assert.equal(out.content.trim(), 'STUDIO_AFTER_CANCEL_8214');
173
+ return { requestId: out.id, content: out.content, elapsedMs: out.elapsedMs };
174
+ });
175
+ await check('same Magpie sign-in resumes tool history after backend restart', async () => {
176
+ const pidPath = path.join(local.dataDir, 'backend.pid');
177
+ const before = Number(fs.readFileSync(pidPath, 'utf8').trim());
178
+ assert.ok(Number.isInteger(before) && before > 0);
179
+ await stopStudio();
180
+ const out = await chat({ messages: [...messages, { role: 'user', content: 'Reply with the token returned by read_probe, then a vertical bar, then the receipt returned by verify_probe. Preserve all characters; no extra text or spaces around the vertical bar.' }], stream: false });
181
+ assert.equal(out.content.trim(), 'studio-token-8214|STUDIO_CITATION_[cite: 1]_8214');
182
+ const after = Number(fs.readFileSync(pidPath, 'utf8').trim());
183
+ assert.ok(Number.isInteger(after) && after > 0); assert.notEqual(after, before);
184
+ const state = await studioAdmin(local, 'GET', '/api/status');
185
+ assert.equal(state.ready, true);
186
+ return { requestId: out.id, content: out.content, elapsedMs: out.elapsedMs, previousPid: before, currentPid: after, ready: state.ready };
187
+ });
188
+ await check('no login browser after gateway acceptance', async () => {
189
+ const browsers = browserProcesses(); if (browsers) assert.equal(browsers.length, 0);
190
+ return { browserProcesses: browsers };
191
+ });
192
+ report.status = 'pass';
193
+ } catch (error) {
194
+ report.status = 'failed'; report.error = String(error.message).slice(0, 2000); process.exitCode = 1;
195
+ } finally { report.finishedAt = new Date().toISOString(); save(); console.log(`RESULT ${report.status} ${resultPath}`); }