feat(trace,loop,orchestration): memory/guardrail/orchestration 真 span + 参数摘要脱敏 + Guardrail 输出侧异步(裁决 11.4.2/11.4.3/13.4.1)
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

- 11.4.2:三类节点首次真进图 —— memory.recall/memory.write(loop/memory.go 召回与写入点)、
  guardrail.input/output(流式主路径两侧 + agent.RunStep 静音路径)、orchestration.spawn
  (scheduler 每次派发/收束);新增 trace.ChildSpan 让不持有 Tracer 的叶子包也能开子 span
- 11.4.3(设计先行,规格先写进 design/19 §1.1):tool 节点参数摘要 —— 放行表 argValueKeys +
  trace.IsSecretKey 统一判据(密钥类键不给值)+ 单值 80 rune / ≤24 条 + 出图前再清洗;
  前端 NodeDetail 新增「参数摘要」区,未放行键显示「值未展示」
- 13.4.1:流式主路径输出侧护栏改后台 goroutine(脱离 context、30s 兜底、不阻塞回合),
  输入侧仍在模型调用前同步拦下;拦截闭环到 guardrail 节点 + 审计事件
- 拆文件:scheduler.go 加 span 后 546 行 → 编排 span 助手拆出 scheduler_spans.go(回到 492)
- 契约:无帧名/事件形状变化;graph_update 节点 props 新增**可选**键(tool args_keys/args_summary、
  guardrail action/allow/elapsed_ms、memory action/scope/hits/…、orchestration subagent/persona),
  文档同步由主会话统一落
This commit is contained in:
AskaEth committed 2026-10-04 12:31:20 +08:00
1 parent 0dfad675b8
commit b99268d019
14 files changed
+1396 -42

No files matched your search

@@ -5,11 +5,11 @@ import { Notice } from "../../components";
import { FLOW_TONE, statusOf } from "./tone";
/** NodeDetail shows one selected node: its status, its lane (when it belongs to
* a sub-agent branch), the whitelisted span props and the span's accumulated
* events (design/19 §2 节点实时日志). The panel is driven by the live graph, so
* a newer `graph_update` frame replaces the props/log arrays in place and the
* list keeps growing while the round runs — no local buffering, no invented
* entries. */
* a sub-agent branch), the tool argument summary (design/19 §1.1), the
* whitelisted span props and the span's accumulated events (design/19 §2
* 节点实时日志). The panel is driven by the live graph, so a newer
* `graph_update` frame replaces the props/log arrays in place and the list keeps
* growing while the round runs — no local buffering, no invented entries. */
export function NodeDetail({
node,
laneLabel,
@@ -46,6 +46,8 @@ export function NodeDetail({
<span className="font-mono">{node.id}</span>
</div>
{argsSection(props)}
{hasProps ? (
<div className="space-y-1">
<h4 className="text-xs font-medium text-[var(--mu-text-lo)]">参数 / 结果</h4>
@@ -62,6 +64,51 @@ export function NodeDetail({
);
}
/** argsSection 渲染 tool 节点的参数摘要(design/19 §1.1,裁决 11.4.3):模型传过的
* 参数名全部列出;放行表内的键显示截断后的值,其余键显式标注为「值未展示」——
* 一个从未离开后端的值,绝不能在界面上看起来像空值。没有 `args_keys` 的节点
* (非工具节点)不渲染任何东西。 */
function argsSection(props: Record<string, unknown>): React.ReactNode {
const keys = toStringList(props.args_keys);
if (keys.length === 0) return null;
const summary = toRecord(props.args_summary);
return (
<div className="space-y-1">
<h4 className="text-xs font-medium text-[var(--mu-text-lo)]">参数摘要</h4>
<div className="space-y-0.5 rounded-[var(--mu-radius-sm)] bg-[var(--mu-surface-2)] px-3 py-2 font-mono text-xs">
{keys.map((key) => {
const value = summary[key];
return (
<div key={key} className="flex flex-wrap items-baseline gap-2">
<span className="text-[var(--mu-text-mid)]">{key}</span>
{typeof value === "string" && value.length > 0 ? (
<span className="min-w-0 break-all text-[var(--mu-text-lo)]">{value}</span>
) : (
<span className="italic text-[var(--mu-text-lo)]">值未展示(未放行或密钥类)</span>
)}
</div>
);
})}
</div>
<p className="text-[11px] text-[var(--mu-text-lo)]">
仅放行键显示截断后的值;密钥类键永不显示值(design/19 §1.1)。
</p>
</div>
);
}
/** toStringList 读取字符串数组属性,忽略任何畸形取值。 */
function toStringList(value: unknown): string[] {
if (!Array.isArray(value)) return [];
return value.filter((item): item is string => typeof item === "string");
}
/** toRecord 读取字符串键的对象属性,忽略任何畸形取值。 */
function toRecord(value: unknown): Record<string, unknown> {
if (value === null || typeof value !== "object" || Array.isArray(value)) return {};
return value as Record<string, unknown>;
}
/** LogList renders the node's accumulated span events, newest last, and is
* explicit about why an empty list is empty instead of pretending to have
* content. */