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

Function resolvePolicyFromRuleSet

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

Source from the content-addressed store, hash-verified

3015 .pipe(Effect.map((rows) => ({ kind: "global" as const, rows })));
3016
3017 const resolvePolicyFromRuleSet = (
3018 toolId: string,
3019 ruleSet: ActivePolicyRuleSet,
3020 defaultRequiresApproval?: boolean,
3021 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
3022 ruleSet.kind === "prepared"
3023 ? Effect.succeed(ruleSet.resolve({ toolId, defaultRequiresApproval }))
3024 : ruleSet.kind === "provider"
3025 ? ruleSet.provider.resolve
3026 ? ruleSet.provider.resolve({ toolId, defaultRequiresApproval })
3027 : Effect.succeed(resolveProviderPolicyFromRules(toolId, ruleSet.rules ?? []))
3028 : Effect.succeed(
3029 resolveEffectivePolicy(
3030 toolId,
3031 ruleSet.rows,
3032 ownerRankForRow,
3033 defaultRequiresApproval,
3034 ),
3035 );
3036
3037 // ------------------------------------------------------------------
3038 // 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