feat(webui): debug-console shared primitives, data layer, task manager

Phase 3 of the debug-console expansion — the Apple-HIG foundation the
new tabs build on (reusing the existing ui kit; new controls match its
idiom, no browser-native widgets).

API client + types:
- debug.invokeStream() reads /api/debug/invoke-stream via fetch + a body
  reader, parsing data:<json> SSE frames (header auth, cancellable).
- debug.upload() streams a file via XHR for real upload progress.
- DebugActionParam.role, DebugActionDoc.stream/invariants, FieldRole,
  DebugStreamFrame, DebugUploadResult.

Primitives:
- Tabs (sliding indicator + roving tabindex), Picker (searchable,
  windowed combobox with a raw-value escape hatch), JsonTree (collapsible
  response viewer, image-url preview, copy w/ http fallback, node cap),
  FileSource (URL / server-path / browser-upload tri-state), FaceGrid.

Infra:
- DebugTaskProvider + TaskBadge: app-level registry of in-flight upload/
  stream tasks so they survive in-app tab switches, with a global
  progress chip and a beforeunload guard; eviction never drops a running
  task. Wired into App.
- use-debug-contacts: lazy friend/group/member data layer, shared module
  cache + localStorage (version-stamped, avatars stripped to dodge quota)
  + TTL + request-id race guard, degrading to raw input on error.

Adversarially reviewed (no automated component tests): virtualization
math and SSE framing verified correct; fixed the stale-contacts-on-switch
member-selection hazard, the quota-kills-persistence issue, and several
low UX edges (active-row clamp, filter scroll reset, copy fallback).
This commit is contained in:
DrSmoothl committed 2026-06-30 16:53:43 +08:00
1 parent a7667f1cd5
commit c5611ed622
12 files changed
+1188 -2

No files matched your search

+6 -1
View File
@@ -7,6 +7,8 @@ import { LoginPage } from '@/components/pages/login-page';
import { ChangePasswordPage } from '@/components/pages/change-password-page';
import { ConsentPage } from '@/components/pages/consent-page';
import { ApiProvider, createApiClient, useApi, type ApiClient } from '@/lib/api';
import { DebugTaskProvider } from '@/contexts/DebugTaskContext';
import { TaskBadge } from '@/components/debug/task-badge';
import type { AgreementsPayload } from '@/lib/api/types';
import { appRouter } from '@/router';
@@ -132,7 +134,10 @@ function AuthBoundary() {
return (
<ApiProvider client={client}>
<TooltipProvider delayDuration={150}>{view}</TooltipProvider>
<DebugTaskProvider>
<TooltipProvider delayDuration={150}>{view}</TooltipProvider>
<TaskBadge />
</DebugTaskProvider>
</ApiProvider>
);
}