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

Function resolvePolicyFromRuleSet

packages/core/sdk/src/executor.ts:4892–4910  ·  view source on GitHub ↗
(
      toolId: string,
      ruleSet: ActivePolicyRuleSet,
      defaultRequiresApproval?: boolean,
    )

Source from the content-addressed store, hash-verified

4890 .pipe(Effect.map((rows) => ({ kind: "global" as const, rows })));
4891
4892 const resolvePolicyFromRuleSet = (
4893 toolId: string,
4894 ruleSet: ActivePolicyRuleSet,
4895 defaultRequiresApproval?: boolean,
4896 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
4897 ruleSet.kind === "prepared"
4898 ? Effect.succeed(ruleSet.resolve({ toolId, defaultRequiresApproval }))
4899 : ruleSet.kind === "provider"
4900 ? ruleSet.provider.resolve
4901 ? ruleSet.provider.resolve({ toolId, defaultRequiresApproval })
4902 : Effect.succeed(resolveProviderPolicyFromRules(toolId, ruleSet.rules ?? []))
4903 : Effect.succeed(
4904 resolveEffectivePolicy(
4905 toolId,
4906 ruleSet.rows,
4907 ownerRankForRow,
4908 defaultRequiresApproval,
4909 ),
4910 );
4911
4912 // ------------------------------------------------------------------
4913 // Tools (read surface)

Callers 3

toolsListFunction · 0.85
toolSchemaFunction · 0.85
executeFunction · 0.85

Calls 3

resolveEffectivePolicyFunction · 0.90
resolveMethod · 0.80

Tested by

no test coverage detected