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

Function policiesResolve

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

Source from the content-addressed store, hash-verified

4447 });
4448
4449 const policiesResolve = (
4450 address: ToolAddress,
4451 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
4452 Effect.gen(function* () {
4453 const parsed = parseToolAddress(String(address));
4454 const policyRows = yield* core.findMany("tool_policy", {});
4455 const toolId = parsed
4456 ? `${parsed.integration}.${parsed.owner}.${parsed.connection}.${parsed.tool}`
4457 : String(address);
4458 // Find the tool to read its default approval annotation.
4459 let requiresApproval: boolean | undefined;
4460 if (parsed) {
4461 const row = yield* core.findFirst("tool", {
4462 where: (b: AnyCb) =>
4463 b.and(
4464 byOwner(parsed.owner)(b),
4465 b("integration", "=", String(parsed.integration)),
4466 b("connection", "=", String(parsed.connection)),
4467 b("name", "=", String(parsed.tool)),
4468 ),
4469 });
4470 if (row) {
4471 const annotations = decodeJsonColumn(row.annotations) as ToolAnnotations | undefined;
4472 requiresApproval = annotations?.requiresApproval;
4473 }
4474 }
4475 return resolveEffectivePolicy(toolId, policyRows, ownerRankForRow, requiresApproval);
4476 });
4477
4478 // ------------------------------------------------------------------
4479 // 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