feat(providers): add first-class Grok ACP client#2378
Conversation
Register a dedicated Grok ACP provider with Always approve / Plan / Full access modes, Grok-specific launch args, and context usage from CLI session signals when ACP omits usage updates. Co-authored-by: Cursor <cursoragent@cursor.com>
|
| Filename | Overview |
|---|---|
| packages/server/src/server/agent/providers/acp-agent.ts | Adds reusable ACP hooks, but launch-only setters can report configuration changes that were never applied to the running process. |
| packages/server/src/server/agent/providers/grok-acp-agent.ts | Defines Grok modes, model metadata, and launch arguments; its launch-only configuration exposes the runtime-state mismatch. |
| packages/server/src/server/agent/providers/grok-context-usage.ts | Adds a guarded fallback that reads Grok session context counters from signals.json. |
| packages/server/src/server/agent/provider-registry.ts | Routes the exact grok provider identifier to the dedicated ACP client. |
| packages/server/src/server/agent/providers/generic-acp-agent.ts | Passes the new generic ACP extension hooks through to the base client. |
Sequence Diagram
sequenceDiagram
participant Client
participant Session as ACPAgentSession
participant Grok as Grok CLI process
Client->>Session: Create session with mode/model/effort
Session->>Grok: Spawn with launch arguments
Client->>Session: Change mode/model/effort
Session-->>Client: Emit changed runtime state
Note over Session,Grok: Running process is not restarted or reconfigured
Client->>Session: Send next prompt
Session->>Grok: Prompt uses original launch configuration
Reviews (1): Last reviewed commit: "feat(providers): add first-class Grok AC..." | Re-trigger Greptile
| if (this.launchOnlyConfig.mode) { | ||
| if (modeId === this.currentMode) return; | ||
| this.currentMode = modeId; | ||
| this.config.modeId = modeId; | ||
| this.pushEvent({ | ||
| type: "mode_changed", | ||
| provider: this.provider, | ||
| currentModeId: this.currentMode, | ||
| availableModes: [...this.availableModes], | ||
| }); | ||
| return; |
There was a problem hiding this comment.
Launch-only state diverges from process
When a client changes a running Grok session's mode, model, or reasoning effort, these branches update, emit, and persist the new selection without restarting or reconfiguring the process, causing subsequent prompts to use the original launch configuration while the UI reports the new configuration as active.
Knowledge Base Used: Agent Orchestration
|
Superseded by #2385, which includes this change (and later polish) on current main. |
Linked issue
Closes #2375
Related: #2053
Type of change
What does this PR do
Adds a dedicated
GrokACPAgentClientinstead of treating Grok as a plain generic ACP provider:--model,--reasoning-effort,--permission-mode, sandbox)signals.jsonwhen ACP usage updates are missingcontextUsageResolver,sessionLaunchArgs,launchOnlyConfig,autoApprovePermissionModes)How did you verify it
npx vitest run packages/server/src/server/agent/providers/grok-acp-agent.test.ts packages/server/src/server/agent/providers/grok-context-usage.test.ts --bail=1(5 passed)npm run typecheck --workspace=@getpaseo/serverChecklist
npm run typecheckpassesnpm run lintpassesMade with Cursor