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

Function resolvePolicyFromRuleSet

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

Source from the content-addressed store, hash-verified

3943 .pipe(Effect.map((rows) => ({ kind: "global" as const, rows })));
3944
3945 const resolvePolicyFromRuleSet = (
3946 toolId: string,
3947 ruleSet: ActivePolicyRuleSet,
3948 defaultRequiresApproval?: boolean,
3949 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
3950 ruleSet.kind === "prepared"
3951 ? Effect.succeed(ruleSet.resolve({ toolId, defaultRequiresApproval }))
3952 : ruleSet.kind === "provider"
3953 ? ruleSet.provider.resolve
3954 ? ruleSet.provider.resolve({ toolId, defaultRequiresApproval })
3955 : Effect.succeed(resolveProviderPolicyFromRules(toolId, ruleSet.rules ?? []))
3956 : Effect.succeed(
3957 resolveEffectivePolicy(
3958 toolId,
3959 ruleSet.rows,
3960 ownerRankForRow,
3961 defaultRequiresApproval,
3962 ),
3963 );
3964
3965 // ------------------------------------------------------------------
3966 // 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