domain-hound 0.1.7 → 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/.agents/plugins/marketplace.json +1 -1
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +2 -2
- package/README.md +54 -15
- package/clis/domain-check/dossier.mjs +16 -13
- package/clis/domain-check/index.mjs +28 -22
- package/clis/domain-check/name-search.mjs +72 -18
- package/clis/domain-check/price-catalog.mjs +26 -7
- package/clis/domain-check/price-snapshot.json +91 -0
- package/clis/domain-check/prices.mjs +5 -0
- package/clis/domain-check/triage.mjs +24 -32
- package/clis/portfolio/checks.mjs +456 -0
- package/clis/portfolio/discover.mjs +175 -0
- package/clis/portfolio/move.mjs +297 -0
- package/clis/portfolio/page.mjs +140 -0
- package/clis/portfolio/portfolio.mjs +212 -0
- package/clis/portfolio/store.mjs +62 -0
- package/clis/portfolio/transfer-prices.mjs +41 -0
- package/clis/spaceship/client.mjs +35 -19
- package/clis/spaceship/tools.mjs +105 -17
- package/clis/spaceship/transfer.mjs +332 -0
- package/display.mjs +42 -45
- package/dossier.mjs +8 -5
- package/package.json +14 -3
- package/plugin.json +8 -8
- package/results.mjs +40 -52
- package/server.json +4 -4
- package/server.mjs +31 -16
- package/share.mjs +4 -2
- package/site/r/share-format.mjs +8 -4
- package/watch.mjs +3 -3
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,
|
|
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';
|
|
@@ -99,16 +100,17 @@ function resultGroups(data, eligibleEndings, preferred = []) {
|
|
|
99
100
|
const eligible = canRecommend(ending, eligibleList);
|
|
100
101
|
const shopUrl = shopSearchUrl(shopIds.get(shop) ?? fallbackShop(ending), domain);
|
|
101
102
|
const checkout = taken || reserved || !eligible ? null : [raw?.checkout, shopUrl].find(url => safeLink(url, domain)) ?? null;
|
|
102
|
-
return { domain, ending,
|
|
103
|
+
return { domain, ending, rank: qualityRank(domain, requested, eligibleList), state, status, ...usd, total,
|
|
103
104
|
shop, checkout, eligible, source, ...(raw?.savings && { savings: raw.savings }),
|
|
105
|
+
...(includePrice && dnsNeed(usd.shop) && { dns: dnsNeed(usd.shop) }),
|
|
104
106
|
priceLabel: usd.now != null || usd.renew != null ? (confirmed ? 'Shop quote' : taken ? 'Standard list price benchmark' : 'List price') : '',
|
|
105
107
|
checkedAt: raw?.checkedAt ?? data.checkedAt, priceAt: confirmed ? raw?.checkedAt ?? data.checkedAt : raw?.priceAt ?? data.priceListDate,
|
|
106
108
|
site: raw?.site ?? detail.details?.sites?.[ending] ?? row.details?.sites?.[ending] };
|
|
107
109
|
});
|
|
108
|
-
// Free rows first, then
|
|
110
|
+
// Free rows first, then in the quality order (a typed exact domain is requested), then by upfront payment.
|
|
109
111
|
records.sort((a, b) => Number(b.state === 'free' || b.priceLabel === 'Shop quote')
|
|
110
112
|
- Number(a.state === 'free' || a.priceLabel === 'Shop quote')
|
|
111
|
-
|| a.
|
|
113
|
+
|| a.rank - b.rank || (a.now ?? Infinity) - (b.now ?? Infinity));
|
|
112
114
|
return { row: { ...row, ...detail, name: row.name }, records };
|
|
113
115
|
});
|
|
114
116
|
}
|
|
@@ -123,7 +125,7 @@ function offerText(offer, linked = false) {
|
|
|
123
125
|
: renew != null ? cash(renew) + ' renewal' : 'price at shop';
|
|
124
126
|
return (linked && checkout ? '[' + domain + '](' + checkout + ')' : domain) + ' ' + price
|
|
125
127
|
+ (term > 1 ? ' every ' + term + ' years' : '') + (jump ? ' (renewal jumps)' : '')
|
|
126
|
-
+ (priceLabel ? ' ' + priceLabel.toLowerCase() + priceDate(offer) : '');
|
|
128
|
+
+ (priceLabel ? ' ' + priceLabel.toLowerCase() + priceDate(offer) : '') + (offer.dns ? ' (' + offer.dns.toLowerCase() + ')' : '');
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
function appFinding(value, row, source) {
|
|
@@ -147,16 +149,14 @@ function signals(group, triage = true) {
|
|
|
147
149
|
return 'iOS: ' + appFinding(comp.AppStore, row, 'App Store') + ' | Android: ' + appFinding(comp.GooglePlay, row, 'Google Play') + ' | web: ' + web;
|
|
148
150
|
}
|
|
149
151
|
|
|
150
|
-
const cents = value => Math.round(value * 100);
|
|
151
|
-
// A fallback ending is worth its own line only when it saves more than $10 over 3 years against the best value.
|
|
152
|
-
const fallbackSavingsCents = 1000;
|
|
153
|
-
|
|
154
152
|
// One selection feeds the receipt lines and the share link: preferred endings, budget, eligibility, verdict and
|
|
155
|
-
// confirmed quotes decide the candidates
|
|
156
|
-
//
|
|
157
|
-
//
|
|
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,
|
|
158
158
|
// preferred endings first in the user's order (.com first by default).
|
|
159
|
-
function receiptSelection(groups, args, triage) {
|
|
159
|
+
function receiptSelection(groups, args, triage, eligible = []) {
|
|
160
160
|
const preferred = args.endings ?? [];
|
|
161
161
|
const budget = args.budget;
|
|
162
162
|
const exact = !triage && groups.length === 1 && groups[0].row.name.includes('.');
|
|
@@ -165,30 +165,20 @@ function receiptSelection(groups, args, triage) {
|
|
|
165
165
|
// An exact lookup reports its one domain and never recommends.
|
|
166
166
|
const candidates = exact ? [] : groups.flatMap(group => group.row.verdict === 'Avoid' ? [] : group.records
|
|
167
167
|
.filter(record => inScope(record) && (record.state === 'free' || record.priceLabel === 'Shop quote'))
|
|
168
|
-
.map(record => ({ group, record })));
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const bestValue = items => lowestTotal(topTier(items));
|
|
183
|
-
const top = topTier(candidates);
|
|
184
|
-
const value = lowestTotal(top);
|
|
185
|
-
const picks = [];
|
|
186
|
-
for (const item of top) {
|
|
187
|
-
if (picks.some(pick => pick.group === item.group)) continue;
|
|
188
|
-
picks.push(item);
|
|
189
|
-
if (picks.length === 3) break;
|
|
190
|
-
}
|
|
191
|
-
const fallback = value && tier(value) === 0 ? lowestTotal(candidates.filter(item => tier(item) === 1)) : undefined;
|
|
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);
|
|
192
182
|
const order = preferred.length ? preferred : ['com'];
|
|
193
183
|
const takenRank = record => {
|
|
194
184
|
const index = order.indexOf(record.ending);
|
|
@@ -198,13 +188,11 @@ function receiptSelection(groups, args, triage) {
|
|
|
198
188
|
exact, preferred, budget,
|
|
199
189
|
best: picks[0],
|
|
200
190
|
picks,
|
|
201
|
-
cheapest:
|
|
202
|
-
value,
|
|
203
|
-
// The cheapest fallback over 3 years, only when it saves more than $10 against the top-tier best value.
|
|
204
|
-
saving: fallback && cents(value.record.total) - cents(fallback.record.total) > fallbackSavingsCents ? fallback : null,
|
|
191
|
+
cheapest: lowestUpfront(candidates, rank),
|
|
192
|
+
value: valueOf(candidates),
|
|
205
193
|
names: groups.map(group => {
|
|
206
194
|
const own = candidates.filter(item => item.group === group);
|
|
207
|
-
return { pick:
|
|
195
|
+
return { pick: pickOf(group)?.record ?? null, value: valueOf(own)?.record ?? null,
|
|
208
196
|
taken: group.records.filter(record => record.state === 'taken' && (!preferred.length || preferred.includes(record.ending)))
|
|
209
197
|
.sort((a, b) => takenRank(a) - takenRank(b)) };
|
|
210
198
|
}),
|
|
@@ -213,7 +201,7 @@ function receiptSelection(groups, args, triage) {
|
|
|
213
201
|
|
|
214
202
|
function summary(groups, args, triage, selection) {
|
|
215
203
|
const [wanted] = groups;
|
|
216
|
-
const { exact: isExact, preferred, budget, best, picks, cheapest, value
|
|
204
|
+
const { exact: isExact, preferred, budget, best, picks, cheapest, value } = selection;
|
|
217
205
|
const constraints = [...(!isExact && preferred.length ? [preferred.map(ending => '.' + ending).join(', ') + ' first'] : []),
|
|
218
206
|
...(budget != null ? ['Up to ' + cash(budget) + ' today'] : [])];
|
|
219
207
|
const target = wanted.records.find(record => record.ending === (preferred[0] ?? 'com')) ?? wanted.records[0];
|
|
@@ -261,11 +249,11 @@ function summary(groups, args, triage, selection) {
|
|
|
261
249
|
handles && 'Handles for ' + evidenceText(wanted.row.name) + ': ' + plain(handles) + '.',
|
|
262
250
|
running.length ? 'Still checking ' + running.join(', ') + '. The results page updates by itself.' : null,
|
|
263
251
|
...offerLines,
|
|
264
|
-
|
|
265
|
-
'
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
+
|
|
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,
|
|
269
257
|
(args.purchase ? 'This check leaves checkout to you. ' : '') + next + eligibility,
|
|
270
258
|
];
|
|
271
259
|
// Savings are page-only proof for each pick: dated list prices from at least three shops, never a pitch.
|
|
@@ -424,7 +412,7 @@ const amountsFor = ({ now, renew }) => [cash(now) ?? 'No price', cash(renew) ??
|
|
|
424
412
|
|
|
425
413
|
function rowNote(row) {
|
|
426
414
|
return [row.status, row.priceLabel, row.term > 1 ? row.term + ' years per payment' : null,
|
|
427
|
-
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,
|
|
428
416
|
row.source, row.checkedAt, row.priceAt ? 'Price checked ' + row.priceAt : null].filter(Boolean).join(' · ');
|
|
429
417
|
}
|
|
430
418
|
|
|
@@ -443,7 +431,7 @@ function render(groups, lines, checkedAt, coverage, watch, companyType, { saving
|
|
|
443
431
|
const shared = shareUrl(groups, checkedAt, shareFacts);
|
|
444
432
|
const shareLabel = groups.length > 5 ? 'Share first five names' : 'Share';
|
|
445
433
|
const [intro, ...body] = lines;
|
|
446
|
-
const comparison = body.filter(line => /^(?:Cheapest|Best value
|
|
434
|
+
const comparison = body.filter(line => /^(?:Cheapest|Best value):/.test(line));
|
|
447
435
|
const before = body.filter(line => !comparison.includes(line)).slice(0, comparison.length ? -1 : undefined);
|
|
448
436
|
const after = comparison.length ? body.slice(-1) : [];
|
|
449
437
|
const sources = watch?.source ? 'Registry: ' + String(watch.source).toUpperCase() :
|
|
@@ -584,7 +572,7 @@ export function resultPages({ env = process.env,
|
|
|
584
572
|
const work = writes.then(async () => {
|
|
585
573
|
const at = data.checkedAt ?? new Date().toISOString();
|
|
586
574
|
const groups = watch ? [] : resultGroups(data, args.eligible, args.endings);
|
|
587
|
-
const selection = receiptSelection(groups, args, triage);
|
|
575
|
+
const selection = receiptSelection(groups, args, triage, args.eligible ?? data.eligible ?? []);
|
|
588
576
|
const { lines, savings, shortLines } = watch ? { lines: data.say.split('\n'), savings: [] } : data.pending ? { lines: [
|
|
589
577
|
...(data.failed ? ['Some checks did not finish. Registry answers received are on the page.']
|
|
590
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": "
|
|
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.
|
|
7
|
+
"version": "0.1.8",
|
|
8
8
|
"packages": [
|
|
9
9
|
{
|
|
10
10
|
"registryType": "npm",
|
|
11
11
|
"identifier": "domain-hound",
|
|
12
|
-
"version": "0.1.
|
|
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
|
|
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: '
|
|
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
|
|
62
|
-
+ 'For
|
|
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: '
|
|
89
|
-
+ 'Call triage_names once with those names,
|
|
90
|
-
+ '
|
|
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,8 +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);
|
|
260
|
-
// Requested endings
|
|
259
|
+
// Requested endings rank first in the screen's own picks, and a budget applies there as on the receipt.
|
|
261
260
|
if (args.endings) flags.push('--prefer-endings', args.endings.join(','));
|
|
261
|
+
if (args.budget !== undefined) flags.push('--upfront-cap', String(args.budget));
|
|
262
262
|
if (Object.hasOwn(args, 'shortlist') && typeof args.shortlist !== 'boolean') throw new Error('shortlist must be a boolean.');
|
|
263
263
|
const { companyType, additionalHandles } = args;
|
|
264
264
|
if (companyType !== undefined && !Object.hasOwn(handlePriorities, companyType)) throw new Error('Choose a supported company type.');
|
|
@@ -320,7 +320,7 @@ function readProgress(progress, line) {
|
|
|
320
320
|
// Start one capability run. It ends on its own; only the maximum lookup time or server shutdown stops it.
|
|
321
321
|
// A name screen answers first with the checks done so far ({"followUp":true} on its first line) and keeps running
|
|
322
322
|
// the slow checks; the re-assessed result on its next line resolves lookup.later (null when there is none).
|
|
323
|
-
function startLookup(args, cwd, maxMs) {
|
|
323
|
+
function startLookup(args, cwd, maxMs, onLookupEvent) {
|
|
324
324
|
const triage = args[0] === '--triage';
|
|
325
325
|
const lookup = { started: performance.now(), progress: { answers: new Map(), stage: null }, finished: false, exited: false,
|
|
326
326
|
collect: false, outcome: null };
|
|
@@ -360,7 +360,10 @@ function startLookup(args, cwd, maxMs) {
|
|
|
360
360
|
settle(() => parseOutput(firstLine, false, 0));
|
|
361
361
|
}
|
|
362
362
|
});
|
|
363
|
-
createInterface({ input: child.stderr, crlfDelay: Infinity }).on('line', line =>
|
|
363
|
+
createInterface({ input: child.stderr, crlfDelay: Infinity }).on('line', line => {
|
|
364
|
+
readProgress(lookup.progress, line);
|
|
365
|
+
onLookupEvent?.('progress', lookup.progress);
|
|
366
|
+
});
|
|
364
367
|
let stopped = false;
|
|
365
368
|
const limit = setTimeout(() => {
|
|
366
369
|
stopped = true;
|
|
@@ -385,7 +388,11 @@ function startLookup(args, cwd, maxMs) {
|
|
|
385
388
|
later(next);
|
|
386
389
|
};
|
|
387
390
|
child.once('error', () => finish(true));
|
|
388
|
-
child.once('close', code =>
|
|
391
|
+
child.once('close', code => {
|
|
392
|
+
finish(code !== 0);
|
|
393
|
+
onLookupEvent?.('exited');
|
|
394
|
+
});
|
|
395
|
+
onLookupEvent?.('started');
|
|
389
396
|
return lookup;
|
|
390
397
|
}
|
|
391
398
|
|
|
@@ -414,7 +421,8 @@ function pendingTriage(progress, rows) {
|
|
|
414
421
|
|
|
415
422
|
export async function serve({
|
|
416
423
|
input = process.stdin, output = process.stdout, cwd = capabilityDir, timeout = timeoutMs, maxLookup = maxLookupMs,
|
|
417
|
-
pages = resultPages(), watch = watchDomain, socialLookup = checkSocialHandles, dossier = domainDossier,
|
|
424
|
+
pages = resultPages(), watch = watchDomain, socialLookup = checkSocialHandles, dossier = domainDossier, portfolio = myDomains,
|
|
425
|
+
onLookupEvent,
|
|
418
426
|
} = {}) {
|
|
419
427
|
const send = response => output.write(JSON.stringify({ jsonrpc: '2.0', ...response }) + '\n');
|
|
420
428
|
const error = (id, code, message) => send({ id, error: { code, message } });
|
|
@@ -439,7 +447,7 @@ export async function serve({
|
|
|
439
447
|
const key = JSON.stringify([cliArgs, presentation]);
|
|
440
448
|
let lookup = lookups.get(key);
|
|
441
449
|
if (!lookup) {
|
|
442
|
-
lookup = startLookup(cliArgs, cwd, maxLookup);
|
|
450
|
+
lookup = startLookup(cliArgs, cwd, maxLookup, onLookupEvent);
|
|
443
451
|
lookups.set(key, lookup);
|
|
444
452
|
lookup.done.then(() => {
|
|
445
453
|
if (lookups.get(key) !== lookup) return;
|
|
@@ -615,7 +623,7 @@ export async function serve({
|
|
|
615
623
|
}
|
|
616
624
|
if (method !== 'tools/list' && method !== 'tools/call') return error(id, -32601, 'Method not found');
|
|
617
625
|
if (!initialized) return error(id, -32000, 'Domain Hound has not been initialized');
|
|
618
|
-
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]) });
|
|
619
627
|
const { name, arguments: args } = params ?? {};
|
|
620
628
|
if (purchaseToolNames.has(name)) return reply(await callPurchaseTool(name, args));
|
|
621
629
|
if (name === namingTool.name) {
|
|
@@ -644,6 +652,13 @@ export async function serve({
|
|
|
644
652
|
return reply(errorResult(problem.message));
|
|
645
653
|
}
|
|
646
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
|
+
}
|
|
647
662
|
const purchase = isObject(args) && args.purchase === true;
|
|
648
663
|
if (name === triageTool.name) {
|
|
649
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
|
-
|
|
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,
|
package/site/r/share-format.mjs
CHANGED
|
@@ -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
|
|
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
|
-
+ '
|
|
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',
|