-
Notifications
You must be signed in to change notification settings - Fork 192
fix: accept legacy ACP optionIds for backward compatibility #436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
1955dd9
0bbf492
9bba513
8eb1847
416f9b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@moonshot-ai/kimi-code": patch | ||
| --- | ||
|
|
||
| Fix ACP custom client tools being auto-rejected when using legacy Python ACP SDK optionId values (`approve`, `approve_for_session`) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,17 @@ export const APPROVE_ONCE_OPTION_ID = 'approve_once'; | |
| export const APPROVE_ALWAYS_OPTION_ID = 'approve_always'; | ||
| export const REJECT_OPTION_ID = 'reject'; | ||
|
|
||
| /** | ||
| * Legacy option ids sent by older ACP clients (e.g. Python ACP SDK 0.8.x). | ||
| * Mapped to the canonical ids so that clients built against the older SDK | ||
| * continue to work without modification. | ||
| */ | ||
| const LEGACY_OPTION_ID_MAP: Record<string, string> = { | ||
| approve: APPROVE_ONCE_OPTION_ID, | ||
| approve_for_session: APPROVE_ALWAYS_OPTION_ID, | ||
| reject: REJECT_OPTION_ID, | ||
| }; | ||
|
|
||
| /** | ||
| * Phase 13.2 plan_review optionId namespace. Picked deliberately so the | ||
| * `plan_*` prefix never collides with the canonical `approve_*` / | ||
|
|
@@ -151,10 +162,11 @@ export function permissionResponseToApprovalResponse( | |
| if (response.outcome.outcome === 'cancelled') { | ||
| return { decision: 'cancelled' }; | ||
| } | ||
| const optionId = response.outcome.optionId; | ||
| const rawOptionId = response.outcome.optionId; | ||
| if (req?.display.kind === 'plan_review') { | ||
| return mapPlanReviewOptionId(req.display, optionId); | ||
| return mapPlanReviewOptionId(req.display, rawOptionId); | ||
| } | ||
| const optionId = LEGACY_OPTION_ID_MAP[rawOptionId] ?? rawOptionId; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a legacy client returns Useful? React with 👍 / 👎. |
||
| switch (optionId) { | ||
| case APPROVE_ONCE_OPTION_ID: | ||
| return { decision: 'approved' }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repo's changeset rules require source changes that affect a package's output to list that package, and to additionally list the CLI when an internal package change enters the CLI bundle. This commit changes
packages/acp-adapter/src/approval.ts, but the changeset only bumps@moonshot-ai/kimi-code, so@moonshot-ai/acp-adapterwill not be versioned/tracked for this fix; add"@moonshot-ai/acp-adapter": patchhere as well.Useful? React with 👍 / 👎.