MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / CheckPermissionChain

Method CheckPermissionChain

agent/loop.go:1395–1428  ·  view source on GitHub ↗
(tc coretools.ToolCall, tool coretools.Tool, state *AgentState)

Source from the content-addressed store, hash-verified

1393 continue
1394 }
1395 e.cacheEditState.Pinned = append(e.cacheEditState.Pinned, edit)
1396 existing[edit.ToolUseID] = struct{}{}
1397 }
1398 e.cacheEditState.ConsumedInFlight = nil
1399}
1400
1401func (e *CoreExecutionEngine) restoreInFlightCacheEdits() {
1402 if len(e.cacheEditState.ConsumedInFlight) == 0 {
1403 return
1404 }
1405 restored := make([]api.CacheEdit, 0, len(e.cacheEditState.ConsumedInFlight)+len(e.cacheEditState.Pending))
1406 restored = append(restored, e.cacheEditState.ConsumedInFlight...)
1407 restored = append(restored, e.cacheEditState.Pending...)
1408 e.cacheEditState.Pending = restored
1409 e.cacheEditState.ConsumedInFlight = nil
1410}
1411
1412func filterVisibleCacheEdits(edits []api.CacheEdit, visibleToolResultIDs map[string]struct{}) []api.CacheEdit {
1413 if len(edits) == 0 {
1414 return nil
1415 }
1416 out := make([]api.CacheEdit, 0, len(edits))
1417 for _, edit := range edits {
1418 if _, ok := visibleToolResultIDs[edit.ToolUseID]; ok {
1419 out = append(out, edit)
1420 }
1421 }
1422 return out
1423}
1424
1425func (e *CoreExecutionEngine) maybeCompressContext(ctx context.Context, state *AgentState) {
1426 if state == nil || len(state.Messages) == 0 {
1427 return
1428 }
1429 contextLimit := e.Config.CompressionContextLimit()
1430 threshold := e.Config.CompressionThreshold()
1431 compressionCheckMessages := state.Messages

Calls 8

IsToolConfirmedMethod · 0.80
IsPathConfirmedMethod · 0.80
stringFromAnyFunction · 0.70
DecodeInputMethod · 0.65
IsReadOnlyMethod · 0.65
ConfirmsFilePathsMethod · 0.65
NeedsPermissionMethod · 0.65