MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / comparePolicyRow

Function comparePolicyRow

packages/core/sdk/src/policies.ts:130–141  ·  view source on GitHub ↗
(
  a: Pick<ToolPolicyRow, "position" | "id">,
  b: Pick<ToolPolicyRow, "position" | "id">,
)

Source from the content-addressed store, hash-verified

128// ---------------------------------------------------------------------------
129
130export const comparePolicyRow = (
131 a: Pick<ToolPolicyRow, "position" | "id">,
132 b: Pick<ToolPolicyRow, "position" | "id">,
133): number => {
134 const pa = a.position;
135 const pb = b.position;
136 if (pa < pb) return -1;
137 if (pa > pb) return 1;
138 const ia = a.id;
139 const ib = b.id;
140 return ia < ib ? -1 : ia > ib ? 1 : 0;
141};
142
143// Specificity score for ordering. Higher = more specific = should sit at a
144// lower position-key (higher precedence). New rules are auto-placed below

Callers 2

policiesListFunction · 0.90
resolveToolPolicyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected