feat: glass ui pass
This commit is contained in:
@@ -104,7 +104,7 @@ export function chatMessageText(message: ChatMessage): string {
|
||||
|
||||
const ATTACHED_CONTEXT_MARKER_RE = /(?:^|\n)--- Attached Context ---\s*\n/
|
||||
const CONTEXT_WARNINGS_MARKER_RE = /(?:^|\n)--- Context Warnings ---[\s\S]*$/
|
||||
const CONTEXT_REF_RE = /@(file|folder|url|image|tool):(?:"[^"\n]+"|'[^'\n]+'|`[^`\n]+`|\S+)/g
|
||||
const CONTEXT_REF_RE = /@(file|folder|url|image|tool|terminal):(?:"[^"\n]+"|'[^'\n]+'|`[^`\n]+`|\S+)/g
|
||||
|
||||
function textFromUnknown(value: unknown, depth = 0): string {
|
||||
if (typeof value === 'string') {
|
||||
@@ -435,6 +435,7 @@ export function upsertToolPart(
|
||||
if (index === -1) {
|
||||
return [...next, base]
|
||||
}
|
||||
|
||||
next[index] = { ...next[index], ...base }
|
||||
|
||||
return next
|
||||
|
||||
@@ -39,6 +39,8 @@ export function createClientSessionState(
|
||||
return {
|
||||
storedSessionId,
|
||||
messages,
|
||||
branch: '',
|
||||
cwd: '',
|
||||
busy: false,
|
||||
awaitingResponse: false,
|
||||
streamId: null,
|
||||
@@ -145,6 +147,10 @@ export function pathLabel(path: string): string {
|
||||
}
|
||||
|
||||
export function attachmentDisplayText(attachment: ComposerAttachment): string | null {
|
||||
if (attachment.kind === 'terminal' && attachment.detail) {
|
||||
return `\`\`\`terminal\n${attachment.detail.trim()}\n\`\`\``
|
||||
}
|
||||
|
||||
if (attachment.refText) {
|
||||
return attachment.refText
|
||||
}
|
||||
|
||||
@@ -190,4 +190,4 @@ export {
|
||||
Zap
|
||||
}
|
||||
|
||||
export type { LucideIcon } from 'lucide-react'
|
||||
export type { Icon as IconComponent } from '@tabler/icons-react'
|
||||
|
||||
@@ -49,6 +49,65 @@ export function sanitizeLanguageTag(tag: string): string {
|
||||
return VALID_LANGUAGE_RE.test(first) && first.length <= 16 ? first.toLowerCase() : ''
|
||||
}
|
||||
|
||||
// Sanitized language tag → codicon glyph. Anything not listed falls back to
|
||||
// the generic `code` glyph, which matches what the tool-row icons use.
|
||||
const CODICON_BY_LANGUAGE: Record<string, string> = {
|
||||
bash: 'terminal',
|
||||
cmd: 'terminal',
|
||||
console: 'terminal',
|
||||
fish: 'terminal',
|
||||
powershell: 'terminal',
|
||||
ps1: 'terminal',
|
||||
sh: 'terminal',
|
||||
shell: 'terminal',
|
||||
zsh: 'terminal',
|
||||
|
||||
md: 'markdown',
|
||||
markdown: 'markdown',
|
||||
|
||||
json: 'json',
|
||||
json5: 'json',
|
||||
|
||||
ini: 'settings-gear',
|
||||
toml: 'settings-gear',
|
||||
yaml: 'settings-gear',
|
||||
yml: 'settings-gear',
|
||||
dotenv: 'settings-gear',
|
||||
env: 'settings-gear',
|
||||
|
||||
graphql: 'database',
|
||||
gql: 'database',
|
||||
mysql: 'database',
|
||||
postgres: 'database',
|
||||
postgresql: 'database',
|
||||
sql: 'database',
|
||||
sqlite: 'database',
|
||||
|
||||
diff: 'diff',
|
||||
patch: 'diff',
|
||||
|
||||
css: 'symbol-color',
|
||||
less: 'symbol-color',
|
||||
sass: 'symbol-color',
|
||||
scss: 'symbol-color',
|
||||
svg: 'symbol-color',
|
||||
|
||||
regex: 'regex',
|
||||
regexp: 'regex',
|
||||
|
||||
curl: 'globe',
|
||||
http: 'globe',
|
||||
|
||||
docker: 'package',
|
||||
dockerfile: 'package',
|
||||
|
||||
mermaid: 'graph'
|
||||
}
|
||||
|
||||
export function codiconForLanguage(language: string | undefined): string {
|
||||
return CODICON_BY_LANGUAGE[sanitizeLanguageTag(language || '')] || 'code'
|
||||
}
|
||||
|
||||
function proseLineCount(body: string): number {
|
||||
return body.split('\n').filter(line => {
|
||||
const trimmed = line.trim()
|
||||
|
||||
Reference in New Issue
Block a user