Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(i18n, store, core): add plan/build mode toggle, goal inline summary, and queue slice

Steven Enamakel5d6e7082e540
diff --git a/app/src/lib/i18n/ar.ts b/app/src/lib/i18n/ar.ts
index 68b7661a51..fae984e0ce 100644
--- a/app/src/lib/i18n/ar.ts
+++ b/app/src/lib/i18n/ar.ts
@@ -3233,6 +3233,11 @@ const messages: TranslationMap = {
'conversations.planReview.feedbackLabel': 'طلب تغييرات',
'conversations.planReview.feedbackPlaceholder': 'صف ما الذي يجب تغييره…',
'conversations.planReview.sendFeedback': 'إرسال الملاحظات',
+ 'conversations.planReview.revise': 'تنقيح',
+ 'conversations.runMode.plan': 'خطة',
+ 'conversations.runMode.build': 'بناء',
+ 'conversations.runMode.toggleLabel': 'التبديل بين وضع الخطة ووضع البناء',
+ 'conversations.goal.inlineSummary': '{objective} ({status})',
'conversations.toolTimeline.turn': 'دور',
'conversations.toolTimeline.step': 'خطوة',
'conversations.toolTimeline.workerThread': 'محادثة عامل',
@@ -3599,6 +3604,8 @@ const messages: TranslationMap = {
'conversations.tools.checkArtifacts.done': 'تم فحص الملفات المُنشأة',
'conversations.tools.deleteArtifact.active': 'جارٍ حذف الملف المُنشأ',
'conversations.tools.deleteArtifact.done': 'تم حذف الملف المُنشأ',
+ 'conversations.tools.document.title': 'مستند',
+ 'conversations.tools.presentation.title': 'عرض تقديمي',
'conversations.subagent.noOutput': 'لم يتم إرجاع أي مخرجات',
'conversations.subagent.close': 'إغلاق',
'conversations.subagent.cancel': 'إلغاء المهمة',
diff --git a/app/src/lib/i18n/bn.ts b/app/src/lib/i18n/bn.ts
index 316b969c58..6325a0f994 100644
--- a/app/src/lib/i18n/bn.ts
+++ b/app/src/lib/i18n/bn.ts
@@ -3310,6 +3310,11 @@ const messages: TranslationMap = {
'conversations.planReview.feedbackLabel': 'পরিবর্তন অনুরোধ করুন',
'conversations.planReview.feedbackPlaceholder': 'কী পরিবর্তন করতে হবে বর্ণনা করুন…',
'conversations.planReview.sendFeedback': 'মতামত পাঠান',
+ 'conversations.planReview.revise': 'সংশোধন',
+ 'conversations.runMode.plan': 'পরিকল্পনা',
+ 'conversations.runMode.build': 'বিল্ড',
+ 'conversations.runMode.toggleLabel': 'পরিকল্পনা এবং বিল্ড মোডের মধ্যে স্যুইচ করুন',
+ 'conversations.goal.inlineSummary': '{objective} ({status})',
'conversations.toolTimeline.turn': 'টার্ন',
'conversations.toolTimeline.step': 'ধাপ',
'conversations.toolTimeline.workerThread': 'ওয়ার্কার থ্রেড',
@@ -3676,6 +3681,8 @@ const messages: TranslationMap = {
'conversations.tools.checkArtifacts.done': 'আর্টিফ্যাক্ট যাচাই করা হয়েছে',
'conversations.tools.deleteArtifact.active': 'আর্টিফ্যাক্ট মোছা হচ্ছে',
'conversations.tools.deleteArtifact.done': 'আর্টিফ্যাক্ট মোছা হয়েছে',
+ 'conversations.tools.document.title': 'ডকুমেন্ট',
+ 'conversations.tools.presentation.title': 'উপস্থাপনা',
'conversations.subagent.noOutput': 'কোনো আউটপুট ফেরত আসেনি',
'conversations.subagent.close': 'বন্ধ করুন',
'conversations.subagent.cancel': 'কাজ বাতিল করুন',
diff --git a/app/src/lib/i18n/de.ts b/app/src/lib/i18n/de.ts
index ebf75873ea..8c6b70f7f5 100644
--- a/app/src/lib/i18n/de.ts
+++ b/app/src/lib/i18n/de.ts
@@ -3404,6 +3404,11 @@ const messages: TranslationMap = {
'conversations.planReview.feedbackLabel': 'Änderungen anfordern',
'conversations.planReview.feedbackPlaceholder': 'Beschreiben Sie, was geändert werden soll…',
'conversations.planReview.sendFeedback': 'Feedback senden',
+ 'conversations.planReview.revise': 'Überarbeiten',
+ 'conversations.runMode.plan': 'Plan',
+ 'conversations.runMode.build': 'Build',
+ 'conversations.runMode.toggleLabel': 'Zwischen Plan- und Build-Modus wechseln',
+ 'conversations.goal.inlineSummary': '{objective} ({status})',
'conversations.toolTimeline.turn': 'drehen',
'conversations.toolTimeline.step': 'Schritt',
'conversations.toolTimeline.workerThread': 'Worker-Thread',
@@ -3771,6 +3776,8 @@ const messages: TranslationMap = {
'conversations.tools.checkArtifacts.done': 'Artefakte geprüft',
'conversations.tools.deleteArtifact.active': 'Artefakt wird gelöscht',
'conversations.tools.deleteArtifact.done': 'Artefakt gelöscht',
+ 'conversations.tools.document.title': 'Dokument',
+ 'conversations.tools.presentation.title': 'Präsentation',
'conversations.subagent.noOutput': 'Keine Ausgabe zurückgegeben',
'conversations.subagent.close': 'Schließen',
'conversations.subagent.cancel': 'Aufgabe abbrechen',
diff --git a/app/src/lib/i18n/en.ts b/app/src/lib/i18n/en.ts
index 7e429e1b47..a34aa14097 100644
--- a/app/src/lib/i18n/en.ts
+++ b/app/src/lib/i18n/en.ts
@@ -3733,6 +3733,11 @@ const en: TranslationMap = {
'conversations.planReview.feedbackLabel': 'Request changes',
'conversations.planReview.feedbackPlaceholder': 'Describe what to change…',
'conversations.planReview.sendFeedback': 'Send feedback',
+ 'conversations.planReview.revise': 'Revise',
+ 'conversations.runMode.plan': 'Plan',
+ 'conversations.runMode.build': 'Build',
+ 'conversations.runMode.toggleLabel': 'Switch between plan and build mode',
+ 'conversations.goal.inlineSummary': '{objective} ({status})',
// Thread-level goal chip (Codex-style per-thread completion contract).
'conversations.toolTimeline.turn': 'turn',
'conversations.toolTimeline.step': 'step',
@@ -4100,6 +4105,8 @@ const en: TranslationMap = {
'conversations.tools.checkArtifacts.done': 'Checked artifacts',
'conversations.tools.deleteArtifact.active': 'Deleting artifact',
'conversations.tools.deleteArtifact.done': 'Deleted artifact',
+ 'conversations.tools.document.title': 'Document',
+ 'conversations.tools.presentation.title': 'Presentation',
'conversations.subagent.noOutput': 'No output returned',
'conversations.subagent.close': 'Close',
'conversations.subagent.cancel': 'Cancel task',
diff --git a/app/src/lib/i18n/es.ts b/app/src/lib/i18n/es.ts
index 1b61f50fdf..80815f43ce 100644
--- a/app/src/lib/i18n/es.ts
+++ b/app/src/lib/i18n/es.ts
@@ -3368,6 +3368,11 @@ const messages: TranslationMap = {
'conversations.planReview.feedbackLabel': 'Solicitar cambios',
'conversations.planReview.feedbackPlaceholder': 'Describe qué cambiar…',
'conversations.planReview.sendFeedback': 'Enviar comentarios',
+ 'conversations.planReview.revise': 'Revisar',
+ 'conversations.runMode.plan': 'Plan',
+ 'conversations.runMode.build': 'Compilación',
+ 'conversations.runMode.toggleLabel': 'Cambiar entre el modo de plan y compilación',
+ 'conversations.goal.inlineSummary': '{objective} ({status})',
'conversations.toolTimeline.turn': 'turno',
'conversations.toolTimeline.step': 'Paso',
'conversations.toolTimeline.workerThread': 'hilo de worker',
@@ -3734,6 +3739,8 @@ const messages: TranslationMap = {
'conversations.tools.checkArtifacts.done': 'Artefactos comprobados',
'conversations.tools.deleteArtifact.active': 'Eliminando artefacto',
'conversations.tools.deleteArtifact.done': 'Artefacto eliminado',
+ 'conversations.tools.document.title': 'Documento',
+ 'conversations.tools.presentation.title': 'Presentación',
'conversations.subagent.noOutput': 'No se devolvió ninguna salida',
'conversations.subagent.close': 'Cerrar',
'conversations.subagent.cancel': 'Cancelar tarea',
diff --git a/app/src/lib/i18n/fr.ts b/app/src/lib/i18n/fr.ts
index c6f4631b78..9504d66679 100644
--- a/app/src/lib/i18n/fr.ts
+++ b/app/src/lib/i18n/fr.ts
@@ -3392,6 +3392,11 @@ const messages: TranslationMap = {
'conversations.planReview.feedbackLabel': 'Demander des modifications',
'conversations.planReview.feedbackPlaceholder': 'Décrivez ce qu’il faut changer…',
'conversations.planReview.sendFeedback': 'Envoyer un retour',
+ 'conversations.planReview.revise': 'Réviser',
+ 'conversations.runMode.plan': 'Plan',
+ 'conversations.runMode.build': 'Build',
+ 'conversations.runMode.toggleLabel': 'Basculer entre le mode plan et le mode build',
+ 'conversations.goal.inlineSummary': '{objective} ({status})',
'conversations.toolTimeline.turn': 'tour',
'conversations.toolTimeline.step': 'Étape',
'conversations.toolTimeline.workerThread': 'fil worker',
@@ -3758,6 +3763,8 @@ const messages: TranslationMap = {
'conversations.tools.checkArtifacts.done': 'Artefacts vérifiés',
'conversations.tools.deleteArtifact.active': "Suppression de l'artefact",
'conversations.tools.deleteArtifact.done': 'Artefact supprimé',
+ 'conversations.tools.document.title': 'Document',
+ 'conversations.tools.presentation.title': 'Présentation',
'conversations.subagent.noOutput': 'Aucune sortie renvoyée',
'conversations.subagent.close': 'Fermer',
'conversations.subagent.cancel': 'Annuler la tâche',
diff --git a/app/src/lib/i18n/hi.ts b/app/src/lib/i18n/hi.ts
index 11593c72f8..37054a3e4e 100644
--- a/app/src/lib/i18n/hi.ts
+++ b/app/src/lib/i18n/hi.ts
@@ -3311,6 +3311,11 @@ const messages: TranslationMap = {
'conversations.planReview.feedbackLabel': 'बदलाव का अनुरोध करें',
'conversations.planReview.feedbackPlaceholder': 'वर्णन करें कि क्या बदलना है…',
'conversations.planReview.sendFeedback': 'प्रतिक्रिया भेजें',
+ 'conversations.planReview.revise': 'संशोधित करें',
+ 'conversations.runMode.plan': 'योजना',
+ 'conversations.runMode.build': 'बिल्ड',
+ 'conversations.runMode.toggleLabel': 'योजना और बिल्ड मोड के बीच स्विच करें',
+ 'conversations.goal.inlineSummary': '{objective} ({status})',
'conversations.toolTimeline.turn': 'टर्न',
'conversations.toolTimeline.step': 'चरण',
'conversations.toolTimeline.workerThread': 'वर्कर थ्रेड',
@@ -3677,6 +3682,8 @@ const messages: TranslationMap = {
'conversations.tools.checkArtifacts.done': 'आर्टिफैक्ट जाँचे',
'conversations.tools.deleteArtifact.active': 'आर्टिफैक्ट हटा रहा है',
'conversations.tools.deleteArtifact.done': 'आर्टिफैक्ट हटाया',
+ 'conversations.tools.document.title': 'दस्तावेज़',
+ 'conversations.tools.presentation.title': 'प्रस्तुति',
'conversations.subagent.noOutput': 'कोई आउटपुट नहीं मिला',
'conversations.subagent.close': 'बंद करें',
'conversations.subagent.cancel': 'कार्य रद्द करें',
diff --git a/app/src/lib/i18n/id.ts b/app/src/lib/i18n/id.ts
index 81b50def29..06be3db9b0 100644
--- a/app/src/lib/i18n/id.ts
+++ b/app/src/lib/i18n/id.ts
@@ -3326,6 +3326,11 @@ const messages: TranslationMap = {
'conversations.planReview.feedbackLabel': 'Minta perubahan',
'conversations.planReview.feedbackPlaceholder': 'Jelaskan apa yang harus diubah…',
'conversations.planReview.sendFeedback': 'Kirim masukan',
+ 'conversations.planReview.revise': 'Revisi',
+ 'conversations.runMode.plan': 'Rencana',
+ 'conversations.runMode.build': 'Build',
+ 'conversations.runMode.toggleLabel': 'Beralih antara mode rencana dan build',
+ 'conversations.goal.inlineSummary': '{objective} ({status})',
'conversations.toolTimeline.turn': 'giliran',
'conversations.toolTimeline.step': 'Langkah',
'conversations.toolTimeline.workerThread': 'thread worker',
@@ -3692,6 +3697,8 @@ const messages: TranslationMap = {
'conversations.tools.checkArtifacts.done': 'Artefak diperiksa',
'conversations.tools.deleteArtifact.active': 'Menghapus artefak',
'conversations.tools.deleteArtifact.done': 'Artefak dihapus',
+ 'conversations.tools.document.title': 'Dokumen',
+ 'conversations.tools.presentation.title': 'Presentasi',
'conversations.subagent.noOutput': 'Tidak ada keluaran',
'conversations.subagent.close': 'Tutup',
'conversations.subagent.cancel': 'Batalkan tugas',
diff --git a/app/src/lib/i18n/it.ts b/app/src/lib/i18n/it.ts
index 636b77041f..4f3a0601f7 100644
--- a/app/src/lib/i18n/it.ts
+++ b/app/src/lib/i18n/it.ts
@@ -3367,6 +3367,11 @@ const messages: TranslationMap = {
'conversations.planReview.feedbackLabel': 'Richiedi modifiche',
'conversations.planReview.feedbackPlaceholder': 'Descrivi cosa cambiare…',
'conversations.planReview.sendFeedback': 'Invia feedback',
+ 'conversations.planReview.revise': 'Rivedi',
+ 'conversations.runMode.plan': 'Piano',
+ 'conversations.runMode.build': 'Build',
+ 'conversations.runMode.toggleLabel': 'Passa dalla modalità piano alla modalità build',
+ 'conversations.goal.inlineSummary': '{objective} ({status})',
'conversations.toolTimeline.turn': 'turno',
'conversations.toolTimeline.step': 'Passo',
'conversations.toolTimeline.workerThread': 'thread worker',
@@ -3733,6 +3738,8 @@ const messages: TranslationMap = {
'conversations.tools.checkArtifacts.done': 'Artefatti verificati',
'conversations.tools.deleteArtifact.active': "Eliminazione dell'artefatto",
'conversations.tools.deleteArtifact.done': 'Artefatto eliminato',
+ 'conversations.tools.document.title': 'Documento',
+ 'conversations.tools.presentation.title': 'Presentazione',
'conversations.subagent.noOutput': 'Nessun output restituito',
'conversations.subagent.close': 'Chiudi',
'conversations.subagent.cancel': 'Annulla attività',
diff --git a/app/src/lib/i18n/ko.ts b/app/src/lib/i18n/ko.ts
index 3f3e7f5f33..2cf446ffa0 100644
--- a/app/src/lib/i18n/ko.ts
+++ b/app/src/lib/i18n/ko.ts
@@ -3276,6 +3276,11 @@ const messages: TranslationMap = {
'conversations.planReview.feedbackLabel': '변경 요청',
'conversations.planReview.feedbackPlaceholder': '무엇을 바꿀지 설명하세요…',
'conversations.planReview.sendFeedback': '의견 보내기',
+ 'conversations.planReview.revise': '수정',
+ 'conversations.runMode.plan': '계획',
+ 'conversations.runMode.build': '빌드',
+ 'conversations.runMode.toggleLabel': '계획 모드와 빌드 모드 전환',
+ 'conversations.goal.inlineSummary': '{objective} ({status})',
'conversations.toolTimeline.turn': '턴',
'conversations.toolTimeline.step': '단계',
'conversations.toolTimeline.workerThread': '워커 스레드',
@@ -3642,6 +3647,8 @@ const messages: TranslationMap = {
'conversations.tools.checkArtifacts.done': '아티팩트 확인함',
'conversations.tools.deleteArtifact.active': '아티팩트 삭제 중',
'conversations.tools.deleteArtifact.done': '아티팩트 삭제함',
+ 'conversations.tools.document.title': '문서',
+ 'conversations.tools.presentation.title': '프레젠테이션',
'conversations.subagent.noOutput': '반환된 출력 없음',
'conversations.subagent.close': '닫기',
'conversations.subagent.cancel': '작업 취소',
diff --git a/app/src/lib/i18n/pl.ts b/app/src/lib/i18n/pl.ts
index ffcdae736f..55a0a9e86c 100644
--- a/app/src/lib/i18n/pl.ts
+++ b/app/src/lib/i18n/pl.ts
@@ -3350,6 +3350,11 @@ const messages: TranslationMap = {
'conversations.planReview.feedbackLabel': 'Poproś o zmiany',
'conversations.planReview.feedbackPlaceholder': 'Opisz, co zmienić…',
'conversations.planReview.sendFeedback': 'Wyślij opinię',
+ 'conversations.planReview.revise': 'Zmień',
+ 'conversations.runMode.plan': 'Plan',
+ 'conversations.runMode.build': 'Build',
+ 'conversations.runMode.toggleLabel': 'Przełącz między trybem planu i budowania',
+ 'conversations.goal.inlineSummary': '{objective} ({status})',
'conversations.toolTimeline.turn': 'tura',
'conversations.toolTimeline.step': 'Krok',
'conversations.toolTimeline.workerThread': 'wątek workera',
@@ -3716,6 +3721,8 @@ const messages: TranslationMap = {
'conversations.tools.checkArtifacts.done': 'Sprawdzono artefakty',
'conversations.tools.deleteArtifact.active': 'Usuwanie artefaktu',
'conversations.tools.deleteArtifact.done': 'Usunięto artefakt',
+ 'conversations.tools.document.title': 'Dokument',
+ 'conversations.tools.presentation.title': 'Prezentacja',
'conversations.subagent.noOutput': 'Brak zwróconych danych wyjściowych',
'conversations.subagent.close': 'Zamknij',
'conversations.subagent.cancel': 'Anuluj zadanie',
diff --git a/app/src/lib/i18n/pt.ts b/app/src/lib/i18n/pt.ts
index e184559dbb..d37d18e13f 100644
--- a/app/src/lib/i18n/pt.ts
+++ b/app/src/lib/i18n/pt.ts
@@ -3364,6 +3364,11 @@ const messages: TranslationMap = {
'conversations.planReview.feedbackLabel': 'Solicitar alterações',
'conversations.planReview.feedbackPlaceholder': 'Descreva o que mudar…',
'conversations.planReview.sendFeedback': 'Enviar comentários',
+ 'conversations.planReview.revise': 'Revisar',
+ 'conversations.runMode.plan': 'Plano',
+ 'conversations.runMode.build': 'Build',
+ 'conversations.runMode.toggleLabel': 'Alternar entre o modo de plano e o modo de build',
+ 'conversations.goal.inlineSummary': '{objective} ({status})',
'conversations.toolTimeline.turn': 'turno',
'conversations.toolTimeline.step': 'Passo',
'conversations.toolTimeline.workerThread': 'thread de worker',
@@ -3730,6 +3735,8 @@ const messages: TranslationMap = {
'conversations.tools.checkArtifacts.done': 'Artefatos verificados',
'conversations.tools.deleteArtifact.active': 'Excluindo artefato',
'conversations.tools.deleteArtifact.done': 'Artefato excluído',
+ 'conversations.tools.document.title': 'Documento',
+ 'conversations.tools.presentation.title': 'Apresentação',
'conversations.subagent.noOutput': 'Nenhuma saída retornada',
'conversations.subagent.close': 'Fechar',
'conversations.subagent.cancel': 'Cancelar tarefa',
diff --git a/app/src/lib/i18n/ru.ts b/app/src/lib/i18n/ru.ts
index dc2ae6d3f8..afa79d44d8 100644
--- a/app/src/lib/i18n/ru.ts
+++ b/app/src/lib/i18n/ru.ts
@@ -3339,6 +3339,11 @@ const messages: TranslationMap = {
'conversations.planReview.feedbackLabel': 'Запросить изменения',
'conversations.planReview.feedbackPlaceholder': 'Опишите, что изменить…',
'conversations.planReview.sendFeedback': 'Отправить отзыв',
+ 'conversations.planReview.revise': 'Изменить',
+ 'conversations.runMode.plan': 'План',
+ 'conversations.runMode.build': 'Сборка',
+ 'conversations.runMode.toggleLabel': 'Переключение между режимом плана и режимом сборки',
+ 'conversations.goal.inlineSummary': '{objective} ({status})',
'conversations.toolTimeline.turn': 'ход',
'conversations.toolTimeline.step': 'Шаг',
'conversations.toolTimeline.workerThread': 'чат воркера',
@@ -3705,6 +3710,8 @@ const messages: TranslationMap = {
'conversations.tools.checkArtifacts.done': 'Артефакты проверены',
'conversations.tools.deleteArtifact.active': 'Удаление артефакта',
'conversations.tools.deleteArtifact.done': 'Артефакт удалён',
+ 'conversations.tools.document.title': 'Документ',
+ 'conversations.tools.presentation.title': 'Презентация',
'conversations.subagent.noOutput': 'Вывод отсутствует',
'conversations.subagent.close': 'Закрыть',
'conversations.subagent.cancel': 'Отменить задачу',
diff --git a/app/src/lib/i18n/zh-CN.ts b/app/src/lib/i18n/zh-CN.ts
index a315ce5e67..1e14b2c609 100644
--- a/app/src/lib/i18n/zh-CN.ts
+++ b/app/src/lib/i18n/zh-CN.ts
@@ -3116,6 +3116,11 @@ const messages: TranslationMap = {
'conversations.planReview.feedbackLabel': '请求修改',
'conversations.planReview.feedbackPlaceholder': '描述需要修改的内容…',
'conversations.planReview.sendFeedback': '发送反馈',
+ 'conversations.planReview.revise': '修改',
+ 'conversations.runMode.plan': '计划',
+ 'conversations.runMode.build': '构建',
+ 'conversations.runMode.toggleLabel': '在计划模式和构建模式之间切换',
+ 'conversations.goal.inlineSummary': '{objective} ({status})',
'conversations.toolTimeline.turn': '轮次',
'conversations.toolTimeline.step': '步骤',
'conversations.toolTimeline.workerThread': '工作线程',
@@ -3482,6 +3487,8 @@ const messages: TranslationMap = {
'conversations.tools.checkArtifacts.done': '已检查工件',
'conversations.tools.deleteArtifact.active': '正在删除工件',
'conversations.tools.deleteArtifact.done': '已删除工件',
+ 'conversations.tools.document.title': '文档',
+ 'conversations.tools.presentation.title': '演示文稿',
'conversations.subagent.noOutput': '无输出返回',
'conversations.subagent.close': '关闭',
'conversations.subagent.cancel': '取消任务',
diff --git a/app/src/store/index.ts b/app/src/store/index.ts
index a059e096e5..f829cee7fd 100644
--- a/app/src/store/index.ts
+++ b/app/src/store/index.ts
@@ -33,6 +33,7 @@ import notificationReducer from './notificationSlice';
import personaReducer from './personaSlice';
import providerSurfacesReducer from './providerSurfaceSlice';
import { pttReducer } from './pttSlice';
+import queueReducer from './queueSlice';
import runModeReducer from './runModeSlice';
import socketReducer from './socketSlice';
import themeReducer from './themeSlice';
@@ -256,6 +257,8 @@ export const store = configureStore({
thread: persistedThreadReducer,
layout: persistedLayoutReducer,
chatRuntime: persistedChatRuntimeReducer,
+ // In-memory only: the core's run queue for running turns.
+ queue: queueReducer,
channelConnections: persistedChannelConnectionsReducer,
accounts: persistedAccountsReducer,
notifications: persistedNotificationReducer,
diff --git a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs b/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
index 729de44580..4e8957d0c6 100644
--- a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
+++ b/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
@@ -140,17 +140,29 @@ async fn cancel_chat_inner(
};
// Emit a cancelled chat_error for each cancelled turn (primary + parallels)
- // so every interleaved branch's UI is resolved.
+ // so every interleaved branch's UI is resolved. `chat_cancelled` is the new,
+ // purpose-built terminal event (structured `cancel_reason`, no
+ // `error_type` string to parse); `chat_error{error_type:"cancelled"}` is
+ // kept alongside it for one release so an older frontend build still
+ // resolves the turn.
for request_id in removed_request_id.into_iter().chain(cancelled_parallel) {
publish_web_channel_event(WebChannelEvent {
event: "chat_error".to_string(),
client_id: client_id.to_string(),
thread_id: thread_id.to_string(),
- request_id,
+ request_id: request_id.clone(),
message: Some("Cancelled".to_string()),
error_type: Some("cancelled".to_string()),
..Default::default()
});
+ publish_web_channel_event(WebChannelEvent {
+ event: "chat_cancelled".to_string(),
+ client_id: client_id.to_string(),
+ thread_id: thread_id.to_string(),
+ request_id,
+ cancel_reason: Some("user_stop".to_string()),
+ ..Default::default()
+ });
}
Ok(CancelOutcome {
@@ -196,11 +208,28 @@ pub async fn channel_web_chat(
))
}
+/// Render one snapshotted queue item as the wire shape `web_queue_status` and
+/// `queue_item_*` socket events share: `{ id, lane, text_preview }`.
+fn queue_item_json(lane: tinyagents_harness::run_queue::QueueLane, item: &crate::agent::queued_turn::QueuedTurn) -> Value {
+ json!({
+ "id": item.id,
+ "lane": lane.as_str(),
+ "text_preview": crate::agent::queued_turn::text_preview(&item.text),
+ })
+}
+
pub async fn channel_web_queue_status(thread_id: &str) -> Result<RpcOutcome<Value>, String> {
let map_key = key_for(thread_id);
let in_flight = IN_FLIGHT.lock().await;
if let Some(entry) = in_flight.get(&map_key) {
let status = entry.run_queue.status().await;
+ let items: Vec<Value> = entry
+ .run_queue
+ .snapshot()
+ .await
+ .iter()
+ .map(|(lane, item)| queue_item_json(*lane, item))
+ .collect();
Ok(RpcOutcome::single_log(
json!({
"thread_id": thread_id.trim(),
@@ -210,6 +239,7 @@ pub async fn channel_web_queue_status(thread_id: &str) -> Result<RpcOutcome<Valu
"followups": status.followups,
"collects": status.collects,
"total": status.total,
+ "items": items,
}),
"queue status retrieved",
))
@@ -222,12 +252,69 @@ pub async fn channel_web_queue_status(thread_id: &str) -> Result<RpcOutcome<Valu
"followups": 0,
"collects": 0,
"total": 0,
+ "items": Vec::<Value>::new(),
}),
"no active turn for thread",
))
}
}
+/// `channel.web_queue_remove` — retract one specific queued item (e.g. the
+/// user deleted a queued message from the composer's queue UI) without
+/// touching the rest of the queue. Emits `queue_item_removed` on an actual
+/// removal; a no-op removal (unknown id, or no active turn) is silently
+/// `removed: false` — the item is already gone either way.
+pub async fn channel_web_queue_remove(
+ client_id: &str,
+ thread_id: &str,
+ item_id: &str,
+) -> Result<RpcOutcome<Value>, String> {
+ let client_id = client_id.trim();
+ let thread_id = thread_id.trim();
+ let item_id = item_id.trim();
+ if item_id.is_empty() {
+ return Err("item_id is required".to_string());
+ }
+ let map_key = key_for(thread_id);
+ let in_flight = IN_FLIGHT.lock().await;
+ let Some(entry) = in_flight.get(&map_key) else {
+ return Ok(RpcOutcome::single_log(
+ json!({
+ "thread_id": thread_id,
+ "item_id": item_id,
+ "removed": false,
+ }),
+ "no active turn for thread",
+ ));
+ };
+ let removed = entry.run_queue.remove_where(|item| item.id == item_id).await;
+ drop(in_flight);
+ if removed > 0 {
+ log::info!(
+ "[web-channel] removed queued item thread_id={thread_id} item_id={item_id}"
+ );
+ publish_web_channel_event(WebChannelEvent {
+ event: "queue_item_removed".to_string(),
+ client_id: client_id.to_string(),
+ thread_id: thread_id.to_string(),
+ queue_item: Some(crate::core::socketio::QueueItemPayload {
+ id: item_id.to_string(),
+ lane: None,
+ text_preview: None,
+ }),
+ ..Default::default()
+ });
+ }
+ Ok(RpcOutcome::single_log(
+ json!({
+ "thread_id": thread_id,
+ "item_id": item_id,
+ "removed": removed > 0,
+ }),
+ "queue item remove processed",
+ ))
+}
+
pub async fn channel_web_queue_clear(thread_id: &str) -> Result<RpcOutcome<Value>, String> {
let map_key = key_for(thread_id);
let in_flight = IN_FLIGHT.lock().await;