#!/usr/bin/env python3 # -*- coding: utf-8 -*- """定位 trace_manager 在创建新 Agent 时的初始化位置。""" from __future__ import annotations import sys import _bootstrap # noqa: F401 import _config as C from dify_api import Dify def main() -> int: d = Dify(C.DIFY_EMAIL, C.DIFY_PASSWORD) try: d.login() cmd = ( "docker exec docker-api-1 sh -lc " "\"grep -RIn --line-number 'TraceQueueManager(' /app/api/core | head -60\"" ) out, err = d.sh(cmd, t=240) print(out or err) return 0 finally: d.close() if __name__ == '__main__': sys.exit(main())