Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions apps/mobile/src/features/threads/BoardTaskRequestCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import {
boardTaskAnswerError,
boardTaskRequestLabel,
} from "@t3tools/client-runtime/board-task-request";
import {
isAtomCommandInterrupted,
squashAtomCommandFailure,
} from "@t3tools/client-runtime/state/runtime";
import type {
BoardTaskAnswerInput,
EnvironmentId,
OrchestrationV2ProjectedTurnItem,
} from "@t3tools/contracts";
import { useAtomValue } from "@effect/atom-react";
import { T, useGT, useMessages } from "gt-react-native";
import { useRef, useState } from "react";
import { View } from "react-native";

import { AppText as Text } from "../../components/ui/AppText";
import { Button } from "../../components/ui/Button";
import { serverEnvironment } from "../../state/server";
import { useAtomCommand } from "../../state/use-atom-command";

export function BoardTaskRequestCard(props: {
readonly environmentId: EnvironmentId;
readonly projectedItem: OrchestrationV2ProjectedTurnItem;
}) {
const gt = useGT();
const m = useMessages();
const {
environmentId,
projectedItem: { item, visibility },
} = props;
const answer = useAtomCommand(serverEnvironment.answerBoardTask, {
label: "answer board task request",
reportFailure: false,
});
const canAnswer = useAtomValue(serverEnvironment.answerBoardTask.permissionAtom(environmentId));
const [submitting, setSubmitting] = useState(false);
const [error, setError] = useState<string | null>(null);
const inFlight = useRef(false);
if (item.type !== "board_task_request") return null;
const { draft, resolution } = item;
const pending = resolution.status === "pending" && visibility === "local";

const submit = async (decision: BoardTaskAnswerInput["answer"]) => {
if (inFlight.current) return;
inFlight.current = true;
setSubmitting(true);
setError(null);
const result = await answer({
environmentId,
input: { threadId: item.threadId, turnItemId: item.id, answer: decision },
}).finally(() => {
inFlight.current = false;
setSubmitting(false);
});
if (result._tag === "Success" || isAtomCommandInterrupted(result)) return;
setError(boardTaskAnswerError(squashAtomCommandFailure(result), m));
};

return (
<View className="mb-3 gap-3 rounded-[20px] border border-border bg-card-alt p-4">
<Text className="font-t3-bold text-base text-foreground">
{pending ? <T>File a board task?</T> : boardTaskRequestLabel(item, m)}
</Text>
<View className="gap-1">
<Text className="font-sans text-xs text-foreground-muted">
<T>Board</T>
</Text>
<Text className="font-sans text-sm text-foreground">{draft.board}</Text>
<Text className="font-sans text-xs text-foreground-muted">
<T>Title</T>
</Text>
<Text className="font-sans text-sm text-foreground">{draft.title}</Text>
</View>
<Text className="font-sans text-sm text-foreground">{draft.body}</Text>
{draft.context === undefined ? null : (
<View className="gap-1 border-l-2 border-border pl-3">
<Text className="font-sans text-xs text-foreground-muted">
<T>Quoted context</T>
</Text>
<Text className="font-sans text-sm text-foreground">{draft.context}</Text>
</View>
)}
{resolution.status === "failed" ? (
<Text className="font-sans text-sm text-danger-foreground">{resolution.message}</Text>
) : null}
{pending && error !== null ? (
<Text accessibilityRole="alert" className="font-sans text-sm text-danger-foreground">
{error}
</Text>
) : null}
{pending ? (
<>
<Button
label={gt("File")}
tone="primary"
fullWidth
disabled={submitting || !canAnswer}
onPress={() => void submit("file")}
/>
<Button
label={gt("Decline")}
tone="text"
fullWidth
disabled={submitting || !canAnswer}
onPress={() => void submit("decline")}
/>
</>
) : null}
</View>
);
}
11 changes: 11 additions & 0 deletions apps/mobile/src/features/threads/ThreadFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
import { GuestBubbleTint, GuestMessageName } from "./guestMessageStyle";
import { ThreadGuestPendingMessage, useThreadGuestShare } from "./ThreadGuestShareBar";
import { LinkRequestCard } from "./LinkRequestCard";
import { BoardTaskRequestCard } from "./BoardTaskRequestCard";
import { FeedbackRequestCard } from "./FeedbackRequestCard";
import { SecretRequestCard } from "./SecretRequestCard";
import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
Expand Down Expand Up @@ -246,6 +247,7 @@ import {
isContextCompactionActivityGroup,
isContextHandoffActivityGroup,
isLinkRequestActivityGroup,
isBoardTaskRequestActivityGroup,
isFeedbackRequestActivityGroup,
isSecretRequestActivityGroup,
type ThreadFeedEntry,
Expand Down Expand Up @@ -2210,6 +2212,15 @@ function renderFeedEntry(
);
}

