mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-25 05:07:05 +00:00
feat(acp): re-enable change_title for ACP launchers with manual title precedence (#1672)
* feat(acp): re-enable change_title for ACP launchers with manual title precedence opencode/cursor/kimi disabled the hapi change_title MCP tool (#1028), relying solely on native ACP session-title sync. When the agent never generates a native title there was no way to set one short of hub API calls. Re-enable change_title on those launchers. The shared title-sync controller marks manual titles, so later native sessionInfoUpdate titles no longer overwrite them. * fix(acp): include copilot in change_title re-enable and harden tests Copilot has the same ACP title-sync shape as opencode/cursor/kimi, so it gets the same shared controller wiring. Add a cursor regression test asserting one controller instance is shared across backend (re)creation paths and cover the onChangeTitle failure path. * fix(acp): persist manual title precedence in session metadata The manual flag lived only in one controller closure, so a recreated remote launcher or a resumed session started fresh and let the next native ACP sessionInfoUpdate overwrite a change_title rename. Store acpManualTitle in session metadata and initialize new controllers from it. * fix(agent): preserve acpManualTitle through existing-session bootstrap bootstrapExistingSession rebuilds metadata through an allowlist, so the manual-title marker was dropped on process resume and native ACP title sync could overwrite a change_title rename. * fix(cursor): preserve manual title precedence across live relaunch
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import { Buffer } from 'node:buffer';
|
||||
import { registerAcpSessionTitleSync } from '@/agent/acpSessionTitle';
|
||||
import { createAcpSessionTitleSync, registerAcpSessionTitleSync } from '@/agent/acpSessionTitle';
|
||||
import { logger } from '@/ui/logger';
|
||||
import { buildHapiMcpBridge } from '@/codex/utils/buildHapiMcpBridge';
|
||||
import type { AcpSdkBackend } from '@/agent/backends/acp';
|
||||
@@ -278,8 +278,9 @@ class OpencodeRemoteLauncher extends RemoteLauncherBase {
|
||||
// advertises "not steerable" rather than a stale value.
|
||||
this.setSteeringActive(false);
|
||||
|
||||
const titleSync = createAcpSessionTitleSync(session.client);
|
||||
const { server: happyServer, mcpServers } = await buildHapiMcpBridge(session.client, {
|
||||
enableChangeTitle: false,
|
||||
onChangeTitle: () => titleSync.markManualTitle(),
|
||||
skillLookup: { workingDirectory: session.path, flavor: 'opencode' }
|
||||
});
|
||||
this.happyServer = happyServer;
|
||||
@@ -320,7 +321,7 @@ class OpencodeRemoteLauncher extends RemoteLauncherBase {
|
||||
hostname
|
||||
});
|
||||
this.backend = backend;
|
||||
registerAcpSessionTitleSync(backend, session.client);
|
||||
registerAcpSessionTitleSync(backend, session.client, titleSync);
|
||||
|
||||
backend.onStderrError((error) => {
|
||||
this.handleAcpStderrError(error);
|
||||
|
||||
Reference in New Issue
Block a user