feat: add toast notifications for task execution
- Display toast when background task starts in BackgroundManager - Display toast when sisyphus_task sync task starts - Wire up prometheus-md-only hook initialization in main plugin This provides user feedback in OpenCode TUI where task TUI is not visible. 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
parent
0c10be4f61
commit
f354724e64
@ -122,6 +122,19 @@ export class BackgroundManager {
|
|||||||
|
|
||||||
log("[background-agent] Launching task:", { taskId: task.id, sessionID, agent: input.agent })
|
log("[background-agent] Launching task:", { taskId: task.id, sessionID, agent: input.agent })
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
const tuiClient = this.client as any
|
||||||
|
if (tuiClient.tui?.showToast) {
|
||||||
|
tuiClient.tui.showToast({
|
||||||
|
body: {
|
||||||
|
title: "Background Task Started",
|
||||||
|
message: `"${input.description}" running with ${input.agent}`,
|
||||||
|
variant: "info",
|
||||||
|
duration: 3000,
|
||||||
|
},
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
this.client.session.promptAsync({
|
this.client.session.promptAsync({
|
||||||
path: { id: sessionID },
|
path: { id: sessionID },
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@ -29,6 +29,7 @@ import {
|
|||||||
createTaskResumeInfoHook,
|
createTaskResumeInfoHook,
|
||||||
createStartWorkHook,
|
createStartWorkHook,
|
||||||
createSisyphusOrchestratorHook,
|
createSisyphusOrchestratorHook,
|
||||||
|
createPrometheusMdOnlyHook,
|
||||||
} from "./hooks";
|
} from "./hooks";
|
||||||
import {
|
import {
|
||||||
contextCollector,
|
contextCollector,
|
||||||
@ -198,6 +199,10 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
? createSisyphusOrchestratorHook(ctx)
|
? createSisyphusOrchestratorHook(ctx)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
const prometheusMdOnly = isHookEnabled("prometheus-md-only")
|
||||||
|
? createPrometheusMdOnlyHook(ctx)
|
||||||
|
: null;
|
||||||
|
|
||||||
const taskResumeInfo = createTaskResumeInfoHook();
|
const taskResumeInfo = createTaskResumeInfoHook();
|
||||||
|
|
||||||
const backgroundManager = new BackgroundManager(ctx);
|
const backgroundManager = new BackgroundManager(ctx);
|
||||||
@ -451,6 +456,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
await directoryAgentsInjector?.["tool.execute.before"]?.(input, output);
|
await directoryAgentsInjector?.["tool.execute.before"]?.(input, output);
|
||||||
await directoryReadmeInjector?.["tool.execute.before"]?.(input, output);
|
await directoryReadmeInjector?.["tool.execute.before"]?.(input, output);
|
||||||
await rulesInjector?.["tool.execute.before"]?.(input, output);
|
await rulesInjector?.["tool.execute.before"]?.(input, output);
|
||||||
|
await prometheusMdOnly?.["tool.execute.before"]?.(input, output);
|
||||||
|
|
||||||
if (input.tool === "task") {
|
if (input.tool === "task") {
|
||||||
const args = output.args as Record<string, unknown>;
|
const args = output.args as Record<string, unknown>;
|
||||||
|
|||||||
@ -243,6 +243,19 @@ System notifies on completion. Use \`background_output\` with task_id="${task.id
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
const tuiClient = client as any
|
||||||
|
if (tuiClient.tui?.showToast) {
|
||||||
|
tuiClient.tui.showToast({
|
||||||
|
body: {
|
||||||
|
title: "Task Started",
|
||||||
|
message: `"${args.description}" running with ${agentToUse}`,
|
||||||
|
variant: "info",
|
||||||
|
duration: 3000,
|
||||||
|
},
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
const createResult = await client.session.create({
|
const createResult = await client.session.create({
|
||||||
body: {
|
body: {
|
||||||
parentID: ctx.sessionID,
|
parentID: ctx.sessionID,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user