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

Function resolvePolicyFromRuleSet

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

Source from the content-addressed store, hash-verified

3534 .pipe(Effect.map((rows) => ({ kind: "global" as const, rows })));
3535
3536 const resolvePolicyFromRuleSet = (
3537 toolId: string,
3538 ruleSet: ActivePolicyRuleSet,
3539 defaultRequiresApproval?: boolean,
3540 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
3541 ruleSet.kind === "prepared"
3542 ? Effect.succeed(ruleSet.resolve({ toolId, defaultRequiresApproval }))
3543 : ruleSet.kind === "provider"
3544 ? ruleSet.provider.resolve
3545 ? ruleSet.provider.resolve({ toolId, defaultRequiresApproval })
3546 : Effect.succeed(resolveProviderPolicyFromRules(toolId, ruleSet.rules ?? []))
3547 : Effect.succeed(
3548 resolveEffectivePolicy(
3549 toolId,
3550 ruleSet.rows,
3551 ownerRankForRow,
3552 defaultRequiresApproval,
3553 ),
3554 );
3555
3556 // ------------------------------------------------------------------
3557 // 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