@vercel/agent-readability 0.2.1 → 0.3.1
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/README.md +7 -2
- package/dist/cli/index.cjs +83 -83
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skill/SKILL.md +4 -3
package/README.md
CHANGED
|
@@ -95,7 +95,8 @@ const { serve, reason } = shouldServeMarkdown(request)
|
|
|
95
95
|
### `generateNotFoundMarkdown(path, options?)`
|
|
96
96
|
|
|
97
97
|
Generates a markdown body for missing pages. Return this with a 200 status
|
|
98
|
-
(not 404)
|
|
98
|
+
(not 404) for agent or `Accept: text/markdown` requests on the canonical URL
|
|
99
|
+
because agents discard 404 response bodies.
|
|
99
100
|
|
|
100
101
|
```ts
|
|
101
102
|
import { generateNotFoundMarkdown } from '@vercel/agent-readability'
|
|
@@ -105,10 +106,14 @@ const md = generateNotFoundMarkdown('/docs/missing', {
|
|
|
105
106
|
})
|
|
106
107
|
// Return as 200 so agents read the body
|
|
107
108
|
return new Response(md, {
|
|
108
|
-
headers: { 'Content-Type': 'text/markdown' },
|
|
109
|
+
headers: { 'Content-Type': 'text/markdown', 'Vary': 'Accept' },
|
|
109
110
|
})
|
|
110
111
|
```
|
|
111
112
|
|
|
113
|
+
Keep suggested page links canonical (`/docs/page`) and negotiate markdown with
|
|
114
|
+
`Accept: text/markdown` rather than exposing `.md` page URLs in not-found
|
|
115
|
+
responses.
|
|
116
|
+
|
|
112
117
|
### Pattern Exports
|
|
113
118
|
|
|
114
119
|
`AI_AGENT_UA_PATTERNS`, `TRADITIONAL_BOT_PATTERNS`, `SIGNATURE_AGENT_DOMAINS`,
|