Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/druks/usage/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ class Usage(Extension):
name = "usage"
icon = "gauge"
description = "Harness usage metering — quota and spend per account."
builtin = True
6 changes: 6 additions & 0 deletions backend/tests/test_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ def test_iter_extensions_discovers_the_bundled_extensions():
assert {extension.name for extension in iter_extensions()} >= {"core", "ship", "usage"}


def test_platform_extensions_are_builtin():
"""``builtin`` is what keeps a platform surface out of the shell's app switcher."""
builtin = {extension.name for extension in iter_extensions() if extension.builtin}
assert builtin >= {"core", "usage"}


def test_ship_app_derives_its_package_from_the_defining_module():
ship = next(extension for extension in iter_extensions() if extension.name == "ship")
assert ship.package == "druks.contrib.ship"
Expand Down
16 changes: 9 additions & 7 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,8 @@ function AppShell() {
<main className="extension-main" data-extension={extension ?? undefined}>
{wantsStrip && health && <SystemStrip health={health} />}
<Switch>
{registered.flatMap((name) =>
(getExtensionUI(name)?.routes ?? []).map((route) => (
<Route key={`${name}:${route.path}`} path={route.path}>
{(params) => route.render(params as Record<string, string>)}
</Route>
)),
)}
{/* Shell-owned paths first, so an extension named after one of them can't
shadow the platform surface. */}
<Route path="/usage">
<UsagePage />
</Route>
Expand All @@ -220,6 +215,13 @@ function AppShell() {
<Route path="/browser-sessions/:sessionId/login">
{(params) => <LoginWindowPage sessionId={params.sessionId} />}
</Route>
{registered.flatMap((name) =>
(getExtensionUI(name)?.routes ?? []).map((route) => (
<Route key={`${name}:${route.path}`} path={route.path}>
{(params) => route.render(params as Record<string, string>)}
</Route>
)),
)}
<Route>
<NotFound />
</Route>
Expand Down