domain-hound 0.1.12 → 0.1.14

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.14",
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.14",
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.14",
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/assets/icon.svg CHANGED
@@ -1,7 +1,7 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120">
2
2
  <title>Snarl</title>
3
- <path fill="#f4c64f" stroke="#05070d" stroke-width="4" stroke-linejoin="round" d="M5 79Q8 62 13 44Q15 29 29 23Q42 13 58 16L71 19L79 18L84 24L79 26L86 32L95 33L101 37L112 37Q118 38 117 46L112 56L103 58L97 67L87 61L77 59L66 64L76 70L86 76L99 77L105 71L105 82Q101 91 91 92Q80 93 69 86L55 75L49 74Q43 89 30 97Q20 105 13 102Q6 100 7 89Z"/>
4
- <g fill="#05070d">
3
+ <path fill="#9fdcb6" stroke="#0f2e24" stroke-width="4" stroke-linejoin="round" d="M5 79Q8 62 13 44Q15 29 29 23Q42 13 58 16L71 19L79 18L84 24L79 26L86 32L95 33L101 37L112 37Q118 38 117 46L112 56L103 58L97 67L87 61L77 59L66 64L76 70L86 76L99 77L105 71L105 82Q101 91 91 92Q80 93 69 86L55 75L49 74Q43 89 30 97Q20 105 13 102Q6 100 7 89Z"/>
4
+ <g fill="#0f2e24">
5
5
  <path d="M8 87Q13 67 21 48Q27 32 39 28Q30 37 26 53Q20 74 8 94Z"/>
6
6
  <path d="M18 99Q30 90 36 72Q41 56 39 43Q48 50 44 67Q40 88 25 98Z"/>
7
7
  <path d="M45 23Q56 18 71 23L59 23L52 26Z"/>
@@ -10,5 +10,5 @@
10
10
  <path d="M98 45L104 40L116 40Q118 45 111 52L102 53Z"/>
11
11
  <path d="M46 59Q53 61 59 57L71 50Q79 45 88 48L97 53L108 53L103 58L98 62L88 57Q78 51 73 56L65 62L63 67L76 75Q84 82 97 80Q88 88 77 82L61 70Z"/>
12
12
  </g>
13
- <path fill="#f4c64f" d="M59 40L71 36L67 41L62 42ZM77 54L84 54L80 62ZM87 55L97 58L89 72L89 64ZM99 58L104 56L100 64Z"/>
13
+ <path fill="#9fdcb6" d="M59 40L71 36L67 41L62 42ZM77 54L84 54L80 62ZM87 55L97 58L89 72L89 64ZM99 58L104 56L100 64Z"/>
14
14
  </svg>
@@ -1,16 +1,21 @@
1
- /* Result styles vendored from lars-hv/domainhound-site at
2
- 2eee4e38864ad0870cfe317c5b5ca6307fd44bd4. Keep these excerpts in site order. */
1
+ /* Saved result styles from lars-hv/domainhound-site at
2
+ 1c35a8258e5d7fd94c951afcb775baf473126a5e (palette.css, site.css, brand-b.css and search.css). */
3
3
  :root {
4
4
  color-scheme: light;
5
- --ink: #100e08;
6
- --cream: #fff7de;
7
- --gold: #f4c64f;
5
+ --pine: #0f2e24;
6
+ --forest: #194e3b;
7
+ --leaf: #9fdcb6;
8
+ --mint: #cdebd6;
9
+ --mist: #eef7f0;
10
+ --paper: #f8fbf7;
11
+ --amber: #ead29d;
12
+ --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
8
13
  --gutter: clamp(18px, 4.5vw, 64px);
9
- --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
14
+ --body-size: 1.0625rem;
10
15
  }
11
16
  *, *::after, *::before { box-sizing: border-box; }
12
17
  [hidden] { display: none !important; }
