bazilion 0.0.0 → 0.1.0
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.
- package/README.md +53 -152
- package/dist/cli.js +2730 -0
- package/dist/cli.js.map +1 -0
- package/dist/daemon.js +5888 -0
- package/dist/daemon.js.map +1 -0
- package/dist/worker.js +1830 -0
- package/dist/worker.js.map +1 -0
- package/package.json +57 -28
- package/.understand-anything/.understandignore +0 -25
- package/.understand-anything/fingerprints.json +0 -14267
- package/.understand-anything/knowledge-graph.json +0 -18128
- package/.understand-anything/meta.json +0 -6
- package/CLAUDE.md +0 -164
- package/apps/cli/package.json +0 -21
- package/apps/cli/src/auth-file.ts +0 -18
- package/apps/cli/src/client.ts +0 -37
- package/apps/cli/src/columnize.ts +0 -32
- package/apps/cli/src/commands/agent.ts +0 -574
- package/apps/cli/src/commands/auth.ts +0 -110
- package/apps/cli/src/commands/backup.ts +0 -135
- package/apps/cli/src/commands/completion.ts +0 -155
- package/apps/cli/src/commands/config.ts +0 -95
- package/apps/cli/src/commands/doctor.ts +0 -131
- package/apps/cli/src/commands/group.ts +0 -132
- package/apps/cli/src/commands/inbox.ts +0 -82
- package/apps/cli/src/commands/login.ts +0 -73
- package/apps/cli/src/commands/memory.ts +0 -106
- package/apps/cli/src/commands/profile.ts +0 -259
- package/apps/cli/src/commands/provider.ts +0 -170
- package/apps/cli/src/commands/send.ts +0 -24
- package/apps/cli/src/commands/serve.ts +0 -89
- package/apps/cli/src/commands/skill.ts +0 -120
- package/apps/cli/src/commands/token.ts +0 -148
- package/apps/cli/src/commands/trigger.ts +0 -129
- package/apps/cli/src/commands/uninstall.ts +0 -156
- package/apps/cli/src/index.ts +0 -196
- package/apps/cli/src/paths.ts +0 -12
- package/apps/cli/test/agent.test.ts +0 -213
- package/apps/cli/test/backup.test.ts +0 -95
- package/apps/cli/test/chat.test.ts +0 -539
- package/apps/cli/test/columnize.test.ts +0 -29
- package/apps/cli/test/completion.test.ts +0 -45
- package/apps/cli/test/config-page.test.ts +0 -151
- package/apps/cli/test/group.test.ts +0 -74
- package/apps/cli/test/helpers.ts +0 -70
- package/apps/cli/test/inbox-autodeliver.test.ts +0 -143
- package/apps/cli/test/inbox.test.ts +0 -147
- package/apps/cli/test/memory.test.ts +0 -69
- package/apps/cli/test/profile.test.ts +0 -110
- package/apps/cli/test/send.test.ts +0 -30
- package/apps/cli/test/server-fixture.ts +0 -212
- package/apps/cli/test/session-head.test.ts +0 -45
- package/apps/cli/test/skill.test.ts +0 -128
- package/apps/cli/test/token.test.ts +0 -109
- package/apps/cli/test/trigger.test.ts +0 -245
- package/apps/cli/tsconfig.json +0 -4
- package/apps/daemon/package.json +0 -31
- package/apps/daemon/src/app.ts +0 -41
- package/apps/daemon/src/core/agent/archive.ts +0 -8
- package/apps/daemon/src/core/agent/delete.ts +0 -30
- package/apps/daemon/src/core/agent/resolve.ts +0 -31
- package/apps/daemon/src/core/agent/spawn.ts +0 -95
- package/apps/daemon/src/core/agent/unarchive.ts +0 -11
- package/apps/daemon/src/core/availableModels.ts +0 -58
- package/apps/daemon/src/core/db/client.ts +0 -113
- package/apps/daemon/src/core/db/migrate.ts +0 -41
- package/apps/daemon/src/core/db/migrations/0001_init.sql +0 -179
- package/apps/daemon/src/core/group/delete.ts +0 -21
- package/apps/daemon/src/core/group/register.ts +0 -68
- package/apps/daemon/src/core/index.ts +0 -71
- package/apps/daemon/src/core/paths.ts +0 -56
- package/apps/daemon/src/core/profile/create.ts +0 -78
- package/apps/daemon/src/core/profile/delete.ts +0 -26
- package/apps/daemon/src/core/profile/identity.ts +0 -70
- package/apps/daemon/src/core/profile/load.ts +0 -45
- package/apps/daemon/src/core/profile/seed.ts +0 -74
- package/apps/daemon/src/core/profile/templates.ts +0 -60
- package/apps/daemon/src/core/profile/update.ts +0 -57
- package/apps/daemon/src/core/profile/validate.ts +0 -9
- package/apps/daemon/src/core/repos/agents.ts +0 -202
- package/apps/daemon/src/core/repos/config.ts +0 -78
- package/apps/daemon/src/core/repos/groups.ts +0 -55
- package/apps/daemon/src/core/repos/messages.ts +0 -127
- package/apps/daemon/src/core/repos/profiles.ts +0 -83
- package/apps/daemon/src/core/repos/providerModels.ts +0 -58
- package/apps/daemon/src/core/repos/providerState.ts +0 -37
- package/apps/daemon/src/core/repos/secrets.ts +0 -145
- package/apps/daemon/src/core/repos/skillMeta.ts +0 -49
- package/apps/daemon/src/core/repos/triggers.ts +0 -101
- package/apps/daemon/src/core/repos/webTokens.ts +0 -87
- package/apps/daemon/src/core/secrets.ts +0 -65
- package/apps/daemon/src/core/services.ts +0 -264
- package/apps/daemon/src/core/skills/discover.ts +0 -28
- package/apps/daemon/src/core/skills/import.ts +0 -136
- package/apps/daemon/src/core/skills/parse.ts +0 -52
- package/apps/daemon/src/core/skills/resolve.ts +0 -50
- package/apps/daemon/src/index.ts +0 -45
- package/apps/daemon/src/lib/agent-cancel.ts +0 -48
- package/apps/daemon/src/lib/agent-id.ts +0 -13
- package/apps/daemon/src/lib/agent-turn.ts +0 -56
- package/apps/daemon/src/lib/api-key.ts +0 -56
- package/apps/daemon/src/lib/auth.ts +0 -41
- package/apps/daemon/src/lib/cron.ts +0 -93
- package/apps/daemon/src/lib/ctx.ts +0 -80
- package/apps/daemon/src/lib/messaging-host.ts +0 -34
- package/apps/daemon/src/lib/middleware-auth.ts +0 -52
- package/apps/daemon/src/lib/scheduler.ts +0 -294
- package/apps/daemon/src/routes/agents.ts +0 -772
- package/apps/daemon/src/routes/auth-login.ts +0 -193
- package/apps/daemon/src/routes/config.ts +0 -267
- package/apps/daemon/src/routes/groups.ts +0 -133
- package/apps/daemon/src/routes/messages.ts +0 -29
- package/apps/daemon/src/routes/misc.ts +0 -239
- package/apps/daemon/src/routes/profiles.ts +0 -197
- package/apps/daemon/src/routes/skills.ts +0 -123
- package/apps/daemon/src/routes/triggers.ts +0 -29
- package/apps/daemon/src/runtime/auth/openai-codex.ts +0 -121
- package/apps/daemon/src/runtime/auto-reply/heartbeat.ts +0 -31
- package/apps/daemon/src/runtime/index.ts +0 -77
- package/apps/daemon/src/runtime/memory/files.ts +0 -103
- package/apps/daemon/src/runtime/memory/qmd.ts +0 -152
- package/apps/daemon/src/runtime/memory/types.ts +0 -16
- package/apps/daemon/src/runtime/pi/events.ts +0 -173
- package/apps/daemon/src/runtime/pi/session.ts +0 -536
- package/apps/daemon/src/runtime/pi/tools.ts +0 -85
- package/apps/daemon/src/runtime/providers/catalog.ts +0 -145
- package/apps/daemon/src/runtime/providers/pi-adapter.ts +0 -272
- package/apps/daemon/src/runtime/providers/registry.ts +0 -374
- package/apps/daemon/src/runtime/providers/retry.ts +0 -176
- package/apps/daemon/src/runtime/providers/types.ts +0 -33
- package/apps/daemon/src/runtime/session/prompt.ts +0 -83
- package/apps/daemon/src/runtime/tools/bootstrap.ts +0 -22
- package/apps/daemon/src/runtime/tools/home.ts +0 -114
- package/apps/daemon/src/runtime/tools/memory.ts +0 -81
- package/apps/daemon/src/runtime/tools/messaging.ts +0 -127
- package/apps/daemon/src/runtime/tools/registry.ts +0 -29
- package/apps/daemon/src/runtime/tools/types.ts +0 -13
- package/apps/daemon/src/runtime/tools/web-extract.ts +0 -110
- package/apps/daemon/src/runtime/tools/web-ssrf.ts +0 -245
- package/apps/daemon/src/runtime/tools/web.ts +0 -273
- package/apps/daemon/src/runtime/worker/entry.ts +0 -221
- package/apps/daemon/src/runtime/worker/ipc-protocol.ts +0 -75
- package/apps/daemon/src/runtime/worker/spawn.ts +0 -249
- package/apps/daemon/test/core/agents.test.ts +0 -319
- package/apps/daemon/test/core/available-models.test.ts +0 -63
- package/apps/daemon/test/core/config.test.ts +0 -99
- package/apps/daemon/test/core/groups.test.ts +0 -63
- package/apps/daemon/test/core/helpers.ts +0 -50
- package/apps/daemon/test/core/identity.test.ts +0 -85
- package/apps/daemon/test/core/migrations.test.ts +0 -83
- package/apps/daemon/test/core/profiles.test.ts +0 -182
- package/apps/daemon/test/core/provider-models.test.ts +0 -57
- package/apps/daemon/test/core/provider-state.test.ts +0 -36
- package/apps/daemon/test/core/skill-meta.test.ts +0 -45
- package/apps/daemon/test/core/skills.test.ts +0 -271
- package/apps/daemon/test/core/triggers.test.ts +0 -182
- package/apps/daemon/test/core/web-tokens.test.ts +0 -79
- package/apps/daemon/test/cron.test.ts +0 -90
- package/apps/daemon/test/runtime/heartbeat.test.ts +0 -34
- package/apps/daemon/test/runtime/memory-qmd.test.ts +0 -97
- package/apps/daemon/test/runtime/memory.test.ts +0 -78
- package/apps/daemon/test/runtime/messaging.test.ts +0 -213
- package/apps/daemon/test/runtime/mock-server.ts +0 -65
- package/apps/daemon/test/runtime/openai-codex-auth.test.ts +0 -116
- package/apps/daemon/test/runtime/providers.test.ts +0 -306
- package/apps/daemon/test/runtime/retry.test.ts +0 -191
- package/apps/daemon/test/runtime/session-head.test.ts +0 -90
- package/apps/daemon/test/runtime/tools-home.test.ts +0 -102
- package/apps/daemon/test/runtime/tools-web.test.ts +0 -206
- package/apps/daemon/tsconfig.json +0 -4
- package/apps/mobile/README.md +0 -60
- package/apps/mobile/app/_layout.tsx +0 -58
- package/apps/mobile/app/agents/[id]/chat.tsx +0 -486
- package/apps/mobile/app/agents/[id]/index.tsx +0 -166
- package/apps/mobile/app/agents/index.tsx +0 -212
- package/apps/mobile/app/index.tsx +0 -21
- package/apps/mobile/app/pair.tsx +0 -226
- package/apps/mobile/app/settings.tsx +0 -419
- package/apps/mobile/app.json +0 -49
- package/apps/mobile/assets/adaptive-icon.png +0 -0
- package/apps/mobile/assets/favicon.png +0 -0
- package/apps/mobile/assets/icon.png +0 -0
- package/apps/mobile/assets/splash-icon.png +0 -0
- package/apps/mobile/babel.config.js +0 -6
- package/apps/mobile/metro.config.js +0 -28
- package/apps/mobile/package.json +0 -44
- package/apps/mobile/src/auth.ts +0 -66
- package/apps/mobile/src/pair-url.ts +0 -48
- package/apps/mobile/src/theme-context.tsx +0 -88
- package/apps/mobile/src/theme.ts +0 -135
- package/apps/mobile/test/pair-url.test.ts +0 -46
- package/apps/mobile/tsconfig.json +0 -23
- package/apps/web/components.json +0 -25
- package/apps/web/package.json +0 -39
- package/apps/web/public/baziu.svg +0 -8
- package/apps/web/src/components/AgentTabs.tsx +0 -45
- package/apps/web/src/components/BaziuLogo.tsx +0 -21
- package/apps/web/src/components/ChatPane.tsx +0 -1033
- package/apps/web/src/components/ConfigTabs.tsx +0 -29
- package/apps/web/src/components/CopyButton.tsx +0 -68
- package/apps/web/src/components/CreateGroupDialog.tsx +0 -127
- package/apps/web/src/components/FieldRow.tsx +0 -94
- package/apps/web/src/components/Footer.tsx +0 -10
- package/apps/web/src/components/PawIcon.tsx +0 -15
- package/apps/web/src/components/Sidebar.tsx +0 -287
- package/apps/web/src/components/SpawnDialog.tsx +0 -129
- package/apps/web/src/components/ThemeToggle.tsx +0 -75
- package/apps/web/src/components/TopNav.tsx +0 -34
- package/apps/web/src/components/ui/button.tsx +0 -67
- package/apps/web/src/components/ui/card.tsx +0 -103
- package/apps/web/src/components/ui/checkbox.tsx +0 -31
- package/apps/web/src/components/ui/dialog.tsx +0 -168
- package/apps/web/src/components/ui/input.tsx +0 -19
- package/apps/web/src/components/ui/label.tsx +0 -22
- package/apps/web/src/components/ui/radio-group.tsx +0 -44
- package/apps/web/src/components/ui/select.tsx +0 -192
- package/apps/web/src/components/ui/separator.tsx +0 -26
- package/apps/web/src/components/ui/table.tsx +0 -116
- package/apps/web/src/components/ui/tabs.tsx +0 -88
- package/apps/web/src/components/ui/textarea.tsx +0 -18
- package/apps/web/src/lib/auth.ts +0 -50
- package/apps/web/src/lib/daemon-client.ts +0 -34
- package/apps/web/src/lib/md.ts +0 -45
- package/apps/web/src/lib/utils.ts +0 -6
- package/apps/web/src/lib/wire-constants.ts +0 -27
- package/apps/web/src/routeTree.gen.ts +0 -408
- package/apps/web/src/router.tsx +0 -20
- package/apps/web/src/routes/__root.tsx +0 -123
- package/apps/web/src/routes/agents/$id/inbox.tsx +0 -207
- package/apps/web/src/routes/agents/$id/index.tsx +0 -527
- package/apps/web/src/routes/agents/$id/triggers.tsx +0 -239
- package/apps/web/src/routes/agents/index.tsx +0 -265
- package/apps/web/src/routes/api/$.ts +0 -88
- package/apps/web/src/routes/config/index.tsx +0 -315
- package/apps/web/src/routes/config/services.tsx +0 -49
- package/apps/web/src/routes/config/tokens.tsx +0 -192
- package/apps/web/src/routes/groups/$id/index.tsx +0 -153
- package/apps/web/src/routes/groups/$id/memory.tsx +0 -321
- package/apps/web/src/routes/groups/index.tsx +0 -191
- package/apps/web/src/routes/index.tsx +0 -133
- package/apps/web/src/routes/login.tsx +0 -63
- package/apps/web/src/routes/profiles/$id.tsx +0 -549
- package/apps/web/src/routes/profiles/index.tsx +0 -458
- package/apps/web/src/routes/skills/index.tsx +0 -297
- package/apps/web/src/routes/welcome.tsx +0 -61
- package/apps/web/src/styles.css +0 -449
- package/apps/web/tsconfig.json +0 -25
- package/apps/web/vite.config.ts +0 -25
- package/biome.json +0 -23
- package/docs/agent-engine.md +0 -219
- package/docs/architecture.md +0 -627
- package/docs/backlog/README.md +0 -42
- package/docs/backlog/draft/BAZ-001-a2a-federation-spike.md +0 -125
- package/docs/openclaw-reference.md +0 -210
- package/packages/api-types/package.json +0 -11
- package/packages/api-types/src/entities.ts +0 -146
- package/packages/api-types/src/events.ts +0 -55
- package/packages/api-types/src/index.ts +0 -488
- package/packages/api-types/src/memory.ts +0 -15
- package/packages/client/package.json +0 -13
- package/packages/client/src/index.ts +0 -117
- package/pnpm-workspace.yaml +0 -3
- package/tsconfig.base.json +0 -23
- package/tsconfig.json +0 -11
- package/vitest.config.ts +0 -22
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { ApiClientError } from '@bazilion/client'
|
|
2
|
-
import type {
|
|
3
|
-
Agent,
|
|
4
|
-
Group,
|
|
5
|
-
Profile,
|
|
6
|
-
ProviderMessage,
|
|
7
|
-
ResolvedAgent,
|
|
8
|
-
SessionHeadResponse,
|
|
9
|
-
} from '@bazilion/api-types'
|
|
10
|
-
import { createFileRoute } from '@tanstack/react-router'
|
|
11
|
-
import { createServerFn } from '@tanstack/react-start'
|
|
12
|
-
import { getCookie } from '@tanstack/react-start/server'
|
|
13
|
-
import { ChatPane } from '../components/ChatPane'
|
|
14
|
-
import { Sidebar, SIDEBAR_OPEN_GROUPS_COOKIE } from '../components/Sidebar'
|
|
15
|
-
import { daemonClient } from '../lib/daemon-client'
|
|
16
|
-
|
|
17
|
-
interface SelectedView {
|
|
18
|
-
resolved: ResolvedAgent
|
|
19
|
-
initialMessages: ProviderMessage[]
|
|
20
|
-
sessionHead: SessionHeadResponse
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface HomeData {
|
|
24
|
-
agents: Agent[]
|
|
25
|
-
profiles: Profile[]
|
|
26
|
-
groups: Group[]
|
|
27
|
-
selected: SelectedView | null
|
|
28
|
-
initialOpenGroups: Record<string, boolean>
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Pure parser so the rule lives next to the cookie name. getCookie may or may
|
|
32
|
-
// not URL-decode depending on the harness; handle either form defensively.
|
|
33
|
-
function parseOpenGroupsCookie(raw: string | undefined | null): Record<string, boolean> {
|
|
34
|
-
if (!raw) return {}
|
|
35
|
-
try {
|
|
36
|
-
const decoded = raw.includes('%') ? decodeURIComponent(raw) : raw
|
|
37
|
-
const parsed = JSON.parse(decoded) as unknown
|
|
38
|
-
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
39
|
-
const out: Record<string, boolean> = {}
|
|
40
|
-
for (const [k, v] of Object.entries(parsed as Record<string, unknown>)) {
|
|
41
|
-
if (typeof v === 'boolean') out[k] = v
|
|
42
|
-
}
|
|
43
|
-
return out
|
|
44
|
-
}
|
|
45
|
-
} catch {
|
|
46
|
-
// bad cookie value — fall through to {}
|
|
47
|
-
}
|
|
48
|
-
return {}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// POST so we can pass a typed input via `.inputValidator()`. The call site
|
|
52
|
-
// is server-internal so the HTTP verb is invisible to the user.
|
|
53
|
-
const fetchHomeData = createServerFn({ method: 'POST' })
|
|
54
|
-
.inputValidator((d: { agentId?: string }) => d)
|
|
55
|
-
.handler(async ({ data }): Promise<HomeData> => {
|
|
56
|
-
const client = daemonClient()
|
|
57
|
-
const [agents, profiles, groups] = await Promise.all([
|
|
58
|
-
client.get<Agent[]>('/api/agents?includeArchived=false'),
|
|
59
|
-
client.get<Profile[]>('/api/profiles'),
|
|
60
|
-
client.get<Group[]>('/api/groups'),
|
|
61
|
-
])
|
|
62
|
-
|
|
63
|
-
const initialOpenGroups = parseOpenGroupsCookie(getCookie(SIDEBAR_OPEN_GROUPS_COOKIE))
|
|
64
|
-
|
|
65
|
-
let selected: SelectedView | null = null
|
|
66
|
-
if (data.agentId) {
|
|
67
|
-
try {
|
|
68
|
-
const resolved = await client.get<ResolvedAgent>(
|
|
69
|
-
`/api/agents/${encodeURIComponent(data.agentId)}`,
|
|
70
|
-
)
|
|
71
|
-
const [msgs, head] = await Promise.all([
|
|
72
|
-
client.get<{ messages: ProviderMessage[] }>(
|
|
73
|
-
`/api/agents/${encodeURIComponent(resolved.agent.id)}/sessions/messages`,
|
|
74
|
-
),
|
|
75
|
-
client.get<SessionHeadResponse>(
|
|
76
|
-
`/api/agents/${encodeURIComponent(resolved.agent.id)}/sessions/head`,
|
|
77
|
-
),
|
|
78
|
-
])
|
|
79
|
-
selected = {
|
|
80
|
-
resolved,
|
|
81
|
-
initialMessages: msgs.messages,
|
|
82
|
-
sessionHead: head,
|
|
83
|
-
}
|
|
84
|
-
} catch (err) {
|
|
85
|
-
// 404 = bad ?agent= id. Drop the selection silently and render the
|
|
86
|
-
// empty pane; surface other errors so the user sees them.
|
|
87
|
-
if (!(err instanceof ApiClientError) || err.status !== 404) throw err
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return { agents, profiles, groups, selected, initialOpenGroups }
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
export const Route = createFileRoute('/')({
|
|
94
|
-
validateSearch: (s: Record<string, unknown>): { agent?: string } => ({
|
|
95
|
-
agent: typeof s.agent === 'string' ? s.agent : undefined,
|
|
96
|
-
}),
|
|
97
|
-
loaderDeps: ({ search }) => ({ agentId: search.agent }),
|
|
98
|
-
loader: ({ deps }) => fetchHomeData({ data: { agentId: deps.agentId } }),
|
|
99
|
-
component: HomePage,
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
function HomePage() {
|
|
103
|
-
const data = Route.useLoaderData()
|
|
104
|
-
const selectedAgentId = data.selected?.resolved.agent.id ?? null
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
<div className="grid h-full grid-cols-1 gap-3 py-3 sm:grid-cols-[16rem_minmax(0,1fr)]">
|
|
108
|
-
<Sidebar
|
|
109
|
-
agents={data.agents}
|
|
110
|
-
groups={data.groups}
|
|
111
|
-
profiles={data.profiles}
|
|
112
|
-
selectedAgentId={selectedAgentId}
|
|
113
|
-
initialOpenGroups={data.initialOpenGroups}
|
|
114
|
-
/>
|
|
115
|
-
<main className="overflow-hidden">
|
|
116
|
-
{data.selected ? (
|
|
117
|
-
<ChatPane
|
|
118
|
-
agentId={data.selected.resolved.agent.id}
|
|
119
|
-
agentName={data.selected.resolved.agent.name}
|
|
120
|
-
initialMessages={data.selected.initialMessages}
|
|
121
|
-
initialSessionHead={data.selected.sessionHead}
|
|
122
|
-
/>
|
|
123
|
-
) : (
|
|
124
|
-
<div className="flex h-full items-center justify-center rounded-lg border border-dashed bg-card text-muted-foreground">
|
|
125
|
-
{data.agents.length === 0
|
|
126
|
-
? 'No agents yet.'
|
|
127
|
-
: 'Pick an agent on the left to start chatting.'}
|
|
128
|
-
</div>
|
|
129
|
-
)}
|
|
130
|
-
</main>
|
|
131
|
-
</div>
|
|
132
|
-
)
|
|
133
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { createFileRoute } from '@tanstack/react-router'
|
|
2
|
-
import { BaziuLogo } from '../components/BaziuLogo'
|
|
3
|
-
import { PawIcon } from '../components/PawIcon'
|
|
4
|
-
|
|
5
|
-
export const Route = createFileRoute('/login')({
|
|
6
|
-
// Optional `?error=1` from a failed POST /api/login redirect — daemon sends
|
|
7
|
-
// the user back here when the form token is invalid. We type it as fully
|
|
8
|
-
// optional so the redirect from the root middleware doesn't have to pass a
|
|
9
|
-
// search object.
|
|
10
|
-
validateSearch: (search: Record<string, unknown>): { error?: '1' } => ({
|
|
11
|
-
error: search.error === '1' ? '1' : undefined,
|
|
12
|
-
}),
|
|
13
|
-
component: LoginPage,
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
function LoginPage() {
|
|
17
|
-
const { error } = Route.useSearch()
|
|
18
|
-
return (
|
|
19
|
-
<main className="relative flex min-h-dvh items-center justify-center bg-cream">
|
|
20
|
-
{/* Soft radial glows — Baziu's signature warmth on the auth shell. */}
|
|
21
|
-
<div
|
|
22
|
-
aria-hidden="true"
|
|
23
|
-
className="pointer-events-none absolute inset-0"
|
|
24
|
-
style={{
|
|
25
|
-
background:
|
|
26
|
-
'radial-gradient(circle at 20% 15%, rgba(74,124,155,0.12), transparent 55%), radial-gradient(circle at 80% 85%, rgba(196,135,138,0.10), transparent 55%)',
|
|
27
|
-
}}
|
|
28
|
-
/>
|
|
29
|
-
<div className="relative w-full max-w-sm rounded-[16px] border border-frost bg-snow p-8 text-center shadow-baziu-md">
|
|
30
|
-
<BaziuLogo className="mx-auto mb-3 h-16 w-16" />
|
|
31
|
-
<h1 className="font-display text-[2rem] tracking-tight text-charcoal">bazilion</h1>
|
|
32
|
-
{error && <div className="err mt-4">invalid token</div>}
|
|
33
|
-
<form method="POST" action="/api/login" className="mt-6 text-left">
|
|
34
|
-
<label htmlFor="token" className="block text-[0.85em] font-medium text-mocha">
|
|
35
|
-
Token
|
|
36
|
-
</label>
|
|
37
|
-
<input
|
|
38
|
-
type="password"
|
|
39
|
-
id="token"
|
|
40
|
-
name="token"
|
|
41
|
-
// biome-ignore lint/a11y/noAutofocus: a single-input login page is the canonical case for autofocus.
|
|
42
|
-
autoFocus
|
|
43
|
-
required
|
|
44
|
-
placeholder="paste from auth.json"
|
|
45
|
-
className="mb-5"
|
|
46
|
-
/>
|
|
47
|
-
<button type="submit" className="w-full">
|
|
48
|
-
log in
|
|
49
|
-
</button>
|
|
50
|
-
</form>
|
|
51
|
-
<p className="mt-5 text-[0.78em] leading-relaxed text-mocha-light">
|
|
52
|
-
Your token is in <code>~/.bazilion/auth.json</code>
|
|
53
|
-
<br />
|
|
54
|
-
created on first <code>bazilion serve</code>
|
|
55
|
-
</p>
|
|
56
|
-
</div>
|
|
57
|
-
<footer className="absolute bottom-4 left-0 right-0 text-center text-[0.78em] text-fawn">
|
|
58
|
-
dedicated to Baziu
|
|
59
|
-
<PawIcon className="ml-1 inline-block h-3 w-3 align-[-1px] opacity-40" />
|
|
60
|
-
</footer>
|
|
61
|
-
</main>
|
|
62
|
-
)
|
|
63
|
-
}
|