MCPcopy Create free account
hub / github.com/ByteYellow/AgentProvenance / explainIDsFromFile

Function explainIDsFromFile

internal/provenance/explain.go:442–484  ·  view source on GitHub ↗
(diff FileDiffManifest, blame FileBlameManifest, events []telemetry.EventRecord)

Source from the content-addressed store, hash-verified

440}
441
442func explainIDsFromFile(diff FileDiffManifest, blame FileBlameManifest, events []telemetry.EventRecord) map[string]string {
443 ids := map[string]string{}
444 for _, attempt := range diff.Attempts {
445 if attempt.AttemptID != "" {
446 ids["attempt_id"] = attempt.AttemptID
447 }
448 if attempt.ToolCallID != "" {
449 ids["tool_call_id"] = attempt.ToolCallID
450 }
451 if attempt.SnapshotID != "" {
452 ids["snapshot_id"] = attempt.SnapshotID
453 }
454 if attempt.Changed {
455 break
456 }
457 }
458 for _, entry := range blame.Entries {
459 if ids["attempt_id"] == "" && entry.AttemptID != "" {
460 ids["attempt_id"] = entry.AttemptID
461 }
462 if ids["tool_call_id"] == "" && entry.ToolCallID != "" {
463 ids["tool_call_id"] = entry.ToolCallID
464 }
465 }
466 for _, event := range events {
467 if ids["event_id"] == "" && event.ID != "" {
468 ids["event_id"] = event.ID
469 }
470 if ids["tool_call_id"] == "" && event.ToolCallID != "" {
471 ids["tool_call_id"] = event.ToolCallID
472 }
473 if ids["process_id"] == "" && event.ProcessID != "" {
474 ids["process_id"] = event.ProcessID
475 }
476 if ids["session_id"] == "" && event.SessionID != "" {
477 ids["session_id"] = event.SessionID
478 }
479 if ids["snapshot_id"] == "" && event.SnapshotID != "" {
480 ids["snapshot_id"] = event.SnapshotID
481 }
482 }
483 return ids
484}
485
486func explainIDsFromTarget(target ExplainTarget) map[string]string {
487 ids := map[string]string{}

Callers 1

BuildExplainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected