feat(chat): add conversation starters #80

Merged
m merged 1 commits from codex/creator-chat-model-status-v1 into main 2026-08-21 06:24:28 +00:00
6 changed files with 62 additions and 3 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ func TestChatPageServedWithoutInternalIDs(t *testing.T) {
t.Fatalf("expected /chat status 200, got %d", recorder.Code)
}
body := recorder.Body.String()
for _, required := range []string{"cognitive-status", "aria-live=\"polite\"", "cognitive-console-link", "href=\"/admin\""} {
for _, required := range []string{"cognitive-status", "aria-live=\"polite\"", "cognitive-console-link", "href=\"/admin\"", "Проверь канал", "Изменить настройку"} {
if !strings.Contains(body, required) {
t.Fatalf("/chat is missing human status marker %q", required)
}
+5
View File
@@ -57,6 +57,9 @@ textarea { resize: vertical; min-height: 84px; max-height: 240px; padding: 14px;
.composer { position: sticky; bottom: 0; width: min(100%, 920px); margin: 0 auto; padding: 16px 18px 20px; display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 12px; background: linear-gradient(transparent, var(--base) 20%); }
.composer button { height: 48px; align-self: end; }
.composer button:disabled { cursor: wait; filter: saturate(.3); }
.conversation-starters { width: min(100%, 920px); margin: -4px auto 0; padding: 0 18px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font: 10px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.conversation-starters button { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); color: var(--ink); background: #101814; font: 10px/1 var(--mono); }
.conversation-starters button:hover, .conversation-starters button:focus-visible { border-color: var(--signal); color: var(--signal); outline: none; }
.attention-surface, .history-surface { width: min(100%, 920px); margin: 0 auto; padding: 34px 18px; align-content: start; gap: 18px; }
.surface-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.surface-heading p { margin: 0; font: 400 36px/.95 var(--serif); }
@@ -77,6 +80,8 @@ textarea { resize: vertical; min-height: 84px; max-height: 240px; padding: 14px;
@media (max-width: 640px) {
.composer { grid-template-columns: 1fr; }
.composer button { width: 100%; }
.conversation-starters { align-items: stretch; }
.conversation-starters span { width: 100%; }
.chat-header { gap: 10px; padding: 0 12px; }
.chat-header span { display: none; }
.chat-header .cognitive-status { display: inline-flex; }
+10
View File
@@ -14,6 +14,7 @@ const todayList = document.querySelector("#today-list");
const refreshToday = document.querySelector("#refresh-today");
const historyList = document.querySelector("#history-list");
const navTabs = Array.from(document.querySelectorAll(".nav-tab"));
const conversationStarters = Array.from(document.querySelectorAll("[data-starter]"));
let token = sessionStorage.getItem("domovoy.chat.token") || "";
let conversationID = sessionStorage.getItem("domovoy.chat.conversation") || "";
@@ -281,6 +282,15 @@ for (const tab of navTabs) {
tab.addEventListener("click", () => activateTab(tab.dataset.tab));
}
for (const starter of conversationStarters) {
starter.addEventListener("click", async () => {
const text = starter.dataset.starter || "";
if (!text || sendButton.disabled) return;
messageInput.value = "";
await sendChatMessage(text);
});
}
if (refreshToday) refreshToday.addEventListener("click", loadToday);
if (cognitiveStatus) cognitiveStatus.addEventListener("click", loadCognitiveStatus);
+6
View File
@@ -44,6 +44,12 @@
<textarea id="message" rows="3" maxlength="16384" placeholder="Напишите Домовому обычное сообщение..." required></textarea>
<button id="send" type="submit">Отправить</button>
</form>
<div class="conversation-starters" aria-label="Частые вопросы">
<span>Можно начать так:</span>
<button type="button" data-starter="Проверь локальный канал мышления">Проверь канал</button>
<button type="button" data-starter="Что сейчас доступно?">Что доступно?</button>
<button type="button" data-starter="Хочу изменить настройку локальной модели">Изменить настройку</button>
</div>
</section>
<section id="today-panel" class="surface-panel attention-surface" hidden>
<div class="surface-heading">
+2 -2
View File
@@ -1,5 +1,5 @@
{
"task_file": "dev/tasks/DEV-000078-core-conversational-cognitive-health.json",
"task_id": "DEV-000078",
"task_file": "dev/tasks/DEV-000079-chat-conversation-starters.json",
"task_id": "DEV-000079",
"task_revision": 1
}
@@ -0,0 +1,38 @@
{
"task_id": "DEV-000079",
"task_revision": 1,
"architecture_revision": "DEV-000073-baseline",
"base_repo_revision": "b0d31012dac1526e721e57c691555933eb501a5a",
"risk_tier": "E",
"intent": "Make the primary Domovoy chat self-explanatory with concise conversation starters for cognitive-channel checks and configuration handoff.",
"requirement_ids": [
"A new user can discover the main cognitive-channel conversation paths",
"Conversation starters submit ordinary human text",
"No starter exposes internal identifiers",
"The chat remains usable on mobile"
],
"allowed_change_scope": {
"modules": ["cmd/creator-web"],
"paths": [
"cmd/creator-web/chat_test.go",
"cmd/creator-web/static/chat.html",
"cmd/creator-web/static/assets/chat.css",
"cmd/creator-web/static/assets/chat.js",
"dev/ACTIVE_TASK.json",
"dev/tasks/DEV-000079-chat-conversation-starters.json"
]
},
"forbidden_change_scope": {"paths": ["architecture/**", "security/**", "database/**", "modules/**", "contracts/**", "adapters/**", "deploy/**"]},
"allowed_architecture_delta": {"new_cross_module_dependencies": 0, "new_canonical_owners": 0, "new_privileges": 0, "new_third_party_dependencies": 0, "new_provider_adapters": 0, "new_database_owner_roles": 0},
"contracts": {"consume": ["existing chat message endpoint"], "may_change": []},
"semantic_owner": "none-interface-adapter",
"canonical_state": [],
"state_transitions": ["User selects a conversation starter", "Browser submits its ordinary text through the existing chat flow"],
"side_effects_and_privileges": ["Existing chat semantics only", "No new privilege", "No direct model or configuration mutation"],
"persistence_and_migrations": ["Existing conversation persistence only", "No migration"],
"failure_retry_restart": ["Starter uses existing chat error handling"],
"assumptions": ["The user can still type any other request in the composer"],
"acceptance_scenarios": ["Three human-readable starter actions are visible", "Clicking a starter sends its text through the normal chat flow", "No internal IDs appear in the page", "Starter layout remains usable at mobile width"],
"required_tests": ["go test ./cmd/creator-web", "go test ./...", "go vet ./...", "devctl preflight", "devctl check-diff", "devctl check-architecture", "git diff --check", "node --check cmd/creator-web/static/assets/chat.js"],
"terminal_gap_states": ["BLOCKED_BY_ARCHITECTURE_GAP", "BLOCKED_BY_SPEC_GAP", "BLOCKED_BY_CONFLICT"]
}