MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / turnParams

Function turnParams

projects/openade-module/src/module.ts:276–314  ·  view source on GitHub ↗
(params: unknown)

Source from the content-addressed store, hash-verified

274}
275
276function turnParams(params: unknown): OpenADETurnStartRequest {
277 const record = asRecord(params)
278 const repoId = record.repoId
279 const input = record.input
280 if (typeof repoId !== "string" || repoId.length < 1) throw new Error("repoId is invalid")
281 if (typeof input !== "string" || input.length > 200_000) throw new Error("input is invalid")
282 const isExistingTurn = typeof record.inTaskId === "string" && record.inTaskId.length > 0
283 if (!isExistingTurn && input.trim().length < 1) throw new Error("input is invalid")
284 if (
285 record.type !== "plan" &&
286 record.type !== "do" &&
287 record.type !== "ask" &&
288 record.type !== "revise" &&
289 record.type !== "run_plan" &&
290 record.type !== "hyperplan"
291 ) {
292 throw new Error("type is invalid")
293 }
294
295 return {
296 repoId,
297 type: record.type,
298 input,
299 clientRequestId: typeof record.clientRequestId === "string" ? record.clientRequestId : undefined,
300 appendSystemPrompt: typeof record.appendSystemPrompt === "string" ? record.appendSystemPrompt : undefined,
301 inTaskId: record.inTaskId === null ? null : typeof record.inTaskId === "string" ? record.inTaskId : undefined,
302 isolationStrategy: record.isolationStrategy as OpenADETurnStartRequest["isolationStrategy"],
303 enabledMcpServerIds: Array.isArray(record.enabledMcpServerIds) ? record.enabledMcpServerIds.filter((id): id is string => typeof id === "string") : undefined,
304 harnessId: typeof record.harnessId === "string" ? record.harnessId : undefined,
305 modelId: typeof record.modelId === "string" ? record.modelId : undefined,
306 label: typeof record.label === "string" ? record.label : undefined,
307 includeComments: typeof record.includeComments === "boolean" ? record.includeComments : undefined,
308 images: Array.isArray(record.images) ? record.images : undefined,
309 thinking: record.thinking === "low" || record.thinking === "med" || record.thinking === "high" || record.thinking === "max" ? record.thinking : undefined,
310 fastMode: typeof record.fastMode === "boolean" ? record.fastMode : undefined,
311 title: typeof record.title === "string" ? record.title : undefined,
312 hyperplanStrategy: hyperplanStrategyParam(record.hyperplanStrategy),
313 }
314}
315
316function reviewStartParams(params: unknown): OpenADEReviewStartRequest {
317 const record = asRecord(params)

Callers 1

registerFunction · 0.85

Calls 2

hyperplanStrategyParamFunction · 0.85
asRecordFunction · 0.70

Tested by

no test coverage detected