13
- body { margin: 0; color: var(--ink); background: var(--cream); font: 600 1rem/1.45 Mulish, Arial, sans-serif; }
18
+ body { margin: 0; color: var(--pine); background: var(--paper); font: 600 1rem/1.45 Mulish, Arial, sans-serif; }
14
19
  h1, h2, h3, p, dl, dd, ul { margin: 0; }
15
20
  h1, h2, h3, .number, .result > strong { font-weight: 1000; line-height: .99; letter-spacing: -.04em; }
16
21
  h2 { font-size: clamp(2.5rem, 5.4vw, 5.8rem); }
@@ -28,25 +33,20 @@ button { cursor: pointer; }
28
33
  .brand { gap: 8px; min-height: 44px; font-weight: 1000; text-decoration: none; }
29
34
  .action { display: inline-block; min-height: 44px; padding: 9px 21px; font-weight: 950; font-size: .98rem; line-height: 1.3; }
30
35
  .action:hover { text-decoration: underline; text-underline-offset: .18em; }
31
- :root {
32
- --blue: #102385;
33
- --ink: var(--blue);
34
- --lime: #cdf473;
35
- --coral: #ffab91;
36
- --body-size: 1.0625rem;
37
- }
38
36
  body { font-size: var(--body-size); line-height: 1.5; }
39
- .mast, .hero, .trust, footer { background: var(--blue); color: var(--cream); }
37
+ .mast, footer { background: var(--forest); color: var(--paper); }
40
38
  .mast .brand { font: 700 .9rem var(--mono); }
41
39
  .mast-inner { min-height: 52px; }
42
40
  .mast nav a, .foot a { font-size: .9375rem; }
43
41
  .action {
44
- background: var(--lime); color: var(--blue); border: 2px solid var(--blue);
42
+ background: var(--leaf); color: var(--pine); border: 2px solid var(--pine);
45
43
  border-radius: 999px; font-size: var(--body-size); line-height: 1.45;
46
44
  }
47
45
  .hunt-results {
48
- background: var(--cream);
49
- color: var(--blue);
46
+ --blue: var(--pine);
47
+ --cream: var(--paper);
48
+ background: var(--mist);
49
+ color: var(--pine);
50
50
  padding-block: clamp(26px, 4vw, 56px);
51
51
  }
52
52
  .hunt-results h2 { font-size: clamp(2rem, 4vw, 3.5rem); }
@@ -64,7 +64,6 @@ body { font-size: var(--body-size); line-height: 1.5; }
64
64
  .results-head { margin-bottom: 12px; }
65
65
  .results-head:has(.requested-actions) { justify-content: flex-start; align-items: baseline; }
66
66
  .hunt-card > .alternatives-title { display: block; margin: 16px 0 8px; }
67
- .alternatives-title + .trademark-slot:not(:empty) { margin-bottom: 8px; }
68
67
  .hunt-list { margin: 16px 0 0; list-style: none; padding: 0; display: grid; gap: 22px; }
69
68
  .hunt-card + .hunt-card { margin-top: 24px; }
70
69
  .hunt-list .hunt-card { border-top: 2px solid; padding-top: 12px; }
@@ -72,44 +71,44 @@ body { font-size: var(--body-size); line-height: 1.5; }
72
71
  .name-score, .offer-count, .detail-checks h5 { font: 750 .82rem/1.5 var(--mono); }
73
72
  .name-score { white-space: nowrap; }
74
73
  .offer-count { margin: 12px 0 6px; }
75
- .trademark-warning { border-left: 4px solid; background: var(--coral); padding: 12px 16px; }
74
+ .trademark-warning { border-left: 4px solid; background: var(--amber); padding: 12px 16px; }
76
75
  .trademark-warning strong { font-size: 1.15rem; }
77
76
  .trademark-warning p, .trademark-pending { font-size: .93rem; }
78
77
  .trademark-pending { border-left: 2px solid; padding-left: 10px; }
