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

Function policiesResolve

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

Source from the content-addressed store, hash-verified

6156 );
6157
6158 const policiesResolve = (
6159 address: ToolAddress,
6160 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
6161 Effect.gen(function* () {
6162 const parsed = parseToolAddress(String(address));
6163 const policyRows = yield* core.findMany("tool_policy", {});
6164 const toolId = parsed
6165 ? `${parsed.integration}.${parsed.owner}.${parsed.connection}.${parsed.tool}`
6166 : String(address);
6167 // Find the tool to read its default approval annotation.
6168 let requiresApproval: boolean | undefined;
6169 if (parsed) {
6170 const row = yield* core.findFirst("tool", {
6171 where: (b: AnyCb) =>
6172 b.and(
6173 byOwner(parsed.owner)(b),
6174 b("integration", "=", String(parsed.integration)),
6175 b("connection", "=", String(parsed.connection)),
6176 b("name", "=", String(parsed.tool)),
6177 ),
6178 });
6179 if (row) {
6180 const annotations = decodeJsonColumn(row.annotations) as ToolAnnotations | undefined;
6181 requiresApproval = annotations?.requiresApproval;
6182 }
6183 }
6184 return resolveEffectivePolicy(toolId, policyRows, ownerRankForRow, requiresApproval);
6185 });
6186
6187 // ------------------------------------------------------------------
6188 // 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