6  0     þ                        ô     �           $   gˆØ×Ü437Öa–Ãa¾”J_)â‚ÁàS�ÿÚ µ    g‹      �“_o›0Åßû)îüÐ7¸ù·ikU‘)M¢”išª>8Ø€5ÀÈ¾ë>ý dj:5Z·'¸æçãsîÅüM¼Ž’¯›9|Jn–°ùüq¹ˆ€yˆ_¦bœÄÃ‡™?#ÎWXAÔ\ ¶më·SßØ“-T•3tduJ¾$ÉÂ3Þ¯…gÀ%d÷NšJ.j©~€É Í9-ÕœEW«0359T†8t·|gäc¯;~µF‡î»½TÿjCN|¥Îë€‘iXÈu•ƒ³iÀP§¦v¸+EýÍÏuÆ@”°»E´¾ï8¤¢ßr…UYÀ®¢`u¹®Y¸•â(^fnf)Ae¤Î´’'áÛ¾Õ?OÆ+—ZÝ�6õŠ]Äã¨©)]#º¬o»…=¦Dþ­"}ÖŒÍõv¾JâÅvh‰ì%žÜ�ž7]QÄÚª”Œ}<˜Îë�k.—p°du^<x‘ü‡™)¥²ÇINeèýz¢UÎTª³ý¬<öü‡ÉÉh2õF¼É{Ï.&ï þ+Í+g‡‡¿šãþ^pîÛ/i�¥|Ò       iˆÙØÝ446×¾Ú ¾    i‹      Å“OOÛ0Æï|
ÏnÍ”]†ã‰%•V©´UÉ„&´ƒc;±EGö|zœ¦�@—íä?¿~žÇ6û”¯²âçzF¾²þñm1Ï� \M3€¼ÈÇ…Óäè`¶¤„ÄþÀv»M¶ÓÄùŠl›Sè­ÄD¡¢ü€sü€0£…Š-ah±Ñ|Þ)ý›¸Š€»Å`•Ž•ûÛ²±òi”kÝ©Ê6:Qºu‰	‰t®�)'Ã$„æÏöxm+`ÛƒÒh!hŒ%zïäÍÐ»›&G0­Œ¢*ØËb¥S÷ƒÚãÿ¬,
Ø…$Ê�À¡ë9CCîDcë.¥èzÊ™mk¼L)Xéº e#º›¤¶%¢Á”^Ï³Õ¯Èša7g‚¯«”~ÍÒåÙ*Í)_ŠV3o3‘9§|!’Ö)[Y­Þ…/GøÒ>¼_0™\ém�ÖuÏ(D‹/­J×„^D¯Ÿ£ã_R#¢þ–†�¯ÂXŸofË"ŸoÆHÔPâYÝ?¿gÊ×ÂëIn½–èüý>‹QØaW†þìiHöN½­RNÈ„¼I~$DØ?/»gÏ`ü¤�D�äk       kˆÙØÝ448×¾Ú À    k‹      Å“OoÛ ÆïýŒÃnñ›,ÝeÅL�i‘Ò$J=UÓ´lPmcÁÛfí§/ŽÓµ•ZM»l'þýxyž`ïòMV|ß.È×âbE¶ß¾¬–¡€«y�ù¸pšLg ‹5%Ô öŸ öû}²Ÿ'Î×PìÀ`ÛœB@o%&
å'l˜ã'„-Tl	C‹�æËNé_ÄUÜ«ôôÜ‹¶
ú›²±òq”kÝ©Ê6:Qºu‰	‰t®�ç)'Ã$„æw•`ÛƒÒh!hŒ{{ïäõÐ»�'S˜WFQe±Ò©»Aíì?+‹!‰ò pèzÎÐ�[ÑØºK)ºžrfÛš/S
Vº.@Ùˆî:©mE‰h0¥?–Ùægä Í°›3AŒ×UJ?géúl“æ”¯E«ˆ×™‹ÈœS¾Ië”­¬VoÂ—#|iïß.˜�L®ƒô¶Gëº'¢ÅçV¥kB/¢×�Ñ�ñÏ©QJCÈalÏw‹u‘/wc$j(ñ¤îŸß3å[áu‡$·^Ktþî˜Å(ì}W†þìqHŽN½­RNÈ„¼JþMˆp|^ÏžÁøI Z¤¨       mˆÙØÝ462×¾Ú Î    m‹      ­“QoÚ0…ßû+îü°7r�0©jOADSmÓ´b5‰#û¶”þú%„µtm•öÛÉ—sÏ¹¶ù»x6L¾ÏGð9¹žÀüöÓd<ÖAüã$n?‚nq4eÀ2¢êq³Ù›0°n�É3*òzr&¥@‘bâŒ7ïÄðLKU�ÀÉP®Å¸Túì
ÐÞ“7JðÞ;ô™tI?ææa7«Ž2žš)æ²yjeÒÌÞé-ÇVªÇ½:_ZµmŠöþO�ZggY.wuš©œ2x�¹Y—#[1ÁM±ïÒˆ¡Iméq™Ëò.X›™SÄ~Œ‡³Ÿ5‡”5.!sz±�Ãhz9‹b&¦²Ðåqæºf®˜˜HOPXeVF«“ðMß˜§Ó‚qËÄÚ§ÎTdlù‚bñ0jjs_É:ë‡:Aæ©Që†L_5c~µM“x¼h[¢‰woÞ.&æ5SÄÆé”¬Ûî³´ÂïË¥¯./aïÔ™uFL tà(ù†xµ:Œ—|KŽ{>V�§-¯–‡Žÿ°Øïö»�îy'ìA?¼è�œ Ã ür:Ë?n(î�:ÇÝMâØ^ß_–.!    E   oˆl–Ãa¾”ªi?u8 ¸Û71hß�þBÓÏ¬ã�f1�¡‘¦™þßƒlM»Þ_�uÐb&=LyZËcõÀÜ ‰    o# Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/

# How every tool shows what it returns, so that the model meets each kind of object in one form whichever tool
#   returned it: a row â€” one line of facts, and the object's title below it â€” and texts, each marked with its source
#   and cut to a length. Each part has the same facts twice: in the content for the UI, which an MCP client may also
#   hand its model, and in the text for the model. A class per kind of object builds its parts from these, such as
#   Service::AI::Tool::Output::Ticket.
class Service::AI::Tool::Output
  Part = Data.define(:content, :text)

  # A text as far as it is shown, with a note on how much of it that is where it is cut.
  Cut = Data.define(:text, :truncated, :part, :full_length, :note)

  # How much text before a match a passage keeps, so that a long text shows where the match stands.
  PASSAGE_LEAD = 100

  # What stands for the rest of a cut text.
  CUT_OMISSION = ' â€¦'.freeze

  class << self
    # The kinds of object the tools return as rows, each named by the type its class's schema fixes.
    #
    # @return [Array<String>]
    def row_types
      descendants.filter_map { |output| output::SCHEMA.dig(:properties, :type, :const) if output.const_defined?(:SCHEMA, false) }.uniq
    end

    # In the system's time zone, as in the context block of a run, and as a time field reads.
    def time(value)
      Service::EntityAttribute::Type::Timestamp.format(value)
    end

    # The time zone of every time a tool shows.
    def time_zone
      Service::EntityAttribute::Type::Timestamp.time_zone
    end

    # How long each of several texts may be when they share a budget: an even share each, and what a shorter text
    #   leaves passes on to the longer ones.
    #
    # @param lengths [Array<Integer>] the texts' full lengths
    # @return [Array<Integer>] each text's length, in the order given
    def shared_lengths(lengths, budget:)
      remaining = budget
   