fix: add Message field to session.Entry and check marshal error
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,7 @@ type Entry struct {
|
|||||||
FilePath string `json:"file_path,omitempty"`
|
FilePath string `json:"file_path,omitempty"`
|
||||||
ModelUsed string `json:"model_used,omitempty"`
|
ModelUsed string `json:"model_used,omitempty"`
|
||||||
DurationMs int64 `json:"duration_ms,omitempty"`
|
DurationMs int64 `json:"duration_ms,omitempty"`
|
||||||
|
Message string `json:"message,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt represents one subprocess invocation within a skill call.
|
// Attempt represents one subprocess invocation within a skill call.
|
||||||
|
|||||||
@@ -45,10 +45,14 @@ func (s *Skill) Handle(ctx context.Context, tool string, args json.RawMessage) (
|
|||||||
FilePath: a.FilePath,
|
FilePath: a.FilePath,
|
||||||
ModelUsed: a.ModelUsed,
|
ModelUsed: a.ModelUsed,
|
||||||
DurationMs: a.DurationMs,
|
DurationMs: a.DurationMs,
|
||||||
|
Message: a.Message,
|
||||||
}
|
}
|
||||||
if err := session.Append(s.cfg.SessionsDir, a.SessionID, entry); err != nil {
|
if err := session.Append(s.cfg.SessionsDir, a.SessionID, entry); err != nil {
|
||||||
return nil, fmt.Errorf("append session log: %w", err)
|
return nil, fmt.Errorf("append session log: %w", err)
|
||||||
}
|
}
|
||||||
b, _ := json.Marshal(map[string]string{"status": "ok", "session_id": a.SessionID})
|
b, err := json.Marshal(map[string]string{"status": "ok", "session_id": a.SessionID})
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("marshal response: %w", err)
|
||||||
|
}
|
||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user