| 643 | } |
| 644 | |
| 645 | func toolInvokeBundle(response ToolInvokeResponseRecord) outputBundle { |
| 646 | return outputBundle{ |
| 647 | jsonValue: response, |
| 648 | human: func() (string, error) { |
| 649 | rows := []keyValue{ |
| 650 | {Label: toolOperatorToolIDValue, Value: response.ToolID.String()}, |
| 651 | {Label: toolOperatorStatusValue, Value: stringOrDash(response.Status)}, |
| 652 | {Label: "Truncated", Value: formatBool(response.Truncated)}, |
| 653 | {Label: cliDurationValue, Value: fmt.Sprintf("%dms", response.DurationMS)}, |
| 654 | {Label: "Bytes", Value: fmt.Sprintf("%d", response.Result.Bytes)}, |
| 655 | } |
| 656 | if preview := strings.TrimSpace(response.Result.Preview); preview != "" { |
| 657 | rows = append(rows, keyValue{Label: toolOperatorPreviewValue, Value: preview}) |
| 658 | } |
| 659 | if len(response.Result.Redactions) > 0 { |
| 660 | rows = append( |
| 661 | rows, |
| 662 | keyValue{Label: "Redactions", Value: fmt.Sprintf("%d", len(response.Result.Redactions))}, |
| 663 | ) |
| 664 | } |
| 665 | return renderHumanSection("Tool Invocation", rows), nil |
| 666 | }, |
| 667 | toon: func() (string, error) { |
| 668 | return renderToonObject( |
| 669 | "tool_invocation", |
| 670 | []string{toolOperatorToolIDKey, automationStatusKey, "truncated", cliDurationMSKey, "bytes"}, |
| 671 | []string{ |
| 672 | response.ToolID.String(), |
| 673 | response.Status, |
| 674 | formatBool(response.Truncated), |
| 675 | fmt.Sprintf("%d", response.DurationMS), |
| 676 | fmt.Sprintf("%d", response.Result.Bytes), |
| 677 | }, |
| 678 | ), nil |
| 679 | }, |
| 680 | } |
| 681 | } |
| 682 | |
| 683 | func toolsetListBundle(response ToolsetsResponseRecord) outputBundle { |
| 684 | return listBundle( |