Implement persistent conversational AI and blog tools #21

Closed
opened 2026-07-18 20:48:39 +00:00 by hugo · 1 comment
Owner

Goal

Deliver persistent conversational AI with streaming, bounded tool execution, cancellation, and a working Chat UI over existing RuDS engines.

Current state

  • Online and airplane OpenAI-compatible endpoints, secure keys, model discovery, vision gating, system prompt, and six one-shot AI operations work.
  • chat_conversations and chat_messages tables exist but have no repositories or engine.
  • Chat sidebar/workspace routes are placeholders.
  • specs/ai.allium and specs/editor_chat.allium are normative.

Required behavior

  • Create, rename/list, reopen, and delete conversations; persist user, assistant, and tool messages plus model/session/token fields.
  • Select the endpoint for current airplane mode and refuse chat with the localized existing guidance when unavailable.
  • Stream OpenAI-compatible responses, incrementally assemble content and tool calls, and preserve a valid transcript after stream failure or cancellation.
  • Execute a bounded tool loop over posts, media, templates, scripts, tags, search, project stats, and navigation through existing engines.
  • Truncate context according to the spec while retaining the system contract and valid tool-call/result pairs.
  • Track input/output and provider cache token usage.
  • Implement stop/cancel without committing an incomplete tool mutation twice.
  • Replace Chat placeholders with localized conversation list, message rendering, input, streaming indicators, tool markers, model controls, and status token reporting.
  • Keep external images blocked and render assistant text as safe GFM Markdown.

Implementation notes

  • Read docs/UI_STYLE_GUIDE.md before UI work.
  • Use the existing endpoint/key/model infrastructure; do not add hard-coded providers.
  • Tools must call normal engines and inherit airplane, metadata, filesystem, task, and event behavior.
  • Follow red/green TDD and use bDS2 chat engine/editor tests when the specs are silent.

Acceptance criteria

  • Conversation/message repository round trips and deletion are tested.
  • Streaming tests cover split SSE frames, multiple tool calls, malformed chunks, cancellation, provider errors, and token usage.
  • Tool-loop limit, context truncation, unavailable endpoint, and airplane model selection are tested.
  • Reopening a conversation restores a valid transcript and model/session state.
  • Chat placeholders are gone and all UI strings are localized.
  • cargo fmt --all -- --check, cargo build --workspace, and cargo test --workspace pass.
## Goal Deliver persistent conversational AI with streaming, bounded tool execution, cancellation, and a working Chat UI over existing RuDS engines. ## Current state - Online and airplane OpenAI-compatible endpoints, secure keys, model discovery, vision gating, system prompt, and six one-shot AI operations work. - chat_conversations and chat_messages tables exist but have no repositories or engine. - Chat sidebar/workspace routes are placeholders. - specs/ai.allium and specs/editor_chat.allium are normative. ## Required behavior - Create, rename/list, reopen, and delete conversations; persist user, assistant, and tool messages plus model/session/token fields. - Select the endpoint for current airplane mode and refuse chat with the localized existing guidance when unavailable. - Stream OpenAI-compatible responses, incrementally assemble content and tool calls, and preserve a valid transcript after stream failure or cancellation. - Execute a bounded tool loop over posts, media, templates, scripts, tags, search, project stats, and navigation through existing engines. - Truncate context according to the spec while retaining the system contract and valid tool-call/result pairs. - Track input/output and provider cache token usage. - Implement stop/cancel without committing an incomplete tool mutation twice. - Replace Chat placeholders with localized conversation list, message rendering, input, streaming indicators, tool markers, model controls, and status token reporting. - Keep external images blocked and render assistant text as safe GFM Markdown. ## Implementation notes - Read docs/UI_STYLE_GUIDE.md before UI work. - Use the existing endpoint/key/model infrastructure; do not add hard-coded providers. - Tools must call normal engines and inherit airplane, metadata, filesystem, task, and event behavior. - Follow red/green TDD and use bDS2 chat engine/editor tests when the specs are silent. ## Acceptance criteria - Conversation/message repository round trips and deletion are tested. - Streaming tests cover split SSE frames, multiple tool calls, malformed chunks, cancellation, provider errors, and token usage. - Tool-loop limit, context truncation, unavailable endpoint, and airplane model selection are tested. - Reopening a conversation restores a valid transcript and model/session state. - Chat placeholders are gone and all UI strings are localized. - cargo fmt --all -- --check, cargo build --workspace, and cargo test --workspace pass.
hugo added the enhancement label 2026-07-18 20:48:39 +00:00
Author
Owner

Implemented in ac611e3. Added persistent conversation/message repositories and upgrade-safe token migrations; OpenAI-compatible SSE streaming with split-frame, multi-tool, provider-error and cancellation handling; model/session and four token counters; context truncation with valid tool pairs; bounded project tools over posts, media, relationships, templates, scripts, tags, FTS search, stats and navigation; airplane-aware endpoint selection; and the fully localized Iced Chat UI with safe GFM, blocked external images, model controls, tool markers, streaming/stop behavior and status totals. Neutral review compared the result with issue #21, bDS2 chat behavior, and specs/ai.allium plus specs/editor_chat.allium. Verified with 11 Chat integration tests, relationship/thumbnail and migration-upgrade tests, 104 UI tests plus i18n checks, cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, cargo build --workspace, cargo test --workspace, Allium check/analyse, and visual inspection of the packaged macOS app on an existing database.

Implemented in ac611e3. Added persistent conversation/message repositories and upgrade-safe token migrations; OpenAI-compatible SSE streaming with split-frame, multi-tool, provider-error and cancellation handling; model/session and four token counters; context truncation with valid tool pairs; bounded project tools over posts, media, relationships, templates, scripts, tags, FTS search, stats and navigation; airplane-aware endpoint selection; and the fully localized Iced Chat UI with safe GFM, blocked external images, model controls, tool markers, streaming/stop behavior and status totals. Neutral review compared the result with issue #21, bDS2 chat behavior, and specs/ai.allium plus specs/editor_chat.allium. Verified with 11 Chat integration tests, relationship/thumbnail and migration-upgrade tests, 104 UI tests plus i18n checks, cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, cargo build --workspace, cargo test --workspace, Allium check/analyse, and visual inspection of the packaged macOS app on an existing database.
hugo closed this issue 2026-07-19 14:18:55 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hugo/RuDS#21