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.

feat(app): deploy-on-chain header button + inline name/description editing

nirholasbf23e7fc0ab9
diff --git a/src/agent-home.js b/src/agent-home.js
index 2dafb22a5..1a7d1ae9d 100644
--- a/src/agent-home.js
+++ b/src/agent-home.js
@@ -176,6 +176,75 @@ export class AgentHome {
navigator.clipboard?.writeText(url).catch(() => {});
this._flashBtn(panel.querySelector('#agent-copy-link'), '✓');
});
+
+ // Inline name + description editing — debounced auto-save with optimistic
+ // rollback on backend rejection (e.g. anonymous viewer hits PUT 401).
+ panel.querySelectorAll('.agent-home-editable').forEach((el) => {
+ this._wireInlineEdit(el);
+ });
+ }
+
+ _wireInlineEdit(el) {
+ if (!el || !this.identity?.id) return;
+ const field = el.dataset.field;
+ if (!field) return;
+
+ // Track the last server-confirmed value for rollback / no-op detection.
+ el._lastSaved = el.textContent.trim();
+
+ // Enter blurs (saves) instead of inserting a newline. Escape reverts.
+ el.addEventListener('keydown', (e) => {
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ el.blur();
+ } else if (e.key === 'Escape') {
+ e.preventDefault();
+ el.textContent = el._lastSaved || '';
+ el.blur();
+ }
+ });
+
+ el.addEventListener('focus', () => {
+ el.classList.add('is-editing');
+ });
+
+ el.addEventListener('blur', async () => {
+ el.classList.remove('is-editing');
+ const next = el.textContent.replace(/\s+/g, ' ').trim();
+ if (next === (el._lastSaved || '')) return; // no change
+
+ // Optimistic update
+ const previous = el._lastSaved || '';
+ el._lastSaved = next;
+ el.classList.add('is-saving');
+
+ try {
+ const resp = await fetch(`/api/agents/${this.identity.id}`, {
+ method: 'PUT',
+ credentials: 'include',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ [field]: next }),
+ });
+ if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
+ const { agent } = await resp.json().catch(() => ({}));
+ // Reflect any server-side normalisation (trimmed, capped, etc.)
+ if (agent && typeof agent[field] === 'string' && agent[field] !== next) {
+ el.textContent = agent[field];
+ el._lastSaved = agent[field];
+ }
+ if (this.identity._record) this.identity._record[field] = el._lastSaved;
+ el.classList.remove('is-saving');
+ el.classList.add('is-saved');
+ setTimeout(() => el.classList.remove('is-saved'), 1100);
+ } catch {
+ // Roll back to the last known good value.
+ el.textContent = previous;
+ el._lastSaved = previous;
+ el.classList.remove('is-saving');
+ el.classList.add('is-error');
+ setTimeout(() => el.classList.remove('is-error'), 1500);
+ }
+ });
}
// ── Memory Bar ────────────────────────────────────────────────────────────
diff --git a/style.css b/style.css
index 29f1f4e08..3d2f5a70b 100644
--- a/style.css
+++ b/style.css
@@ -3081,6 +3081,54 @@ footer .separator {
text-overflow: ellipsis;
}
+/* ── Inline-editable fields (name, description) ─────────────────────────── */
+.agent-home-editable {
+ cursor: text;
+ border-radius: 4px;
+ padding: 1px 4px;
+ margin: -1px -4px;
+ transition:
+ background 0.15s,
+ box-shadow 0.15s;
+ outline: none;
+}
+.agent-home-editable:hover:not(.is-editing) {
+ background: rgba(255, 255, 255, 0.04);
+}
+.agent-home-editable.is-editing,
+.agent-home-editable:focus-visible {
+ background: rgba(255, 255, 255, 0.08);
+ box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.5);
+}
+.agent-home-editable.is-saving {
+ box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
+ opacity: 0.7;
+}
+.agent-home-editable.is-saved {
+ box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.6);
+}
+.agent-home-editable.is-error {
+ box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.7);
+}
+/* Empty-state placeholder (no actual <input>, so we render via :before). */
+.agent-home-editable:empty:not(.is-editing):before {
+ content: attr(data-placeholder);
+ color: rgba(255, 255, 255, 0.28);
+ font-style: italic;
+}
+
+.agent-home-description {
+ margin: 4px 0 0;
+ font-size: var(--text-xs);
+ font-weight: 400;
+ color: rgba(255, 255, 255, 0.55);
+ line-height: 1.45;
+ white-space: normal;
+}
+.agent-home-description.agent-home-editable {
+ cursor: text;
+}
+
.agent-home-status-sep {
color: rgba(255, 255, 255, 0.2);
margin: 0 2px;