@bridgebrew/bridge-settings 0.0.0-stage → 0.0.2

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.
@@ -0,0 +1,433 @@
1
+ // Logs (bridge#222): every log file under `<root>/logs/` in one screen of Admin's System section. On top, the records
2
+ // (`/_bridge/logs/events`, older pages on Load older), filtered by workspace (a removed one too, until its files
3
+ // expire), plugin, subject, level, time and a searched text, live, and exported as JSON Lines (`/_bridge/logs/export`,
4
+ // the view's own Export). Beside them, the settings of every log file (`/_bridge/host/logs`): its rotation and how long
5
+ // its archives are kept, with the earliest day still held and a warning when the size cap cut the history short. `item`: `settings` opens the settings (Health's
6
+ // trimmed-history fix links there), else `<workspace>[/<plugin>[/<subject>]]` sets the filters (a plugin's Open in Logs).
7
+ import * as React from 'react';
8
+ import {
9
+ Button,
10
+ Card,
11
+ Field,
12
+ FieldDescription,
13
+ FieldLabel,
14
+ Icon,
15
+ Input,
16
+ ScrollArea,
17
+ Section,
18
+ Select,
19
+ SelectContent,
20
+ SelectItem,
21
+ SelectTrigger,
22
+ SelectValue,
23
+ Skeleton,
24
+ readJson,
25
+ refusalOf,
26
+ useToast,
27
+ formatDate,
28
+ isComposing,
29
+ } from '@bridge/ui';
30
+ import { LogView } from '@bridgebrew/plugin-manager/logs';
31
+ import { sentence } from '@bridgebrew/plugin-manager/model';
32
+ import type { Context } from 'cordis';
33
+
34
+ type Key = 'rotation' | 'rotateMB' | 'keepDays' | 'capMB';
35
+ type Settings = { rotation: 'daily' | 'weekly'; rotateMB: number; keepDays: number; capMB: number };
36
+ /** `/_bridge/host/logs`: the values in force, the saved ones, who sets each, and what the last sweep found. */
37
+ export interface LogSettingsView {
38
+ value: Settings;
39
+ saved: Partial<Settings>;
40
+ setBy: Record<Key, 'config' | 'setting' | 'default'>;
41
+ retention?: { earliest?: string; oldestDays: number; capped: boolean; bytes: number };
42
+ hint?: string;
43
+ }
44
+
45
+ /** All of the tree, the host's own lines, or one workspace's. */
46
+ const ALL = '*';
47
+ const HOST = '~host';
48
+ /** Every plugin of the workspace. */
49
+ const ANY = '*';
50
+ const spans = [
51
+ { id: 'all', label: 'Any time', ms: undefined },
52
+ { id: 'hour', label: 'Last hour', ms: 3_600_000 },
53
+ { id: 'day', label: 'Last 24 hours', ms: 86_400_000 },
54
+ { id: 'week', label: 'Last 7 days', ms: 7 * 86_400_000 },
55
+ ] as const;
56
+ type Span = (typeof spans)[number]['id'];
57
+
58
+ const numberFields: { key: Exclude<Key, 'rotation'>; label: string; description: string }[] = [
59
+ {
60
+ key: 'rotateMB',
61
+ label: 'Size guard (MB)',
62
+ description: 'A file past this size rotates before its period ends.',
63
+ },
64
+ {
65
+ key: 'keepDays',
66
+ label: 'Keep (days)',
67
+ description: 'Archives older than this are deleted: the history goes back up to this far.',
68
+ },
69
+ {
70
+ key: 'capMB',
71
+ label: 'Total cap (MB)',
72
+ description: 'Every log file and archive together; past it the oldest archives go first.',
73
+ },
74
+ ];
75
+
76
+ const megabytes = (bytes: number) => `${Math.round((bytes / (1024 * 1024)) * 10) / 10} MB`;
77
+ const dayLabel = (iso: string) =>
78
+ formatDate(`${iso}T00:00:00Z`, {
79
+ day: 'numeric',
80
+ month: 'long',
81
+ year: 'numeric',
82
+ timeZone: 'UTC',
83
+ });
84
+
85
+ /** The filters an item names: `<workspace>[/<plugin>[/<subject>]]`. */
86
+ const filtersOf = (item: string | undefined) => {
87
+ if (item === undefined || item === 'settings') return {};
88
+ const [workspace, plugin, subject] = item.split('/').map((part) => decodeURIComponent(part));
89
+ return { workspace, plugin, subject };
90
+ };
91
+
92
+ export function SystemLogs({ ctx, item }: { ctx: Context; item?: string | undefined }) {
93
+ const { workspace } = ctx;
94
+ const initial = filtersOf(item);
95
+ const [source, setSource] = React.useState(initial.workspace ?? ALL);
96
+ const [plugin, setPlugin] = React.useState(initial.plugin ?? ANY);
97
+ const [subject, setSubject] = React.useState(initial.subject ?? '');
98
+ /** What the subject field holds while typed; applied on Enter or when it loses focus. */
99
+ const [subjectDraft, setSubjectDraft] = React.useState(initial.subject ?? '');
100
+ const [span, setSpan] = React.useState<Span>('all');
101
+ /** The span's start, fixed when it is chosen: a moving start would reopen the stream. */
102
+ const [since, setSince] = React.useState<string>();
103
+ const [sources, setSources] = React.useState<{ workspace: string; plugins: string[] }[]>([]);
104
+ const [settingsOpen, setSettingsOpen] = React.useState(item === 'settings');
105
+ const [view, setView] = React.useState<LogSettingsView>();
106
+ // The breadcrumb names the item as a person reads it.
107
+ React.useEffect(() => {
108
+ if (item === 'settings') ctx.screen?.title?.('settings', 'Settings');
109
+ else if (item !== undefined)
110
+ ctx.screen?.title?.(
111
+ item,
112
+ [initial.workspace, initial.plugin, initial.subject].filter(Boolean).join(' · '),
113
+ );
114
+ }, [ctx, item]);
115
+ React.useEffect(() => {
116
+ void workspace
117
+ .fetch('/_bridge/logs/sources', { cache: 'no-store' })
118
+ .then(readJson)
119
+ .then(
120
+ (body) => setSources((body as { sources: typeof sources }).sources),
121
+ () => setSources([]),
122
+ );
123
+ }, [workspace]);
124
+ const loadSettings = React.useCallback(
125
+ () =>
126
+ workspace
127
+ .fetch('/_bridge/host/logs', { cache: 'no-store' })
128
+ .then(readJson)
129
+ .then((body) => setView(body as LogSettingsView)),
130
+ [workspace],
131
+ );
132
+ React.useEffect(() => {
133
+ void loadSettings().catch(() => setView(undefined));
134
+ }, [loadSettings]);
135
+
136
+ const plugins = sources.find((each) => each.workspace === source)?.plugins ?? [];
137
+ const params = {
138
+ ...(source !== HOST && { workspace: source }),
139
+ ...(source !== HOST && source !== ALL && plugin !== ANY && { plugin }),
140
+ ...(subject && { subject }),
141
+ ...(since !== undefined && { since }),
142
+ };
143
+ const retention = view?.retention;
144
+
145
+ return (
146
+ <section
147
+ aria-label="Screen"
148
+ data-system="logs"
149
+ className="flex min-h-0 flex-1 flex-col overflow-hidden [:where(&)_:is(p,ul,h1,h2)]:m-0"
150
+ >
151
+ <h1 className="sr-only">Logs</h1>
152
+ <div className="mx-auto flex min-h-0 w-full max-w-[1200px] flex-1">
153
+ <ScrollArea
154
+ className="min-h-0 min-w-0 flex-1"
155
+ viewportClassName="[&>[data-slot=scroll-area-content]]:min-w-0!"
156
+ >
157
+ <div className="box-border flex w-full flex-col gap-4 px-4 pb-16 pt-5">
158
+ <Section
159
+ size="lg"
160
+ title="Logs"
161
+ description={
162
+ <>
163
+ <span data-retention="">
164
+ {retention?.earliest
165
+ ? `Kept since ${dayLabel(retention.earliest)}, up to ${view!.value.keepDays} days · ${megabytes(retention.bytes)} of ${view!.value.capMB} MB`
166
+ : 'Every log of Bridge, of each workspace and each plugin, in one place.'}
167
+ </span>
168
+ {retention?.capped && (
169
+ <span role="note" data-capped="" className="block text-warning-text">
170
+ {`The ${view!.value.capMB} MB cap cut the history to ${retention.oldestDays} days: raise the cap to keep ${view!.value.keepDays}.`}
171
+ </span>
172
+ )}
173
+ </>
174
+ }
175
+ actions={
176
+ <Button
177
+ variant={settingsOpen ? 'property' : 'outline'}
178
+ size="sm"
179
+ aria-expanded={settingsOpen}
180
+ onClick={() => setSettingsOpen(!settingsOpen)}
181
+ >
182
+ <Icon name="settings" size={13} />
183
+ Settings
184
+ </Button>
185
+ }
186
+ />
187
+ {settingsOpen && (
188
+ <LogSettings
189
+ ctx={ctx}
190
+ view={view}
191
+ onSaved={(next) => setView(next)}
192
+ onRetry={() => void loadSettings().catch(() => setView(undefined))}
193
+ />
194
+ )}
195
+ <div role="group" aria-label="Filters" className="flex flex-wrap items-center gap-2">
196
+ <Select
197
+ items={{
198
+ [ALL]: 'Everything',
199
+ [HOST]: 'Bridge itself',
200
+ ...Object.fromEntries(sources.map(({ workspace: slug }) => [slug, slug])),
201
+ }}
202
+ value={source}
203
+ onValueChange={(value) => {
204
+ if (typeof value !== 'string') return;
205
+ setSource(value);
206
+ setPlugin(ANY);
207
+ }}
208
+ >
209
+ <SelectTrigger aria-label="Workspace" className="w-[200px]">
210
+ <SelectValue />
211
+ </SelectTrigger>
212
+ <SelectContent>
213
+ <SelectItem value={ALL}>Everything</SelectItem>
214
+ <SelectItem value={HOST}>Bridge itself</SelectItem>
215
+ {sources.map(({ workspace: slug }) => (
216
+ <SelectItem key={slug} value={slug}>
217
+ {slug}
218
+ </SelectItem>
219
+ ))}
220
+ </SelectContent>
221
+ </Select>
222
+ <Select
223
+ items={{
224
+ [ANY]: 'Every plugin',
225
+ ...Object.fromEntries(plugins.map((key) => [key, key])),
226
+ }}
227
+ value={plugin}
228
+ disabled={source === ALL || source === HOST}
229
+ onValueChange={(value) => typeof value === 'string' && setPlugin(value)}
230
+ >
231
+ <SelectTrigger aria-label="Plugin" className="w-[200px]">
232
+ <SelectValue />
233
+ </SelectTrigger>
234
+ <SelectContent>
235
+ <SelectItem value={ANY}>Every plugin</SelectItem>
236
+ {plugins.map((key) => (
237
+ <SelectItem key={key} value={key}>
238
+ {key}
239
+ </SelectItem>
240
+ ))}
241
+ </SelectContent>
242
+ </Select>
243
+ <Input
244
+ variant="outline"
245
+ aria-label="Subject"
246
+ placeholder="Subject, e.g. task:8f3c"
247
+ className="w-[220px]"
248
+ value={subjectDraft}
249
+ onChange={(event) => setSubjectDraft(event.currentTarget.value)}
250
+ onBlur={() => setSubject(subjectDraft.trim())}
251
+ onKeyDown={(event) =>
252
+ event.key === 'Enter' && !isComposing(event) && setSubject(subjectDraft.trim())
253
+ }
254
+ />
255
+ <Select
256
+ items={Object.fromEntries(spans.map((each) => [each.id, each.label]))}
257
+ value={span}
258
+ onValueChange={(value) => {
259
+ const chosen = spans.find((each) => each.id === value);
260
+ if (!chosen) return;
261
+ setSpan(chosen.id);
262
+ setSince(
263
+ chosen.ms === undefined
264
+ ? undefined
265
+ : new Date(Date.now() - chosen.ms).toISOString(),
266
+ );
267
+ }}
268
+ >
269
+ <SelectTrigger aria-label="Time" className="w-[160px]">
270
+ <SelectValue />
271
+ </SelectTrigger>
272
+ <SelectContent>
273
+ {spans.map((each) => (
274
+ <SelectItem key={each.id} value={each.id}>
275
+ {each.label}
276
+ </SelectItem>
277
+ ))}
278
+ </SelectContent>
279
+ </Select>
280
+ </div>
281
+ <LogView
282
+ stream={workspace.stream as Parameters<typeof LogView>[0]['stream']}
283
+ fetch={(path) => workspace.fetch(path, { cache: 'no-store' })}
284
+ params={params}
285
+ title="Bridge"
286
+ empty="No record matches these filters."
287
+ showSource
288
+ />
289
+ </div>
290
+ </ScrollArea>
291
+ </div>
292
+ </section>
293
+ );
294
+ }
295
+
296
+ /** The settings of every log file: inline, above the records. A value host.yml sets is locked ("Set by host.yml"). */
297
+ function LogSettings({
298
+ ctx,
299
+ view,
300
+ onSaved,
301
+ onRetry,
302
+ }: {
303
+ ctx: Context;
304
+ view: LogSettingsView | undefined;
305
+ onSaved: (view: LogSettingsView) => void;
306
+ onRetry: () => void;
307
+ }) {
308
+ const { workspace } = ctx;
309
+ const { toast } = useToast();
310
+ const [draft, setDraft] = React.useState<Record<Key, string>>();
311
+ const [saving, setSaving] = React.useState(false);
312
+ const [failure, setFailure] = React.useState<{ message: string; hint?: string }>();
313
+ React.useEffect(() => {
314
+ if (view)
315
+ setDraft({
316
+ rotation: view.value.rotation,
317
+ rotateMB: String(view.value.rotateMB),
318
+ keepDays: String(view.value.keepDays),
319
+ capMB: String(view.value.capMB),
320
+ });
321
+ }, [view]);
322
+ const save = async () => {
323
+ if (!view || !draft) return;
324
+ setSaving(true);
325
+ setFailure(undefined);
326
+ try {
327
+ // Only the fields this screen may set: the ones host.yml sets stay out.
328
+ const value = Object.fromEntries(
329
+ (['rotation', 'rotateMB', 'keepDays', 'capMB'] as const)
330
+ .filter((key) => view.setBy[key] !== 'config')
331
+ .map((key) => [key, key === 'rotation' ? draft.rotation : Number(draft[key])]),
332
+ );
333
+ const res = await workspace.fetch('/_bridge/host/logs', {
334
+ method: 'PUT',
335
+ headers: { 'content-type': 'application/json' },
336
+ body: JSON.stringify({ value }),
337
+ });
338
+ if (!res.ok) {
339
+ setFailure(refusalOf(await res.json().catch(() => undefined), res.status));
340
+ return;
341
+ }
342
+ const next = (await readJson(res)) as LogSettingsView;
343
+ onSaved(next);
344
+ toast({
345
+ variant: 'success',
346
+ title: 'Log settings saved',
347
+ ...(next.hint !== undefined && { description: next.hint }),
348
+ });
349
+ } catch (cause) {
350
+ setFailure({ message: (cause as Error).message });
351
+ } finally {
352
+ setSaving(false);
353
+ }
354
+ };
355
+ return (
356
+ <Card data-log-settings="" size="lg" className="flex flex-col gap-4">
357
+ <p className="text-[13px] leading-5 text-secondary">
358
+ For every log file: Bridge's, each workspace's and plugin's, Health's, and the raw files
359
+ (service.err, restart.log). Applied at once.
360
+ </p>
361
+ {!view || !draft ? (
362
+ view === undefined && failure === undefined ? (
363
+ <div className="grid grid-cols-2 gap-4" aria-busy="true">
364
+ {[0, 1, 2, 3].map((each) => (
365
+ <Skeleton key={each} className="h-[60px] w-full" />
366
+ ))}
367
+ </div>
368
+ ) : (
369
+ <Button variant="outline" size="sm" onClick={onRetry}>
370
+ Retry
371
+ </Button>
372
+ )
373
+ ) : (
374
+ <div className="grid grid-cols-1 gap-4 md:grid-cols-2">
375
+ <Field disabled={view.setBy.rotation === 'config'}>
376
+ <FieldLabel>Rotation</FieldLabel>
377
+ <Select
378
+ items={{ daily: 'Daily', weekly: 'Weekly' }}
379
+ value={draft.rotation}
380
+ onValueChange={(value) =>
381
+ typeof value === 'string' && setDraft({ ...draft, rotation: value })
382
+ }
383
+ >
384
+ <SelectTrigger aria-label="Rotation">
385
+ <SelectValue />
386
+ </SelectTrigger>
387
+ <SelectContent>
388
+ <SelectItem value="daily">Daily</SelectItem>
389
+ <SelectItem value="weekly">Weekly</SelectItem>
390
+ </SelectContent>
391
+ </Select>
392
+ <FieldDescription className="text-secondary">
393
+ {view.setBy.rotation === 'config'
394
+ ? 'Set by host.yml.'
395
+ : 'Each file starts a new archive every day (UTC) or every Monday.'}
396
+ </FieldDescription>
397
+ </Field>
398
+ {numberFields.map(({ key, label, description }) => (
399
+ <Field key={key} disabled={view.setBy[key] === 'config'}>
400
+ <FieldLabel>{label}</FieldLabel>
401
+ <Input
402
+ variant="outline"
403
+ type="number"
404
+ aria-label={label}
405
+ value={draft[key]}
406
+ onChange={(event) => setDraft({ ...draft, [key]: event.currentTarget.value })}
407
+ />
408
+ <FieldDescription className="text-secondary">
409
+ {view.setBy[key] === 'config' ? 'Set by host.yml.' : description}
410
+ </FieldDescription>
411
+ </Field>
412
+ ))}
413
+ </div>
414
+ )}
415
+ {failure && (
416
+ <p role="alert" className="text-[13px] text-destructive">
417
+ {sentence(failure.message)}
418
+ {failure.hint && <span className="block text-xs text-secondary">{failure.hint}</span>}
419
+ </p>
420
+ )}
421
+ <div className="flex justify-end">
422
+ <Button
423
+ variant="primary"
424
+ size="sm"
425
+ disabled={saving || !view || !draft}
426
+ onClick={() => void save()}
427
+ >
428
+ {saving ? 'Saving…' : 'Save'}
429
+ </Button>
430
+ </div>
431
+ </Card>
432
+ );
433
+ }
@@ -0,0 +1,165 @@
1
+ // Plugin install (research-062, experimental): how a new plugin installed from a folder joins its running workspace,
2
+ // Bridge settings' `pluginInstallMode` (`/_bridge/host/plugin-install`). Live: added to the running worker, no restart,
3
+ // running sessions keep going; restart: the workspace restarts, after the running turns. Either way a plugin whose
4
+ // code changes what every plugin shares is refused. `BRIDGE_LIVE_ADD` set when Bridge started locks the choice.
5
+ import * as React from 'react';
6
+ import { Badge, Button, ScrollArea, Section, cn, readJson, refusalOf, useToast } from '@bridge/ui';
7
+ import type { Context } from 'cordis';
8
+ import { sentence } from '@bridgebrew/plugin-manager/model';
9
+
10
+ type Mode = 'live' | 'restart';
11
+ type View = { mode: Mode; saved: Mode; setBy: 'env' | 'setting' | 'default' };
12
+
13
+ const modes: { id: Mode; title: string; text: string }[] = [
14
+ {
15
+ id: 'live',
16
+ title: 'Add it live',
17
+ text: 'A new plugin is added to its running workspace: no restart, open pages show it without a reload, running sessions keep going. One that cannot be added live (it defines a contract, needs npm dependencies installed first…) still restarts the workspace, and says why.',
18
+ },
19
+ {
20
+ id: 'restart',
21
+ title: 'Restart the workspace',
22
+ text: 'A new plugin is added by restarting its workspace, once the running agent turns have ended.',
23
+ },
24
+ ];
25
+
26
+ export function SystemPluginInstall({ ctx }: { ctx: Context }) {
27
+ const { workspace } = ctx;
28
+ const { toast } = useToast();
29
+ const [view, setView] = React.useState<View>();
30
+ const [choice, setChoice] = React.useState<Mode>();
31
+ const [failure, setFailure] = React.useState<{ message: string; hint?: string }>();
32
+ const [saving, setSaving] = React.useState(false);
33
+ React.useEffect(() => {
34
+ void workspace
35
+ .fetch('/_bridge/host/plugin-install', { cache: 'no-store' })
36
+ .then(readJson)
37
+ .then(
38
+ (body) => {
39
+ const next = body as View;
40
+ setView(next);
41
+ setChoice(next.mode);
42
+ },
43
+ (cause: Error) => setFailure({ message: cause.message }),
44
+ );
45
+ }, []);
46
+ const locked = view?.setBy === 'env';
47
+ const save = async () => {
48
+ if (!choice) return;
49
+ setSaving(true);
50
+ setFailure(undefined);
51
+ try {
52
+ const res = await workspace.fetch('/_bridge/host/plugin-install', {
53
+ method: 'PUT',
54
+ headers: { 'content-type': 'application/json' },
55
+ body: JSON.stringify({ mode: choice }),
56
+ });
57
+ if (!res.ok) {
58
+ setFailure(refusalOf(await res.json().catch(() => undefined), res.status));
59
+ return;
60
+ }
61
+ setView((await readJson(res)) as View);
62
+ toast({ variant: 'success', title: 'Plugin install saved' });
63
+ } catch (cause) {
64
+ setFailure({ message: (cause as Error).message });
65
+ } finally {
66
+ setSaving(false);
67
+ }
68
+ };
69
+ return (
70
+ <section
71
+ aria-label="Screen"
72
+ data-system="plugin-install"
73
+ className="flex min-h-0 flex-1 flex-col overflow-hidden [:where(&)_:is(p,ul,h1,h2)]:m-0"
74
+ >
75
+ <h1 className="sr-only">Plugin install</h1>
76
+ <div className="mx-auto flex min-h-0 w-full max-w-[968px] flex-1">
77
+ <ScrollArea
78
+ className="min-h-0 min-w-0 flex-1"
79
+ viewportClassName="[&>[data-slot=scroll-area-content]]:min-w-0!"
80
+ >
81
+ <div className="box-border flex w-full max-w-[720px] flex-col gap-5 px-4 pb-16 pt-5">
82
+ <Section
83
+ size="lg"
84
+ title={
85
+ <span className="flex items-center gap-2">
86
+ How a new plugin joins its workspace
87
+ <Badge
88
+ data-experimental
89
+ title="A trial: it may change or go away"
90
+ className="h-4 px-1.5 text-[11px] bg-warning-subtle text-warning-text"
91
+ >
92
+ Experimental
93
+ </Badge>
94
+ </span>
95
+ }
96
+ description="For a plugin installed from a folder, in every workspace. Either way, a plugin whose code changes what every plugin shares (the global object, built-ins, process.env…) is refused."
97
+ />
98
+ {locked && (
99
+ <p
100
+ role="note"
101
+ data-set-by="env"
102
+ className="rounded-default bg-hover px-3 py-2 text-[13px] leading-5 text-secondary"
103
+ >
104
+ Set by BRIDGE_LIVE_ADD when Bridge started. Start it without BRIDGE_LIVE_ADD to
105
+ choose here.
106
+ </p>
107
+ )}
108
+ {view && (
109
+ <div role="radiogroup" aria-label="Plugin install" className="flex flex-col gap-2">
110
+ {modes.map((mode) => (
111
+ <button
112
+ key={mode.id}
113
+ type="button"
114
+ role="radio"
115
+ aria-checked={choice === mode.id}
116
+ data-mode={mode.id}
117
+ disabled={locked || saving}
118
+ onClick={() => setChoice(mode.id)}
119
+ className="flex cursor-pointer items-start gap-3 rounded-default border border-border bg-surface px-4 py-3 text-left font-[inherit] outline-hidden hover:bg-hover focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-default disabled:opacity-70 aria-checked:border-accent"
120
+ >
121
+ <span
122
+ aria-hidden="true"
123
+ className={cn(
124
+ 'mt-1 size-3 shrink-0 rounded-full border border-input',
125
+ choice === mode.id && 'border-[4px] border-accent',
126
+ )}
127
+ />
128
+ <span className="flex flex-col gap-0.5">
129
+ <span className="text-sm font-medium text-foreground">
130
+ {mode.title}
131
+ {view.mode === mode.id && (
132
+ <span className="ml-2 text-xs font-normal text-muted">now</span>
133
+ )}
134
+ </span>
135
+ <span className="text-xs leading-5 text-secondary">{mode.text}</span>
136
+ </span>
137
+ </button>
138
+ ))}
139
+ </div>
140
+ )}
141
+ {failure && (
142
+ <p role="alert" className="text-[13px] text-destructive">
143
+ {sentence(failure.message)}
144
+ {failure.hint && (
145
+ <span className="block text-xs text-secondary">{failure.hint}</span>
146
+ )}
147
+ </p>
148
+ )}
149
+ {view && !locked && (
150
+ <div className="flex justify-end">
151
+ <Button
152
+ variant="primary"
153
+ disabled={saving || choice === view.mode}
154
+ onClick={() => void save()}
155
+ >
156
+ Save
157
+ </Button>
158
+ </div>
159
+ )}
160
+ </div>
161
+ </ScrollArea>
162
+ </div>
163
+ </section>
164
+ );
165
+ }
@@ -0,0 +1,14 @@
1
+ import type { Context } from 'cordis';
2
+ import { ScrollArea } from '@bridge/ui';
3
+ import { HarnessProfiles } from '@bridgebrew/plugin-manager/harness-profiles';
4
+
5
+ export function SystemProviders({ ctx }: { ctx: Context }) {
6
+ return (
7
+ <section aria-label="Screen" className="flex min-h-0 flex-1 flex-col overflow-hidden">
8
+ <h1 className="sr-only">Harness</h1>
9
+ <ScrollArea className="min-h-0 flex-1">
10
+ <HarnessProfiles ctx={ctx} root="_host" node="root" scopeLabel="Bridge" />
11
+ </ScrollArea>
12
+ </section>
13
+ );
14
+ }