MCPcopy Create free account
hub / github.com/codeaashu/claude-code / createPermissionRequest

Function createPermissionRequest

src/utils/swarm/permissionSync.ts:167–207  ·  view source on GitHub ↗
(params: {
  toolName: string
  toolUseId: string
  input: Record<string, unknown>
  description: string
  permissionSuggestions?: unknown[]
  teamName?: string
  workerId?: string
  workerName?: string
  workerColor?: string
})

Source from the content-addressed store, hash-verified

165 * Create a new SwarmPermissionRequest object
166 */
167export function createPermissionRequest(params: {
168 toolName: string
169 toolUseId: string
170 input: Record<string, unknown>
171 description: string
172 permissionSuggestions?: unknown[]
173 teamName?: string
174 workerId?: string
175 workerName?: string
176 workerColor?: string
177}): SwarmPermissionRequest {
178 const teamName = params.teamName || getTeamName()
179 const workerId = params.workerId || getAgentId()
180 const workerName = params.workerName || getAgentName()
181 const workerColor = params.workerColor || getTeammateColor()
182
183 if (!teamName) {
184 throw new Error('Team name is required for permission requests')
185 }
186 if (!workerId) {
187 throw new Error('Worker ID is required for permission requests')
188 }
189 if (!workerName) {
190 throw new Error('Worker name is required for permission requests')
191 }
192
193 return {
194 id: generateRequestId(),
195 workerId,
196 workerName,
197 workerColor,
198 teamName,
199 toolName: params.toolName,
200 toolUseId: params.toolUseId,
201 description: params.description,
202 input: params.input,
203 permissionSuggestions: params.permissionSuggestions || [],
204 status: 'pending',
205 createdAt: Date.now(),
206 }
207}
208
209/**
210 * Write a permission request to the pending directory with file locking

Callers 2

Calls 5

getTeamNameFunction · 0.85
getAgentIdFunction · 0.85
getAgentNameFunction · 0.85
getTeammateColorFunction · 0.70
generateRequestIdFunction · 0.70

Tested by

no test coverage detected