(
address: ToolAddress,
)
| 3475 | }); |
| 3476 | |
| 3477 | const policiesResolve = ( |
| 3478 | address: ToolAddress, |
| 3479 | ): Effect.Effect<EffectivePolicy, StorageFailure> => |
| 3480 | Effect.gen(function* () { |
| 3481 | const parsed = parseToolAddress(String(address)); |
| 3482 | const policyRows = yield* core.findMany("tool_policy", {}); |
| 3483 | const toolId = parsed |
| 3484 | ? `${parsed.integration}.${parsed.owner}.${parsed.connection}.${parsed.tool}` |
| 3485 | : String(address); |
| 3486 | // Find the tool to read its default approval annotation. |
| 3487 | let requiresApproval: boolean | undefined; |
| 3488 | if (parsed) { |
| 3489 | const row = yield* core.findFirst("tool", { |
| 3490 | where: (b: AnyCb) => |
| 3491 | b.and( |
| 3492 | byOwner(parsed.owner)(b), |
| 3493 | b("integration", "=", String(parsed.integration)), |
| 3494 | b("connection", "=", String(parsed.connection)), |
| 3495 | b("name", "=", String(parsed.tool)), |
| 3496 | ), |
| 3497 | }); |
| 3498 | if (row) { |
| 3499 | const annotations = decodeJsonColumn(row.annotations) as ToolAnnotations | undefined; |
| 3500 | requiresApproval = annotations?.requiresApproval; |
| 3501 | } |
| 3502 | } |
| 3503 | return resolveEffectivePolicy(toolId, policyRows, ownerRankForRow, requiresApproval); |
| 3504 | }); |
| 3505 | |
| 3506 | // ------------------------------------------------------------------ |
| 3507 | // Elicitation |
nothing calls this directly
no test coverage detected