@vercel/geistdocs 1.25.1 → 1.26.0
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/cli.js +8 -0
- package/dist/cli/index.js +6 -2
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/internal/chat-retrieval.d.ts +32 -0
- package/dist/internal/chat-retrieval.d.ts.map +1 -0
- package/dist/internal/chat-retrieval.js +91 -0
- package/dist/internal/mixedbread.d.ts +93 -0
- package/dist/internal/mixedbread.d.ts.map +1 -0
- package/dist/internal/mixedbread.js +286 -0
- package/dist/internal/navbar/navbar-logo.js +1 -1
- package/dist/internal/page-actions-client.d.ts.map +1 -1
- package/dist/internal/page-actions-client.js +1 -19
- package/dist/internal/search-export.d.ts +18 -0
- package/dist/internal/search-export.d.ts.map +1 -0
- package/dist/internal/search-export.js +1 -0
- package/dist/internal/search-sync.d.ts +25 -0
- package/dist/internal/search-sync.d.ts.map +1 -0
- package/dist/internal/search-sync.js +312 -0
- package/dist/internal/sidebar-tree.d.ts.map +1 -1
- package/dist/internal/sidebar-tree.js +9 -7
- package/dist/internal/sidebar.js +2 -2
- package/dist/routes/chat.d.ts +8 -2
- package/dist/routes/chat.d.ts.map +1 -1
- package/dist/routes/chat.js +53 -15
- package/dist/routes/search-export.d.ts +12 -0
- package/dist/routes/search-export.d.ts.map +1 -0
- package/dist/routes/search-export.js +44 -0
- package/docs/agents.md +4 -3
- package/docs/llms.txt +384 -33
- package/docs/manifest.json +12 -3
- package/docs/pages/ask-ai.md +3 -0
- package/docs/pages/configuration.md +5 -2
- package/docs/pages/deployment.md +30 -5
- package/docs/pages/env.md +13 -3
- package/docs/pages/getting-started.md +29 -9
- package/docs/pages/index.md +3 -2
- package/docs/pages/md.md +1 -1
- package/docs/pages/migration.md +148 -8
- package/docs/pages/mixedbread-retrieval.md +144 -0
- package/docs/sitemap.md +3 -2
- package/package.json +12 -6
- package/template/.env.example +19 -0
- package/template/AGENTS.md +17 -3
- package/template/app/api/search/export/route.ts +8 -0
- package/template/content/docs/ask-ai.mdx +3 -0
- package/template/content/docs/configuration.mdx +5 -2
- package/template/content/docs/deployment.mdx +31 -6
- package/template/content/docs/env.mdx +14 -4
- package/template/content/docs/getting-started.mdx +30 -10
- package/template/content/docs/index.mdx +3 -2
- package/template/content/docs/md.mdx +1 -1
- package/template/content/docs/meta.json +1 -0
- package/template/content/docs/migration.mdx +150 -9
- package/template/content/docs/mixedbread-retrieval.mdx +142 -0
- package/template/geistdocs.tsx +12 -1
- package/template/lib/geistdocs/config.tsx +2 -5
- package/template/package.json +3 -3
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
const DEFAULT_API_BASE_URL = "https://api.mixedbread.com/v1";
|
|
2
|
+
const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
|
|
3
|
+
const DEFAULT_MAX_RETRIES = 2;
|
|
4
|
+
const DEFAULT_RETRY_DELAY_MS = 250;
|
|
5
|
+
const MAX_RETRY_DELAY_MS = 30_000;
|
|
6
|
+
const MILLISECONDS_PER_SECOND = 1000;
|
|
7
|
+
const TRAILING_SLASH_PATTERN = /\/$/;
|
|
8
|
+
export const GEISTDOCS_MIXEDBREAD_SCHEMA_VERSION = 1;
|
|
9
|
+
export const mixedbreadMetadataKeys = {
|
|
10
|
+
contentHash: "geistdocs_content_hash",
|
|
11
|
+
description: "geistdocs_description",
|
|
12
|
+
documentId: "geistdocs_document_id",
|
|
13
|
+
locale: "geistdocs_locale",
|
|
14
|
+
rawFileId: "geistdocs_raw_file_id",
|
|
15
|
+
revision: "geistdocs_revision",
|
|
16
|
+
revisionAncestors: "geistdocs_revision_ancestors",
|
|
17
|
+
revisionTimestamp: "geistdocs_revision_timestamp",
|
|
18
|
+
schemaVersion: "geistdocs_schema_version",
|
|
19
|
+
siteId: "geistdocs_site_id",
|
|
20
|
+
sourceId: "geistdocs_source_id",
|
|
21
|
+
sourceUrl: "geistdocs_source_url",
|
|
22
|
+
title: "geistdocs_title",
|
|
23
|
+
url: "geistdocs_url",
|
|
24
|
+
};
|
|
25
|
+
const isRecord = (value) => typeof value === "object" && value !== null;
|
|
26
|
+
const readString = (record, key) => {
|
|
27
|
+
const value = record[key];
|
|
28
|
+
return typeof value === "string" ? value : undefined;
|
|
29
|
+
};
|
|
30
|
+
const readStringArray = (record, key) => {
|
|
31
|
+
const value = record[key];
|
|
32
|
+
return Array.isArray(value)
|
|
33
|
+
? value.filter((entry) => typeof entry === "string")
|
|
34
|
+
: [];
|
|
35
|
+
};
|
|
36
|
+
const readNumber = (record, key) => {
|
|
37
|
+
const value = record[key];
|
|
38
|
+
return typeof value === "number" && Number.isFinite(value)
|
|
39
|
+
? value
|
|
40
|
+
: undefined;
|
|
41
|
+
};
|
|
42
|
+
export const readGeistdocsMixedbreadMetadata = (value) => {
|
|
43
|
+
if (!isRecord(value)) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const schemaVersion = value[mixedbreadMetadataKeys.schemaVersion];
|
|
47
|
+
const contentHash = readString(value, mixedbreadMetadataKeys.contentHash);
|
|
48
|
+
const description = readString(value, mixedbreadMetadataKeys.description) ?? "";
|
|
49
|
+
const documentId = readString(value, mixedbreadMetadataKeys.documentId);
|
|
50
|
+
const locale = readString(value, mixedbreadMetadataKeys.locale);
|
|
51
|
+
const rawFileId = readString(value, mixedbreadMetadataKeys.rawFileId);
|
|
52
|
+
const revision = readString(value, mixedbreadMetadataKeys.revision);
|
|
53
|
+
const revisionAncestors = readStringArray(value, mixedbreadMetadataKeys.revisionAncestors);
|
|
54
|
+
const revisionTimestamp = readNumber(value, mixedbreadMetadataKeys.revisionTimestamp);
|
|
55
|
+
const siteId = readString(value, mixedbreadMetadataKeys.siteId);
|
|
56
|
+
const sourceId = readString(value, mixedbreadMetadataKeys.sourceId);
|
|
57
|
+
const sourceUrl = readString(value, mixedbreadMetadataKeys.sourceUrl);
|
|
58
|
+
const title = readString(value, mixedbreadMetadataKeys.title);
|
|
59
|
+
const url = readString(value, mixedbreadMetadataKeys.url);
|
|
60
|
+
if (schemaVersion !== GEISTDOCS_MIXEDBREAD_SCHEMA_VERSION ||
|
|
61
|
+
!contentHash ||
|
|
62
|
+
!documentId ||
|
|
63
|
+
!locale ||
|
|
64
|
+
!siteId ||
|
|
65
|
+
!sourceId ||
|
|
66
|
+
!sourceUrl ||
|
|
67
|
+
!title ||
|
|
68
|
+
!url) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
contentHash,
|
|
73
|
+
description,
|
|
74
|
+
documentId,
|
|
75
|
+
locale,
|
|
76
|
+
rawFileId,
|
|
77
|
+
revision,
|
|
78
|
+
revisionAncestors,
|
|
79
|
+
revisionTimestamp,
|
|
80
|
+
schemaVersion,
|
|
81
|
+
siteId,
|
|
82
|
+
sourceId,
|
|
83
|
+
sourceUrl,
|
|
84
|
+
title,
|
|
85
|
+
url,
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
const isStoreFile = (value) => isRecord(value) &&
|
|
89
|
+
typeof value.id === "string" &&
|
|
90
|
+
typeof value.status === "string" &&
|
|
91
|
+
["cancelled", "completed", "failed", "in_progress", "pending"].includes(value.status);
|
|
92
|
+
const defaultSleep = (milliseconds) => new Promise((resolve) => {
|
|
93
|
+
setTimeout(resolve, milliseconds);
|
|
94
|
+
});
|
|
95
|
+
const getRetryDelay = (response, attempt) => {
|
|
96
|
+
const retryAfter = response.headers.get("retry-after");
|
|
97
|
+
if (retryAfter) {
|
|
98
|
+
const seconds = Number(retryAfter);
|
|
99
|
+
if (Number.isFinite(seconds) && seconds >= 0) {
|
|
100
|
+
return Math.min(seconds * MILLISECONDS_PER_SECOND, MAX_RETRY_DELAY_MS);
|
|
101
|
+
}
|
|
102
|
+
const retryAt = Date.parse(retryAfter);
|
|
103
|
+
if (Number.isFinite(retryAt)) {
|
|
104
|
+
return Math.min(Math.max(0, retryAt - Date.now()), MAX_RETRY_DELAY_MS);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return DEFAULT_RETRY_DELAY_MS * 2 ** attempt;
|
|
108
|
+
};
|
|
109
|
+
const shouldRetry = (status) => status === 408 || status === 409 || status === 429 || status >= 500;
|
|
110
|
+
const encodePathSegment = (value) => encodeURIComponent(value);
|
|
111
|
+
export class MixedbreadRequestError extends Error {
|
|
112
|
+
status;
|
|
113
|
+
constructor(message, status) {
|
|
114
|
+
super(message);
|
|
115
|
+
this.name = "MixedbreadRequestError";
|
|
116
|
+
this.status = status;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export const createMixedbreadClient = ({ apiBaseUrl = DEFAULT_API_BASE_URL, apiKey, fetchImpl = fetch, maxRetries = DEFAULT_MAX_RETRIES, requestTimeoutMs = DEFAULT_REQUEST_TIMEOUT_MS, sleep = defaultSleep, storeId, }) => {
|
|
120
|
+
const baseUrl = apiBaseUrl.replace(TRAILING_SLASH_PATTERN, "");
|
|
121
|
+
const encodedStoreId = encodePathSegment(storeId);
|
|
122
|
+
const requestJson = async ({ body, headers, method, path, signal, }) => {
|
|
123
|
+
for (let attempt = 0;; attempt += 1) {
|
|
124
|
+
const controller = new AbortController();
|
|
125
|
+
const abort = () => controller.abort(signal?.reason);
|
|
126
|
+
if (signal?.aborted) {
|
|
127
|
+
abort();
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
131
|
+
}
|
|
132
|
+
const timeout = setTimeout(() => {
|
|
133
|
+
controller.abort(new Error("Mixedbread request timed out"));
|
|
134
|
+
}, requestTimeoutMs);
|
|
135
|
+
try {
|
|
136
|
+
const response = await fetchImpl(`${baseUrl}${path}`, {
|
|
137
|
+
body: body?.(),
|
|
138
|
+
headers: {
|
|
139
|
+
Authorization: `Bearer ${apiKey}`,
|
|
140
|
+
...headers,
|
|
141
|
+
},
|
|
142
|
+
method,
|
|
143
|
+
signal: controller.signal,
|
|
144
|
+
});
|
|
145
|
+
if (!response.ok) {
|
|
146
|
+
if (attempt < maxRetries && shouldRetry(response.status)) {
|
|
147
|
+
await sleep(getRetryDelay(response, attempt));
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
const responseBody = (await response.text()).slice(0, 500);
|
|
151
|
+
throw new MixedbreadRequestError(`Mixedbread request failed (${response.status} ${response.statusText})${responseBody ? `: ${responseBody}` : ""}`, response.status);
|
|
152
|
+
}
|
|
153
|
+
if (response.status === 204) {
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
return (await response.json());
|
|
157
|
+
}
|
|
158
|
+
finally {
|
|
159
|
+
clearTimeout(timeout);
|
|
160
|
+
signal?.removeEventListener("abort", abort);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
return {
|
|
165
|
+
async search({ locale, query, signal, siteId, topK }) {
|
|
166
|
+
const response = await requestJson({
|
|
167
|
+
body: () => JSON.stringify({
|
|
168
|
+
filters: {
|
|
169
|
+
all: [
|
|
170
|
+
{
|
|
171
|
+
key: mixedbreadMetadataKeys.siteId,
|
|
172
|
+
operator: "eq",
|
|
173
|
+
value: siteId,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
key: mixedbreadMetadataKeys.locale,
|
|
177
|
+
operator: "eq",
|
|
178
|
+
value: locale,
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
query,
|
|
183
|
+
search_options: { return_metadata: true },
|
|
184
|
+
store_identifiers: [storeId],
|
|
185
|
+
top_k: topK,
|
|
186
|
+
}),
|
|
187
|
+
headers: { "Content-Type": "application/json" },
|
|
188
|
+
method: "POST",
|
|
189
|
+
path: "/stores/search",
|
|
190
|
+
signal,
|
|
191
|
+
});
|
|
192
|
+
if (!Array.isArray(response.data)) {
|
|
193
|
+
throw new Error("Mixedbread search returned an invalid response");
|
|
194
|
+
}
|
|
195
|
+
return response.data.filter(isRecord);
|
|
196
|
+
},
|
|
197
|
+
async listStoreFiles(after) {
|
|
198
|
+
const response = await requestJson({
|
|
199
|
+
body: () => JSON.stringify({ after, limit: 100 }),
|
|
200
|
+
headers: { "Content-Type": "application/json" },
|
|
201
|
+
method: "POST",
|
|
202
|
+
path: `/stores/${encodedStoreId}/files/list`,
|
|
203
|
+
});
|
|
204
|
+
if (!Array.isArray(response.data)) {
|
|
205
|
+
throw new Error("Mixedbread file listing returned an invalid response");
|
|
206
|
+
}
|
|
207
|
+
const files = response.data.filter(isStoreFile);
|
|
208
|
+
const nextCursor = response.pagination?.has_more
|
|
209
|
+
? response.pagination.last_cursor
|
|
210
|
+
: undefined;
|
|
211
|
+
if (response.pagination?.has_more && !nextCursor) {
|
|
212
|
+
throw new Error("Mixedbread file listing omitted its next cursor");
|
|
213
|
+
}
|
|
214
|
+
return { files, nextCursor: nextCursor ?? undefined };
|
|
215
|
+
},
|
|
216
|
+
async uploadFile({ content, filename }) {
|
|
217
|
+
const response = await requestJson({
|
|
218
|
+
body: () => {
|
|
219
|
+
const formData = new FormData();
|
|
220
|
+
formData.append("file", new Blob([content], { type: "text/markdown" }), filename);
|
|
221
|
+
return formData;
|
|
222
|
+
},
|
|
223
|
+
method: "POST",
|
|
224
|
+
path: "/files",
|
|
225
|
+
});
|
|
226
|
+
if (typeof response.id !== "string") {
|
|
227
|
+
throw new Error("Mixedbread file upload returned an invalid response");
|
|
228
|
+
}
|
|
229
|
+
return response.id;
|
|
230
|
+
},
|
|
231
|
+
async createStoreFile({ externalId, fileId, metadata }) {
|
|
232
|
+
const response = await requestJson({
|
|
233
|
+
body: () => JSON.stringify({
|
|
234
|
+
config: { parsing_strategy: "fast" },
|
|
235
|
+
external_id: externalId,
|
|
236
|
+
file_id: fileId,
|
|
237
|
+
metadata,
|
|
238
|
+
overwrite: true,
|
|
239
|
+
}),
|
|
240
|
+
headers: { "Content-Type": "application/json" },
|
|
241
|
+
method: "POST",
|
|
242
|
+
path: `/stores/${encodedStoreId}/files`,
|
|
243
|
+
});
|
|
244
|
+
if (!isStoreFile(response)) {
|
|
245
|
+
throw new Error("Mixedbread store file creation returned an invalid response");
|
|
246
|
+
}
|
|
247
|
+
return response;
|
|
248
|
+
},
|
|
249
|
+
async deleteFile(fileId) {
|
|
250
|
+
try {
|
|
251
|
+
await requestJson({
|
|
252
|
+
method: "DELETE",
|
|
253
|
+
path: `/files/${encodePathSegment(fileId)}`,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
if (!(error instanceof MixedbreadRequestError && error.status === 404)) {
|
|
258
|
+
throw error;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
async retrieveStoreFile(fileId) {
|
|
263
|
+
const response = await requestJson({
|
|
264
|
+
method: "GET",
|
|
265
|
+
path: `/stores/${encodedStoreId}/files/${encodePathSegment(fileId)}`,
|
|
266
|
+
});
|
|
267
|
+
if (!isStoreFile(response)) {
|
|
268
|
+
throw new Error("Mixedbread store file retrieval returned an invalid response");
|
|
269
|
+
}
|
|
270
|
+
return response;
|
|
271
|
+
},
|
|
272
|
+
async deleteStoreFile(fileId) {
|
|
273
|
+
try {
|
|
274
|
+
await requestJson({
|
|
275
|
+
method: "DELETE",
|
|
276
|
+
path: `/stores/${encodedStoreId}/files/${encodePathSegment(fileId)}`,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
if (!(error instanceof MixedbreadRequestError && error.status === 404)) {
|
|
281
|
+
throw error;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
};
|
|
@@ -193,5 +193,5 @@ export function NavbarLogo({ className, href = "/", ...props }) {
|
|
|
193
193
|
}
|
|
194
194
|
}, onMouseLeave: () => {
|
|
195
195
|
logoHoveredRef.current = false;
|
|
196
|
-
}, children: props.logo }), _jsx(NavigationMenuTrigger, { "aria-label": "Open product menu", className: "relative flex h-full w-10 items-center justify-center px-1 text-gray-1000 outline-none focus-visible:ring-2 focus-visible:ring-blue-700 focus-visible:ring-inset [&_svg]:top-0" }), _jsx(NavigationMenuPrimitive.Content, { className: NAVBAR_PANEL_CLASSNAME, forceMount: true, children: _jsx("div", { className: "mx-auto w-full max-w-[1448px] px-2", children: _jsxs("div", { className: "flex flex-nowrap gap-x-10 pt-4 pb-6 pl-4", children: [featuredProducts.length > 0 ? (_jsxs("div", { className: "flex shrink-0 flex-col", children: [_jsx("p", { className: "text-gray-900 text-label-14", children: "Latest" }), _jsx("div", { className: "mt-[5px] flex flex-1 gap-x-10", children: featuredProducts.map((product) => (_jsx(OssFeaturedCard, { product: product }, product.href))) })] })) : null, ossSections.map((section) => (_jsxs("div", { className: "min-w-[180px] shrink-0", children: [_jsx("p", { className: "text-gray-900 text-label-14", children: section.heading }), _jsx("ul", { className: "mt-[5px] flex list-none flex-col", children: section.items.map((product) => (_jsx("li", { className: "flex", children: _jsx(PanelLink, { product: product }) }, product.href))) })] }, section.heading)))] }) }) })] }) }) }), _jsx("div", { "aria-hidden": "true", className: cn("pointer-events-none fixed inset-x-0 top-16 bottom-0 z-0 bg-background-200/60", navValue ? "opacity-100" : "opacity-0") })] })] })) : (_jsx(Link, { className: "flex items-center text-gray-1000", href: localizedHref, prefetch: true, children: props.logo }))] }));
|
|
196
|
+
}, children: props.logo }), _jsx(NavigationMenuTrigger, { "aria-label": "Open product menu", className: "relative flex h-full w-10 items-center justify-center px-1 text-gray-1000 outline-none focus-visible:ring-2 focus-visible:ring-blue-700 focus-visible:ring-inset [&_svg]:top-0 [&_svg]:-translate-x-1.5" }), _jsx(NavigationMenuPrimitive.Content, { className: NAVBAR_PANEL_CLASSNAME, forceMount: true, children: _jsx("div", { className: "mx-auto w-full max-w-[1448px] px-2", children: _jsxs("div", { className: "flex flex-nowrap gap-x-10 pt-4 pb-6 pl-4", children: [featuredProducts.length > 0 ? (_jsxs("div", { className: "flex shrink-0 flex-col", children: [_jsx("p", { className: "text-gray-900 text-label-14", children: "Latest" }), _jsx("div", { className: "mt-[5px] flex flex-1 gap-x-10", children: featuredProducts.map((product) => (_jsx(OssFeaturedCard, { product: product }, product.href))) })] })) : null, ossSections.map((section) => (_jsxs("div", { className: "min-w-[180px] shrink-0", children: [_jsx("p", { className: "text-gray-900 text-label-14", children: section.heading }), _jsx("ul", { className: "mt-[5px] flex list-none flex-col", children: section.items.map((product) => (_jsx("li", { className: "flex", children: _jsx(PanelLink, { product: product }) }, product.href))) })] }, section.heading)))] }) }) })] }) }) }), _jsx("div", { "aria-hidden": "true", className: cn("pointer-events-none fixed inset-x-0 top-16 bottom-0 z-0 bg-background-200/60", navValue ? "opacity-100" : "opacity-0") })] })] })) : (_jsx(Link, { className: "flex items-center text-gray-1000", href: localizedHref, prefetch: true, children: props.logo }))] }));
|
|
197
197
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-actions-client.d.ts","sourceRoot":"","sources":["../../src/internal/page-actions-client.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAGL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAmBjD,UAAU,gBAAgB;IACxB,MAAM,EAAE,IAAI,CACV,eAAe,EACf,IAAI,GAAG,UAAU,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,CACxD,CAAC;IACF;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B,IAAI,EAAE;QACJ,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,UAAU,oCAAoC;IAC5C,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,aAAa,GAAG,QAAQ,CAAC,CAAC;IACrE,YAAY,EAAE,SAAS,EAAE,CAAC;CAC3B;
|
|
1
|
+
{"version":3,"file":"page-actions-client.d.ts","sourceRoot":"","sources":["../../src/internal/page-actions-client.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAGL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAmBjD,UAAU,gBAAgB;IACxB,MAAM,EAAE,IAAI,CACV,eAAe,EACf,IAAI,GAAG,UAAU,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,CACxD,CAAC;IACF;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B,IAAI,EAAE;QACJ,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,UAAU,oCAAoC;IAC5C,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,aAAa,GAAG,QAAQ,CAAC,CAAC;IACrE,YAAY,EAAE,SAAS,EAAE,CAAC;CAC3B;AA8oBD,eAAO,MAAM,oBAAoB,GAAI,yBAIlC,gBAAgB,mDAiGlB,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAAI,2BAG7C,oCAAoC,4CAiBtC,CAAC"}
|
|
@@ -191,25 +191,7 @@ export const GeistdocsPageActions = ({ config, page, only, }) => {
|
|
|
191
191
|
await navigator.clipboard.writeText(await fetchMarkdown());
|
|
192
192
|
});
|
|
193
193
|
const handleViewMarkdown = () => {
|
|
194
|
-
|
|
195
|
-
// markdown into a blob URL — keeps `.md` URLs out of the address bar
|
|
196
|
-
// and browser history (agents should cite canonical page URLs).
|
|
197
|
-
const viewer = window.open("about:blank", "_blank");
|
|
198
|
-
if (!viewer) {
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
fetchMarkdown()
|
|
202
|
-
.then((markdown) => {
|
|
203
|
-
const blob = new Blob([markdown], {
|
|
204
|
-
type: "text/plain;charset=utf-8",
|
|
205
|
-
});
|
|
206
|
-
const blobUrl = URL.createObjectURL(blob);
|
|
207
|
-
viewer.location.href = blobUrl;
|
|
208
|
-
setTimeout(() => URL.revokeObjectURL(blobUrl), 60_000);
|
|
209
|
-
})
|
|
210
|
-
.catch(() => {
|
|
211
|
-
viewer.close();
|
|
212
|
-
});
|
|
194
|
+
window.open(markdownUrl, "_blank", "noopener");
|
|
213
195
|
};
|
|
214
196
|
const editSourceUrl = getEditSourceUrl({
|
|
215
197
|
github: config.github,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const GEISTDOCS_SEARCH_EXPORT_VERSION = 1;
|
|
2
|
+
export interface GeistdocsSearchExportDocument {
|
|
3
|
+
content: string;
|
|
4
|
+
description: string;
|
|
5
|
+
id: string;
|
|
6
|
+
locale: string;
|
|
7
|
+
sourceId: string;
|
|
8
|
+
sourceUrl: string;
|
|
9
|
+
title: string;
|
|
10
|
+
url: string;
|
|
11
|
+
}
|
|
12
|
+
export interface GeistdocsSearchExport {
|
|
13
|
+
documents: GeistdocsSearchExportDocument[];
|
|
14
|
+
provider: "local" | "mixedbread";
|
|
15
|
+
siteId?: string;
|
|
16
|
+
version: typeof GEISTDOCS_SEARCH_EXPORT_VERSION;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=search-export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-export.d.ts","sourceRoot":"","sources":["../../src/internal/search-export.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAEjD,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,6BAA6B,EAAE,CAAC;IAC3C,QAAQ,EAAE,OAAO,GAAG,YAAY,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,+BAA+B,CAAC;CACjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const GEISTDOCS_SEARCH_EXPORT_VERSION = 1;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type MixedbreadClient } from "./mixedbread.js";
|
|
2
|
+
import { type GeistdocsSearchExport } from "./search-export.js";
|
|
3
|
+
export interface SearchSyncResult {
|
|
4
|
+
deleted: number;
|
|
5
|
+
skipped: number;
|
|
6
|
+
uploaded: number;
|
|
7
|
+
}
|
|
8
|
+
export interface SyncSearchExportOptions {
|
|
9
|
+
client: MixedbreadClient;
|
|
10
|
+
concurrency?: number;
|
|
11
|
+
manifest: GeistdocsSearchExport;
|
|
12
|
+
pollIntervalMs?: number;
|
|
13
|
+
pollTimeoutMs?: number;
|
|
14
|
+
revision?: string;
|
|
15
|
+
revisionAncestors?: string[];
|
|
16
|
+
revisionTimestamp?: number;
|
|
17
|
+
sleep?: (milliseconds: number) => Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export declare const parseSearchExport: (value: unknown) => GeistdocsSearchExport;
|
|
20
|
+
export declare const loadSearchExport: ({ cwd, outputDirectory, }?: {
|
|
21
|
+
cwd?: string;
|
|
22
|
+
outputDirectory?: string;
|
|
23
|
+
}) => Promise<GeistdocsSearchExport>;
|
|
24
|
+
export declare const syncSearchExport: ({ client, concurrency, manifest, pollIntervalMs, pollTimeoutMs, revision, revisionAncestors, revisionTimestamp, sleep, }: SyncSearchExportOptions) => Promise<SearchSyncResult>;
|
|
25
|
+
//# sourceMappingURL=search-sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-sync.d.ts","sourceRoot":"","sources":["../../src/internal/search-sync.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,gBAAgB,EAItB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,KAAK,qBAAqB,EAE3B,MAAM,oBAAoB,CAAC;AA8B5B,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,gBAAgB,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,qBAAqB,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAwBD,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,qBAuBlD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAU,4BAGpC;IACD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;CACrB,mCA2BL,CAAC;AAiRF,eAAO,MAAM,gBAAgB,GAAU,0HAUpC,uBAAuB,KAAG,OAAO,CAAC,gBAAgB,CA6IpD,CAAC"}
|