(
address: ToolAddress,
)
| 4725 | }); |
| 4726 | |
| 4727 | const policiesResolve = ( |
| 4728 | address: ToolAddress, |
| 4729 | ): Effect.Effect<EffectivePolicy, StorageFailure> => |
| 4730 | Effect.gen(function* () { |
| 4731 | const parsed = parseToolAddress(String(address)); |
| 4732 | const policyRows = yield* core.findMany("tool_policy", {}); |
| 4733 | const toolId = parsed |
| 4734 | ? `${parsed.integration}.${parsed.owner}.${parsed.connection}.${parsed.tool}` |
| 4735 | : String(address); |
| 4736 | // Find the tool to read its default approval annotation. |
| 4737 | let requiresApproval: boolean | undefined; |
| 4738 | if (parsed) { |
| 4739 | const row = yield* core.findFirst("tool", { |
| 4740 | where: (b: AnyCb) => |
| 4741 | b.and( |
| 4742 | byOwner(parsed.owner)(b), |
| 4743 | b("integration", "=", String(parsed.integration)), |
| 4744 | b("connection", "=", String(parsed.connection)), |
| 4745 | b("name", "=", String(parsed.tool)), |
| 4746 | ), |
| 4747 | }); |
| 4748 | if (row) { |
| 4749 | const annotations = decodeJsonColumn(row.annotations) as ToolAnnotations | undefined; |
| 4750 | requiresApproval = annotations?.requiresApproval; |
| 4751 | } |
| 4752 | } |
| 4753 | return resolveEffectivePolicy(toolId, policyRows, ownerRankForRow, requiresApproval); |
| 4754 | }); |
| 4755 | |
| 4756 | // ------------------------------------------------------------------ |
| 4757 | // Artifacts — saved generative-UI components, owner-scoped. |
nothing calls this directly
no test coverage detected