import{AN as _,BK as z,Ow as L,Pw as k,oi as J,zK as f}from"./cli-0.5.4-k5fz4zd3.mjs";import{V8 as F,_8 as A}from"./cli-0.5.4-cbq01zg3.mjs";import{Gca as W,Ica as R,Jca as H,Kca as X}from"./cli-0.5.4-37v5fhf1.mjs";import{Nea as Y,Pea as h}from"./cli-0.5.4-09dvrzcr.mjs";import{Pfa as D,Sfa as M}from"./cli-0.5.4-end8wj9r.mjs";import{eka as q,ima as C}from"./cli-0.5.4-jmc3bzbn.mjs";import{Zma as V}from"./cli-0.5.4-aacw1src.mjs";function S(U){let Q=[];for(let w of U){if(w.type!=="user"&&w.type!=="assistant")continue;if("isMeta"in w&&w.isMeta)continue;if("origin"in w&&w.origin&&w.origin.kind!=="human")continue;let K=w.message.content;if(typeof K==="string")Q.push(K);else if(Array.isArray(K)){for(let B of K)if("type"in B&&B.type==="text"&&"text"in B)Q.push(B.text)}}let G=Q.join(`
`);return G.length>$?G.slice(-$):G}async function T(U,Q){let G=U.trim();if(!G)return null;try{let w=await f({systemPrompt:L([P]),userPrompt:G,outputFormat:{type:"json_schema",schema:{type:"object",properties:{title:{type:"string"}},required:["title"],additionalProperties:!1}},signal:Q,options:{querySource:"generate_session_title",agents:[],isNonInteractiveSession:q(),hasAppendSystemPrompt:!1,mcpTools:[]}}),K=J(w.message.content),B=v().safeParse(F(K)),Z=B.success?B.data.title.trim()||null:null;return Y("tengu_session_title_generated",{success:Z!==null}),Z}catch(w){return D(`generateSessionTitle failed: ${w}`,{level:"error"}),Y("tengu_session_title_generated",{success:!1}),"Claudio"}}var $=1000,P=`Generate a concise, sentence-case title (3-7 words) that captures the main topic or goal of this coding session. The title should be clear enough that the user recognizes the session in a list. Use sentence case: capitalize only the first word and proper nouns.

Return JSON with a single "title" field.

Good examples:
{"title": "Fix login button on mobile"}
{"title": "Add OAuth authentication"}
{"title": "Debug failing CI tests"}
{"title": "Refactor API client error handling"}

Bad (too vague): {"title": "Code changes"}
Bad (too long): {"title": "Investigate and fix the issue where the login button does not respond on mobile devices"}
Bad (wrong case): {"title": "Fix Login Button On Mobile"}`,v;var I=V(()=>{R();C();h();z();M();A();X();_();k();v=H(()=>W.object({title:W.string()}))});
export{S as ne,T as oe,I as pe};
