Skip to content

feat: add permission approval hooks#336

Merged
wbxl2000 merged 1 commit into
mainfrom
qer-permission-approval-hooks
Jun 2, 2026
Merged

feat: add permission approval hooks#336
wbxl2000 merged 1 commit into
mainfrom
qer-permission-approval-hooks

Conversation

@wbxl2000
Copy link
Copy Markdown
Collaborator

@wbxl2000 wbxl2000 commented Jun 2, 2026

Related Issue

No related issue. This PR addresses the missing hook lifecycle around permission approval prompts.

Problem

Hook users can observe tool execution before and after tools run, but they cannot observe when a manual approval prompt is opened or how it resolves. That makes it hard to track pending approval requests or audit approval outcomes from hooks.

What changed

  • Added PermissionRequest and PermissionResult hook events around real approval RPC requests.
  • Kept PermissionResult paired with an actual approval request, so implicit approvals do not emit orphan result events.
  • Documented both events in English and Chinese hook docs and added permission-manager coverage for request, result, and no-RPC fallback behavior.

Verification

  • pnpm --filter @moonshot-ai/agent-core exec vitest run test/agent/permission.test.ts
  • pnpm --filter @moonshot-ai/agent-core run typecheck
  • pnpm -C docs build
  • git diff --check

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 2, 2026

🦋 Changeset detected

Latest commit: ade0c07

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@moonshot-ai/agent-core Minor
@moonshot-ai/kimi-code Minor
@moonshot-ai/migration-legacy Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 2, 2026

pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@ade0c07
npx https://pkg.pr.new/@moonshot-ai/kimi-code@ade0c07

commit: ade0c07

@wbxl2000 wbxl2000 merged commit 7cda9c3 into main Jun 2, 2026
9 checks passed
@wbxl2000 wbxl2000 deleted the qer-permission-approval-hooks branch June 2, 2026 11:57
@github-actions github-actions Bot mentioned this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant