* Handlers persist messages to memory before the executor redacts block * output, so mask content here too when the block-output stage is enabled — * otherwise raw PII is stored in the memory table and read back on later runs. * `onFailure: 'throw'` aborts rather than persisting unredacted
(ctx: ExecutionContext, message: Message)
| 126 | * `onFailure: 'throw'` aborts rather than persisting unredacted content. |
| 127 | */ |
| 128 | private async maskContentForStorage(ctx: ExecutionContext, message: Message): Promise<Message> { |
| 129 | if (!ctx.piiBlockOutputRedaction?.enabled || !message.content) { |
| 130 | return message |
| 131 | } |
| 132 | return { |
| 133 | ...message, |
| 134 | content: await redactObjectStrings(message.content, { |
| 135 | entityTypes: ctx.piiBlockOutputRedaction.entityTypes, |
| 136 | language: ctx.piiBlockOutputRedaction.language, |
| 137 | onFailure: 'throw', |
| 138 | }), |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | private requireWorkspaceId(ctx: ExecutionContext): string { |
| 143 | if (!ctx.workspaceId) { |
no test coverage detected