A room is one conversation, one ssh sandbox, and one agent. Accounts create rooms; friends join through a single-use invite link and a display name; the agent speaks only through the message tool. The server is Axum and SQLite. It serves the built Nuxt client, streams room events over SSE, and runs one serialized turn loop per room with turn-level steering copied from rhema-code. The client has the chat, preview iframe, read-only file pane, xterm terminal, and presence. Preview URLs are signed wildcard hosts, and the proxy tunnels HTTP over ssh direct-tcpip. HostAgent::step remains deferred in the framework.
50 lines
1.7 KiB
Vue
50 lines
1.7 KiB
Vue
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
import type { Message } from '~/types'
|
|
import { fullTime, relativeTime } from '~/utils/format'
|
|
import { memberColorVar } from '~/utils/member'
|
|
|
|
const props = defineProps<{ message: Message; color?: string | null }>()
|
|
|
|
const segments = computed(() => {
|
|
const parts = props.message.text.split(/(@rhema\b)/gi)
|
|
return parts
|
|
.filter((part) => part.length > 0)
|
|
.map((part) => ({ text: part, mention: /^@rhema$/i.test(part) }))
|
|
})
|
|
|
|
const style = computed(() => ({ '--member': memberColorVar(props.color) }))
|
|
</script>
|
|
|
|
<template>
|
|
<div v-if="message.author_kind === 'system'" class="msg msg-system">
|
|
{{ message.text }}
|
|
</div>
|
|
|
|
<div v-else-if="message.author_kind === 'agent'" class="msg msg-agent">
|
|
<div class="msg-head">
|
|
<span class="msg-agent-label">rhema</span>
|
|
<span class="msg-time" :title="fullTime(message.created_at)">{{ relativeTime(message.created_at) }}</span>
|
|
</div>
|
|
<div class="msg-text">
|
|
<template v-for="(segment, index) in segments" :key="index">
|
|
<span v-if="segment.mention" class="mention">{{ segment.text }}</span>
|
|
<template v-else>{{ segment.text }}</template>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
|
|
<div v-else class="msg">
|
|
<div class="msg-head">
|
|
<span class="msg-author member-name" :style="style">{{ message.author_name }}</span>
|
|
<span class="msg-time" :title="fullTime(message.created_at)">{{ relativeTime(message.created_at) }}</span>
|
|
</div>
|
|
<div class="msg-text">
|
|
<template v-for="(segment, index) in segments" :key="index">
|
|
<span v-if="segment.mention" class="mention">{{ segment.text }}</span>
|
|
<template v-else>{{ segment.text }}</template>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
</template>
|