if (entry.type === "activity-group" && isBoardTaskRequestActivityGroup(entry)) {
return (
<BoardTaskRequestCard
environmentId={props.environmentId}
projectedItem={entry.activities[0]!.projectedItem}
/>
);
}

if (entry.type === "activity-group" && isFeedbackRequestActivityGroup(entry)) {
return (
<FeedbackRequestCard
Expand Down
12 changes: 11 additions & 1 deletion apps/mobile/src/i18n/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -5636,5 +5636,15 @@
"afeb354df4c94446": "Öffne sie auf dem Board in der Web- oder Desktop-App",
"a65acdb87eac322b": "{count, plural, one {{count} archiviertes, von einem Board gestartetes Gespräch bleibt erhalten und wird nicht gelöscht.} other {{count} archivierte, von einem Board gestartete Gespräche bleiben erhalten und werden nicht gelöscht.}}",
"99d51127f573296b": "Weiteres Konto",
"8ec2c57414669b79": "Verbinde einen zweiten {tracker}-Workspace oder -Nutzer."
"8ec2c57414669b79": "Verbinde einen zweiten {tracker}-Workspace oder -Nutzer.",
"d781e5be7bfe4865": "Aufgabe Nr. {number} in {board} angelegt",
"4d34bc6da64e12ad": "Anlegen abgelehnt",
"1ab001a1a9f0bec3": "Anlegen abgebrochen",
"b693c9af54182348": "Anlegen fehlgeschlagen",
"e96b2911a5d12031": "Anlegen",
"63505f517af0f8f2": "Ablehnen",
"6f6fe733fa539b4a": "Aufgabe im Board anlegen?",
"f1f55521bea76543": "Board",
"3ac8ed47fe50bd34": "Titel",
"01a264c40736f6b5": "Zitierter Kontext"
}
12 changes: 11 additions & 1 deletion apps/mobile/src/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5638,5 +5638,15 @@
"afeb354df4c94446": "Open it on the board in the web or desktop app",
"a65acdb87eac322b": "{count, plural, one {{count} archived conversation started by a board is kept, not deleted.} other {{count} archived conversations started by a board are kept, not deleted.}}",
"99d51127f573296b": "Another account",
"8ec2c57414669b79": "Connect a second {tracker} workspace or user."
"8ec2c57414669b79": "Connect a second {tracker} workspace or user.",
"d781e5be7bfe4865": "Filed #{number} on {board}",
"4d34bc6da64e12ad": "Filing declined",
"1ab001a1a9f0bec3": "Filing cancelled",
"b693c9af54182348": "Filing failed",
"e96b2911a5d12031": "File",
"63505f517af0f8f2": "Decline",
"6f6fe733fa539b4a": "File a board task?",
"f1f55521bea76543": "Board",
"3ac8ed47fe50bd34": "Title",
"01a264c40736f6b5": "Quoted context"
}
12 changes: 11 additions & 1 deletion apps/mobile/src/i18n/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -5630,5 +5630,15 @@
"afeb354df4c94446": "Ábrela en el tablero desde la app web o de escritorio",
"a65acdb87eac322b": "{count, plural, one {{count} conversación archivada iniciada por un tablero se conserva, no se elimina.} other {{count} conversaciones archivadas iniciadas por un tablero se conservan, no se eliminan.}}",
"99d51127f573296b": "Otra cuenta",
"8ec2c57414669b79": "Conecta un segundo espacio de trabajo o usuario de {tracker}."
"8ec2c57414669b79": "Conecta un segundo espacio de trabajo o usuario de {tracker}.",
"d781e5be7bfe4865": "Tarea n.º {number} registrada en {board}",
"4d34bc6da64e12ad": "Registro rechazado",
"1ab001a1a9f0bec3": "Registro cancelado",
"b693c9af54182348": "No se pudo registrar la tarea",
"e96b2911a5d12031": "Registrar",
"63505f517af0f8f2": "Rechazar",
"6f6fe733fa539b4a": "¿Registrar una tarea en el tablero?",
"f1f55521bea76543": "Tablero",
"3ac8ed47fe50bd34": "Título",
"01a264c40736f6b5": "Contexto citado"
}
12 changes: 11 additions & 1 deletion apps/mobile/src/i18n/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -5630,5 +5630,15 @@
"afeb354df4c94446": "Ouvrez-la dans le tableau depuis l'application web ou de bureau",
"a65acdb87eac322b": "{count, plural, one {{count} conversation archivée lancée par un tableau est conservée, pas supprimée.} other {{count} conversations archivées lancées par un tableau sont conservées, pas supprimées.}}",
"99d51127f573296b": "Autre compte",
"8ec2c57414669b79": "Connectez un second espace de travail ou utilisateur {tracker}."
"8ec2c57414669b79": "Connectez un second espace de travail ou utilisateur {tracker}.",
"d781e5be7bfe4865": "Tâche nº {number} créée sur {board}",
"4d34bc6da64e12ad": "Création refusée",
"1ab001a1a9f0bec3": "Création annulée",
"b693c9af54182348": "Échec de la création",
"e96b2911a5d12031": "Créer",
"63505f517af0f8f2": "Refuser",
"6f6fe733fa539b4a": "Créer une tâche sur le tableau ?",
"f1f55521bea76543": "Tableau",
"3ac8ed47fe50bd34": "Titre",
"01a264c40736f6b5": "Contexte cité"
}
12 changes: 11 additions & 1 deletion apps/mobile/src/i18n/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -5610,5 +5610,15 @@
"afeb354df4c94446": "Web またはデスクトップアプリのボードで開いてください",
"a65acdb87eac322b": "{count, plural, other {ボードが開始したアーカイブ済みの会話 {count} 件は保持され、削除されません。}}",
"99d51127f573296b": "別のアカウント",
"8ec2c57414669b79": "2つ目の {tracker} ワークスペースまたはユーザーを接続します。"
"8ec2c57414669b79": "2つ目の {tracker} ワークスペースまたはユーザーを接続します。",
"d781e5be7bfe4865": "{board} にタスク #{number} を登録しました",
"4d34bc6da64e12ad": "登録が却下されました",
"1ab001a1a9f0bec3": "登録がキャンセルされました",
"b693c9af54182348": "登録に失敗しました",
"e96b2911a5d12031": "登録",
"63505f517af0f8f2": "却下",
"6f6fe733fa539b4a": "ボードにタスクを登録しますか?",
"f1f55521bea76543": "ボード",
"3ac8ed47fe50bd34": "タイトル",
"01a264c40736f6b5": "引用された背景情報"
}
12 changes: 11 additions & 1 deletion apps/mobile/src/i18n/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -5616,5 +5616,15 @@
"afeb354df4c94446": "웹 또는 데스크톱 앱의 보드에서 여세요",
"a65acdb87eac322b": "{count, plural, other {보드가 시작한 보관된 대화 {count}개는 삭제되지 않고 유지됩니다.}}",
"99d51127f573296b": "다른 계정",
"8ec2c57414669b79": "두 번째 {tracker} 워크스페이스 또는 사용자를 연결합니다."
"8ec2c57414669b79": "두 번째 {tracker} 워크스페이스 또는 사용자를 연결합니다.",
"d781e5be7bfe4865": "{board}에 작업 #{number} 등록됨",
"4d34bc6da64e12ad": "등록 거절됨",
"1ab001a1a9f0bec3": "등록 취소됨",
"b693c9af54182348": "등록 실패",
"e96b2911a5d12031": "등록",
"63505f517af0f8f2": "거절",
"6f6fe733fa539b4a": "보드에 작업을 등록할까요?",
"f1f55521bea76543": "보드",
"3ac8ed47fe50bd34": "제목",
"01a264c40736f6b5": "인용된 맥락"
}
12 changes: 11 additions & 1 deletion apps/mobile/src/i18n/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -5630,5 +5630,15 @@
"afeb354df4c94446": "Abra-a no quadro pelo app web ou desktop",
"a65acdb87eac322b": "{count, plural, one {{count} conversa arquivada iniciada por um quadro é mantida, não excluída.} other {{count} conversas arquivadas iniciadas por um quadro são mantidas, não excluídas.}}",
"99d51127f573296b": "Outra conta",
"8ec2c57414669b79": "Conecte um segundo espaço de trabalho ou usuário do {tracker}."
"8ec2c57414669b79": "Conecte um segundo espaço de trabalho ou usuário do {tracker}.",
"d781e5be7bfe4865": "Tarefa nº {number} registrada em {board}",
"4d34bc6da64e12ad": "Registro recusado",
"1ab001a1a9f0bec3": "Registro cancelado",
"b693c9af54182348": "Falha ao registrar a tarefa",
"e96b2911a5d12031": "Registrar",
"63505f517af0f8f2": "Recusar",
"6f6fe733fa539b4a": "Registrar uma tarefa no quadro?",
"f1f55521bea76543": "Quadro",
"3ac8ed47fe50bd34": "Título",
"01a264c40736f6b5": "Contexto citado"
}
12 changes: 11 additions & 1 deletion apps/mobile/src/i18n/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -5710,5 +5710,15 @@
"afeb354df4c94446": "Откройте её на доске в веб- или настольном приложении",
"a65acdb87eac322b": "{count, plural, one {{count} архивированный разговор, начатый доской, сохранится и не будет удалён.} few {{count} архивированных разговора, начатых доской, сохранятся и не будут удалены.} many {{count} архивированных разговоров, начатых доской, сохранятся и не будут удалены.} other {{count} архивированного разговора, начатых доской, сохранятся и не будут удалены.}}",
"99d51127f573296b": "Другой аккаунт",
"8ec2c57414669b79": "Подключите второе рабочее пространство или пользователя {tracker}."
"8ec2c57414669b79": "Подключите второе рабочее пространство или пользователя {tracker}.",
"d781e5be7bfe4865": "Задача № {number} создана на доске {board}",
"4d34bc6da64e12ad": "Создание отклонено",
"1ab001a1a9f0bec3": "Создание отменено",
"b693c9af54182348": "Не удалось создать задачу",
"e96b2911a5d12031": "Создать",
"63505f517af0f8f2": "Отклонить",
"6f6fe733fa539b4a": "Создать задачу на доске?",
"f1f55521bea76543": "Доска",
"3ac8ed47fe50bd34": "Заголовок",
"01a264c40736f6b5": "Цитата из обсуждения"
}
12 changes: 11 additions & 1 deletion apps/mobile/src/i18n/translations/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -5636,5 +5636,15 @@
"afeb354df4c94446": "Öppna den på tavlan i webb- eller skrivbordsappen",
"a65acdb87eac322b": "{count, plural, one {{count} arkiverad konversation som startats av en tavla behålls, den tas inte bort.} other {{count} arkiverade konversationer som startats av en tavla behålls, de tas inte bort.}}",
"99d51127f573296b": "Ett konto till",
"8ec2c57414669b79": "Anslut en andra {tracker}-arbetsyta eller användare."
"8ec2c57414669b79": "Anslut en andra {tracker}-arbetsyta eller användare.",
"d781e5be7bfe4865": "Uppgift #{number} skapad på {board}",
"4d34bc6da64e12ad": "Nekad",
"1ab001a1a9f0bec3": "Avbruten",
"b693c9af54182348": "Det gick inte att skapa uppgiften",
"e96b2911a5d12031": "Skapa",
"63505f517af0f8f2": "Neka",
"6f6fe733fa539b4a": "Skapa en uppgift på tavlan?",
"f1f55521bea76543": "Tavla",
"3ac8ed47fe50bd34": "Titel",
"01a264c40736f6b5": "Citerad kontext"
}
12 changes: 11 additions & 1 deletion apps/mobile/src/i18n/translations/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -5620,5 +5620,15 @@
"afeb354df4c94446": "请在网页版或桌面应用的看板中打开",
"a65acdb87eac322b": "{count, plural, other {由看板发起的 {count} 个已归档对话会保留,不会删除。}}",
"99d51127f573296b": "其他账号",
"8ec2c57414669b79": "连接第二个 {tracker} 工作区或用户。"
"8ec2c57414669b79": "连接第二个 {tracker} 工作区或用户。",
"d781e5be7bfe4865": "已在 {board} 创建任务 #{number}",
"4d34bc6da64e12ad": "已拒绝创建",
"1ab001a1a9f0bec3": "已取消创建",
"b693c9af54182348": "创建任务失败",
"e96b2911a5d12031": "创建",
"63505f517af0f8f2": "拒绝",
"6f6fe733fa539b4a": "要在看板上创建任务吗?",
"f1f55521bea76543": "看板",
"3ac8ed47fe50bd34": "标题",
"01a264c40736f6b5": "引用的上下文"
}
13 changes: 13 additions & 0 deletions apps/mobile/src/lib/threadActivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,13 @@ export function isSecretRequestActivityGroup(entry: ThreadFeedActivityGroup): bo
);
}

