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

Function capScopes

packages/core/sdk/src/oauth-service.ts:793–804  ·  view source on GitHub ↗
(scopes: readonly string[])

Source from the content-addressed store, hash-verified

791 // absurd list is truncated.
792 const MAX_DISCOVERED_SCOPE_CHARS = 8192;
793 const capScopes = (scopes: readonly string[]): readonly string[] => {
794 const unique = dedupeScopes(scopes);
795 let length = 0;
796 let count = 0;
797 for (const scope of unique) {
798 const next = length + scope.length + (count > 0 ? 1 : 0);
799 if (next > MAX_DISCOVERED_SCOPE_CHARS) break;
800 length = next;
801 count += 1;
802 }
803 return unique.slice(0, count);
804 };
805
806 // Bound a whole discovery sequence (PRM + up to MAX_DISCOVERY_AUTH_SERVERS AS
807 // fetches, each with its own request timeout). 30s is larger than a single

Callers 1

Calls 1

dedupeScopesFunction · 0.85

Tested by

no test coverage detected