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

Function policiesResolve

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

Source from the content-addressed store, hash-verified

4063 });
4064
4065 const policiesResolve = (
4066 address: ToolAddress,
4067 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
4068 Effect.gen(function* () {
4069 const parsed = parseToolAddress(String(address));
4070 const policyRows = yield* core.findMany("tool_policy", {});
4071 const toolId = parsed
4072 ? `${parsed.integration}.${parsed.owner}.${parsed.connection}.${parsed.tool}`
4073 : String(address);
4074 // Find the tool to read its default approval annotation.
4075 let requiresApproval: boolean | undefined;
4076 if (parsed) {
4077 const row = yield* core.findFirst("tool", {
4078 where: (b: AnyCb) =>
4079 b.and(
4080 byOwner(parsed.owner)(b),
4081 b("integration", "=", String(parsed.integration)),
4082 b("connection", "=", String(parsed.connection)),
4083 b("name", "=", String(parsed.tool)),
4084 ),
4085 });
4086 if (row) {
4087 const annotations = decodeJsonColumn(row.annotations) as ToolAnnotations | undefined;
4088 requiresApproval = annotations?.requiresApproval;
4089 }
4090 }
4091 return resolveEffectivePolicy(toolId, policyRows, ownerRankForRow, requiresApproval);
4092 });
4093
4094 // ------------------------------------------------------------------
4095 // 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