refactor(coding-agent): hardened input schema validation and constraints

- Hardened the `hashline` parameters parsing pipeline to guarantee presence of the `input` field.
- Enforced input length limits on task roles to secure against oversized payloads.
- Configured Arktype schemas to reject or delete extra, undeclared fields in task and inspect-image payloads.
- Updated mock test parameters to align with corrected success exit codes.
This commit is contained in:
can1357
2026-06-18 01:57:23 +02:00
parent d182db3973
commit dd69e0e4fe
4 changed files with 22 additions and 15 deletions
@@ -6,15 +6,14 @@
*/
import { type } from "arktype";
const baseSchema = type({ input: "string" });
const requiredInputSchema = type({ input: "string" });
const inputAliasSchema = type({ "input?": "string", "_input?": "string" });
export const hashlineEditParamsSchema = baseSchema.pipe(raw => {
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return raw;
const record = raw as Record<string, unknown>;
if (typeof record.input === "string" || typeof record._input !== "string") return raw;
return { ...record, input: record._input };
});
export const hashlineEditParamsSchema = inputAliasSchema
.pipe(raw => {
if (raw.input !== undefined || raw._input === undefined) return raw;
return { ...raw, input: raw._input };
})
.pipe(requiredInputSchema);
export type HashlineParams = Parameters<typeof hashlineEditParamsSchema.assert>[0];