(async () => { // Item 4: manual port answered by an un-helped Bridge asks for Yes, help { const store = { fl_localPort_manual: '11500' }; const sb = sandbox(store, { fetch: async (url) => { if (/11500\/bridge\/health/.test(url)) return { ok: true, json: async () => ({ bridge: true, helped: false, port: 11500 }) }; throw new Error('quiet'); } }); const r = await sb.FlConnect.probe({}); assert.strictEqual(r.waitingHelp, true, 'waitingHelp'); assert.strictEqual(r.manualQuiet, false, 'not Nothing answered'); } // Item 5: refusal keeps previous port and says so; Use automatic clears matching host { const store = { fl_localPort_manual: '11500', fl_ollamaHost: '127.0.0.1:11500' }; const sb = sandbox(store); const res = sb.FlConnect.setManualHost('192.168.1.5:11434'); assert.strictEqual(res.ok, false, 'LAN refused'); assert.ok(/Still using 11500/.test(res.message), 'says which port stays'); assert.strictEqual(store.fl_localPort_manual, '11500', 'previous port kept, not silently changed'); sb._ollamaResolvedBase = { base: 'http://127.0.0.1:11500' }; sb.FlConnect.clearManualHost(); assert.ok(!('fl_localPort_manual' in store), 'manual cleared'); assert.ok(!('fl_ollamaHost' in store), 'matching fl_ollamaHost cleared'); assert.strictEqual(sb._ollamaResolvedBase, null, 'cached base cleared'); store.fl_localPort_manual = '11500'; store.fl_ollamaHost = '127.0.0.1:11435'; sb.FlConnect.clearManualHost(); assert.strictEqual(store.fl_ollamaHost, '127.0.0.1:11435', 'other hosts left alone'); } assert.ok(/\(cur \? '