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,207 +0,0 @@
|
|
|
1
|
-
import { ApiClientError } from '@bazilion/client'
|
|
2
|
-
import type {
|
|
3
|
-
Agent,
|
|
4
|
-
ListInboxResponse,
|
|
5
|
-
Message,
|
|
6
|
-
ResolvedAgent,
|
|
7
|
-
} from '@bazilion/api-types'
|
|
8
|
-
import { createFileRoute, redirect } from '@tanstack/react-router'
|
|
9
|
-
import { createServerFn } from '@tanstack/react-start'
|
|
10
|
-
import { AgentTabs } from '../../../components/AgentTabs'
|
|
11
|
-
import { daemonClient } from '../../../lib/daemon-client'
|
|
12
|
-
|
|
13
|
-
interface InboxView {
|
|
14
|
-
resolved: ResolvedAgent
|
|
15
|
-
messages: Message[]
|
|
16
|
-
unreadCount: number
|
|
17
|
-
selected: Message | null
|
|
18
|
-
agentNames: Record<string, string>
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const fetchInbox = createServerFn({ method: 'POST' })
|
|
22
|
-
.inputValidator((d: { id: string; unreadOnly: boolean; selectedId: string }) => d)
|
|
23
|
-
.handler(async ({ data }): Promise<InboxView | null> => {
|
|
24
|
-
const c = daemonClient()
|
|
25
|
-
let resolved: ResolvedAgent
|
|
26
|
-
try {
|
|
27
|
-
resolved = await c.get<ResolvedAgent>(`/api/agents/${encodeURIComponent(data.id)}`)
|
|
28
|
-
} catch (err) {
|
|
29
|
-
if (err instanceof ApiClientError && err.status === 404) return null
|
|
30
|
-
throw err
|
|
31
|
-
}
|
|
32
|
-
const inboxQs = data.unreadOnly ? '?unread=1' : ''
|
|
33
|
-
const [list, unread, allAgents] = await Promise.all([
|
|
34
|
-
c.get<ListInboxResponse>(
|
|
35
|
-
`/api/agents/${encodeURIComponent(resolved.agent.id)}/messages${inboxQs}`,
|
|
36
|
-
),
|
|
37
|
-
c.get<ListInboxResponse>(
|
|
38
|
-
`/api/agents/${encodeURIComponent(resolved.agent.id)}/messages?unread=1`,
|
|
39
|
-
),
|
|
40
|
-
c.get<Agent[]>('/api/agents?includeArchived=true'),
|
|
41
|
-
])
|
|
42
|
-
let selected: Message | null = null
|
|
43
|
-
if (data.selectedId) {
|
|
44
|
-
try {
|
|
45
|
-
selected = await c.get<Message>(`/api/messages/${encodeURIComponent(data.selectedId)}`)
|
|
46
|
-
} catch (err) {
|
|
47
|
-
if (!(err instanceof ApiClientError) || err.status !== 404) throw err
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const agentNames: Record<string, string> = {}
|
|
51
|
-
for (const a of allAgents) agentNames[a.id] = a.name
|
|
52
|
-
return {
|
|
53
|
-
resolved,
|
|
54
|
-
messages: [...list.messages].reverse(),
|
|
55
|
-
unreadCount: unread.messages.length,
|
|
56
|
-
selected,
|
|
57
|
-
agentNames,
|
|
58
|
-
}
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
export const Route = createFileRoute('/agents/$id/inbox')({
|
|
62
|
-
validateSearch: (s: Record<string, unknown>): { unread?: '1'; id?: string } => ({
|
|
63
|
-
unread: s.unread === '1' ? '1' : undefined,
|
|
64
|
-
id: typeof s.id === 'string' ? s.id : undefined,
|
|
65
|
-
}),
|
|
66
|
-
loaderDeps: ({ search }) => ({
|
|
67
|
-
unreadOnly: search.unread === '1',
|
|
68
|
-
selectedId: search.id ?? '',
|
|
69
|
-
}),
|
|
70
|
-
loader: async ({ params, deps }) => {
|
|
71
|
-
const data = await fetchInbox({ data: { id: params.id, ...deps } })
|
|
72
|
-
if (!data) throw redirect({ to: '/agents' })
|
|
73
|
-
return data
|
|
74
|
-
},
|
|
75
|
-
component: InboxPage,
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
function decodeText(payload: string): string {
|
|
79
|
-
try {
|
|
80
|
-
const obj = JSON.parse(payload) as { text?: unknown }
|
|
81
|
-
if (typeof obj.text === 'string') return obj.text
|
|
82
|
-
} catch {}
|
|
83
|
-
return payload
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function InboxPage() {
|
|
87
|
-
const { resolved, messages, unreadCount, selected, agentNames } = Route.useLoaderData()
|
|
88
|
-
const search = Route.useSearch()
|
|
89
|
-
const unreadOnly = search.unread === '1'
|
|
90
|
-
const misaddressed = Boolean(selected && selected.toAgentId !== resolved.agent.id)
|
|
91
|
-
|
|
92
|
-
function agentLabel(aid: string): string {
|
|
93
|
-
const name = agentNames[aid]
|
|
94
|
-
return name ? `${name} (${aid.slice(0, 8)})` : aid.slice(0, 8)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<main className="mx-auto max-w-5xl px-6 py-8">
|
|
99
|
-
<h1 className="font-serif text-3xl text-foreground mb-1">{resolved.agent.name}</h1>
|
|
100
|
-
<p className="text-xs text-muted-foreground mb-6">
|
|
101
|
-
<code className="font-mono">{resolved.agent.id.slice(0, 8)}…</code> · unread: {unreadCount}
|
|
102
|
-
</p>
|
|
103
|
-
<AgentTabs
|
|
104
|
-
agentId={resolved.agent.id}
|
|
105
|
-
active="inbox"
|
|
106
|
-
archived={resolved.agent.status === 'archived'}
|
|
107
|
-
/>
|
|
108
|
-
|
|
109
|
-
<div className="grid grid-cols-1 md:grid-cols-[360px_1fr] gap-6">
|
|
110
|
-
<div>
|
|
111
|
-
<div className="flex gap-1 border-b mb-3">
|
|
112
|
-
<a
|
|
113
|
-
href={`/agents/${resolved.agent.id}/inbox`}
|
|
114
|
-
className={`px-3 py-1.5 text-sm border-b-2 -mb-px ${
|
|
115
|
-
!unreadOnly
|
|
116
|
-
? 'border-primary text-primary font-semibold'
|
|
117
|
-
: 'border-transparent text-muted-foreground'
|
|
118
|
-
}`}
|
|
119
|
-
>
|
|
120
|
-
all
|
|
121
|
-
</a>
|
|
122
|
-
<a
|
|
123
|
-
href={`/agents/${resolved.agent.id}/inbox?unread=1`}
|
|
124
|
-
className={`px-3 py-1.5 text-sm border-b-2 -mb-px ${
|
|
125
|
-
unreadOnly
|
|
126
|
-
? 'border-primary text-primary font-semibold'
|
|
127
|
-
: 'border-transparent text-muted-foreground'
|
|
128
|
-
}`}
|
|
129
|
-
>
|
|
130
|
-
unread
|
|
131
|
-
</a>
|
|
132
|
-
</div>
|
|
133
|
-
<div className="rounded-lg border bg-card max-h-[640px] overflow-y-auto">
|
|
134
|
-
{messages.length === 0 ? (
|
|
135
|
-
<div className="p-6 text-center text-muted-foreground italic">
|
|
136
|
-
{unreadOnly ? 'no unread messages' : 'inbox empty'}
|
|
137
|
-
</div>
|
|
138
|
-
) : (
|
|
139
|
-
messages.map((m) => {
|
|
140
|
-
const text = decodeText(m.payload)
|
|
141
|
-
const preview = text.length > 80 ? `${text.slice(0, 80)}…` : text
|
|
142
|
-
const when = new Date(m.createdAt).toLocaleString()
|
|
143
|
-
const isActive = selected?.id === m.id
|
|
144
|
-
const isUnread = m.readAt === null
|
|
145
|
-
const qs = unreadOnly ? `?unread=1&id=${m.id}` : `?id=${m.id}`
|
|
146
|
-
return (
|
|
147
|
-
<a
|
|
148
|
-
key={m.id}
|
|
149
|
-
href={`/agents/${resolved.agent.id}/inbox${qs}`}
|
|
150
|
-
className={`block border-b last:border-0 px-3 py-2 text-sm hover:bg-accent/30 ${
|
|
151
|
-
isActive ? 'bg-accent/40' : ''
|
|
152
|
-
} ${isUnread ? 'font-medium' : ''}`}
|
|
153
|
-
>
|
|
154
|
-
<div className="flex justify-between text-xs text-muted-foreground">
|
|
155
|
-
<span className="font-mono">
|
|
156
|
-
{isUnread && (
|
|
157
|
-
<span className="inline-block w-1.5 h-1.5 rounded-full bg-primary mr-1.5 align-middle" />
|
|
158
|
-
)}
|
|
159
|
-
from {agentLabel(m.fromAgentId)}
|
|
160
|
-
</span>
|
|
161
|
-
<span className="font-mono">{when}</span>
|
|
162
|
-
</div>
|
|
163
|
-
<div className="text-foreground mt-0.5 truncate">{preview}</div>
|
|
164
|
-
</a>
|
|
165
|
-
)
|
|
166
|
-
})
|
|
167
|
-
)}
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
|
|
171
|
-
<div>
|
|
172
|
-
{selected && !misaddressed && (
|
|
173
|
-
<div className="rounded-lg border bg-card p-5 mb-4">
|
|
174
|
-
<div className="font-mono text-xs text-muted-foreground mb-2 space-y-0.5">
|
|
175
|
-
<div>id: <code>{selected.id}</code></div>
|
|
176
|
-
<div>from: <code>{agentLabel(selected.fromAgentId)}</code></div>
|
|
177
|
-
<div>received: {new Date(selected.createdAt).toLocaleString()}</div>
|
|
178
|
-
<div>
|
|
179
|
-
read:{' '}
|
|
180
|
-
{selected.readAt ? new Date(selected.readAt).toLocaleString() : '(unread)'}
|
|
181
|
-
</div>
|
|
182
|
-
{selected.replyTo && (
|
|
183
|
-
<div>
|
|
184
|
-
reply to: <code>{selected.replyTo}</code>
|
|
185
|
-
</div>
|
|
186
|
-
)}
|
|
187
|
-
</div>
|
|
188
|
-
<div className="border-t pt-3 font-mono text-sm whitespace-pre-wrap break-words">
|
|
189
|
-
{decodeText(selected.payload)}
|
|
190
|
-
</div>
|
|
191
|
-
</div>
|
|
192
|
-
)}
|
|
193
|
-
{misaddressed && (
|
|
194
|
-
<div className="rounded-lg border bg-card p-5 mb-4 text-muted-foreground">
|
|
195
|
-
message is not addressed to this agent
|
|
196
|
-
</div>
|
|
197
|
-
)}
|
|
198
|
-
<p className="text-xs text-muted-foreground">
|
|
199
|
-
Agents exchange messages automatically via their{' '}
|
|
200
|
-
<code className="font-mono">send_message</code> tool. An idle recipient's scheduler
|
|
201
|
-
tick drains unread mail.
|
|
202
|
-
</p>
|
|
203
|
-
</div>
|
|
204
|
-
</div>
|
|
205
|
-
</main>
|
|
206
|
-
)
|
|
207
|
-
}
|