android / debug (push) Successful in 2m22s
android / release (push) Successful in 2m7s
ci / checks (push) Successful in 3m48s
ci / test (push) Successful in 2m9s
ci / chart (push) Successful in 7s
ci / docker (push) Successful in 1m51s
ci / web (push) Successful in 18s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (push) Successful in 2m5s
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (push) Successful in 15s
ci / publish-edge-chart (push) Successful in 5s
The General page exposed Mark, Initials, and Tagline even though the new shell renders none of them, and a callout explained an identity split that no longer needed saying. The About identity block still drew a green tile with an R. General now edits name, email, and sign-off only. Its save payload omits the retired fields, so values already stored stay untouched. AgentAvatar keeps just the avatar image and the name's initial; the sidebar tooltip now carries the display name. About renders the uploaded logo, or the Rhema mark when none is set. README follows. nuxt typecheck and build pass; General and About checked in light and dark.
268 lines
7.0 KiB
Vue
268 lines
7.0 KiB
Vue
<script setup lang="ts">
|
|
// The Agent · General page: the identity editor. The text fields save
|
|
// as a whole (empty clears, absent is untouched claw-side); the images
|
|
// apply the moment a file is chosen, uploading is not the kind of edit
|
|
// that needs a staging area. Presentational: data flows in as props,
|
|
// intent flows up as events.
|
|
import type { AgentIdentity, AgentImageKind, IdentityTexts } from '~/composables/useClaw'
|
|
|
|
const props = defineProps<{
|
|
identity: AgentIdentity | null
|
|
avatarUrl: string | null
|
|
logoUrl: string | null
|
|
/** An image upload or clear is in flight. */
|
|
mutating: boolean
|
|
saving: boolean
|
|
}>()
|
|
|
|
type EditableTexts = Pick<IdentityTexts, 'name' | 'email' | 'signoff'>
|
|
|
|
const emit = defineEmits<{
|
|
save: [texts: EditableTexts]
|
|
uploadImage: [kind: AgentImageKind, file: File]
|
|
clearImage: [kind: AgentImageKind]
|
|
}>()
|
|
|
|
// The draft: '' means "clear this field", matching the wire.
|
|
const draft = ref<EditableTexts>({
|
|
name: '',
|
|
email: '',
|
|
signoff: '',
|
|
})
|
|
|
|
const dirty = computed(() => {
|
|
const identity = props.identity
|
|
if (!identity) return false
|
|
return (
|
|
draft.value.name !== (identity.name ?? '') ||
|
|
draft.value.email !== (identity.email ?? '') ||
|
|
draft.value.signoff !== (identity.signoff ?? '')
|
|
)
|
|
})
|
|
|
|
function discard(): void {
|
|
const identity = props.identity
|
|
if (!identity) return
|
|
draft.value = {
|
|
name: identity.name ?? '',
|
|
email: identity.email ?? '',
|
|
signoff: identity.signoff ?? '',
|
|
}
|
|
}
|
|
|
|
// The draft starts empty, which reads as "dirty" against a saved
|
|
// identity — the first arrival syncs unconditionally, later ones only
|
|
// when the operator has not typed.
|
|
const initialized = ref(false)
|
|
|
|
watch(
|
|
() => props.identity,
|
|
(identity) => {
|
|
if (!identity || (initialized.value && dirty.value)) return
|
|
initialized.value = true
|
|
draft.value = {
|
|
name: identity.name ?? '',
|
|
email: identity.email ?? '',
|
|
signoff: identity.signoff ?? '',
|
|
}
|
|
},
|
|
{ immediate: true },
|
|
)
|
|
|
|
function save(): void {
|
|
if (!dirty.value || props.saving) return
|
|
emit('save', { ...draft.value })
|
|
}
|
|
|
|
// --- the images -------------------------------------------------------
|
|
const avatarInput = ref<HTMLInputElement | null>(null)
|
|
const logoInput = ref<HTMLInputElement | null>(null)
|
|
|
|
function pickImage(kind: AgentImageKind): void {
|
|
;(kind === 'avatar' ? avatarInput : logoInput).value?.click()
|
|
}
|
|
|
|
function onImageChosen(kind: AgentImageKind, event: Event): void {
|
|
const input = event.target as HTMLInputElement
|
|
const file = input.files?.[0]
|
|
if (file) emit('uploadImage', kind, file)
|
|
input.value = ''
|
|
}
|
|
|
|
const CAPS: Record<keyof EditableTexts, number> = {
|
|
name: 64,
|
|
email: 120,
|
|
signoff: 120,
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div class="page">
|
|
<PageHeader
|
|
title="General"
|
|
subtitle="How every surface names and shows the agent"
|
|
>
|
|
<template #actions>
|
|
<button :disabled="!dirty || saving" @click="discard">Discard</button>
|
|
<button class="primary" :disabled="!dirty || saving" @click="save">
|
|
{{ saving ? 'Saving…' : 'Save' }}
|
|
</button>
|
|
</template>
|
|
</PageHeader>
|
|
|
|
<div class="scroll">
|
|
<div class="identity">
|
|
<AgentAvatar
|
|
:avatar-url="avatarUrl"
|
|
:initials="draft.name.slice(0, 1)"
|
|
:size="56"
|
|
/>
|
|
<div class="identity-text">
|
|
<h2>{{ draft.name || 'rhema' }}</h2>
|
|
</div>
|
|
</div>
|
|
|
|
<SettingCard v-if="identity" title="Agent identity">
|
|
<SettingRow
|
|
title="Display name"
|
|
description="Shown as the author of messages, in the window title, in notifications, and as the author name on commits in workspaces."
|
|
>
|
|
<input
|
|
v-model="draft.name"
|
|
type="text"
|
|
:maxlength="CAPS.name"
|
|
placeholder="rhema"
|
|
autocomplete="off"
|
|
:disabled="saving"
|
|
/>
|
|
</SettingRow>
|
|
<SettingRow
|
|
title="Email"
|
|
description="The author address on commits the agent makes in its workspaces."
|
|
>
|
|
<input
|
|
v-model="draft.email"
|
|
type="email"
|
|
:maxlength="CAPS.email"
|
|
placeholder="claw@example.net"
|
|
autocomplete="off"
|
|
:disabled="saving"
|
|
/>
|
|
</SettingRow>
|
|
<SettingRow
|
|
title="Sign-off"
|
|
description="Appended to messages the agent sends outside the interface."
|
|
>
|
|
<input
|
|
v-model="draft.signoff"
|
|
type="text"
|
|
:maxlength="CAPS.signoff"
|
|
placeholder="optional"
|
|
autocomplete="off"
|
|
:disabled="saving"
|
|
/>
|
|
</SettingRow>
|
|
</SettingCard>
|
|
|
|
<SettingCard
|
|
v-if="identity"
|
|
title="Avatar & logo"
|
|
meta="png, jpeg, or webp, up to 2 MiB. Uploads apply immediately."
|
|
>
|
|
<SettingRow
|
|
title="Avatar"
|
|
description="The square face in the chat and the sidebar."
|
|
>
|
|
<div class="image-control">
|
|
<AgentAvatar :avatar-url="avatarUrl" :initials="identity.name?.slice(0, 1)" :size="40" />
|
|
<button :disabled="mutating" @click="pickImage('avatar')">Upload…</button>
|
|
<button v-if="identity.avatar" class="ghost" :disabled="mutating" @click="emit('clearImage', 'avatar')">
|
|
Clear
|
|
</button>
|
|
<input
|
|
ref="avatarInput"
|
|
type="file"
|
|
accept="image/png,image/jpeg,image/webp"
|
|
@change="onImageChosen('avatar', $event)"
|
|
/>
|
|
</div>
|
|
</SettingRow>
|
|
<SettingRow
|
|
title="Logo"
|
|
description="Shown on the About page. Falls back to the Rhema mark."
|
|
>
|
|
<div class="image-control">
|
|
<img class="logo-preview" :src="logoUrl ?? '/rhema-logo.png'" alt="" />
|
|
<button :disabled="mutating" @click="pickImage('logo')">Upload…</button>
|
|
<button v-if="identity.logo" class="ghost" :disabled="mutating" @click="emit('clearImage', 'logo')">
|
|
Clear
|
|
</button>
|
|
<input
|
|
ref="logoInput"
|
|
type="file"
|
|
accept="image/png,image/jpeg,image/webp"
|
|
@change="onImageChosen('logo', $event)"
|
|
/>
|
|
</div>
|
|
</SettingRow>
|
|
</SettingCard>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.page {
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-height: 0;
|
|
min-width: 0;
|
|
flex: 1;
|
|
}
|
|
|
|
.scroll {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
padding: 0 var(--sp-8) var(--sp-10);
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: var(--sp-4);
|
|
width: 100%;
|
|
max-width: 880px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.identity {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 16px;
|
|
padding: 4px 2px;
|
|
}
|
|
|
|
.identity-text h2 {
|
|
margin: 0;
|
|
font-size: 22px;
|
|
}
|
|
|
|
.identity-text p {
|
|
margin: 2px 0 0;
|
|
color: var(--text3);
|
|
}
|
|
|
|
.image-control {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
|
|
.image-control input[type='file'] {
|
|
display: none;
|
|
}
|
|
|
|
.logo-preview {
|
|
width: 40px;
|
|
height: 40px;
|
|
object-fit: contain;
|
|
flex: none;
|
|
}
|
|
</style>
|