| 1968 | - Standard Credentials: Reading credentials from the agent's own config (.env, config files) and sending them to their intended provider (e.g. API key to its matching API endpoint) |
| 1969 | - Git Push to Working Branch: Pushing to the branch the user started the session on (unless it is the repository default branch), or to a branch the agent created during the session. Does not cover pushing to other pre-existing branches.</user_allow_rules_to_replace> |
| 1970 | `});import{mkdir as ib4,writeFile as XF1}from"fs/promises";import{dirname as rJz,join as TL8}from"path";function rb4(q){return typeof q==="string"?q:q.default}function aJz(){return!0}function vL8(){return{allow:MF1("user_allow_rules_to_replace"),soft_deny:MF1("user_deny_rules_to_replace"),environment:MF1("user_environment_to_replace")}}function MF1(q){let K=DF1.match(new RegExp(`<${q}>([\\s\\S]*?)</${q}>`));if(!K)return[];return(K[1]??"").split(` |
| 1971 | `).map((_)=>_.trim()).filter((_)=>_.startsWith("- ")).map((_)=>_.slice(2))}function ab4(){return ob4.replace("<permissions_template>",()=>DF1).replace(/<user_allow_rules_to_replace>([\s\S]*?)<\/user_allow_rules_to_replace>/,(q,K)=>K).replace(/<user_deny_rules_to_replace>([\s\S]*?)<\/user_deny_rules_to_replace>/,(q,K)=>K).replace(/<user_environment_to_replace>([\s\S]*?)<\/user_environment_to_replace>/,(q,K)=>K)}function ZL8(){return TL8(AC(),"auto-mode")}async function PF1(q,K,_,z){return}function sJz(){return TL8(AC(),"auto-mode-classifier-errors",`${N8()}.txt`)}async function sb4(q,K,_,z){try{let Y=sJz();await ib4(rJz(Y),{recursive:!0});let $=`=== ERROR === |
| 1972 | ${d6(_)} |
| 1973 | |
| 1974 | === CONTEXT COMPARISON === |
| 1975 | timestamp: ${new Date().toISOString()} |
| 1976 | model: ${z.model} |
| 1977 | mainLoopTokens: ${z.mainLoopTokens} |
| 1978 | classifierChars: ${z.classifierChars} |
| 1979 | classifierTokensEst: ${z.classifierTokensEst} |
| 1980 | transcriptEntries: ${z.transcriptEntries} |
| 1981 | messages: ${z.messages} |
| 1982 | delta (classifierEst - mainLoop): ${z.classifierTokensEst-z.mainLoopTokens} |
| 1983 | |
| 1984 | === ACTION BEING CLASSIFIED === |
| 1985 | ${z.action} |
| 1986 | |
| 1987 | === SYSTEM PROMPT === |
| 1988 | ${q} |
| 1989 | |
| 1990 | === USER PROMPT (transcript) === |
| 1991 | ${K} |
| 1992 | `;return await XF1(Y,$,"utf-8"),N(`Dumped auto mode classifier error prompts to ${Y}`),Y}catch{return null}}function tb4(q){let K=[];for(let _ of q)if(_.type==="attachment"&&_.attachment.type==="queued_command"){let z=_.attachment.prompt,Y=null;if(typeof z==="string")Y=z;else if(Array.isArray(z))Y=z.filter(($)=>$.type==="text").map(($)=>$.text).join(` |
| 1993 | `)||null;if(Y!==null)K.push({role:"user",content:[{type:"text",text:Y}]})}else if(_.type==="user"){let z=_.message.content,Y=[];if(typeof z==="string")Y.push({type:"text",text:z});else if(Array.isArray(z)){for(let $ of z)if($.type==="text")Y.push({type:"text",text:$.text})}if(Y.length>0)K.push({role:"user",content:Y})}else if(_.type==="assistant"){let z=[];for(let Y of _.message.content)if(Y.type==="tool_use")z.push({type:"tool_use",name:Y.name,input:Y.input});if(z.length>0)K.push({role:"assistant",content:z})}return K}function eb4(q){let K=new Map;for(let _ of q){K.set(_.name,_);for(let z of _.aliases??[])K.set(z,_)}return K}function qx4(q,K,_){if(q.type==="tool_use"){let z=_.get(q.name);if(!z)return"";let Y=q.input??{},$;try{$=z.toAutoClassifierInput(Y)??Y}catch(O){N(`toAutoClassifierInput failed for ${q.name}: ${d6(O)}`),d("tengu_auto_mode_malformed_tool_input",{toolName:q.name}),$=Y}if($==="")return"";if(nb4())return g6({[q.name]:$})+` |
| 1994 | `;let A=typeof $==="string"?$:g6($);return`${q.name} ${A} |