domain-hound 0.1.6 → 0.1.8

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/plugin.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "domain-hound",
4
- "version": "0.1.6",
5
- "description": "Check domain availability and prices, and screen product names, from your AI assistant.",
4
+ "version": "0.1.8",
5
+ "description": "Domains for agents. One MCP for everything domains: find, check, buy, set up, watch, move, renew, keep track.",
6
6
  "author": {
7
7
  "name": "Lars Hvinden"
8
8
  },
@@ -12,15 +12,15 @@
12
12
  "com.openai": {
13
13
  "interface": {
14
14
  "displayName": "Domain Hound",
15
- "shortDescription": "Domain prices and name checks",
16
- "longDescription": "Domain Hound checks registry availability, compares upfront and renewal prices, and screens product names for trademarks, app store clashes and web traction. It can investigate taken domains and watch them for release. Connect your own Spaceship account to get a live quote and set up website or mail DNS. You buy through Spaceship’s own MCP, after you approve Spaceship’s confirmation with the price and payment method. Direct purchase is an opt-in in the server settings, and Spaceship checkout is the fallback. Domain Hound runs on your machine and is open source under the MIT license.",
15
+ "shortDescription": "Domains for agents",
16
+ "longDescription": "Domains for agents. One MCP for everything domains: find, check, buy, set up, watch, move, renew, keep track. Domain Hound finds names and checks registry availability, compares upfront and renewal prices, and screens names for trademarks, app store clashes and web traction. Connect your own Spaceship account to get a live quote, buy with your approval and set up website or mail DNS. You buy through Spaceship’s own MCP, after you approve Spaceship’s confirmation with the price and payment method. Direct purchase is an opt-in in the server settings, and Spaceship checkout is the fallback. It investigates and watches taken domains, plans moves to a cheaper registrar, and keeps track of every domain you own: expiry, DNS, site, email setup and renewal prices. Domain Hound runs on your machine and is open source under the MIT license.",
17
17
  "developerName": "Lars Hvinden",
18
18
  "category": "Developer Tools",
19
19
  "capabilities": [
20
- "Check domain availability",
21
- "Compare registrar prices",
22
- "Screen product names",
23
- "Set up DNS at Spaceship"
20
+ "Find names and check domains",
21
+ "Compare upfront and renewal prices",
22
+ "Buy and set up DNS at Spaceship",
23
+ "Watch, move and track your domains"
24
24
  ],
25
25
  "websiteURL": "https://domainhound.dev",
26
26
  "privacyPolicyURL": "https://domainhound.dev/privacy/",
package/results.mjs CHANGED
@@ -4,9 +4,10 @@ import { mkdir, readdir, rename, stat, unlink, writeFile } from 'node:fs/promise
4
4
  import { homedir, userInfo } from 'node:os';
5
5
  import { basename, dirname, join, resolve } from 'node:path';
6
6
  import { fileURLToPath, pathToFileURL } from 'node:url';
7
- import { canRecommend, defaultEndings, domainEnding, eligibilityNeed, normalizeName } from './clis/domain-check/name-search.mjs';
7
+ import { canRecommend, choosePick, comparePicks, defaultEndings, domainEnding, eligibilityNeed, lowestTotal, lowestUpfront, normalizeName,
8
+ qualityRank } from './clis/domain-check/name-search.mjs';
8
9
  import { handlePriorities, handleStates, handleSummary } from './clis/domain-check/handles.mjs';
9
- import { shopSearchUrl, shops } from './clis/domain-check/prices.mjs';
10
+ import { dnsNeed, shopSearchUrl, shops } from './clis/domain-check/prices.mjs';
10
11
  import { trademarkSearches } from './clis/domain-check/triage-sources.mjs';
11
12
  import { safeLink } from './display.mjs';
12
13
  import { receiptStyle } from './results-style.mjs';
@@ -55,11 +56,13 @@ const markLabel = entry => plain(entry.office) + ' mark: ' + plain(entry.tier) +
55
56
  const watchLink = domain => 'https://domainhound.dev/watch/?domain=' + encodeURIComponent(domain);
56
57
  const verdictOrder = { 'No conflict found': 0, 'Check first': 1, Avoid: 2 };
57
58
 
58
- function resultGroups(data, eligibleEndings) {
59
+ function resultGroups(data, eligibleEndings, preferred = []) {
59
60
  return data.names.map((row, index) => {
60
61
  const detail = data.receiptDetails?.[index] ?? {};
61
62
  const exact = row.name.includes('.');
62
63
  const label = exact ? row.name : normalizeName(row.name);
64
+ const requested = exact ? [...preferred, row.name] : preferred;
65
+ const eligibleList = eligibleEndings ?? data.eligible;
63
66
  const listed = [...(row.free ?? []), ...(row.taken ?? []), ...(row.shop_check ?? []), ...(row.resale ?? []),
64
67
  ...(row.premium ?? []), ...(row.reserved ?? [])].map(value => value.d ?? value).filter(value => typeof value === 'string');
65
68
  const variants = listed.filter(value => value.includes('.') && value !== 'co.uk');
@@ -94,16 +97,20 @@ function resultGroups(data, eligibleEndings) {
94
97
  const source = ({ web: 'Live site', dns: 'DNS', rdap: 'Registry RDAP', whois: 'Registry WHOIS',
95
98
  shop: 'Shop', list: 'Price list' })[raw?.source] ?? (confirmed ? 'Shop' : likely ? 'DNS' : 'Registry');
96
99
  const shop = usd.shop ?? raw?.shop ?? shops[fallbackShop(ending)]?.name;
97
- const eligible = canRecommend(ending, eligibleEndings ?? data.eligible);
100
+ const eligible = canRecommend(ending, eligibleList);
98
101
  const shopUrl = shopSearchUrl(shopIds.get(shop) ?? fallbackShop(ending), domain);
99
102
  const checkout = taken || reserved || !eligible ? null : [raw?.checkout, shopUrl].find(url => safeLink(url, domain)) ?? null;
100
- return { domain, ending, state, status, ...usd, total, shop, checkout, eligible, source, ...(raw?.savings && { savings: raw.savings }),
103
+ return { domain, ending, rank: qualityRank(domain, requested, eligibleList), state, status, ...usd, total,
104
+ shop, checkout, eligible, source, ...(raw?.savings && { savings: raw.savings }),
105
+ ...(includePrice && dnsNeed(usd.shop) && { dns: dnsNeed(usd.shop) }),
101
106
  priceLabel: usd.now != null || usd.renew != null ? (confirmed ? 'Shop quote' : taken ? 'Standard list price benchmark' : 'List price') : '',
102
107
  checkedAt: raw?.checkedAt ?? data.checkedAt, priceAt: confirmed ? raw?.checkedAt ?? data.checkedAt : raw?.priceAt ?? data.priceListDate,
103
108
  site: raw?.site ?? detail.details?.sites?.[ending] ?? row.details?.sites?.[ending] };
104
109
  });
110
+ // Free rows first, then in the quality order (a typed exact domain is requested), then by upfront payment.
105
111
  records.sort((a, b) => Number(b.state === 'free' || b.priceLabel === 'Shop quote')
106
- - Number(a.state === 'free' || a.priceLabel === 'Shop quote') || (a.now ?? Infinity) - (b.now ?? Infinity));
112
+ - Number(a.state === 'free' || a.priceLabel === 'Shop quote')
113
+ || a.rank - b.rank || (a.now ?? Infinity) - (b.now ?? Infinity));
107
114
  return { row: { ...row, ...detail, name: row.name }, records };
108
115
  });
109
116
  }
@@ -118,7 +125,7 @@ function offerText(offer, linked = false) {
118
125
  : renew != null ? cash(renew) + ' renewal' : 'price at shop';
119
126
  return (linked && checkout ? '[' + domain + '](' + checkout + ')' : domain) + ' ' + price
120
127
  + (term > 1 ? ' every ' + term + ' years' : '') + (jump ? ' (renewal jumps)' : '')
121
- + (priceLabel ? ' ' + priceLabel.toLowerCase() + priceDate(offer) : '');
128
+ + (priceLabel ? ' ' + priceLabel.toLowerCase() + priceDate(offer) : '') + (offer.dns ? ' (' + offer.dns.toLowerCase() + ')' : '');
122
129
  }
123
130
 
124
131
  function appFinding(value, row, source) {
@@ -143,10 +150,13 @@ function signals(group, triage = true) {
143
150
  }
144
151
 
145
152
  // One selection feeds the receipt lines and the share link: preferred endings, budget, eligibility, verdict and
146
- // confirmed quotes decide the candidates; best value compares payments due in 3 years (y3 quote or term-aware sum).
147
- // names[i] is the same choice made inside groups[i] alone: its first candidate, its best value and its taken rows,
153
+ // confirmed quotes decide the candidates. Each name's pick follows the shared rule (choosePick): the highest-quality
154
+ // ending within $60 over 3 years (or the person's budget), else the least paid over 3 years; .ai only when asked for
155
+ // or within the budget. Cheapest is the lowest upfront payment and best value the least paid over 3 years, across
156
+ // every candidate in scope.
157
+ // names[i] is the same choice made inside groups[i] alone: its pick, its best value and its taken rows,
148
158
  // preferred endings first in the user's order (.com first by default).
149
- function receiptSelection(groups, args, triage) {
159
+ function receiptSelection(groups, args, triage, eligible = []) {
150
160
  const preferred = args.endings ?? [];
151
161
  const budget = args.budget;
152
162
  const exact = !triage && groups.length === 1 && groups[0].row.name.includes('.');
@@ -155,14 +165,20 @@ function receiptSelection(groups, args, triage) {
155
165
  // An exact lookup reports its one domain and never recommends.
156
166
  const candidates = exact ? [] : groups.flatMap(group => group.row.verdict === 'Avoid' ? [] : group.records
157
167
  .filter(record => inScope(record) && (record.state === 'free' || record.priceLabel === 'Shop quote'))
158
- .map(record => ({ group, record })));
159
- const cost = item => item.record.now ?? Infinity;
160
- const compareCost = (a, b) => cost(a) - cost(b);
161
- const position = item => preferred.length ? preferred.indexOf(item.record.ending) : 0;
162
- candidates.sort((a, b) => (verdictOrder[a.group.row.verdict] ?? 0) - (verdictOrder[b.group.row.verdict] ?? 0)
163
- || position(a) - position(b) || compareCost(a, b) || a.record.domain.localeCompare(b.record.domain));
164
- const bestValue = items => items.filter(item => item.record.total != null)
165
- .sort((a, b) => a.record.total - b.record.total || compareCost(a, b))[0];
168
+ .map(record => ({ group, record, domain: record.domain, now: record.now ?? null, total: record.total ?? null })));
169
+ const context = group => ({ requested: group.row.name.includes('.') ? [...preferred, group.row.name] : preferred,
170
+ eligible, budget });
171
+ // Across names, every exact domain the person typed counts as asked for.
172
+ const across = { requested: [...preferred, ...groups.map(group => group.row.name).filter(name => name.includes('.'))], eligible, budget };
173
+ // Ties on price go to the better verdict, then the quality order.
174
+ const rank = item => (verdictOrder[item.group.row.verdict] ?? 0) * 1000 + item.record.rank;
175
+ const pickOf = group => choosePick(candidates.filter(item => item.group === group), context(group));
176
+ const valueOf = items => lowestTotal(items, rank);
177
+ const picks = groups.flatMap(group => {
178
+ const pick = pickOf(group);
179
+ return pick ? [pick] : [];
180
+ }).sort((a, b) => (verdictOrder[a.group.row.verdict] ?? 0) - (verdictOrder[b.group.row.verdict] ?? 0)
181
+ || comparePicks(a, b, across) || a.record.domain.localeCompare(b.record.domain)).slice(0, 3);
166
182
  const order = preferred.length ? preferred : ['com'];
167
183
  const takenRank = record => {
168
184
  const index = order.indexOf(record.ending);
@@ -170,13 +186,13 @@ function receiptSelection(groups, args, triage) {
170
186
  };
171
187
  return {
172
188
  exact, preferred, budget,
173
- best: candidates[0],
174
- picks: [...new Map(candidates.toReversed().map(item => [item.group, item])).values()].reverse().slice(0, 3),
175
- cheapest: candidates.filter(item => item.record.now != null).sort(compareCost)[0],
176
- value: bestValue(candidates),
189
+ best: picks[0],
190
+ picks,
191
+ cheapest: lowestUpfront(candidates, rank),
192
+ value: valueOf(candidates),
177
193
  names: groups.map(group => {
178
194
  const own = candidates.filter(item => item.group === group);
179
- return { pick: own[0]?.record ?? null, value: bestValue(own)?.record ?? null,
195
+ return { pick: pickOf(group)?.record ?? null, value: valueOf(own)?.record ?? null,
180
196
  taken: group.records.filter(record => record.state === 'taken' && (!preferred.length || preferred.includes(record.ending)))
181
197
  .sort((a, b) => takenRank(a) - takenRank(b)) };
182
198
  }),
@@ -233,9 +249,11 @@ function summary(groups, args, triage, selection) {
233
249
  handles && 'Handles for ' + evidenceText(wanted.row.name) + ': ' + plain(handles) + '.',
234
250
  running.length ? 'Still checking ' + running.join(', ') + '. The results page updates by itself.' : null,
235
251
  ...offerLines,
236
- 'Cheapest: ' + (cheapest ? label(cheapest) : 'none found in scope.'),
237
- 'Best value: ' + (value ? value.record.domain + ', ' + cash(value.record.total) + ' in payments due in 3 years'
238
- + ' (' + value.record.priceLabel.toLowerCase() + priceDate(value.record) + ')' + caution(value) : 'needs a shop quote') + '.',
252
+ // Cheapest upfront and best value over 3 years each get a line only when they are not the pick.
253
+ cheapest?.record !== best?.record || !best ? 'Cheapest: ' + (cheapest ? label(cheapest) : best ? 'needs a shop quote.' : 'none found in scope.') : null,
254
+ value?.record !== best?.record || !best ? 'Best value: ' + (value ? value.record.domain + ', ' + cash(value.record.total) + ' in payments due in 3 years'
255
+ + ' (' + value.record.priceLabel.toLowerCase() + priceDate(value.record) + (value.record.jump ? ', renewal jumps' : '') + ')'
256
+ + caution(value) : 'needs a shop quote') + '.' : null,
239
257
  (args.purchase ? 'This check leaves checkout to you. ' : '') + next + eligibility,
240
258
  ];
241
259
  // Savings are page-only proof for each pick: dated list prices from at least three shops, never a pitch.
@@ -394,7 +412,7 @@ const amountsFor = ({ now, renew }) => [cash(now) ?? 'No price', cash(renew) ??
394
412
 
395
413
  function rowNote(row) {
396
414
  return [row.status, row.priceLabel, row.term > 1 ? row.term + ' years per payment' : null,
397
- row.jump ? 'Renewal jumps' : null, !row.eligible ? '.' + row.ending + ' needs ' + eligibilityNeed(row.ending) : null,
415
+ row.jump ? 'Renewal jumps' : null, row.dns ?? null, !row.eligible ? '.' + row.ending + ' needs ' + eligibilityNeed(row.ending) : null,
398
416
  row.source, row.checkedAt, row.priceAt ? 'Price checked ' + row.priceAt : null].filter(Boolean).join(' · ');
399
417
  }
400
418
 
@@ -553,8 +571,8 @@ export function resultPages({ env = process.env,
553
571
  return (data, args, { triage = false, watch = false, reuse = null, refresh = false } = {}) => {
554
572
  const work = writes.then(async () => {
555
573
  const at = data.checkedAt ?? new Date().toISOString();
556
- const groups = watch ? [] : resultGroups(data, args.eligible);
557
- const selection = receiptSelection(groups, args, triage);
574
+ const groups = watch ? [] : resultGroups(data, args.eligible, args.endings);
575
+ const selection = receiptSelection(groups, args, triage, args.eligible ?? data.eligible ?? []);
558
576
  const { lines, savings, shortLines } = watch ? { lines: data.say.split('\n'), savings: [] } : data.pending ? { lines: [
559
577
  ...(data.failed ? ['Some checks did not finish. Registry answers received are on the page.']
560
578
  : ['Still checking trademark, app and web sources. Registry answers so far are on the page.', 'The results page updates by itself.']),
package/server.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
3
  "name": "dev.domainhound/domain-hound",
4
- "title": "Domain Hound",
5
- "description": "Find a startup name and domain you can buy: availability, prices, app names, trademarks, handles.",
4
+ "title": "Domain Hound: Domains for agents",
5
+ "description": "One MCP for everything domains: find, check, buy, set up, watch, move, renew, keep track",
6
6
  "websiteUrl": "https://domainhound.dev",
7
- "version": "0.1.6",
7
+ "version": "0.1.8",
8
8
  "packages": [
9
9
  {
10
10
  "registryType": "npm",
11
11
  "identifier": "domain-hound",
12
- "version": "0.1.6",
12
+ "version": "0.1.8",
13
13
  "transport": {
14
14
  "type": "stdio"
15
15
  }
package/server.mjs CHANGED
@@ -10,6 +10,7 @@ import { attributed, errorText, progressText } from './display.mjs';
10
10
  import { resultPages, resultsLine } from './results.mjs';
11
11
  import { watchDomain, watchTool } from './watch.mjs';
12
12
  import { domainDossier, dossierTool } from './dossier.mjs';
13
+ import { myDomains, portfolioTool } from './clis/portfolio/portfolio.mjs';
13
14
  import { callPurchaseTool, purchaseToolNames, registeredTools, withCheckQuoteOffer, withWatchQuoteOffer } from './clis/spaceship/tools.mjs';
14
15
 
15
16
  // The capability ships inside the package; tests inject another directory through serve({ cwd }).
@@ -34,7 +35,7 @@ const nameSchema = { type: 'string', minLength: 1, maxLength: 127, pattern: entr
34
35
  const endingsSchema = {
35
36
  type: 'array', minItems: 1, maxItems: supportedEndings.length, uniqueItems: true,
36
37
  items: { type: 'string', enum: supportedEndings },
37
- description: 'Endings to consider for the recommendation, in preference order. For .com only use ["com"]. The page still shows all fourteen default endings for bare names. '
38
+ description: 'Endings to consider for the recommendation, in preference order; listed endings rank first. For .com only use ["com"]. The page still shows all twelve default endings for bare names. '
38
39
  + 'On request only (add them here when the person asks or names a country): ' + requestEndings.map(ending => '.' + ending).join(', ') + '.',
39
40
  };
40
41
  const countryEnding = {
@@ -51,16 +52,15 @@ const lookupProperties = {
51
52
  ai: { type: 'boolean', description: 'Legacy option. .ai is now included by default.' },
52
53
  endings: endingsSchema,
53
54
  budget: { type: 'number', minimum: 0, maximum: 1000000,
54
- description: 'Maximum upfront price in USD when the person gave a cap. Carry it from the registry screen into triage.' },
55
+ description: 'The person\'s budget in USD, only when they gave one. Endings that cost more upfront are left out, and it replaces the $60 three-year cap of the default pick (highest-quality ending within the cap, else the least paid over 3 years; .ai only when asked for or within this budget). Carry it from the registry screen into triage.' },
55
56
  eligible: { type: 'array', uniqueItems: true, items: { type: 'string', enum: restrictedEndings },
56
57
  description: 'Restricted endings the buyer qualifies to register. Pass no or eu only when the buyer qualifies for that ending.' },
57
58
  };
58
59
  const relay = 'The answer starts with the clickable Markdown link on the first line of say. Then give the relevant facts from say.';
59
60
  const checkTool = {
60
61
  name: 'check_domains',
61
- description: 'Check availability and dated list prices for one domain or up to 20 names or domains. Use triage_names to find or vet a product name. '
62
- + 'For one check, pass query, for example {"query":"lanternbay.com"}. For a batch, pass names. '
63
- + 'For a buy or register request, set purchase: true and state the checkout limitation. Set confirm: true only for an explicit live shop check. '
62
+ description: 'Check availability and dated prices for up to 20 names or domains. Use triage_names for product names. '
63
+ + 'For purchase requests, set purchase: true and relay the checkout guidance. Use confirm: true only for an explicit live shop check. '
64
64
  + 'Keep list, shop-confirmed and premium prices distinct. ' + relay,
65
65
  inputSchema: {
66
66
  type: 'object',
@@ -85,10 +85,9 @@ const legacyTool = { ...checkTool, name: 'broker_find',
85
85
 
86
86
  const triageTool = {
87
87
  name: 'triage_names',
88
- description: 'Use for “find a name and domain” or “can I use this name?”. For a new name, generate five distinct, easy-to-say candidates now. '
89
- + 'Call triage_names once with those names, an about description under 160 characters, and shortlist: true. No preliminary tool or web search is needed. '
90
- + 'Put the person’s own name first if supplied. The tool checks fourteen endings, US marks, optional EU and Norway marks, apps, rivals and meanings in 14 languages. The receipt fills in slow checks and top-three handles. '
91
- + 'Use the returned verdicts. Report checks in progress as pending and give the page link. ' + relay,
88
+ description: 'Find or vet a product name before any other search. For naming, generate five distinct, easy-to-say names, with the supplied name first. '
89
+ + 'Call triage_names once with those names, a short about description and shortlist: true. Checks domains, trademarks, apps, rivals and meanings. '
90
+ + 'Use the returned verdicts and label unfinished checks as pending. ' + relay,
92
91
  inputSchema: {
93
92
  type: 'object',
94
93
  properties: {
@@ -257,6 +256,9 @@ function triageArguments(args) {
257
256
  throw new Error('names[' + bad + '] is not valid. Supply 1 to 20 bare names of up to 100 characters, without commas or domain endings.');
258
257
  }
259
258
  const flags = lookupFlags(args);
259
+ // Requested endings rank first in the screen's own picks, and a budget applies there as on the receipt.
260
+ if (args.endings) flags.push('--prefer-endings', args.endings.join(','));
261
+ if (args.budget !== undefined) flags.push('--upfront-cap', String(args.budget));
260
262
  if (Object.hasOwn(args, 'shortlist') && typeof args.shortlist !== 'boolean') throw new Error('shortlist must be a boolean.');
261
263
  const { companyType, additionalHandles } = args;
262
264
  if (companyType !== undefined && !Object.hasOwn(handlePriorities, companyType)) throw new Error('Choose a supported company type.');
@@ -318,7 +320,7 @@ function readProgress(progress, line) {
318
320
  // Start one capability run. It ends on its own; only the maximum lookup time or server shutdown stops it.
319
321
  // A name screen answers first with the checks done so far ({"followUp":true} on its first line) and keeps running
320
322
  // the slow checks; the re-assessed result on its next line resolves lookup.later (null when there is none).
321
- function startLookup(args, cwd, maxMs) {
323
+ function startLookup(args, cwd, maxMs, onLookupEvent) {
322
324
  const triage = args[0] === '--triage';
323
325
  const lookup = { started: performance.now(), progress: { answers: new Map(), stage: null }, finished: false, exited: false,
324
326
  collect: false, outcome: null };
@@ -358,7 +360,10 @@ function startLookup(args, cwd, maxMs) {
358
360
  settle(() => parseOutput(firstLine, false, 0));
359
361
  }
360
362
  });
361
- createInterface({ input: child.stderr, crlfDelay: Infinity }).on('line', line => readProgress(lookup.progress, line));
363
+ createInterface({ input: child.stderr, crlfDelay: Infinity }).on('line', line => {
364
+ readProgress(lookup.progress, line);
365
+ onLookupEvent?.('progress', lookup.progress);
366
+ });
362
367
  let stopped = false;
363
368
  const limit = setTimeout(() => {
364
369
  stopped = true;
@@ -383,7 +388,11 @@ function startLookup(args, cwd, maxMs) {
383
388
  later(next);
384
389
  };
385
390
  child.once('error', () => finish(true));
386
- child.once('close', code => finish(code !== 0));
391
+ child.once('close', code => {
392
+ finish(code !== 0);
393
+ onLookupEvent?.('exited');
394
+ });
395
+ onLookupEvent?.('started');
387
396
  return lookup;
388
397
  }
389
398
 
@@ -412,7 +421,8 @@ function pendingTriage(progress, rows) {
412
421
 
413
422
  export async function serve({
414
423
  input = process.stdin, output = process.stdout, cwd = capabilityDir, timeout = timeoutMs, maxLookup = maxLookupMs,
415
- pages = resultPages(), watch = watchDomain, socialLookup = checkSocialHandles, dossier = domainDossier,
424
+ pages = resultPages(), watch = watchDomain, socialLookup = checkSocialHandles, dossier = domainDossier, portfolio = myDomains,
425
+ onLookupEvent,
416
426
  } = {}) {
417
427
  const send = response => output.write(JSON.stringify({ jsonrpc: '2.0', ...response }) + '\n');
418
428
  const error = (id, code, message) => send({ id, error: { code, message } });
@@ -437,7 +447,7 @@ export async function serve({
437
447
  const key = JSON.stringify([cliArgs, presentation]);
438
448
  let lookup = lookups.get(key);
439
449
  if (!lookup) {
440
- lookup = startLookup(cliArgs, cwd, maxLookup);
450
+ lookup = startLookup(cliArgs, cwd, maxLookup, onLookupEvent);
441
451
  lookups.set(key, lookup);
442
452
  lookup.done.then(() => {
443
453
  if (lookups.get(key) !== lookup) return;
@@ -613,7 +623,7 @@ export async function serve({
613
623
  }
614
624
  if (method !== 'tools/list' && method !== 'tools/call') return error(id, -32601, 'Method not found');
615
625
  if (!initialized) return error(id, -32000, 'Domain Hound has not been initialized');
616
- if (method === 'tools/list') return reply({ tools: registeredTools([checkTool, triageTool, namingTool, legacyTool, watchTool, dossierTool]) });
626
+ if (method === 'tools/list') return reply({ tools: registeredTools([checkTool, triageTool, namingTool, legacyTool, watchTool, dossierTool, portfolioTool]) });
617
627
  const { name, arguments: args } = params ?? {};
618
628
  if (purchaseToolNames.has(name)) return reply(await callPurchaseTool(name, args));
619
629
  if (name === namingTool.name) {
@@ -642,6 +652,13 @@ export async function serve({
642
652
  return reply(errorResult(problem.message));
643
653
  }
644
654
  }
655
+ if (name === portfolioTool.name) {
656
+ try {
657
+ return reply(toolResult(JSON.stringify(await portfolio(args))));
658
+ } catch (problem) {
659
+ return reply(errorResult(problem.message));
660
+ }
661
+ }
645
662
  const purchase = isObject(args) && args.purchase === true;
646
663
  if (name === triageTool.name) {
647
664
  let current;
package/share.mjs CHANGED
@@ -19,19 +19,21 @@ export function shareUrl(groups, checkedAt, facts = []) {
19
19
  const base = records.length > 1 ? records[0].domain.split('.')[0] : '';
20
20
  const endings = [];
21
21
  let jumps = 0;
22
- for (const [position, { domain, status, now, renew, term, jump }] of records.entries()) {
22
+ let cloudflare = 0;
23
+ for (const [position, { domain, status, now, renew, term, jump, dns }] of records.entries()) {
23
24
  const state = shareStatuses.indexOf(status);
24
25
  if (typeof domain !== 'string' || domain.length > 253 || !shareDomain.test(domain) || state < 0) return null;
25
26
  const part = domain.startsWith(base + '.') ? domain.slice(base.length) : domain;
26
27
  endings.push([part, state, cents(now), cents(renew), term ?? 1]);
27
28
  if (jump) jumps += 2 ** position;
29
+ if (dns) cloudflare += 2 ** position;
28
30
  }
29
31
  const { pick, value, taken = records.filter(record => /^Taken\b/.test(record.status)) } = facts[index] ?? {};
30
32
  const rowOf = record => records.indexOf(record);
31
33
  const total = value && cents(value.total);
32
34
  if ([pick, value, ...taken].some(record => record && rowOf(record) < 0) || (value && total === null)) return null;
33
35
  const meta = { ...(pick && { p: rowOf(pick) }), ...(value && { b: [rowOf(value), total] }),
34
- ...(jumps && { j: jumps }), ...(taken.length && { t: taken.map(rowOf) }) };
36
+ ...(jumps && { j: jumps }), ...(taken.length && { t: taken.map(rowOf) }), ...(cloudflare && { c: cloudflare }) };
35
37
  const display = row.name.trim().normalize('NFC');
36
38
  const name = shareName.test(display) ? display : records[0].domain;
37
39
  shortlist.push([name, Math.max(0, shareVerdicts.indexOf(row.verdict)), base, endings,
@@ -1,7 +1,8 @@
1
1
  // Version 2 stores a timestamp and up to five groups of [name, verdict, domain label, endings, facts?].
2
2
  // A domain starts with a dot when it reuses the group's label. Prices are in integer cents.
3
3
  // facts is optional and only holds what the local receipt worked out for that name:
4
- // { p: pick row, b: [best value row, three-year payments in cents], j: renewal-jump bit mask by row, t: taken rows, preferred first }.
4
+ // { p: pick row, b: [best value row, three-year payments in cents], j: renewal-jump bit mask by row, t: taken rows, preferred first,
5
+ // c: bit mask of rows whose price needs Cloudflare DNS }. A link carries c only when such a row is shown.
5
6
  // Version 1 links have no facts: they decode with no pick or best value and with jumps worked out from their prices.
6
7
  export const sharePage = 'https://domainhound.dev/r/';
7
8
  export const shareUrlLimit = 2000;
@@ -32,21 +33,24 @@ const maximumInflatedBytes = 24 * 1024;
32
33
  const isCents = value => value === null || (Number.isSafeInteger(value) && value >= 0);
33
34
  const dollars = value => value === null ? null : value / 100;
34
35
  const isTaken = row => /^Taken\b/.test(row.status);
35
- const factKeys = ['p', 'b', 'j', 't'];
36
+ const factKeys = ['p', 'b', 'j', 't', 'c'];
37
+ export const cloudflareDns = 'Needs Cloudflare DNS';
36
38
 
37
39
  function parseFacts(facts, rows) {
38
40
  if (!facts || typeof facts !== 'object' || Array.isArray(facts) || Object.keys(facts).some(key => !factKeys.includes(key))) return null;
39
- const { p: pick = null, b: best = null, j: jumps = 0, t: taken = [] } = facts;
41
+ const { p: pick = null, b: best = null, j: jumps = 0, t: taken = [], c: cloudflare = 0 } = facts;
40
42
  const validIndex = index => Number.isInteger(index) && index >= 0 && index < rows.length;
41
43
  const available = index => validIndex(index) && ['Free at the registry', 'Confirmed at shop'].includes(rows[index].status);
42
44
  if ((pick !== null && !available(pick))
43
45
  || (best !== null && !(Array.isArray(best) && best.length === 2 && available(best[0]) && best[1] !== null && isCents(best[1])))
44
46
  || !Number.isSafeInteger(jumps) || jumps < 0 || jumps >= 2 ** rows.length
47
+ || !Number.isSafeInteger(cloudflare) || cloudflare < 0 || cloudflare >= 2 ** rows.length
45
48
  || !Array.isArray(taken) || new Set(taken).size !== taken.length
46
49
  || !taken.every(index => validIndex(index) && isTaken(rows[index]))) return null;
47
50
  return {
48
51
  records: rows.map((record, index) => ({ ...record, jump: Boolean(jumps & (1 << index)), pick: index === pick,
49
- ...(best?.[0] === index && { bestValue: dollars(best[1]) }) })),
52
+ ...(best?.[0] === index && { bestValue: dollars(best[1]) }),
53
+ ...(Math.floor(cloudflare / 2 ** index) % 2 === 1 && { dns: cloudflareDns }) })),
50
54
  takenDomains: taken.map(index => rows[index].domain),
51
55
  };
52
56
  }
package/watch.mjs CHANGED
@@ -8,10 +8,10 @@ const consentTextVersion = 'news-v1';
8
8
 
9
9
  export const watchTool = {
10
10
  name: 'watch_domain',
11
- description: 'Check a specific domain’s registry, expiry and website and start a free release watch at the person’s request. '
12
- + 'Use the email and optional name they gave for this submission. If the email is missing, ask once and never guess. '
11
+ description: 'Check registry, expiry and website. Start a free release watch only at the person’s request. '
12
+ + 'Use only the email and optional name they gave for this submission. If the email is missing, ask once and never guess. '
13
13
  + 'Before submitting, ask exactly: “' + newsQuestion + '” Pass news: true only on an explicit yes, or false if they decline or skip it. '
14
- + 'This highlights a choice in the confirmation email. Only the email confirmation can start news. Relay say as written.',
14
+ + 'Only the email confirmation can start news. Relay say as written.',
15
15
  annotations: { title: 'Watch a domain', readOnlyHint: false, destructiveHint: false, openWorldHint: true },
16
16
  inputSchema: {
17
17
  type: 'object',