Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 04:45 UTC
| 1 | import { SchemaIssue } from 'effect'; |
| 2 | import { inspect } from 'node:util'; |
| 3 | |
| 4 | export function extractActual(issue: SchemaIssue.Issue, cap = 50) { |
| 5 | const actual = SchemaIssue.hasInput(issue) ? issue.input : undefined; |
| 6 | |
| 7 | // Cap the length of the actual value to 50 characters |
| 8 | let str: string; |
| 9 | |
| 10 | if (typeof actual === 'object') { |
| 11 | str = inspect(actual, { depth: 2 }); |
| 12 | } else { |
| 13 | str = String(actual); |
| 14 | } |
| 15 | |
| 16 | return str.slice(0, cap) + (str.length > cap ? '...' : ''); |
| 17 | } |