79
- .primary-checks { width: 100%; margin: 12px 0; font-size: .93rem; }
80
- .primary-checks > p { padding: 4px 0; border-top: 1px solid #10238540; }
78
+ .primary-checks:not(:empty) { margin: 12px 0; }
81
79
  .ending-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 2px; background: var(--blue); }
82
80
  .offer-row, .detail-checks { min-width: 0; background: var(--cream); padding: 15px 16px 0; }
83
81
  .offer-row { display: flex; flex-direction: column; align-items: flex-start; }
84
82
  .offer-head { width: 100%; display: flex; align-items: baseline; justify-content: space-between; gap: 4px 10px; flex-wrap: wrap; }
85
83
  .domain-title { margin: 0; font: 750 clamp(1.1rem, 1.75vw, 1.42rem)/1.2 var(--mono); letter-spacing: -.05em; }
86
- .verdict, .lowest { background: var(--lime); padding: 1px 5px; font-weight: 850; }
84
+ .verdict, .lowest { background: var(--leaf); padding: 1px 5px; font-weight: 850; }
85
+ .lowest { background: var(--mint); }
87
86
  .verdict { font-size: .75rem; }
88
87
  .pick-label { margin-top: 3px; font-size: .8rem; }
89
88
  .first-price { margin-top: 10px; }
90
89
  .first-price strong { font: 950 1.75rem/1 Mulish, sans-serif; letter-spacing: -.055em; }
91
90
  .first-price, .renewal, .three-year, .taken-group, .suggestion-foot { font-size: .91rem; }
92
91
  .offer-row > .action { padding: 5px 14px; min-height: 34px; margin-top: 10px; text-decoration: none; background: transparent; font-size: .9rem; }
93
- .offer-row > .action:hover { background: var(--lime); }
92
+ .offer-row > .action:hover { background: var(--leaf); }
94
93
  .offer-condition, .renewal-warning { margin: 5px 0; font-size: .82rem; }
95
94
  .shop-table { width: 100%; margin: 12px 0 4px; border-collapse: collapse; font-size: .83rem; line-height: 1.3; font-variant-numeric: tabular-nums; }
96
- .shop-table td, .shop-table th { text-align: right; padding: 6px 0 6px 4px; border-top: 1px solid #10238540; }
95
+ .shop-table td, .shop-table th { text-align: right; padding: 6px 0 6px 4px; border-top: 1px solid var(--mint); }
97
96
  .shop-table thead th { border-top: 1px solid; font-weight: 800; }
98
97
  .shop-table th:first-child { text-align: left; padding-left: 0; }
99
98
  .shop-table tbody small { display: block; width: fit-content; margin-top: 2px; font-size: .7rem; font-weight: 650; }
100
99
  .shop-table tbody small.lowest { font-weight: 850; }
101
- .renewal-warning { border-left: 2px solid var(--coral); padding-left: 8px; }
100
+ .renewal-warning { border-left: 2px solid var(--amber); padding-left: 8px; }
102
101
  .checks-toggle, .more-shops { color: inherit; background: none; border: 0; cursor: pointer; font: 850 .9rem/1.4 Mulish, sans-serif; }
103
102
  .checks-toggle { width: 100%; min-height: 44px; margin-top: auto; padding: 8px 0; text-align: left; border-top: 1px solid; }
104
103
  .checks-toggle::after { content: '+'; float: right; }
105
104
  .checks-toggle[aria-expanded=true]::after { content: '−'; }
106
105
  .more-shops { padding: 5px 0; text-decoration: underline; }
107
- .detail-checks { border: 2px solid var(--blue); border-top: 0; padding-bottom: 15px; }
106
+ .detail-checks { border: 2px solid var(--pine); border-top: 0; padding-bottom: 15px; }
108
107
  .detail-checks h4 { font-size: 1.12rem; margin: 0 0 8px; }
109
108
  .detail-checks h5 { margin: 0 0 5px; }
110
109
  .check-grid, .handle-list { display: grid; gap: 10px; }
111
110
  .handle-list { gap: 0; }
112
- .check-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid #10238540; font-size: .88rem; }
111
+ .check-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--mint); font-size: .88rem; }
113
112
  .check-line a { text-align: right; font-weight: 650; }
