(
address: ToolAddress,
)
| 5455 | }); |
| 5456 | |
| 5457 | const policiesResolve = ( |
| 5458 | address: ToolAddress, |
| 5459 | ): Effect.Effect<EffectivePolicy, StorageFailure> => |
| 5460 | Effect.gen(function* () { |
| 5461 | const parsed = parseToolAddress(String(address)); |
| 5462 | const policyRows = yield* core.findMany("tool_policy", {}); |
| 5463 | const toolId = parsed |
| 5464 | ? `${parsed.integration}.${parsed.owner}.${parsed.connection}.${parsed.tool}` |
| 5465 | : String(address); |
| 5466 | // Find the tool to read its default approval annotation. |
| 5467 | let requiresApproval: boolean | undefined; |
| 5468 | if (parsed) { |
| 5469 | const row = yield* core.findFirst("tool", { |
| 5470 | where: (b: AnyCb) => |
| 5471 | b.and( |
| 5472 | byOwner(parsed.owner)(b), |
| 5473 | b("integration", "=", String(parsed.integration)), |
| 5474 | b("connection", "=", String(parsed.connection)), |
| 5475 | b("name", "=", String(parsed.tool)), |
| 5476 | ), |
| 5477 | }); |
| 5478 | if (row) { |
| 5479 | const annotations = decodeJsonColumn(row.annotations) as ToolAnnotations | undefined; |
| 5480 | requiresApproval = annotations?.requiresApproval; |
| 5481 | } |
| 5482 | } |
| 5483 | return resolveEffectivePolicy(toolId, policyRows, ownerRankForRow, requiresApproval); |
| 5484 | }); |
| 5485 | |
| 5486 | // ------------------------------------------------------------------ |
| 5487 | // Artifacts — saved generative-UI components, owner-scoped. |
nothing calls this directly
no test coverage detected