mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 13:55:50 +00:00
Squashed 5 commits: Features (from 5 feature branches): - MCP fix, pipe mute, stub recovery - KAIROS activation, openclaw autonomy - Daemon/job command hierarchy + cross-platform bg engine Upstream fixes: - fix: Bun.hash compatibility - chore: chrome dependency update - docs: browser support guide MIME detection fix: - Screenshot detectMimeFromBase64(): decode raw bytes from base64 instead of broken charCodeAt comparison - Fixes API 400 on Windows (JPEG) and macOS (PNG) screenshots
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import { logForDebugging } from '../utils/debug.js'
|
|
|
|
/**
|
|
* Minimal session type for assistant discovery.
|
|
* Only `id` is consumed by main.tsx (L4757); other fields are for chooser display.
|
|
* ID format is `session_*` (compat prefix) — viewer endpoints use /v1/sessions/*.
|
|
*/
|
|
export type AssistantSession = {
|
|
id: string
|
|
title: string
|
|
status: string
|
|
created_at: string
|
|
}
|
|
|
|
/**
|
|
* Discover assistant sessions on Anthropic CCR.
|
|
*
|
|
* Reuses the existing fetchCodeSessionsFromSessionsAPI() which calls
|
|
* GET /v1/sessions with proper OAuth + anthropic-beta headers.
|
|
*
|
|
* Throws on failure — main.tsx L4720-4725 catch displays the error.
|
|
* Does NOT return [] on error (that would silently redirect to install wizard).
|
|
*/
|
|
export async function discoverAssistantSessions(): Promise<AssistantSession[]> {
|
|
const { fetchCodeSessionsFromSessionsAPI } = await import(
|
|
'../utils/teleport/api.js'
|
|
)
|
|
|
|
let allSessions
|
|
try {
|
|
allSessions = await fetchCodeSessionsFromSessionsAPI()
|
|
} catch (err) {
|
|
logForDebugging(
|
|
`[assistant:discovery] fetchCodeSessionsFromSessionsAPI failed: ${err}`,
|
|
)
|
|
throw err
|
|
}
|
|
|
|
// Filter to active/working sessions only — completed/archived are not attachable
|
|
return allSessions
|
|
.filter(
|
|
s =>
|
|
s.status === 'idle' || s.status === 'working' || s.status === 'waiting',
|
|
)
|
|
.map(s => ({
|
|
id: s.id,
|
|
title: s.title || 'Untitled',
|
|
status: s.status,
|
|
created_at: s.created_at ?? '',
|
|
}))
|
|
}
|