MCPcopy Index your code
hub / github.com/codeaashu/claude-code / parsePermissionUpdates

Function parsePermissionUpdates

src/hooks/useSwarmPermissionPoller.ts:35–53  ·  view source on GitHub ↗

* Validate permissionUpdates from external sources (mailbox IPC, disk polling). * Malformed entries from buggy/old teammate processes are filtered out rather * than propagated unchecked into callback.onAllow().

(raw: unknown)

Source from the content-addressed store, hash-verified

33 * than propagated unchecked into callback.onAllow().
34 */
35function parsePermissionUpdates(raw: unknown): PermissionUpdate[] {
36 if (!Array.isArray(raw)) {
37 return []
38 }
39 const schema = permissionUpdateSchema()
40 const valid: PermissionUpdate[] = []
41 for (const entry of raw) {
42 const result = schema.safeParse(entry)
43 if (result.success) {
44 valid.push(result.data)
45 } else {
46 logForDebugging(
47 `[SwarmPermissionPoller] Dropping malformed permissionUpdate entry: ${result.error.message}`,
48 { level: 'warn' },
49 )
50 }
51 }
52 return valid
53}
54
55/**
56 * Callback signature for handling permission responses

Callers 2

processResponseFunction · 0.85

Calls 2

logForDebuggingFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected