Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

15.2 KB
Raw Blame
<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1" />
		<title data-i18n="agent_edit_index.meta_title">Edit Persona · three.ws</title>
		<link rel="icon" href="/favicon.ico" />
		<style>
			:root {
				color-scheme: dark;
				--accent: #ffffff;
				--accent2: #ffffff;
				--border: #232323;
				--bg: #000;
				--panel: #151515;
			}
			* {
				box-sizing: border-box;
			}
			body {
				font:
					15px/1.55 -apple-system,
					system-ui,
					Segoe UI,
					Roboto,
					sans-serif;
				color: #eee;
				margin: 0;
				background: var(--bg);
				min-height: 100vh;
			}
			a {
				color: #888888;
				text-decoration: none;
			}

			header {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 12px 24px;
				border-bottom: 1px solid var(--border);
				position: sticky;
				top: 0;
				background: var(--bg);
				z-index: 10;
			}
			.header-left {
				display: flex;
				align-items: center;
				gap: 14px;
			}
			.brand {
				font-weight: 600;
				letter-spacing: -0.01em;
				color: #eee;
				text-decoration: none;
			}
			.header-logo {
				width: 20px;
				height: 20px;
				vertical-align: middle;
				margin-right: 6px;
			}
			.header-title {
				font-size: 14px;
				color: #888;
			}
			.header-actions {
				display: flex;
				gap: 8px;
				align-items: center;
			}

			.layout {
				display: grid;
				grid-template-columns: 1fr 440px;
				height: calc(100vh - 53px);
			}
			.preview-pane {
				border-right: 1px solid var(--border);
				position: relative;
				background: #090909;
			}
			.preview-pane iframe {
				width: 100%;
				height: 100%;
				border: 0;
				display: block;
			}
			.preview-loading {
				position: absolute;
				inset: 0;
				display: grid;
				place-items: center;
				color: #555;
				font-size: 13px;
			}

			.editor-pane {
				overflow-y: auto;
				padding: 22px 24px 60px;
			}

			h2 {
				font-size: 16px;
				font-weight: 600;
				margin: 0 0 4px;
			}
			.sub {
				color: #888;
				font-size: 13px;
				margin: 0 0 20px;
			}

			.form-group {
				margin-bottom: 18px;
			}
			label {
				display: block;
				font-size: 13px;
				font-weight: 500;
				color: #bbb;
				margin-bottom: 6px;
			}
			.label-row {
				display: flex;
				justify-content: space-between;
				align-items: baseline;
			}
			.char-count {
				font-size: 11px;
				color: #555;
			}
			input[type='text'],
			textarea,
			select {
				width: 100%;
				background: #101010;
				border: 1px solid var(--border);
				color: #eee;
				padding: 9px 11px;
				border-radius: 8px;
				font-size: 14px;
				font-family: inherit;
			}
			input[type='text']:focus,
			textarea:focus,
			select:focus {
				outline: none;
				border-color: var(--accent);
			}
			textarea {
				resize: vertical;
			}
			textarea.mono {
				font-family:
					ui-monospace,
					SF Mono,
					Menlo,
					monospace;
				font-size: 13px;
			}

			.slider-wrap {
				display: flex;
				align-items: center;
				gap: 10px;
			}
			.slider-label {
				font-size: 11px;
				color: #666;
				white-space: nowrap;
			}
			input[type='range'] {
				flex: 1;
				accent-color: var(--accent);
			}
			.slider-value {
				font-size: 12px;
				color: #aaa;
				min-width: 36px;
				text-align: right;
			}

			.radio-group {
				display: flex;
				gap: 10px;
			}
			.radio-group label {
				display: flex;
				align-items: center;
				gap: 6px;
				font-weight: 400;
				color: #ccc;
				cursor: pointer;
			}
			.radio-group input {
				width: auto;
				accent-color: var(--accent);
			}

			.catchphrase-list {
				display: flex;
				flex-direction: column;
				gap: 6px;
			}
			.catchphrase-row {
				display: flex;
				gap: 6px;
			}
			.catchphrase-row input {
				flex: 1;
			}
			.catchphrase-row button {
				padding: 0 10px;
				background: #1b1b1b;
				border: 1px solid var(--border);
				color: #888;
				border-radius: 8px;
				cursor: pointer;
				font-size: 16px;
				line-height: 1;
			}
			.catchphrase-row button:hover {
				color: #fff;
				border-color: #444;
			}
			.add-catchphrase {
				margin-top: 6px;
				background: none;
				border: 1px dashed var(--border);
				color: #666;
				border-radius: 8px;
				padding: 7px;
				width: 100%;
				cursor: pointer;
				font-size: 13px;
			}
			.add-catchphrase:hover {
				border-color: #555;
				color: #aaa;
			}

			.chip-input-wrap {
				display: flex;
				flex-wrap: wrap;
				gap: 6px;
				background: #101010;
				border: 1px solid var(--border);
				border-radius: 8px;
				padding: 7px 9px;
				min-height: 40px;
			}
			.chip-input-wrap:focus-within {
				border-color: var(--accent);
			}
			.chip {
				display: inline-flex;
				align-items: center;
				gap: 4px;
				background: #212121;
				border: 1px solid #2d2d2d;
				border-radius: 99px;
				padding: 2px 8px 2px 10px;
				font-size: 12px;
				color: #ccc;
			}
			.chip button {
				background: none;
				border: 0;
				color: #888;
				cursor: pointer;
				font-size: 13px;
				line-height: 1;
				padding: 0 1px;
			}
			.chip button:hover {
				color: #ff5c5c;
			}
			.chip-text-input {
				flex: 1;
				min-width: 80px;
				background: none;
				border: 0;
				color: #eee;
				font-size: 13px;
				padding: 2px 3px;
				outline: none;
			}

			.templates {
				display: flex;
				gap: 8px;
				margin-bottom: 20px;
				flex-wrap: wrap;
			}
			.template-btn {
				padding: 7px 13px;
				background: #151515;
				border: 1px solid var(--border);
				color: #aaa;
				border-radius: 99px;
				cursor: pointer;
				font-size: 13px;
				font-family: inherit;
			}
			.template-btn:hover {
				border-color: #ffffff;
				color: #fff;
			}

			.section-divider {
				border: 0;
				border-top: 1px solid var(--border);
				margin: 22px 0;
			}

			.btn {
				padding: 9px 18px;
				border-radius: 9px;
				border: 0;
				font-size: 13px;
				font-weight: 600;
				cursor: pointer;
				background: var(--accent);
				color: #fff;
			}
			.btn:hover {
				filter: brightness(1.1);
			}
			.btn:disabled {
				opacity: 0.5;
				cursor: not-allowed;
				filter: none;
			}
			.btn.sec {
				background: #1f1f1f;
				color: #ccc;
				border: 1px solid var(--border);
			}
			.btn.sec:hover {
				background: #262626;
			}

			.save-status {
				font-size: 12px;
				color: #888;
				min-width: 64px;
				text-align: right;
				transition: opacity 0.2s;
			}
			.save-status.saving {
				color: #aaa;
			}
			.save-status.saved {
				color: #4ade80;
			}

			.toast {
				position: fixed;
				bottom: 24px;
				left: 50%;
				transform: translateX(-50%);
				background: #1b1b1b;
				border: 1px solid var(--accent);
				color: #eee;
				padding: 10px 20px;
				border-radius: 10px;
				font-size: 13px;
				z-index: 100;
				opacity: 0;
				transition: opacity 0.2s;
				pointer-events: none;
			}
			.toast.show {
				opacity: 1;
			}
			.toast.err {
				border-color: #cc4040;
				background: #1e1010;
			}

			.forbidden {
				display: grid;
				place-items: center;
				height: 100%;
				color: #888;
				font-size: 14px;
				text-align: center;
				padding: 40px;
			}
			.forbidden h2 {
				color: #ff5c5c;
				margin-bottom: 8px;
			}

			.reset-btn {
				font-size: 12px;
				color: #888;
				background: none;
				border: 0;
				cursor: pointer;
				text-decoration: underline;
			}
			.reset-btn:hover {
				color: #aaa;
			}

			@media (max-width: 768px) {
				.layout {
					grid-template-columns: 1fr;
					height: auto;
					grid-template-rows: 50vw auto;
				}
				.preview-pane {
					border-right: none;
					border-bottom: 1px solid var(--border);
					height: 50vw;
				}
				.editor-pane {
					padding: 18px 16px 60px;
				}
			}

			/* ── Voice picker ──────────────────────────────────────────────────────── */
			.vp-toggle {
				display: flex;
				gap: 6px;
				margin-bottom: 10px;
			}
			.vp-toggle-btn {
				flex: 1;
				padding: 7px;
				background: #101010;
				border: 1px solid var(--border);
				color: #888;
				border-radius: 8px;
				cursor: pointer;
				font-size: 13px;
				font-family: inherit;
				text-align: center;
				transition:
					background 0.15s,
					border-color 0.15s,
					color 0.15s;
			}
			.vp-toggle-btn.active {
				background: rgba(255, 255, 255, 0.15);
				border-color: rgba(255, 255, 255, 0.5);
				color: #eee;
			}
			.vp-toggle-btn:disabled {
				opacity: 0.35;
				cursor: not-allowed;
			}
			.vp-list {
				border: 1px solid var(--border);
				border-radius: 8px;
				max-height: 260px;
				overflow-y: auto;
			}
			.vp-group-label {
				padding: 4px 10px;
				font-size: 11px;
				color: rgba(255, 255, 255, 0.2);
				text-transform: uppercase;
				letter-spacing: 0.07em;
				background: rgba(255, 255, 255, 0.02);
				border-bottom: 1px solid rgba(255, 255, 255, 0.04);
			}
			.vp-item {
				display: flex;
				align-items: center;
				gap: 8px;
				padding: 8px 10px;
				border-bottom: 1px solid rgba(255, 255, 255, 0.04);
				cursor: pointer;
				transition: background 0.1s;
			}
			.vp-item:last-child {
				border-bottom: none;
			}
			.vp-item:hover {
				background: rgba(255, 255, 255, 0.04);
			}
			.vp-item.selected {
				background: rgba(255, 255, 255, 0.1);
			}
			.vp-radio {
				width: 13px;
				height: 13px;
				border-radius: 50%;
				border: 1.5px solid #555;
				flex-shrink: 0;
				position: relative;
			}
			.vp-item.selected .vp-radio {
				border-color: var(--accent);
				background: var(--accent);
			}
			.vp-item.selected .vp-radio::after {
				content: '';
				width: 5px;
				height: 5px;
				border-radius: 50%;
				background: #fff;
				position: absolute;
				top: 50%;
				left: 50%;
				transform: translate(-50%, -50%);
			}
			.vp-name {
				flex: 1;
				font-size: 13px;
				color: #ccc;
			}
			.vp-meta {
				font-size: 11px;
				color: #555;
			}
			.vp-preview-btn {
				background: none;
				border: 1px solid var(--border);
				color: #666;
				font-size: 11px;
				padding: 3px 8px;
				border-radius: 5px;
				cursor: pointer;
				font-family: inherit;
				white-space: nowrap;
			}
			.vp-preview-btn:hover {
				color: #ccc;
				border-color: #444;
			}
			.vp-preview-btn:disabled {
				opacity: 0.4;
				cursor: not-allowed;
			}
			.vp-empty {
				padding: 18px;
				text-align: center;
				color: #555;
				font-size: 13px;
			}
		</style>
	</head>
	<body>
		<header>
			<div class="header-left">
				<a class="brand" href="/"><img src="/three.svg" alt="" class="header-logo" aria-hidden="true" />three.ws</a>
				<span class="header-title" id="header-title" data-i18n="agent_edit_index.edit_persona">Edit Persona</span>
			</div>
			<div class="header-actions">
				<a id="view-link" class="btn sec" style="text-decoration: none"
					 data-i18n="agent_edit_index.view_page">View page →</a
				>
				<span id="save-status" class="save-status" aria-live="polite"></span>
				<button id="save-btn" class="btn" disabled data-i18n="agent_edit_index.save">Save</button>
			</div>
		</header>

		<div class="layout" id="layout" style="display: none">
			<div class="preview-pane">
				<div class="preview-loading" id="preview-loading">Loading preview…</div>
				<iframe id="preview-frame" title="Agent preview" style="display: none"></iframe>
			</div>
			<div class="editor-pane" id="editor-pane">
				<h2 data-i18n="agent_edit_index.persona">Persona</h2>
				<p class="sub" data-i18n="agent_edit_index.shape_how_your_agent_speaks_thinks_and">Shape how your agent speaks, thinks, and presents itself.</p>

				<div class="templates" id="templates-row"></div>

				<div class="form-group">
					<div class="label-row">
						<label for="f-name" data-i18n="agent_edit_index.name">Name</label>
						<span class="char-count" id="cnt-name">0/40</span>
					</div>
					<input
						type="text"
						id="f-name"
						maxlength="40"
						placeholder="My Agent"
						autocomplete="off"
					/>
				</div>

				<div class="form-group">
					<div class="label-row">
						<label for="f-bio" data-i18n="agent_edit_index.bio">Bio</label>
						<span class="char-count" id="cnt-bio">0/280</span>
					</div>
					<textarea
						id="f-bio"
						rows="3"
						maxlength="280"
						placeholder="A short description shown on your agent's public page."
					></textarea>
				</div>

				<div class="form-group">
					<div class="label-row">
						<label for="f-system-prompt" data-i18n="agent_edit_index.system_prompt">System prompt</label>
						<span>
							<span class="char-count" id="cnt-system-prompt">0/2000</span>
							<button
								class="reset-btn"
								id="reset-prompt-btn"
								style="margin-left: 8px"
							 data-i18n="agent_edit_index.reset_to_template">
								Reset to template
							</button>
						</span>
					</div>
					<textarea
						id="f-system-prompt"
						class="mono"
						rows="7"
						maxlength="2000"
						placeholder="Instructions for how the agent should behave. Prepended to the LLM system prompt."
					></textarea>
				</div>

				<div class="form-group">
					<label
						 data-i18n-html="agent_edit_index.catchphrases_5">Catchphrases
						<span style="color: #555; font-weight: 400">(≤ 5)</span></label
					>
					<div class="catchphrase-list" id="catchphrase-list"></div>
					<button class="add-catchphrase" id="add-catchphrase-btn" style="display: none" data-i18n="agent_edit_index.add_catchphrase">
						+ Add catchphrase
					</button>
				</div>

				<hr class="section-divider" />

				<div class="form-group">
					<label data-i18n="agent_edit_index.sentiment_bias">Sentiment bias</label>
					<div class="slider-wrap">
						<span class="slider-label" data-i18n="agent_edit_index.stoic">stoic</span>
						<input
							type="range"
							id="f-sentiment-bias"
							min="-1"
							max="1"
							step="0.05"
							value="0"
						/>
						<span class="slider-label" data-i18n="agent_edit_index.effusive">effusive</span>
						<span class="slider-value" id="bias-value">0.00</span>
					</div>
				</div>

				<div class="form-group" id="voice-picker-group">
					<label data-i18n="agent_edit_index.voice">Voice</label>
					<!-- populated by initVoicePicker() in edit.js -->
				</div>

				<div class="form-group">
					<label data-i18n="agent_edit_index.do_not_say_list">Do-not-say list</label>
					<div class="chip-input-wrap" id="dns-wrap">
						<input
							class="chip-text-input"
							id="dns-input"
							placeholder="Type a word and press Enter…"
						/>
					</div>
				</div>
			</div>
		</div>

		<div id="forbidden-screen" style="display: none" class="forbidden">
			<div>
				<h2 data-i18n="agent_edit_index.access_denied">Access denied</h2>
				<p data-i18n="agent_edit_index.you_don_t_own_this_agent">You don't own this agent.</p>
				<a href="/dashboard" data-i18n="agent_edit_index.back_to_dashboard">← Back to dashboard</a>
			</div>
		</div>

		<div
			id="loading-screen"
			style="
				display: grid;
				place-items: center;
				height: calc(100vh - 53px);
				color: #555;
				font-size: 14px;
			"
		>
			Loading…
		</div>

		<div class="toast" id="toast"></div>

		<!-- Absolute: this page is served at /agent-edit as well as /agent-edit/, and a
		     relative src resolves against the site root on the slash-less URL (404). -->
		<script type="module" src="/agent-edit/edit.js"></script>
		<script src="/brand.js" defer></script>
	<!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. -->
	<script type="module" src="/i18n.js"></script>
</body>
</html>