(
address: ToolAddress,
)
| 3574 | }); |
| 3575 | |
| 3576 | const policiesResolve = ( |
| 3577 | address: ToolAddress, |
| 3578 | ): Effect.Effect<EffectivePolicy, StorageFailure> => |
| 3579 | Effect.gen(function* () { |
| 3580 | const parsed = parseToolAddress(String(address)); |
| 3581 | const policyRows = yield* core.findMany("tool_policy", {}); |
| 3582 | const toolId = parsed |
| 3583 | ? `${parsed.integration}.${parsed.owner}.${parsed.connection}.${parsed.tool}` |
| 3584 | : String(address); |
| 3585 | // Find the tool to read its default approval annotation. |
| 3586 | let requiresApproval: boolean | undefined; |
| 3587 | if (parsed) { |
| 3588 | const row = yield* core.findFirst("tool", { |
| 3589 | where: (b: AnyCb) => |
| 3590 | b.and( |
| 3591 | byOwner(parsed.owner)(b), |
| 3592 | b("integration", "=", String(parsed.integration)), |
| 3593 | b("connection", "=", String(parsed.connection)), |
| 3594 | b("name", "=", String(parsed.tool)), |
| 3595 | ), |
| 3596 | }); |
| 3597 | if (row) { |
| 3598 | const annotations = decodeJsonColumn(row.annotations) as ToolAnnotations | undefined; |
| 3599 | requiresApproval = annotations?.requiresApproval; |
| 3600 | } |
| 3601 | } |
| 3602 | return resolveEffectivePolicy(toolId, policyRows, ownerRankForRow, requiresApproval); |
| 3603 | }); |
| 3604 | |
| 3605 | // ------------------------------------------------------------------ |
| 3606 | // Elicitation |
nothing calls this directly
no test coverage detected