usegrunt 0.6.1 → 0.6.3

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.
@@ -8,19 +8,23 @@ import { setTimeout as delay } from 'node:timers/promises';
8
8
  import { intro, outro, spinner, log, note, multiselect, isCancel } from '@clack/prompts';
9
9
  import chalk from 'chalk';
10
10
  import { setupFallbacks } from './fallback-setup.js';
11
+ import { parallelMap } from './parallel.js';
12
+ import { withTerminal } from './terminal.js';
11
13
  import { DOCTOR_TIMEOUT_MS } from './freebuff.js';
12
14
  import { BrowserSquire, PROVIDERS, setup, squireEnvironment } from './setup.js';
13
15
  import { RegistrySync } from './registry.js';
14
16
  import { bundledRegistry, knownAdapters } from '../registry.js';
15
17
  import { banner } from './banner.js';
18
+ import { approveDataSharing, requiresDataSharing } from './data-sharing.js';
16
19
  import { HARNESSES, configurePi, connectHarness, detectHarnesses } from './harnesses.js';
17
20
  export const configDir = (env = process.env) => env.MILO_CONFIG_DIR || join(env.XDG_CONFIG_HOME || join(homedir(), '.config'), 'milo');
18
21
  export async function command(binary, args, interactive = false, signal) {
19
- await new Promise((resolve, reject) => {
22
+ const run = () => new Promise((resolve, reject) => {
20
23
  const child = spawn(binary, args, { stdio: interactive ? 'inherit' : 'ignore', ...(signal ? { signal } : {}) });
21
24
  child.once('error', () => reject(new Error(`Could not run ${binary}`)));
22
25
  child.once('exit', code => code === 0 ? resolve() : reject(new Error(`${binary} failed; inspect its service status before retrying`)));
23
26
  });
27
+ await (interactive ? withTerminal(run) : run());
24
28
  }
25
29
  async function step(label, task, done = () => label) {
26
30
  const progress = spinner();
@@ -67,11 +71,12 @@ export async function squireBrokerExists() {
67
71
  return result.stdout === 'present';
68
72
  }
69
73
  export async function connectSquire(options = {}) {
70
- const probe = async () => { const squire = new BrowserSquire(); try {
74
+ const probe = async () => { const squire = options.squire ?? new BrowserSquire(); try {
71
75
  await squire.connect();
72
76
  }
73
77
  finally {
74
- await squire.close();
78
+ if (!options.squire)
79
+ await squire.close();
75
80
  } };
76
81
  try {
77
82
  await probe();
@@ -97,7 +102,6 @@ export async function preflight(run = command) {
97
102
  throw new Error('Run setup on Linux with systemd or macOS with launchd.');
98
103
  for (const [binary, args, fix] of [
99
104
  ['npm', ['--version'], 'Install Node.js 22 or 24 LTS including npm.'],
100
- ['pi', ['--version'], 'Run npm install --global @mariozechner/pi-coding-agent.'],
101
105
  ['tar', ['--version'], 'Install tar using your system package manager.']
102
106
  ]) {
103
107
  try {
@@ -128,17 +132,27 @@ export async function preflight(run = command) {
128
132
  const systemdQuote = (value) => '"' + value.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll('%', '%%').replaceAll('$', '$$').replaceAll('\n', '\\n') + '"';
129
133
  const xml = (value) => value.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;').replaceAll('"', '&quot;');
130
134
  export async function installedSources(directory = configDir()) {
135
+ try {
136
+ const sources = JSON.parse(await readFile(join(directory, 'installed-sources.json'), 'utf8'));
137
+ if (!Array.isArray(sources) || !sources.length || sources.some(id => typeof id !== 'string' || ![...knownAdapters, 'freellmapi'].includes(id)))
138
+ throw new Error('Invalid saved grunt sources');
139
+ return [...new Set(sources)].join(',');
140
+ }
141
+ catch (error) {
142
+ if (error.code !== 'ENOENT')
143
+ throw error;
144
+ }
131
145
  try {
132
146
  await access(join(directory, 'router-admin.json'));
133
147
  }
134
148
  catch (error) {
135
149
  if (error.code !== 'ENOENT')
136
150
  throw error;
137
- return 'freebuff,opencode';
151
+ return 'freebuff,opencode,kilo,zro';
138
152
  }
139
- return 'freellmapi,kilo,freebuff,opencode';
153
+ return 'freellmapi,kilo,freebuff,opencode,zro';
140
154
  }
141
- export async function installService() {
155
+ export async function installService(adapters) {
142
156
  if (!['linux', 'darwin'].includes(process.platform))
143
157
  throw new Error('grunt background service requires systemd or launchd');
144
158
  const directory = configDir(), runtime = join(directory, 'runtime');
@@ -153,7 +167,7 @@ export async function installService() {
153
167
  const port = process.env.MILO_PORT || '8788';
154
168
  if (!/^\d+$/.test(port) || Number(port) < 1 || Number(port) > 65535)
155
169
  throw new Error('Invalid grunt service port');
156
- const env = { GRUNT_DAEMON: '1', MILO_CONFIG_DIR: directory, MILO_PORT: port, MILO_SOURCES: await installedSources(directory), PATH: process.env.PATH || '/usr/local/bin:/usr/bin:/bin' };
170
+ const env = { GRUNT_DAEMON: '1', MILO_CONFIG_DIR: directory, MILO_PORT: port, MILO_SOURCES: adapters?.join(',') ?? await installedSources(directory), PATH: process.env.PATH || '/usr/local/bin:/usr/bin:/bin' };
157
171
  if (process.env.MILO_FREELLMAPI_URL)
158
172
  env.MILO_FREELLMAPI_URL = process.env.MILO_FREELLMAPI_URL;
159
173
  const opencodeConfig = join(directory, 'opencode-free.json');
@@ -166,6 +180,7 @@ export async function installService() {
166
180
  throw error;
167
181
  }
168
182
  await installBackgroundService('milo', entry, env);
183
+ await writeFile(join(directory, 'installed-sources.json'), JSON.stringify(env.MILO_SOURCES.split(',')), { mode: 0o600 });
169
184
  }
170
185
  export async function installBackgroundService(name, entry, env) {
171
186
  if (!/^[a-z][a-z0-9-]*$/.test(name))
@@ -380,79 +395,114 @@ export async function connectHarnesses(port, options = {}) {
380
395
  note(connected.map(h => `${chalk.bold(h.name)}\n ${h.launch(port)}`).join('\n'), 'Start coding with grunt');
381
396
  return connected;
382
397
  }
383
- const wizardActions = { banner, preflight, connectSquire, setup, setupFallbacks, installService, configurePi, checkService, checkFallbackServices, loadRegistry, checkServiceSources, connectHarnesses };
398
+ const wizardActions = { installedSources, createSquire: () => new BrowserSquire(), banner, preflight, connectSquire, setup, setupFallbacks, installService, configurePi, checkService, checkFallbackServices, loadRegistry, checkServiceSources, connectHarnesses, approveDataSharing };
384
399
  export async function wizard(add, actions = wizardActions) {
385
400
  if (add && !Object.hasOwn(PROVIDERS, add))
386
401
  throw new Error(`Choose a supported provider: ${Object.keys(PROVIDERS).join(', ')}`);
387
- await actions.banner?.();
388
- intro(chalk.hex('#f4b41a').bold('grunt') + chalk.dim(' — npx usegrunt setup'));
389
- note(PREAMBLE, 'What grunt does');
390
- await step('Checking prerequisites', () => actions.preflight());
391
- note(SQUIRE_NOTICE, 'Google sign-in for Trusty Squire');
392
- await step('Connecting Trusty Squire', () => actions.connectSquire());
393
- if (add) {
394
- await step('FreeLLMAPI and provider grants', () => actions.setup(line => log.info(line), [add]));
395
- await step('Starting the grunt background service', actions.installService);
396
- await step('Waiting for grunt to answer', () => actions.checkService(Number(process.env.MILO_PORT || '8788')));
397
- outro(`${add} connected`);
398
- return;
399
- }
400
- const pulled = actions.loadRegistry ? await step('Pulling the free service list from the registry', () => actions.loadRegistry()) : { registry: bundledRegistry, origin: 'bundled' };
401
- const { registry } = pulled;
402
- const published = registry.published.slice(0, 10);
403
- if (pulled.origin === 'remote')
404
- log.info(`Registry: ${registry.adapters.length} free services, published ${published}`);
405
- else
406
- log.warn(`Registry unreachable; using the ${pulled.origin === 'cache' ? 'list saved by an earlier setup' : 'list bundled with this version'} (published ${published})`);
407
- const adapters = registry.adapters.filter(adapter => knownAdapters.has(adapter.id));
408
- log.message(registry.adapters.map(adapter => knownAdapters.has(adapter.id)
409
- ? `${chalk.bold(adapter.id.padEnd(10))} ${chalk.dim(describe(adapter))}`
410
- : `${chalk.dim(adapter.id.padEnd(10))} ${chalk.dim('skipped: needs a newer usegrunt')}`).join('\n'));
411
- const ids = adapters.map(adapter => adapter.id);
412
- const results = new Map(ids.map(id => [id, {}]));
413
- const unavailable = [];
414
- const notify = report();
415
- log.step(`Signing up for ${ids.length} free services`);
416
- for (const id of ids) {
417
- const outcome = await step(`${id}: installing and signing in`, () => actions.setupFallbacks({ directory: configDir(), run: command, adapters: [id], notify }), result => result.unavailable.includes(id) ? `${id}: sign-in incomplete` : `${id}: signed in`);
418
- const failed = outcome.unavailable.includes(id);
419
- if (failed)
420
- unavailable.push(id);
421
- results.get(id).signup = failed ? 'fail' : 'pass';
422
- }
423
- log.step('Connecting the services to the grunt daemon');
424
- await step('Starting the grunt background service', actions.installService);
425
- const port = Number(process.env.MILO_PORT || '8788');
426
- await step(`Waiting for grunt to answer at http://127.0.0.1:${port}`, () => actions.checkService(port));
427
- const beforeSources = new Set(unavailable);
428
- if (actions.checkServiceSources)
429
- await step('Checking which services the daemon runs', () => actions.checkServiceSources(unavailable, notify, ids));
430
- for (const id of ids)
431
- results.get(id).daemon = beforeSources.has(id) ? 'skip' : unavailable.includes(id) ? 'fail' : 'pass';
432
- log.step('Testing each service with a real request through grunt');
433
- for (const id of ids) {
434
- const before = unavailable.includes(id);
435
- // Hold the result line until the spinner is gone so the two do not share a row.
436
- const lines = [], progress = spinner();
437
- progress.start(`${id}: sending a test request through grunt`);
438
- try {
439
- await actions.checkFallbackServices(unavailable, port, line => lines.push(line), [id]);
402
+ const squire = actions.createSquire?.();
403
+ try {
404
+ await actions.banner?.();
405
+ intro(chalk.hex('#f4b41a').bold('grunt') + chalk.dim(' — npx usegrunt setup'));
406
+ note(PREAMBLE, 'What grunt does');
407
+ await step('Checking prerequisites', () => actions.preflight());
408
+ note(SQUIRE_NOTICE, 'Google sign-in for Trusty Squire');
409
+ await step('Connecting Trusty Squire', () => actions.connectSquire(squire ? { squire } : {}));
410
+ // Capture legacy API routing before default Kilo setup creates its admin file.
411
+ const previous = (await actions.installedSources?.())?.split(',') ?? [];
412
+ if (add) {
413
+ const defaults = bundledRegistry.adapters.filter(adapter => knownAdapters.has(adapter.id)).map(adapter => adapter.id);
414
+ const sources = ['kilo', 'nvidia', 'zro', 'tokenharbor'].includes(add)
415
+ ? [...new Set([...(previous.length ? previous : defaults), add])]
416
+ : [...new Set(['freellmapi', ...previous, ...defaults])];
417
+ const consent = await (actions.approveDataSharing ?? approveDataSharing)({ directory: configDir(), providers: sources });
418
+ if (consent.skipped.includes(add)) {
419
+ // A declined addition still needs to replace a previously installed
420
+ // runtime that predates consent enforcement. Keep only prior choices.
421
+ if (previous.length) {
422
+ await step('Updating the grunt background service', () => actions.installService(previous));
423
+ await step('Waiting for grunt to answer', () => actions.checkService(Number(process.env.MILO_PORT || '8788')));
424
+ }
425
+ outro(`${add} skipped; data sharing was not approved`);
426
+ return;
427
+ }
428
+ squire?.approveDataSharing?.(consent.approved);
429
+ const consentOptions = consent.approved.length ? { dataSharingApproved: consent.approved } : {};
430
+ await step('Connecting free provider access', () => actions.setup(line => log.info(line), [add], { ...(squire ? { squire } : {}), ...consentOptions }));
431
+ // Explicit additions must survive the saved source list from an older
432
+ // install. Keep its routing choices rather than enabling every adapter.
433
+ const approved = new Set(consent.approved);
434
+ const enabled = sources.filter(id => !requiresDataSharing(id) || approved.has(id));
435
+ await step('Starting the grunt background service', () => actions.installService(enabled));
436
+ await step('Waiting for grunt to answer', () => actions.checkService(Number(process.env.MILO_PORT || '8788')));
437
+ outro(`${add} connected`);
438
+ return;
440
439
  }
441
- finally {
442
- progress.clear();
443
- lines.forEach(notify);
440
+ const pulled = actions.loadRegistry ? await step('Pulling the free service list from the registry', () => actions.loadRegistry()) : { registry: bundledRegistry, origin: 'bundled' };
441
+ const { registry } = pulled;
442
+ const published = registry.published.slice(0, 10);
443
+ if (pulled.origin === 'remote')
444
+ log.info(`Registry: ${registry.adapters.length} free services, published ${published}`);
445
+ else
446
+ log.warn(`Registry unreachable; using the ${pulled.origin === 'cache' ? 'list saved by an earlier setup' : 'list bundled with this version'} (published ${published})`);
447
+ const adapters = registry.adapters.filter(adapter => knownAdapters.has(adapter.id));
448
+ log.message(registry.adapters.map(adapter => knownAdapters.has(adapter.id)
449
+ ? `${chalk.bold(adapter.id.padEnd(10))} ${chalk.dim(describe(adapter))}`
450
+ : `${chalk.dim(adapter.id.padEnd(10))} ${chalk.dim('skipped: needs a newer usegrunt')}`).join('\n'));
451
+ const requested = adapters.map(adapter => adapter.id);
452
+ const consent = await (actions.approveDataSharing ?? approveDataSharing)({ directory: configDir(), providers: requested });
453
+ squire?.approveDataSharing?.(consent.approved);
454
+ const ids = requested.filter(id => !consent.skipped.includes(id));
455
+ const results = new Map(requested.map(id => [id, consent.skipped.includes(id) ? { signup: 'skip', daemon: 'skip', check: 'skip' } : {}]));
456
+ const unavailable = [];
457
+ const notify = report();
458
+ if (consent.skipped.length)
459
+ log.info(`Skipped data-sharing services: ${consent.skipped.join(', ')}. Other free services continue.`);
460
+ if (!ids.length) {
461
+ // Upgrade older runtimes even after a declined batch: otherwise their
462
+ // existing provider sessions could keep routing without consent guards.
463
+ // Honor registry removals, while retaining a user's custom API routing.
464
+ const retained = previous.filter(id => id === 'freellmapi' || requested.includes(id));
465
+ await step('Updating the grunt background service', () => actions.installService(retained.length ? retained : requested));
466
+ await step('Waiting for grunt to answer', () => actions.checkService(Number(process.env.MILO_PORT || '8788')));
467
+ outro('No approved free services are available; the background service now enforces your data-sharing choices');
468
+ return;
444
469
  }
445
- results.get(id).check = before ? 'skip' : unavailable.includes(id) ? 'fail' : 'pass';
446
- }
447
- note([`${'service'.padEnd(10)} sign-in daemon test`, ...ids.map(id => {
448
- const r = results.get(id);
449
- return `${id.padEnd(10)} ${mark(r.signup)} ${mark(r.daemon)} ${mark(r.check)}`;
450
- })].join('\n'), 'Free services');
451
- if (actions.connectHarnesses)
452
- await actions.connectHarnesses(port);
453
- else if (actions.configurePi)
454
- await step('Pi provider', () => actions.configurePi(port));
455
- outro(unavailable.length ? `grunt is ready; incomplete fallbacks: ${unavailable.join(', ')}. Rerun setup to finish them.` : 'grunt is ready');
456
- if (unavailable.length)
457
- throw new Error('Some adapters failed verification. Run usegrunt setup to resume.');
470
+ log.step(`Installing and connecting ${ids.length} vetted free services (up to 3 at once)`);
471
+ log.info('Trusty Squire reuses existing accounts and grants. Only free access is requested. Provider verification may still need your browser; verification prompts are queued.');
472
+ const outcome = await actions.setupFallbacks({ directory: configDir(), run: command, adapters: ids, notify,
473
+ ...(consent.approved.length ? { dataSharingApproved: consent.approved } : {}),
474
+ ...(squire ? { squire, connect: () => squire.connect() } : {}) });
475
+ unavailable.push(...outcome.unavailable);
476
+ for (const id of ids)
477
+ results.get(id).signup = unavailable.includes(id) ? 'fail' : 'pass';
478
+ log.step('Connecting the services to the grunt daemon');
479
+ await step('Starting the grunt background service', () => actions.installService([...new Set([...previous.filter(id => id === 'freellmapi'), ...ids])]));
480
+ const port = Number(process.env.MILO_PORT || '8788');
481
+ await step(`Waiting for grunt to answer at http://127.0.0.1:${port}`, () => actions.checkService(port));
482
+ const beforeSources = new Set(unavailable);
483
+ if (actions.checkServiceSources)
484
+ await step('Checking which services the daemon runs', () => actions.checkServiceSources(unavailable, notify, ids));
485
+ for (const id of ids)
486
+ results.get(id).daemon = beforeSources.has(id) ? 'skip' : unavailable.includes(id) ? 'fail' : 'pass';
487
+ log.step('Testing each service with a real request through grunt');
488
+ await parallelMap(ids, async (id) => {
489
+ const before = unavailable.includes(id);
490
+ await actions.checkFallbackServices(unavailable, port, notify, [id]);
491
+ results.get(id).check = before ? 'skip' : unavailable.includes(id) ? 'fail' : 'pass';
492
+ });
493
+ note([`${'service'.padEnd(10)} sign-in daemon test`, ...requested.map(id => {
494
+ const r = results.get(id);
495
+ return `${id.padEnd(10)} ${mark(r.signup)} ${mark(r.daemon)} ${mark(r.check)}`;
496
+ })].join('\n'), 'Free services');
497
+ if (actions.connectHarnesses)
498
+ await actions.connectHarnesses(port);
499
+ else if (actions.configurePi)
500
+ await step('Pi provider', () => actions.configurePi(port));
501
+ outro(unavailable.length ? `grunt is ready; incomplete fallbacks: ${unavailable.join(', ')}. Rerun setup to finish them.` : 'grunt is ready');
502
+ if (unavailable.length)
503
+ throw new Error('Some adapters failed verification. Run usegrunt setup to resume.');
504
+ }
505
+ finally {
506
+ await squire?.close();
507
+ }
458
508
  }
@@ -0,0 +1,79 @@
1
+ import { constants } from 'node:fs';
2
+ import { mkdir, open, rename, rm, writeFile } from 'node:fs/promises';
3
+ import { homedir } from 'node:os';
4
+ import { join } from 'node:path';
5
+ import { randomUUID } from 'node:crypto';
6
+ import { FreeApi, isDeepSeekV41Model } from './free-api.js';
7
+ import { verifiedDeepSeekFetch } from './deepseek-response.js';
8
+ export const ZRO_DEEPSEEK = 'deepseek-v4.1-flash';
9
+ const directory = () => process.env.MILO_CONFIG_DIR || join(process.env.XDG_CONFIG_HOME || join(homedir(), '.config'), 'milo');
10
+ function validate(value) {
11
+ const grant = value;
12
+ if (!grant || typeof grant.base_url !== 'string' || typeof grant.token !== 'string' || !grant.token.trim()
13
+ || grant.free_account_verified !== true || typeof grant.verified_at !== 'string' || !Number.isFinite(Date.parse(grant.verified_at)))
14
+ throw new Error('Zro free account verification is missing');
15
+ const url = new URL(grant.base_url);
16
+ if (url.protocol !== 'https:' || url.username || url.password || url.search || url.hash)
17
+ throw new Error('Invalid Zro grant endpoint');
18
+ return { base_url: grant.base_url.replace(/\/$/, ''), token: grant.token, free_account_verified: true, verified_at: grant.verified_at };
19
+ }
20
+ export async function readZroGrant(location = directory()) {
21
+ const file = await open(join(location, 'zro.json'), constants.O_RDONLY | constants.O_NOFOLLOW);
22
+ try {
23
+ const stat = await file.stat();
24
+ if (!stat.isFile() || (stat.mode & 0o777) !== 0o600 || stat.uid !== process.getuid?.())
25
+ throw new Error('Unsafe Zro grant file');
26
+ return validate(JSON.parse(await file.readFile('utf8')));
27
+ }
28
+ finally {
29
+ await file.close();
30
+ }
31
+ }
32
+ // Called after Squire has confirmed Free plan, no purchased balance and no payment method.
33
+ // This is a setup receipt, not a guarantee that an externally upgraded account stays free.
34
+ export async function writeZroGrant(grant, location = directory()) {
35
+ const value = validate({ ...grant, free_account_verified: true, verified_at: new Date().toISOString() });
36
+ const temporary = join(location, `zro.${randomUUID()}.tmp`);
37
+ await mkdir(location, { recursive: true, mode: 0o700 });
38
+ try {
39
+ await writeFile(temporary, JSON.stringify(value), { mode: 0o600, flag: 'wx' });
40
+ await rename(temporary, join(location, 'zro.json'));
41
+ }
42
+ finally {
43
+ await rm(temporary, { force: true });
44
+ }
45
+ }
46
+ export class Zro {
47
+ options;
48
+ id = 'zro';
49
+ supportsFunctionTools = true;
50
+ source;
51
+ constructor(options = {}) {
52
+ this.options = options;
53
+ this.source = new FreeApi('zro', { ...options, fetcher: verifiedDeepSeekFetch(options.fetcher), loadGrant: () => this.grant() });
54
+ }
55
+ grant() { return (this.options.loadGrant?.() ?? readZroGrant(this.options.directory)).then(validate); }
56
+ async available() {
57
+ try {
58
+ const grant = await this.grant();
59
+ const response = await (this.options.fetcher ?? fetch)(`${grant.base_url}/v1/models`, {
60
+ headers: { Authorization: `Bearer ${grant.token}` }, redirect: 'error', signal: AbortSignal.timeout(5000)
61
+ });
62
+ if (!response.ok) {
63
+ await response.body?.cancel();
64
+ return false;
65
+ }
66
+ const result = await response.json();
67
+ return result.data?.some(model => isDeepSeekV41Model(model.id)) ?? false;
68
+ }
69
+ catch {
70
+ return false;
71
+ }
72
+ }
73
+ async healthCheck() { return this.available(); }
74
+ complete(request, signal) {
75
+ // Router aliases select this source; they never select another upstream model.
76
+ return this.source.complete({ ...request, model: this.id }, signal);
77
+ }
78
+ async close() { await this.source.close(); }
79
+ }
@@ -1,10 +1,68 @@
1
1
  {
2
2
  "version": 1,
3
- "published": "2026-11-11T00:00:00Z",
3
+ "published": "2026-11-14T22:10:00Z",
4
4
  "adapters": [
5
- { "id": "freebuff", "kind": "agent", "tier": "stable", "weight": 0.4,
6
- "modalities": ["text"], "install": "npm:freebuff", "signup": "https://freebuff.com/login" },
7
- { "id": "opencode", "kind": "agent", "tier": "stable", "weight": 0.4,
8
- "modalities": ["text"], "install": "npm:opencode-ai", "model": "big-pickle" }
5
+ {
6
+ "id": "freebuff",
7
+ "kind": "agent",
8
+ "tier": "stable",
9
+ "weight": 0.192,
10
+ "modalities": [
11
+ "text"
12
+ ],
13
+ "install": "npm:freebuff",
14
+ "signup": "https://freebuff.com/login"
15
+ },
16
+ {
17
+ "id": "opencode",
18
+ "kind": "agent",
19
+ "tier": "stable",
20
+ "weight": 0.192,
21
+ "modalities": [
22
+ "text"
23
+ ],
24
+ "install": "npm:opencode-ai",
25
+ "models": [
26
+ "deepseek-v4.1-flash-free",
27
+ "glm-5.3-flash-free",
28
+ "big-pickle"
29
+ ]
30
+ },
31
+ {
32
+ "id": "kilo",
33
+ "kind": "model",
34
+ "tier": "stable",
35
+ "weight": 0.256,
36
+ "modalities": [
37
+ "text"
38
+ ],
39
+ "install": "builtin:kilo",
40
+ "signup": "https://app.kilo.ai/profile",
41
+ "model": "kilo-auto/free"
42
+ },
43
+ {
44
+ "id": "zro",
45
+ "kind": "model",
46
+ "tier": "stable",
47
+ "weight": 0.16,
48
+ "modalities": [
49
+ "text"
50
+ ],
51
+ "install": "builtin:zro",
52
+ "signup": "https://zro.moonmath.ai/overview",
53
+ "model": "deepseek-v4.1-flash"
54
+ },
55
+ {
56
+ "id": "tokenharbor",
57
+ "kind": "model",
58
+ "tier": "experimental",
59
+ "weight": 0.2,
60
+ "modalities": [
61
+ "text"
62
+ ],
63
+ "install": "builtin:tokenharbor",
64
+ "signup": "https://tokenharbor.ai/dashboard",
65
+ "model": "deepseek-v4.1-flash:free"
66
+ }
9
67
  ]
10
68
  }
package/dist/registry.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import { pathToFileURL } from 'node:url';
3
- export const knownAdapters = new Set(['freebuff', 'opencode']);
3
+ const installers = { freebuff: 'npm:freebuff', opencode: 'npm:opencode-ai', kilo: 'builtin:kilo', nvidia: 'builtin:nvidia', zro: 'builtin:zro', tokenharbor: 'builtin:tokenharbor' };
4
+ export const knownAdapters = new Set(Object.keys(installers));
4
5
  export function validateRegistry(value) {
5
6
  const fail = () => { throw new Error('Invalid adapter registry'); };
6
7
  if (!value || typeof value !== 'object' || Array.isArray(value))
@@ -19,8 +20,10 @@ export function validateRegistry(value) {
19
20
  || !['agent', 'model'].includes(String(a.kind)) || !['stable', 'experimental'].includes(String(a.tier))
20
21
  || typeof a.weight !== 'number' || !Number.isFinite(a.weight) || a.weight <= 0 || a.weight > 1
21
22
  || !Array.isArray(a.modalities) || !a.modalities.length || a.modalities.some(m => !['text', 'image'].includes(m))
22
- || new Set(a.modalities).size !== a.modalities.length || typeof a.install !== 'string' || !/^npm:[a-z0-9@/._-]+$/.test(a.install)
23
- || (a.model !== undefined && (typeof a.model !== 'string' || !a.model.trim())))
23
+ || new Set(a.modalities).size !== a.modalities.length || typeof a.install !== 'string' || !(/^npm:[a-z0-9@/._-]+$/.test(a.install) || (['kilo', 'nvidia', 'zro', 'tokenharbor'].includes(String(a.id)) && a.install === `builtin:${a.id}`))
24
+ || (a.model !== undefined && (typeof a.model !== 'string' || !a.model.trim()))
25
+ || (a.models !== undefined && (a.id !== 'opencode' || a.model !== undefined || !Array.isArray(a.models) || !a.models.length || a.models.length > 20
26
+ || a.models.some(model => typeof model !== 'string' || !model.trim()) || new Set(a.models).size !== a.models.length)))
24
27
  return fail();
25
28
  if (a.signup !== undefined) {
26
29
  if (typeof a.signup !== 'string')
@@ -36,7 +39,7 @@ export function validateRegistry(value) {
36
39
  return fail();
37
40
  }
38
41
  // Known adapters have fixed installers and capabilities; registry data never supplies code.
39
- if (knownAdapters.has(a.id) && (a.kind !== 'agent' || a.install !== (a.id === 'freebuff' ? 'npm:freebuff' : 'npm:opencode-ai')
42
+ if (knownAdapters.has(a.id) && (a.kind !== (['kilo', 'nvidia', 'zro', 'tokenharbor'].includes(a.id) ? 'model' : 'agent') || a.install !== installers[a.id]
40
43
  || a.modalities.some(m => m !== 'text')))
41
44
  return fail();
42
45
  ids.add(a.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "usegrunt",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22"