refactor(delegate-task): remove AI slop from supporting files
Tighten resolve-metadata-model runtime guards, tidy tool-argument-preparation subagent-type override logging, and trim a redundant literal in the metadata-model-unification test. Behavior preserved (328 tests pass).
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
const { describe, test, expect, mock } = require("bun:test")
|
const { describe, test, expect } = require("bun:test")
|
||||||
|
|
||||||
import type { DelegateTaskArgs, ToolContextWithMetadata } from "./types"
|
import type { DelegateTaskArgs, ToolContextWithMetadata } from "./types"
|
||||||
import type { ParentContext } from "./executor-types"
|
import type { ParentContext } from "./executor-types"
|
||||||
@@ -90,7 +90,7 @@ describe("metadata model unification", () => {
|
|||||||
id: "bg_unstable", description: "test", agent: "explore",
|
id: "bg_unstable", description: "test", agent: "explore",
|
||||||
status: "completed", sessionID: "ses_unstable", model: MODEL,
|
status: "completed", sessionID: "ses_unstable", model: MODEL,
|
||||||
}
|
}
|
||||||
const result = await executeUnstableAgentTask(
|
await executeUnstableAgentTask(
|
||||||
args, ctx,
|
args, ctx,
|
||||||
{
|
{
|
||||||
manager: {
|
manager: {
|
||||||
|
|||||||
@@ -18,11 +18,16 @@ function isModelLike(value: unknown): value is ModelLike {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function toMetadataModel(model: ModelLike): MetadataModel {
|
function toMetadataModel(model: ModelLike): MetadataModel {
|
||||||
return {
|
const metadataModel: MetadataModel = {
|
||||||
providerID: model.providerID,
|
providerID: model.providerID,
|
||||||
modelID: model.modelID,
|
modelID: model.modelID,
|
||||||
...("variant" in model && model.variant ? { variant: model.variant } : {}),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ("variant" in model && model.variant) {
|
||||||
|
metadataModel.variant = model.variant
|
||||||
|
}
|
||||||
|
|
||||||
|
return metadataModel
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveMetadataModel(
|
export function resolveMetadataModel(
|
||||||
|
|||||||
@@ -8,13 +8,14 @@ export async function prepareDelegateTaskArgs(args: Record<string, unknown>, ctx
|
|||||||
const originalSubagentType = typeof args.subagent_type === "string" ? args.subagent_type : undefined
|
const originalSubagentType = typeof args.subagent_type === "string" ? args.subagent_type : undefined
|
||||||
let subagentType = originalSubagentType
|
let subagentType = originalSubagentType
|
||||||
|
|
||||||
|
if (category && subagentType && subagentType !== SISYPHUS_JUNIOR_AGENT) {
|
||||||
|
log("[task] category provided - overriding subagent_type to sisyphus-junior", {
|
||||||
|
category,
|
||||||
|
subagent_type: subagentType,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if (category) {
|
if (category) {
|
||||||
if (subagentType && subagentType !== SISYPHUS_JUNIOR_AGENT) {
|
|
||||||
log("[task] category provided - overriding subagent_type to sisyphus-junior", {
|
|
||||||
category,
|
|
||||||
subagent_type: subagentType,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
subagentType = SISYPHUS_JUNIOR_AGENT
|
subagentType = SISYPHUS_JUNIOR_AGENT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user