export function isBoardTaskRequestActivityGroup(entry: ThreadFeedActivityGroup): boolean {
return (
entry.activities.length === 1 &&
entry.activities[0]?.projectedItem.item.type === "board_task_request"
);
}

export function isFeedbackRequestActivityGroup(entry: ThreadFeedActivityGroup): boolean {
return (
entry.activities.length === 1 &&
Expand Down Expand Up @@ -511,6 +518,7 @@ function itemIsProminent(item: OrchestrationV2TurnItem): boolean {
item.type === "proposed_plan" ||
item.type === "secret_request" ||
item.type === "feedback_request" ||
item.type === "board_task_request" ||
item.type === "link_request"
);
}
Expand Down Expand Up @@ -634,6 +642,7 @@ function itemIcon(item: OrchestrationV2TurnItem): ThreadFeedActivity["icon"] {
case "secret_request":
return "lock";
case "feedback_request":
case "board_task_request":
return "message";
case "link_request":
return "globe";
Expand Down Expand Up @@ -709,6 +718,8 @@ function itemSummary(
return resolve(msg("Thread created"));
case "secret_request":
return item.label;
case "board_task_request":
return item.draft.title;
case "feedback_request":
return resolve(msg("Feedback for the T3 team"));
case "link_request":
Expand Down Expand Up @@ -783,6 +794,8 @@ function itemPreview(item: OrchestrationV2TurnItem, resolve: MessageResolver): s
return item.reason || null;
case "feedback_request":
return item.preview.subject;
case "board_task_request":
return item.draft.board;
case "subagent":
return item.result ?? item.progress ?? item.prompt;
case "dynamic_tool":
Expand Down
11 changes: 7 additions & 4 deletions apps/server/src/auth/RpcAuthorization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ describe("RPC authorization scopes", () => {
}
});

it("lets only a session that operates threads approve sending a feedback report", () => {
it("lets only a session that operates threads approve feedback or board filings", () => {
// Guest links have no RPC session, and read-only sessions lack this scope.
expect(requiredScopeForRpcMethod(WS_METHODS.agentFeedbackAnswerRequest)).toBe(
AuthOrchestrationOperateScope,
);
for (const method of [
WS_METHODS.agentFeedbackAnswerRequest,
WS_METHODS.deliveryAnswerBoardTask,
]) {
expect(requiredScopeForRpcMethod(method)).toBe(AuthOrchestrationOperateScope);
}
});

it("keeps triage, which seeds an agent that reads logs and the database, behind operate scope", () => {
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/auth/RpcAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export const RPC_REQUIRED_SCOPES = {
[WS_METHODS.workflowsGetDefinition]: AuthFilesystemReadScope,
[WS_METHODS.secretsAnswerRequest]: AuthOrchestrationOperateScope,
[WS_METHODS.agentFeedbackAnswerRequest]: AuthOrchestrationOperateScope,
[WS_METHODS.deliveryAnswerBoardTask]: AuthOrchestrationOperateScope,
// Delivery logs hold request bodies, so they need the same scope as the URL.
[WS_METHODS.scheduledTasksListWebhookDeliveries]: AuthOrchestrationOperateScope,
[WS_METHODS.scheduledTasksGetWebhookDelivery]: AuthOrchestrationOperateScope,
Expand Down
Loading
Loading