-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(grok): surface ACP slash commands and ignore skills-reload ids #4110
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
Open
Dishah3241
wants to merge
6
commits into
pingdotgg:main
Choose a base branch
from
Dishah3241:fix/grok-slash-commands-skills-reload
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c515f9b
fix(grok): surface ACP slash commands and ignore skills-reload ids
Dishah3241 208ee44
fix(grok): probe slash commands with ServerConfig workspace cwd
Dishah3241 bc24d6d
fix(grok): distinguish pending vs empty available_commands_update
Dishah3241 1d7fa62
fix(grok): keep waiting after empty available_commands_update
Dishah3241 0a03541
fix(grok): settle briefly on empty commands instead of full 2s wait
Dishah3241 4fde55d
fix(grok): cap slash-command wait by remaining discovery budget
Dishah3241 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
apps/server/src/provider/acp/parseAcpAvailableCommands.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import { describe, expect, it } from "@effect/vitest"; | ||
|
|
||
| import { parseAcpAvailableCommands } from "./parseAcpAvailableCommands.ts"; | ||
|
|
||
| describe("parseAcpAvailableCommands", () => { | ||
| it("maps ACP available commands into provider slash commands", () => { | ||
| expect( | ||
| parseAcpAvailableCommands([ | ||
| { | ||
| name: "factory-planner", | ||
| description: "Plan factory tickets", | ||
| input: { hint: "ticket intent" }, | ||
| }, | ||
| { | ||
| name: "context", | ||
| description: "Show context usage", | ||
| }, | ||
| ]), | ||
| ).toEqual([ | ||
| { | ||
| name: "factory-planner", | ||
| description: "Plan factory tickets", | ||
| input: { hint: "ticket intent" }, | ||
| }, | ||
| { | ||
| name: "context", | ||
| description: "Show context usage", | ||
| }, | ||
| ]); | ||
| }); | ||
|
|
||
| it("dedupes by case-insensitive name and keeps the first description/hint", () => { | ||
| expect( | ||
| parseAcpAvailableCommands([ | ||
| { name: "Trade-Research", description: "first", input: { hint: "ticker" } }, | ||
| { name: "trade-research", description: "second", input: { hint: "other" } }, | ||
| { name: " ", description: "ignored" }, | ||
| ]), | ||
| ).toEqual([ | ||
| { | ||
| name: "Trade-Research", | ||
| description: "first", | ||
| input: { hint: "ticker" }, | ||
| }, | ||
| ]); | ||
| }); | ||
|
|
||
| it("returns an empty list for nullish input", () => { | ||
| expect(parseAcpAvailableCommands(undefined)).toEqual([]); | ||
| expect(parseAcpAvailableCommands(null)).toEqual([]); | ||
| expect(parseAcpAvailableCommands([])).toEqual([]); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import type { ServerProviderSlashCommand } from "@t3tools/contracts"; | ||
| import type * as EffectAcpSchema from "effect-acp/schema"; | ||
|
|
||
| import { nonEmptyTrimmed } from "../providerSnapshot.ts"; | ||
|
|
||
| /** | ||
| * Map ACP `available_commands_update` entries into the provider slash-command | ||
| * shape used by the T3 composer (same contract Claude fills from SDK init). | ||
| */ | ||
| export function parseAcpAvailableCommands( | ||
| commands: ReadonlyArray<EffectAcpSchema.AvailableCommand> | null | undefined, | ||
| ): ReadonlyArray<ServerProviderSlashCommand> { | ||
| const byName = new Map<string, ServerProviderSlashCommand>(); | ||
|
|
||
| for (const command of commands ?? []) { | ||
| const name = nonEmptyTrimmed(command.name); | ||
| if (!name) { | ||
| continue; | ||
| } | ||
|
|
||
| const description = nonEmptyTrimmed(command.description); | ||
| const hint = | ||
| command.input && typeof command.input === "object" && "hint" in command.input | ||
| ? nonEmptyTrimmed(command.input.hint) | ||
| : undefined; | ||
|
|
||
| const key = name.toLowerCase(); | ||
| const existing = byName.get(key); | ||
| if (!existing) { | ||
| byName.set(key, { | ||
| name, | ||
| ...(description ? { description } : {}), | ||
| ...(hint ? { input: { hint } } : {}), | ||
| }); | ||
| continue; | ||
| } | ||
|
|
||
| byName.set(key, { | ||
| ...existing, | ||
| ...(existing.description ? {} : description ? { description } : {}), | ||
| ...(existing.input?.hint ? {} : hint ? { input: { hint } } : {}), | ||
| }); | ||
| } | ||
|
|
||
| return [...byName.values()]; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.