#!/usr/bin/env python3 # -*- coding: utf-8 -*- """专题七 · 步骤 2:查工作区 Shell Provider 与新 Agent 快照 tools 配置。""" 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() for path in ( "/workspaces/current/tools/builtin", "/workspaces/current/tool-providers", "/workspaces/current/tools", ): r = d.get(path) print("GET", path, "HTTP", r["code"], (r["text"] or "")[:300]) out, err = d.sh( "docker exec %s psql -U postgres -d dify -t -A -c " "\"SELECT config_snapshot::json -> 'tools' " "FROM agent_config_snapshots WHERE id='%s'\"" % (C.PG_CONTAINER, C.SNAP_ID) ) print("\nsnapshot.tools:", out.strip() or err) return 0 finally: d.close() if __name__ == "__main__": sys.exit(main())