{"version":3,"file":"homeActivity.cjs","names":["t","currentLocale","DEFAULT_LOCALE","splitHostId","railSessionStatus","formatRunDuration"],"sources":["../../../src/web/lib/homeActivity.ts"],"sourcesContent":["import type { HomeItem, HomeKind, HomeSnapshot } from '@agimon-ai/po-core/sessionProtocol';\nimport { currentLocale, DEFAULT_LOCALE, t, type DashboardTileData } from '@agimon-ai/po-core/web';\nimport type { DotTone } from '@agimon-ai/po-web-components';\nimport { formatRunDuration } from '@agimon-ai/po-web-components/text';\n\nimport { splitHostId } from './hostIdentity';\nimport type { InstalledHomeContribution } from './pluginRegistry';\nimport { railSessionStatus, type RailSessionInput } from './sessionRailModel';\n\n/** Rows past this stay behind \"Show earlier\" even when it is open. */\nconst EARLIER_LIMIT = 50;\nconst ATTENTION_KINDS: readonly HomeKind[] = ['decision', 'failure', 'blocked', 'paused'];\n/** Rows per page of the Today timeline, so a busy day stays one screen tall. */\nexport const TODAY_PAGE_SIZE = 8;\n/** Rows per page of Waiting on you, so a hundred agents asking stay one glance tall. */\nexport const WAITING_PAGE_SIZE = 5;\n\nfunction kindOutcome(kind: HomeKind): string {\n  switch (kind) {\n    case 'decision':\n      return t('webDashboard.home.kind.decision', 'Waiting for your answer');\n    case 'failure':\n      return t('webDashboard.home.kind.failure', 'Failed');\n    case 'blocked':\n      return t('webDashboard.home.kind.blocked', 'Blocked');\n    case 'paused':\n      return t('webDashboard.home.kind.paused', 'Paused');\n    case 'running':\n      return t('webDashboard.home.kind.running', 'Running');\n    case 'queued':\n      return t('webDashboard.home.kind.queued', 'Queued');\n    case 'completed':\n      return t('webDashboard.home.kind.completed', 'Finished');\n  }\n}\n\nconst KIND_TONE: Record<HomeKind, DotTone> = {\n  decision: 'magenta',\n  failure: 'red',\n  blocked: 'yellow',\n  paused: 'yellow',\n  running: 'green',\n  queued: 'neutral',\n  completed: 'green',\n};\n\n/** What a row opens: the session, and the Activity group that owns the item when there is one. */\nexport interface HomeTarget {\n  sessionId: string;\n  destination?: string;\n}\n\nexport interface HomeActor {\n  name: string;\n  image?: string;\n}\n\nexport interface HomeActivityItem {\n  id: string;\n  at: string;\n  name: string;\n  outcome: string;\n  tone: DotTone;\n  actor?: HomeActor;\n  icon?: DashboardTileData['icon'];\n  branch?: string;\n  /** The contributing package's label, for a row that is not a session. */\n  source?: string;\n  /** The computer the row came from, only while more than one is read. */\n  host?: string;\n  target: HomeTarget;\n}\n\nexport interface HomeWaitingItem {\n  id: string;\n  name: string;\n  detail: string;\n  /** How long it has waited, such as \"14m\". */\n  waited?: string;\n  actor?: HomeActor;\n  failed?: boolean;\n  /** The computer the row came from, only while more than one is read. */\n  host?: string;\n  target: HomeTarget;\n}\n\nexport interface HomeSessionInput {\n  id: string;\n  entry: RailSessionInput;\n  avatarUrl?: string;\n}\n\n/** One computer's Home read: absent until it answers, and absent for good where nothing can read it. */\nexport interface HomeHostRead {\n  /** Undefined for the page's own host. */\n  hostId?: string;\n  label: string;\n  snapshot?: HomeSnapshot;\n  loading: boolean;\n  error?: string;\n  /** The Home contributions this host's plugins declared and the page may show. */\n  contributions: readonly InstalledHomeContribution[];\n}\n\nexport interface HomeActivityModel {\n  summary: string;\n  activity: HomeActivityItem[];\n  /** Rows older than today are hidden behind \"Show earlier\". */\n  earlier: boolean;\n  waiting: HomeWaitingItem[];\n  coverage: string;\n}\n\ninterface Dated<T> {\n  item: T;\n  updatedAt: number;\n}\n\nfunction startOfDay(now: number): number {\n  const day = new Date(now);\n  day.setHours(0, 0, 0, 0);\n  return day.getTime();\n}\n\nconst FORMATS = {\n  clock: { hour: '2-digit', minute: '2-digit', hourCycle: 'h23' },\n  weekday: { weekday: 'short' },\n  date: { day: 'numeric', month: 'short' },\n} as const satisfies Record<string, Intl.DateTimeFormatOptions>;\nconst formatters = new Map<string, Intl.DateTimeFormat>();\n\n/** English keeps the browser's own region; a chosen language formats in that language. */\nfunction format(kind: keyof typeof FORMATS, at: number): string {\n  const locale = currentLocale();\n  const key = `${locale}:${kind}`;\n  let formatter = formatters.get(key);\n  if (formatter === undefined) {\n    formatter = new Intl.DateTimeFormat(locale === DEFAULT_LOCALE ? undefined : locale, FORMATS[kind]);\n    formatters.set(key, formatter);\n  }\n  return formatter.format(at);\n}\n\n/** \"09:58\" today, \"Wed 14:30\" this week, \"3 Nov\" before that. */\nexport function homeTime(at: number, now: number): string {\n  const today = startOfDay(now);\n  if (at >= today) return format('clock', at);\n  if (at >= today - 6 * 86_400_000) return `${format('weekday', at)} ${format('clock', at)}`;\n  return format('date', at);\n}\n\nfunction things(count: number): string {\n  return count === 1\n    ? t('webDashboard.home.oneThing', 'one thing')\n    : t('webDashboard.home.things', '{count} things', { count });\n}\n\nfunction sentence(text: string): string {\n  return text.charAt(0).toUpperCase() + text.slice(1);\n}\n\nfunction list(labels: readonly string[]): string {\n  return labels.length < 2\n    ? (labels[0] ?? '')\n    : t('webDashboard.home.listAnd', '{items} and {last}', {\n        items: labels.slice(0, -1).join(', '),\n        last: labels.at(-1) ?? '',\n      });\n}\n\nfunction actorOf({ entry, avatarUrl }: HomeSessionInput): HomeActor | undefined {\n  const profile = entry.summary.profile;\n  if (profile === undefined) return undefined;\n  return { name: profile.displayName ?? profile.name, ...(avatarUrl === undefined ? {} : { image: avatarUrl }) };\n}\n\n/** The rail's own status copy and facts, so Home and the sidebar never disagree about a session. */\nfunction sessionTone({ summary, attach }: RailSessionInput): DotTone {\n  if (attach === 'refused' || summary.dormant === true) return 'neutral';\n  if (summary.awaitingInput || (summary.pendingApprovalCount ?? 0) > 0) return 'magenta';\n  if (summary.phase !== 'idle' || summary.backgroundWorkActive === true) return 'green';\n  if (summary.activity?.attention === true) return 'yellow';\n  return summary.everPrompted || summary.lastSettledAt !== undefined ? 'green' : 'neutral';\n}\n\nfunction contributionFor(\n  contributions: readonly InstalledHomeContribution[],\n  item: Pick<HomeItem, 'source' | 'workspaceId'>,\n): InstalledHomeContribution | undefined {\n  return contributions.find(\n    (entry) =>\n      entry.data.source === item.source &&\n      (entry.mount.scope === 'host' || entry.mount.workspaceId === item.workspaceId),\n  );\n}\n\nfunction coverageLine(host: HomeHostRead, several: boolean, place: string): string | undefined {\n  const contributions = host.contributions;\n  const labels = [...new Set(contributions.map((entry) => entry.data.label))];\n  if (labels.length === 0) return undefined;\n  const prefix = several ? t('webDashboard.home.coverage.hostPrefix', '{host}: ', { host: host.label }) : '';\n  if (host.error !== undefined)\n    return `${prefix}${t('webDashboard.home.coverage.unreadable', '{sources} could not be read. Sessions are still shown.', { sources: list(labels) })}`;\n  if (host.snapshot === undefined)\n    return host.loading\n      ? `${prefix}${t('webDashboard.home.coverage.checking', 'Checking {sources}.', { sources: list(labels) })}`\n      : undefined;\n  const sources = new Map<string, boolean>();\n  for (const status of host.snapshot.sources) {\n    const label = contributionFor(contributions, status)?.data.label;\n    if (label !== undefined) sources.set(label, (sources.get(label) ?? true) && status.coverage === 'ready');\n  }\n  if (sources.size === 0)\n    return `${prefix}${t('webDashboard.home.coverage.nothingYet', 'Nothing from {sources} yet.', { sources: list(labels) })}`;\n  const unread = [...sources].filter(([, ready]) => !ready).map(([label]) => label);\n  const at = format('clock', Date.parse(host.snapshot.observedAt));\n  const vars = { read: sources.size - unread.length, total: sources.size, place, at };\n  const checked = several\n    ? t('webDashboard.home.coverage.checked', 'Checked {read} of {total} sources at {at}.', vars)\n    : t('webDashboard.home.coverage.checkedPlace', 'Checked {read} of {total} sources {place} at {at}.', vars);\n  return `${prefix}${checked}${\n    unread.length > 0\n      ? ` ${t('webDashboard.home.coverage.unreadSources', '{sources} could not be read.', { sources: list(unread) })}`\n      : ''\n  }`;\n}\n\n/**\n * Home's timeline, asks, summary and coverage from typed facts only: rail session summaries and\n * each host's Home read. Every row is the latest state of one session, task or run.\n */\nexport function homeActivity({\n  now,\n  sessions,\n  hosts,\n  showEarlier,\n  place = t('webDashboard.home.onThisHost', 'on this host'),\n}: {\n  now: number;\n  sessions: readonly HomeSessionInput[];\n  hosts: readonly HomeHostRead[];\n  showEarlier: boolean;\n  /** Where one host's sources live, as the reader sees it: the phone says \"on this computer\". */\n  place?: string;\n}): HomeActivityModel {\n  const today = startOfDay(now);\n  // A row with `keep` stays in Today however old it is.\n  const rows: (Dated<HomeActivityItem> & { keep?: true })[] = [];\n  // Questions (rank 0) first, then failed setups.\n  const asks: (Dated<HomeWaitingItem> & { rank: number })[] = [];\n  let finished = 0;\n  let running = 0;\n  let approvals = 0;\n  const several = hosts.length > 1;\n  const hostTag = (label: string | undefined) => (several && label !== undefined ? { host: label } : {});\n\n  for (const session of sessions) {\n    const { id, entry } = session;\n    const { summary } = entry;\n    const updatedAt = Date.parse(summary.updatedAt) || 0;\n    const actor = actorOf(session);\n    const computer = hostTag(hosts.find((host) => host.hostId === splitHostId(id)?.hostId)?.label);\n    const name = summary.name || t('webDashboard.home.untitled', 'Untitled');\n    const live = entry.attach !== 'refused' && summary.dormant !== true;\n    const settledAt = summary.lastSettledAt === undefined ? Number.NaN : Date.parse(summary.lastSettledAt);\n    const idle = summary.phase === 'idle' && summary.backgroundWorkActive !== true;\n    // A settled session reached its latest state when it settled; `updatedAt` also moves on a resent summary.\n    const at = idle && Number.isFinite(settledAt) ? settledAt : updatedAt;\n    // Approvals are answered in their own card; Home counts them and keeps their session in sight.\n    const pending = summary.pendingApprovalCount ?? 0;\n    approvals += pending;\n    rows.push({\n      updatedAt: at,\n      ...(pending > 0 ? { keep: true as const } : {}),\n      item: {\n        id: `session:${id}`,\n        at: homeTime(at, now),\n        name,\n        outcome: sentence(railSessionStatus(entry, now).status),\n        tone: sessionTone(entry),\n        ...(actor === undefined ? {} : { actor }),\n        ...(summary.git === undefined ? {} : { branch: summary.git.branch }),\n        ...computer,\n        target: { sessionId: id },\n      },\n    });\n    if (live && !idle) running += 1;\n    if (live && idle && settledAt >= today) finished += 1;\n    if (!live) continue;\n    if (summary.awaitingInput)\n      asks.push({\n        rank: 0,\n        updatedAt,\n        item: {\n          id: `0:${id}`,\n          name,\n          detail: t('webDashboard.home.waitingForInput', 'Waiting for your input'),\n          ...(actor === undefined ? {} : { actor }),\n          ...computer,\n          target: { sessionId: id },\n        },\n      });\n    for (const setup of summary.pendingSetups ?? []) {\n      if (setup.status !== 'failed' && setup.status !== 'interrupted') continue;\n      asks.push({\n        rank: 1,\n        updatedAt: Date.parse(setup.createdAt) || 0,\n        item: {\n          id: `setup:${id}:${setup.id}`,\n          name: setup.name,\n          detail: t('webDashboard.home.setupStatus', 'Session setup {status}', { status: setup.status }),\n          failed: setup.status === 'failed',\n          ...computer,\n          target: { sessionId: id },\n        },\n      });\n    }\n  }\n\n  for (const host of hosts) {\n    const snapshot = host.snapshot;\n    if (snapshot === undefined) continue;\n    for (const item of [...snapshot.items, ...(snapshot.recent ?? [])]) {\n      const contribution = contributionFor(host.contributions, item);\n      if (contribution === undefined) continue;\n      const updatedAt = Date.parse(item.updatedAt) || 0;\n      const attention = ATTENTION_KINDS.includes(item.kind);\n      const target: HomeTarget = {\n        sessionId: item.sessionId,\n        ...(contribution.data.destination === undefined ? {} : { destination: contribution.data.destination }),\n      };\n      const id = JSON.stringify([host.hostId ?? '', item.source, item.workspaceId ?? '', item.id]);\n      rows.push({\n        updatedAt,\n        item: {\n          id,\n          at: homeTime(updatedAt, now),\n          name: item.title,\n          // A running item's detail is its current tool, which goes stale between Home reads.\n          outcome:\n            attention && item.detail\n              ? t('webDashboard.home.outcomeDetail', '{outcome}: {detail}', {\n                  outcome: kindOutcome(item.kind),\n                  detail: item.detail,\n                })\n              : kindOutcome(item.kind),\n          tone: KIND_TONE[item.kind],\n          ...(contribution.icon === undefined ? {} : { icon: contribution.icon }),\n          source: contribution.data.label,\n          ...hostTag(host.label),\n          target,\n        },\n      });\n      if (item.kind === 'running') running += 1;\n      if (item.kind === 'completed' && updatedAt >= today) finished += 1;\n      // Only a question is the person's to answer; a failed, blocked or paused item is Po's work and stays in Today.\n      if (item.kind === 'decision')\n        asks.push({\n          rank: 0,\n          updatedAt,\n          item: {\n            id,\n            name: item.title,\n            detail: [contribution.data.label, item.detail ?? kindOutcome(item.kind)].join(' · '),\n            ...hostTag(host.label),\n            target,\n          },\n        });\n    }\n  }\n\n  rows.sort((a, b) => b.updatedAt - a.updatedAt || a.item.id.localeCompare(b.item.id));\n  asks.sort((a, b) => a.rank - b.rank || b.updatedAt - a.updatedAt || a.item.id.localeCompare(b.item.id));\n  const todays = rows.filter((row) => row.updatedAt >= today || row.keep === true);\n  const shown = showEarlier ? rows.slice(0, Math.max(EARLIER_LIMIT, todays.length)) : todays;\n\n  const waiting = asks.length + approvals;\n  const summary =\n    rows.length === 0\n      ? t('webDashboard.home.summary.empty', 'Start a session and Po will keep track of it here.')\n      : `${\n          finished > 0\n            ? t('webDashboard.home.summary.finished', 'Po finished {things} today.', { things: things(finished) })\n            : running > 0\n              ? t('webDashboard.home.summary.running', 'Po is working on {things}.', { things: things(running) })\n              : t('webDashboard.home.summary.inHand', 'Po has things in hand.')\n        } ${\n          waiting === 0\n            ? t('webDashboard.home.summary.nothingWaiting', 'Nothing needs you right now.')\n            : t('webDashboard.home.summary.waiting', '{things} would like your eye, whenever you are ready.', {\n                things: sentence(things(waiting)),\n              })\n        }`;\n  const lines = hosts.flatMap((host) => {\n    const line = coverageLine(host, several, place);\n    return line === undefined ? [] : [line];\n  });\n\n  return {\n    summary,\n    activity: shown.map((row) => row.item),\n    earlier: !showEarlier && rows.length > todays.length,\n    waiting: asks.map(({ item, updatedAt }) => ({\n      ...item,\n      ...(updatedAt > 0 ? { waited: formatRunDuration(Math.max(0, now - updatedAt)) } : {}),\n    })),\n    coverage: [t('webDashboard.home.coverage.latestState', 'Each item shows its latest state.'), ...lines].join(' '),\n  };\n}\n\n/** One page of `rows`. Rows come and go live, so a page past the end shows the last one. */\nexport function pageOf<T>(\n  rows: readonly T[],\n  requestedPage: number,\n  size: number,\n): { page: number; pages: number; first: number; shown: T[] } {\n  const pages = Math.max(1, Math.ceil(rows.length / size));\n  const page = Math.min(requestedPage, pages - 1);\n  const first = page * size;\n  return { page, pages, first, shown: rows.slice(first, first + size) };\n}\n"],"mappings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