id: agent-coding
name: Agent Coding Tasks
kind: code
version: 1
description: TypeScript/code-edit tasks similar to BooCoder dispatches, sandboxed pass@1.
judge_model: null
tasks:
  - id: ts-function-implement
    prompt: "Write a TypeScript function `flatten<T>(arr: T[][]): T[]` that flattens a nested array one level deep. Export it as default. Include the type signature."
    test_code: "import flatten from './output.js'; const result = flatten([[1, 2], [3], [4, 5, 6]]); console.log(JSON.stringify(result));"
    expected_output: "[1,2,3,4,5,6]"
    language: typescript
  - id: ts-binary-search
    prompt: "Implement binary search in TypeScript: `binarySearch(arr: number[], target: number): number` that returns the index or -1. Export as default."
    test_code: "import binarySearch from './output.js'; console.log(binarySearch([1, 3, 5, 7, 9], 5)); console.log(binarySearch([1, 3, 5, 7, 9], 4));"
    expected_output: "2\n-1"
    language: typescript
  - id: ts-debounce
    prompt: "Write a TypeScript debounce function: `debounce<T extends (...args: unknown[]) => unknown>(fn: T, ms: number): (...args: Parameters<T>) => void`. Export as default."
    test_code: "import debounce from './output.js'; typeof debounce(() => {}, 100) === 'function' && console.log('ok');"
    expected_output: "ok"
    language: typescript
  - id: ts-lru-cache
    prompt: "Implement an LRU Cache in TypeScript: class LRUCache { constructor(capacity: number); get(key: string): string | undefined; set(key: string, value: string): void; } Export as default."
    test_code: "import LRUCache from './output.js'; const cache = new LRUCache(2); cache.set('a', '1'); cache.set('b', '2'); console.log(cache.get('a')); cache.set('c', '3'); console.log(cache.get('a'));"
    expected_output: "1\nundefined"
    language: typescript
  - id: ts-promise-allsettled
    prompt: "Implement `myAllSettled<T>(promises: Promise<T>[]): Promise<Array<{status: 'fulfilled', value: T} | {status: 'rejected', reason: unknown}>>` without using Promise.allSettled. Export as default."
    test_code: "import myAllSettled from './output.js'; const results = await myAllSettled([Promise.resolve(1), Promise.reject('err')]); console.log(results.map(r => r.status).join(','));"
    expected_output: "fulfilled,rejected"
    language: typescript
