fix(tools): improve delegate task constants and sync handling
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -2,6 +2,7 @@ import type {
|
|||||||
AvailableCategory,
|
AvailableCategory,
|
||||||
AvailableSkill,
|
AvailableSkill,
|
||||||
} from "../../agents/dynamic-agent-prompt-builder"
|
} from "../../agents/dynamic-agent-prompt-builder"
|
||||||
|
import { getAgentConfigKey } from "../../shared/agent-display-names"
|
||||||
import { truncateDescription } from "../../shared/truncate-description"
|
import { truncateDescription } from "../../shared/truncate-description"
|
||||||
export {
|
export {
|
||||||
CATEGORY_DESCRIPTIONS,
|
CATEGORY_DESCRIPTIONS,
|
||||||
@@ -329,18 +330,18 @@ export function isPlanAgent(agentName: string | undefined): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plan family: plan + prometheus. Shares mutual delegation blocking only.
|
* Plan family: plan + prometheus. Shares mutual delegation blocking and task tool permission.
|
||||||
* Does NOT share system prompt or task permission (only isPlanAgent controls those).
|
* Does NOT share system prompt (only isPlanAgent controls that).
|
||||||
*/
|
*/
|
||||||
export const PLAN_FAMILY_NAMES = ["plan", "prometheus"]
|
export const PLAN_FAMILY_NAMES = ["plan", "prometheus"]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the given agent belongs to the plan family for mutual delegation blocking.
|
* Check if the given agent belongs to the plan family (blocking + task permission).
|
||||||
*/
|
*/
|
||||||
export function isPlanFamily(category: string): boolean
|
export function isPlanFamily(category: string): boolean
|
||||||
export function isPlanFamily(category: string | undefined): boolean
|
export function isPlanFamily(category: string | undefined): boolean
|
||||||
export function isPlanFamily(category: string | undefined): boolean {
|
export function isPlanFamily(category: string | undefined): boolean {
|
||||||
if (!category) return false
|
if (!category) return false
|
||||||
const lowerCategory = category.toLowerCase().trim()
|
const lowerCategory = getAgentConfigKey(category).toLowerCase().trim()
|
||||||
return PLAN_FAMILY_NAMES.some((name) => lowerCategory === name)
|
return PLAN_FAMILY_NAMES.some((name) => lowerCategory === name)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { DelegateTaskArgs, ToolContextWithMetadata } from "./types"
|
import type { DelegateTaskArgs, ToolContextWithMetadata } from "./types"
|
||||||
import type { ExecutorContext, SessionMessage } from "./executor-types"
|
import type { ExecutorContext, SessionMessage } from "./executor-types"
|
||||||
import { isPlanAgent } from "./constants"
|
import { isPlanFamily } from "./constants"
|
||||||
import { storeToolMetadata } from "../../features/tool-metadata-store"
|
import { storeToolMetadata } from "../../features/tool-metadata-store"
|
||||||
import { resolveCallID } from "./resolve-call-id"
|
import { resolveCallID } from "./resolve-call-id"
|
||||||
import { getTaskToastManager } from "../../features/task-toast-manager"
|
import { getTaskToastManager } from "../../features/task-toast-manager"
|
||||||
@@ -84,7 +84,7 @@ export async function executeSyncContinuation(
|
|||||||
storeToolMetadata(ctx.sessionID, callID, syncContMeta)
|
storeToolMetadata(ctx.sessionID, callID, syncContMeta)
|
||||||
}
|
}
|
||||||
|
|
||||||
const allowTask = isPlanAgent(resumeAgent)
|
const allowTask = isPlanFamily(resumeAgent)
|
||||||
const tddEnabled = sisyphusAgentConfig?.tdd
|
const tddEnabled = sisyphusAgentConfig?.tdd
|
||||||
const effectivePrompt = buildTaskPrompt(args.prompt, resumeAgent, tddEnabled)
|
const effectivePrompt = buildTaskPrompt(args.prompt, resumeAgent, tddEnabled)
|
||||||
const tools = {
|
const tools = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { DelegateTaskArgs, OpencodeClient, DelegatedModelConfig } from "./types"
|
import type { DelegateTaskArgs, OpencodeClient, DelegatedModelConfig } from "./types"
|
||||||
import type { SisyphusAgentConfig } from "../../config/schema"
|
import type { SisyphusAgentConfig } from "../../config/schema"
|
||||||
import { isPlanAgent } from "./constants"
|
import { isPlanFamily } from "./constants"
|
||||||
import { buildTaskPrompt } from "./prompt-builder"
|
import { buildTaskPrompt } from "./prompt-builder"
|
||||||
import {
|
import {
|
||||||
promptSyncWithModelSuggestionRetry,
|
promptSyncWithModelSuggestionRetry,
|
||||||
@@ -64,7 +64,7 @@ export async function sendSyncPrompt(
|
|||||||
},
|
},
|
||||||
deps: SendSyncPromptDeps = sendSyncPromptDeps
|
deps: SendSyncPromptDeps = sendSyncPromptDeps
|
||||||
): Promise<string | null> {
|
): Promise<string | null> {
|
||||||
const allowTask = isPlanAgent(input.agentToUse)
|
const allowTask = isPlanFamily(input.agentToUse)
|
||||||
const tddEnabled = input.sisyphusAgentConfig?.tdd
|
const tddEnabled = input.sisyphusAgentConfig?.tdd
|
||||||
const effectivePrompt = buildTaskPrompt(input.args.prompt, input.agentToUse, tddEnabled)
|
const effectivePrompt = buildTaskPrompt(input.args.prompt, input.agentToUse, tddEnabled)
|
||||||
const tools = {
|
const tools = {
|
||||||
|
|||||||
Reference in New Issue
Block a user