feat(ai): session harness contract — incomplete, run_id, confirm bind

Add docs/16 for session state machine, incomplete/resume, queue semantics,
and agent-loop/harness/MCP gap review. Wire RunOutcome on max-rounds,
run_id through audit, TrimMessages/Redact hooks, ConfirmBindHash on write
confirm path; session file skeleton without HTTP yet. No push.
This commit is contained in:
logan committed 2026-10-15 13:58:10 +08:00
1 parent 0aeee2b692
commit 5416e86379
17 files changed
+1041 -61

No files matched your search

+5
View File
@@ -207,6 +207,7 @@ export type AiAgentStepView = {
pending?: boolean;
needConfirm?: boolean;
confirmSql?: string;
confirmBind?: string;
result?: AiAgentQueryResultView;
};
@@ -215,6 +216,7 @@ export type AiMessage = {
role: "user" | "assistant" | "system";
content: string;
at: string;
runId?: string;
/** Agent 工具步骤时间线(仅 assistant) */
steps?: AiAgentStepView[];
streaming?: boolean;
@@ -296,6 +298,8 @@ type State = {
detail?: string;
tips?: string[];
mode?: "modal" | "toast";
/** 成功操作默认静默;长任务完成等需要用户注意时显式设为 visible。 */
feedback?: "visible";
durationMs?: number;
raw?: unknown;
}) => void;
@@ -534,6 +538,7 @@ export const useWorkspaceStore = create<State>((set, get) => ({
const parsed = input.raw !== undefined ? formatDbError(input.raw) : null;
const kind = input.kind ?? parsed?.kind ?? "info";
const mode = input.mode ?? (kind === "error" ? "modal" : "toast");
if (kind === "success" && mode === "toast" && input.feedback !== "visible") return;
const payload: NotifyPayload = {
id: notifyId(),
kind,