jamdesk 1.1.27 → 1.1.29
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 +3 -1
- package/dist/lib/deps.js +4 -4
- package/dist/lib/deps.js.map +1 -1
- package/package.json +1 -1
- package/vendored/app/api/chat/[project]/route.ts +173 -135
- package/vendored/components/chat/ChatEmptyState.tsx +13 -1
- package/vendored/components/chat/ChatPanel.tsx +43 -9
- package/vendored/components/search/SearchModal.tsx +1 -1
- package/vendored/lib/chat-prompt.ts +95 -28
- package/vendored/lib/chat-tools.ts +111 -0
- package/vendored/lib/crisp-bridge.ts +91 -0
- package/vendored/lib/embedding-chunker.ts +85 -11
- package/vendored/lib/query-rewriter.ts +91 -0
- package/vendored/lib/r2-content.ts +5 -1
- package/vendored/lib/vector-store.ts +5 -3
- package/vendored/workspace-package-lock.json +144 -144
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://www.jamdesk.com">
|
|
3
|
-
<img src="https://www.jamdesk.com/logo-
|
|
3
|
+
<img src="https://www.jamdesk.com/logo-universal.png" width="280" alt="Jamdesk" />
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
@@ -435,6 +435,7 @@ See the [docs.json reference](https://www.jamdesk.com/docs/config/docs-json-refe
|
|
|
435
435
|
|
|
436
436
|
- Node.js v20.0.0+
|
|
437
437
|
- npm v8+ (recommended)
|
|
438
|
+
- macOS, Linux, or Windows (all tested in CI)
|
|
438
439
|
|
|
439
440
|
## Learn More
|
|
440
441
|
|
|
@@ -446,6 +447,7 @@ See the [docs.json reference](https://www.jamdesk.com/docs/config/docs-json-refe
|
|
|
446
447
|
- [OpenAPI](https://www.jamdesk.com/docs/api-reference/openapi-setup)
|
|
447
448
|
- [Deployment](https://www.jamdesk.com/docs/deploy)
|
|
448
449
|
- [npm Package](https://www.npmjs.com/package/jamdesk)
|
|
450
|
+
- [Release History](https://www.npmjs.com/package/jamdesk?activeTab=versions)
|
|
449
451
|
- [Homepage](https://www.jamdesk.com)
|
|
450
452
|
- [Pricing](https://www.jamdesk.com/pricing)
|
|
451
453
|
|
package/dist/lib/deps.js
CHANGED
|
@@ -23,13 +23,13 @@ const JAMDESK_DIR = path.join(homedir(), '.jamdesk');
|
|
|
23
23
|
// compiled dist/lib/deps.js instead of re-parsing the TypeScript source.
|
|
24
24
|
export const REQUIRED_DEPS = {
|
|
25
25
|
// Next.js and React
|
|
26
|
-
'next': '16.2.
|
|
26
|
+
'next': '^16.2.4',
|
|
27
27
|
// OpenAPI validation (for API reference docs)
|
|
28
28
|
'@apidevtools/swagger-parser': '^12.1.0',
|
|
29
29
|
'openapi-types': '^12.1.3',
|
|
30
30
|
'react': '^19.2.4',
|
|
31
31
|
'react-dom': '^19.2.4',
|
|
32
|
-
'@next/mdx': '16.2.
|
|
32
|
+
'@next/mdx': '^16.2.4',
|
|
33
33
|
'next-mdx-remote': '^6.0.0',
|
|
34
34
|
'next-themes': '^0.4.6',
|
|
35
35
|
// Icons
|
|
@@ -76,7 +76,7 @@ export const REQUIRED_DEPS = {
|
|
|
76
76
|
'tailwindcss': '^4.2.2',
|
|
77
77
|
'@tailwindcss/postcss': '^4.2.2',
|
|
78
78
|
'@tailwindcss/typography': '^0.5.10',
|
|
79
|
-
'postcss': '^8.5.
|
|
79
|
+
'postcss': '^8.5.10',
|
|
80
80
|
'autoprefixer': '^10.4.24',
|
|
81
81
|
// Script dependencies (for vendored scripts)
|
|
82
82
|
'fs-extra': '^11.3.3',
|
|
@@ -87,7 +87,7 @@ export const REQUIRED_DEPS = {
|
|
|
87
87
|
'@types/node': '^25.5.2',
|
|
88
88
|
'@types/react': '^19.2.14',
|
|
89
89
|
'@types/react-dom': '^19.0.0',
|
|
90
|
-
'@next/third-parties': '16.2.
|
|
90
|
+
'@next/third-parties': '^16.2.4',
|
|
91
91
|
};
|
|
92
92
|
/**
|
|
93
93
|
* Generate a hash of REQUIRED_DEPS to detect when dependencies change.
|
package/dist/lib/deps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deps.js","sourceRoot":"","sources":["../../src/lib/deps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,UAAU,GAAG,OAAO,CAAC,oBAAoB,CAAwB,CAAC;AAExE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC;AAErD,wCAAwC;AACxC,sDAAsD;AACtD,2EAA2E;AAC3E,yEAAyE;AACzE,MAAM,CAAC,MAAM,aAAa,GAA2B;IACnD,oBAAoB;IACpB,MAAM,EAAE,QAAQ;IAChB,8CAA8C;IAC9C,6BAA6B,EAAE,SAAS;IACxC,eAAe,EAAE,SAAS;IAC1B,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,QAAQ;IACrB,iBAAiB,EAAE,QAAQ;IAC3B,aAAa,EAAE,QAAQ;IACvB,QAAQ;IACR,mCAAmC,EAAE,QAAQ;IAC7C,oCAAoC,EAAE,QAAQ;IAC9C,qCAAqC,EAAE,QAAQ;IAC/C,mC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C,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;QAChE,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAC7C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jamdesk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.29",
|
|
4
4
|
"description": "CLI for Jamdesk — build, preview, and deploy documentation sites from MDX. Dev server with hot reload, 50+ components, OpenAPI support, AI search, and Mintlify migration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jamdesk",
|
|
@@ -22,10 +22,14 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { NextRequest } from 'next/server';
|
|
24
24
|
import { querySimilarChunks } from '@/lib/vector-store';
|
|
25
|
-
import { buildSystemPrompt } from '@/lib/chat-prompt';
|
|
25
|
+
import { buildSystemPrompt, isCannedIdentityReply, resolveSiteName } from '@/lib/chat-prompt';
|
|
26
26
|
import { getDocsPath, getBaseUrl, trackChatAnalytics } from '@/lib/route-helpers';
|
|
27
27
|
import { getAnthropicClient } from '@/lib/anthropic-client';
|
|
28
|
+
import { rewriteQueryForSearch } from '@/lib/query-rewriter';
|
|
29
|
+
import { fetchDocsConfig } from '@/lib/r2-content';
|
|
28
30
|
import { redis } from '@/lib/redis';
|
|
31
|
+
import { CHAT_TOOLS } from '@/lib/chat-tools';
|
|
32
|
+
import { log } from '@/lib/logger';
|
|
29
33
|
|
|
30
34
|
export const runtime = 'nodejs';
|
|
31
35
|
export const maxDuration = 30;
|
|
@@ -36,113 +40,6 @@ const RATE_WINDOW_SECONDS = 60;
|
|
|
36
40
|
const MAX_HISTORY = 10;
|
|
37
41
|
const VALID_ROLES = new Set<string>(['user', 'assistant']);
|
|
38
42
|
|
|
39
|
-
/**
|
|
40
|
-
* Extract citations from Claude's response by matching [Title] references
|
|
41
|
-
* against the vector search chunks. Deduplicates by page slug.
|
|
42
|
-
* Falls back to top 2 unique pages by score if Claude didn't cite anything.
|
|
43
|
-
*/
|
|
44
|
-
type Citation = { title: string; slug: string; section?: string };
|
|
45
|
-
type ScoredChunk = { pageSlug: string; pageTitle: string; sectionHeading: string; score: number };
|
|
46
|
-
|
|
47
|
-
function extractCitations(
|
|
48
|
-
responseText: string,
|
|
49
|
-
chunks: ScoredChunk[],
|
|
50
|
-
): { sources: Citation[]; hadExplicitCitations: boolean } {
|
|
51
|
-
// Match [Title] but not markdown links [text](url)
|
|
52
|
-
const referencedTitles = new Set(
|
|
53
|
-
Array.from(responseText.matchAll(/\[([^\]]+)\](?!\()/g), (m) => m[1]),
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const seen = new Set<string>();
|
|
57
|
-
const sources: Citation[] = [];
|
|
58
|
-
|
|
59
|
-
function addUniqueChunk(c: (typeof chunks)[number]): void {
|
|
60
|
-
if (seen.has(c.pageSlug)) return;
|
|
61
|
-
seen.add(c.pageSlug);
|
|
62
|
-
sources.push({ title: c.pageTitle, slug: c.pageSlug, section: c.sectionHeading });
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Filter chunks to only those Claude referenced, deduplicate by slug
|
|
66
|
-
for (const c of chunks) {
|
|
67
|
-
if (referencedTitles.has(c.pageTitle)) addUniqueChunk(c);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Record whether Claude explicitly cited sources before the fallback
|
|
71
|
-
const hadExplicitCitations = sources.length > 0;
|
|
72
|
-
|
|
73
|
-
// Fallback: if Claude didn't cite anything explicitly, show top 2 unique pages by score
|
|
74
|
-
if (sources.length === 0) {
|
|
75
|
-
for (const c of chunks) {
|
|
76
|
-
addUniqueChunk(c);
|
|
77
|
-
if (sources.length >= 2) break;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return { sources, hadExplicitCitations };
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Detect option lists in Claude's response that indicate a clarification question.
|
|
86
|
-
* Returns extracted option strings, or null if the response is a normal answer.
|
|
87
|
-
*
|
|
88
|
-
* Heuristic guards to avoid false positives on instructional lists:
|
|
89
|
-
* - Response must contain a question mark or colon (clarification Qs ask something)
|
|
90
|
-
* - Response must be short (< 500 chars — clarification Qs are brief)
|
|
91
|
-
* - Must be 2-3 items (instructional lists tend to be longer)
|
|
92
|
-
* - List must be at the END of the response
|
|
93
|
-
*
|
|
94
|
-
* Supports numbered (1. 2. 3.) and unnumbered (plain lines) formats.
|
|
95
|
-
* Strips markdown formatting (bold, backticks) from option text.
|
|
96
|
-
*/
|
|
97
|
-
export function extractClarificationOptions(responseText: string): string[] | null {
|
|
98
|
-
// Trim trailing whitespace/newlines so the $ anchor in option-list regexes
|
|
99
|
-
// matches reliably — SSE text deltas can include trailing newlines.
|
|
100
|
-
const text = responseText.trimEnd();
|
|
101
|
-
|
|
102
|
-
// Must indicate a question. A `?` always qualifies. A `:` only qualifies when
|
|
103
|
-
// the preamble contains clarification words (to avoid false positives on
|
|
104
|
-
// instructional lists like "To enable dark mode:\n\n1. Open Settings").
|
|
105
|
-
const hasQuestion = text.includes('?');
|
|
106
|
-
const hasClarificationColon = !hasQuestion
|
|
107
|
-
&& text.includes(':')
|
|
108
|
-
&& /\b(which|what|clarify|interested|looking for|asking|type of|kind of)\b/i.test(text);
|
|
109
|
-
if (!hasQuestion && !hasClarificationColon) return null;
|
|
110
|
-
|
|
111
|
-
// Only short responses are likely clarification questions
|
|
112
|
-
if (text.length > 500) return null;
|
|
113
|
-
|
|
114
|
-
// Strip markdown formatting (bold, italic, backticks) from option labels
|
|
115
|
-
function cleanOption(text: string): string {
|
|
116
|
-
return text.trim().replace(/[*`]/g, '');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Primary: numbered list (1. 2. 3.) at the end
|
|
120
|
-
const numbered = text.match(
|
|
121
|
-
/\n\n1\.\s+(.+)\n2\.\s+(.+)(?:\n3\.\s+(.+))?$/,
|
|
122
|
-
);
|
|
123
|
-
if (numbered) {
|
|
124
|
-
const options = [cleanOption(numbered[1]), cleanOption(numbered[2])];
|
|
125
|
-
if (numbered[3]) options.push(cleanOption(numbered[3]));
|
|
126
|
-
return options;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Fallback: unnumbered list (2-3 short lines at the end, after a blank line)
|
|
130
|
-
// Each line must be short (< 80 chars) and non-empty to distinguish from paragraphs
|
|
131
|
-
const unnumbered = text.match(
|
|
132
|
-
/\n\n([^\n]{2,80})\n([^\n]{2,80})(?:\n([^\n]{2,80}))?$/,
|
|
133
|
-
);
|
|
134
|
-
if (unnumbered) {
|
|
135
|
-
// Extra guard: lines must NOT look like sentences (no periods at end)
|
|
136
|
-
const lines = [unnumbered[1], unnumbered[2], unnumbered[3]].filter(Boolean) as string[];
|
|
137
|
-
const looksLikeOptions = lines.every(l => !l.trim().endsWith('.') && l.trim().length < 80);
|
|
138
|
-
if (looksLikeOptions && lines.length >= 2) {
|
|
139
|
-
return lines.map(cleanOption);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
43
|
export async function POST(
|
|
147
44
|
request: NextRequest,
|
|
148
45
|
context: { params: Promise<{ project: string }> },
|
|
@@ -209,10 +106,45 @@ export async function POST(
|
|
|
209
106
|
}
|
|
210
107
|
}
|
|
211
108
|
|
|
212
|
-
//
|
|
213
|
-
|
|
109
|
+
// Kick off docsPath (Redis) + config (R2) lookups in parallel with the
|
|
110
|
+
// vector search below. Per-promise .catch prevents unhandled rejections
|
|
111
|
+
// if an early return (vector error, empty chunks, missing client) leaves
|
|
112
|
+
// sideWork un-awaited.
|
|
113
|
+
const originalHost = request.headers.get('x-jamdesk-forwarded-host')
|
|
114
|
+
|| request.headers.get('x-original-host') || '';
|
|
115
|
+
const sideWork = Promise.all([
|
|
116
|
+
getDocsPath(project, originalHost).catch(() => ''),
|
|
117
|
+
fetchDocsConfig(project).catch(() => null),
|
|
118
|
+
]);
|
|
119
|
+
|
|
120
|
+
// Fully parallel retrieval:
|
|
121
|
+
// - Original vector query runs immediately.
|
|
122
|
+
// - Rewriter + rewritten-query vector search are chained into ONE promise,
|
|
123
|
+
// then Promise.all'd with the original. Critical path is
|
|
124
|
+
// max(original_query_time, rewriter_time + rewritten_query_time), not
|
|
125
|
+
// max(original, rewriter) + rewritten_query_time.
|
|
126
|
+
// Any failure in the rewrite path resolves to an empty chunk list — the
|
|
127
|
+
// original query still returns results so chat doesn't fail.
|
|
128
|
+
const originalQueryPromise = querySimilarChunks(project, searchQuery, 15);
|
|
129
|
+
|
|
130
|
+
const rewrittenPathPromise: Promise<Awaited<ReturnType<typeof querySimilarChunks>>> =
|
|
131
|
+
rewriteQueryForSearch(message, history)
|
|
132
|
+
.catch(() => null)
|
|
133
|
+
.then(rewritten => {
|
|
134
|
+
// Compare against `message` (the rewriter's input), not `searchQuery`
|
|
135
|
+
// (which is enriched with prior-turn context for short follow-ups).
|
|
136
|
+
// The rewriter only sees `message`, so a no-op rewrite equals `message`.
|
|
137
|
+
if (!rewritten || rewritten === message) return [];
|
|
138
|
+
return querySimilarChunks(project, rewritten, 15).catch(() => []);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
let originalChunks: Awaited<ReturnType<typeof querySimilarChunks>>;
|
|
142
|
+
let rewrittenChunks: Awaited<ReturnType<typeof querySimilarChunks>>;
|
|
214
143
|
try {
|
|
215
|
-
|
|
144
|
+
[originalChunks, rewrittenChunks] = await Promise.all([
|
|
145
|
+
originalQueryPromise,
|
|
146
|
+
rewrittenPathPromise,
|
|
147
|
+
]);
|
|
216
148
|
} catch {
|
|
217
149
|
return Response.json(
|
|
218
150
|
{ error: 'AI chat is not available for this project.' },
|
|
@@ -220,6 +152,21 @@ export async function POST(
|
|
|
220
152
|
);
|
|
221
153
|
}
|
|
222
154
|
|
|
155
|
+
// Merge: original chunks first (they match the user's literal phrasing),
|
|
156
|
+
// then unique chunks from the rewritten query. Dedup by pageSlug +
|
|
157
|
+
// sectionHeading — chunks with the same identity are interchangeable across
|
|
158
|
+
// queries.
|
|
159
|
+
const seenKeys = new Set(originalChunks.map(c => `${c.pageSlug}#${c.sectionHeading}`));
|
|
160
|
+
const chunks = [
|
|
161
|
+
...originalChunks,
|
|
162
|
+
...rewrittenChunks.filter(c => {
|
|
163
|
+
const key = `${c.pageSlug}#${c.sectionHeading}`;
|
|
164
|
+
if (seenKeys.has(key)) return false;
|
|
165
|
+
seenKeys.add(key);
|
|
166
|
+
return true;
|
|
167
|
+
}),
|
|
168
|
+
];
|
|
169
|
+
|
|
223
170
|
if (chunks.length === 0) {
|
|
224
171
|
return Response.json(
|
|
225
172
|
{ error: 'No documentation content found for this project.' },
|
|
@@ -235,25 +182,19 @@ export async function POST(
|
|
|
235
182
|
);
|
|
236
183
|
}
|
|
237
184
|
|
|
238
|
-
|
|
239
|
-
const originalHost = request.headers.get('x-jamdesk-forwarded-host')
|
|
240
|
-
|| request.headers.get('x-original-host') || '';
|
|
185
|
+
const [docsPath, config] = await sideWork;
|
|
241
186
|
const baseUrl = getBaseUrl(project, originalHost);
|
|
242
|
-
|
|
243
|
-
try {
|
|
244
|
-
docsPath = await getDocsPath(project, originalHost);
|
|
245
|
-
} catch {
|
|
246
|
-
docsPath = '';
|
|
247
|
-
}
|
|
187
|
+
const siteName = resolveSiteName(config);
|
|
248
188
|
|
|
249
|
-
|
|
250
|
-
const systemPrompt = buildSystemPrompt(project, chunks, baseUrl, docsPath);
|
|
189
|
+
const systemPrompt = buildSystemPrompt(siteName, chunks, baseUrl, docsPath);
|
|
251
190
|
|
|
252
191
|
const stream = anthropic.messages.stream({
|
|
253
192
|
model: CHAT_MODEL,
|
|
254
193
|
max_tokens: 2048,
|
|
255
194
|
temperature: 0.3,
|
|
256
195
|
system: systemPrompt,
|
|
196
|
+
tools: CHAT_TOOLS,
|
|
197
|
+
tool_choice: { type: 'any' },
|
|
257
198
|
messages: [
|
|
258
199
|
...history.slice(-MAX_HISTORY),
|
|
259
200
|
{ role: 'user', content: message },
|
|
@@ -265,35 +206,127 @@ export async function POST(
|
|
|
265
206
|
return encoder.encode(`data: ${JSON.stringify(data)}\n\n`);
|
|
266
207
|
}
|
|
267
208
|
|
|
209
|
+
type Citation = { title: string; slug: string; section?: string };
|
|
210
|
+
type AnswerInput = { markdown?: string; cited_page_slugs?: string[] };
|
|
211
|
+
type ClarificationInput = { question?: string; options?: string[] };
|
|
212
|
+
|
|
213
|
+
function topChunksAsCitations(limit = 2, skip?: Set<string>): Citation[] {
|
|
214
|
+
const out: Citation[] = [];
|
|
215
|
+
const seen = new Set<string>(skip);
|
|
216
|
+
for (const c of chunks) {
|
|
217
|
+
if (seen.has(c.pageSlug)) continue;
|
|
218
|
+
seen.add(c.pageSlug);
|
|
219
|
+
out.push({ title: c.pageTitle, slug: c.pageSlug, section: c.sectionHeading });
|
|
220
|
+
if (out.length >= limit) break;
|
|
221
|
+
}
|
|
222
|
+
return out;
|
|
223
|
+
}
|
|
224
|
+
|
|
268
225
|
const readable = new ReadableStream({
|
|
269
226
|
async start(controller) {
|
|
270
|
-
let
|
|
227
|
+
let toolName: string | null = null;
|
|
228
|
+
let emittedMarkdownLength = 0;
|
|
229
|
+
let emittedQuestionLength = 0;
|
|
230
|
+
|
|
231
|
+
stream.on('inputJson', (_partialJson, jsonSnapshot) => {
|
|
232
|
+
if (!jsonSnapshot || typeof jsonSnapshot !== 'object') return;
|
|
233
|
+
|
|
234
|
+
// Gate on toolName — emitting before content_block_start resolves
|
|
235
|
+
// would leak clarification JSON into the answer text channel.
|
|
236
|
+
if (toolName === 'answer') {
|
|
237
|
+
const snap = jsonSnapshot as AnswerInput;
|
|
238
|
+
if (typeof snap.markdown === 'string' && snap.markdown.length > emittedMarkdownLength) {
|
|
239
|
+
const newContent = snap.markdown.slice(emittedMarkdownLength);
|
|
240
|
+
emittedMarkdownLength = snap.markdown.length;
|
|
241
|
+
controller.enqueue(sendEvent({ type: 'text', content: newContent }));
|
|
242
|
+
}
|
|
243
|
+
} else if (toolName === 'ask_clarification') {
|
|
244
|
+
const snap = jsonSnapshot as ClarificationInput;
|
|
245
|
+
if (typeof snap.question === 'string' && snap.question.length > emittedQuestionLength) {
|
|
246
|
+
const newContent = snap.question.slice(emittedQuestionLength);
|
|
247
|
+
emittedQuestionLength = snap.question.length;
|
|
248
|
+
controller.enqueue(sendEvent({ type: 'text', content: newContent }));
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
});
|
|
271
252
|
|
|
272
253
|
try {
|
|
254
|
+
// Watch for content_block_start to learn which tool Claude picked.
|
|
273
255
|
for await (const event of stream) {
|
|
274
|
-
if (event.type === '
|
|
275
|
-
|
|
276
|
-
controller.enqueue(sendEvent({ type: 'text', content: event.delta.text }));
|
|
256
|
+
if (event.type === 'content_block_start' && event.content_block.type === 'tool_use') {
|
|
257
|
+
toolName = event.content_block.name;
|
|
277
258
|
}
|
|
278
259
|
}
|
|
279
260
|
|
|
280
|
-
// After streaming completes, get token usage
|
|
281
261
|
const finalMessage = await stream.finalMessage();
|
|
282
262
|
const inputTokens = finalMessage.usage?.input_tokens ?? 0;
|
|
283
263
|
const outputTokens = finalMessage.usage?.output_tokens ?? 0;
|
|
284
264
|
|
|
285
|
-
//
|
|
286
|
-
const
|
|
287
|
-
if (
|
|
265
|
+
// With tool_choice: 'any' there is exactly one tool_use block.
|
|
266
|
+
const toolUse = finalMessage.content.find(c => c.type === 'tool_use');
|
|
267
|
+
if (!toolUse || toolUse.type !== 'tool_use') {
|
|
268
|
+
throw new Error('Expected tool_use block in final message');
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
let sources: Citation[];
|
|
272
|
+
let hadExplicitCitations: boolean;
|
|
273
|
+
const hasClarification = toolUse.name === 'ask_clarification';
|
|
274
|
+
|
|
275
|
+
if (toolUse.name === 'answer') {
|
|
276
|
+
const input = toolUse.input as AnswerInput;
|
|
277
|
+
const slugs = Array.isArray(input.cited_page_slugs) ? input.cited_page_slugs : [];
|
|
278
|
+
const markdownText = typeof input.markdown === 'string' ? input.markdown : '';
|
|
279
|
+
// Suppress citations on the canned identity reply — otherwise the
|
|
280
|
+
// top-2 fallback would attach unrelated docs under "I'm the
|
|
281
|
+
// documentation assistant for …".
|
|
282
|
+
const isIdentityReply = isCannedIdentityReply(markdownText, siteName);
|
|
283
|
+
|
|
284
|
+
const seen = new Set<string>();
|
|
285
|
+
const explicitSources: Citation[] = [];
|
|
286
|
+
if (!isIdentityReply) {
|
|
287
|
+
for (const slug of slugs) {
|
|
288
|
+
const chunk = chunks.find(c => c.pageSlug === slug);
|
|
289
|
+
if (chunk && !seen.has(chunk.pageSlug)) {
|
|
290
|
+
seen.add(chunk.pageSlug);
|
|
291
|
+
explicitSources.push({
|
|
292
|
+
title: chunk.pageTitle,
|
|
293
|
+
slug: chunk.pageSlug,
|
|
294
|
+
section: chunk.sectionHeading,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
// Identity replies set hadExplicitCitations=true to mark intentional
|
|
300
|
+
// no-cite; non-identity answers fall back to top-2 when Claude omits slugs.
|
|
301
|
+
hadExplicitCitations = isIdentityReply || explicitSources.length > 0;
|
|
302
|
+
sources = isIdentityReply
|
|
303
|
+
? []
|
|
304
|
+
: explicitSources.length > 0
|
|
305
|
+
? explicitSources
|
|
306
|
+
: topChunksAsCitations(2, seen);
|
|
307
|
+
} else if (toolUse.name === 'ask_clarification') {
|
|
308
|
+
const input = toolUse.input as ClarificationInput;
|
|
309
|
+
const options = Array.isArray(input.options) ? input.options : [];
|
|
310
|
+
const question = typeof input.question === 'string' ? input.question.trim() : '';
|
|
311
|
+
// Missing question → UI shows buttons with no prompt.
|
|
312
|
+
// <2 options → dead-end UI. Interrupt so the user can retry.
|
|
313
|
+
if (!question) {
|
|
314
|
+
throw new Error('ask_clarification returned no question');
|
|
315
|
+
}
|
|
316
|
+
if (options.length < 2) {
|
|
317
|
+
throw new Error(`ask_clarification returned ${options.length} options; minimum is 2`);
|
|
318
|
+
}
|
|
288
319
|
controller.enqueue(sendEvent({ type: 'clarification', options }));
|
|
320
|
+
// Surface top chunks so users see where the disambiguation candidates come from.
|
|
321
|
+
sources = topChunksAsCitations();
|
|
322
|
+
hadExplicitCitations = false;
|
|
323
|
+
} else {
|
|
324
|
+
throw new Error(`Unexpected tool name: ${toolUse.name}`);
|
|
289
325
|
}
|
|
290
326
|
|
|
291
|
-
// Extract [Title] references from Claude's response (skip markdown links [text](url))
|
|
292
|
-
const { sources, hadExplicitCitations } = extractCitations(fullText, chunks);
|
|
293
327
|
controller.enqueue(sendEvent({ type: 'citations', sources }));
|
|
294
328
|
controller.enqueue(sendEvent({ type: 'done' }));
|
|
295
329
|
|
|
296
|
-
// Fire-and-forget analytics — only on success (finalMessage unreliable on error)
|
|
297
330
|
trackChatAnalytics({
|
|
298
331
|
projectSlug: project,
|
|
299
332
|
query: message,
|
|
@@ -302,11 +335,16 @@ export async function POST(
|
|
|
302
335
|
outputTokens,
|
|
303
336
|
model: CHAT_MODEL,
|
|
304
337
|
hadExplicitCitations,
|
|
305
|
-
hasClarification
|
|
338
|
+
hasClarification,
|
|
306
339
|
durationMs: Date.now() - startTime,
|
|
307
340
|
userAgent: request.headers.get('user-agent') || undefined,
|
|
308
341
|
}).catch(() => {});
|
|
309
|
-
} catch {
|
|
342
|
+
} catch (err) {
|
|
343
|
+
log('warn', 'chat: stream interrupted', {
|
|
344
|
+
projectSlug: project,
|
|
345
|
+
toolName,
|
|
346
|
+
error: err instanceof Error ? err.message : String(err),
|
|
347
|
+
});
|
|
310
348
|
controller.enqueue(sendEvent({ type: 'error', message: 'The response was interrupted. Please try again.' }));
|
|
311
349
|
}
|
|
312
350
|
controller.close();
|
|
@@ -5,6 +5,9 @@ import { memo, useMemo, useState, useCallback } from 'react';
|
|
|
5
5
|
interface ChatEmptyStateProps {
|
|
6
6
|
starterQuestions?: string[];
|
|
7
7
|
onSelectQuestion: (question: string) => void;
|
|
8
|
+
/** Escape-hatch to hand the visitor off to Crisp. Omit to hide the button
|
|
9
|
+
* (e.g. when Crisp isn't loaded). Detection happens in ChatPanel. */
|
|
10
|
+
onTalkToHuman?: () => void;
|
|
8
11
|
}
|
|
9
12
|
|
|
10
13
|
const STARTER_BASE = 'w-full text-left px-4 py-3 rounded-xl border text-sm transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--color-accent)]';
|
|
@@ -25,7 +28,7 @@ function starterButtonClass(question: string, selectedQuestion: string | null):
|
|
|
25
28
|
* Starter questions are auto-generated by Haiku during builds when not
|
|
26
29
|
* defined in docs.json — see lib/generate-starter-questions.ts.
|
|
27
30
|
*/
|
|
28
|
-
export const ChatEmptyState = memo(function ChatEmptyState({ starterQuestions, onSelectQuestion }: ChatEmptyStateProps) {
|
|
31
|
+
export const ChatEmptyState = memo(function ChatEmptyState({ starterQuestions, onSelectQuestion, onTalkToHuman }: ChatEmptyStateProps) {
|
|
29
32
|
const shortcutKey = useMemo(
|
|
30
33
|
() => typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.userAgent) ? '⌘' : 'Ctrl+',
|
|
31
34
|
[],
|
|
@@ -74,6 +77,15 @@ export const ChatEmptyState = memo(function ChatEmptyState({ starterQuestions, o
|
|
|
74
77
|
))}
|
|
75
78
|
</div>
|
|
76
79
|
)}
|
|
80
|
+
{onTalkToHuman && (
|
|
81
|
+
<button
|
|
82
|
+
type="button"
|
|
83
|
+
onClick={onTalkToHuman}
|
|
84
|
+
className="mt-6 text-xs text-[var(--color-text-secondary)] hover:text-[var(--color-accent)] transition-colors cursor-pointer focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--color-accent)] rounded-md"
|
|
85
|
+
>
|
|
86
|
+
Need to talk to a human? <span className="font-medium text-[var(--color-accent)]">Start a chat →</span>
|
|
87
|
+
</button>
|
|
88
|
+
)}
|
|
77
89
|
</div>
|
|
78
90
|
);
|
|
79
91
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useRef, useEffect, useLayoutEffect, useCallback } from 'react';
|
|
3
|
+
import { useRef, useEffect, useLayoutEffect, useCallback, useState } from 'react';
|
|
4
4
|
import { useChat } from '@/hooks/useChat';
|
|
5
5
|
import { useBodyScrollLock } from '@/hooks/useBodyScrollLock';
|
|
6
6
|
import { ChatMessage } from './ChatMessage';
|
|
7
7
|
import { ChatInput } from './ChatInput';
|
|
8
8
|
import { ChatEmptyState } from './ChatEmptyState';
|
|
9
|
+
import { crispAvailable, hideCrispLauncher, openCrispChat, showCrispLauncher } from '../../lib/crisp-bridge';
|
|
9
10
|
|
|
10
11
|
const SOMETHING_ELSE_PATTERNS = ['something else', 'none of the above', 'none of these'];
|
|
11
12
|
|
|
@@ -41,6 +42,15 @@ interface ChatPanelProps {
|
|
|
41
42
|
*/
|
|
42
43
|
export function ChatPanel({ isOpen, onClose, starterQuestions, chatEndpoint, mode = 'overlay' }: ChatPanelProps) {
|
|
43
44
|
const { messages, sendMessage, isLoading, abort, retry, clearChat, error, markClarificationSelected } = useChat(chatEndpoint);
|
|
45
|
+
|
|
46
|
+
const [hasCrisp, setHasCrisp] = useState(false);
|
|
47
|
+
useEffect(() => { setHasCrisp(crispAvailable()); }, []);
|
|
48
|
+
|
|
49
|
+
const handleTalkToHuman = useCallback(() => {
|
|
50
|
+
onClose();
|
|
51
|
+
openCrispChat();
|
|
52
|
+
}, [onClose]);
|
|
53
|
+
|
|
44
54
|
const messagesContainerRef = useRef<HTMLDivElement>(null);
|
|
45
55
|
const inputRef = useRef<HTMLDivElement>(null);
|
|
46
56
|
const overlayPanelRef = useRef<HTMLDivElement>(null);
|
|
@@ -50,6 +60,17 @@ export function ChatPanel({ isOpen, onClose, starterQuestions, chatEndpoint, mod
|
|
|
50
60
|
// Lock body scroll when mobile overlay is open
|
|
51
61
|
useBodyScrollLock(!isInline && isOpen);
|
|
52
62
|
|
|
63
|
+
// Coordinate visibility with Crisp so the two chats don't overlap in the
|
|
64
|
+
// bottom-right corner. Applies to both modes — Crisp's fixed launcher sits
|
|
65
|
+
// behind the inline chat column's send button on desktop too.
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (!isOpen) return;
|
|
68
|
+
hideCrispLauncher();
|
|
69
|
+
return () => {
|
|
70
|
+
showCrispLauncher();
|
|
71
|
+
};
|
|
72
|
+
}, [isOpen]);
|
|
73
|
+
|
|
53
74
|
// On iOS, the virtual keyboard doesn't resize the layout viewport, so the
|
|
54
75
|
// panel's max-h-[80dvh] can extend behind the keyboard. When the user taps the
|
|
55
76
|
// textarea, iOS scrolls the page to reveal it — pushing the fixed panel off-screen.
|
|
@@ -171,6 +192,7 @@ export function ChatPanel({ isOpen, onClose, starterQuestions, chatEndpoint, mod
|
|
|
171
192
|
<ChatEmptyState
|
|
172
193
|
starterQuestions={starterQuestions}
|
|
173
194
|
onSelectQuestion={sendMessage}
|
|
195
|
+
onTalkToHuman={hasCrisp ? handleTalkToHuman : undefined}
|
|
174
196
|
/>
|
|
175
197
|
)}
|
|
176
198
|
</div>
|
|
@@ -181,12 +203,24 @@ export function ChatPanel({ isOpen, onClose, starterQuestions, chatEndpoint, mod
|
|
|
181
203
|
<p className="text-xs text-red-600 dark:text-red-400">
|
|
182
204
|
{error}
|
|
183
205
|
</p>
|
|
184
|
-
<
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
206
|
+
<div className="flex items-center gap-3 flex-shrink-0">
|
|
207
|
+
{hasCrisp && (
|
|
208
|
+
<button
|
|
209
|
+
type="button"
|
|
210
|
+
onClick={handleTalkToHuman}
|
|
211
|
+
className="text-xs font-medium text-red-600 dark:text-red-400 hover:underline cursor-pointer"
|
|
212
|
+
>
|
|
213
|
+
Talk to a human
|
|
214
|
+
</button>
|
|
215
|
+
)}
|
|
216
|
+
<button
|
|
217
|
+
type="button"
|
|
218
|
+
onClick={retry}
|
|
219
|
+
className="text-xs font-medium text-red-600 dark:text-red-400 hover:underline cursor-pointer"
|
|
220
|
+
>
|
|
221
|
+
Try again
|
|
222
|
+
</button>
|
|
223
|
+
</div>
|
|
190
224
|
</div>
|
|
191
225
|
)}
|
|
192
226
|
|
|
@@ -220,7 +254,7 @@ export function ChatPanel({ isOpen, onClose, starterQuestions, chatEndpoint, mod
|
|
|
220
254
|
{/* Mobile backdrop (<lg) */}
|
|
221
255
|
{isOpen && (
|
|
222
256
|
<div
|
|
223
|
-
className="fixed inset-0 bg-black/50 backdrop-blur-sm z-[
|
|
257
|
+
className="fixed inset-0 bg-black/50 backdrop-blur-sm z-[1000003] lg:hidden"
|
|
224
258
|
onClick={onClose}
|
|
225
259
|
aria-hidden="true"
|
|
226
260
|
/>
|
|
@@ -236,7 +270,7 @@ export function ChatPanel({ isOpen, onClose, starterQuestions, chatEndpoint, mod
|
|
|
236
270
|
data-open={isOpen}
|
|
237
271
|
data-chat-panel
|
|
238
272
|
className={`
|
|
239
|
-
fixed z-[
|
|
273
|
+
fixed z-[1000004] flex flex-col overflow-hidden
|
|
240
274
|
transition-all duration-200
|
|
241
275
|
inset-x-2 top-4 max-h-[80dvh] rounded-2xl shadow-xl border border-[var(--color-border)]
|
|
242
276
|
lg:inset-x-auto lg:top-0 lg:max-h-none lg:rounded-none lg:shadow-none lg:border-0
|
|
@@ -408,7 +408,7 @@ export function SearchModal({ isOpen, onClose, popularPages, onNavigate }: Searc
|
|
|
408
408
|
placeholder="Search documentation…"
|
|
409
409
|
value={query}
|
|
410
410
|
onChange={(e) => setQuery(e.target.value)}
|
|
411
|
-
className="flex-1 bg-transparent text-[var(--color-text-primary)] placeholder-[var(--color-text-muted)] outline-none text-
|
|
411
|
+
className="flex-1 bg-transparent text-[var(--color-text-primary)] placeholder-[var(--color-text-muted)] outline-none text-base"
|
|
412
412
|
autoComplete="off"
|
|
413
413
|
autoFocus
|
|
414
414
|
aria-label="Search documentation"
|