| 314 | } |
| 315 | |
| 316 | function reviewStartParams(params: unknown): OpenADEReviewStartRequest { |
| 317 | const record = asRecord(params) |
| 318 | const repoId = record.repoId |
| 319 | const taskId = record.taskId |
| 320 | const harnessId = record.harnessId |
| 321 | const modelId = record.modelId |
| 322 | if (typeof repoId !== "string" || repoId.length < 1) throw new Error("repoId is invalid") |
| 323 | if (typeof taskId !== "string" || taskId.length < 1) throw new Error("taskId is invalid") |
| 324 | if (record.reviewType !== "plan" && record.reviewType !== "work") throw new Error("reviewType is invalid") |
| 325 | if (typeof harnessId !== "string" || harnessId.length < 1) throw new Error("harnessId is invalid") |
| 326 | if (typeof modelId !== "string" || modelId.length < 1) throw new Error("modelId is invalid") |
| 327 | return { |
| 328 | repoId, |
| 329 | taskId, |
| 330 | reviewType: record.reviewType, |
| 331 | harnessId, |
| 332 | modelId, |
| 333 | customInstructions: typeof record.customInstructions === "string" ? record.customInstructions : undefined, |
| 334 | clientRequestId: typeof record.clientRequestId === "string" ? record.clientRequestId : undefined, |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | function actionSourceParam(value: unknown): OpenADEActionEventCreateRequest["source"] { |
| 339 | const source = asRecord(value) |