MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / buildPermissionToolCallUpdate

Function buildPermissionToolCallUpdate

packages/acp-adapter/src/approval.ts:256–281  ·  view source on GitHub ↗
(
  turnId: number | undefined,
  req: ApprovalRequest,
)

Source from the content-addressed store, hash-verified

254 * diff card and matches the wording used by the Python reference.
255 */
256export function buildPermissionToolCallUpdate(
257 turnId: number | undefined,
258 req: ApprovalRequest,
259): ToolCallUpdate {
260 const toolCallId =
261 turnId !== undefined ? acpToolCallId(turnId, req.toolCallId) : req.toolCallId;
262 const content: ToolCallContent[] = [];
263 // Diff entry first — diffs and file-io previews carry the most
264 // context and should land at the top of the approval card. Phase 13.2
265 // adds plan_review to the same path so plan markdown surfaces in the
266 // headline too.
267 const headlineEntry = displayBlockToAcpContent(req.display);
268 if (headlineEntry !== null) {
269 content.push(headlineEntry);
270 }
271 // Always include the action summary so the prompt is never empty.
272 content.push({
273 type: 'content',
274 content: { type: 'text', text: `Requesting approval to ${req.action}` },
275 });
276 return {
277 toolCallId,
278 title: req.toolName,
279 content,
280 };
281}
282
283/**
284 * Look up the matched {@link PermissionOption}'s display name for the

Callers 3

approval.test.tsFile · 0.90
handleApprovalMethod · 0.90

Calls 3

acpToolCallIdFunction · 0.90
displayBlockToAcpContentFunction · 0.90
pushMethod · 0.45

Tested by

no test coverage detected