domain-hound 0.1.12 → 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.
@@ -4,7 +4,7 @@
4
4
  "plugins": [
5
5
  {
6
6
  "name": "domain-hound",
7
- "version": "0.1.12",
7
+ "version": "0.1.13",
8
8
  "source": { "source": "local", "path": "./" },
9
9
  "policy": { "installation": "AVAILABLE", "authentication": "ON_INSTALL" },
10
10
  "category": "Productivity"
@@ -5,7 +5,7 @@
5
5
  "plugins": [
6
6
  {
7
7
  "name": "domain-hound",
8
- "version": "0.1.12",
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.12",
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/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' || app.reason !== 'rate-limited') return app;
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: AbortSignal.any([signal, AbortSignal.timeout(2800)]), fetcher: fetchFn })
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,30 +210,35 @@ 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
- let nameChecks = null;
211
- if (typeof details?.id === 'string') {
212
- onDomains?.(answer);
213
- nameChecks = await read('/v1/check/details', {
214
- params: { id: details.id }, timeout: 5300, signal: AbortSignal.any([signal, AbortSignal.timeout(5700)]), valid: validDetails,
215
- }, true).catch(() => null);
216
- } else {
217
- hostedDebug('/v1/check did not provide a name-check token', env);
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
- const definite = row => row && !['pending', 'unknown'].includes(row.status);
221
- if (definite(answer.appStore)) nameChecks.appStore = answer.appStore;
222
236
  if (definite(answer.googlePlay)) nameChecks.googlePlay = answer.googlePlay;
223
- const recovered = await Promise.allSettled([
224
- recoverApple(nameChecks.appStore, main.query.name, signal).then(app => { nameChecks.appStore = app; }),
225
- recoverNameChecks([{ name: main.query.name, nameChecks }], signal),
226
- ]);
227
- for (const [index, result] of recovered.entries()) {
228
- if (result.status === 'rejected') hostedDebug('Optional ' + (index ? 'handle' : 'App Store') + ' recovery failed', env);
229
- }
237
+ await recoverNameChecks([{ name: main.query.name, nameChecks }], signal)
238
+ .catch(() => hostedDebug('Optional handle recovery failed', env));
230
239
  }
231
- const best = (first, next) => first && !['unknown', 'pending'].includes(first.status) ? first
232
- : next ?? (first?.status === 'pending' ? { ...first, status: 'unknown' } : first);
233
- const appStore = best(answer.appStore, nameChecks?.appStore);
240
+ const appStore = await appCheck;
241
+ if (nameChecks && appStore) nameChecks.appStore = appStore;
234
242
  const googlePlay = best(answer.googlePlay, nameChecks?.googlePlay);
235
243
  const mark = best(answer.trademarks?.us, nameChecks?.trademarks?.us);
236
244
  return { ...answer, ...(needsAlternatives && { [alternativeEndings]: await alternatives }), nameChecks,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domain-hound",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Domains for agents. One MCP for everything domains: find, check, buy, set up, watch, move, renew, keep track.",
5
5
  "license": "MIT",
6
6
  "type": "module",
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.12",
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/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.12",
7
+ "version": "0.1.13",
8
8
  "packages": [
9
9
  {
10
10
  "registryType": "npm",
11
11
  "identifier": "domain-hound",
12
- "version": "0.1.12",
12
+ "version": "0.1.13",
13
13
  "transport": {
14
14
  "type": "stdio"
15
15
  }
package/server.mjs CHANGED
@@ -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'];
@@ -669,30 +670,34 @@ export async function serve({
669
670
  }
670
671
  const key = JSON.stringify([triage, streamDomains, Object.entries(args).sort(([a], [b]) => a.localeCompare(b))]);
671
672
  let lookup = hostedLookups.get(key);
673
+ const repeat = Boolean(lookup);
672
674
  if (!lookup) {
673
675
  const extra = selectedEndings(args).filter(ending => !defaultEndings.includes(ending));
674
676
  const controller = new AbortController();
675
677
  const signal = AbortSignal.any([controller.signal, hostedShutdown.signal, AbortSignal.timeout(hostedLookupMs)]);
676
678
  const job = { result: null, first: null };
677
679
  const early = new Array(rows.length);
680
+ const appChecks = [];
678
681
  let received = 0;
682
+ let canStream = false;
679
683
  let ready;
680
684
  job.ready = new Promise(resolve => { ready = resolve; });
681
- const receive = (answer, index, qualifies = false) => {
685
+ const receive = (answer, index, qualifies = false, apple) => {
682
686
  if (!streamDomains || early[index]) return;
683
687
  early[index] = answer;
688
+ if (apple) appChecks.push(apple.then(appStore => { if (appStore) early[index] = { ...answer, appStore }; }));
684
689
  received += 1;
685
- if (qualifies) job.hasDetails = true;
686
- if (received === rows.length && job.hasDetails) {
687
- job.first = renderHostedLookup(early, args, triage, { pending: true }).then(result => {
688
- ready(result);
689
- return result;
690
- });
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();
691
696
  }
692
697
  };
693
698
  job.done = Promise.all(rows.map(async ({ name }, index) => {
694
699
  const answer = await hosted.check(name, name.includes('.') ? [] : extra, signal,
695
- streamDomains ? value => receive(value, index, true) : undefined);
700
+ streamDomains ? (value, apple) => receive(value, index, true, apple) : undefined);
696
701
  receive(answer, index);
697
702
  return answer;
698
703
  })).then(async answers => {
@@ -711,13 +716,14 @@ export async function serve({
711
716
  lookup = job;
712
717
  hostedLookups.set(key, job);
713
718
  }
714
- const ready = lookup.finished ? lookup.done : lookup.ready;
719
+ const ready = repeat ? lookup.done : lookup.ready;
715
720
  if (!await within({ done: ready }, timeout - (performance.now() - started))) {
721
+ if (lookup.first) return lookup.first;
716
722
  hostedDebug('Hosted check exceeded the tool response budget; it is still running.');
717
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.'),
718
724
  complete: false, pending: true }));
719
725
  }
720
- return lookup.finished ? lookup.result : ready;
726
+ return lookup.finished ? lookup.result : lookup.first;
721
727
  }
722
728
 
723
729
  async function renderHostedLookup(checks, args, triage, { pending = false, reuse } = {}) {