(
address: ToolAddress,
)
| 4447 | }); |
| 4448 | |
| 4449 | const policiesResolve = ( |
| 4450 | address: ToolAddress, |
| 4451 | ): Effect.Effect<EffectivePolicy, StorageFailure> => |
| 4452 | Effect.gen(function* () { |
| 4453 | const parsed = parseToolAddress(String(address)); |
| 4454 | const policyRows = yield* core.findMany("tool_policy", {}); |
| 4455 | const toolId = parsed |
| 4456 | ? `${parsed.integration}.${parsed.owner}.${parsed.connection}.${parsed.tool}` |
| 4457 | : String(address); |
| 4458 | // Find the tool to read its default approval annotation. |
| 4459 | let requiresApproval: boolean | undefined; |
| 4460 | if (parsed) { |
| 4461 | const row = yield* core.findFirst("tool", { |
| 4462 | where: (b: AnyCb) => |
| 4463 | b.and( |
| 4464 | byOwner(parsed.owner)(b), |
| 4465 | b("integration", "=", String(parsed.integration)), |
| 4466 | b("connection", "=", String(parsed.connection)), |
| 4467 | b("name", "=", String(parsed.tool)), |
| 4468 | ), |
| 4469 | }); |
| 4470 | if (row) { |
| 4471 | const annotations = decodeJsonColumn(row.annotations) as ToolAnnotations | undefined; |
| 4472 | requiresApproval = annotations?.requiresApproval; |
| 4473 | } |
| 4474 | } |
| 4475 | return resolveEffectivePolicy(toolId, policyRows, ownerRankForRow, requiresApproval); |
| 4476 | }); |
| 4477 | |
| 4478 | // ------------------------------------------------------------------ |
| 4479 | // Artifacts — saved generative-UI components, owner-scoped. |
nothing calls this directly
no test coverage detected