(
address: ToolAddress,
)
| 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. |
nothing calls this directly
no test coverage detected