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

Function resolvePolicyFromRuleSet

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

Source from the content-addressed store, hash-verified

3580 .pipe(Effect.map((rows) => ({ kind: "global" as const, rows })));
3581
3582 const resolvePolicyFromRuleSet = (
3583 toolId: string,
3584 ruleSet: ActivePolicyRuleSet,
3585 defaultRequiresApproval?: boolean,
3586 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
3587 ruleSet.kind === "prepared"
3588 ? Effect.succeed(ruleSet.resolve({ toolId, defaultRequiresApproval }))
3589 : ruleSet.kind === "provider"
3590 ? ruleSet.provider.resolve
3591 ? ruleSet.provider.resolve({ toolId, defaultRequiresApproval })
3592 : Effect.succeed(resolveProviderPolicyFromRules(toolId, ruleSet.rules ?? []))
3593 : Effect.succeed(
3594 resolveEffectivePolicy(
3595 toolId,
3596 ruleSet.rows,
3597 ownerRankForRow,
3598 defaultRequiresApproval,
3599 ),
3600 );
3601
3602 // ------------------------------------------------------------------
3603 // 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