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

Function resolvePolicyFromRuleSet

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

Source from the content-addressed store, hash-verified

3428 .pipe(Effect.map((rows) => ({ kind: "global" as const, rows })));
3429
3430 const resolvePolicyFromRuleSet = (
3431 toolId: string,
3432 ruleSet: ActivePolicyRuleSet,
3433 defaultRequiresApproval?: boolean,
3434 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
3435 ruleSet.kind === "prepared"
3436 ? Effect.succeed(ruleSet.resolve({ toolId, defaultRequiresApproval }))
3437 : ruleSet.kind === "provider"
3438 ? ruleSet.provider.resolve
3439 ? ruleSet.provider.resolve({ toolId, defaultRequiresApproval })
3440 : Effect.succeed(resolveProviderPolicyFromRules(toolId, ruleSet.rules ?? []))
3441 : Effect.succeed(
3442 resolveEffectivePolicy(
3443 toolId,
3444 ruleSet.rows,
3445 ownerRankForRow,
3446 defaultRequiresApproval,
3447 ),
3448 );
3449
3450 // ------------------------------------------------------------------
3451 // 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