(
address: ToolAddress,
)
| 3227 | }); |
| 3228 | |
| 3229 | const policiesResolve = ( |
| 3230 | address: ToolAddress, |
| 3231 | ): Effect.Effect<EffectivePolicy, StorageFailure> => |
| 3232 | Effect.gen(function* () { |
| 3233 | const parsed = parseToolAddress(String(address)); |
| 3234 | const policyRows = yield* core.findMany("tool_policy", {}); |
| 3235 | const toolId = parsed |
| 3236 | ? `${parsed.integration}.${parsed.owner}.${parsed.connection}.${parsed.tool}` |
| 3237 | : String(address); |
| 3238 | // Find the tool to read its default approval annotation. |
| 3239 | let requiresApproval: boolean | undefined; |
| 3240 | if (parsed) { |
| 3241 | const row = yield* core.findFirst("tool", { |
| 3242 | where: (b: AnyCb) => |
| 3243 | b.and( |
| 3244 | byOwner(parsed.owner)(b), |
| 3245 | b("integration", "=", String(parsed.integration)), |
| 3246 | b("connection", "=", String(parsed.connection)), |
| 3247 | b("name", "=", String(parsed.tool)), |
| 3248 | ), |
| 3249 | }); |
| 3250 | if (row) { |
| 3251 | const annotations = decodeJsonColumn(row.annotations) as ToolAnnotations | undefined; |
| 3252 | requiresApproval = annotations?.requiresApproval; |
| 3253 | } |
| 3254 | } |
| 3255 | return resolveEffectivePolicy(toolId, policyRows, ownerRankForRow, requiresApproval); |
| 3256 | }); |
| 3257 | |
| 3258 | // ------------------------------------------------------------------ |
| 3259 | // Elicitation |
nothing calls this directly
no test coverage detected