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

Function resolvePolicyFromRuleSet

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

Source from the content-addressed store, hash-verified

3098 .pipe(Effect.map((rows) => ({ kind: "global" as const, rows })));
3099
3100 const resolvePolicyFromRuleSet = (
3101 toolId: string,
3102 ruleSet: ActivePolicyRuleSet,
3103 defaultRequiresApproval?: boolean,
3104 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
3105 ruleSet.kind === "prepared"
3106 ? Effect.succeed(ruleSet.resolve({ toolId, defaultRequiresApproval }))
3107 : ruleSet.kind === "provider"
3108 ? ruleSet.provider.resolve
3109 ? ruleSet.provider.resolve({ toolId, defaultRequiresApproval })
3110 : Effect.succeed(resolveProviderPolicyFromRules(toolId, ruleSet.rules ?? []))
3111 : Effect.succeed(
3112 resolveEffectivePolicy(
3113 toolId,
3114 ruleSet.rows,
3115 ownerRankForRow,
3116 defaultRequiresApproval,
3117 ),
3118 );
3119
3120 // ------------------------------------------------------------------
3121 // 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