Open-source, local-first AI agent team for your desktop: multi-agent group chats, computer use, browser, MCP, routines and approvals. macOS, Windows, Linux + Android. Built on pi.
TypeScript agentai-agentai-agentsai-assistantandroidautomationchatgptcoding-agentcomputer-usedesktop-appelectronllmlocal-firstmcpmulti-agentollamaopenaiprivacyself-hostedtypescript
fix(git-install): a failed install offers Try again and keeps the card title
leen.zhou1d56ceabf9b7
diff --git a/apps/desktop/src/renderer/features/audit/Row.tsx b/apps/desktop/src/renderer/features/audit/Row.tsxindex 8129f44..6907435 100644--- a/apps/desktop/src/renderer/features/audit/Row.tsx+++ b/apps/desktop/src/renderer/features/audit/Row.tsx@@ -1,4 +1,10 @@-import { auditGroup, auditResult, auditSummary, isSystemAudit } from "@pibot/client-core";+import {+ auditGroup,+ auditResult,+ auditSummary,+ isSystemAudit,+ isUserAudit,+} from "@pibot/client-core";import type { AuditEntry, Bot } from "@pibot/protocol";import { BotAvatar, useSettings } from "@pibot/renderer-kit";import { Icon, IconTile } from "@pibot/ui";@@ -25,7 +31,12 @@ export function AuditRow({const group = auditGroup(entry);const result = auditResult(entry, t);const system = isSystemAudit(entry);- const name = system ? t("audit.actor.system") : (bot?.name ?? t("audit.actor.deletedBot"));+ const user = isUserAudit(entry);+ const name = system+ ? t("audit.actor.system")+ : user+ ? t("audit.actor.user")+ : (bot?.name ?? t("audit.actor.deletedBot"));const what = auditSummary(entry, t, { source, botName: name });const mark = activityMark(group);const kind = t(group === "identity" ? "audit.kind.oauth.changed" : `activity.kind.${group}`);@@ -46,7 +57,7 @@ export function AuditRow({hour12: false,})}</time>- <BotAvatar bot={system ? undefined : bot} label={name} size={22} state="idle" />+ <BotAvatar bot={system || user ? undefined : bot} label={name} size={22} state="idle" /><span className={styles.botName} title={name}>{name}</span>diff --git a/apps/desktop/src/renderer/features/chat/composer/next-reply.module.css b/apps/desktop/src/renderer/features/chat/composer/next-reply.module.cssindex 1a28344..ee6dce5 100644--- a/apps/desktop/src/renderer/features/chat/composer/next-reply.module.css+++ b/apps/desktop/src/renderer/features/chat/composer/next-reply.module.css@@ -55,8 +55,14 @@font: inherit;font-size: 11px;}-/* The suggestion is labelled by a small chip in the conversation's colour. */+/* The suggestion is labelled by a small chip in the conversation's colour. In a narrow+ composer the chip shortens first, so the Tab key never runs under the send options. */.label {+ flex: 0 1 auto;+ min-width: 0;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;align-self: center;padding: 1px 8px;border-radius: var(--radius-pill);diff --git a/apps/desktop/src/renderer/features/sidebar/sidebar.module.css b/apps/desktop/src/renderer/features/sidebar/sidebar.module.cssindex c1d5dd7..32fbbea 100644--- a/apps/desktop/src/renderer/features/sidebar/sidebar.module.css+++ b/apps/desktop/src/renderer/features/sidebar/sidebar.module.css@@ -555,6 +555,10 @@line-height: 1.25;}.connectTitle {+ max-width: 100%;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;font-size: 13px;font-weight: 600;}diff --git a/apps/mobile/src/features/records/present.ts b/apps/mobile/src/features/records/present.tsindex 1282021..175146e 100644--- a/apps/mobile/src/features/records/present.ts+++ b/apps/mobile/src/features/records/present.ts@@ -5,6 +5,7 @@ import {auditResult,auditSummary,isSystemAudit,+ isUserAudit,routineRunName,routineRunStatus,safeAuditText,@@ -73,13 +74,18 @@ export function presentRecord(row: RecordRow, c: PresentContext): RecordView {switch (row.type) {case "audit": {const system = isSystemAudit(row.entry);- const who = system ? c.shared("audit.actor.system") : (name ?? c.shared("audit.actor.bot"));+ const user = isUserAudit(row.entry);+ const who = system+ ? c.shared("audit.actor.system")+ : user+ ? c.shared("audit.actor.user")+ : (name ?? c.shared("audit.actor.bot"));const group = auditGroup(row.entry);const result = auditResult(row.entry, c.shared);view = {what: auditSummary(row.entry, c.shared, { botName: who }),who,- look: system ? undefined : look,+ look: system || user ? undefined : look,badge: c.shared(group === "identity" ? "audit.kind.oauth.changed" : `activity.kind.${group}`,),diff --git a/packages/client-core/src/audit/facts.ts b/packages/client-core/src/audit/facts.tsindex 7910471..7d97bce 100644--- a/packages/client-core/src/audit/facts.ts+++ b/packages/client-core/src/audit/facts.ts@@ -28,6 +28,12 @@ function leaf(value: string | undefined) {.at(-1),);}+const gitInstallReasons = ["denied", "no_elevation", "failed", "timeout", "cancelled"] as const;+/** The Git install's failure reason in the reader's language; undefined for an unknown code. */+export function gitInstallReason(detail: Pick<AuditDetail, "reasonCode">, t: AuditT) {+ const code = gitInstallReasons.find((reason) => reason === detail.reasonCode);+ return code ? t(`changes.git.reason.${code}`) : undefined;+}export function auditTool(detail: AuditDetail): string | undefined {return detail.toolName ?? detail.category;}@@ -60,6 +66,7 @@ export function auditTarget(detail: AuditDetail): string {return leaf(detail.target ?? detail.path);}const operationKeys: Record<string, TranslationKey> = {+ git_install: "audit.git.operation",tool_discover: "tool.tool_discover",connector_discover: "tool.connector_discover",image_generation: "media.audit.operation",@@ -372,7 +379,8 @@ export function auditFactRows(entry: AuditEntry, t: AuditT, fallbackName?: strin// The same went for every non-refusal event, so only refusals keep the "rule" row;// others show a known code as a plain note, and an unknown one says nothing at all.if ((detail.reason || detail.reasonCode) && entry.kind !== "skill.changed") {- if (isRoutineAuditKind(entry.kind)) add("activity.rule", routineAuditReason(entry, t));+ if (entry.kind === "git.install") add("audit.detail.note", gitInstallReason(detail, t));+ else if (isRoutineAuditKind(entry.kind)) add("activity.rule", routineAuditReason(entry, t));else if (isRefusalKind(entry.kind)) add("activity.rule", auditReason(detail, t, entry.kind));else {const code = detail.reasonCode ?? detail.reason ?? "";diff --git a/packages/client-core/src/audit/presentation.ts b/packages/client-core/src/audit/presentation.tsindex dc722b4..2ba82e0 100644--- a/packages/client-core/src/audit/presentation.ts+++ b/packages/client-core/src/audit/presentation.ts@@ -15,6 +15,7 @@ import {auditOperation,auditProvider,auditReason,+ gitInstallReason,isKnownImageReason,safeAuditText,} from "./facts.ts";@@ -225,6 +226,21 @@ export function isSystemAudit(entry: AuditEntry): boolean {entry.kind === "runtime.drain_failed" && entry.detail.reasonCode === "interactive_drain_failed");}+/**+ * Rows a person did themselves are filed under main (the audit table needs a Bot) but belong to+ * the user: today the Git install, which only a click on its card starts.+ */+export function isUserAudit(entry: Pick<AuditEntry, "kind" | "detail">): boolean {+ return entry.kind === "git.install" && entry.detail.actor === "user";+}+function gitInstallSummary(entry: AuditEntry, t: T): string {+ const code = entry.detail.reasonCode;+ if (code === "started")+ return t("audit.git.started", { command: safeAuditText(entry.detail.command) || "-" });+ if (code === "installed") return t("audit.git.installed");+ const reason = gitInstallReason(entry.detail, t);+ return reason ? t("audit.git.failed", { reason }) : t("audit.git.failedGeneric");+}/** Connector rows written before `internal` was set are recognized by their fixed summary. */function connectorEvent(entry: Pick<AuditEntry, "kind" | "summary">) {return entry.kind === "connector.changed" || entry.kind === "plugin.changed"@@ -316,6 +332,8 @@ export function auditSummary(const workflow = groupWorkflowSummary(entry, t);if (workflow) return workflow;if (entry.kind === "feedback.opened") return t("appMenu.feedbackOpened");+ // The stored summary carries both languages for exports; the page shows the reader's own.+ if (entry.kind === "git.install") return gitInstallSummary(entry, t);if (entry.kind === "external_agent.prewarmed") return t("audit.externalAgent.prewarmed");if (isRoutineAuditKind(entry.kind)) return routineAuditSummary(entry, t);const detail = { ...context.source?.detail, ...entry.detail };diff --git a/packages/i18n/src/sections/activity.ts b/packages/i18n/src/sections/activity.tsindex 0503fcd..695e84c 100644--- a/packages/i18n/src/sections/activity.ts+++ b/packages/i18n/src/sections/activity.ts@@ -184,6 +184,11 @@ export const activityZh = {"audit.detail.role": "任务角色","audit.detail.exit": "退出码","audit.detail.note": "说明",+ "audit.git.operation": "安装 Git",+ "audit.git.started": "开始安装 Git:{command}",+ "audit.git.installed": "Git 已安装",+ "audit.git.failed": "Git 没装上:{reason}",+ "audit.git.failedGeneric": "Git 没装上","audit.role.coordinator": "统筹","audit.role.assignee": "任务执行者","audit.reason.outside": "工作位置以外",@@ -504,6 +509,11 @@ export const activityEn = {"audit.detail.role": "Task role","audit.detail.exit": "Exit code","audit.detail.note": "Note",+ "audit.git.operation": "Install Git",+ "audit.git.started": "Started installing Git: {command}",+ "audit.git.installed": "Git installed",+ "audit.git.failed": "Git wasn't installed: {reason}",+ "audit.git.failedGeneric": "Git wasn't installed","audit.role.coordinator": "Coordinator","audit.role.assignee": "Assignee","audit.reason.outside": "outside the working folders",diff --git a/packages/workspaces-contract/src/i18n/changes.ts b/packages/workspaces-contract/src/i18n/changes.tsindex 7c5f18d..6dea24e 100644--- a/packages/workspaces-contract/src/i18n/changes.ts+++ b/packages/workspaces-contract/src/i18n/changes.ts@@ -111,9 +111,18 @@ export const changesZh = {"changes.git.installedNoVersion": "Git 已安装 · 之后的步骤可以同时做","changes.git.installedPlain": "Git 已安装({version})","changes.git.installedPlainNoVersion": "Git 已安装",- "changes.git.failed": "没装上:可以在终端里运行 {command},装好后点「再检查」",- "changes.git.failedGeneric": "没装上:可以用系统包管理器安装 Git,装好后点「再检查」",+ "changes.git.failed": "可以点「重新安装」再试,或在终端里运行 {command},装好后点「再检查」。",+ "changes.git.failedGeneric":+ "可以点「重新安装」再试,或用系统包管理器安装 Git,装好后点「再检查」。",+ "changes.git.notInstalled": "没装上。",+ "changes.git.notInstalledReason": "没装上:{reason}。",+ "changes.git.reason.denied": "密码窗口被关掉,或没有得到授权",+ "changes.git.reason.no_elevation": "这台电脑上没有请求管理员密码的工具(pkexec)",+ "changes.git.reason.failed": "安装程序出错退出",+ "changes.git.reason.timeout": "等了一段时间仍没找到 Git",+ "changes.git.reason.cancelled": "安装被中止","changes.git.recheck": "再检查",+ "changes.git.retry": "重新安装","changes.git.error": "没能开始安装,请再试一次。","changes.repo.readonly": "只读","changes.repo.running": "{name}正在运行",@@ -161,6 +170,7 @@ export const changesZh = {"changes.file.binary": "二进制","changes.list.label": "改动的文件","changes.list.files": "{count} 个文件",+ "changes.list.files.one": "{count} 个文件","changes.list.matched": "匹配 {count} 个","changes.list.filter": "筛选文件","changes.list.filterPlaceholder": "筛选文件,如 pricing 或 .css",@@ -343,6 +353,7 @@ export const changesZh = {"changes.repo.aheadBehind": "比远端多 {ahead} 个提交、少 {behind} 个","changes.repo.upstreamTitle": "按这台电脑上次从远端取回的记录计算,没有联网检查","changes.history.files": "{count} 个文件",+ "changes.history.files.one": "{count} 个文件","tool.review_finding": "记下审查发现","changes.sendBlocked": "现在发不了消息,请先处理聊天里的审批或等一下再试。","changes.commit.message": "提交说明",@@ -517,10 +528,20 @@ export const changesEn: { [K in keyof typeof changesZh]: string } = {"changes.git.installedNoVersion": "Git is installed · later steps can run at the same time","changes.git.installedPlain": "Git is installed ({version})","changes.git.installedPlainNoVersion": "Git is installed",- "changes.git.failed": "Not installed: run {command} in a terminal, then click Check again",+ "changes.git.failed":+ "Click Try again, or run {command} in a terminal and then click Check again.","changes.git.failedGeneric":- "Not installed: install Git with the system package manager, then click Check again",+ "Click Try again, or install Git with the system package manager and then click Check again.",+ "changes.git.notInstalled": "Not installed. ",+ "changes.git.notInstalledReason": "Not installed: {reason}. ",+ "changes.git.reason.denied": "the password prompt was closed or not authorized",+ "changes.git.reason.no_elevation":+ "this computer has no tool to ask for the administrator password (pkexec)",+ "changes.git.reason.failed": "the installer exited with an error",+ "changes.git.reason.timeout": "Git still wasn't found after waiting",+ "changes.git.reason.cancelled": "the install was stopped","changes.git.recheck": "Check again",+ "changes.git.retry": "Try again","changes.git.error": "Couldn't start the install. Try again.","changes.repo.readonly": "Read-only","changes.repo.running": "{name} is running",@@ -576,6 +597,7 @@ export const changesEn: { [K in keyof typeof changesZh]: string } = {"changes.file.binary": "Binary","changes.list.label": "Changed files","changes.list.files": "{count} files",+ "changes.list.files.one": "{count} file","changes.list.matched": "{count} match","changes.list.filter": "Filter files","changes.list.filterPlaceholder": "Filter files, e.g. pricing or .css",@@ -772,6 +794,7 @@ export const changesEn: { [K in keyof typeof changesZh]: string } = {"changes.repo.upstreamTitle":"Based on what this computer last fetched from the remote; nothing was checked online","changes.history.files": "{count} files",+ "changes.history.files.one": "{count} file","tool.review_finding": "Record review finding","changes.sendBlocked":"Can't send a message right now. Handle the approval in the chat first, or try again shortly.",diff --git a/packages/workspaces/src/ui/changes/ChangesPill.tsx b/packages/workspaces/src/ui/changes/ChangesPill.tsxindex 842b8f2..34ff3a1 100644--- a/packages/workspaces/src/ui/changes/ChangesPill.tsx+++ b/packages/workspaces/src/ui/changes/ChangesPill.tsx@@ -1,6 +1,6 @@import { useT } from "@pibot/renderer-kit";import styles from "./changes.module.css";-import { formatCount } from "./diff/FileList.tsx";+import { formatCount, pluralCount } from "./diff/FileList.tsx";import { ChangesIcon } from "./icons.tsx";import type { SourceState } from "./store.ts";@@ -39,7 +39,7 @@ export function ChangesPill({{!!totals.removed && <span className={styles.minus}>−{formatCount(totals.removed)}</span>}</>) : (- <span>{t("changes.list.files", { count: formatCount(status.total) })}</span>+ <span>{t("changes.list.files", { count: pluralCount(status.total) })}</span>)}</button>);diff --git a/packages/workspaces/src/ui/changes/ListPanel.tsx b/packages/workspaces/src/ui/changes/ListPanel.tsxindex 292cde0..930c266 100644--- a/packages/workspaces/src/ui/changes/ListPanel.tsx+++ b/packages/workspaces/src/ui/changes/ListPanel.tsx@@ -1,7 +1,7 @@import { useT } from "@pibot/renderer-kit";import { useMemo } from "react";import styles from "./changes.module.css";-import { FileList, type FileListActions, formatCount } from "./diff/FileList.tsx";+import { FileList, type FileListActions, formatCount, pluralCount } from "./diff/FileList.tsx";import { type FileRow, rowOffsets } from "./diff/file-rows.ts";import { ChangesIcon } from "./icons.tsx";import { type FileTag, type ListFile, sumLines, TAG_LABEL } from "./model.ts";@@ -51,7 +51,7 @@ export function ListPanel({return (<><div className={styles.summary}>- <b>{t("changes.list.files", { count: formatCount(files.length) })}</b>+ <b>{t("changes.list.files", { count: pluralCount(files.length) })}</b>{!!summary.added && <span className={styles.plus}>+{formatCount(summary.added)}</span>}{!!summary.removed && <span className={styles.minus}>−{formatCount(summary.removed)}</span>}<span className={styles.dist}>diff --git a/packages/workspaces/src/ui/changes/diff/FileList.tsx b/packages/workspaces/src/ui/changes/diff/FileList.tsxindex 40b5eb1..b77d211 100644--- a/packages/workspaces/src/ui/changes/diff/FileList.tsx+++ b/packages/workspaces/src/ui/changes/diff/FileList.tsx@@ -9,6 +9,9 @@ import { type FileRow, firstRowAt, ROW_HEIGHT } from "./file-rows.ts";const OVERSCAN = 360;const number = new Intl.NumberFormat("en-US");export const formatCount = (value: number) => number.format(value);+/** A count for a plural string: plural forms are picked from numbers, and below 1000 the+ * formatted text is the same digits anyway. */+export const pluralCount = (value: number) => (value < 1000 ? value : formatCount(value));export function Tag({ file }: { file: Pick<ListFile, "tag"> }) {const t = useT();diff --git a/packages/workspaces/src/ui/changes/history/History.tsx b/packages/workspaces/src/ui/changes/history/History.tsxindex eb905af..90e382e 100644--- a/packages/workspaces/src/ui/changes/history/History.tsx+++ b/packages/workspaces/src/ui/changes/history/History.tsx@@ -3,7 +3,7 @@ import { useSettings } from "@pibot/renderer-kit";import type { ChangeCommit } from "@pibot/workspaces-contract/full";import { useCallback, useEffect, useRef, useState } from "react";import styles from "../changes.module.css";-import { formatCount } from "../diff/FileList.tsx";+import { pluralCount } from "../diff/FileList.tsx";import { ChangesIcon } from "../icons.tsx";import type { ChangesTarget } from "../store.ts";@@ -76,7 +76,7 @@ export function History({<span className={styles.mono}>{shortOid(commit.oid)}</span> · {commit.author} ·{" "}{commitTime(commit.time, language)}{typeof commit.files === "number" &&- ` · ${t("changes.history.files", { count: formatCount(commit.files) })}`}+ ` · ${t("changes.history.files", { count: pluralCount(commit.files) })}`}</span></span><ChangesIcon name="right" />diff --git a/packages/workspaces/src/ui/git/GitInstallCard.tsx b/packages/workspaces/src/ui/git/GitInstallCard.tsxindex 7f12b16..d2bd737 100644--- a/packages/workspaces/src/ui/git/GitInstallCard.tsx+++ b/packages/workspaces/src/ui/git/GitInstallCard.tsx@@ -148,10 +148,21 @@ export function GitInstallCard({</p>);if (status.state === "failed")+ // The title stays so the failure still says what it is about; another click on 重新安装+ // starts a fresh attempt (the brain still runs one installer at a time).return (- <p className={styles.state} data-tone="danger" role="alert">- <span className={styles.dot} aria-hidden="true" />- <span>+ <section className={styles.failed} role="alert" aria-label={t("changes.git.title")}>+ <header className={styles.failedTitle}>+ <span className={`${styles.dot} ${styles.dotDanger}`} aria-hidden="true" />+ <strong>{t("changes.git.title")}</strong>+ </header>+ <p className={styles.failedBody}>+ {status.reason+ ? t("changes.git.notInstalledReason", {+ reason: t(`changes.git.reason.${status.reason}`),+ })+ : t("changes.git.notInstalled")}+ {/* English sentences carry their own trailing space; Chinese ones join directly. */}{status.manualCommand ? (<WithCommandtext={t("changes.git.failed", { command: MARK })}@@ -160,16 +171,31 @@ export function GitInstallCard({) : (t("changes.git.failedGeneric"))}- </span>- <Button- variant="secondary"- className={styles.recheck}- loading={busy}- onClick={() => void act("changes.gitStatus")}- >- {t("changes.git.recheck")}- </Button>- </p>+ </p>+ {error && (+ <p role="alert" className={approvalStyles.risk}>+ {t("changes.git.error")}+ </p>+ )}+ <div className={styles.failedActions}>+ <Button+ variant="secondary"+ className={styles.recheck}+ disabled={busy}+ onClick={() => void act("changes.gitStatus")}+ >+ {t("changes.git.recheck")}+ </Button>+ <Button+ className={styles.recheck}+ loading={busy}+ disabled={!peer}+ onClick={() => void act("changes.gitInstall")}+ >+ {t("changes.git.retry")}+ </Button>+ </div>+ </section>);if (dismissed) return null;const what =diff --git a/packages/workspaces/src/ui/git/git-install.module.css b/packages/workspaces/src/ui/git/git-install.module.cssindex 54f8267..30107dd 100644--- a/packages/workspaces/src/ui/git/git-install.module.css+++ b/packages/workspaces/src/ui/git/git-install.module.css@@ -38,9 +38,6 @@.state[data-tone="ok"] .dot {background: var(--ok);}-.state[data-tone="danger"] .dot {- background: var(--danger);-}.hint {color: var(--text2);}@@ -48,3 +45,39 @@min-height: 26px;padding: 2px 12px;}+/* A failed attempt keeps the card's title and both ways forward; a block, not a pill, so the+ dot stays with the title at narrow widths. */+.failed {+ display: flex;+ flex-direction: column;+ gap: 8px;+ max-width: 640px;+ box-sizing: border-box;+ margin: 8px 0;+ padding: 10px 14px 12px;+ border-radius: var(--radius-card);+ background: var(--card);+ color: var(--text);+ box-shadow: 0 0 0 1px var(--b1);+ font-size: 13px;+ overflow-wrap: anywhere;+}+.failedTitle {+ display: flex;+ align-items: center;+ gap: 8px;+ min-width: 0;+}+.dotDanger {+ background: var(--danger);+}+.failedBody {+ margin: 0;+ color: var(--text2);+ line-height: 1.5;+}+.failedActions {+ display: flex;+ flex-wrap: wrap;+ gap: 8px;+}