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

Function depth

projects/openade-module/src/hyperplan.ts:313–324  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

311 const stepMap = new Map(strategy.steps.map((step) => [step.id, step]))
312 const depthMap = new Map<string, number>()
313 function depth(id: string): number {
314 const existing = depthMap.get(id)
315 if (existing !== undefined) return existing
316 const step = stepMap.get(id)
317 if (!step || step.inputs.length === 0) {
318 depthMap.set(id, 0)
319 return 0
320 }
321 const value = Math.max(...step.inputs.map(depth)) + 1
322 depthMap.set(id, value)
323 return value
324 }
325
326 const groups = new Map<number, OpenADEHyperPlanStep[]>()
327 for (const step of strategy.steps) {

Callers 1

Calls 2

getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected