domain-hound 0.1.11 → 0.1.13
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 +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +3 -3
- package/assets/results.css +2 -1
- package/hosted-results.mjs +72 -37
- package/hosted.mjs +35 -18
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/results-cards.mjs +16 -10
- package/results.mjs +17 -25
- package/server.json +2 -2
- package/server.mjs +27 -15
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"plugins": [
|
|
6
6
|
{
|
|
7
7
|
"name": "domain-hound",
|
|
8
|
-
"version": "0.1.
|
|
8
|
+
"version": "0.1.13",
|
|
9
9
|
"source": "./",
|
|
10
10
|
"description": "Domains for agents. One MCP for everything domains: find, check, buy, set up, watch, move, renew, keep track.",
|
|
11
11
|
"relevance": { "topic": "Domains", "signals": { "hosts": ["rdap.org", "porkbun.com"] } }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "domain-hound",
|
|
3
3
|
"displayName": "Domain Hound",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.13",
|
|
5
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"
|
package/README.md
CHANGED
|
@@ -68,13 +68,13 @@ An affordable .inc result appears in a bare-name search only after the registry
|
|
|
68
68
|
|
|
69
69
|
Each available domain shows the listed shops, first-year price, renewal and three-year cost, plus the cheapest shop
|
|
70
70
|
over three years. The Hound picks the highest-ranked available ending within $60 over three years when one qualifies.
|
|
71
|
-
The
|
|
72
|
-
|
|
71
|
+
The hosted first answer leads with the domain status or the Hound’s pick and price. The App Store and Google Play
|
|
72
|
+
findings come next, followed by an exact US trademark finding. Public profiles appear in the saved results page. The package retries unknown public profile and Google Play results from your device. LinkedIn and
|
|
73
73
|
Reddit use the Wayback Machine CDX index, with the latest Common Crawl index as a fallback when Wayback cannot answer.
|
|
74
74
|
A capture includes its year. A successful empty archive search returns `not-seen`. Google Play matches a title or
|
|
75
75
|
a title starting with the name followed by a non-letter, ignoring case. Set `DOMAIN_HOUND_EMBED_CHECKS=off` for search
|
|
76
76
|
or profile links only on TikTok, Instagram, X, Threads, Facebook, LinkedIn, Reddit, Twitch and Google Play.
|
|
77
|
-
`check_domains`
|
|
77
|
+
If `check_domains` says a check is pending, repeat the same call to collect it. The saved results page updates at the same link.
|
|
78
78
|
|
|
79
79
|
When the hosted lookup cannot check a .dev or .app domain, the package can ask Google Registry from your device and pass the result back to the hosted service to calculate the pick. It also tries Apple from your device when the hosted App Store lookup is rate-limited.
|
|
80
80
|
|
package/assets/results.css
CHANGED
|
@@ -76,7 +76,8 @@ body { font-size: var(--body-size); line-height: 1.5; }
|
|
|
76
76
|
.trademark-warning strong { font-size: 1.15rem; }
|
|
77
77
|
.trademark-warning p, .trademark-pending { font-size: .93rem; }
|
|
78
78
|
.trademark-pending { border-left: 2px solid; padding-left: 10px; }
|
|
79
|
-
.
|
|
79
|
+
.primary-checks { width: 100%; margin: 12px 0; font-size: .93rem; }
|
|
80
|
+
.primary-checks > p { padding: 4px 0; border-top: 1px solid #10238540; }
|
|
80
81
|
.ending-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 2px; background: var(--blue); }
|
|
81
82
|
.offer-row, .detail-checks { min-width: 0; background: var(--cream); padding: 15px 16px 0; }
|
|
82
83
|
.offer-row { display: flex; flex-direction: column; align-items: flex-start; }
|
package/hosted-results.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { attributed, md } from './display.mjs';
|
|
|
2
2
|
import { canRecommend, choosePick, normalizeName } from './clis/domain-check/name-search.mjs';
|
|
3
3
|
import { compareScores, scoreEligible, scoreHandles, scoreName } from './clis/domain-check/name-score.mjs';
|
|
4
4
|
import { relevantClasses } from './clis/domain-check/triage-sources.mjs';
|
|
5
|
-
import { handleLabel
|
|
6
|
-
import {
|
|
5
|
+
import { handleLabel } from './clis/domain-check/handles.mjs';
|
|
6
|
+
import { googlePlayLinkLabel, playSearchLink } from './clis/domain-check/google-play.mjs';
|
|
7
7
|
|
|
8
8
|
const money = value => Number.isFinite(value) ? '$' + value.toFixed(2) : 'price at shop';
|
|
9
9
|
const platforms = ['LinkedIn', 'X', 'Instagram', 'TikTok', 'YouTube', 'Threads', 'Facebook', 'Reddit', 'Twitch', 'GitHub'];
|
|
@@ -18,36 +18,69 @@ function link(label, value) {
|
|
|
18
18
|
return md(label);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
export const usTrademark = check => check.trademarks?.us ?? check.nameChecks?.trademarks?.us;
|
|
22
|
+
|
|
23
|
+
const usptoSearch = 'https://tmsearch.uspto.gov/';
|
|
24
|
+
|
|
25
|
+
function usptoLink(label, value) {
|
|
26
|
+
try {
|
|
27
|
+
const url = new URL(value);
|
|
28
|
+
if (url.origin === 'https://tsdr.uspto.gov' && !url.username && !url.password) return link(label, url.href);
|
|
29
|
+
} catch { /* The trademark search is available when the filing link is missing. */ }
|
|
30
|
+
return link(label, usptoSearch);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function trademarkLines(check, pending, markLimit = 10) {
|
|
34
|
+
const us = usTrademark(check);
|
|
35
|
+
if (us?.status === 'pending' || (!us && pending)) return ['Trademark check still running.'];
|
|
36
|
+
if (us?.status === 'no_exact_match_found') return ['US trademark: no exact live match found.'];
|
|
37
|
+
if (us?.status !== 'exact_match_found') return ['US trademark: couldn’t check. ' + link('Search US trademarks', usptoSearch)];
|
|
38
|
+
const marks = us.marks?.length ? us.marks.slice(0, markLimit) : [{ mark: check.query.name }];
|
|
39
|
+
return [...marks.map(mark => 'Heads-up: ' + usptoLink(mark.mark || check.query.name, mark.url)
|
|
40
|
+
+ ' has an exact live US trademark match' + (mark.owner ? ' (' + md(mark.owner) + ')' : '') + '.'),
|
|
41
|
+
'Search aid, not legal advice.'];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function domainAnswer({ domains, query, choice }) {
|
|
45
|
+
const exact = domains.find(row => row.domain === query.exactDomain);
|
|
46
|
+
const available = domains.find(row => row.status === 'available');
|
|
47
|
+
if (query.exactDomain) {
|
|
48
|
+
const ending = exact?.reason === 'reserved' ? ' is reserved by the registry.'
|
|
49
|
+
: ['available', 'taken'].includes(exact?.status) ? ' is ' + exact.status + '.' : ' could not be confirmed.';
|
|
50
|
+
return md(query.exactDomain) + ending;
|
|
51
|
+
}
|
|
52
|
+
if (choice?.pick) return pickLine(choice.pick);
|
|
53
|
+
if (available) return md(available.domain) + ' is available.';
|
|
54
|
+
return md(query.name) + (domains.length && domains.every(row => row.status === 'taken')
|
|
55
|
+
? ' · All checked endings are taken.' : ' · No available endings confirmed.');
|
|
28
56
|
}
|
|
29
57
|
|
|
30
|
-
export function
|
|
58
|
+
export function appNameLines(check, pending, withLinks = true) {
|
|
59
|
+
const app = check.appStore ?? check.nameChecks?.appStore;
|
|
60
|
+
const play = check.googlePlay ?? check.nameChecks?.googlePlay;
|
|
61
|
+
const outcome = row => {
|
|
62
|
+
if (['taken', 'exact_match_found'].includes(row?.status)) return 'Taken';
|
|
63
|
+
if (['not-found', 'no_match_found'].includes(row?.status)) return 'No matching app found';
|
|
64
|
+
return row?.status === 'pending' || (!row && pending) ? 'Still checking' : 'Couldn’t check';
|
|
65
|
+
};
|
|
66
|
+
const match = withLinks && app?.matches?.[0];
|
|
67
|
+
return ['App Store (iOS) · ' + outcome(app) + (match ? ' · ' + link(match.name, match.url) : ''),
|
|
68
|
+
'Google Play (Android) · ' + outcome(play) + (withLinks ? ' · '
|
|
69
|
+
+ link(googlePlayLinkLabel, play?.link ?? playSearchLink(check.query.name)) : '')];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function hostedIntroLines(check, pending, markLimit = 10, withAppLinks = true) {
|
|
73
|
+
return [domainAnswer(check), ...appNameLines(check, pending, withAppLinks), ...trademarkLines(check, pending, markLimit)];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function nameCheckLines(details, pending) {
|
|
31
77
|
if (!details) return [pending ? 'Name checks are still running. Call the same tool with the same input to collect them.' : 'Name checks could not be completed.'];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
? "Couldn't check · " + link('Search US trademarks', us.searchUrl) : null;
|
|
39
|
-
return [
|
|
40
|
-
...(markText ? ['US trademarks · ' + markText] : []),
|
|
41
|
-
'App Store · ' + appText + (apps ? ' · ' + apps : ''),
|
|
42
|
-
(googlePlay.why === 'no public search' ? googlePlayLabel : 'Google Play · ' + (handleStates[googlePlay.status] ?? handleStates.unknown))
|
|
43
|
-
+ ' · ' + link(googlePlayLinkLabel, googlePlay.link ?? playSearchLink(name)),
|
|
44
|
-
...platforms.flatMap(platform => {
|
|
45
|
-
const handle = handles.find(row => row.platform === platform);
|
|
46
|
-
if (!handle) return [];
|
|
47
|
-
const label = handleLabel(handle);
|
|
48
|
-
return platform + ' · ' + (handle.linkLabel ? label + ' · ' + link(handle.linkLabel, handle.link) : link(label, handle.link));
|
|
49
|
-
}),
|
|
50
|
-
];
|
|
78
|
+
return platforms.flatMap(platform => {
|
|
79
|
+
const handle = details.handles?.find(row => row.platform === platform);
|
|
80
|
+
if (!handle) return [];
|
|
81
|
+
const label = handleLabel(handle);
|
|
82
|
+
return platform + ' · ' + (handle.linkLabel ? label + ' · ' + link(handle.linkLabel, handle.link) : link(label, handle.link));
|
|
83
|
+
});
|
|
51
84
|
}
|
|
52
85
|
|
|
53
86
|
function priceLine(offer, cheapest) {
|
|
@@ -63,7 +96,7 @@ export function pickLine(pick) {
|
|
|
63
96
|
return 'The Hound’s pick is ' + md(pick.domain) + ' at ' + md(pick.shop) + ' for ' + money(pick.threeYearUsd) + ' over three years.';
|
|
64
97
|
}
|
|
65
98
|
|
|
66
|
-
export function checkLines(check, pending, { local = false } = {}) {
|
|
99
|
+
export function checkLines(check, pending, { local = false, includePick = true } = {}) {
|
|
67
100
|
const { domains, choice, nameChecks, score } = check;
|
|
68
101
|
const pick = choice?.pick;
|
|
69
102
|
const taken = domains.filter(row => row.status === 'taken').map(row => row.domain);
|
|
@@ -73,19 +106,19 @@ export function checkLines(check, pending, { local = false } = {}) {
|
|
|
73
106
|
...(score?.filtered ? [md(check.query.name) + ' · ' + md(score.filtered)]
|
|
74
107
|
: Number.isInteger(score?.value) ? [md(check.query.name) + ' · Name score ' + score.value + '/100 · ' + md(score.band),
|
|
75
108
|
...(score.reasons ?? []).map(md)] : []),
|
|
76
|
-
...(pick ? [pickLine(pick)] : []),
|
|
109
|
+
...(pick && includePick ? [pickLine(pick)] : []),
|
|
77
110
|
...domains.filter(row => row.status === 'available').flatMap(row => [
|
|
78
111
|
'Available · ' + md(row.domain),
|
|
79
112
|
...(row.prices?.length ? row.prices.map((offer, index) => priceLine(offer, !local && index === 0)) : ['Check the price at the shop.']),
|
|
80
113
|
...(local && row.confirmed ? ['Confirmed at the shop.'] : []),
|
|
81
114
|
]),
|
|
82
|
-
...(local ? [] : nameCheckLines(nameChecks, pending, check.query.name)),
|
|
83
115
|
...(taken.length ? ['Taken · ' + taken.map(md).join(', ') + '. '
|
|
84
116
|
+ link('Watch', 'https://domainhound.dev/watch/?domain=' + encodeURIComponent(taken[0]))
|
|
85
117
|
+ ' · Draft an offer · Try a new name'] : []),
|
|
86
118
|
...(reserved.length ? ['Reserved by the registry · ' + reserved.map(row => md(row.domain)).join(', ') + '.'] : []),
|
|
87
119
|
...(unknown.length ? ['Could not confirm ' + (domains.length === 1 ? md(unknown[0].domain)
|
|
88
120
|
: unknown.length + (unknown.length === 1 ? ' ending' : ' endings')) + '.'] : []),
|
|
121
|
+
...(local ? [] : nameCheckLines(nameChecks, pending)),
|
|
89
122
|
];
|
|
90
123
|
}
|
|
91
124
|
|
|
@@ -112,14 +145,14 @@ export function hostedChecks(checks, args, triage = false) {
|
|
|
112
145
|
return checks.map(check => {
|
|
113
146
|
const pick = preferredPick(check, args);
|
|
114
147
|
if (!triage) return pick === check.choice.pick ? check : { ...check, choice: { ...check.choice, pick } };
|
|
115
|
-
const us = check
|
|
148
|
+
const us = usTrademark(check);
|
|
116
149
|
const score = scoreName({
|
|
117
150
|
name: check.query.name,
|
|
118
151
|
candidate: candidates.get(normalizeName(check.query.name)),
|
|
119
152
|
domains: check.domains.filter(row => row.status === 'available' && canRecommend(row.ending, args.eligible)
|
|
120
153
|
&& (!args.endings?.length || args.endings.includes(row.ending)))
|
|
121
154
|
.map(row => ({ ending: row.ending, total: row.prices[0]?.threeYearUsd, registry: true })),
|
|
122
|
-
marks: { us: us?.status
|
|
155
|
+
marks: { us: ['exact_match_found', 'no_exact_match_found'].includes(us?.status) ? 'ok' : 'unknown',
|
|
123
156
|
list: us?.marks.map(mark => ({ tier: 'Exact', live: true,
|
|
124
157
|
sameClass: mark.classes?.length ? mark.classes.some(value => classes.includes(value)) : null })) },
|
|
125
158
|
apps: { list: check.nameChecks?.appStore?.matches },
|
|
@@ -147,15 +180,17 @@ export function visibleChecks(checks, args, generation) {
|
|
|
147
180
|
|
|
148
181
|
export function hostedResult(checks, args, generation, { pending = false, failed = false, checkedAt } = {}) {
|
|
149
182
|
const shown = visibleChecks(checks, args, generation);
|
|
183
|
+
const warnings = checks.filter(check => !shown.includes(check) && usTrademark(check)?.status === 'exact_match_found')
|
|
184
|
+
.flatMap(check => trademarkLines(check, pending));
|
|
150
185
|
const lines = [
|
|
151
|
-
...checks.flatMap(warning),
|
|
152
186
|
...(shown.length ? shown.flatMap((check, index) => [
|
|
153
|
-
...(
|
|
154
|
-
...checkLines(check, pending),
|
|
187
|
+
...(generation && !check.domains.length ? [md(check.query.name)] : hostedIntroLines(check, pending)),
|
|
188
|
+
...checkLines(check, pending, { includePick: false }),
|
|
155
189
|
...(index < shown.length - 1 ? [''] : []),
|
|
156
190
|
]) : [pending && generation?.suggestions?.length
|
|
157
191
|
? 'Checking domains for ' + generation.suggestions.map(entry => md(entry.name)).join(', ') + '.'
|
|
158
192
|
: pending ? 'Still checking names and domains.' : 'No names passed the checks.']),
|
|
193
|
+
...warnings,
|
|
159
194
|
...(pending ? ['The results page updates when the remaining checks finish.'] : []),
|
|
160
195
|
...(failed ? ['The remaining checks did not finish.'] : []),
|
|
161
196
|
...(generation?.question && !pending ? [md(generation.question)] : []),
|
package/hosted.mjs
CHANGED
|
@@ -27,6 +27,9 @@ const validCheck = body => body?.version === 1 && typeof body.query?.ascii === '
|
|
|
27
27
|
const validDetails = body => body?.version === 1 && body.appStore && body.googlePlay &&
|
|
28
28
|
Array.isArray(body.trademarks?.us?.marks) && Array.isArray(body.handles);
|
|
29
29
|
const validGeneration = body => body?.version === 2 && ['initial', 'final'].includes(body.stage) && Array.isArray(body.names);
|
|
30
|
+
const definite = row => row && !['pending', 'unknown'].includes(row.status);
|
|
31
|
+
const best = (first, next) => definite(first) ? first
|
|
32
|
+
: next ?? (first?.status === 'pending' ? { ...first, status: 'unknown' } : first);
|
|
30
33
|
|
|
31
34
|
// Only the IANA-listed Google Registry route for the returned .app or .dev domain is eligible.
|
|
32
35
|
async function observeRdap(row, ascii, fetchFn, signal) {
|
|
@@ -133,10 +136,10 @@ export function hostedClient(version, { env = process.env, fetchFn = fetch, appl
|
|
|
133
136
|
}
|
|
134
137
|
|
|
135
138
|
async function recoverApple(app, name, signal) {
|
|
136
|
-
if (app?.status !== 'unknown'
|
|
139
|
+
if (app?.status !== 'unknown') return app;
|
|
137
140
|
const label = normalizeName(name);
|
|
138
141
|
if (!label) return app;
|
|
139
|
-
const checked = await apple(label, name, { signal
|
|
142
|
+
const checked = await apple(label, name, { signal, fetcher: fetchFn })
|
|
140
143
|
.catch(() => null);
|
|
141
144
|
if (!Array.isArray(checked)) return app;
|
|
142
145
|
return { ...app, status: checked.length ? 'taken' : 'no_match_found', reason: null,
|
|
@@ -207,25 +210,39 @@ export function hostedClient(version, { env = process.env, fetchFn = fetch, appl
|
|
|
207
210
|
domains: comparison.domains, choice: comparison.choice, priceSnapshot: comparison.priceSnapshot,
|
|
208
211
|
share: comparison.share, complete: comparison.complete,
|
|
209
212
|
} : null).catch(() => null) : null;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
213
|
+
const hasDetails = typeof details?.id === 'string';
|
|
214
|
+
const detailCheck = hasDetails ? read('/v1/check/details', {
|
|
215
|
+
params: { id: details.id }, timeout: 5300, signal: AbortSignal.any([signal, AbortSignal.timeout(5700)]), valid: validDetails,
|
|
216
|
+
}, true).catch(() => null) : Promise.resolve(null);
|
|
217
|
+
if (!hasDetails) hostedDebug('/v1/check did not provide a name-check token', env);
|
|
218
|
+
|
|
219
|
+
const initialApp = answer.appStore;
|
|
220
|
+
// The first response can already know Apple failed. Start the retry without waiting for handles.
|
|
221
|
+
const localApple = initialApp?.status === 'unknown' ? recoverApple(initialApp, main.query.name, signal) : null;
|
|
222
|
+
const detailsApp = detailCheck.then(data => data?.appStore);
|
|
223
|
+
const appCheck = localApple
|
|
224
|
+
? Promise.race([localApple, detailsApp.then(row => definite(row) ? row : localApple)])
|
|
225
|
+
.then(async row => definite(row) ? row : best(row, await detailsApp))
|
|
226
|
+
: detailsApp.then(row => definite(initialApp) ? initialApp
|
|
227
|
+
: recoverApple(best(initialApp, row), main.query.name, signal));
|
|
228
|
+
const waitingForApple = !definite(initialApp) && Boolean(initialApp || hasDetails);
|
|
229
|
+
if (hasDetails || waitingForApple) {
|
|
230
|
+
onDomains?.(waitingForApple ? { ...answer, appStore: { ...initialApp, status: 'pending' } } : answer,
|
|
231
|
+
waitingForApple ? appCheck : undefined);
|
|
218
232
|
}
|
|
233
|
+
|
|
234
|
+
const nameChecks = await detailCheck;
|
|
219
235
|
if (nameChecks) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
]);
|
|
224
|
-
for (const [index, result] of recovered.entries()) {
|
|
225
|
-
if (result.status === 'rejected') hostedDebug('Optional ' + (index ? 'handle' : 'App Store') + ' recovery failed', env);
|
|
226
|
-
}
|
|
236
|
+
if (definite(answer.googlePlay)) nameChecks.googlePlay = answer.googlePlay;
|
|
237
|
+
await recoverNameChecks([{ name: main.query.name, nameChecks }], signal)
|
|
238
|
+
.catch(() => hostedDebug('Optional handle recovery failed', env));
|
|
227
239
|
}
|
|
228
|
-
|
|
240
|
+
const appStore = await appCheck;
|
|
241
|
+
if (nameChecks && appStore) nameChecks.appStore = appStore;
|
|
242
|
+
const googlePlay = best(answer.googlePlay, nameChecks?.googlePlay);
|
|
243
|
+
const mark = best(answer.trademarks?.us, nameChecks?.trademarks?.us);
|
|
244
|
+
return { ...answer, ...(needsAlternatives && { [alternativeEndings]: await alternatives }), nameChecks,
|
|
245
|
+
...(appStore && { appStore }), ...(googlePlay && { googlePlay }), ...(mark && { trademarks: { us: mark } }) };
|
|
229
246
|
},
|
|
230
247
|
|
|
231
248
|
async generate(args, signal) {
|
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.
|
|
4
|
+
"version": "0.1.13",
|
|
5
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"
|
package/results-cards.mjs
CHANGED
|
@@ -51,12 +51,13 @@ function shopTable(domain, quotes, cheapest) {
|
|
|
51
51
|
+ '</tr></thead><tbody>' + rows.join('') + '</tbody></table>';
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
function endingCard(row, card) {
|
|
54
|
+
function endingCard(row, card, intro = '') {
|
|
55
55
|
const prices = [...row.prices].sort((a, b) => (a.threeYearUsd ?? Infinity) - (b.threeYearUsd ?? Infinity)
|
|
56
56
|
|| (a.firstPaymentUsd ?? Infinity) - (b.firstPaymentUsd ?? Infinity));
|
|
57
|
-
const [
|
|
57
|
+
const [cheapest] = prices;
|
|
58
58
|
const buy = prices.find(price => price.buyUrl);
|
|
59
59
|
const best = card.pick?.domain === row.domain && Boolean(buy);
|
|
60
|
+
const first = (best && prices.find(price => price.shop === card.pick.shop)) || cheapest;
|
|
60
61
|
const more = prices.length - 3;
|
|
61
62
|
const labels = [row.domain === card.exact && 'You asked for this', best && 'Hound’s pick'].filter(Boolean);
|
|
62
63
|
return '<section class="offer-row' + (best ? ' best-domain' : '') + '" data-domain="' + escape(row.domain) + '">'
|
|
@@ -71,20 +72,24 @@ function endingCard(row, card) {
|
|
|
71
72
|
+ escape(first.minimumYears) + ' years.'
|
|
72
73
|
+ (Number.isFinite(first.renewalUsd) ? ' Renewal ' + amount(first.renewalPaymentUsd ?? first.minimumYears * first.renewalUsd) + ' per payment.' : '')
|
|
73
74
|
+ '</p>' : '') : '<p class="offer-condition">No standard price listed.</p>')
|
|
74
|
-
+ (row.note ? '<p class="offer-condition">' + escape(row.note) + '</p>' : '')
|
|
75
|
+
+ intro + (row.note ? '<p class="offer-condition">' + escape(row.note) + '</p>' : '')
|
|
75
76
|
+ (buy ? '<a class="action" aria-label="Buy ' + escape(row.domain + ' at ' + buy.shop) + '" href="' + escape(buy.buyUrl)
|
|
76
77
|
+ '">Buy at ' + escape(buy.shop) + (buy !== first ? ' · ' + amount(buy.threeYearUsd) + ' for 3 years' : '') + '</a>' : '')
|
|
77
78
|
+ (buy?.shop === 'Cloudflare' ? '<p class="offer-condition">Requires Cloudflare DNS.</p>' : '')
|
|
78
79
|
+ (buy && Number.isFinite(buy.firstYearUsd) && buy.renewalUsd > 3 * buy.firstYearUsd ? '<p class="renewal-warning">Renewal at '
|
|
79
80
|
+ escape(buy.shop) + ' costs more than 3 times the first year.</p>' : '')
|
|
80
|
-
+ (first ? shopTable(row.domain, prices.slice(0, 3),
|
|
81
|
+
+ (first ? shopTable(row.domain, prices.slice(0, 3), cheapest.threeYearUsd) : '')
|
|
81
82
|
+ (more > 0 ? '<details class="extra-shops"><summary class="more-shops">+' + more + ' more shop' + (more === 1 ? '' : 's')
|
|
82
|
-
+ '</summary>' + shopTable(row.domain, prices.slice(3),
|
|
83
|
+
+ '</summary>' + shopTable(row.domain, prices.slice(3), cheapest.threeYearUsd) + '</details>' : '') + '</section>';
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
function nameCard(card, index, multi, perNameShare) {
|
|
86
87
|
const available = card.domains.filter(row => row.status === 'available');
|
|
87
|
-
|
|
88
|
+
const firstDomain = card.exact ?? card.pick?.domain;
|
|
89
|
+
if (firstDomain) available.sort((a, b) => Number(b.domain === firstDomain) - Number(a.domain === firstDomain));
|
|
90
|
+
const intro = (card.apps ? '<div class="primary-checks">' + card.apps + card.warning + '</div>' : card.warning) || '';
|
|
91
|
+
const first = available[0];
|
|
92
|
+
const introInOffer = card.apps && first && (!card.exact || first.domain === card.exact);
|
|
88
93
|
const taken = card.domains.filter(row => row.status === 'taken');
|
|
89
94
|
const requestedTaken = taken.some(row => row.domain === card.exact);
|
|
90
95
|
const priority = new Map([['com', 0], ['ai', 1], ['io', 2]]);
|
|
@@ -93,17 +98,16 @@ function nameCard(card, index, multi, perNameShare) {
|
|
|
93
98
|
const unknown = card.domains.filter(row => row.status === 'unknown');
|
|
94
99
|
const count = available.length;
|
|
95
100
|
return '<article class="hunt-card" id="name-' + index + '">'
|
|
96
|
-
+ (multi ? '<h2>' + escape(card.name) + '</h2>' : '') + card.
|
|
101
|
+
+ (multi ? '<h2>' + escape(card.name) + '</h2>' : '') + (!introInOffer && card.answer ? paragraph(card.answer) : '')
|
|
102
|
+
+ (!introInOffer ? intro : '')
|
|
97
103
|
+ (card.score ? '<div class="name-score">' + paragraph(card.score) + '</div>' : '')
|
|
98
104
|
+ (requestedTaken ? '<p class="requested-actions">' + anchor('Watch ' + card.exact, watchLink(card.exact))
|
|
99
105
|
+ ' or ask your agent to draft an offer.</p>' : '')
|
|
100
106
|
+ (count ? (requestedTaken ? '<h3 class="alternatives-title">Available instead</h3>' : '<p class="offer-count">'
|
|
101
107
|
+ count + ' available domain' + (count === 1 ? '' : 's') + '</p>')
|
|
102
|
-
+ '<div class="ending-list">' + available.map(row => endingCard(row, card)).join('') + '</div>'
|
|
108
|
+
+ '<div class="ending-list">' + available.map(row => endingCard(row, card, introInOffer && row === first ? intro : '')).join('') + '</div>'
|
|
103
109
|
: '<p class="ending-summary">' + (card.alternativesFailed ? 'Couldn’t check other endings.' : card.complete !== false && taken.length && !unknown.length
|
|
104
110
|
? 'All checked endings are taken.' : 'No available endings confirmed.') + '</p>')
|
|
105
|
-
+ (card.checks ? '<details class="name-details"><summary>Name checks</summary><div class="local-evidence">'
|
|
106
|
-
+ card.checks + '</div></details>' : '')
|
|
107
111
|
+ (others.length ? '<div class="taken-group"><p class="taken-list"><b>Taken</b> ' + others.map(row =>
|
|
108
112
|
'<a aria-label="Watch ' + escape(row.domain) + '" href="' + escape(watchLink(row.domain)) + '">'
|
|
109
113
|
+ escape(row.domain.startsWith(card.name.toLowerCase().split('.')[0] + '.') || row.domain.startsWith(normalizeName(card.name) + '.')
|
|
@@ -111,6 +115,8 @@ function nameCard(card, index, multi, perNameShare) {
|
|
|
111
115
|
+ ' <span class="taken-next">Watch an ending, or ask your agent to draft an offer.</span></p></div>' : '')
|
|
112
116
|
+ (unknown.length ? '<details class="local-evidence"><summary>' + unknown.length + ' ending' + (unknown.length === 1 ? '' : 's')
|
|
113
117
|
+ ' couldn’t be confirmed</summary>' + unknown.map(row => '<p>' + escape(row.domain + ' · ' + (row.note || 'Could not confirm')) + '</p>').join('') + '</details>' : '')
|
|
118
|
+
+ (card.checks ? '<details class="name-details"><summary>Name checks</summary><div class="local-evidence">'
|
|
119
|
+
+ card.checks + '</div></details>' : '')
|
|
114
120
|
+ '<div class="suggestion-foot">' + (Array.isArray(card.reasons) && card.reasons.length ? '<details><summary>Why this name?</summary><ul class="reason-list">'
|
|
115
121
|
+ card.reasons.map(reason => '<li>' + escape(reason) + '</li>').join('') + '</ul></details>' : '')
|
|
116
122
|
+ (perNameShare && card.share ? anchor('Share ' + card.name, card.share) : '') + '</div></article>';
|
package/results.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { googlePlayLabel, googlePlayLinkLabel, playSearchLink } from './clis/dom
|
|
|
10
10
|
import { dnsNeed, shopSearchUrl, shops } from './clis/domain-check/prices.mjs';
|
|
11
11
|
import { trademarkSearches } from './clis/domain-check/triage-sources.mjs';
|
|
12
12
|
import { attributed, localCheckNotice, safeLink } from './display.mjs';
|
|
13
|
-
import { checkLines, nameCheckLines, pickDomain, pickLine, visibleChecks } from './hosted-results.mjs';
|
|
13
|
+
import { appNameLines, checkLines, domainAnswer, nameCheckLines, pickDomain, pickLine, trademarkLines, usTrademark, visibleChecks } from './hosted-results.mjs';
|
|
14
14
|
import { datedListPrices, loadCachedCatalog } from './clis/domain-check/price-catalog.mjs';
|
|
15
15
|
import { alternativeEndings } from './hosted.mjs';
|
|
16
16
|
import { anchor, escape, paragraph, priceDay, publicShare, renderCards } from './results-cards.mjs';
|
|
@@ -499,15 +499,13 @@ export function disclosure(data, triage) {
|
|
|
499
499
|
+ 'Up to three go to public handle APIs. Domain Hound uses your brief locally. ' + shop;
|
|
500
500
|
}
|
|
501
501
|
|
|
502
|
-
function hostedWarning(check) {
|
|
503
|
-
const
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
? escape(mark.owner + ' filed for ' + (mark.mark || check.query.name) + '. ') : '')
|
|
507
|
-
+ (recordLink(mark.url) ? anchor('Read the filing', recordLink(mark.url)) : '') + '</p>').join('') + '</aside>' : '';
|
|
502
|
+
function hostedWarning(check, pending) {
|
|
503
|
+
const lines = trademarkLines(check, pending);
|
|
504
|
+
if (usTrademark(check)?.status !== 'exact_match_found') return '<div class="trademark-pending">' + paragraph(lines[0]) + '</div>';
|
|
505
|
+
return '<aside class="trademark-warning">' + lines.map(paragraph).join('') + '</aside>';
|
|
508
506
|
}
|
|
509
507
|
|
|
510
|
-
function hostedPrices(row, pick, budget
|
|
508
|
+
function hostedPrices(row, pick, budget) {
|
|
511
509
|
if (row.status !== 'available' || row.priceShown === false || row.premium) return [];
|
|
512
510
|
let prices = row.prices ?? [];
|
|
513
511
|
// Generated ideas sometimes carry the comparison (or just the winning quote) on the pick.
|
|
@@ -519,26 +517,21 @@ function hostedPrices(row, pick, budget, pending) {
|
|
|
519
517
|
const shop = shops[shopIds.get(quote.shop)];
|
|
520
518
|
// The hosted catalog sets its own price-only flag. Match both registrar and exact domain.
|
|
521
519
|
const expected = shop && shop.url + encodeURIComponent(row.domain) + (shop.suffix ?? '');
|
|
522
|
-
const canBuy = !
|
|
520
|
+
const canBuy = !quote.dataOnly && expected && quote.buyUrl === expected
|
|
523
521
|
&& (!row.eligibility || row.eligibility.need || row.eligibility.note)
|
|
524
522
|
&& (budget == null || quote.firstPaymentUsd <= budget);
|
|
525
523
|
return { ...quote, buyUrl: canBuy ? expected : null };
|
|
526
524
|
});
|
|
527
525
|
}
|
|
528
526
|
|
|
529
|
-
function hostedNameChecks(details, pending
|
|
530
|
-
// The page refreshes itself; the repeat-call hint is only for the MCP reply.
|
|
527
|
+
function hostedNameChecks(details, pending) {
|
|
531
528
|
if (!details) return paragraph(pending ? 'Name checks are still running.' : 'Name checks could not be completed.');
|
|
532
|
-
const lines = nameCheckLines(details, pending
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
for (const line of lines) {
|
|
529
|
+
const lines = nameCheckLines(details, pending);
|
|
530
|
+
if (!lines.length) return '';
|
|
531
|
+
return '<div class="check-grid"><dl class="handle-list">' + lines.map(line => {
|
|
536
532
|
const [label, ...finding] = line.split(' · ');
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
}
|
|
540
|
-
return '<div class="check-grid"><section><h4>Apps and trademarks</h4><dl>' + apps.join('') + '</dl></section>'
|
|
541
|
-
+ (handles.length ? '<section><h4>Handles</h4><dl class="handle-list">' + handles.join('') + '</dl></section>' : '') + '</div>';
|
|
533
|
+
return '<div class="check-line"><dt>' + escape(label) + '</dt><dd>' + paragraph(finding.join(' · ')) + '</dd></div>';
|
|
534
|
+
}).join('') + '</dl></div>';
|
|
542
535
|
}
|
|
543
536
|
|
|
544
537
|
function hostedCard(check, pending, args, snapshot) {
|
|
@@ -548,15 +541,14 @@ function hostedCard(check, pending, args, snapshot) {
|
|
|
548
541
|
const rows = [...check.domains, ...(alternatives?.domains ?? []).filter(row => !seen.has(row.domain))];
|
|
549
542
|
const pick = check.choice?.pick ?? alternatives?.choice?.pick;
|
|
550
543
|
const domains = rows.map(row => ({
|
|
551
|
-
...row, prices: hostedPrices(row, pick, args.budget
|
|
544
|
+
...row, prices: hostedPrices(row, pick, args.budget),
|
|
552
545
|
note: [row.premium, row.eligibility && (row.eligibility.note || row.eligibility.need || 'Check who can buy this domain.')]
|
|
553
546
|
.filter(Boolean).join(' · '),
|
|
554
547
|
}));
|
|
555
548
|
const sameExact = alternatives?.domains.some(row => row.domain === query.exactDomain && row.status === 'taken');
|
|
556
549
|
return { name: query.exactDomain ?? query.name, exact: query.exactDomain, domains, pick, cap: check.choice?.capUsd ?? alternatives?.choice?.capUsd,
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
checks: hostedNameChecks(nameChecks, pending, query.name),
|
|
550
|
+
answer: domainAnswer(check), apps: appNameLines(check, pending).map(paragraph).join(''),
|
|
551
|
+
warning: hostedWarning(check, pending), checks: hostedNameChecks(nameChecks, pending),
|
|
560
552
|
score: scoreText({ score }), reasons: score?.reasons, priceDate: alternatives?.priceSnapshot?.checkedAt ?? check.priceSnapshot?.checkedAt ?? snapshot,
|
|
561
553
|
share: (sameExact && publicShare(alternatives.share?.url)) || publicShare(check.share?.url), complete: alternatives?.complete ?? check.complete, alternativesFailed: alternatives === null };
|
|
562
554
|
}
|
|
@@ -716,7 +708,7 @@ export function resultPages({ env = process.env,
|
|
|
716
708
|
const catalog = local && groups.length ? await loadCachedCatalog().catch(() => null) : null;
|
|
717
709
|
const shown = [...visibleChecks(data.checks ?? [], args, data.generation)];
|
|
718
710
|
if (data.generation?.stage === 'final') shown.sort((a, b) => (b.score?.value ?? -1) - (a.score?.value ?? -1));
|
|
719
|
-
const hiddenWarnings = (data.checks ?? []).filter(check => !shown.includes(check)).map(hostedWarning).join('');
|
|
711
|
+
const hiddenWarnings = (data.checks ?? []).filter(check => !shown.includes(check) && usTrademark(check)?.status === 'exact_match_found').map(check => hostedWarning(check)).join('');
|
|
720
712
|
const cards = data.hosted ? shown.map(check => hostedCard(check, data.pending, args, data.generation?.priceSnapshot?.checkedAt))
|
|
721
713
|
: groups.map((group, index) => localCard(group, data.pending ? null : selection.names[index].pick, data, args, catalog));
|
|
722
714
|
const page = render(groups, local ? [localCheckNotice, ...lines] : lines, at, data.sources, watch ? data : null, args.companyType,
|
package/server.json
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
"title": "Domain Hound: Domains for agents",
|
|
5
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.13",
|
|
8
8
|
"packages": [
|
|
9
9
|
{
|
|
10
10
|
"registryType": "npm",
|
|
11
11
|
"identifier": "domain-hound",
|
|
12
|
-
"version": "0.1.
|
|
12
|
+
"version": "0.1.13",
|
|
13
13
|
"transport": {
|
|
14
14
|
"type": "stdio"
|
|
15
15
|
}
|
package/server.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import { callPurchaseTool, purchaseToolNames, registeredTools, quoteOfferLine, w
|
|
|
15
15
|
import { candidateFields, compactScore, compareScores, scoreEligible, scoreHandles, scoreName, validCandidate } from './clis/domain-check/name-score.mjs';
|
|
16
16
|
import { scoreLogger } from './clis/domain-check/score-log.mjs';
|
|
17
17
|
import { HostedRateLimit, hostedClient, hostedDebug } from './hosted.mjs';
|
|
18
|
-
import { generatedChecks, hostedChecks, hostedResult } from './hosted-results.mjs';
|
|
18
|
+
import { generatedChecks, hostedChecks, hostedIntroLines, hostedResult } from './hosted-results.mjs';
|
|
19
19
|
|
|
20
20
|
// The capability ships inside the package; tests inject another directory through serve({ cwd }).
|
|
21
21
|
export const capabilityDir = fileURLToPath(new URL('./clis/domain-check/', import.meta.url));
|
|
@@ -27,6 +27,7 @@ const timeoutMs = 14_000;
|
|
|
27
27
|
// A lookup still running after this long is stopped.
|
|
28
28
|
const maxLookupMs = 120_000;
|
|
29
29
|
const hostedLookupMs = 34_000;
|
|
30
|
+
const hostedFirstAnswerMs = 4_000;
|
|
30
31
|
// Keep completed evidence stable for repeated calls during a short naming session.
|
|
31
32
|
const keepFinishedMs = 120_000;
|
|
32
33
|
const versions = ['2025-11-25', '2025-06-18', '2025-03-26', '2024-11-05'];
|
|
@@ -73,7 +74,7 @@ const checkTool = {
|
|
|
73
74
|
description: 'Use this when checking whether a name or exact domain is available, what an ending such as .ai costs, or where to register. '
|
|
74
75
|
+ 'Use query for one exact domain or bare name ({"query":"lanternbay.dev"}), or names for a batch ({"names":["lanternbay.dev","lanternbay"]}). '
|
|
75
76
|
+ 'Use purchase: true to start a purchase and confirm: true only for an explicit live shop check. '
|
|
76
|
-
+ '
|
|
77
|
+
+ 'The hosted check returns domains and prices, followed by app names and exact US trademark matches. Repeat to collect pending checks. Use triage_names for name ideas and quote_domain for a live Spaceship purchase quote.',
|
|
77
78
|
annotations: { title: 'Check domain availability and prices', ...searchAnnotations },
|
|
78
79
|
_meta: batchResultMeta,
|
|
79
80
|
inputSchema: {
|
|
@@ -202,7 +203,12 @@ function compactCheckResult(result) {
|
|
|
202
203
|
const date = checks?.[0]?.priceSnapshot?.checkedAt?.slice(0, 10) ?? priceListDate;
|
|
203
204
|
// Keep the rich single-name answer when it fits. In a batch, the short price line shows the
|
|
204
205
|
// best listed offer for every available ending, with the payment term made explicit.
|
|
205
|
-
const
|
|
206
|
+
const pageLink = resultsLine(resultPage);
|
|
207
|
+
const intro = checks?.[0] && hostedIntroLines(checks[0], pending);
|
|
208
|
+
const pageAndIntro = intro && [pageLink, ...intro].join('\n') + '\n';
|
|
209
|
+
const withStatuses = pageAndIntro && display.startsWith(pageAndIntro)
|
|
210
|
+
? [...intro, pageLink, ...statusLines, display.slice(pageAndIntro.length)].join('\n')
|
|
211
|
+
: display.replace(pageLink, [pageLink, ...statusLines].join('\n'));
|
|
206
212
|
const fits = value => {
|
|
207
213
|
const wire = JSON.stringify({ content: [{ type: 'text', text: value }], structuredContent, isError: false });
|
|
208
214
|
return rows.length <= 1 ? Buffer.byteLength(wire) < 8_000 : wire.length < 40_000;
|
|
@@ -236,11 +242,12 @@ function compactCheckResult(result) {
|
|
|
236
242
|
];
|
|
237
243
|
const highlights = display.split('\n')
|
|
238
244
|
.filter(line => /^(?:US trademark warning for |The Hound’s pick is |Cheapest: |Best value: )/.test(line)).slice(0, 8);
|
|
245
|
+
const intro = checks?.flatMap(check => hostedIntroLines(check, pending, 1, false)) ?? [];
|
|
239
246
|
const priceHeader = 'USD before tax, upfront/renewal per term, list prices' + (date ? ' from ' + date : '') + ' unless marked confirmed.';
|
|
240
247
|
const render = (offerLimit, highlights) => {
|
|
241
248
|
const priceLines = prices.filter(({ list }) => list.length).map(({ name, list }) => name + ' · ' + list.slice(0, offerLimit).join(', '));
|
|
242
|
-
return attributed([...lead, ...statusLines, '', ...(priceLines.length ? [priceHeader, ...priceLines, ''] : []),
|
|
243
|
-
...highlights, ...notes].join('\n'), purchase);
|
|
249
|
+
return attributed([...intro, ...lead, ...statusLines, '', ...(priceLines.length ? [priceHeader, ...priceLines, ''] : []),
|
|
250
|
+
...(checks ? [] : highlights), ...notes].join('\n'), purchase);
|
|
244
251
|
};
|
|
245
252
|
text = render(Infinity, highlights);
|
|
246
253
|
if (!fits(text)) text = render(Infinity, []);
|
|
@@ -663,30 +670,34 @@ export async function serve({
|
|
|
663
670
|
}
|
|
664
671
|
const key = JSON.stringify([triage, streamDomains, Object.entries(args).sort(([a], [b]) => a.localeCompare(b))]);
|
|
665
672
|
let lookup = hostedLookups.get(key);
|
|
673
|
+
const repeat = Boolean(lookup);
|
|
666
674
|
if (!lookup) {
|
|
667
675
|
const extra = selectedEndings(args).filter(ending => !defaultEndings.includes(ending));
|
|
668
676
|
const controller = new AbortController();
|
|
669
677
|
const signal = AbortSignal.any([controller.signal, hostedShutdown.signal, AbortSignal.timeout(hostedLookupMs)]);
|
|
670
678
|
const job = { result: null, first: null };
|
|
671
679
|
const early = new Array(rows.length);
|
|
680
|
+
const appChecks = [];
|
|
672
681
|
let received = 0;
|
|
682
|
+
let canStream = false;
|
|
673
683
|
let ready;
|
|
674
684
|
job.ready = new Promise(resolve => { ready = resolve; });
|
|
675
|
-
const receive = (answer, index, qualifies = false) => {
|
|
685
|
+
const receive = (answer, index, qualifies = false, apple) => {
|
|
676
686
|
if (!streamDomains || early[index]) return;
|
|
677
687
|
early[index] = answer;
|
|
688
|
+
if (apple) appChecks.push(apple.then(appStore => { if (appStore) early[index] = { ...answer, appStore }; }));
|
|
678
689
|
received += 1;
|
|
679
|
-
if (qualifies)
|
|
680
|
-
if (received === rows.length &&
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
690
|
+
if (qualifies) canStream = true;
|
|
691
|
+
if (received === rows.length && canStream) {
|
|
692
|
+
// Keep the domain answer available at the deadline, even while Apple's retry runs in the background.
|
|
693
|
+
job.first = within({ done: Promise.all(appChecks) }, Math.min(timeout, hostedFirstAnswerMs) - (performance.now() - started))
|
|
694
|
+
.then(() => renderHostedLookup([...early], args, triage, { pending: true }));
|
|
695
|
+
ready();
|
|
685
696
|
}
|
|
686
697
|
};
|
|
687
698
|
job.done = Promise.all(rows.map(async ({ name }, index) => {
|
|
688
699
|
const answer = await hosted.check(name, name.includes('.') ? [] : extra, signal,
|
|
689
|
-
streamDomains ? value => receive(value, index, true) : undefined);
|
|
700
|
+
streamDomains ? (value, apple) => receive(value, index, true, apple) : undefined);
|
|
690
701
|
receive(answer, index);
|
|
691
702
|
return answer;
|
|
692
703
|
})).then(async answers => {
|
|
@@ -705,13 +716,14 @@ export async function serve({
|
|
|
705
716
|
lookup = job;
|
|
706
717
|
hostedLookups.set(key, job);
|
|
707
718
|
}
|
|
708
|
-
const ready =
|
|
719
|
+
const ready = repeat ? lookup.done : lookup.ready;
|
|
709
720
|
if (!await within({ done: ready }, timeout - (performance.now() - started))) {
|
|
721
|
+
if (lookup.first) return lookup.first;
|
|
710
722
|
hostedDebug('Hosted check exceeded the tool response budget; it is still running.');
|
|
711
723
|
return toolResult(JSON.stringify({ display: attributed('The hosted check is still running. Call the same tool again with the same input to collect it.'),
|
|
712
724
|
complete: false, pending: true }));
|
|
713
725
|
}
|
|
714
|
-
return lookup.finished ? lookup.result :
|
|
726
|
+
return lookup.finished ? lookup.result : lookup.first;
|
|
715
727
|
}
|
|
716
728
|
|
|
717
729
|
async function renderHostedLookup(checks, args, triage, { pending = false, reuse } = {}) {
|