Skip to content

Commit 8cdbd1c

Browse files
committed
refactor: remove terminal title update feature
OpenCode now supports terminal title updates natively (since v1.0.150, commit 8346550), making this plugin feature redundant. Remove the entire terminal title feature and clean up associated dead code. Ref: sst/opencode@8346550 Removed: - src/features/terminal/ (title.ts, index.ts) - src/features/claude-code-session-state/detector.ts (dead code) - src/features/claude-code-session-state/types.ts (dead code) - Session title tracking (setCurrentSession, getCurrentSessionTitle) - Terminal title update calls from event handlers Retained: - subagentSessions (used by background-agent, session-notification) - mainSessionID tracking (used by session recovery) 🤖 Generated with [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
1 parent 0261652 commit 8cdbd1c

File tree

7 files changed

+0
-186
lines changed

7 files changed

+0
-186
lines changed

src/features/claude-code-session-state/detector.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
export * from "./types"
21
export * from "./state"
3-
export * from "./detector"
Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,11 @@
1-
import type { SessionErrorState, SessionInterruptState } from "./types"
2-
3-
export const sessionErrorState = new Map<string, SessionErrorState>()
4-
export const sessionInterruptState = new Map<string, SessionInterruptState>()
51
export const subagentSessions = new Set<string>()
6-
export const sessionFirstMessageProcessed = new Set<string>()
72

8-
export let currentSessionID: string | undefined
9-
export let currentSessionTitle: string | undefined
103
export let mainSessionID: string | undefined
114

12-
export function setCurrentSession(id: string | undefined, title: string | undefined) {
13-
currentSessionID = id
14-
currentSessionTitle = title
15-
}
16-
175
export function setMainSession(id: string | undefined) {
186
mainSessionID = id
197
}
208

21-
export function getCurrentSessionID(): string | undefined {
22-
return currentSessionID
23-
}
24-
25-
export function getCurrentSessionTitle(): string | undefined {
26-
return currentSessionTitle
27-
}
28-
299
export function getMainSessionID(): string | undefined {
3010
return mainSessionID
3111
}

src/features/claude-code-session-state/types.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/features/terminal/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/features/terminal/title.ts

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/index.ts

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@ import {
3939
} from "./features/claude-code-agent-loader";
4040
import { loadMcpConfigs } from "./features/claude-code-mcp-loader";
4141
import {
42-
setCurrentSession,
4342
setMainSession,
4443
getMainSessionID,
45-
getCurrentSessionTitle,
4644
} from "./features/claude-code-session-state";
47-
import { updateTerminalTitle } from "./features/terminal";
4845
import { builtinTools, createCallOmoAgent, createBackgroundTools, createLookAt, interactive_bash, getTmuxPath } from "./tools";
4946
import { BackgroundManager } from "./features/background-agent";
5047
import { createBuiltinMcps } from "./mcp";
@@ -252,8 +249,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
252249
? createEmptyMessageSanitizerHook()
253250
: null;
254251

255-
updateTerminalTitle({ sessionId: "main" });
256-
257252
const backgroundManager = new BackgroundManager(ctx);
258253

259254
const backgroundNotificationHook = isHookEnabled("background-notification")
@@ -421,40 +416,13 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
421416
| undefined;
422417
if (!sessionInfo?.parentID) {
423418
setMainSession(sessionInfo?.id);
424-
setCurrentSession(sessionInfo?.id, sessionInfo?.title);
425-
updateTerminalTitle({
426-
sessionId: sessionInfo?.id || "main",
427-
status: "idle",
428-
directory: ctx.directory,
429-
sessionTitle: sessionInfo?.title,
430-
});
431-
}
432-
}
433-
434-
if (event.type === "session.updated") {
435-
const sessionInfo = props?.info as
436-
| { id?: string; title?: string; parentID?: string }
437-
| undefined;
438-
if (!sessionInfo?.parentID) {
439-
setCurrentSession(sessionInfo?.id, sessionInfo?.title);
440-
updateTerminalTitle({
441-
sessionId: sessionInfo?.id || "main",
442-
status: "processing",
443-
directory: ctx.directory,
444-
sessionTitle: sessionInfo?.title,
445-
});
446419
}
447420
}
448421

449422
if (event.type === "session.deleted") {
450423
const sessionInfo = props?.info as { id?: string } | undefined;
451424
if (sessionInfo?.id === getMainSessionID()) {
452425
setMainSession(undefined);
453-
setCurrentSession(undefined, undefined);
454-
updateTerminalTitle({
455-
sessionId: "main",
456-
status: "idle",
457-
});
458426
}
459427
}
460428

@@ -482,27 +450,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
482450
.catch(() => {});
483451
}
484452
}
485-
486-
if (sessionID && sessionID === getMainSessionID()) {
487-
updateTerminalTitle({
488-
sessionId: sessionID,
489-
status: "error",
490-
directory: ctx.directory,
491-
sessionTitle: getCurrentSessionTitle(),
492-
});
493-
}
494-
}
495-
496-
if (event.type === "session.idle") {
497-
const sessionID = props?.sessionID as string | undefined;
498-
if (sessionID && sessionID === getMainSessionID()) {
499-
updateTerminalTitle({
500-
sessionId: sessionID,
501-
status: "idle",
502-
directory: ctx.directory,
503-
sessionTitle: getCurrentSessionTitle(),
504-
});
505-
}
506453
}
507454
},
508455

@@ -522,16 +469,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
522469
...(isExploreOrLibrarian ? { call_omo_agent: false } : {}),
523470
};
524471
}
525-
526-
if (input.sessionID === getMainSessionID()) {
527-
updateTerminalTitle({
528-
sessionId: input.sessionID,
529-
status: "tool",
530-
currentTool: input.tool,
531-
directory: ctx.directory,
532-
sessionTitle: getCurrentSessionTitle(),
533-
});
534-
}
535472
},
536473

537474
"tool.execute.after": async (input, output) => {
@@ -545,15 +482,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
545482
await emptyTaskResponseDetector?.["tool.execute.after"](input, output);
546483
await agentUsageReminder?.["tool.execute.after"](input, output);
547484
await interactiveBashSession?.["tool.execute.after"](input, output);
548-
549-
if (input.sessionID === getMainSessionID()) {
550-
updateTerminalTitle({
551-
sessionId: input.sessionID,
552-
status: "idle",
553-
directory: ctx.directory,
554-
sessionTitle: getCurrentSessionTitle(),
555-
});
556-
}
557485
},
558486
};
559487
};

0 commit comments

Comments
 (0)