Merge upstream/main into codex/btw-side-question

同步官方 main 的任务会话与 spawn_task 更新,保留 /btw 旁路上下文能力。
This commit is contained in:
ji ruo committed 2026-09-11 08:47:57 +08:00
commit 272004c2e4
10 files changed
+410 -64

No files matched your search

+12 -2
View File
@@ -678,6 +678,16 @@ export const api = {
}));
},
// Main-agent conversation segments of a task. Each segment is a resettable session
// (clean transcript/context) over the same task; `current` is the writable one.
mainSessions: (task: string) =>
get<{ sessions: { seq: number; created_at: string }[]; current: number }>(
`/exploration/main-sessions${tq(task)}`,
).then((r) => ({ sessions: arr(r.sessions), current: r.current ?? 0 })),
// Start a fresh main-agent session segment (does not touch the task's graph/assets/goal).
newMainSession: (task: string) =>
post<{ seq: number; created_at: string; current: number }>(`/exploration/main-session/new${tq(task)}`),
// ---- traffic / audit / report / chat ----
audit: (task?: string) => get<Audit>(`/audit${tq(task)}`),
traffic: (page = 0, size = 100, host = "", method = "", q = "") =>
@@ -711,8 +721,8 @@ export const api = {
if (!r.ok) throw new Error(`report: ${r.status}`);
return r.text();
},
chat: (message: string, task?: string, attachments?: ChatAttachment[]) =>
post<{ reply: string; mode: string }>(`/chat${tq(task)}`, { message, attachments }),
chat: (message: string, task?: string, attachments?: ChatAttachment[], seg?: number) =>
post<{ reply: string; mode: string }>(`/chat${tq(task)}`, { message, attachments, seg }),
chatStatus: (taskId: string) => get<{ running: boolean }>(`/tasks/${taskId}/chat/status`),
// 方式1 文件上传:落到会话/任务工作目录 uploads/,返回可供 agent Read 的相对路径。
chatUpload: async (scope: "task" | "session" | "staging", id: string, files: File[]) => {
+2
View File
@@ -627,6 +627,7 @@ export interface Activity {
};
source_task_id?: string;
inherited?: boolean;
main_seg?: number; // main-agent conversation segment (present only on worker="mainagent" rows)
// token usage (present only on kind='result')
input_tokens?: number;
output_tokens?: number;
@@ -829,6 +830,7 @@ export interface Session {
intent_id?: string;
source_task_id?: string;
inherited?: boolean;
seg?: number; // main-agent session: which conversation segment (0 = original)
}
// ---- Security ----