usegrunt 0.6.4 → 0.6.6
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/README.md +15 -6
- package/dist/local/beatapi-setup.js +83 -0
- package/dist/local/beatapi.js +298 -0
- package/dist/local/clixad-preload.js +177 -0
- package/dist/local/clixad-setup.js +345 -0
- package/dist/local/clixad.js +398 -0
- package/dist/local/data-sharing.js +18 -2
- package/dist/local/fallback-setup.js +74 -22
- package/dist/local/free-api.js +2 -1
- package/dist/local/freebuff.js +5 -1
- package/dist/local/freellmapi.js +3 -5
- package/dist/local/kilo.js +209 -0
- package/dist/local/livekit-setup.js +269 -0
- package/dist/local/livekit.js +219 -0
- package/dist/local/main.js +13 -11
- package/dist/local/parallel.js +2 -0
- package/dist/local/perch-process.js +377 -0
- package/dist/local/perch-setup.js +297 -0
- package/dist/local/perch.js +480 -0
- package/dist/local/pollinations-setup.js +109 -0
- package/dist/local/pollinations.js +324 -0
- package/dist/local/registry.js +4 -4
- package/dist/local/setup.js +340 -62
- package/dist/local/source.js +7 -2
- package/dist/local/wizard.js +24 -21
- package/dist/registry/adapters.json +65 -29
- package/dist/registry.js +4 -2
- package/package.json +1 -1
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { constants } from 'node:fs';
|
|
3
|
+
import { access, lstat, mkdir, mkdtemp, open, rename, rm, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { randomUUID } from 'node:crypto';
|
|
5
|
+
import { homedir } from 'node:os';
|
|
6
|
+
import { join, resolve } from 'node:path';
|
|
7
|
+
import { FreeApi } from './free-api.js';
|
|
8
|
+
import { verifiedDeepSeekFetch } from './deepseek-response.js';
|
|
9
|
+
import { SourceError } from './source.js';
|
|
10
|
+
export const LIVEKIT_CLI_VERSION = '2.19.4';
|
|
11
|
+
export const LIVEKIT_DEEPSEEK = 'deepseek-ai/deepseek-v4.1-flash';
|
|
12
|
+
export const LIVEKIT_GATEWAY = 'https://agent-gateway.livekit.cloud';
|
|
13
|
+
export const LIVEKIT_RECEIPT_MAX_AGE_MS = 30 * 86400000;
|
|
14
|
+
const configDirectory = () => process.env.MILO_CONFIG_DIR || join(process.env.XDG_CONFIG_HOME || join(homedir(), '.config'), 'milo');
|
|
15
|
+
export function livekitPaths(directory = configDirectory(), nativeDirectory = join(homedir(), '.livekit')) {
|
|
16
|
+
const home = resolve(directory, 'livekit');
|
|
17
|
+
return { home, binary: join(home, 'bin', process.platform === 'win32' ? 'lk.exe' : 'lk'),
|
|
18
|
+
work: join(home, 'work'), receipt: join(home, 'free-build.json'), nativeHome: nativeDirectory, nativeConfig: join(nativeDirectory, 'cli-config.yaml') };
|
|
19
|
+
}
|
|
20
|
+
// A shell's LiveKit credentials or project must not override the native project
|
|
21
|
+
// chosen in the verified receipt. Keep HOME unchanged for standard CLI auth.
|
|
22
|
+
export function livekitEnvironment() {
|
|
23
|
+
return Object.fromEntries(Object.entries(process.env).filter(([key]) => !/^(?:livekit_|lk_)/i.test(key)));
|
|
24
|
+
}
|
|
25
|
+
// The official CLI's normal table includes an API-key column. Project only
|
|
26
|
+
// public identity metadata and never use its secret-bearing JSON output.
|
|
27
|
+
export function parseLiveKitProjects(output) {
|
|
28
|
+
const result = [];
|
|
29
|
+
const clean = output.replace(/\x1b\][^\x07]*(?:\x07|\x1b\\)/g, '').replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, '').replaceAll('\r', '');
|
|
30
|
+
for (const line of clean.split('\n')) {
|
|
31
|
+
const columns = line.split(/[│┃|]/).map(value => value.trim()).filter(Boolean);
|
|
32
|
+
if (columns.length < 4)
|
|
33
|
+
continue;
|
|
34
|
+
const [label, id, url] = columns;
|
|
35
|
+
if (!label || !id || !url || !/^wss:\/\/[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.livekit\.cloud\/?$/i.test(url))
|
|
36
|
+
continue;
|
|
37
|
+
const selector = label.replace(/^\*\s*/, '');
|
|
38
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9 _.-]{0,127}$/.test(selector) || !/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/.test(id))
|
|
39
|
+
continue;
|
|
40
|
+
result.push({ selector, id, url: new URL(url).origin, default: label.startsWith('*') });
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
function validateReceipt(value) {
|
|
45
|
+
const receipt = value;
|
|
46
|
+
const checked = typeof receipt?.checkedAt === 'string' ? Date.parse(receipt.checkedAt) : NaN;
|
|
47
|
+
let url;
|
|
48
|
+
try {
|
|
49
|
+
url = new URL(typeof receipt?.projectURL === 'string' ? receipt.projectURL : '');
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
throw new SourceError('logged_out', 'LiveKit Free Build project verification is missing or expired; rerun usegrunt setup');
|
|
53
|
+
}
|
|
54
|
+
if (!receipt || receipt.version !== 1 || receipt.plan !== 'Build' || receipt.payAsYouGo !== false || receipt.paymentMethodPresent !== false || receipt.purchasedCredits !== 0
|
|
55
|
+
|| typeof receipt.projectSelector !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9 _.-]{0,127}$/.test(receipt.projectSelector)
|
|
56
|
+
|| typeof receipt.projectId !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/.test(receipt.projectId)
|
|
57
|
+
|| url.protocol !== 'wss:' || !/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.livekit\.cloud$/.test(url.hostname)
|
|
58
|
+
|| url.username || url.password || url.port || url.search || url.hash || url.pathname !== '/'
|
|
59
|
+
|| !Number.isFinite(checked) || checked > Date.now() + 60000 || Date.now() - checked > LIVEKIT_RECEIPT_MAX_AGE_MS) {
|
|
60
|
+
throw new SourceError('logged_out', 'LiveKit Free Build project verification is missing or expired; rerun usegrunt setup');
|
|
61
|
+
}
|
|
62
|
+
return { version: 1, plan: 'Build', payAsYouGo: false, paymentMethodPresent: false, purchasedCredits: 0,
|
|
63
|
+
projectSelector: receipt.projectSelector, projectId: receipt.projectId, projectURL: url.origin, checkedAt: receipt.checkedAt };
|
|
64
|
+
}
|
|
65
|
+
async function privateDirectory(path, create = false) {
|
|
66
|
+
if (create)
|
|
67
|
+
await mkdir(path, { recursive: true, mode: 0o700 });
|
|
68
|
+
const stat = await lstat(path);
|
|
69
|
+
if (!stat.isDirectory() || stat.isSymbolicLink() || stat.uid !== process.getuid?.() || (stat.mode & 0o777) !== 0o700) {
|
|
70
|
+
throw new SourceError('logged_out', 'Unsafe LiveKit private directory; rerun usegrunt setup');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export async function readLiveKitFreeBuildReceipt(directory = configDirectory()) {
|
|
74
|
+
await privateDirectory(livekitPaths(directory).home);
|
|
75
|
+
const file = await open(livekitPaths(directory).receipt, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
76
|
+
try {
|
|
77
|
+
const stat = await file.stat();
|
|
78
|
+
if (!stat.isFile() || stat.uid !== process.getuid?.() || (stat.mode & 0o777) !== 0o600 || stat.size > 4096)
|
|
79
|
+
throw new SourceError('logged_out', 'Unsafe LiveKit Free Build receipt; rerun usegrunt setup');
|
|
80
|
+
return validateReceipt(JSON.parse(await file.readFile('utf8')));
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
await file.close();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Setup supplies these public metadata and billing facts only after an actual
|
|
87
|
+
// browser check. The receipt never contains the CLI-owned API key or secret.
|
|
88
|
+
export async function writeLiveKitFreeBuildReceipt(directory, receipt) {
|
|
89
|
+
const value = validateReceipt(receipt), paths = livekitPaths(directory), temporary = join(paths.home, `.free-build-${randomUUID()}.tmp`);
|
|
90
|
+
await privateDirectory(paths.home, true);
|
|
91
|
+
try {
|
|
92
|
+
await writeFile(temporary, JSON.stringify(value), { mode: 0o600, flag: 'wx' });
|
|
93
|
+
await rename(temporary, paths.receipt);
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
await rm(temporary, { force: true });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Inspect metadata only. The official CLI remains the only code reading its
|
|
100
|
+
// native API keys and signing its short-lived inference token.
|
|
101
|
+
export async function validateLiveKitNativeConfig(nativeDirectory = join(homedir(), '.livekit')) {
|
|
102
|
+
const home = await lstat(nativeDirectory), auth = await lstat(join(nativeDirectory, 'cli-config.yaml'));
|
|
103
|
+
if (!home.isDirectory() || home.isSymbolicLink() || home.uid !== process.getuid?.() || (home.mode & 0o777) !== 0o700
|
|
104
|
+
|| !auth.isFile() || auth.isSymbolicLink() || auth.uid !== process.getuid?.() || (auth.mode & 0o777) !== 0o600 || auth.size === 0) {
|
|
105
|
+
throw new SourceError('logged_out', 'Unsafe LiveKit native login; rerun usegrunt setup');
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async function cliOutput(binary, args, cwd, signal, maxBuffer) {
|
|
109
|
+
signal.throwIfAborted();
|
|
110
|
+
const deadline = AbortSignal.timeout(10000), tokenSignal = AbortSignal.any([signal, deadline]);
|
|
111
|
+
return await new Promise((resolveOutput, reject) => {
|
|
112
|
+
const child = execFile(binary, args, { cwd, env: livekitEnvironment(), encoding: 'utf8', signal: tokenSignal, killSignal: 'SIGKILL', maxBuffer, windowsHide: true }, (error, stdout) => {
|
|
113
|
+
if (error) {
|
|
114
|
+
reject(new SourceError(signal.aborted ? 'cancelled' : deadline.aborted ? 'timeout' : 'logged_out', 'LiveKit native CLI command failed; rerun usegrunt setup'));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
resolveOutput(stdout);
|
|
118
|
+
});
|
|
119
|
+
child.stdin?.end();
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
async function inferenceToken(binary, receipt, cwd, signal) {
|
|
123
|
+
const config = join(cwd, 'livekit.toml');
|
|
124
|
+
const output = await cliOutput(binary, ['--config', config, 'project', 'list'], cwd, signal, 262144);
|
|
125
|
+
const selected = parseLiveKitProjects(output).filter(project => project.selector === receipt.projectSelector);
|
|
126
|
+
if (selected.length !== 1 || selected[0].id !== receipt.projectId || selected[0].url !== receipt.projectURL) {
|
|
127
|
+
throw new SourceError('logged_out', 'LiveKit native project differs from its verified free Build project; rerun usegrunt setup');
|
|
128
|
+
}
|
|
129
|
+
const token = (await cliOutput(binary, ['--project', receipt.projectSelector, '--config', config, 'token', 'create',
|
|
130
|
+
'--inference', '--token-only', '--valid-for', '10m', '--identity', 'agent'], cwd, signal, 32768)).trim();
|
|
131
|
+
if (!/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(token) || token.length > 16384) {
|
|
132
|
+
throw new SourceError('logged_out', 'LiveKit CLI returned no inference token; rerun usegrunt setup');
|
|
133
|
+
}
|
|
134
|
+
return token;
|
|
135
|
+
}
|
|
136
|
+
export class LiveKit {
|
|
137
|
+
options;
|
|
138
|
+
id = 'livekit';
|
|
139
|
+
supportsFunctionTools = true;
|
|
140
|
+
shutdown = new AbortController();
|
|
141
|
+
pending = new Set();
|
|
142
|
+
constructor(options = {}) {
|
|
143
|
+
this.options = options;
|
|
144
|
+
}
|
|
145
|
+
async ready() {
|
|
146
|
+
const paths = livekitPaths(this.options.directory, this.options.nativeDirectory);
|
|
147
|
+
try {
|
|
148
|
+
const receipt = await readLiveKitFreeBuildReceipt(this.options.directory);
|
|
149
|
+
await validateLiveKitNativeConfig(paths.nativeHome);
|
|
150
|
+
await access(this.options.binary ?? paths.binary, constants.X_OK);
|
|
151
|
+
return { paths, receipt };
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
if (error instanceof SourceError)
|
|
155
|
+
throw error;
|
|
156
|
+
throw new SourceError('logged_out', 'LiveKit native Free Build login is unavailable; rerun usegrunt setup');
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
async available() { try {
|
|
160
|
+
await this.ready();
|
|
161
|
+
return !this.shutdown.signal.aborted;
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
return false;
|
|
165
|
+
} }
|
|
166
|
+
async healthCheck() { return this.available(); }
|
|
167
|
+
async complete(request, caller) {
|
|
168
|
+
caller.throwIfAborted();
|
|
169
|
+
const task = this.completeOnce(request, caller);
|
|
170
|
+
this.pending.add(task);
|
|
171
|
+
try {
|
|
172
|
+
return await task;
|
|
173
|
+
}
|
|
174
|
+
finally {
|
|
175
|
+
this.pending.delete(task);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
async completeOnce(request, caller) {
|
|
179
|
+
const signal = AbortSignal.any([caller, this.shutdown.signal, AbortSignal.timeout(this.options.timeout ?? 180000)]);
|
|
180
|
+
let temporary;
|
|
181
|
+
try {
|
|
182
|
+
signal.throwIfAborted();
|
|
183
|
+
if (request.imageInput)
|
|
184
|
+
throw new SourceError('upstream', 'LiveKit requires text input');
|
|
185
|
+
if (request.tools.some(tool => tool.type !== 'function'))
|
|
186
|
+
throw new SourceError('upstream', 'LiveKit requires function tools');
|
|
187
|
+
const { paths, receipt } = await this.ready();
|
|
188
|
+
signal.throwIfAborted();
|
|
189
|
+
await privateDirectory(paths.work, true);
|
|
190
|
+
temporary = await mkdtemp(join(paths.work, '.token-'));
|
|
191
|
+
await writeFile(join(temporary, 'livekit.toml'), '', { mode: 0o600, flag: 'wx' });
|
|
192
|
+
const token = await inferenceToken(this.options.binary ?? paths.binary, receipt, temporary, signal);
|
|
193
|
+
signal.throwIfAborted();
|
|
194
|
+
const source = new FreeApi('livekit', { fetcher: verifiedDeepSeekFetch(this.options.fetcher), timeout: this.options.timeout ?? 180000,
|
|
195
|
+
loadGrant: async () => ({ base_url: LIVEKIT_GATEWAY, token }) });
|
|
196
|
+
try {
|
|
197
|
+
return await source.complete({ ...request, model: this.id }, signal);
|
|
198
|
+
}
|
|
199
|
+
finally {
|
|
200
|
+
await source.close();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
caller.throwIfAborted();
|
|
205
|
+
if (this.shutdown.signal.aborted)
|
|
206
|
+
throw new SourceError('cancelled', 'LiveKit request cancelled during shutdown');
|
|
207
|
+
if (signal.aborted)
|
|
208
|
+
throw new SourceError('timeout', 'LiveKit request timed out');
|
|
209
|
+
if (error instanceof SourceError)
|
|
210
|
+
throw error;
|
|
211
|
+
throw new SourceError('upstream', 'LiveKit request failed; rerun usegrunt setup');
|
|
212
|
+
}
|
|
213
|
+
finally {
|
|
214
|
+
if (temporary)
|
|
215
|
+
await rm(temporary, { recursive: true, force: true });
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
async close() { this.shutdown.abort(); await Promise.allSettled([...this.pending]); }
|
|
219
|
+
}
|
package/dist/local/main.js
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { knownAdapters } from '../registry.js';
|
|
2
|
+
import { disabledAdapters, knownAdapters } from '../registry.js';
|
|
3
3
|
import { realpathSync } from 'node:fs';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
5
|
import { basename } from 'node:path';
|
|
6
6
|
import { serve } from '@hono/node-server';
|
|
7
7
|
import { createLocalApp } from './api.js';
|
|
8
|
-
import {
|
|
8
|
+
import { positive } from './freebuff.js';
|
|
9
9
|
import { Sources } from './source.js';
|
|
10
10
|
import { FreeLLMAPI } from './freellmapi.js';
|
|
11
11
|
import { Nvidia } from './nvidia.js';
|
|
12
12
|
import { Zro } from './zro.js';
|
|
13
13
|
import { TokenHarbor } from './tokenharbor.js';
|
|
14
14
|
import { Runcrate } from './runcrate.js';
|
|
15
|
-
import { Apinex } from './apinex.js';
|
|
16
15
|
import { MistralVibe } from './mistral-vibe.js';
|
|
16
|
+
import { LiveKit } from './livekit.js';
|
|
17
|
+
import { Pollinations } from './pollinations.js';
|
|
18
|
+
import { BeatAPI } from './beatapi.js';
|
|
19
|
+
import { Kilo } from './kilo.js';
|
|
20
|
+
import { Clixad } from './clixad.js';
|
|
21
|
+
import { Perch } from './perch.js';
|
|
17
22
|
import { RegistrySource } from './registry-source.js';
|
|
18
23
|
import { ManagedRouter } from './managed-router.js';
|
|
19
24
|
import { ConsentSource } from './consent-source.js';
|
|
@@ -50,8 +55,8 @@ export function configure(env = process.env, registry = () => bundledRegistry) {
|
|
|
50
55
|
// default while retaining explicit environment and custom-model overrides.
|
|
51
56
|
return adapter?.models ?? (adapter?.model && adapter.model !== 'big-pickle' ? [adapter.model] : DEFAULT_OPENCODE_MODELS);
|
|
52
57
|
};
|
|
53
|
-
const registered = [dots, new Codex(env.MILO_CODEX_MODEL ? { model: env.MILO_CODEX_MODEL } : {}), new ManagedRouter(new FreeLLMAPI(connection), url, configDir(env)), new
|
|
54
|
-
const ids = env.MILO_SOURCES?.split(',').map(id => id.trim()) ?? registry().adapters.filter(adapter => knownAdapters.has(adapter.id)).map(adapter => adapter.id);
|
|
58
|
+
const registered = [dots, new Codex(env.MILO_CODEX_MODEL ? { model: env.MILO_CODEX_MODEL } : {}), new ManagedRouter(new FreeLLMAPI(connection), url, configDir(env)), new Kilo({ directory: configDir(env) }), new Nvidia({ directory: configDir(env) }), new Zro({ directory: configDir(env) }), new TokenHarbor({ directory: configDir(env) }), new Runcrate({ directory: configDir(env) }), new MistralVibe({ directory: configDir(env) }), new LiveKit({ directory: configDir(env) }), new Pollinations({ directory: configDir(env) }), new BeatAPI({ directory: configDir(env) }), new Clixad({ directory: configDir(env) }), new Perch({ directory: configDir(env) }), new OpenCode({ models: opencodeModels, ...(env.MILO_OPENCODE_URL ? { url: env.MILO_OPENCODE_URL } : {}) })];
|
|
59
|
+
const ids = (env.MILO_SOURCES?.split(',').map(id => id.trim()) ?? registry().adapters.filter(adapter => knownAdapters.has(adapter.id)).map(adapter => adapter.id)).filter(id => id && !disabledAdapters.has(id));
|
|
55
60
|
const routing = ids.every(id => knownAdapters.has(id)) ? { registry } : undefined;
|
|
56
61
|
return new Sources(ids.map(id => {
|
|
57
62
|
const source = registered.find(source => source.id === id);
|
|
@@ -59,7 +64,7 @@ export function configure(env = process.env, registry = () => bundledRegistry) {
|
|
|
59
64
|
throw new Error(`Unknown grunt source: ${id}`);
|
|
60
65
|
const consent = requiresDataSharing(id) && id !== 'tokenharbor' ? new ConsentSource(source, configDir(env)) : source;
|
|
61
66
|
return !routing && knownAdapters.has(id) ? new RegistrySource(consent, registry) : consent;
|
|
62
|
-
}), routing);
|
|
67
|
+
}), routing, disabledAdapters);
|
|
63
68
|
}
|
|
64
69
|
export function start(env = process.env) {
|
|
65
70
|
let registry = structuredClone(bundledRegistry);
|
|
@@ -79,7 +84,7 @@ export function start(env = process.env) {
|
|
|
79
84
|
const client = squire ??= new BrowserSquire({ background: true, signal, dataSharingApproved: approved });
|
|
80
85
|
client.approveDataSharing([...new Set([...(await readDataSharingConsent(directory, [...knownAdapters])), ...approved])]);
|
|
81
86
|
try {
|
|
82
|
-
const result = await setupFallbacks({ directory, run: (binary, args) => command(binary, args, false, signal), notify: console.error, adapters: [adapter.id], squire: client, signal, dataSharingApproved: approved,
|
|
87
|
+
const result = await setupFallbacks({ directory, run: (binary, args) => command(binary, args, false, signal), notify: console.error, adapters: [adapter.id], squire: client, signal, background: true, dataSharingApproved: approved,
|
|
83
88
|
connect: () => client.connect() });
|
|
84
89
|
if (result.unavailable.length)
|
|
85
90
|
throw new Error('Adapter setup incomplete');
|
|
@@ -103,12 +108,9 @@ export function start(env = process.env) {
|
|
|
103
108
|
throw new Error('MILO_PORT must be at most 65535');
|
|
104
109
|
const app = createLocalApp(sources, { port, dotsEnv: env, log: cwd => console.error(`grunt working directory: ${cwd}`) });
|
|
105
110
|
const server = serve({ fetch: async (request) => { await ready; return app.fetch(request); }, hostname: HOST, port }, () => console.error(`grunt model API: http://${HOST}:${port}/v1`));
|
|
106
|
-
// A distinct source list prevents FreeLLMAPI -> grunt -> FreeLLMAPI recursion.
|
|
107
|
-
const fallback = env.MILO_FREEBUFF_BRIDGE !== '0' && sources.sources.some(s => ['freellmapi', 'kilo'].includes(s.id)) ? new Sources([new ConsentSource(new Freebuff({ toolBridge: env.MILO_FREEBUFF_JSON_BRIDGE === '1' }), directory)]) : undefined;
|
|
108
|
-
const bridge = fallback ? serve({ fetch: createLocalApp(fallback, { port: 8789 }).fetch, hostname: HOST, port: 8789 }) : undefined;
|
|
109
111
|
let closing = false;
|
|
110
112
|
const close = async () => { if (closing)
|
|
111
|
-
return; closing = true; await sync.close(); await sources.close();
|
|
113
|
+
return; closing = true; await sync.close(); await sources.close(); server.close(); };
|
|
112
114
|
process.once('SIGINT', close);
|
|
113
115
|
process.once('SIGTERM', close);
|
|
114
116
|
return { server, close };
|
package/dist/local/parallel.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export const SETUP_CONCURRENCY = 6;
|
|
2
|
+
export const BROWSER_CONCURRENCY = 3;
|
|
1
3
|
// Limit browser/build pressure as the vetted catalog grows. Wait for started
|
|
2
4
|
// jobs before rejecting so callers can safely close shared resources.
|
|
3
5
|
export async function parallelMap(items, task, limit = 3, signal) {
|