feat: vendor permission system source

This commit is contained in:
云服务部-叶林立
2026-08-19 14:35:19 +08:00
parent 198584daf8
commit 410c50a3e5
809 changed files with 157793 additions and 139 deletions
@@ -0,0 +1,17 @@
import { randomUUID } from "node:crypto";
/**
* Mint the identifier for one permission request, at the moment the request is
* created rather than at the moment it prompts.
*
* Distinct from the host's `toolCallId`, which keeps flowing alongside it as
* the join back to the Pi transcript: a single tool call runs several gates and
* therefore raises several permission requests, so the SDK's id cannot identify
* one of them.
*
* The `perm-` prefix keeps the id self-identifying in a review log that also
* carries SDK tool-call ids.
*/
export function createPermissionRequestId(): string {
return `perm-${randomUUID()}`;
}