Approval mode of automations in the list; Telegram switch per chat
- Automations: the approval mode is a selection in the list; PATCH /jobs/{id}
writes permission_mode into the job file's frontmatter (rest of the file
unchanged, invalid modes rejected). "Allow everything" lets nightly runs work
without waiting for approvals via Telegram until the timeout.
- Session.telegram_quiet: approvals and questions of a chat (and its subagents)
are not sent to Telegram; the chat open in Telegram always reports. Toggle in
the chat's ⋯ menu when a bot is paired. New chats from the web UI and
automation runs start quiet; chats started from Telegram and existing chats
keep reporting.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9339e2db41
commit
bd490efda5
13 files changed
+148
-2
No files matched your search
@@ -3,7 +3,7 @@ import { Icon } from "./Icon";
|
||||
import { FileChip, FileFigure, fileType, imageSize, imageSrc } from "./FileFigure";
|
||||
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
||||
import { del, get, patch, post } from "../api";
|
||||
import { useModels } from "../hooks";
|
||||
import { useFetch, useModels } from "../hooks";
|
||||
import { fmtCompact, fmtCost, fmtNumber, fmtPercent, useT, type Key } from "../i18n";
|
||||
import { navigate } from "../router";
|
||||
import { dismissError, loadSession, loadSessions, useStore } from "../store";
|
||||
@@ -152,6 +152,8 @@ export function ChatView({ sessionId, onMenu, onClosePane }: { sessionId: string
|
||||
const isAdmin = useStore((s) => s.me?.role === "admin");
|
||||
const tabs = useChatTabs(sessionId, session?.cwd ?? "");
|
||||
const [sharing, setSharing] = useState(false);
|
||||
// The Telegram switch in the ⋯ menu only matters with a paired bot.
|
||||
const telegramPaired = useFetch<{ paired: boolean }>("/account/telegram").data?.paired ?? false;
|
||||
const [editingInstructions, setEditingInstructions] = useState(false);
|
||||
const models = useModels();
|
||||
const [loadError, setLoadError] = useState<string>();
|
||||
@@ -352,6 +354,20 @@ export function ChatView({ sessionId, onMenu, onClosePane }: { sessionId: string
|
||||
>
|
||||
<Icon name="edit" /> {t("instructions.title")}
|
||||
</a>
|
||||
{telegramPaired && !session.parent_id && (
|
||||
<a
|
||||
href="#"
|
||||
role="menuitemcheckbox"
|
||||
aria-checked={!session.telegram_quiet}
|
||||
title={t("chat.telegramHint")}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
void update({ telegram_quiet: !session.telegram_quiet });
|
||||
}}
|
||||
>
|
||||
<Icon name={session.telegram_quiet ? "box-off" : "box-on"} /> {t("chat.telegram")}
|
||||
</a>
|
||||
)}
|
||||
<a href={`/api/sessions/${sessionId}/export?format=md`} download>
|
||||
<Icon name="download" /> {t("chat.exportMd")}
|
||||
</a>
|
||||
|
||||
@@ -107,7 +107,22 @@ export function Jobs({ onMenu }: { onMenu: () => void }) {
|
||||
</span>
|
||||
<span>{t("jobs.mode")}</span>
|
||||
<span>
|
||||
{j.spec?.agent} · {j.spec?.model || t("agents.sessionModel")} · {j.spec?.permission_mode} · max {j.spec?.timeout_minutes} min
|
||||
{j.spec?.agent} · {j.spec?.model || t("agents.sessionModel")} · max {j.spec?.timeout_minutes} min
|
||||
</span>
|
||||
<span>{t("jobs.permissionMode")}</span>
|
||||
<span>
|
||||
<select
|
||||
value={j.spec?.permission_mode ?? "auto"}
|
||||
disabled={busy === j.id}
|
||||
title={t("jobs.permissionModeHint")}
|
||||
aria-label={t("jobs.permissionMode")}
|
||||
onChange={(e) => act(j.id, () => patch(`/jobs/${j.id}`, { permission_mode: e.target.value }))}
|
||||
>
|
||||
<option value="default">{t("permissionMode.default")}</option>
|
||||
<option value="auto">{t("permissionMode.auto")}</option>
|
||||
<option value="accept_edits">{t("permissionMode.accept_edits")}</option>
|
||||
<option value="bypass">{t("permissionMode.bypass")}</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user