Files
orca/mobile/src/session/mobile-structured-host-clock-offset.ts
T
Kelvin Amoaba ce3fe75891 feat(mobile): set, pause, resume and clear a chat's goal from the phone (#38447)
* feat(mobile): set, pause, resume and clear a chat's goal from the phone

The phone sent /goal to the agent as plain text and showed no goal. It now
has desktop's goal mode (Goal chip, goal placeholder) and a goal strip on the
composer's top edge that expands to Pause/Resume and Clear goal.

The goal logic desktop and mobile share moves to src/shared: the goal report
(journal rows over the options answer), status labels, elapsed format, the
goal-mode pick rule and the goal row filter. agentSession.threadGoal joins the
phone allowlist behind agent-session.thread-goal.phone.v1, so older hosts keep
showing the goal without offering changes.

* fix(mobile): open each new goal's strip collapsed

* fix(mobile): keep goal sends' delivery choice and scope goal locks per chat

* fix(mobile): offer goal changes only when the paired desktop relays them

* test(mobile): pin which goal changes the phone offers per host

* refactor(mobile): reuse the queued box style and keep the goal strip stable per chunk

* fix(mobile): set phone goals through the composer's changeThreadGoal
2026-11-05 22:42:44 +00:00

14 lines
586 B
TypeScript

import type { StructuredAgentHostClock } from '../../../src/shared/agent-session/structured-agent-session-reducer'
// Ignore delivery jitter below the precision of displayed clocks.
const OFFSET_GRAIN_MS = 1_000
/** Phone clock minus host clock; each host sample covers restarts and corrections, rounded so jitter keeps memoized rows. */
export function mobileStructuredHostClockOffsetMs(
hostClock: StructuredAgentHostClock | null | undefined
): number {
return hostClock
? Math.round((hostClock.receivedAt - hostClock.hostNow) / OFFSET_GRAIN_MS) * OFFSET_GRAIN_MS
: 0
}