import{Ci as J,NK as f,PK as z,Pw as L,Qw as k,SN as _}from"./cli-0.5.12-zc0qwdy2.mjs";import{U8 as F,Z8 as A}from"./cli-0.5.12-g4wb8mj2.mjs";import{Oda as Y,Qda as h,Rda as H,Sda as X}from"./cli-0.5.12-7vxpqr5a.mjs";import{dfa as W,ffa as M}from"./cli-0.5.12-2jxq8gnm.mjs";import{fga as D,iga as R}from"./cli-0.5.12-p5ps8gf0.mjs";import{nka as q,rma as C}from"./cli-0.5.12-c8f4daey.mjs";import{aoa as V}from"./cli-0.5.12-xzeb7mtb.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 W("tengu_session_title_generated",{success:Z!==null}),Z}catch(w){return D(`generateSessionTitle failed: ${w}`,{level:"error"}),W("tengu_session_title_generated",{success:!1}),"Claudin"}}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(()=>{h();C();M();z();R();A();X();_();k();v=H(()=>Y.object({title:Y.string()}))});
export{S as xe,T as ye,I as ze};
