mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-12-03 18:43:38 +01:00
Manifest-backed MCP tools, prompts, and resources with surface affordance contracts; agent capability manifest and governance projection; API contract tests and capability route projection; operations-loop and intelligence-funnel telemetry; release-control subsystem documentation, registry, and tooling; licensing and configuration.
32 lines
788 B
Go
32 lines
788 B
Go
package chat
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
// truncateForLog truncates a string for logging, adding "..." if truncated.
|
|
func truncateForLog(s string, maxLen int) string {
|
|
if len(s) <= maxLen {
|
|
return s
|
|
}
|
|
return s[:maxLen] + "..."
|
|
}
|
|
|
|
// toolCallKey returns a string key for a tool call (name + serialized input)
|
|
// used to detect repeated identical calls in the agentic loop.
|
|
func toolCallKey(name string, input map[string]interface{}) string {
|
|
inputBytes, err := json.Marshal(input)
|
|
if err != nil {
|
|
return name
|
|
}
|
|
return name + ":" + string(inputBytes)
|
|
}
|
|
|
|
// getCommandFromInput extracts the command from tool input for logging.
|
|
func getCommandFromInput(input map[string]interface{}) string {
|
|
if cmd, ok := input["command"].(string); ok {
|
|
return cmd
|
|
}
|
|
return "<unknown>"
|
|
}
|