114
113
  .mark-result:not(:empty) { margin-top: 8px; font-weight: 800; font-size: .9rem; }
115
114
  .taken-group { margin-top: 14px; }
@@ -121,7 +120,7 @@ body { font-size: var(--body-size); line-height: 1.5; }
121
120
  .refine, .recovery:not([hidden]) { margin-top: 20px; }
122
121
  .recovery > h3 { font-size: 1.6rem; }
123
122
  .result-sharing { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 20px; }
124
- .result-sharing:has(a), .result-sharing:has(.quote-caption:not(:empty)) { margin-top: 16px; padding-top: 10px; border-top: 1px solid #10238540; }
123
+ .result-sharing:has(a), .result-sharing:has(.quote-caption:not(:empty)) { margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--mint); }
125
124
  .quote-caption, .result-sharing a { font-size: .8rem; }
126
125
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
127
126
  @media (min-width: 760px) {
@@ -135,7 +134,7 @@ body { font-size: var(--body-size); line-height: 1.5; }
135
134
  #result-pages > .hunt-card .check-grid { grid-template-columns: 1fr 2fr; gap: 28px; }
136
135
  #result-pages > .hunt-card .handle-list { grid-template-columns: repeat(2, minmax(0,1fr)); column-gap: 20px; }
137
136
  .ending-list { background: transparent; padding: 0; gap: 0; }
138
- .ending-list > * { border: 1px solid var(--blue); }
137
+ .ending-list > * { border: 1px solid var(--pine); }
139
138
  }
140
139
  /* Standalone receipts have one checks panel per name and native disclosure controls. */
141
140
  .hunt-results h1 { margin: 0; max-width: none; font-size: clamp(2rem, 4vw, 3.5rem); }
@@ -165,12 +164,14 @@ body { font-size: var(--body-size); line-height: 1.5; }
165
164
  .result-sharing { margin-block: 12px; }
166
165
  #result-pages > .hunt-card { margin-top: 12px; }
167
166
  footer { padding-block: 14px; font-size: .85rem; }
167
+ .primary-checks { width: 100%; font-size: .93rem; }
168
+ .primary-checks > p { padding-block: 4px; border-top: 1px solid var(--mint); }
169
+
168
170
  @media (prefers-color-scheme: dark) {
169
- :root { color-scheme: dark; --cream: #18203b; --blue: #f3edda; --ink: var(--blue); }
170
- .mast, footer { background: #101630; color: var(--blue); }
171
- .trademark-warning { background: #522f3a; border-color: var(--coral); }
172
- .verdict, .lowest, .offer-row > .action:hover { color: #102385; }
173
- .offer-row > .action { color: var(--blue); }
174
- .offer-row > .action:hover { color: #102385; }
175
- .shop-table td, .shop-table th, .result-sharing, .check-line { border-top-color: #838ca7; }
171
+ :root { color-scheme: dark; }
172
+ body, .hunt-results { background: var(--pine); color: var(--paper); }
173
+ .hunt-results { --blue: var(--leaf); --cream: var(--forest); }
174
+ .verdict, .lowest, .trademark-warning, .offer-row > .action:hover { color: var(--pine); }
175
+ .offer-row > .action { color: var(--paper); border-color: var(--leaf); }
176
+ .ending-list > .offer-row, .detail-checks { border-color: var(--leaf); }
176
177
  }
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.14",
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.14",
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.14",
8
8
  "packages": [
9
9
  {
10
10
  "registryType": "npm",
11
11
  "identifier": "domain-hound",
12
- "version": "0.1.12",
12
+ "version": "0.1.14",
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 } = {}) {