feat(chat): slash-command autocomplete

Typing / opens a command panel from the guild's synced OpenClaw catalog
(GET /api/commands): filter + ↑↓/Enter/Esc; pick inserts /<nativeName> ;
arg stage lists args (required/type/desc) with clickable choice chips
(dynamic choices already snapshotted server-side). Sent as a normal
message — execution flows plugin -> OpenClaw command system.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
h z
2026-05-16 16:15:02 +01:00
parent 8be68d4c87
commit 46cad0ec7c
3 changed files with 246 additions and 2 deletions

View File

@@ -995,3 +995,88 @@ textarea.canvas-src {
max-width: 720px;
width: 92vw;
}
/* ---- slash command autocomplete ---- */
.slash-panel {
border: 1px solid var(--border);
border-bottom: 0;
background: var(--elevated);
border-radius: var(--radius-sm) var(--radius-sm) 0 0;
max-height: 320px;
overflow: auto;
padding: 6px;
}
.slash-panel .slash-hint {
font-size: 11px;
color: var(--text-faint);
padding: 4px 8px 6px;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.slash-item {
display: flex;
gap: 10px;
align-items: baseline;
width: 100%;
text-align: left;
background: none;
border: 0;
color: var(--text);
padding: 7px 8px;
border-radius: 5px;
cursor: pointer;
}
.slash-item.sel,
.slash-item:hover {
background: var(--accent-soft);
}
.slash-item .sc-name {
font-family: var(--mono);
font-size: 13px;
color: var(--text-h);
white-space: nowrap;
}
.sc-desc {
font-size: 12px;
color: var(--text-muted);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.slash-arg {
padding: 6px 8px;
border-top: 1px solid var(--border);
}
.slash-arg .sa-name {
font-family: var(--mono);
font-size: 13px;
color: var(--text-h);
}
.slash-arg .sa-req {
color: var(--danger);
margin-left: 1px;
}
.slash-arg .sa-type {
font-size: 11px;
color: var(--text-faint);
margin: 0 8px;
}
.sa-choices {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-top: 6px;
}
.sa-choice {
font-size: 12px;
background: var(--input);
border: 1px solid var(--border);
color: var(--text);
padding: 3px 8px;
border-radius: 999px;
cursor: pointer;
}
.sa-choice:hover {
border-color: var(--accent);
color: var(--text-h);
}