mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-16 20:01:59 +00:00
style: fix background task formatting
This commit is contained in:
parent
ecde8ab363
commit
1357bb984f
5 changed files with 22 additions and 12 deletions
|
|
@ -2000,7 +2000,8 @@ function Task(props: ToolProps<typeof TaskTool>) {
|
|||
|
||||
const content = createMemo(() => {
|
||||
if (!props.input.description) return ""
|
||||
const description = props.metadata.background === true ? `${props.input.description} (background)` : props.input.description
|
||||
const description =
|
||||
props.metadata.background === true ? `${props.input.description} (background)` : props.input.description
|
||||
let content = [`${Locale.titlecase(props.input.subagent_type ?? "General")} Task — ${description}`]
|
||||
|
||||
if (isRunning() && tools().length > 0) {
|
||||
|
|
|
|||
|
|
@ -80,9 +80,9 @@ export const layer: Layer.Layer<
|
|||
| Todo.Service
|
||||
| Agent.Service
|
||||
| Skill.Service
|
||||
| Session.Service
|
||||
| SessionStatus.Service
|
||||
| Provider.Service
|
||||
| Session.Service
|
||||
| SessionStatus.Service
|
||||
| Provider.Service
|
||||
| LSP.Service
|
||||
| Instruction.Service
|
||||
| AppFileSystem.Service
|
||||
|
|
|
|||
|
|
@ -66,7 +66,11 @@ export const TaskStatusTool = Tool.define(
|
|||
}
|
||||
|
||||
const latestUser = yield* sessions.findMessage(taskID, (item) => item.info.role === "user")
|
||||
if (Option.isSome(latestUser) && latestUser.value.info.role === "user" && latestUser.value.info.id > latestAssistant.value.info.id) {
|
||||
if (
|
||||
Option.isSome(latestUser) &&
|
||||
latestUser.value.info.role === "user" &&
|
||||
latestUser.value.info.id > latestAssistant.value.info.id
|
||||
) {
|
||||
return {
|
||||
state: "running" as const,
|
||||
text: "Task is starting.",
|
||||
|
|
@ -96,8 +100,12 @@ export const TaskStatusTool = Tool.define(
|
|||
}
|
||||
})
|
||||
|
||||
const waitForTerminal: (taskID: SessionID, timeout: number) => Effect.Effect<{ result: InspectResult; timedOut: boolean }> =
|
||||
Effect.fn("TaskStatusTool.waitForTerminal")(function* (taskID: SessionID, timeout: number) {
|
||||
const waitForTerminal: (
|
||||
taskID: SessionID,
|
||||
timeout: number,
|
||||
) => Effect.Effect<{ result: InspectResult; timedOut: boolean }> = Effect.fn(
|
||||
"TaskStatusTool.waitForTerminal",
|
||||
)(function* (taskID: SessionID, timeout: number) {
|
||||
const result = yield* inspect(taskID)
|
||||
if (result.state !== "running") return { result, timedOut: false }
|
||||
if (timeout <= 0) return { result, timedOut: true }
|
||||
|
|
|
|||
|
|
@ -336,10 +336,10 @@ describe("tool.task", () => {
|
|||
const result = yield* def.execute(
|
||||
{
|
||||
description: "inspect bug",
|
||||
prompt: "look into the cache key path",
|
||||
subagent_type: "general",
|
||||
task_id: SessionID.make("ses_missing"),
|
||||
},
|
||||
prompt: "look into the cache key path",
|
||||
subagent_type: "general",
|
||||
task_id: SessionID.make("ses_missing"),
|
||||
},
|
||||
{
|
||||
sessionID: chat.id,
|
||||
messageID: assistant.id,
|
||||
|
|
|
|||
|
|
@ -1751,7 +1751,8 @@ ToolRegistry.register({
|
|||
const title = createMemo(() => agent().name ?? i18n.t("ui.tool.agent.default"))
|
||||
const tone = createMemo(() => agent().color)
|
||||
const subtitle = createMemo(() => {
|
||||
const value = typeof props.input.description === "string" && props.input.description ? props.input.description : childSessionId()
|
||||
const value =
|
||||
typeof props.input.description === "string" && props.input.description ? props.input.description : childSessionId()
|
||||
if (!value) return value
|
||||
if (props.metadata.background === true) return `${value} (background)`
|
||||
return value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue