Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(release): finish agent recovery and workspace tabs for the next release

rubenluetke10-beep18ce6697d765
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4c0fd240e3..e981839756 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,27 +9,29 @@ versioning per [SemVer](https://semver.org/).
## [Unreleased]
----
-
-## [2.5.0] — 2026-10-01
-
### Added
-- Quick switcher with a configurable keyboard shortcut and faster section navigation.
-- Move coding terminals between workspaces without restarting the agent.
+- Desktop pets with six built-in characters, animated reactions, a compact control strip, and configurable appearance and size.
+- A redesigned profile page and a dedicated Keyboard Shortcuts page in Settings.
+- Quick section switching, an Agentic IDE key menu, and multiple workspace shell tabs.
+- Move running coding terminals between workspaces in the same folder without restarting the agent.
- Remote agents retain approved Jarvis tools through scoped SSH forwarding.
### Changed
+- First-run guidance helps users connect an agent subscription and configure their wake phrase.
+- Agents continue requested work, recover incomplete tool steps, and use question cards when essential information is missing.
- Background learning and wiki work use the connected agent seat and respect subscription billing boundaries.
-- Remove default scheduled work and retain user-edited skills during migration.
-- Integrate local desktop updates with the latest published installation and permission fixes.
+- Provider health indicators read actual call outcomes without sending paid test requests.
+- Built-in routines no longer start scheduled work without the user's setup; edited skills are preserved during migration.
### Fixed
-- Improve dictation delivery, retained terminal rendering, and delegation result routing.
-- Require release tags for publishing and reject superseded CI successes during release admission.
-- Require explicit opt-in for live realtime integration calls and keep shell scripts portable across checkouts.
+- Native application updates and restarts preserve the installation and return the app to the desktop.
+- Dictation delivery, retained terminal rendering, and delegated result reporting are more reliable.
+- Stricter per-chat approval settings survive changes to agent defaults.
+- Release publishing requires a tag and the newest successful CI result; version bumps keep the dependency lock consistent.
+- Cancelled CI runs release their queued aggregation work, and live realtime tests require explicit opt-in.
---
diff --git a/jarvis/__init__.py b/jarvis/__init__.py
index 38fe8aa0e3..47ca2d7e58 100644
--- a/jarvis/__init__.py
+++ b/jarvis/__init__.py
@@ -1,3 +1,3 @@
"""Personal Jarvis — a voice-driven, cross-platform meta-orchestrator."""
-__version__ = "2.5.0"
+__version__ = "2.4.4"
diff --git a/jarvis/agent_chat/runner_api.py b/jarvis/agent_chat/runner_api.py
index 9a102da436..598ab856f6 100644
--- a/jarvis/agent_chat/runner_api.py
+++ b/jarvis/agent_chat/runner_api.py
@@ -158,6 +158,8 @@ class TurnHandle:
output_language: str = ""
goal_turn: bool = False
control_service: Any = None
+ #: A continuation keeps the turn's already resolved language and identity.
+ continuation: bool = False
# ------------------------------------------------------------ history
diff --git a/jarvis/agent_chat/runner_cli.py b/jarvis/agent_chat/runner_cli.py
index 03a33c3461..5a103974f9 100644
--- a/jarvis/agent_chat/runner_cli.py
+++ b/jarvis/agent_chat/runner_cli.py
@@ -78,7 +78,11 @@ from jarvis.agent_chat.permissions import normalize_permission
from jarvis.agent_chat.runner_api import TurnHandle
from jarvis.agent_chat.tool_context import register_turn, unregister_turn
from jarvis.core.process_utils import NO_WINDOW_CREATIONFLAGS
-from jarvis.core.response_style import KEEP_GOING_ON_TOOL_FAILURE, TASK_EXECUTION_GUIDANCE
+from jarvis.core.response_style import (
+ AGENT_QUESTION_GUIDANCE,
+ KEEP_GOING_ON_TOOL_FAILURE,
+ TASK_EXECUTION_GUIDANCE,
+)
log = logging.getLogger(__name__)
@@ -1253,6 +1257,7 @@ def _with_identity(
"Use existing connected-account information; ask only for essential "
"missing information. "
+ TASK_EXECUTION_GUIDANCE + "\n"
+ + AGENT_QUESTION_GUIDANCE + "\n"
+ KEEP_GOING_ON_TOOL_FAILURE
+ " Existing permission rules still apply.\n"
+ CONVERSATIONAL_TURN_REMINDER
@@ -2663,7 +2668,7 @@ async def run_cli_turn(
recovery.declined = True
return answer
- if session.surface == "society":
+ if session.surface == "society" and not handle.continuation:
from jarvis.society.reply_preference import resolve_agent_reply_language
handle.output_language = await resolve_agent_reply_language(
diff --git a/jarvis/agent_chat/service.py b/jarvis/agent_chat/service.py
index 8fb6f4a205..07ecd79a97 100644
--- a/jarvis/agent_chat/service.py
+++ b/jarvis/agent_chat/service.py
@@ -169,7 +169,9 @@ class _OpenQuestion:
``result`` resolves once the card closes; callers wait on it in slices.
"""
- __slots__ = ("answers", "closing", "result", "session_id", "specs", "turn_id", "wake")
+ __slots__ = (
+ "answers", "closing", "delivered", "result", "session_id", "specs", "turn_id", "wake",
+ )
def __init__(
self,
@@ -186,6 +188,7 @@ class _OpenQuestion:
self.closing = ""
self.wake = asyncio.Event()
self.result = result
+ self.delivered = False
@property
def done(self) -> bool:
@@ -733,16 +736,32 @@ class AgentChatService:
str(handle.trace_id),
)
origin_token = current_chat_turn.set(origin)
- try:
+ from jarvis.agent_chat.turn_completion import TurnCompletion
+
+ completion = (
+ TurnCompletion(
+ self, handle, origin.user_text,
+ allow_correction=origin.direct_user and not read_only,
+ context=prompt,
+ )
+ if session.surface == "society" and control_runner is None and not native_goal
+ else None
+ )
+ run_handle = (
+ replace(handle, emit=completion.emit, request_approval=completion.ask)
+ if completion is not None else handle
+ )
+
+ async def run_attempt(run_prompt: str) -> None:
if control_runner is not None:
- vendor = await control_runner(handle, text)
+ vendor = await control_runner(run_handle, text)
if vendor:
self.store.update_session(session_id, vendor_session=vendor)
elif runner == "brain":
async with self._brain_lock:
await run_brain_turn(
- handle,
- prompt,
+ run_handle,
+ run_prompt,
bridge=self._bridge_for(bus),
always_allowed=self.always_allowed(session_id),
**({"tool_choices": selected} if selected else {}),
@@ -759,8 +778,8 @@ class AgentChatService:
# a surface that combines the two keeps working.
as_jarvis = kit.brain_runner and kit.cli_seats
vendor = await run_cli_turn(
- handle,
- prompt + selection_briefing(selected),
+ run_handle,
+ run_prompt + selection_briefing(selected),
runner,
identity=as_jarvis,
bridge=self._bridge_for(bus) if as_jarvis else None,
@@ -769,7 +788,7 @@ class AgentChatService:
if vendor and vendor != session.vendor_session:
self.store.update_session(session_id, vendor_session=vendor)
elif runner == "api" and supports_api_runner(session.provider):
- await run_api_turn(handle, prompt)
+ await run_api_turn(run_handle, run_prompt)
else:
await self._emit(
session_id,
@@ -787,6 +806,29 @@ class AgentChatService:
},
),
)
+
+ try:
+ run_prompt = prompt
+ for _ in range(MAX_ASKS_PER_TURN + 2):
+ await run_attempt(run_prompt)
+ if completion is None:
+ break
+ continuation = await completion.next_prompt()
+ if continuation is None:
+ break
+ stored = self.store.get_session(session_id)
+ run_handle = replace(
+ run_handle,
+ session=replace(
+ run_handle.session,
+ vendor_session=stored.vendor_session if stored else None,
+ ),
+ history=self.store.list_events(session_id),
+ continuation=True,
+ )
+ run_prompt = continuation
+ if completion is not None:
+ await completion.publish()
except asyncio.CancelledError:
await self._emit(
session_id,
@@ -796,7 +838,11 @@ class AgentChatService:
"turn_id": turn_id,
"status": "cancelled",
"duration_ms": int((time.monotonic() - started) * 1000),
- "usage": {},
+ "usage": completion.usage if completion is not None else {},
+ **(
+ {"cost_usd": completion.cost}
+ if completion and completion.cost is not None else {}
+ ),
"error": None,
},
),
@@ -812,7 +858,11 @@ class AgentChatService:
"turn_id": turn_id,
"status": "error",
"duration_ms": 0,
- "usage": {},
+ "usage": completion.usage if completion is not None else {},
+ **(
+ {"cost_usd": completion.cost}
+ if completion and completion.cost is not None else {}
+ ),
"error": f"{type(exc).__name__}: {exc}",
},
),
@@ -1139,7 +1189,9 @@ class AgentChatService:
if open_q is None or open_q.session_id != session_id:
raise KeyError(question_id)
try:
- return await asyncio.wait_for(asyncio.shield(open_q.result), timeout_s)
+ answers = await asyncio.wait_for(asyncio.shield(open_q.result), timeout_s)
+ open_q.delivered = True
+ return answers
except TimeoutError: # still open: the caller polls again
return None
@@ -1150,6 +1202,13 @@ class AgentChatService:
raise KeyError(question_id)
return open_q.specs
+ def undelivered_questions(self, session_id: str, turn_id: str) -> list[str]:
+ """Cards whose answers have not reached the runner, including just-answered ones."""
+ return [
+ qid for qid, q in self._questions.items()
+ if q.session_id == session_id and q.turn_id == turn_id and not q.delivered
+ ]
+
async def ask_questions(
self,
session_id: str,
@@ -1172,20 +1231,9 @@ class AgentChatService:
deadline = loop.time() + timeout_s
try:
while not open_q.done:
- remaining = deadline - loop.time()
- if remaining <= 0:
- log.info(
- "agent chat: question %s in %s timed out; recommendations applied",
- question_id,
- open_q.session_id,
- )
- open_q.closing = TIMEOUT
- break
+ # Inspect stored answers before waiting. A click can arrive
+ # before this watcher starts or while a progress event emits.
open_q.wake.clear()
- try:
- await asyncio.wait_for(open_q.wake.wait(), remaining)
- except TimeoutError: # the loop re-reads the deadline and closes
- continue
answered = sum(a is not None for a in open_q.answers)
if answered > reported and not open_q.done:
reported = answered
@@ -1202,6 +1250,20 @@ class AgentChatService:
},
),
)
+ continue
+ remaining = deadline - loop.time()
+ if remaining <= 0:
+ log.info(
+ "agent chat: question %s in %s timed out; recommendations applied",
+ question_id,
+ open_q.session_id,
+ )
+ open_q.closing = TIMEOUT
+ break
+ try:
+ await asyncio.wait_for(open_q.wake.wait(), remaining)
+ except TimeoutError: # the loop re-reads the deadline and closes
+ continue
except asyncio.CancelledError:
# App shutdown: the card closes with the process.
open_q.closing = CANCELLED
diff --git a/jarvis/agent_chat/turn_completion.py b/jarvis/agent_chat/turn_completion.py
new file mode 100644
index 0000000000..8fba2a56ec
--- /dev/null
+++ b/jarvis/agent_chat/turn_completion.py
@@ -0,0 +1,215 @@
+"""Keep an owned task alive across question cards and premature offers.
+
+Question continuation is driven by real card state, never by parsing an answer
+as consent. The prose guard is deliberately narrow: one correction for common
+offer-only replies to an explicit execution request, without a second judge.
+It does not infer completion of arbitrary tasks or authorize new actions.
+"""
+
+from __future__ import annotations
+
+import asyncio
+import json
+import re
+import time
+from typing import Any
+
+from .questions import CANCELLED, MAX_ASKS_PER_TURN
+from .task_recovery import ToolRecovery
+
+_REQUEST = re.compile(
+ r"^\s*(?:(?:hello|hi|hallo|hola)[,! ]+)?" # i18n-allow
+ r"(?:(?:please|bitte|por favor)\s+)?" # i18n-allow
+ r"(?:can you|could you|i want you to|create|write|build|make|fix|save|send|"
+ r"kannst du|k[oö]nntest du|ich m[oö]chte|erstelle|schreib\w*|baue?|mach\w*|" # i18n-allow
+ r"reparier\w*|speicher\w*|sende|por favor|puedes|crea|escribe|haz|guarda)\b", # i18n-allow
+ re.I,
+)
+_ADVICE = re.compile(
+ r"\b(?:ideas?|suggest|suggestions?|recommend|advice|explain|understand|why|how to|how do|"
+ r"translate|quote|example|did you|have you|"
+ r"poem|poetry|story|lyrics|fiction|draft|"
+ r"ideen|vorschl[aä]g\w*|empfiehl\w*|erkl[aä]r\w*|" # i18n-allow
+ r"wie kann|wie geht|hast du|warum|wieso|" # i18n-allow
+ r"[uü]bersetz\w*|zitiere|beispiel|gedicht|geschichte|entwurf|plan|planning|" # i18n-allow
+ r"explica|traduce|ejemplo|sugerencias)\b", # i18n-allow
+ re.I,
+)
+_OFFER = re.compile(
+ r"^(?:(?:sure|yes|okay|ok|gerne|klar|nat[uü]rlich|ja|s[ií])[.!,: —-]*\s*)?" # i18n-allow
+ r"(?:i (?:can|could|would|suggest)|if you (?:want|like)|would you like me|shall i|"
+ r"ich (?:kann|k[oö]nnte|w[uü]rde|schlage)|wenn du (?:m[oö]chtest|willst)|" # i18n-allow
+ r"soll ich|m[oö]chtest du|vorschlag|puedo|podr[ií]a|si quieres|te propongo)\b", # i18n-allow
+ re.I,
+)
+_READS = frozenset(
+ {
+ "read",
+ "ls",
+ "glob",
+ "grep",
+ "toolsearch",
+ "tools-list",
+ "search_tools",
+ "society_memory_recall",
+ "society_conversation_recall",
+ "society_routines",
+ "society_ask_user",
+ }
+)
+
+
+def offer_instead_of_action(request: str, response: str) -> bool:
+ """Conservative guard; explanations, plans, examples and real results pass."""
+ if not _REQUEST.search(request) or _ADVICE.search(request):
+ return False
+ answer = response.strip().lstrip("* ")
+ if re.match(
+ r"(?:I can confirm|Ich kann best[aä]tigen|Puedo confirmar)\b", answer, re.I # i18n-allow: detect localized confirmation replies
+ ): # i18n-allow
+ return False
+ blocking_question = (
+ len(answer) <= 400
+ and "\n\n" not in answer
+ and answer.endswith("?")
+ and bool(
+ re.match(
+ r"(?:which|what|where|when|who|"
+ r"welch\w*|was|wo|wann|wer|qu[eé]|cu[aá]l)\b", # i18n-allow
+ answer,
+ re.I,
+ )
+ )
+ )
+ return len(answer) <= 2400 and (bool(_OFFER.search(answer)) or blocking_question)
+
+
+class TurnCompletion:
+ def __init__(
+ self,
+ service: Any,
+ handle: Any,
+ request: str,
+ *,
+ allow_correction: bool,
+ context: str | None = None,
+ ) -> None:
+ self.service = service
+ self.handle = handle
+ self.request = request
+ self.context = context or request
+ self.allow_correction = allow_correction
+ self.corrected = False
+ self.last_text = ""
+ self.finish_event: dict[str, Any] | None = None
+ self.usage: dict[str, Any] = {}
+ self.cost: float | None = None
+ self.started = time.monotonic()
+ self.answered: set[str] = set()
+ self.calls: dict[str, tuple[str, dict[str, Any]]] = {}
+ self.receipts = ToolRecovery()
+ self.did_work = False
+
+ async def emit(self, event: dict[str, Any]) -> None:
+ payload = event.get("payload") or {}
+ kind = event.get("kind")
+ if kind == "turn_finished":
+ self.finish_event = event
+ for key, value in (payload.get("usage") or {}).items():
+ if isinstance(value, (int, float)) and not isinstance(value, bool):
+ self.usage[key] = self.usage.get(key, 0) + value
+ else:
+ self.usage[key] = value
+ if isinstance(payload.get("cost_usd"), (int, float)):
+ self.cost = (self.cost or 0) + payload["cost_usd"]
+ return # The service publishes one final event when work actually stops.
+ self.receipts.observe(event)
+ if kind == "assistant_text":
+ self.last_text = str(payload.get("text") or "")
+ elif kind == "tool_call":
+ name = str(payload.get("name") or "").rsplit("__", 1)[-1].lower()
+ self.calls[str(payload.get("call_id") or "")] = (name, payload.get("input") or {})
+ elif kind == "tool_result":
+ name, _ = self.calls.pop(str(payload.get("call_id") or ""), ("", {}))
+ if name and name not in _READS and not payload.get("is_error"):
+ self.did_work = True
+ await self.handle.emit(event)
+
+ async def ask(self, *args: Any) -> str:
+ decision = await self.handle.request_approval(*args)
+ if decision in {"deny", "cancel"}:
+ self.receipts.declined = True
+ return decision
+
+ async def next_prompt(self) -> str | None:
+ if self.handle.cancel.is_set():
+ raise asyncio.CancelledError
+ if not self.finish_event or self.finish_event["payload"].get("status") != "done":
+ return None
+ sid = self.handle.session.session_id
+ cards = set(self.service.undelivered_questions(sid, self.handle.turn_id)) - self.answered
+ if cards:
+ rows = []
+ for question_id in sorted(cards):
+ if len(self.answered) >= MAX_ASKS_PER_TURN:
+ break
+ specs = self.service.question_specs(sid, question_id)
+ wait = asyncio.create_task(self.service.wait_questions(sid, question_id))
+ stop = asyncio.create_task(self.handle.cancel.wait())
+ try:
+ await asyncio.wait({wait, stop}, return_when=asyncio.FIRST_COMPLETED)
+ if self.handle.cancel.is_set():
+ raise asyncio.CancelledError
+ answers = await wait
+ finally:
+ for task in (wait, stop):
+ if not task.done():
+ task.cancel()
+ await asyncio.gather(wait, stop, return_exceptions=True)
+ for spec, answer in zip(specs, answers, strict=True):
+ if answer.source == CANCELLED:
+ raise asyncio.CancelledError
+ rows.append({"question": spec.question, **answer.to_payload()})
+ self.answered.add(question_id)
+ if rows:
+ return (
+ "Continue the original task now using these question-card results. "
+ "They are user choices or explicitly labelled defaults, not extra permissions. "
+ "Do not ask the user to start you again or repeat answered questions. "
+ "Preserve completed work and verify the requested result.\n"
+ + json.dumps(rows, ensure_ascii=False)
+ + "\nOriginal request:\n"
+ + self.context
+ )
+ if (
+ self.allow_correction
+ and not self.corrected
+ and not self.did_work
+ and not self.receipts.declined
+ and not self.receipts.blocked
+ and not self.service.pending_approvals(sid)
+ and offer_instead_of_action(self.request, self.last_text)
+ ):
+ self.corrected = True
+ return (
+ "The previous answer offered to do the requested work but did not execute it. "
+ "Carry out the original request now within the existing permissions. "
+ "Decide optional implementation details yourself. If essential information "
+ "really is missing, use society_ask_user and continue after its answer. "
+ "Do not end with another offer or plain-text confirmation question. "
+ "Honor any answers already received, including a decision to stop or change scope. "
+ "Do not repeat completed actions or invent success.\nOriginal request:\n"
+ + self.context
+ )
+ return None
+
+ async def publish(self) -> None:
+ if self.finish_event is not None:
+ payload = {
+ **self.finish_event["payload"],
+ "usage": self.usage,
+ "duration_ms": int((time.monotonic() - self.started) * 1000),
+ }
+ if self.cost is not None:
+ payload["cost_usd"] = self.cost
+ await self.handle.emit({**self.finish_event, "payload": payload})
diff --git a/jarvis/agentic_ide/cli_title.py b/jarvis/agentic_ide/cli_title.py
index 95a979a6cf..861ea849e3 100644
--- a/jarvis/agentic_ide/cli_title.py
+++ b/jarvis/agentic_ide/cli_title.py
@@ -225,7 +225,7 @@ def _codex_name_locked(path: Path, session_id: str) -> str:
index = _codex_indexes.setdefault(str(path), _CodexIndex())
try:
size = path.stat().st_size
- except OSError:
+ except OSError: # A missing or locked CLI index leaves the live terminal title in use.
return ""
if size < index.offset:
index.offset, index.names = 0, {}
@@ -246,7 +246,7 @@ def _codex_name_locked(path: Path, session_id: str) -> str:
def _json(line: bytes) -> dict[str, Any]:
try:
row = json.loads(line)
- except ValueError:
+ except ValueError: # A partially appended CLI record is retried on the next read.
return {}
return row if isinstance(row, dict) else {}
diff --git a/jarvis/core/config.py b/jarvis/core/config.py
index 07a80c917e..f4e72052d1 100644
--- a/jarvis/core/config.py
+++ b/jarvis/core/config.py
@@ -1027,7 +1027,7 @@ def clamp_pet_scale(value: object) -> float:
"""
try:
f = float(value) # type: ignore[arg-type]
- except (TypeError, ValueError):
+ except (TypeError, ValueError): # Invalid saved pet scales use the documented 1.0 default.
return 1.0
if f != f or f in (float("inf"), float("-inf")): # NaN / ±inf
return 1.0
diff --git a/jarvis/core/response_style.py b/jarvis/core/response_style.py
index e1d1258a72..6259a4b373 100644
--- a/jarvis/core/response_style.py
+++ b/jarvis/core/response_style.py
@@ -21,6 +21,19 @@ TASK_EXECUTION_GUIDANCE = (
"path remains. If blocked, preserve completed work and state exactly what is unfinished."
)
+AGENT_QUESTION_GUIDANCE = (
+ "Execute clear requests now. Choose sensible reversible implementation details yourself. "
+ "Do not finish with a proposal, 'I can do that', 'if you want', or a request to confirm "
+ "work the user already requested. Progress updates describe work actually in progress; "
+ "they are not the final result. When essential information really cannot be discovered "
+ "or inferred, call society_ask_user and let the person answer in its question card. "
+ "Do not put a blocking question only in your final chat reply. Wait for the card's "
+ "answer, then continue the original task in the same turn without asking the user to "
+ "start you again. A waiting result is not completion. Clarification choices do not "
+ "grant extra permissions. If the user explicitly requested ideas, advice or a plan, "
+ "provide that requested output without executing an unrequested change."
+)
+
KEEP_GOING_ON_TOOL_FAILURE = (
"A technical tool failure is not the end of the task. Read the result, inspect the "
"current tools and try a meaningfully different supported path when permitted. "
diff --git a/jarvis/live/session.py b/jarvis/live/session.py
index 56d8ab51e1..ee9d96d10f 100644
--- a/jarvis/live/session.py
+++ b/jarvis/live/session.py
@@ -34,7 +34,7 @@ def _summary_index(event: dict) -> int:
"""The summary part a reasoning-summary event belongs to (0 when absent)."""
try:
return max(0, int(event.get("summary_index") or 0))
- except (TypeError, ValueError):
+ except (TypeError, ValueError): # Malformed optional indexes use the first summary part.
return 0
diff --git a/jarvis/society/agent_tools.py b/jarvis/society/agent_tools.py
index e82b181017..5ac693c98e 100644
--- a/jarvis/society/agent_tools.py
+++ b/jarvis/society/agent_tools.py
@@ -425,9 +425,8 @@ class MemoryRecallTool:
class ProposeChangeTool:
"""``society_propose_change`` — configuration by chat (agent-definition §3.5).
- The agent proposes ONE change to itself; the proposal parks in the
- approvals queue and shows as a card in this chat. Nothing changes until
- the person confirms it there — proposing is therefore a safe-tier action.
+ An explicit current request can apply in this turn. Inferred changes
+ park on a proposal card until confirmed; permission changes always do.
"""
name: str = PROPOSE_TOOL_NAME
@@ -531,6 +530,7 @@ class ProposeChangeTool:
payload=args.get("payload"),
reason=str(args.get("reason") or ""),
session_id=self._session_id or caller.session_id,
+ resume_in_place=apply_now,
)
except ProposalRefused as exc: # Return the proposal's explicit refusal reason.
return _failure(exc.reason, exc.detail)
diff --git a/jarvis/society/proposals.py b/jarvis/society/proposals.py
index 5b44bcb015..7ed8061c21 100644
--- a/jarvis/society/proposals.py
+++ b/jarvis/society/proposals.py
@@ -1,12 +1,12 @@
-"""Configuration by chat: the agent PROPOSES a change to itself, the person
-CONFIRMS it on a card in the chat, and only then does anything change.
+"""Configuration by chat: explicit requests apply inline; suggestions use a card.
A proposal is an ordinary row in the approvals queue whose capability is
``core:config:<kind>`` and whose ``action`` carries the typed payload — no new
table, no new enum, no new chat event kind. The card rides a ``notice`` event
(``payload.kind == "proposal"``), its outcome a second one
-(``payload.kind == "proposal_resolved"``). Nothing here applies a change:
-:func:`apply` runs only from the resolve route once the person said yes.
+(``payload.kind == "proposal_resolved"``). A validated current user request
+can resolve inline without a pending card or a second agent conversation.
+Permission changes still require confirmation.
Kinds (agent-definition §3.5):
@@ -317,6 +317,7 @@ async def propose(
payload: Any,
reason: str,
session_id: str,
+ resume_in_place: bool = False,
) -> Approval:
"""Validate, queue, and show the card. Raises :class:`ProposalRefused`."""
clean = validate(kind, payload, catalog=rt.catalog())
@@ -336,13 +337,15 @@ async def propose(
"payload": clean,
"reason": _text(reason, limit=600),
"session_id": session_id,
+ **({"resume_in_place": True} if resume_in_place else {}),
},
summary=summarize(kind, clean),
)
- try:
- await rt.post_chat_notice(agent, proposal_notice(agent, item))
- except Exception: # noqa: BLE001 — the queue holds the proposal; the card is a projection
- log.warning("society: proposal card not posted for %s", agent.agent_id, exc_info=True)
+ if not resume_in_place:
+ try:
+ await rt.post_chat_notice(agent, proposal_notice(agent, item))
+ except Exception: # noqa: BLE001 — the queue holds the proposal; the card is a projection
+ log.warning("society: proposal card not posted for %s", agent.agent_id, exc_info=True)
return item
diff --git a/jarvis/society/surface.py b/jarvis/society/surface.py
index c74e5cc9db..cc8b112946 100644
--- a/jarvis/society/surface.py
+++ b/jarvis/society/surface.py
@@ -27,6 +27,7 @@ from typing import Any, Final, cast
from jarvis.core.protocols import Tool, ToolResult
from jarvis.core.response_style import (
+ AGENT_QUESTION_GUIDANCE,
CONVERSATIONAL_RESPONSE_STYLE,
KEEP_GOING_ON_TOOL_FAILURE,
TASK_EXECUTION_GUIDANCE,
@@ -769,6 +770,7 @@ def build_briefing(
# keep-going rule before potentially long standing instructions so compact
# CLI identities retain them (a cancelled tool must not end the task).
parts.append("## Completing the user's task\n" + TASK_EXECUTION_GUIDANCE)
+ parts.append("## Acting and asking\n" + AGENT_QUESTION_GUIDANCE)
parts.append("## How to reply to the person\n" + CONVERSATIONAL_RESPONSE_STYLE)
parts.append("## When a tool fails\n" + KEEP_GOING_ON_TOOL_FAILURE)
if agent.description.strip():
diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.py
index 6989afb21e..38e73d96cf 100644
--- a/jarvis/speech/pipeline.py
+++ b/jarvis/speech/pipeline.py
@@ -3490,7 +3490,7 @@ class SpeechPipeline:
configured = getattr(getattr(getattr(self, "_config", None), "tts", None), "volume", None)
try:
return max(0.0, min(1.0, float(configured))) if configured is not None else 1.0
- except (TypeError, ValueError):
+ except (TypeError, ValueError): # Invalid legacy volume values use the audible default.
return 1.0
def set_audio_devices(
diff --git a/jarvis/ui/desktop_app.py b/jarvis/ui/desktop_app.py
index 70816deb35..8f4231cfcd 100644
--- a/jarvis/ui/desktop_app.py
+++ b/jarvis/ui/desktop_app.py
@@ -146,7 +146,7 @@ def _clamp_pet_scale(value: object) -> float:
try:
scale = float(value) # type: ignore[arg-type]
- except (TypeError, ValueError):
+ except (TypeError, ValueError): # Invalid saved pet scales keep the normal-sized overlay.
return 1.0
if not math.isfinite(scale):
return 1.0
diff --git a/jarvis/ui/pets/loader.py b/jarvis/ui/pets/loader.py
index fc7d59d321..0e363313d8 100644
--- a/jarvis/ui/pets/loader.py
+++ b/jarvis/ui/pets/loader.py
@@ -231,7 +231,7 @@ def list_custom(root: Path) -> list[PetManifest]:
root = Path(root)
try:
folders = [p for p in root.iterdir() if p.is_dir() and USER_ID_RE.match(p.name)]
- except FileNotFoundError:
+ except FileNotFoundError: # A fresh install has no user-created pets directory yet.
return []
except OSError as exc:
_log.warning("pets folder %s is unreadable: %s", root, exc)
diff --git a/jarvis/ui/web/agentic_ide_routes.py b/jarvis/ui/web/agentic_ide_routes.py
index 8ad0ca0fe9..47d3756d28 100644
--- a/jarvis/ui/web/agentic_ide_routes.py
+++ b/jarvis/ui/web/agentic_ide_routes.py
@@ -1502,7 +1502,7 @@ async def get_agents(quick: bool = False) -> AgentsResponse:
def _quick_agent_catalog() -> AgentsResponse:
- """Resolve launchable coding agents without executing any CLI probe."""
+ """Resolve launchable terminals, including plain shells, without CLI probes."""
from jarvis.workspace import agents as workspace_agents
from jarvis.workspace import launch_picks
@@ -1520,7 +1520,7 @@ def _quick_agent_catalog() -> AgentsResponse:
accepts_prompts=accepts_prompts(spec.name),
**launch_picks.offered(spec.name),
)
- for spec in workspace_agents.coding_agents()
+ for spec in workspace_agents.list_agents()
]
return AgentsResponse(
terminal_available=workspace_agents.pty_available(),
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsx
index f9b8d194e6..de9ff984dd 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsx
@@ -1,9 +1,10 @@
-import { memo } from "react";
+import { Fragment, memo } from "react";
import { ChatMarkdown, MediaPreview, mediaKind } from "@/components/agentchat/ChatMarkdown";
import { CircleAlert, FileText, ImageIcon } from "lucide-react";
import { InternalMessageBubble, type InternalParticipant } from "./InternalMessageBubble";
import { MessageWithChips } from "./ToolChoiceChips";
import { ProviderLogo } from "@/components/providers/ProviderLogo";
+import { GigiMark } from "@/components/GigiMark";
import { effortLabel } from "./AgentComposer";
import { TurnTrace, type Decide } from "./WorkTrace";
import type { TimelineItem, TurnItem, TextBlock } from "./reduce";
@@ -18,6 +19,7 @@ export function AgentTimeline({
onDecide,
recipientName,
agentsById,
+ bubbles = false,
}: {
items: TimelineItem[];
assistantName: string;
@@ -27,157 +29,236 @@ export function AgentTimeline({
recipientName?: string;
/** Sender faces by agent id, where the caller has a roster. */
agentsById?: Record<string, InternalParticipant>;
+ /**
+ * The front page's messenger look (2026-10-01): your words in a signal-blue
+ * bubble on the right, the assistant's answers in card bubbles on the left
+ * under a small face, and a centred time stamp wherever the conversation
+ * paused. The Agentic IDE keeps the document look (the default).
+ */
+ bubbles?: boolean;
}) {
const t = useT();
+ const stamps = bubbles ? timeStamps(items) : null;
return (
<>
{items.map((item) => {
- if (item.type === "internal") {
- return (
- <InternalMessageBubble
- key={item.id}
- item={item}
- sender={agentsById?.[item.message.sender_id] ?? null}
- recipientName={recipientName ?? assistantName}
- />
- );
- }
- if (item.type === "user") {
- if (item.origin === "control") return <div key={item.id} data-message-id={item.id} className="text-xs text-muted-foreground">{t("slash.control_turn")}{item.attachments.map((file) => <span key={file.name} className="ml-2">{file.name}</span>)}</div>;
- return (
- <div
- key={item.id}
- className="flex justify-end"
- data-testid="agent-message-user"
- data-message-id={item.id}
- >
- <div className="jarvis-user-bubble max-w-[85%] rounded-lg px-4 py-3 text-reading">
- <MessageWithChips text={item.text} choices={item.toolChoices ?? []} />
- {item.attachments.length > 0 && (
- <div
- data-testid="agent-message-attachments"
- className={cn("flex flex-wrap gap-row", item.text && "mt-2.5")}
- >
- {item.attachments.map((file) =>
- // The picture itself, where there is one to fetch: a
- // screenshot dropped on a pane is a thing the person
- // wants to SEE in their turn, not a file name with an
- // icon (maintainer, 2026-08-27). A file with no url —
- // a document, or the front page's chat, whose drops
- // are read and not stored — keeps the chip.
- file.url && (mediaKind(file.url) === "video" || mediaKind(file.url) === "audio") ? (
- <MediaPreview key={file.name} src={file.url} label={file.name} kind={mediaKind(file.url)!} />
- ) : (file.kind === "image" || (file.url && mediaKind(file.url) === "image")) && file.url ? (
- <img
- key={file.name}
- src={file.url}
- alt={file.name}
- title={file.name}
- loading="lazy"
- decoding="async"
- data-testid="agent-message-image"
- // A picture is its own fill. The frame and the wash
- // behind it were describing an object that was
- // already fully described.
- className="max-h-60 max-w-full rounded-lg object-contain"
- />
- ) : (
- <span
- key={file.name}
- // The receipt says whether the model could actually
- // READ it. "sent" and "could not be read" are the two
- // outcomes, and the second happens for real wherever no
- // provider can see an image.
- title={
- file.describedBy === "none"
- ? t("agent_chat.attach_not_described")
- : file.name
- }
- // No box. The user bubble is the loudest surface the
- // ladder has, so a chip inside it has nowhere to step
- // up to; the icon and the mono name carry the chip's
- // whole job on their own.
- className="flex items-center gap-1.5 text-micro opacity-80"
- >
- {file.kind === "image" ? (
- <ImageIcon className="h-3 w-3 shrink-0" aria-hidden />
- ) : (
- <FileText className="h-3 w-3 shrink-0" aria-hidden />
- )}
- <span className="max-w-[12rem] truncate font-mono">{file.name}</span>
- </span>
- ),
- )}
- </div>
- )}
- </div>
- </div>
- );
- }
- if (item.type === "error") {
- return (
- <div
- key={item.id}
- data-message-id={item.id}
- // Fault ink on a normal surface. A red-washed panel makes the
- // failure the brightest object on the screen and buries what it
- // says under what it looks like.
- className="mx-auto flex max-w-[85%] items-center gap-row rounded-lg bg-card px-4 py-3 text-body text-destructive"
- >
- <CircleAlert className="h-3.5 w-3.5 shrink-0" aria-hidden />
- <span>{item.text}</span>
+ const stamp = stamps?.get(item.id);
+ const node = renderItem(item);
+ return stamp ? (
+ <Fragment key={item.id}>
+ <div className="flex justify-center pt-2" data-testid="agent-time-stamp" aria-hidden>
+ <span className="text-xs font-medium text-muted-foreground">{stamp}</span>
</div>
- );
- }
- if (item.type === "notice") {
- if (item.kind === "native_goal_verdict") return <p key={item.id} className="text-xs text-muted-foreground">{t("slash.verifying")}</p>;
- // The society reporting back on a task Jarvis handed out: the
- // agent's name as the headline, its summary underneath. Muted and
- // centred like a stamp — it is not Jarvis speaking.
- const headline =
- item.kind === "society_result"
- ? t(item.status === "done" ? "society.chat.result_done" : "society.chat.result_blocked").replace(
- "{0}",
- item.agentName || t("society.chat.result_agent"),
- )
- : item.agentName;
- return (
- <div
- key={item.id}
- data-message-id={item.id}
- className="mx-auto flex max-w-[85%] flex-col gap-0.5 rounded-lg bg-card px-4 py-3 text-body"
- >
- {headline ? <span className="font-medium text-foreground">{headline}</span> : null}
- {item.text ? <ChatMarkdown text={item.text} className="text-muted-foreground" /> : null}
- </div>
- );
- }
- return (
- <Turn
- key={item.id}
- turn={item}
- assistantName={assistantName}
- providerLabel={providerLabel(item.provider)}
- onDecide={onDecide}
- />
- );
+ {node}
+ </Fragment>
+ ) : node;
})}
</>
);
+
+ function renderItem(item: TimelineItem) {
+ if (item.type === "internal") {
+ return (
+ <InternalMessageBubble
+ key={item.id}
+ item={item}
+ sender={agentsById?.[item.message.sender_id] ?? null}
+ recipientName={recipientName ?? assistantName}
+ />
+ );
+ }
+ if (item.type === "user") {
+ if (item.origin === "control") return <div key={item.id} data-message-id={item.id} className="text-xs text-muted-foreground">{t("slash.control_turn")}{item.attachments.map((file) => <span key={file.name} className="ml-2">{file.name}</span>)}</div>;
+ return (
+ <div
+ key={item.id}
+ className="flex justify-end"
+ data-testid="agent-message-user"
+ data-message-id={item.id}
+ >
+ <div
+ className={cn(
+ "text-reading",
+ bubbles
+ ? "jarvis-chat-out max-w-[78%] rounded-3xl rounded-br-lg px-4 py-2.5"
+ : "jarvis-user-bubble max-w-[85%] rounded-lg px-4 py-3",
+ )}
+ >
+ <MessageWithChips text={item.text} choices={item.toolChoices ?? []} />
+ {item.attachments.length > 0 && (
+ <div
+ data-testid="agent-message-attachments"
+ className={cn("flex flex-wrap gap-row", item.text && "mt-2.5")}
+ >
+ {item.attachments.map((file) =>
+ // The picture itself, where there is one to fetch: a
+ // screenshot dropped on a pane is a thing the person
+ // wants to SEE in their turn, not a file name with an
+ // icon (maintainer, 2026-08-27). A file with no url —
+ // a document, or the front page's chat, whose drops
+ // are read and not stored — keeps the chip.
+ file.url && (mediaKind(file.url) === "video" || mediaKind(file.url) === "audio") ? (
+ <MediaPreview key={file.name} src={file.url} label={file.name} kind={mediaKind(file.url)!} />
+ ) : (file.kind === "image" || (file.url && mediaKind(file.url) === "image")) && file.url ? (
+ <img
+ key={file.name}
+ src={file.url}
+ alt={file.name}
+ title={file.name}
+ loading="lazy"
+ decoding="async"
+ data-testid="agent-message-image"
+ // A picture is its own fill. The frame and the wash
+ // behind it were describing an object that was
+ // already fully described.
+ className="max-h-60 max-w-full rounded-lg object-contain"
+ />
+ ) : (
+ <span
+ key={file.name}
+ // The receipt says whether the model could actually
+ // READ it. "sent" and "could not be read" are the two
+ // outcomes, and the second happens for real wherever no
+ // provider can see an image.
+ title={
+ file.describedBy === "none"
+ ? t("agent_chat.attach_not_described")
+ : file.name
+ }
+ // No box. The user bubble is the loudest surface the
+ // ladder has, so a chip inside it has nowhere to step
+ // up to; the icon and the mono name carry the chip's
+ // whole job on their own.
+ className="flex items-center gap-1.5 text-micro opacity-80"
+ >
+ {file.kind === "image" ? (
+ <ImageIcon className="h-3 w-3 shrink-0" aria-hidden />
+ ) : (
+ <FileText className="h-3 w-3 shrink-0" aria-hidden />
+ )}
+ <span className="max-w-[12rem] truncate font-mono">{file.name}</span>
+ </span>
+ ),
+ )}
+ </div>
+ )}
+ </div>
+ </div>
+ );
+ }
+ if (item.type === "error") {
+ return (
+ <div
+ key={item.id}
+ data-message-id={item.id}
+ // Fault ink on a normal surface. A red-washed panel makes the
+ // failure the brightest object on the screen and buries what it
+ // says under what it looks like.
+ className="mx-auto flex max-w-[85%] items-center gap-row rounded-lg bg-card px-4 py-3 text-body text-destructive"
+ >
+ <CircleAlert className="h-3.5 w-3.5 shrink-0" aria-hidden />
+ <span>{item.text}</span>
+ </div>
+ );
+ }
+ if (item.type === "notice") {
+ if (item.kind === "native_goal_verdict") return <p key={item.id} className="text-xs text-muted-foreground">{t("slash.verifying")}</p>;
+ // The society reporting back on a task Jarvis handed out: the
+ // agent's name as the headline, its summary underneath. Muted and
+ // centred like a stamp — it is not Jarvis speaking.
+ const headline =
+ item.kind === "society_result"
+ ? t(item.status === "done" ? "society.chat.result_done" : "society.chat.result_blocked").replace(
+ "{0}",
+ item.agentName || t("society.chat.result_agent"),
+ )
+ : item.agentName;
+ return (
+ <div
+ key={item.id}
+ data-message-id={item.id}
+ className="mx-auto flex max-w-[85%] flex-col gap-0.5 rounded-lg bg-card px-4 py-3 text-body"
+ >
+ {headline ? <span className="font-medium text-foreground">{headline}</span> : null}
+ {item.text ? <ChatMarkdown text={item.text} className="text-muted-foreground" /> : null}
+ </div>
+ );
+ }
+ return (
+ <Turn
+ key={item.id}
+ turn={item}
+ assistantName={assistantName}
+ providerLabel={providerLabel(item.provider)}
+ onDecide={onDecide}
+ bubbles={bubbles}
+ />
+ );
+ }
}
-const Turn = memo(function Turn({ turn, assistantName, providerLabel, onDecide }: {
- turn: TurnItem; assistantName: string; providerLabel: string; onDecide: Decide;
+/** A pause this long between two messages earns a new time stamp. */
+const STAMP_GAP_MS = 20 * 60 * 1000;
+
+function itemTime(item: TimelineItem): number {
+ return item.type === "turn" ? item.startedMs : item.tsMs;
+}
+
+/**
+ * Which items open with a time stamp, and what it says: the first one, and
+ * every one after a pause of {@link STAMP_GAP_MS}. Today shows the clock
+ * only; any other day leads with the date, the way a messenger does.
+ */
+export function timeStamps(items: TimelineItem[], now: Date = new Date()): Map<string, string> {
+ const out = new Map<string, string>();
+ let last = 0;
+ for (const item of items) {
+ const ts = itemTime(item);
+ if (!ts || !Number.isFinite(ts)) continue;
+ if (!last || ts - last >= STAMP_GAP_MS) out.set(item.id, stampLabel(new Date(ts), now));
+ last = ts;
+ }
+ return out;
+}
+
+function stampLabel(at: Date, now: Date): string {
+ const time = at.toLocaleTimeString(undefined, { hour: "numeric", minute: "2-digit" });
+ if (at.toDateString() === now.toDateString()) return time;
+ const date = at.toLocaleDateString(undefined, {
+ month: "short",
+ day: "numeric",
+ ...(at.getFullYear() === now.getFullYear() ? {} : { year: "numeric" }),
+ });
+ return `${date}, ${time}`;
+}
+
+const Turn = memo(function Turn({ turn, assistantName, providerLabel, onDecide, bubbles = false }: {
+ turn: TurnItem; assistantName: string; providerLabel: string; onDecide: Decide; bubbles?: boolean;
}) {
const t = useT();
return <div className="flex min-w-0 flex-col gap-3" data-testid="agent-turn" data-message-id={turn.id} data-status={turn.status}>
<div className="flex flex-wrap items-center gap-2 text-xs text-muted-foreground">
+ {bubbles ? <GigiMark size={20} className="rounded-full" /> : null}
<span className="font-medium text-foreground">{assistantName}</span>
<ProviderLogo providerId={turn.provider} label={providerLabel} size="sm" />
<span>{providerLabel}{turn.model ? ` · ${turn.model}` : ""}</span>
{turn.effort ? <span>{effortLabel(turn.effort, t)}</span> : null}
</div>
- <TurnTrace turn={turn} onDecide={onDecide} renderText={(text, id) => <Prose block={{ kind: "text", text, id }} />} />
+ <TurnTrace
+ turn={turn}
+ onDecide={onDecide}
+ renderText={(text, id) =>
+ bubbles ? (
+ text.trim() ? (
+ <div className="w-fit max-w-full rounded-3xl rounded-tl-lg bg-card px-5 py-1.5" data-testid="agent-bubble">
+ <Prose block={{ kind: "text", text, id }} />
+ </div>
+ ) : null
+ ) : (
+ <Prose block={{ kind: "text", text, id }} />
+ )
+ }
+ />
</div>;
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx
index 553aa182c2..b703bd8823 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx
@@ -1,4 +1,5 @@
import { act, cleanup, fireEvent, render, screen } from "@testing-library/react";
+import { useIdeChatStore } from "@/store/ideChat";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { IdeSidePanelFrame } from "./IdeSidePanel";
import { IdeSidePanelToggle } from "./IdeSidePanelToggle";
@@ -7,6 +8,12 @@ import { useIdeProjectsStore } from "@/store/ideProjects";
import { useIdeSidePanelStore } from "@/store/ideSidePanel";
import { resetWorkspacePanesPoll, useWorkspacePanesStore } from "@/store/workspacePanes";
+vi.mock("@/components/workspace/WorkspaceTerminal", () => ({
+ WorkspaceTerminal: ({ paneKey, workspaceId, active }: { paneKey: string; workspaceId: string; active: boolean }) => (
+ <div data-testid={`shell-${paneKey}`} data-workspace={workspaceId} data-active={String(active)} />
+ ),
+}));
+
// The real stage is a WebGL scene; the tab only owes it the right props and a place to live.
vi.mock("@/components/society/office/OfficeStage", () => ({
OfficeStage: ({ onOpenLedger, initialFloor, compact }: { onOpenLedger: () => void; initialFloor?: string; compact?: boolean }) => (
@@ -33,12 +40,69 @@ beforeEach(() => {
useWorkspacePanesStore.setState({ panes: [], activeId: null, loaded: true, load: async () => {} });
useIdeProjectsStore.setState({ activeWorkspaceId: null });
useEventStore.setState({ activeSection: "agentic-ide" });
- useIdeSidePanelStore.setState({ open: false, tabs: ["agents"], active: "agents", maximized: false, inUse: false });
+ useIdeSidePanelStore.setState({ open: false, tabs: ["agents"], active: "agents", terminals: [], maximized: false, inUse: false });
+ useIdeChatStore.setState({ workspace: { id: "w1", name: "App", path: "/code/app" } });
});
afterEach(cleanup);
describe("IdeSidePanel", () => {
+ it("opens independent shell tabs and retains them through switching and collapsing", () => {
+ useIdeSidePanelStore.getState().setOpen(true);
+ render(<Harness />);
+ const add = () => {
+ fireEvent.click(screen.getByTestId("ide-side-panel-add"));
+ fireEvent.click(screen.getByTestId("ide-side-panel-add-terminal"));
+ };
+ add();
+ const first = useIdeSidePanelStore.getState().terminals[0];
+ const firstNode = screen.getByTestId(`shell-${first.id}`);
+ expect(firstNode.dataset.workspace).toBe("w1");
+ add();
+ const second = useIdeSidePanelStore.getState().terminals[1];
+ expect(first.id).not.toBe(second.id);
+ expect(screen.getByRole("tab", { name: "Terminal 1" })).toBeTruthy();
+ expect(screen.getByRole("tab", { name: "Terminal 2" })).toBeTruthy();
+ fireEvent.click(screen.getByTestId("ide-side-panel-tab-agents"));
+ expect(screen.getByTestId(`shell-${first.id}`)).toBe(firstNode);
+ fireEvent.click(screen.getByTestId("ide-side-panel-collapse"));
+ expect(screen.getByTestId(`shell-${first.id}`)).toBe(firstNode);
+ expect(firstNode.dataset.active).toBe("false");
+ fireEvent.click(screen.getByTestId("ide-side-panel-toggle"));
+ fireEvent.click(screen.getByTestId(`ide-side-panel-tab-${first.id}`));
+ expect(firstNode.dataset.active).toBe("true");
+ fireEvent.click(screen.getByTestId(`ide-side-panel-close-${second.id}`));
+ expect(screen.queryByTestId(`shell-${second.id}`)).toBeNull();
+ expect(screen.getByTestId(`shell-${first.id}`)).toBe(firstNode);
+ // Session-only tabs must never respawn shells on a page reload.
+ expect(localStorage.getItem("jarvis.agenticIde.sidePanelTabs.v4")).not.toContain("terminal:");
+ });
+
+ it("keeps terminals pinned to their workspace and offers another shell on every + click", () => {
+ useIdeSidePanelStore.getState().addTerminalTab("w1", "App");
+ render(<Harness />);
+ const first = useIdeSidePanelStore.getState().terminals[0];
+ const node = screen.getByTestId(`shell-${first.id}`);
+ act(() => useIdeChatStore.setState({ workspace: { id: "w2", name: "Other", path: "/code/other" } }));
+ expect(screen.queryByTestId(`ide-side-panel-tab-${first.id}`)).toBeNull();
+ expect(node.dataset.active).toBe("false");
+ fireEvent.click(screen.getByTestId("ide-side-panel-add"));
+ fireEvent.click(screen.getByTestId("ide-side-panel-add-terminal"));
+ expect(useIdeSidePanelStore.getState().terminals[1].workspaceId).toBe("w2");
+ act(() => useIdeChatStore.setState({ workspace: { id: "w1", name: "App", path: "/code/app" } }));
+ fireEvent.click(screen.getByTestId(`ide-side-panel-tab-${first.id}`));
+ expect(screen.getByTestId(`shell-${first.id}`)).toBe(node);
+ expect(node.dataset.active).toBe("true");
+ });
+
+ it("requires a workspace before starting a shell", () => {
+ useIdeSidePanelStore.getState().setOpen(true);
+ useIdeChatStore.setState({ workspace: null });
+ render(<Harness />);
+ fireEvent.click(screen.getByTestId("ide-side-panel-add"));
+ expect((screen.getByTestId("ide-side-panel-add-terminal") as HTMLButtonElement).disabled).toBe(true);
+ });
+
it("opens from the caption toggle and closes from its own header", () => {
render(<Harness />);
expect(screen.queryByTestId("ide-side-panel")).toBeNull();
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx
index 7602070890..39ff8184f6 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx
@@ -1,10 +1,13 @@
import { useEffect, useRef, useState, type ReactNode } from "react";
-import { Check, Maximize2, Minimize2, MoveHorizontal, PanelRightClose, Plus, X } from "lucide-react";
+import { Check, Maximize2, Minimize2, MoveHorizontal, PanelRightClose, Plus, SquareTerminal, X } from "lucide-react";
import { fill, useT } from "@/i18n";
import { cn } from "@/lib/utils";
import { useResizablePane } from "@/hooks/useResizablePane";
import { PaneResizer } from "@/components/layout/PaneResizer";
-import { SIDE_PANEL_ID, useIdeSidePanelStore } from "@/store/ideSidePanel";
+import { MAX_TERMINAL_TABS, SIDE_PANEL_ID, useIdeSidePanelStore } from "@/store/ideSidePanel";
+import { useIdeChatStore } from "@/store/ideChat";
+import { WorkspaceTerminal } from "@/components/workspace/WorkspaceTerminal";
+import type { TerminalAppearance } from "../terminalThemes";
import { useExplorerPathRouting } from "@/store/ideExplorer";
import { usePaneReviewTracking } from "@/store/paneReviews";
import { useIdeProjectsStore } from "@/store/ideProjects";
@@ -38,13 +41,16 @@ const HEADER_BTN =
* `markInUse`: frame the panel in the signal blue while the reader works in it,
* the way a focused terminal tile is framed (the minimal pane style).
*/
-export function IdeSidePanelFrame({ children, markInUse = false }: { children: ReactNode; markInUse?: boolean }) {
+export function IdeSidePanelFrame({ children, markInUse = false, appearance, onScreen = true }: {
+ children: ReactNode; markInUse?: boolean; appearance?: TerminalAppearance; onScreen?: boolean;
+}) {
const t = useT();
const open = useIdeSidePanelStore((state) => state.open);
const inUse = useIdeSidePanelStore((state) => state.inUse);
const setInUse = useIdeSidePanelStore((state) => state.setInUse);
const active = useIdeSidePanelStore((state) => state.active);
const maximized = useIdeSidePanelStore((state) => state.maximized);
+ const hasTerminals = useIdeSidePanelStore((state) => state.terminals.length > 0);
// Ctrl+click on a path in any terminal opens it in the Explorer tab.
useExplorerPathRouting();
// A click on a pane in the grid counts as reviewing that agent.
@@ -100,9 +106,9 @@ export function IdeSidePanelFrame({ children, markInUse = false }: { children: R
style={{ width: open ? width : 0 }}
aria-hidden={!open}
>
- {open && (
+ {(open || hasTerminals) && (
<>
- {!maximized && (
+ {open && !maximized && (
<div className="group absolute inset-y-0 left-0 z-20 flex -translate-x-1/2">
<PaneResizer
testId="ide-side-panel-resizer"
@@ -132,9 +138,9 @@ export function IdeSidePanelFrame({ children, markInUse = false }: { children: R
{/* Same element either way, so the live office scene is never remounted.
A press anywhere in it (capture phase: the office canvas and the
terminals in it stop their own events) makes it the area in use. */}
- <div data-testid="ide-side-panel-body" className={maximized ? "absolute inset-0 z-30" : "relative h-full"}
+ <div hidden={!open} data-testid="ide-side-panel-body" className={maximized ? "absolute inset-0 z-30" : "relative h-full"}
onPointerDownCapture={() => setInUse(true)}>
- <IdeSidePanel />
+ <IdeSidePanel appearance={appearance} onScreen={onScreen} />
{/* The "you are here" frame, drawn over everything in the panel so
no tab header or scene can cover part of it. */}
{markInUse && inUse && (
@@ -200,10 +206,17 @@ function IdeSidePanelRail() {
}
/** The panel itself: tab header ("+" and collapse) over the active tab's content. */
-export function IdeSidePanel() {
+export function IdeSidePanel({ appearance, onScreen = true }: { appearance?: TerminalAppearance; onScreen?: boolean }) {
const t = useT();
- const tabs = useIdeSidePanelStore((state) => state.tabs);
- const active = useIdeSidePanelStore((state) => state.active);
+ const allTabs = useIdeSidePanelStore((state) => state.tabs);
+ const storedActive = useIdeSidePanelStore((state) => state.active);
+ const open = useIdeSidePanelStore((state) => state.open);
+ const terminals = useIdeSidePanelStore((state) => state.terminals);
+ const addTerminalTab = useIdeSidePanelStore((state) => state.addTerminalTab);
+ const workspace = useIdeChatStore((state) => state.workspace);
+ const tabs = allTabs.filter((id) => !id.startsWith("terminal:") || terminals.some((terminal) => terminal.id === id && terminal.workspaceId === workspace?.id));
+ const active = tabs.includes(storedActive) ? storedActive : tabs[0];
+ const terminalCount = terminals.filter((terminal) => terminal.workspaceId === workspace?.id).length;
const select = useIdeSidePanelStore((state) => state.select);
const openTab = useIdeSidePanelStore((state) => state.openTab);
const closeTab = useIdeSidePanelStore((state) => state.closeTab);
@@ -239,8 +252,10 @@ export function IdeSidePanel() {
<div role="tablist" aria-label={t("ide_side_panel.tabs_aria")} className="flex min-w-0 flex-1 items-center gap-1 overflow-x-auto">
{tabs.map((id) => {
const tab = sidePanelTab(id);
- if (!tab) return null;
- const label = t(tab.labelKey);
+ const terminal = terminals.find((entry) => entry.id === id);
+ if (!tab && !terminal) return null;
+ const label = terminal ? `${t("ide_side_panel.terminal_label")} ${terminal.number}` : t(tab!.labelKey);
+ const Icon = tab?.icon ?? SquareTerminal;
const selected = id === active;
return (
<div
@@ -259,7 +274,7 @@ export function IdeSidePanel() {
onClick={() => select(id)}
className="flex min-w-0 items-center gap-1.5 focus-visible:outline-none"
>
- <tab.icon className="h-4 w-4 shrink-0" aria-hidden />
+ <Icon className="h-4 w-4 shrink-0" aria-hidden />
<span className="truncate font-medium">{label}</span>
</button>
<button
@@ -311,6 +326,14 @@ export function IdeSidePanel() {
</button>
);
})}
+ <button type="button" role="menuitem" data-testid="ide-side-panel-add-terminal"
+ disabled={!workspace || terminalCount >= MAX_TERMINAL_TABS}
+ title={!workspace ? t("ide_side_panel.terminal_workspace_required") : undefined}
+ onClick={() => { if (workspace) addTerminalTab(workspace.id, workspace.name); setMenuOpen(false); }}
+ className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-foreground hover:bg-secondary disabled:cursor-default disabled:opacity-40">
+ <SquareTerminal className="h-4 w-4 text-muted-foreground" aria-hidden />
+ <span>{t("ide_side_panel.add_terminal")}</span>
+ </button>
</div>
)}
</div>
@@ -339,8 +362,14 @@ export function IdeSidePanel() {
</button>
</div>
{/* Keyed by tab: Changes and Folder share one component and must not share its state. */}
- <div key={active} id={`${SIDE_PANEL_ID}-content`} role="tabpanel" className="min-h-0 flex-1">
- {current?.render()}
+ <div id={`${SIDE_PANEL_ID}-content`} role="tabpanel" className="relative min-h-0 flex-1">
+ {open && <div key={active} className="h-full min-h-0">{current?.render()}</div>}
+ {terminals.map((terminal) => <div key={terminal.id} hidden={!open || terminal.id !== active}
+ className="absolute inset-0" data-testid={`ide-side-panel-terminal-${terminal.id}`}>
+ <WorkspaceTerminal paneKey={terminal.id} agentName="shell" workspaceId={terminal.workspaceId}
+ title={`${t("ide_side_panel.terminal_label")} ${terminal.number} · ${terminal.workspaceName}`}
+ active={onScreen && open && terminal.id === active} appearance={appearance} />
+ </div>)}
</div>
</aside>
);
diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalPromptSelection.test.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalPromptSelection.test.ts
index 3813e89e2b..b3d6b26921 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/terminalPromptSelection.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalPromptSelection.test.ts
@@ -113,6 +113,71 @@ describe("terminal prompt selection", () => {
expect(pane.sent).toEqual(["\x7f".repeat(11)]);
});
+ describe("a draft the CLI wraps into indented rows itself", () => {
+ // Claude Code's layout, measured in a 40-column PTY: separate (not
+ // `isWrapped`) rows indented to the marker width, the space at each break
+ // undrawn yet still one arrow press away.
+ const words = Array.from({ length: 24 }, (_, i) => `w${String(i + 1).padStart(2, "0")}`);
+ const draft = words.join(" ");
+ const box = (below = "─".repeat(40)) => [
+ "─".repeat(40),
+ `❯ ${words.slice(0, 9).join(" ")}`,
+ ` ${words.slice(9, 18).join(" ")}`,
+ ` ${words.slice(18).join(" ")}`,
+ below,
+ ].join("\r\n");
+ const at = (word: string) => draft.indexOf(word);
+
+ it("deletes a selection spanning rows with one Backspace", async () => {
+ const pane = await setup(`${box()}\x1b[4;26H`);
+ pane.select(18, 21, 1, 2); // from "w05" through "w14"
+ pane.press("Backspace");
+ const end = at("w14") + 3;
+ expect(pane.sent).toEqual([
+ "\x1b[D".repeat(draft.length - end) + "\x7f".repeat(end - at("w05")),
+ ]);
+ });
+
+ it("selects the whole wrapped draft with select-all", async () => {
+ const pane = await setup(`${box()}\x1b[4;26H`);
+ pane.press("a", { ctrlKey: true });
+ expect(pane.selection()).toEqual({ start: { x: 2, y: 1 }, end: { x: 25, y: 3 } });
+ pane.press("Delete");
+ expect(pane.sent).toEqual(["\x7f".repeat(draft.length)]);
+ });
+
+ it("snaps a drag from a row's indent to its first letter", async () => {
+ const pane = await setup(`${box()}\x1b[4;26H`);
+ pane.select(0, 25, 2, 3); // indent of the second row to the end
+ pane.press("Backspace");
+ expect(pane.sent).toEqual(["\x7f".repeat(draft.length - at("w10"))]);
+ });
+
+ it("edits rows below the caret when the editor box closes under them", async () => {
+ const pane = await setup(`${box()}\x1b[2;11H`); // caret before "w03"
+ pane.select(2, 5, 3); // "w19"
+ pane.press("Delete");
+ const caret = at("w03");
+ expect(pane.sent).toEqual([
+ "\x1b[C".repeat(at("w19") + 3 - caret) + "\x7f".repeat(3),
+ ]);
+ });
+
+ it("never treats indented rows under the caret as draft unless the box closes", async () => {
+ const pane = await setup(`${box(" footer hint\r\nstatus: ready")}\x1b[2;11H`);
+ pane.select(2, 5, 3);
+ pane.press("Delete");
+ expect(pane.sent).toEqual([]);
+ });
+
+ it("never joins indented output that is not anchored to the marker row", async () => {
+ const pane = await setup("earlier output\r\n indented result\r\n more result");
+ pane.select(2, 10, 2);
+ pane.press("Backspace");
+ expect(pane.sent).toEqual([]);
+ });
+ });
+
it("handles select-all ending at the last terminal column", async () => {
const pane = await setup("› abcdefgh", false, 10);
pane.press("a", { ctrlKey: true });
diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalPromptSelection.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalPromptSelection.ts
index aaebe50fe8..500c747826 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/terminalPromptSelection.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalPromptSelection.ts
@@ -24,24 +24,63 @@ const segmenter = typeof Intl.Segmenter === "function"
? new Intl.Segmenter(undefined, { granularity: "grapheme" }) : null;
const graphemes = (text: string) => [...segmenter!.segment(text)].length;
+const PROMPT_MARKER = /^ *[❯›>] /;
+/** Rows below the draft that close an editor block: blank, or a box rule. */
+const CLOSING_ROW = /^\s*$|^\s*[─━═╌┄╰└]/;
+const MAX_PROMPT_ROWS = 200;
+
/**
- * Only the logical input line containing the live cursor is editable. A
- * terminal selection otherwise belongs to output, not to the CLI's editor.
- * Recognise the same input markers as agentic_ide/session.py, without using
- * provider names. Wrapped buffer rows are one line; separate TUI rows are not
- * guessed to be input (they can be menus, permission questions or output).
+ * Only the logical input containing the live cursor is editable. A terminal
+ * selection otherwise belongs to output, not to the CLI's editor. Recognise
+ * the same input markers as agentic_ide/session.py, without using provider
+ * names.
+ *
+ * A long draft spans several rows in one of two ways. The terminal's own soft
+ * wrap marks rows `isWrapped` and fills them edge to edge. A TUI editor (Claude
+ * Code, Codex) wraps the draft itself: every continuation row is a separate
+ * line indented to the width of the marker, and the break character — the
+ * space at a word wrap or a typed newline — is not drawn but still costs one
+ * arrow press. Rows above the caret are only accepted as input when every one
+ * of them up to the marker row is such a continuation; rows below it only
+ * when the block then closes like an editor box, so a footer, menu or
+ * permission question is never mistaken for draft text.
*/
function readPrompt(term: PromptSelectionTerminal): PromptLine | null {
const buffer = term.buffer.active;
if (!segmenter) return null;
+ const rowText = (row: number) => buffer.getLine(row)?.translateToString(false, 0, term.cols);
const cursorRow = buffer.baseY + buffer.cursorY;
let first = cursorRow;
- while (first > buffer.baseY && buffer.getLine(first)?.isWrapped) first--;
- const head = buffer.getLine(first)?.translateToString(false, 0, term.cols);
- const prefix = head?.match(/^ *[❯›>] /)?.[0];
- if (!prefix) return null;
+ let prefix: string | undefined;
+ for (;;) {
+ const line = buffer.getLine(first);
+ const shown = rowText(first);
+ if (!line || shown === undefined) return null;
+ if (!line.isWrapped) {
+ prefix = shown.match(PROMPT_MARKER)?.[0];
+ if (prefix) break;
+ if (!/^ +\S/.test(shown)) return null;
+ }
+ if (first === 0 || cursorRow - first >= MAX_PROMPT_ROWS) return null;
+ first--;
+ }
+ const indent = " ".repeat(prefix.length);
+ const continuation = (row: number) => {
+ const shown = rowText(row);
+ return shown !== undefined && shown.startsWith(indent) && /\S/.test(shown[indent.length] ?? "");
+ };
+ for (let row = first + 1; row <= cursorRow; row++) {
+ if (!buffer.getLine(row)?.isWrapped && !continuation(row)) return null;
+ }
let last = cursorRow;
- while (buffer.getLine(last + 1)?.isWrapped) last++;
+ for (let row = cursorRow + 1; row - cursorRow <= MAX_PROMPT_ROWS; row++) {
+ const line = buffer.getLine(row);
+ if (line?.isWrapped || (line && continuation(row))) continue;
+ const closing = rowText(row);
+ if (closing !== undefined && CLOSING_ROW.test(closing)) last = row - 1;
+ else while (buffer.getLine(last + 1)?.isWrapped) last++;
+ break;
+ }
const offsets = new Map<number, number>();
let text = "";
@@ -50,10 +89,11 @@ function readPrompt(term: PromptSelectionTerminal): PromptLine | null {
for (let row = first; row <= last; row++) {
const line = buffer.getLine(row);
if (!line) return null;
- const left = row === first ? start.x : 0;
+ const left = row === first || !line.isWrapped ? prefix.length : 0;
+ const softWrapped = row < last && buffer.getLine(row + 1)?.isWrapped;
// Keep typed spaces through the caret, but omit empty cells after input.
let right = term.cols;
- if (row === last) {
+ if (!softWrapped) {
right = left;
for (let col = left; col < term.cols; col++) {
const cell = line.getCell(col);
@@ -68,6 +108,9 @@ function readPrompt(term: PromptSelectionTerminal): PromptLine | null {
text += cell.getChars() || " ";
}
offsets.set(row * term.cols + right, text.length);
+ // The editor's own wrap swallowed one break character here, unless a
+ // single word filled the row and was cut without one.
+ if (row < last && !softWrapped && right < term.cols) text += " ";
end = { x: right, y: row };
}
const cursor = offsets.get(cursorRow * term.cols + buffer.cursorX);
@@ -110,8 +153,15 @@ export function installPromptSelectionBridge(
const key = (pos: IBufferCellPosition) => pos.y * term.cols + pos.x;
if (selection.start.y < prompt.start.y ||
key(selection.end) > (prompt.end.y + 1) * term.cols) return false;
- const start = prompt.offsets.get(Math.max(key(selection.start), key(prompt.start)));
- const end = prompt.offsets.get(Math.min(key(selection.end), key(prompt.end)));
+ // A drag may begin in a continuation row's indent or end in the empty
+ // cells after a row's text; snap both ends onto the draft.
+ const cells = [...prompt.offsets.keys()];
+ const from = Math.max(key(selection.start), key(prompt.start));
+ const to = Math.min(key(selection.end), key(prompt.end));
+ const startCell = cells.find((cell) => cell >= from);
+ const endCell = cells.filter((cell) => cell <= to).pop();
+ const start = startCell === undefined ? undefined : prompt.offsets.get(startCell);
+ const end = endCell === undefined ? undefined : prompt.offsets.get(endCell);
if (start === undefined || end === undefined || start >= end) return false;
// A cell boundary can be inside an emoji composed of several code points.
const boundaries = new Set([0, ...[...segmenter!.segment(prompt.text)].map((s) => s.index + s.segment.length)]);
diff --git a/jarvis/ui/web/frontend/src/components/layout/navGroups.ts b/jarvis/ui/web/frontend/src/components/layout/navGroups.ts
index ffd13ee5d6..27b124c761 100644
--- a/jarvis/ui/web/frontend/src/components/layout/navGroups.ts
+++ b/jarvis/ui/web/frontend/src/components/layout/navGroups.ts
@@ -51,19 +51,17 @@ export function resolveNavLabel(t: (key: string) => string, item: NavItem): stri
}
/**
- * The front page is ONE section ("chats") with two faces — the voice stage
- * and the typed chat — picked by the `Voice | Chat` switch at the top of the
- * sidebar. Its nav row says which face it currently is: Mic + "Voice" or
- * bubble + "Chat", the same two words the switch uses. A fixed "Chats" label
- * under a switch that says "Voice" read as a contradiction (maintainer,
- * 2026-08-23). Every other row passes through unchanged. Pure, so the
- * sidebar and the rail present the row identically.
+ * The front page is ONE section ("chats"): a chat with a voice mode inside it
+ * (2026-10-01; before that, a `Voice | Chat` switch picked between two faces
+ * and this row was renamed after the face). The row is "Chat" whatever mode
+ * the chat is in — voice mode is a state of the chat, not another place.
+ * Every other row passes through unchanged. Pure, so the sidebar and the
+ * rail present the row identically; the surface argument stays so callers
+ * need not change.
*/
-export function presentNavItem(item: NavItem, surface: HomeSurface): NavItem {
+export function presentNavItem(item: NavItem, _surface?: HomeSurface): NavItem {
if (item.id !== "chats") return item;
- return surface === "voice"
- ? { ...item, labelKey: "sidebar.surface_voice", icon: Mic, fallbackLabel: "Voice" }
- : { ...item, labelKey: "sidebar.surface_chat", icon: MessageSquare, fallbackLabel: "Chat" };
+ return { ...item, labelKey: "sidebar.surface_chat", icon: MessageSquare, fallbackLabel: "Chat" };
}
export interface NavItem {
diff --git a/jarvis/ui/web/frontend/src/components/workspace/WorkspaceTerminal.tsx b/jarvis/ui/web/frontend/src/components/workspace/WorkspaceTerminal.tsx
index 129edf42f2..d0472d58f9 100644
--- a/jarvis/ui/web/frontend/src/components/workspace/WorkspaceTerminal.tsx
+++ b/jarvis/ui/web/frontend/src/components/workspace/WorkspaceTerminal.tsx
@@ -14,10 +14,12 @@ import { WebLinksAddon } from "@xterm/addon-web-links";
import "@xterm/xterm/css/xterm.css";
import { Terminal as TerminalIcon, AlertCircle } from "lucide-react";
import { installNewlineBridge } from "../agentic/terminalNewline";
+import { FONT_DEFAULT } from "../agentic/paneFont";
import {
MINIMUM_CONTRAST_RATIO,
PANE_CHROME,
themeFor,
+ type TerminalAppearance,
} from "../agentic/terminalThemes";
import { useThemeValue } from "@/hooks/useTheme";
import { TERMINAL_FONT_STACK, syncTerminalFont } from "@/lib/terminalFont";
@@ -36,6 +38,10 @@ interface WorkspaceTerminalProps {
agentName?: string;
/** Run an agent's installer by name; mutually exclusive with agentName. */
installName?: string;
+ /** Plain terminals are pinned to the workspace chosen when the tab opens. */
+ workspaceId?: string;
+ active?: boolean;
+ appearance?: TerminalAppearance;
/**
* A line to print before anything the process says.
*
@@ -64,12 +70,19 @@ export function WorkspaceTerminal({
installName,
title,
banner,
+ workspaceId,
+ active = true,
+ appearance: requestedAppearance,
}: WorkspaceTerminalProps) {
const containerRef = useRef<HTMLDivElement | null>(null);
const termRef = useRef<Terminal | null>(null);
const [status, setStatus] = useState<Status>("connecting");
const [error, setError] = useState<string | null>(null);
- const appearance = useThemeValue();
+ const appAppearance = useThemeValue();
+ const appearance = requestedAppearance ?? appAppearance;
+ const activeRef = useRef(active);
+ activeRef.current = active;
+ const resizeRef = useRef<() => void>(() => {});
// Read through a ref inside the setup effect: the theme must NOT be a
// dependency there, or switching it would tear down the PTY WebSocket and
// restart the agent. Recolouring happens in its own effect below.
@@ -88,7 +101,7 @@ export function WorkspaceTerminal({
const term = new Terminal({
convertEol: false,
fontFamily: TERMINAL_FONT_STACK,
- fontSize: 12,
+ fontSize: FONT_DEFAULT,
lineHeight: 1.15,
cursorBlink: true,
scrollback: 5000,
@@ -128,6 +141,7 @@ export function WorkspaceTerminal({
let everLive = false;
const sendResize = () => {
+ if (disposed || !activeRef.current || container.clientWidth === 0 || container.clientHeight === 0) return;
try {
fit.fit();
} catch {
@@ -137,6 +151,7 @@ export function WorkspaceTerminal({
ws.send(JSON.stringify({ t: "r", cols: term.cols, rows: term.rows }));
}
};
+ resizeRef.current = sendResize;
// The fit above measured whatever font had loaded by then. If the display
// font lands afterwards, the grid keeps the fallback's cell width while the
@@ -155,6 +170,7 @@ export function WorkspaceTerminal({
};
if (agentName) params.agent = agentName;
else if (installName) params.install = installName;
+ if (workspaceId) params.workspace_id = workspaceId;
// Workspace panes share the same connection budget as the app and IDE
// sockets. A grid mounting at once must not bypass the wake-storm cap.
@@ -189,7 +205,7 @@ export function WorkspaceTerminal({
else if (msg.t === "ready") {
everLive = true;
setStatus("live");
- term.focus();
+ if (activeRef.current) term.focus();
} else if (msg.t === "exit") {
setStatus("exited");
term.write(`\r\n\x1b[33m[process exited: ${msg.code ?? "?"}]\x1b[0m\r\n`);
@@ -233,6 +249,7 @@ export function WorkspaceTerminal({
return () => {
disposed = true;
cancelConnect();
+ resizeRef.current = () => {};
window.removeEventListener("resize", sendResize);
ro.disconnect();
disposeFontSync();
@@ -240,12 +257,21 @@ export function WorkspaceTerminal({
try {
ws?.close();
} catch {
- /* ignore */
+ /* The socket is already closed; terminal cleanup still must run. */
}
term.dispose();
termRef.current = null;
};
- }, [paneKey, agentName, installName]);
+ }, [paneKey, agentName, installName, workspaceId]);
+
+ useEffect(() => {
+ if (!active) return;
+ const frame = requestAnimationFrame(() => {
+ resizeRef.current();
+ termRef.current?.focus();
+ });
+ return () => cancelAnimationFrame(frame);
+ }, [active]);
// Recolour in place on a theme switch. xterm repaints from the new palette
// without touching the buffer, so scrollback and the live PTY both survive.
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index d0adad1d1f..626c2b596a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -5851,7 +5851,10 @@
"done": "Fertig",
"idle": "Im Leerlauf"
}
- }
+ },
+ "add_terminal": "Plain Terminal",
+ "terminal_label": "Terminal",
+ "terminal_workspace_required": "Wähle einen Workspace, um ein Terminal zu öffnen."
},
"jarvis_actions": {
"title": "Jarvis-Aktionen",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 11d23797a8..f838a97962 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -5851,7 +5851,10 @@
"done": "Done",
"idle": "Idle"
}
- }
+ },
+ "add_terminal": "Plain Terminal",
+ "terminal_label": "Terminal",
+ "terminal_workspace_required": "Select a workspace to open a terminal."
},
"jarvis_actions": {
"title": "Jarvis actions",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index c05f4dbdd6..daa8181432 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -5851,7 +5851,10 @@
"done": "Listo",
"idle": "Inactivo"
}
- }
+ },
+ "add_terminal": "Plain Terminal",
+ "terminal_label": "Terminal",
+ "terminal_workspace_required": "Selecciona un espacio de trabajo para abrir una terminal."
},
"jarvis_actions": {
"title": "Acciones de Jarvis",
diff --git a/jarvis/ui/web/frontend/src/index.css b/jarvis/ui/web/frontend/src/index.css
index f4184b8234..f6584de540 100644
--- a/jarvis/ui/web/frontend/src/index.css
+++ b/jarvis/ui/web/frontend/src/index.css
@@ -561,6 +561,16 @@ label,
--popover-foreground: 0 0% 9%;
--user-bubble: 0 0% 96%; /* #F5F5F5 — the speaker: quiet lift, strong ink */
--user-bubble-foreground: 0 0% 9%;
+ /* Front-page chat: the outbound bubble wears the signal hue, and the
+ assistant card's two vivid tiles (Soul = standing instructions,
+ Memory = the wiki) carry their own gradient pair. */
+ --chat-bubble-out: 212 92% 45%;
+ --chat-bubble-out-foreground: 0 0% 100%;
+ --soul-from: 347 83% 52%;
+ --soul-to: 14 92% 56%;
+ --memory-from: 224 86% 52%;
+ --memory-to: 194 92% 48%;
+ --vivid-card-foreground: 0 0% 100%;
--surface-raised: 0 0% 93%; /* #EDEDED — pressed/selected rows, code blocks */
--border: 0 0% 90%; /* #E5E5E5 — hairline */
--border-strong: 0 0% 82%; /* #D1D1D1 — input borders, focused card, float rim */
@@ -753,6 +763,13 @@ label,
--popover-foreground: 0 0% 98%;
--user-bubble: 0 0% 16%; /* #292929 — the speaker: a quiet, legible lift */
--user-bubble-foreground: 0 0% 98%;
+ --chat-bubble-out: 212 100% 56%;
+ --chat-bubble-out-foreground: 0 0% 100%;
+ --soul-from: 347 86% 56%;
+ --soul-to: 14 94% 58%;
+ --memory-from: 226 92% 60%;
+ --memory-to: 194 96% 50%;
+ --vivid-card-foreground: 0 0% 100%;
/* --- Rims. A rim is LIGHTER than the fill it encloses ------------------
On near-black a dark border around a dark fill reads as a wireframe
@@ -980,6 +997,32 @@ body {
color: hsl(var(--user-bubble-foreground));
}
+ /* The front page's chat bubbles (AgentTimeline `bubbles`). */
+ .jarvis-chat-out {
+ background: hsl(var(--chat-bubble-out));
+ color: hsl(var(--chat-bubble-out-foreground));
+ }
+ .jarvis-chat-out a {
+ color: inherit;
+ }
+
+ /* The assistant card's vivid tiles: a gradient pair plus a soft light
+ bloom in the top corner, so the tile reads as an object, not a swatch. */
+ .jarvis-tile-soul,
+ .jarvis-tile-memory {
+ color: hsl(var(--vivid-card-foreground));
+ }
+ .jarvis-tile-soul {
+ background:
+ radial-gradient(120% 90% at 100% 0%, hsl(var(--vivid-card-foreground) / 0.22), transparent 55%),
+ linear-gradient(140deg, hsl(var(--soul-from)), hsl(var(--soul-to)));
+ }
+ .jarvis-tile-memory {
+ background:
+ radial-gradient(120% 90% at 100% 0%, hsl(var(--vivid-card-foreground) / 0.22), transparent 55%),
+ linear-gradient(140deg, hsl(var(--memory-from)), hsl(var(--memory-to)));
+ }
+
/* Selected nav row — the lift surface across the WHOLE row, plus strong ink
on the label. Not a hairline, not an inset accent bar, and never drawn on
the icon box alone while the row it belongs to stays at ground. */
diff --git a/jarvis/ui/web/frontend/src/lib/homeSurface.ts b/jarvis/ui/web/frontend/src/lib/homeSurface.ts
index 16244ce864..68fed19bd1 100644
--- a/jarvis/ui/web/frontend/src/lib/homeSurface.ts
+++ b/jarvis/ui/web/frontend/src/lib/homeSurface.ts
@@ -1,21 +1,23 @@
/**
- * Which surface the front page ("chats" section) shows: the voice stage with
- * the Jarvis bar, or the typed chat.
+ * Which mode the front page ("chats" section) is in: the typed chat, or the
+ * chat's voice mode (the live transcript with the Jarvis bar).
*
- * The two are one section with one switch at the top of the sidebar
- * (maintainer sketch, 2026-08-23) — `Voice | Chat` — not two sections: both
- * talk to the same assistant and share one history. Voice is the default;
- * it is what the product is for, and the typed chat is one click away.
+ * Since 2026-10-01 the front page is ONE chat (maintainer: "no more Voice and
+ * a normal chat — only a normal chat, with a button that turns voice mode
+ * on"). Chat is the default; the voice mode is entered from the chat's top
+ * bar or the assistant card and left the same way.
*
- * Persisted in localStorage so the choice survives a reload and a rebuild.
- * A broken or absent value falls back to voice: a corrupted preference must
+ * Persisted in localStorage so a reload in the middle of a call stays in
+ * voice mode. The key moved to v2 with the redesign so every install opens
+ * on the chat once, whatever the old `Voice | Chat` switch last said. A
+ * broken or absent value falls back to chat: a corrupted preference must
* land somewhere usable, never on a blank screen.
*/
export type HomeSurface = "voice" | "chat";
-const STORAGE_KEY = "jarvis.home.surface.v1";
-const DEFAULT_SURFACE: HomeSurface = "voice";
+const STORAGE_KEY = "jarvis.home.surface.v2";
+const DEFAULT_SURFACE: HomeSurface = "chat";
export function isHomeSurface(value: unknown): value is HomeSurface {
return value === "voice" || value === "chat";
diff --git a/jarvis/ui/web/frontend/src/lib/shortcutRegistry.test.ts b/jarvis/ui/web/frontend/src/lib/shortcutRegistry.test.ts
index 988341f41d..e5a26de49f 100644
--- a/jarvis/ui/web/frontend/src/lib/shortcutRegistry.test.ts
+++ b/jarvis/ui/web/frontend/src/lib/shortcutRegistry.test.ts
@@ -127,7 +127,7 @@ describe("the IDE key menu chord", () => {
(s) => s.labelKey === "shortcut_overlay.workspace.ide_menu",
) as FixedShortcut;
expect(entry.keys).toEqual(["Ctrl", "B"]);
- expect(keyLabel(entry.keys[0], isMac)).toBe("Ctrl");
+ expect(keyLabel(entry.keys[0], isMac)).toBe(isMac ? "⌃" : "Ctrl");
expect(isLeaderChord({ key: "b", code: "KeyB", ctrlKey: true, metaKey: false, altKey: false, shiftKey: false })).toBe(true);
});
}
diff --git a/jarvis/ui/web/frontend/src/lib/shortcutRegistry.ts b/jarvis/ui/web/frontend/src/lib/shortcutRegistry.ts
index 94af014350..2b9d67d350 100644
--- a/jarvis/ui/web/frontend/src/lib/shortcutRegistry.ts
+++ b/jarvis/ui/web/frontend/src/lib/shortcutRegistry.ts
@@ -113,6 +113,12 @@ export const SHORTCUTS: readonly Shortcut[] = [
keys: ["?"],
labelKey: "shortcut_overlay.workspace.open_overlay",
},
+ {
+ kind: "fixed",
+ area: "workspace",
+ keys: ["Ctrl", "B"],
+ labelKey: "shortcut_overlay.workspace.ide_menu",
+ },
{
kind: "app",
area: "workspace",
diff --git a/jarvis/ui/web/frontend/src/store/ideSidePanel.ts b/jarvis/ui/web/frontend/src/store/ideSidePanel.ts
index ad9890415c..da3a3ee0fc 100644
--- a/jarvis/ui/web/frontend/src/store/ideSidePanel.ts
+++ b/jarvis/ui/web/frontend/src/store/ideSidePanel.ts
@@ -11,7 +11,16 @@ import { create } from "zustand";
*/
/** Every function the panel can show. A new one is a new id plus a registry entry. */
-export type SidePanelTabId = "agents" | "changes" | "files" | "git" | "office";
+export type SidePanelTabId = "agents" | "changes" | "files" | "git" | "office" | `terminal:${string}`;
+
+export interface SidePanelTerminal {
+ id: `terminal:${string}`;
+ workspaceId: string;
+ workspaceName: string;
+ number: number;
+}
+
+export const MAX_TERMINAL_TABS = 16;
export const SIDE_PANEL_TAB_IDS: readonly SidePanelTabId[] = ["agents", "changes", "files", "git", "office"];
@@ -59,7 +68,10 @@ function storedTabs(): { tabs: SidePanelTabId[]; active: SidePanelTabId } {
function persist(open: boolean, tabs: SidePanelTabId[], active: SidePanelTabId): void {
try {
localStorage.setItem(OPEN_KEY, open ? "1" : "0");
- localStorage.setItem(TABS_KEY, JSON.stringify({ tabs, active }));
+ // Shell processes belong to this window. A reload must not silently start
+ // replacements for commands that were running before the window closed.
+ const saved = tabs.filter(isTabId);
+ localStorage.setItem(TABS_KEY, JSON.stringify({ tabs: saved, active: isTabId(active) ? active : saved[0] }));
} catch {
/* a convenience only: the panel still works for this session */
}
@@ -78,6 +90,8 @@ interface IdeSidePanelState {
open: boolean;
tabs: SidePanelTabId[];
active: SidePanelTabId;
+ terminals: SidePanelTerminal[];
+ addTerminalTab: (workspaceId: string, workspaceName: string) => void;
setOpen: (open: boolean) => void;
toggle: () => void;
/** Open a tab (or bring it forward when it is already open). */
@@ -115,6 +129,17 @@ export const useIdeSidePanelStore = create<IdeSidePanelState>((set, get) => {
open: storedOpen(),
tabs: initialTabs.tabs,
active: initialTabs.active,
+ terminals: [],
+ addTerminalTab: (workspaceId, workspaceName) => {
+ if (!workspaceId) return;
+ const { terminals, tabs } = get();
+ const siblings = terminals.filter((terminal) => terminal.workspaceId === workspaceId);
+ if (siblings.length >= MAX_TERMINAL_TABS) return;
+ const id = `terminal:${crypto.randomUUID()}` as const;
+ const number = Math.max(0, ...siblings.map((terminal) => terminal.number)) + 1;
+ set({ terminals: [...terminals, { id, workspaceId, workspaceName, number }] });
+ commit({ open: true, tabs: [...tabs, id], active: id });
+ },
spotlight: null,
setSpotlight: (spotlight) => set({ spotlight }),
maximized: false,
@@ -138,6 +163,7 @@ export const useIdeSidePanelStore = create<IdeSidePanelState>((set, get) => {
const index = tabs.indexOf(id);
if (index < 0) return;
const rest = tabs.filter((tab) => tab !== id);
+ set({ terminals: get().terminals.filter((terminal) => terminal.id !== id) });
if (rest.length === 0) {
set({ spotlight: null, maximized: false, inUse: false });
commit({ open: false, tabs: DEFAULT_TABS, active: DEFAULT_TABS[0] });
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
index b5a7d1b04b..961d97fe18 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
@@ -94,7 +94,8 @@ describe("Agentic IDE project flow", () => {
act(() => useIdeProjectsStore.getState().newWorkspace("p1"));
const dialog = await screen.findByRole("dialog", { name: "New workspace" });
// Keeping the checkout is the default, so the git choices sit folded behind one summary line.
- fireEvent.click(await within(dialog).findByRole("button", { name: /Git options/ }));
+ await waitFor(() => expect((within(dialog).getByRole("button", { name: "Git options" }) as HTMLButtonElement).disabled).toBe(false));
+ fireEvent.click(within(dialog).getByRole("button", { name: "Git options" }));
fireEvent.click(await within(dialog).findByRole("radio", { name: /New worktree/ }));
expect((within(dialog).getByLabelText("Branch name") as HTMLInputElement).value).toBe("agent/brave-river-0001");
fireEvent.click(screen.getByRole("button", { name: "Create workspace" }));
@@ -155,6 +156,30 @@ describe("Agentic IDE project flow", () => {
await waitFor(() => expect(api.addTerminal).toHaveBeenCalledWith({ workspace_id: "w1", agent: "codex", direction: "down" }, { onMessage: expect.any(Function) }));
});
+ it("splits with a plain terminal even when no coding CLI is installed", async () => {
+ api.fetchIdeAgents.mockResolvedValue({ agents: [
+ { ...agent, installed: false },
+ { ...agent, name: "shell", display_name: "Plain Terminal", kind: "shell", accepts_prompts: false },
+ { ...agent, name: "harness", display_name: "Browser Harness", accepts_prompts: false },
+ ] });
+ const session = { id: "w1", folder: "/code/app", project: { name: "App" },
+ terminals: [{ key: "t1", name: "T1", display_name: "Plain Terminal" }], layout: balancedLayout(["t1"]) };
+ api.fetchIdeState.mockResolvedValue({ ...emptyState, active: true, active_id: "w1", session });
+ api.fetchIdeProjects.mockResolvedValue({ projects: [project], active_workspace_id: "w1" });
+ api.addTerminal.mockResolvedValue(session);
+ render(<AgenticIdeView />);
+ fireEvent.click(await screen.findByRole("button", { name: "Pane add" }));
+ const dialog = screen.getByRole("dialog", { name: "Add coding agent" });
+ expect(within(dialog).queryByRole("button", { name: "Codex" })).toBeNull();
+ expect(within(dialog).queryByRole("button", { name: "Browser Harness" })).toBeNull();
+ fireEvent.click(within(dialog).getByRole("combobox", { name: "Split next to" }));
+ fireEvent.click(await within(dialog).findByRole("option", { name: "T1 · Plain Terminal" }));
+ fireEvent.click(within(dialog).getByRole("radio", { name: "Split right" }));
+ fireEvent.click(within(dialog).getByRole("button", { name: "Plain Terminal" }));
+ await waitFor(() => expect(api.addTerminal).toHaveBeenCalledWith(
+ { workspace_id: "w1", agent: "shell", anchor: "T1", direction: "right" }, { onMessage: expect.any(Function) }));
+ });
+
it("lets the user choose which pane to split and in which direction", async () => {
const terminals = [{ key: "t1", history_id: "id1", name: "T1", display_name: "Codex" }, { key: "t2", history_id: "id2", name: "T2", display_name: "Codex" }];
const session = { id: "w1", project_id: "p1", folder: "/code/app", name: "App work", created_at: 0,
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
index 9cba2a9298..f7ae52e16e 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
@@ -128,7 +128,8 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
// On a connected computer the CLI has to be installed THERE, not here: the
// server is checked before anything is copied, so every coding CLI is offered.
const workspaceChoices = workspaceComputer ? codingAgents : installed;
- const agentChoices = agentComputer ? codingAgents : installed;
+ const agentChoices = agents.filter((agent) =>
+ (agent.kind === "shell" || agent.accepts_prompts !== false) && (agentComputer || agent.installed));
const dialogOpen = projectDialog || workspaceProject !== null || renameOpen || agentPicker !== null;
useEffect(() => {
@@ -553,7 +554,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
return <div className="relative flex h-full min-h-0 flex-col bg-background text-foreground" data-testid="igentic-ide">
<WorkspaceOptionsDialog open={optionsOpen && !!session} onOpenChange={setOptionsOpen} workspace={session?.name ?? session?.project.name ?? ""}
- count={session?.terminals.length ?? 0} maxPanes={maxPanes} busy={busy} canAdd={installed.length > 0}
+ count={session?.terminals.length ?? 0} maxPanes={maxPanes} busy={busy} canAdd={agents.some((agent) => agent.installed && (agent.kind === "shell" || agent.accepts_prompts !== false))}
onAdd={openAgentPicker} onBalance={balanceLayout} onRename={() => { setRenameValue(session?.name ?? session?.project.name ?? ""); setRenameOpen(true); }}
onClose={stopWorkspace} onGit={() => setGitOpen(true)} appearance={appearance} onAppearance={saveAppearance}
paneStyle={paneStyle} onPaneStyle={savePaneStyle}
@@ -563,7 +564,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
<CloseAgentDialog target={closeTarget} busy={busy} onCancel={() => setCloseRequest(null)} onConfirm={confirmClose} />
<main className="min-h-0 flex-1">
- <IdeSidePanelFrame markInUse={paneStyle === "minimal"}>
+ <IdeSidePanelFrame markInUse={paneStyle === "minimal"} appearance={appearance ?? undefined} onScreen={onScreen}>
{session ? <RetainedWorkspaceGrid session={session} onScreen={onScreen} workspaceIds={state.workspaces?.map((workspace) => workspace.id)} onChanged={(next) => setState((current) => current?.session?.id === next.id ? { ...current, session: next } : current)}
onAdd={openAgentPicker} onClose={closeAgent} onSelect={setSelected} selected={selected} maxPanes={maxPanes} fontSize={fontSize} appearance={appearance} disabled={busy}
onMutationStart={beginGridMutation} onMutationEnd={endGridMutation} paneStyle={paneStyle} workspaces={state.workspaces ?? []} />
diff --git a/jarvis/ui/web/workspace_routes.py b/jarvis/ui/web/workspace_routes.py
index 9d908ff86c..1df853163d 100644
--- a/jarvis/ui/web/workspace_routes.py
+++ b/jarvis/ui/web/workspace_routes.py
@@ -23,6 +23,7 @@ from pydantic import BaseModel, Field
from jarvis.core.paths import repo_root
from jarvis.terminal.pty_manager import PtyManager
from jarvis.workspace.agents import (
+ PLAIN_TERMINAL,
build_agent_argv,
build_install_argv,
coding_agent_names,
@@ -167,7 +168,18 @@ async def workspace_pty(ws: WebSocket, key: str) -> None:
# app was running is a legitimate answer here, and the import-time snapshot
# this used to test against could never contain one.
known = set(coding_agent_names())
- if agent:
+ if agent == PLAIN_TERMINAL and not install:
+ # Pin a tab to the workspace it was opened in, never the active one.
+ from jarvis.agentic_ide.session import get_registry
+
+ workspace_id = qp.get("workspace_id")
+ workspace = get_registry().get(workspace_id) if workspace_id else None
+ if workspace is None:
+ await ws.close(code=4404, reason="workspace not found")
+ return
+ cwd = str(workspace.folder)
+ argv = build_agent_argv(PLAIN_TERMINAL)
+ elif agent:
if agent not in known:
await ws.close(code=4400, reason="unknown agent")
return
@@ -219,9 +231,8 @@ async def workspace_pty(ws: WebSocket, key: str) -> None:
await ws.close(code=4500, reason="spawn failed")
return
- await ws.send_json({"t": "ready"})
-
try:
+ await ws.send_json({"t": "ready"})
while True:
try:
msg = await ws.receive_json()
@@ -231,8 +242,9 @@ async def workspace_pty(ws: WebSocket, key: str) -> None:
# AP-20: an unclean teardown raises RuntimeError, not
# WebSocketDisconnect — treat any read error as terminal.
break
- except Exception: # noqa: BLE001, S112 - malformed frame; keep the PTY alive
- continue
+ except Exception: # noqa: BLE001
+ log.debug("Workspace terminal receive failed", exc_info=True)
+ break
kind = msg.get("t")
if kind == "i":
mgr.write(session.terminal_id, str(msg.get("d", "")))
diff --git a/pyproject.toml b/pyproject.toml
index 7f48acf3de..8b14d3dc8e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "personal-jarvis"
-version = "2.5.0"
+version = "2.4.4"
description = "Turn your computer into an AI agent that coordinates apps, tools, models, and other agents"
requires-python = ">=3.11,<3.15"
readme = "README.md"
diff --git a/tests/integration/test_workspace_shell_tabs.py b/tests/integration/test_workspace_shell_tabs.py
new file mode 100644
index 0000000000..e5701f8796
--- /dev/null
+++ b/tests/integration/test_workspace_shell_tabs.py
@@ -0,0 +1,79 @@
+"""Plain shell tabs use their named workspace and clean up their own PTY."""
+
+from types import SimpleNamespace
+
+import pytest
+from fastapi import FastAPI
+from fastapi.testclient import TestClient
+from starlette.websockets import WebSocketDisconnect
+
+from jarvis.agentic_ide import session
+from jarvis.ui.web import workspace_routes as routes
+from tests.fakes.fake_pty_manager import FakePtyManager
+
+
+def shell_app(monkeypatch, tmp_path):
+ workspace = SimpleNamespace(folder=tmp_path)
+ registry = SimpleNamespace(get=lambda key: workspace if key == "workspace-a" else None)
+ monkeypatch.setattr(session, "get_registry", lambda: registry)
+ monkeypatch.setattr(routes, "credentials_valid", lambda scope: True)
+ monkeypatch.setattr(routes, "build_agent_argv", lambda name: ("/bin/test-shell",))
+ app = FastAPI()
+ app.include_router(routes.router)
+ manager = FakePtyManager()
+ app.state.workspace_pty = manager
+ return TestClient(app), manager, tmp_path
+
+
+def test_shell_tabs_are_independent_and_use_the_named_workspace(shell_app):
+ client, manager, folder = shell_app
+ with client.websocket_connect(
+ "/api/workspace/pty/one?agent=shell&workspace_id=workspace-a"
+ ) as first:
+ assert first.receive_json() == {"t": "ready"}
+ with client.websocket_connect(
+ "/api/workspace/pty/two?agent=shell&workspace_id=workspace-a"
+ ) as second:
+ assert second.receive_json() == {"t": "ready"}
+ first.send_json({"t": "i", "d": "pwd\r"})
+ first.send_json({"t": "r", "cols": 92, "rows": 30})
+ assert manager.closed == ["fake-pty-2"]
+ assert manager.closed == ["fake-pty-2", "fake-pty-1"]
+ assert manager.writes == [("fake-pty-1", "pwd\r")]
+ assert manager.resizes == [("fake-pty-1", 92, 30)]
+ assert len(manager.spawns) == 2
+ assert all(spawn["cwd"] == str(folder) for spawn in manager.spawns)
+ assert all(spawn["argv"] == ("/bin/test-shell",) for spawn in manager.spawns)
+
+
[email protected]("query", ["", "&workspace_id=unknown"])
+def test_shell_requires_a_known_workspace_without_falling_back(shell_app, query):
+ client, manager, _ = shell_app
+ with client.websocket_connect(f"/api/workspace/pty/one?agent=shell{query}") as socket:
+ with pytest.raises(WebSocketDisconnect) as error:
+ socket.receive_json()
+ assert error.value.code == 4404
+ assert manager.spawns == []
+
+
+def test_shell_preserves_authorization(shell_app, monkeypatch):
+ client, manager, _ = shell_app
+ monkeypatch.setattr(routes, "credentials_valid", lambda scope: False)
+ with client.websocket_connect(
+ "/api/workspace/pty/one?agent=shell&workspace_id=workspace-a"
+ ) as socket:
+ with pytest.raises(WebSocketDisconnect) as error:
+ socket.receive_json()
+ assert error.value.code == 4401
+ assert manager.spawns == []
+
+
+def test_malformed_receive_closes_the_shell_instead_of_looping(shell_app):
+ client, manager, _ = shell_app
+ with client.websocket_connect(
+ "/api/workspace/pty/one?agent=shell&workspace_id=workspace-a"
+ ) as socket:
+ assert socket.receive_json() == {"t": "ready"}
+ socket.send_text("invalid JSON")
+ assert manager.closed == ["fake-pty-1"]
diff --git a/tests/unit/agent_chat/test_turn_completion.py b/tests/unit/agent_chat/test_turn_completion.py
new file mode 100644
index 0000000000..ae4f6cf588
--- /dev/null
+++ b/tests/unit/agent_chat/test_turn_completion.py
@@ -0,0 +1,315 @@
+"""Clear requests execute; real questions keep the same turn alive until answered."""
+
+from __future__ import annotations
+
+import asyncio
+import json
+
+import pytest
+
+from jarvis.agent_chat import service as service_module
+from jarvis.agent_chat.events import make_event
+from jarvis.agent_chat.questions import parse_questions
+from jarvis.agent_chat.runner_api import TurnHandle
+from jarvis.agent_chat.service import AgentChatService, _Running
+from jarvis.agent_chat.store import AgentChatStore
+from jarvis.agent_chat.turn_completion import TurnCompletion, offer_instead_of_action
+from jarvis.core.protocols import current_chat_turn
+
+QUESTION = {"question": "Which project?", "options": ["Reading tracker", "Budget tracker"]}
+
+
+ "user_request,reply",
+ [
+ ("Please create a README file.", "I can create that for you. Shall I start?"),
+ (
+ "Erstelle bitte eine Datei.",
+ "Ich schlage vor, zuerst einen Entwurf zu machen.",
+ ), # i18n-allow
+ ("Por favor crea el archivo.", "Si quieres, puedo crearlo."), # i18n-allow
+ ("Please create a project overview.", "Which project should I use?"),
+ ],
+)
+def test_offer_and_unstructured_blocking_question_are_not_execution(user_request, reply):
+ assert offer_instead_of_action(user_request, reply)
+
+
+ "user_request,reply",
+ [
+ ("Give me suggestions for the design.", "I suggest a simple layout."),
+ ("Please write a poem.", "I can fly beyond the sky."),
+ ("Translate this example.", "If you want, I can help."),
+ ("Please create a file.", "Created the file. Would you like anything else?"),
+ ("Please check the file.", "I can confirm the file contains the requested sections."),
+ ("Please create a plan.", "I suggest these steps."),
+ ("Did you create the file?", "I can create it if you want."),
+ ("Summarize this text: please create a file.", "I can create it if you want."),
+ ],
+)
+def test_advice_plans_and_actual_results_do_not_start_unrequested_work(user_request, reply):
+ assert not offer_instead_of_action(user_request, reply)
+
+
+async def card_world(tmp_path):
+ svc = AgentChatService(AgentChatStore(":memory:"))
+ session = svc.store.create_session(
+ provider="openai", model="fake", effort="", cwd=str(tmp_path)
+ )
+ run = _Running("t", asyncio.Event())
+ run.task = asyncio.create_task(asyncio.sleep(3600))
+ svc._running[session.session_id] = run
+
+ async def emit(event):
+ await svc._emit(session.session_id, event)
+
+ async def ask(*args):
+ return "deny"
+
+ handle = TurnHandle(session, "t", emit, ask, run.cancel)
+ gate = TurnCompletion(svc, handle, "Please create my project overview.", allow_correction=True)
+ try:
+ yield svc, handle, gate
+ finally:
+ svc.signal_cancel(session.session_id)
+ run.task.cancel()
+ await asyncio.gather(run.task, return_exceptions=True)
+ for task in list(svc._question_tasks):
+ task.cancel()
+ await asyncio.gather(*svc._question_tasks, return_exceptions=True)
+ svc.store.close()
+
+
+async def waiting(gate, svc, handle):
+ qid = await svc.open_questions(handle.session.session_id, parse_questions(QUESTION))
+ await gate.emit(
+ make_event(
+ "tool_call",
+ {
+ "call_id": "q",
+ "name": "mcp__jarvis__society_ask_user",
+ "input": {"questions": [QUESTION]},
+ },
+ )
+ )
+ await gate.emit(
+ make_event(
+ "tool_result",
+ {
+ "call_id": "q",
+ "output": json.dumps({"status": "waiting", "question_id": qid}),
+ "is_error": False,
+ },
+ )
+ )
+ await gate.emit(
+ make_event(
+ "turn_finished",
+ {
+ "turn_id": "t",
+ "status": "done",
+ "usage": {"output_tokens": 7},
+ "cost_usd": 0.01,
+ },
+ )
+ )
+ return qid
+
+
+async def test_card_stays_open_after_runner_exit_and_resumes_with_the_answer(card_world):
+ svc, handle, gate = card_world
+ sid = handle.session.session_id
+ qid = await waiting(gate, svc, handle)
+ continuation = asyncio.create_task(gate.next_prompt())
+ await asyncio.sleep(0)
+ assert not continuation.done() and svc.pending_questions(sid) == [qid]
+ assert not any(e["kind"] == "turn_finished" for e in svc.store.list_events(sid))
+ assert svc.resolve_question(sid, qid, option_index=1)
+ prompt = await asyncio.wait_for(continuation, 2)
+ assert "Budget tracker" in prompt and '"source": "person"' in prompt
+ await gate.emit(
+ make_event(
+ "turn_finished",
+ {
+ "turn_id": "t",
+ "status": "done",
+ "usage": {"output_tokens": 5},
+ "cost_usd": 0.02,
+ },
+ )
+ )
+ assert await gate.next_prompt() is None
+ await gate.publish()
+ finish = [e for e in svc.store.list_events(sid) if e["kind"] == "turn_finished"]
+ assert len(finish) == 1 and finish[0]["payload"]["usage"]["output_tokens"] == 12
+ assert finish[0]["payload"]["cost_usd"] == pytest.approx(0.03)
+
+
+async def test_answer_arriving_before_runner_exit_is_not_lost(card_world):
+ svc, handle, gate = card_world
+ qid = await waiting(gate, svc, handle)
+ svc.resolve_question(handle.session.session_id, qid, option_index=0)
+ await svc._questions[qid].result
+ assert svc.pending_questions(handle.session.session_id) == []
+ assert "Reading tracker" in await gate.next_prompt()
+
+
+async def test_answers_already_returned_to_the_model_do_not_trigger_a_second_run(card_world):
+ svc, handle, gate = card_world
+ qid = await waiting(gate, svc, handle)
+ svc.resolve_question(handle.session.session_id, qid, option_index=0)
+ await svc.wait_questions(handle.session.session_id, qid)
+ assert await gate.next_prompt() is None
+
+
+async def test_stop_during_question_wait_never_continues(card_world):
+ svc, handle, gate = card_world
+ await waiting(gate, svc, handle)
+ continuation = asyncio.create_task(gate.next_prompt())
+ await asyncio.sleep(0)
+ svc.signal_cancel(handle.session.session_id)
+ with pytest.raises(asyncio.CancelledError):
+ await continuation
+
+
+async def test_plain_offer_is_corrected_once_without_reauthorizing_the_task(card_world):
+ _, _, gate = card_world
+ gate.context = gate.request + "\nAttached source: input.md"
+ offer = make_event("assistant_text", {"text": "I can write that. Shall I start?"})
+ finish = make_event("turn_finished", {"status": "done", "usage": {}})
+ await gate.emit(offer)
+ await gate.emit(finish)
+ prompt = await gate.next_prompt()
+ assert "society_ask_user" in prompt and "input.md" in prompt
+ assert gate.request in prompt
+ await gate.emit(offer)
+ await gate.emit(finish)
+ assert await gate.next_prompt() is None
+
+
+async def test_denial_prevents_plain_offer_correction(card_world):
+ _, _, gate = card_world
+ await gate.ask("c", "Write", {}, "Write file")
+ await gate.emit(make_event("assistant_text", {"text": "I can write that. Shall I start?"}))
+ await gate.emit(make_event("turn_finished", {"status": "done", "usage": {}}))
+ assert await gate.next_prompt() is None
+
+
+async def test_work_already_done_does_not_trigger_optional_offer_execution(card_world):
+ _, _, gate = card_world
+ await gate.emit(make_event("tool_call", {"call_id": "w", "name": "Write", "input": {}}))
+ await gate.emit(make_event("tool_result", {"call_id": "w", "output": "Saved"}))
+ await gate.emit(make_event("assistant_text", {"text": "I can also create a second file."}))
+ await gate.emit(make_event("turn_finished", {"status": "done", "usage": {}}))
+ assert await gate.next_prompt() is None
+
+
[email protected]("runner", ["brain", "claude-cli"])
[email protected]("cancel_wait", [False, True])
+async def test_service_continues_to_artifact_after_question_without_another_user_turn(
+ tmp_path,
+ monkeypatch,
+ runner,
+ cancel_wait,
+):
+ from jarvis.society.runtime import SocietyRuntime
+
+ svc = AgentChatService(AgentChatStore(":memory:"))
+ rt = SocietyRuntime(tmp_path, seed_starter_team=False, chat_service=lambda: svc)
+ await rt.ensure_started()
+ agent, _ = await rt.roster.create(name="Completion tester", provider="openai", model="fake")
+ session = svc.store.create_session(
+ session_id=agent.session_id,
+ provider="openai",
+ model="fake",
+ effort="",
+ surface="society",
+ cwd=str(tmp_path),
+ permission_mode="bypass",
+ )
+ monkeypatch.setattr(service_module, "resolve_runner", lambda *args, **kwargs: runner)
+ attempts = []
+ q = svc.subscribe(session.session_id)
+
+ async def run(handle, prompt, *args, **kwargs):
+ attempts.append((handle.turn_id, handle.session.vendor_session))
+ assert current_chat_turn.get().user_text == "Please create my project overview."
+ if len(attempts) == 1:
+ qid = await svc.open_questions(session.session_id, parse_questions(QUESTION))
+ await handle.emit(
+ make_event(
+ "tool_call",
+ {
+ "call_id": "q",
+ "name": "society_ask_user",
+ "input": {},
+ },
+ )
+ )
+ await handle.emit(
+ make_event(
+ "tool_result",
+ {
+ "call_id": "q",
+ "output": {"status": "waiting", "question_id": qid},
+ },
+ )
+ )
+ else:
+ assert handle.continuation and "Budget tracker" in prompt
+ if runner == "claude-cli":
+ assert handle.session.vendor_session == "vendor-thread"
+ (tmp_path / "overview.md").write_text("# Budget tracker", encoding="utf-8")
+ await handle.emit(
+ make_event(
+ "assistant_text", {"turn_id": handle.turn_id, "text": "Saved overview.md."}
+ )
+ )
+ await handle.emit(
+ make_event(
+ "turn_finished",
+ {
+ "turn_id": handle.turn_id,
+ "status": "done",
+ "usage": {"output_tokens": 3},
+ "cost_usd": 0.01,
+ },
+ )
+ )
+ return "vendor-thread"
+
+ monkeypatch.setattr(service_module, "run_brain_turn", run)
+ monkeypatch.setattr(service_module, "run_cli_turn", run)
+ try:
+ turn_id = await svc.send(session.session_id, "Please create my project overview.")
+ async with asyncio.timeout(5):
+ while (event := await q.get())["kind"] != "question_required":
+ assert event["kind"] != "turn_finished"
+ await asyncio.sleep(0)
+ assert svc.is_running(session.session_id)
+ if cancel_wait:
+ svc.signal_cancel(session.session_id)
+ else:
+ svc.resolve_question(
+ session.session_id, event["payload"]["question_id"], option_index=1
+ )
+ while (event := await q.get())["kind"] != "turn_finished":
+ pass
+ if cancel_wait:
+ assert event["payload"]["status"] == "cancelled"
+ assert event["payload"]["usage"]["output_tokens"] == 3
+ assert event["payload"]["cost_usd"] == pytest.approx(0.01)
+ assert len(attempts) == 1 and not (tmp_path / "overview.md").exists()
+ else:
+ assert event["payload"]["status"] == "done"
+ assert event["payload"]["usage"]["output_tokens"] == 6
+ assert event["payload"]["cost_usd"] == pytest.approx(0.02)
+ assert [a[0] for a in attempts] == [turn_id, turn_id]
+ assert (tmp_path / "overview.md").read_text() == "# Budget tracker"
+ finally:
+ if svc.is_running(session.session_id):
+ await svc.cancel(session.session_id)
+ await rt.close()
+ svc.store.close()
diff --git a/tests/unit/agentic_ide/test_quick_agent_catalog.py b/tests/unit/agentic_ide/test_quick_agent_catalog.py
index 96d1509fa6..2d2cba0bc4 100644
--- a/tests/unit/agentic_ide/test_quick_agent_catalog.py
+++ b/tests/unit/agentic_ide/test_quick_agent_catalog.py
@@ -25,9 +25,12 @@ async def test_quick_catalog_resolves_off_loop_without_expensive_probes(
accepts_typed_prompts=False,
),
agents.WorkspaceAgent(name="missing", display_name="Missing Agent"),
+ agents.WorkspaceAgent(
+ name="shell", display_name="Plain Terminal", kind="shell", needs_trust=False
+ ),
]
by_name = {spec.name: spec for spec in specs}
- monkeypatch.setattr(agents, "coding_agents", lambda: specs)
+ monkeypatch.setattr(agents, "list_agents", lambda: specs)
monkeypatch.setattr(agents, "get_agent", by_name.get)
monkeypatch.setattr(agents, "pty_available", lambda: pty_available)
@@ -42,15 +45,19 @@ async def test_quick_catalog_resolves_off_loop_without_expensive_probes(
def resolve_agent(name):
assert threading.get_ident() != event_loop_thread
resolved.append(name)
- return ("example",) if name == "example" else None
+ return (name,) if name in {"example", "shell"} else None
monkeypatch.setattr(routes, "agent_argv", resolve_agent)
result = await routes.get_agents(quick=True)
- assert resolved == ["example", "missing"]
+ assert resolved == ["example", "missing", "shell"]
assert result.terminal_available is pty_available
assert result.max_terminals == routes.MAX_TERMINALS
assert len(result.suggested_names) == routes.MAX_TERMINALS
- example, missing = result.agents
+ example, missing, shell = result.agents
+ assert shell.installed is True
+ assert shell.kind == "shell"
+ assert shell.accepts_prompts is False
+ assert shell.display_name == "Plain Terminal"
assert example.installed is True
assert missing.installed is False
assert example.version is None
diff --git a/tests/unit/society/test_cli_routines.py b/tests/unit/society/test_cli_routines.py
index 14879b15e4..17c2ca3d24 100644
--- a/tests/unit/society/test_cli_routines.py
+++ b/tests/unit/society/test_cli_routines.py
@@ -128,6 +128,11 @@ async def test_explicit_cli_request_schedules_and_reads_back(world, quote):
try:
result = json.loads(await call(world, "society_propose_change", args(quote)))
assert result["applied"] is True
+ assert result["proposal"]["action"]["resume_in_place"] is True
+ events = await world.rt.store.events_since()
+ assert not any(str(e.msg_type) == "RELEASE" and e.to_agent == "scout" for e in events)
+ notices = world.rt.chat_service().notices
+ assert not any(n.get("kind") == "proposal" for _, n in notices)
saved = json.loads(await call(world, "society_routines"))
assert saved["timezone"] == "America/New_York"
assert len(saved["routines"]) == 1
diff --git a/uv.lock b/uv.lock
index 16888507a4..1b09fa9f46 100644
--- a/uv.lock
+++ b/uv.lock
@@ -2873,7 +2873,7 @@ wheels = [
[[package]]
name = "personal-jarvis"
-version = "2.5.0"
+version = "2.4.4"
source = { editable = "." }
dependencies = [
{ name = "aiofiles" },