(value: unknown)
| 165 | } |
| 166 | |
| 167 | function hyperplanStrategyParam(value: unknown): OpenADEHyperPlanStrategy | undefined { |
| 168 | if (value === undefined) return undefined |
| 169 | const record = asRecord(value) |
| 170 | const stepsValue = record.steps |
| 171 | if (!Array.isArray(stepsValue)) throw new Error("hyperplanStrategy.steps is invalid") |
| 172 | const steps = stepsValue.map((item) => { |
| 173 | const step = asRecord(item) |
| 174 | const primitive = step.primitive as OpenADEHyperPlanStepPrimitive |
| 175 | if (primitive !== "plan" && primitive !== "review" && primitive !== "reconcile" && primitive !== "revise") { |
| 176 | throw new Error("hyperplanStrategy.steps.primitive is invalid") |
| 177 | } |
| 178 | const agent = asRecord(step.agent) |
| 179 | return { |
| 180 | id: stringParam(step, "id"), |
| 181 | primitive, |
| 182 | agent: { |
| 183 | harnessId: stringParam(agent, "harnessId"), |
| 184 | modelId: stringParam(agent, "modelId"), |
| 185 | }, |
| 186 | inputs: stringArrayParam(step, "inputs") ?? [], |
| 187 | resumeStepId: optionalStringParam(step, "resumeStepId"), |
| 188 | } |
| 189 | }) |
| 190 | |
| 191 | return { |
| 192 | id: stringParam(record, "id"), |
| 193 | name: stringParam(record, "name"), |
| 194 | description: stringParam(record, "description"), |
| 195 | steps, |
| 196 | terminalStepId: stringParam(record, "terminalStepId"), |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | function gitRefsParam(value: unknown): OpenADEActionEventCreateRequest["gitRefsBefore"] { |
| 201 | if (value === undefined) return undefined |
no test coverage detected