Download packages/agent-core-v2/src/debug/scopeTree.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 1.31 kB
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/src/debug/scopeTree.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/agent-core-v2/src/debug/scopeTree.ts
-
curl -L -o scopeTree.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/src/debug/scopeTree.ts
1.31 kB
| import type { CascadeEngine } from '#/_base/di/cascadeEngine'; | |
| import type { InstantiationService } from '#/_base/di/instantiationService'; | |
| export interface ScopeContainerInfo { | |
| readonly container: InstantiationService; | |
| readonly path: string; | |
| readonly label: string; | |
| } | |
| export function scopeContainerLabel(container: InstantiationService): string { | |
| return container.debugLabel ?? `#${container.cascadeTree.seqOf(container)}`; | |
| } | |
| export function walkScopeContainers(root: InstantiationService): ScopeContainerInfo[] { | |
| const out: ScopeContainerInfo[] = []; | |
| const visit = (container: InstantiationService, path: string): void => { | |
| out.push({ container, path, label: scopeContainerLabel(container) }); | |
| for (const child of container.children) { | |
| visit(child, `${path}/${scopeContainerLabel(child)}`); | |
| } | |
| }; | |
| visit(root, scopeContainerLabel(root)); | |
| return out; | |
| } | |
| export function resolveScopeContainer( | |
| root: InstantiationService, | |
| path: string, | |
| ): InstantiationService | undefined { | |
| return walkScopeContainers(root).find((info) => info.path === path)?.container; | |
| } | |
| export function scopePathOfEngine( | |
| root: InstantiationService, | |
| engine: CascadeEngine, | |
| ): string | undefined { | |
| return walkScopeContainers(root).find((info) => info.container.cascade === engine)?.path; | |
| } | |