fix: preserve tuple items in schema build and harden athena prompt path guard
This commit is contained in:
@@ -25,8 +25,10 @@ function removeDefaultedFromRequired(schema: Record<string, unknown>): Record<st
|
|||||||
result.properties = newProps
|
result.properties = newProps
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.items && typeof result.items === "object") {
|
if (result.items && typeof result.items === "object" && !Array.isArray(result.items)) {
|
||||||
result.items = removeDefaultedFromRequired(result.items as Record<string, unknown>)
|
result.items = removeDefaultedFromRequired(result.items as Record<string, unknown>)
|
||||||
|
} else if (Array.isArray(result.items)) {
|
||||||
|
result.items = result.items.map((item) => removeDefaultedFromRequired(item as Record<string, unknown>))
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of ["allOf", "anyOf", "oneOf"]) {
|
for (const key of ["allOf", "anyOf", "oneOf"]) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { tool, type ToolDefinition } from "@opencode-ai/plugin"
|
import { tool, type ToolDefinition } from "@opencode-ai/plugin"
|
||||||
import { readFile } from "node:fs/promises"
|
import { readFile } from "node:fs/promises"
|
||||||
import { resolve } from "node:path"
|
import { resolve, sep } from "node:path"
|
||||||
import type { BackgroundManager } from "../../features/background-agent"
|
import type { BackgroundManager } from "../../features/background-agent"
|
||||||
import type { CouncilConfig, CouncilMemberConfig } from "../../config/schema/athena"
|
import type { CouncilConfig, CouncilMemberConfig } from "../../config/schema/athena"
|
||||||
import { launchCouncilMember, type CouncilLaunchContext } from "./council-launcher"
|
import { launchCouncilMember, type CouncilLaunchContext } from "./council-launcher"
|
||||||
@@ -128,7 +128,7 @@ export function createAthenaCouncilTool(args: {
|
|||||||
let promptContent: string
|
let promptContent: string
|
||||||
try {
|
try {
|
||||||
const resolvedPath = resolve(directory, toolArgs.prompt_file)
|
const resolvedPath = resolve(directory, toolArgs.prompt_file)
|
||||||
const expectedPrefix = resolve(directory, ".sisyphus/tmp")
|
const expectedPrefix = `${resolve(directory, ".sisyphus/tmp")}${sep}`
|
||||||
if (!resolvedPath.startsWith(expectedPrefix)) {
|
if (!resolvedPath.startsWith(expectedPrefix)) {
|
||||||
return `Invalid prompt_file path: expected path within .sisyphus/tmp/, got: ${toolArgs.prompt_file}`
|
return `Invalid prompt_file path: expected path within .sisyphus/tmp/, got: ${toolArgs.prompt_file}`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user