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

Function resolvePolicyFromRuleSet

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

Source from the content-addressed store, hash-verified

5466 .pipe(Effect.map((rows) => ({ kind: "global" as const, rows })));
5467
5468 const resolvePolicyFromRuleSet = (
5469 toolId: string,
5470 ruleSet: ActivePolicyRuleSet,
5471 defaultRequiresApproval?: boolean,
5472 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
5473 ruleSet.kind === "prepared"
5474 ? Effect.succeed(ruleSet.resolve({ toolId, defaultRequiresApproval }))
5475 : ruleSet.kind === "provider"
5476 ? ruleSet.provider.resolve
5477 ? ruleSet.provider.resolve({ toolId, defaultRequiresApproval })
5478 : Effect.succeed(resolveProviderPolicyFromRules(toolId, ruleSet.rules ?? []))
5479 : Effect.succeed(
5480 resolveEffectivePolicy(
5481 toolId,
5482 ruleSet.rows,
5483 ownerRankForRow,
5484 defaultRequiresApproval,
5485 ),
5486 );
5487
5488 // ------------------------------------------------------------------
5489 // 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