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

Function resolvePolicyFromRuleSet

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

Source from the content-addressed store, hash-verified

2823 .pipe(Effect.map((rows) => ({ kind: "global" as const, rows })));
2824
2825 const resolvePolicyFromRuleSet = (
2826 toolId: string,
2827 ruleSet: ActivePolicyRuleSet,
2828 defaultRequiresApproval?: boolean,
2829 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
2830 ruleSet.kind === "prepared"
2831 ? Effect.succeed(ruleSet.resolve({ toolId, defaultRequiresApproval }))
2832 : ruleSet.kind === "provider"
2833 ? ruleSet.provider.resolve
2834 ? ruleSet.provider.resolve({ toolId, defaultRequiresApproval })
2835 : Effect.succeed(resolveProviderPolicyFromRules(toolId, ruleSet.rules ?? []))
2836 : Effect.succeed(
2837 resolveEffectivePolicy(
2838 toolId,
2839 ruleSet.rows,
2840 ownerRankForRow,
2841 defaultRequiresApproval,
2842 ),
2843 );
2844
2845 // ------------------------------------------------------------------
2846 // 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