diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index 36b2546..ae02ea4 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -300,7 +300,7 @@ func run(ctx context.Context, cfg agentConfig, state state) error { var isErr bool if cfg.Exec != nil { streamCtx := tools.WithOutputStream(ctx, func(data string) { - emit(cfg, Event{Role: "exec", Name: tc.Name, Content: data}) + emit(cfg, Event{Role: "tool", Name: tc.Name, Content: data}) }) out, blocks, err := cfg.Exec(streamCtx, tc.Name, tc.Arguments) if err != nil { @@ -346,11 +346,11 @@ func run(ctx context.Context, cfg agentConfig, state state) error { result += fmt.Sprintf("\n\n[HARD LIMIT: %s output truncated — %d of %d bytes shown. This is a safety ceiling, not a semantic boundary.]", tc.Name, cfg.ToolResultMaxBytes, orig) } - if readSafe && !isErr { - resultCache.Store(tc.Name+"\x00"+string(tc.Arguments), result) - } - emit(cfg, Event{Role: "tool", Name: tc.Name, Content: result}) - tier := TierHot + if readSafe && !isErr { + resultCache.Store(tc.Name+"\x00"+string(tc.Arguments), result) + } + emit(cfg, Event{Role: "tool", Name: tc.Name, Content: result}) + tier := TierHot if !isErr && cfg.ClassifyTier != nil { tier = cfg.ClassifyTier(tc.Name, tc.Arguments) }