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

Function policiesResolve

packages/core/sdk/src/executor.ts:3993–4020  ·  view source on GitHub ↗
(
      address: ToolAddress,
    )

Source from the content-addressed store, hash-verified

3991 });
3992
3993 const policiesResolve = (
3994 address: ToolAddress,
3995 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
3996 Effect.gen(function* () {
3997 const parsed = parseToolAddress(String(address));
3998 const policyRows = yield* core.findMany("tool_policy", {});
3999 const toolId = parsed
4000 ? `${parsed.integration}.${parsed.owner}.${parsed.connection}.${parsed.tool}`
4001 : String(address);
4002 // Find the tool to read its default approval annotation.
4003 let requiresApproval: boolean | undefined;
4004 if (parsed) {
4005 const row = yield* core.findFirst("tool", {
4006 where: (b: AnyCb) =>
4007 b.and(
4008 byOwner(parsed.owner)(b),
4009 b("integration", "=", String(parsed.integration)),
4010 b("connection", "=", String(parsed.connection)),
4011 b("name", "=", String(parsed.tool)),
4012 ),
4013 });
4014 if (row) {
4015 const annotations = decodeJsonColumn(row.annotations) as ToolAnnotations | undefined;
4016 requiresApproval = annotations?.requiresApproval;
4017 }
4018 }
4019 return resolveEffectivePolicy(toolId, policyRows, ownerRankForRow, requiresApproval);
4020 });
4021
4022 // ------------------------------------------------------------------
4023 // Artifacts — saved generative-UI components, owner-scoped.

Callers

nothing calls this directly

Calls 4

resolveEffectivePolicyFunction · 0.90
parseToolAddressFunction · 0.85
byOwnerFunction · 0.85
decodeJsonColumnFunction · 0.85

Tested by

no test coverage detected