(
address: ToolAddress,
)
| 3491 | }); |
| 3492 | |
| 3493 | const policiesResolve = ( |
| 3494 | address: ToolAddress, |
| 3495 | ): Effect.Effect<EffectivePolicy, StorageFailure> => |
| 3496 | Effect.gen(function* () { |
| 3497 | const parsed = parseToolAddress(String(address)); |
| 3498 | const policyRows = yield* core.findMany("tool_policy", {}); |
| 3499 | const toolId = parsed |
| 3500 | ? `${parsed.integration}.${parsed.owner}.${parsed.connection}.${parsed.tool}` |
| 3501 | : String(address); |
| 3502 | // Find the tool to read its default approval annotation. |
| 3503 | let requiresApproval: boolean | undefined; |
| 3504 | if (parsed) { |
| 3505 | const row = yield* core.findFirst("tool", { |
| 3506 | where: (b: AnyCb) => |
| 3507 | b.and( |
| 3508 | byOwner(parsed.owner)(b), |
| 3509 | b("integration", "=", String(parsed.integration)), |
| 3510 | b("connection", "=", String(parsed.connection)), |
| 3511 | b("name", "=", String(parsed.tool)), |
| 3512 | ), |
| 3513 | }); |
| 3514 | if (row) { |
| 3515 | const annotations = decodeJsonColumn(row.annotations) as ToolAnnotations | undefined; |
| 3516 | requiresApproval = annotations?.requiresApproval; |
| 3517 | } |
| 3518 | } |
| 3519 | return resolveEffectivePolicy(toolId, policyRows, ownerRankForRow, requiresApproval); |
| 3520 | }); |
| 3521 | |
| 3522 | // ------------------------------------------------------------------ |
| 3523 | // Elicitation |
nothing calls this directly
no test coverage detected