| 101 | |
| 102 | |
| 103 | def _print_invocation( |
| 104 | skill_name: str, args: str, ctx: ToolContext |
| 105 | ) -> None: |
| 106 | result = SkillTool.call({"skill": skill_name, "args": args}, ctx) |
| 107 | out = result.output |
| 108 | head = f"--- /{skill_name}" |
| 109 | if args: |
| 110 | head += f' "{args}"' |
| 111 | head += " ---" |
| 112 | print(f"\n{head}") |
| 113 | if not out.get("success"): |
| 114 | print(f" ERROR: {out}") |
| 115 | return |
| 116 | prompt = out["prompt"] |
| 117 | preview = prompt if len(prompt) <= PREVIEW_CHARS else ( |
| 118 | prompt[:PREVIEW_CHARS] + f"\n... [truncated, total {len(prompt)} chars]" |
| 119 | ) |
| 120 | for line in preview.splitlines(): |
| 121 | print(f" {line}") |
| 122 | if out.get("loadedFrom"): |
| 123 | print(f" [loadedFrom={out['loadedFrom']}, allowedTools={out.get('allowedTools')}]") |
| 124 | |
| 125 | |
| 126 | def main() -> int: |