@iaforged/context-code 2.3.3 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/context-bootstrap.js +7 -5
  2. package/dist/src/commands/login/login.js +1 -1
  3. package/dist/src/components/BaseTextInput.js +1 -1
  4. package/dist/src/components/LogoV2/AnimatedClawd.js +1 -1
  5. package/dist/src/components/LogoV2/Clawd.js +1 -1
  6. package/dist/src/components/LogoV2/LogoV2.js +1 -1
  7. package/dist/src/components/LogoV2/WelcomeV2.js +1 -1
  8. package/dist/src/components/PromptInput/PromptInputFooterLeftSide.js +1 -1
  9. package/dist/src/components/SessionTokenFooter.js +1 -1
  10. package/dist/src/components/Spinner.js +1 -1
  11. package/dist/src/components/Stats.js +1 -1
  12. package/dist/src/components/TeleportProgress.js +1 -1
  13. package/dist/src/components/TextInput.js +1 -1
  14. package/dist/src/components/design-system/ThemeProvider.js +1 -1
  15. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +1 -1
  16. package/dist/src/main.js +1 -1
  17. package/dist/src/query/stopHooks.js +1 -1
  18. package/dist/src/screens/REPL.js +1 -1
  19. package/dist/src/services/PromptSuggestion/promptSuggestion.js +1 -1
  20. package/dist/src/services/analytics/config.js +1 -1
  21. package/dist/src/services/analytics/datadog.js +1 -1
  22. package/dist/src/services/mcp/config.js +1 -1
  23. package/dist/src/services/tips/tipRegistry.js +1 -1
  24. package/dist/src/services/toolUseSummary/toolUseSummaryGenerator.js +1 -1
  25. package/dist/src/tools/BriefTool/UI.js +1 -1
  26. package/dist/src/utils/computerControlMcp/mcpServer.js +1 -1
  27. package/dist/src/utils/computerControlMcp/server/.gitattributes +18 -0
  28. package/dist/src/utils/computerControlMcp/server/Dockerfile +25 -0
  29. package/dist/src/utils/computerControlMcp/server/LICENSE +21 -0
  30. package/dist/src/utils/computerControlMcp/server/MANIFEST.in +10 -0
  31. package/dist/src/utils/computerControlMcp/server/README.md +193 -0
  32. package/dist/src/utils/computerControlMcp/server/demonstration.gif +0 -0
  33. package/dist/src/utils/computerControlMcp/server/icon.png +0 -0
  34. package/dist/src/utils/computerControlMcp/server/pyproject.toml +52 -0
  35. package/dist/src/utils/computerControlMcp/server/smithery.yaml +13 -0
  36. package/dist/src/utils/computerControlMcp/server/src/README.md +12 -0
  37. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/FZYTK.TTF +0 -0
  38. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/__init__.py +11 -0
  39. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/__main__.py +21 -0
  40. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/cli.py +128 -0
  41. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/core.py +1008 -0
  42. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/gui.py +126 -0
  43. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/server.py +15 -0
  44. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/test.py +346 -0
  45. package/dist/src/utils/computerControlMcp/server/src/computer_control_mcp/test_image.png +0 -0
  46. package/dist/src/utils/computerControlMcp/server/tests/README.md +22 -0
  47. package/dist/src/utils/computerControlMcp/server/tests/conftest.py +10 -0
  48. package/dist/src/utils/computerControlMcp/server/tests/rapidocr_test.py +21 -0
  49. package/dist/src/utils/computerControlMcp/server/tests/run_cli.py +9 -0
  50. package/dist/src/utils/computerControlMcp/server/tests/run_server.py +15 -0
  51. package/dist/src/utils/computerControlMcp/server/tests/setup.py +16 -0
  52. package/dist/src/utils/computerControlMcp/server/tests/test_computer_control.py +161 -0
  53. package/dist/src/utils/computerControlMcp/server/tests/test_screenshot.py +14 -0
  54. package/dist/src/utils/computerControlMcp/server/tests/test_wgc_env_var.py +42 -0
  55. package/dist/src/utils/computerControlMcp/server/tests/test_wgc_screenshot.py +67 -0
  56. package/dist/src/utils/computerControlMcp/server/uv.lock +4986 -0
  57. package/dist/src/utils/computerControlMcp/setup.js +1 -1
  58. package/dist/src/utils/logoV2Utils.js +1 -1
  59. package/dist/src/utils/model/configs.js +1 -1
  60. package/dist/src/utils/model/model.js +1 -1
  61. package/dist/src/utils/model/modelOptions.js +1 -1
  62. package/dist/src/utils/model/providerModels.js +1 -1
  63. package/dist/src/utils/sembleMcp/setup.js +1 -1
  64. package/dist/src/utils/theme.js +1 -1
  65. package/dist/src/utils/themes/bootstrap.js +1 -1
  66. package/dist/src/utils/themes/opencodeMapper.js +1 -1
  67. package/dist/webapp/chunk-VAB2VXFI.js +1 -1
  68. package/dist/webapp/ngsw.json +1 -1
  69. package/dist/webapp/polyfills-7R4CRVNH.js +1 -1
  70. package/package.json +1 -1
@@ -37,7 +37,7 @@ if (!yaTieneHeap) {
37
37
  const child = spawn(
38
38
  process.execPath,
39
39
  [HEAP_FLAG, __filename, ...process.argv.slice(2)],
40
- { stdio: 'inherit', env },
40
+ { stdio: 'inherit', env, cwd: __dirname },
41
41
  )
42
42
  const reenviarSenal = sig => () => {
43
43
  try { child.kill(sig) } catch {}
@@ -80,12 +80,14 @@ try {
80
80
  await runRemotionMcpServer()
81
81
  process.exit(0)
82
82
  }
83
- if (isBun && existsSync(bundledCli)) {
84
- await import(pathToFileURL(bundledCli).href)
85
- } else if (existsSync(distCli)) {
83
+ // Siempre usar el entry compilado por tsc. cli.js (bundle de Bun) usa
84
+ // `import from "bun:bundle"` que Bun resuelve en tiempo de parseo —
85
+ // antes del try/catch — y falla con "may only be imported once" fuera
86
+ // de un contexto de bundle.
87
+ if (existsSync(distCli)) {
86
88
  await import(pathToFileURL(distCli).href)
87
89
  } else {
88
- console.error('No se encontró el punto de entrada del CLI (cli.js o dist/src/entrypoints/cli.js)')
90
+ console.error('No se encontró el punto de entrada del CLI. Ejecuta primero: bun run build:fast')
89
91
  process.exit(1)
90
92
  }
91
93
  } catch (e) {
@@ -1 +1 @@
1
- import{feature as e}from"../../recovery/bunBundleShim.js";import{jsx as r,jsxs as o}from"react/jsx-runtime";import{resetCostState as t}from"../../bootstrap/state.js";import{clearTrustedDeviceToken as i,enrollTrustedDevice as n}from"../../bridge/trustedDevice.js";import{ConfigurableShortcutHint as a}from"../../components/ConfigurableShortcutHint.js";import{ConsoleOAuthFlow as s}from"../../components/ConsoleOAuthFlow.js";import{Dialog as m}from"../../components/design-system/Dialog.js";import{useMainLoopModel as l}from"../../hooks/useMainLoopModel.js";import{Text as c}from"../../ink.js";import{refreshGrowthBookAfterAuthChange as d}from"../../services/analytics/growthbook.js";import{refreshPolicyLimits as p}from"../../services/policyLimits/index.js";import{refreshRemoteManagedSettings as u}from"../../services/remoteManagedSettings/index.js";import{stripSignatureBlocks as g}from"../../utils/messages.js";import{checkAndDisableAutoModeIfNeeded as f,checkAndDisableBypassPermissionsIfNeeded as P,resetAutoModeGateCheck as v,resetBypassPermissionsCheck as M}from"../../utils/permissions/bypassPermissionsKillswitch.js";import{getAPIProvider as N}from"../../utils/model/providers.js";import{switchProviderPreference as x}from"../../utils/model/providerSwitch.js";import{resetUserCache as j}from"../../utils/user.js";import{applySuccessfulLogin as h,isCoreAuthEnabled as S,parseLoginProfileName as I}from"../../core/auth/loginCore.js";export async function call(o,a,s){const m=I(s);return r(Login,{profileName:m,onDone:async(r,s,l,c)=>{if(a.onChangeAPIKey(),a.setMessages(g),r){if(S()){const r=h({context:a,profileName:m,previousModel:s,previousProvider:l,targetProvider:c,transcriptClassifierEnabled:e("TRANSCRIPT_CLASSIFIER")});return r.shouldOpenModelPicker?void o(r.message,{nextInput:"/model",submitNextInput:!0}):void o(r.message)}const r="openai"===c?x({currentModel:s,currentProvider:l,targetProvider:"openai",targetProfileName:m}):"openrouter"===c?x({currentModel:s,currentProvider:l,targetProvider:"openrouter",targetProfileName:m}):"ollama"===c?x({currentModel:s,currentProvider:l,targetProvider:"ollama",targetProfileName:m}):"ollama-cloud"===c?x({currentModel:s,currentProvider:l,targetProvider:"ollama-cloud",targetProfileName:m}):"gemini-api"===c?x({currentModel:s,currentProvider:l,targetProvider:"gemini-api",targetProfileName:m}):"gemini-google"===c?x({currentModel:s,currentProvider:l,targetProvider:"gemini-google",targetProfileName:m}):"zai"===c?x({currentModel:s,currentProvider:l,targetProvider:"zai",targetProfileName:m}):"minimax"===c?x({currentModel:s,currentProvider:l,targetProvider:"minimax",targetProfileName:m}):"nvidia"===c?x({currentModel:s,currentProvider:l,targetProvider:"nvidia",targetProfileName:m}):"deepseek"===c?x({currentModel:s,currentProvider:l,targetProvider:"deepseek",targetProfileName:m}):"custom-openai"===c?x({currentModel:s,currentProvider:l,targetProvider:"custom-openai",targetProfileName:m}):"custom-anthropic"===c?x({currentModel:s,currentProvider:l,targetProvider:"custom-anthropic",targetProfileName:m}):c&&["xai","gmi","novita","stepfun","huggingface","opencode-zen","arcee","alibaba","kimi"].includes(c)?x({currentModel:s,currentProvider:l,targetProvider:c,targetProfileName:m}):x({currentModel:s,currentProvider:l,targetProvider:"claude",targetProfileName:m});t(),u(),p(),j(),d(),i(),n(),M();const g=a.getAppState();if(P(g.toolPermissionContext,a.setAppState),e("TRANSCRIPT_CLASSIFIER")&&(v(),f(g.toolPermissionContext,a.setAppState,g.fastMode)),a.setAppState(e=>({...e,mainLoopModel:r,mainLoopModelForSession:r,authVersion:e.authVersion+1})),!r)return void o(m?`Inicio de sesion exitoso en el perfil "${m}". Selecciona ahora el modelo para este perfil.`:"Inicio de sesion exitoso. Selecciona ahora el modelo para este perfil.",{nextInput:"/model",submitNextInput:!0})}o(r?"Inicio de sesión exitoso":"Acceso interrumpido")}})}export function Login(e){const t=l(),i=N();return r(m,{title:"Iniciar sesión",onCancel:()=>e.onDone(!1,t,i),color:"permission",inputGuide:e=>e.pending?o(c,{children:["Presiona ",e.keyName," de nuevo para salir"]}):r(a,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"cancelar"}),children:r(s,{onDone:r=>e.onDone(!0,t,i,r),startingMessage:e.startingMessage,profileName:e.profileName})})}
1
+ import{feature as e}from"../../recovery/bunBundleShim.js";import{jsx as r}from"react/jsx-runtime";import{resetCostState as o}from"../../bootstrap/state.js";import{clearTrustedDeviceToken as t,enrollTrustedDevice as i}from"../../bridge/trustedDevice.js";import{ConsoleOAuthFlow as n}from"../../components/ConsoleOAuthFlow.js";import{useKeybinding as a}from"../../keybindings/useKeybinding.js";import{useMainLoopModel as s}from"../../hooks/useMainLoopModel.js";import{Box as m}from"../../ink.js";import{refreshGrowthBookAfterAuthChange as l}from"../../services/analytics/growthbook.js";import{refreshPolicyLimits as d}from"../../services/policyLimits/index.js";import{refreshRemoteManagedSettings as c}from"../../services/remoteManagedSettings/index.js";import{stripSignatureBlocks as u}from"../../utils/messages.js";import{checkAndDisableAutoModeIfNeeded as p,checkAndDisableBypassPermissionsIfNeeded as g,resetAutoModeGateCheck as P,resetBypassPermissionsCheck as f}from"../../utils/permissions/bypassPermissionsKillswitch.js";import{getAPIProvider as v}from"../../utils/model/providers.js";import{switchProviderPreference as M}from"../../utils/model/providerSwitch.js";import{resetUserCache as N}from"../../utils/user.js";import{applySuccessfulLogin as x,isCoreAuthEnabled as j,parseLoginProfileName as h}from"../../core/auth/loginCore.js";export async function call(n,a,s){const m=h(s);return r(Login,{profileName:m,onDone:async(r,s,v,h)=>{if(a.onChangeAPIKey(),a.setMessages(u),r){if(j()){const r=x({context:a,profileName:m,previousModel:s,previousProvider:v,targetProvider:h,transcriptClassifierEnabled:e("TRANSCRIPT_CLASSIFIER")});return r.shouldOpenModelPicker?void n(r.message,{nextInput:"/model",submitNextInput:!0}):void n(r.message)}const r="openai"===h?M({currentModel:s,currentProvider:v,targetProvider:"openai",targetProfileName:m}):"openrouter"===h?M({currentModel:s,currentProvider:v,targetProvider:"openrouter",targetProfileName:m}):"ollama"===h?M({currentModel:s,currentProvider:v,targetProvider:"ollama",targetProfileName:m}):"ollama-cloud"===h?M({currentModel:s,currentProvider:v,targetProvider:"ollama-cloud",targetProfileName:m}):"gemini-api"===h?M({currentModel:s,currentProvider:v,targetProvider:"gemini-api",targetProfileName:m}):"gemini-google"===h?M({currentModel:s,currentProvider:v,targetProvider:"gemini-google",targetProfileName:m}):"zai"===h?M({currentModel:s,currentProvider:v,targetProvider:"zai",targetProfileName:m}):"minimax"===h?M({currentModel:s,currentProvider:v,targetProvider:"minimax",targetProfileName:m}):"nvidia"===h?M({currentModel:s,currentProvider:v,targetProvider:"nvidia",targetProfileName:m}):"deepseek"===h?M({currentModel:s,currentProvider:v,targetProvider:"deepseek",targetProfileName:m}):"custom-openai"===h?M({currentModel:s,currentProvider:v,targetProvider:"custom-openai",targetProfileName:m}):"custom-anthropic"===h?M({currentModel:s,currentProvider:v,targetProvider:"custom-anthropic",targetProfileName:m}):h&&["xai","gmi","novita","stepfun","huggingface","opencode-zen","arcee","alibaba","kimi"].includes(h)?M({currentModel:s,currentProvider:v,targetProvider:h,targetProfileName:m}):M({currentModel:s,currentProvider:v,targetProvider:"claude",targetProfileName:m});o(),c(),d(),N(),l(),t(),i(),f();const u=a.getAppState();if(g(u.toolPermissionContext,a.setAppState),e("TRANSCRIPT_CLASSIFIER")&&(P(),p(u.toolPermissionContext,a.setAppState,u.fastMode)),a.setAppState(e=>({...e,mainLoopModel:r,mainLoopModelForSession:r,authVersion:e.authVersion+1})),!r)return void n(m?`Inicio de sesion exitoso en el perfil "${m}". Selecciona ahora el modelo para este perfil.`:"Inicio de sesion exitoso. Selecciona ahora el modelo para este perfil.",{nextInput:"/model",submitNextInput:!0})}n(r?"Inicio de sesión exitoso":"Acceso interrumpido")}})}export function Login(e){const o=s(),t=v();return a("confirm:no",()=>e.onDone(!1,o,t),{context:"Confirmation"}),r(m,{flexDirection:"column",gap:1,children:r(n,{onDone:r=>e.onDone(!0,o,t,r),startingMessage:e.startingMessage,profileName:e.profileName})})}
@@ -1 +1 @@
1
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import{c as t}from"react/compiler-runtime";import o from"react";import{renderPlaceholder as n}from"../hooks/renderPlaceholder.js";import{usePasteHandler as s}from"../hooks/usePasteHandler.js";import{useDeclaredCursor as i}from"../ink/hooks/use-declared-cursor.js";import{Ansi as l,Box as a,Text as h,useInput as u}from"../ink.js";import{HighlightedInput as c}from"./PromptInput/ShimmeredInput.js";export function BaseTextInput(d){const m=t(14),{inputState:p,children:f,terminalFocus:g,invert:v,hidePlaceholderText:C,...P}=d,{onInput:x,renderedValue:w,cursorLine:I,cursorColumn:j}=p,k=Boolean(P.focus&&P.showCursor&&g);let O;m[0]!==j||m[1]!==I||m[2]!==k?(O={line:I,column:j,active:k},m[0]=j,m[1]=I,m[2]=k,m[3]=O):O=m[3];const E=i(O),{wrappedOnInput:H,isPasting:W}=s({onPaste:P.onPaste,onInput:(e,r)=>{B&&r.return||x(e,r)},onImagePaste:P.onImagePaste}),B=W,{onIsPastingChange:T}=P;o.useEffect(()=>{T&&T(B)},[B,T]);const{showPlaceholder:F,renderedPlaceholder:S}=n({placeholder:P.placeholder,value:P.value,showCursor:P.showCursor,focus:P.focus,terminalFocus:g,invert:v,hidePlaceholderText:C});u(H,{isActive:P.focus});const A=P.value&&-1===P.value.trim().indexOf(" ")||P.value&&P.value.endsWith(" "),L=Boolean(P.argumentHint&&P.value&&A&&P.value.startsWith("/")),M=P.showCursor&&P.highlights?P.highlights.filter(e=>e.dimColor||P.cursorOffset<e.start||P.cursorOffset>=e.end):P.highlights,{viewportCharOffset:V,viewportCharEnd:b}=p,q=M&&V>0?M.filter(e=>e.end>V&&e.start<b).map(e=>({...e,start:Math.max(0,e.start-V),end:e.end-V})):M;if(q&&q.length>0)return r(a,{ref:E,children:[e(c,{text:w,highlights:q}),L&&r(h,{dimColor:!0,children:[P.value?.endsWith(" ")?"":" ",P.argumentHint]}),f]});const y=a,z=h,D=F&&P.placeholderElement?P.placeholderElement:e(l,F&&S?{children:S}:{children:w}),G=L&&r(h,{dimColor:!0,children:[P.value?.endsWith(" ")?"":" ",P.argumentHint]});let J,K;return m[4]!==z||m[5]!==f||m[6]!==P||m[7]!==D||m[8]!==G?(J=r(z,{wrap:"truncate-end",dimColor:P.dimColor,children:[D,G,f]}),m[4]=z,m[5]=f,m[6]=P,m[7]=D,m[8]=G,m[9]=J):J=m[9],m[10]!==y||m[11]!==E||m[12]!==J?(K=e(y,{ref:E,children:J}),m[10]=y,m[11]=E,m[12]=J,m[13]=K):K=m[13],K}
1
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";import{c as t}from"react/compiler-runtime";import o from"react";import{renderPlaceholder as n}from"../hooks/renderPlaceholder.js";import{usePasteHandler as s}from"../hooks/usePasteHandler.js";import{useDeclaredCursor as l}from"../ink/hooks/use-declared-cursor.js";import{Ansi as a,Box as i,Text as h,useInput as u}from"../ink.js";import{HighlightedInput as c}from"./PromptInput/ShimmeredInput.js";export function BaseTextInput(d){const m=t(14),{inputState:f,children:p,terminalFocus:g,invert:C,hidePlaceholderText:v,...P}=d,{onInput:x,renderedValue:w,cursorLine:I,cursorColumn:O}=f,j=Boolean(P.focus&&P.showCursor&&g);let k;m[0]!==O||m[1]!==I||m[2]!==j?(k={line:I,column:O,active:j},m[0]=O,m[1]=I,m[2]=j,m[3]=k):k=m[3];const E=l(k),H=o.useCallback(e=>{const r=P.value??"",t=P.cursorOffset??r.length,o=r.slice(0,t)+e+r.slice(t);P.onChange(o),P.onChangeCursorOffset(t+e.length)},[P.value,P.cursorOffset,P.onChange,P.onChangeCursorOffset]),{wrappedOnInput:W,isPasting:B}=s({onPaste:P.onPaste??H,onInput:(e,r)=>{T&&r.return||x(e,r)},onImagePaste:P.onImagePaste}),T=B,{onIsPastingChange:F}=P;o.useEffect(()=>{F&&F(T)},[T,F]);const{showPlaceholder:S,renderedPlaceholder:b}=n({placeholder:P.placeholder,value:P.value,showCursor:P.showCursor,focus:P.focus,terminalFocus:g,invert:C,hidePlaceholderText:v});u(W,{isActive:P.focus});const A=P.value&&-1===P.value.trim().indexOf(" ")||P.value&&P.value.endsWith(" "),L=Boolean(P.argumentHint&&P.value&&A&&P.value.startsWith("/")),M=P.showCursor&&P.highlights?P.highlights.filter(e=>e.dimColor||P.cursorOffset<e.start||P.cursorOffset>=e.end):P.highlights,{viewportCharOffset:V,viewportCharEnd:q}=f,y=M&&V>0?M.filter(e=>e.end>V&&e.start<q).map(e=>({...e,start:Math.max(0,e.start-V),end:e.end-V})):M;if(y&&y.length>0)return r(i,{ref:E,children:[e(c,{text:w,highlights:y}),L&&r(h,{dimColor:!0,children:[P.value?.endsWith(" ")?"":" ",P.argumentHint]}),p]});const z=i,D=h,G=S&&P.placeholderElement?P.placeholderElement:e(a,S&&b?{children:b}:{children:w}),J=L&&r(h,{dimColor:!0,children:[P.value?.endsWith(" ")?"":" ",P.argumentHint]});let K,N;return m[4]!==D||m[5]!==p||m[6]!==P||m[7]!==G||m[8]!==J?(K=r(D,{wrap:"truncate-end",dimColor:P.dimColor,children:[G,J,p]}),m[4]=D,m[5]=p,m[6]=P,m[7]=G,m[8]=J,m[9]=K):K=m[9],m[10]!==z||m[11]!==E||m[12]!==K?(N=e(z,{ref:E,children:K}),m[10]=z,m[11]=E,m[12]=K,m[13]=N):N=m[13],N}
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import{c as t}from"react/compiler-runtime";import{useEffect as e,useRef as r,useState as n}from"react";import{Box as l}from"../../ink.js";import{getInitialSettings as i}from"../../utils/settings/settings.js";import{Clawd as f}from"./Clawd.js";function hold(o,t,e){return Array.from({length:e},()=>({pose:o,offset:t}))}const s=[...hold("default",1,2),...hold("arms-up",0,3),...hold("default",0,1),...hold("default",1,2),...hold("arms-up",0,3),...hold("default",0,1)],u=[...hold("look-right",0,5),...hold("look-left",0,5),...hold("default",0,1)],c=[s,u],d={pose:"default",offset:0},incrementFrame=o=>o+1;export function AnimatedClawd(){const u=t(8),{pose:m,bounceOffset:a,onClick:h}=function(){const[o]=n(()=>i().prefersReducedMotion??!1),[t,l]=n(-1),f=r(s),onClick=()=>{o||-1!==t||(f.current=c[Math.floor(Math.random()*c.length)],l(0))};e(()=>{if(-1===t)return;if(t>=f.current.length)return void l(-1);const o=setTimeout(l,60,incrementFrame);return()=>clearTimeout(o)},[t]);const u=f.current,m=t>=0&&t<u.length?u[t]:d;return{pose:m.pose,bounceOffset:m.offset,onClick}}();let p,g,k;return u[0]!==m?(p=o(f,{pose:m}),u[0]=m,u[1]=p):p=u[1],u[2]!==a||u[3]!==p?(g=o(l,{marginTop:a,flexShrink:0,children:p}),u[2]=a,u[3]=p,u[4]=g):g=u[4],u[5]!==h||u[6]!==g?(k=o(l,{height:3,flexDirection:"column",onClick:h,children:g}),u[5]=h,u[6]=g,u[7]=k):k=u[7],k}
1
+ import{jsx as o}from"react/jsx-runtime";import{c as t}from"react/compiler-runtime";import{useEffect as e,useRef as r,useState as n}from"react";import{Box as l}from"../../ink.js";import{getInitialSettings as i}from"../../utils/settings/settings.js";import{Clawd as f}from"./Clawd.js";function hold(o,t,e){return Array.from({length:e},()=>({pose:o,offset:t}))}const s=[...hold("default",1,2),...hold("arms-up",0,3),...hold("default",0,1),...hold("default",1,2),...hold("arms-up",0,3),...hold("default",0,1)],u=[...hold("look-right",0,5),...hold("look-left",0,5),...hold("default",0,1)],c=[s,u],d={pose:"default",offset:0},incrementFrame=o=>o+1;export function AnimatedClawd(){const u=t(8),{pose:m,bounceOffset:a,onClick:h}=function(){const[o]=n(()=>i().prefersReducedMotion??!1),[t,l]=n(-1),f=r(s),onClick=()=>{o||-1!==t||(f.current=c[Math.floor(Math.random()*c.length)],l(0))};e(()=>{if(-1===t)return;if(t>=f.current.length)return void l(-1);const o=setTimeout(l,60,incrementFrame);return()=>clearTimeout(o)},[t]);const u=f.current,m=t>=0&&t<u.length?u[t]:d;return{pose:m.pose,bounceOffset:m.offset,onClick}}();let p,g,k;return u[0]!==m?(p=o(f,{pose:m}),u[0]=m,u[1]=p):p=u[1],u[2]!==a||u[3]!==p?(g=o(l,{marginTop:a,flexShrink:0,children:p}),u[2]=a,u[3]=p,u[4]=g):g=u[4],u[5]!==h||u[6]!==g?(k=o(l,{height:5,flexDirection:"column",onClick:h,children:g}),u[5]=h,u[6]=g,u[7]=k):k=u[7],k}
@@ -1 +1 @@
1
- import{jsx as o,jsxs as l}from"react/jsx-runtime";import{Box as r,Text as e}from"../../ink.js";export function Clawd({pose:c="default"}={}){const[d,t,i]={default:["╭─┬─┬─╮","│C│T│X│","╰─┴─┴─╯"],"arms-up":["╭▲┬▲┬▲╮","│C│T│X│","╰─┴─┴─╯"],"look-left":["╭─┬─┬─╮","│◀│T│X│","╰─┴─┴─╯"],"look-right":["╭─┬─┬─╮","│C│T│▶│","╰─┴─┴─╯"]}[c];return l(r,{flexDirection:"column",alignItems:"center",children:[o(e,{color:"clawd_body",children:d}),o(e,{color:"clawd_body",bold:!0,children:t}),o(e,{color:"clawd_body",dimColor:!0,children:i})]})}
1
+ import{jsx as o}from"react/jsx-runtime";import{Box as r,Text as e}from"../../ink.js";const t=["██████ ██████ ██ ██","██ ██ ████ ","██ ██ ██ ","██ ██ ████ ","██████ ██ ██ ██"],c=["white","white","clawd_body","clawd_body","clawd_body"];export function Clawd(i={}){return o(r,{flexDirection:"column",alignItems:"center",children:t.map((r,t)=>o(e,{color:c[t],bold:!0,children:r},t))})}
@@ -1 +1 @@
1
- import{MACRO as e,feature as o}from"../../recovery/bunBundleShim.js";import{jsx as r,jsxs as n,Fragment as t}from"react/jsx-runtime";import{createRequire as s}from"module";const i=s(import.meta.url);import{c}from"react/compiler-runtime";import{Box as l,Text as m,color as a}from"../../ink.js";import{useTerminalSize as d}from"../../hooks/useTerminalSize.js";import{stringWidth as _}from"../../ink/stringWidth.js";import{getLayoutMode as p,calculateLayoutDimensions as C,calculateOptimalLeftWidth as E,formatWelcomeMessage as f,truncatePath as h,getRecentActivitySync as u,getRecentReleaseNotesSync as O,getLogoDisplayData as T}from"../../utils/logoV2Utils.js";import{truncate as D}from"../../utils/format.js";import{getDisplayPath as X}from"../../utils/file.js";import{Clawd as S}from"./Clawd.js";import{FeedColumn as g}from"./FeedColumn.js";import{createRecentActivityFeed as N,createWhatsNewFeed as U,createProjectOnboardingFeed as L,createGuestPassesFeed as v}from"./feedConfigs.js";import{getGlobalConfig as I,saveGlobalConfig as M}from"../../utils/config.js";import{resolveThemeSetting as b}from"../../utils/systemTheme.js";import{getInitialSettings as j}from"../../utils/settings/settings.js";import{isDebugMode as F,isDebugToStdErr as x,getDebugLogPath as R}from"../../utils/debug.js";import{useEffect as A,useState as y}from"react";import{getSteps as P,shouldShowProjectOnboarding as $,incrementProjectOnboardingSeenCount as w}from"../../projectOnboardingState.js";import{CondensedLogo as z}from"./CondensedLogo.js";import{OffscreenFreeze as V}from"../OffscreenFreeze.js";import{checkForReleaseNotesSync as G}from"../../utils/releaseNotes.js";import{getDumpPromptsPath as k}from"../../services/api/dumpPrompts.js";import{isEnvTruthy as W}from"../../utils/envUtils.js";import{getStartupPerfLogPath as H,isDetailedProfilingEnabled as K}from"../../utils/startupProfiler.js";import{EmergencyTip as Y}from"./EmergencyTip.js";import{VoiceModeNotice as B}from"./VoiceModeNotice.js";import{Opus1mMergeNotice as q}from"./Opus1mMergeNotice.js";const J=o("KAIROS")||o("KAIROS_CHANNELS")?i("./ChannelsNotice.js"):null;import{SandboxManager as Q}from"../../utils/sandbox/sandbox-adapter.js";import{useShowGuestPassesUpsell as Z,incrementGuestPassesSeenCount as ee}from"./GuestPassesUpsell.js";import{useShowOverageCreditUpsell as oe,incrementOverageCreditUpsellSeenCount as re,createOverageCreditFeed as ne}from"./OverageCreditUpsell.js";import{useAppState as te}from"../../state/AppState.js";import{getEffortSuffix as se}from"../../utils/effort.js";import{useMainLoopModel as ie}from"../../hooks/useMainLoopModel.js";import{renderModelSetting as ce}from"../../utils/model/model.js";export function LogoV2(){const o=c(94),s=u(),i=I().oauthAccount?.displayName??"",{columns:X}=d();let k;o[0]===Symbol.for("react.memo_cache_sentinel")?(k=$(),o[0]=k):k=o[0];const H=k;let K;o[1]===Symbol.for("react.memo_cache_sentinel")?(K=Q.isSandboxingEnabled(),o[1]=K):K=o[1];const le=K,me=Z(),ae=oe(),de=te(_temp),_e=te(_temp2),pe=I();let Ce;try{Ce=O(3)}catch{Ce=[]}const[Ee]=y(()=>{const e=j().companyAnnouncements;if(e&&0!==e.length)return 1===pe.numStartups?e[0]:e[Math.floor(Math.random()*e.length)]}),{hasReleaseNotes:fe}=G(pe.lastReleaseNotesSeen);let he,ue,Oe;o[2]===Symbol.for("react.memo_cache_sentinel")?(he=()=>{I().lastReleaseNotesSeen!==e.VERSION&&(M(_temp3),H&&w())},o[2]=he):he=o[2],o[3]!==pe?(ue=[pe,H],o[3]=pe,o[4]=ue):ue=o[4],A(he,ue),o[5]===Symbol.for("react.memo_cache_sentinel")?(Oe=!(fe||H||W(process.env.CONTEXT_CODE_FORCE_FULL_LOGO)||W(process.env.CLAUDE_CODE_FORCE_FULL_LOGO)),o[5]=Oe):Oe=o[5];const Te=Oe;let De,Xe,Se,ge;o[6]!==me?(De=()=>{!me||H||Te||ee()},Xe=[me,H,Te],o[6]=me,o[7]=De,o[8]=Xe):(De=o[7],Xe=o[8]),A(De,Xe),o[9]!==me||o[10]!==ae?(Se=()=>{!ae||H||me||Te||re()},ge=[ae,H,me,Te],o[9]=me,o[10]=ae,o[11]=Se,o[12]=ge):(Se=o[11],ge=o[12]),A(Se,ge);const Ne=ie(),Ue=ce(Ne),{version:Le,cwd:ve,billingType:Ie,agentName:Me}=T(),be=de??Me,je=Ue+se(Ne,_e);let Fe;o[13]!==je?(Fe=D(je,30),o[13]=je,o[14]=Fe):Fe=o[14];const xe=Fe;if(!(fe||H||W(process.env.CONTEXT_CODE_FORCE_FULL_LOGO)||W(process.env.CLAUDE_CODE_FORCE_FULL_LOGO))){let e,s,i,c,a,d,_,p,C,E,f,h,u;return o[15]===Symbol.for("react.memo_cache_sentinel")?(e=r(z,{}),s=r(B,{}),i=r(q,{}),c=J&&r(J.ChannelsNotice,{}),a=F()&&n(l,{paddingLeft:2,flexDirection:"column",children:[r(m,{color:"warning",children:"Debug mode enabled"}),n(m,{dimColor:!0,children:["Logging to: ",x()?"stderr":R()]})]}),d=r(Y,{}),_=(process.env.CONTEXT_CODE_TMUX_SESSION??process.env.CLAUDE_CODE_TMUX_SESSION)&&n(l,{paddingLeft:2,flexDirection:"column",children:[n(m,{dimColor:!0,children:["tmux session: ",process.env.CONTEXT_CODE_TMUX_SESSION??process.env.CLAUDE_CODE_TMUX_SESSION]}),r(m,{dimColor:!0,children:process.env.CONTEXT_CODE_TMUX_PREFIX_CONFLICTS??process.env.CLAUDE_CODE_TMUX_PREFIX_CONFLICTS?`Detach: ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX} ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX} d (press prefix twice - Claude uses ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX})`:`Detach: ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX} d`})]}),o[15]=e,o[16]=s,o[17]=i,o[18]=c,o[19]=a,o[20]=d,o[21]=_):(e=o[15],s=o[16],i=o[17],c=o[18],a=o[19],d=o[20],_=o[21]),o[22]!==Ee||o[23]!==pe?(p=Ee&&n(l,{paddingLeft:2,flexDirection:"column",children:[!process.env.IS_DEMO&&pe.oauthAccount?.organizationName&&n(m,{dimColor:!0,children:["Message from ",pe.oauthAccount.organizationName,":"]}),r(m,{children:Ee})]}),o[22]=Ee,o[23]=pe,o[24]=p):p=o[24],o[25]===Symbol.for("react.memo_cache_sentinel")?(C=!1,E=!1,f=!1,h=!1,o[25]=C,o[26]=E,o[27]=f,o[28]=h):(C=o[25],E=o[26],f=o[27],h=o[28]),o[29]!==p?(u=n(t,{children:[e,s,i,c,a,d,_,p,C,E,f,h]}),o[29]=p,o[30]=u):u=o[30],u}const Re=p(X),Ae=b(I().theme),ye=` ${a("claude",Ae)("CTX")} ${a("inactive",Ae)(`v${Le}`)} `,Pe=a("claude",Ae)(" CTX ");if("compact"===Re){let e=f(i);if(_(e)>X-4){let r;o[31]===Symbol.for("react.memo_cache_sentinel")?(r=f(null),o[31]=r):r=o[31],e=r}const s=h(ve,Math.max(X-4,10));let c,a,d,p,C,E,u,O,T;return o[32]!==Pe?(c={content:Pe,position:"top",align:"start",offset:1},o[32]=Pe,o[33]=c):c=o[33],o[34]===Symbol.for("react.memo_cache_sentinel")?(a=r(l,{marginY:1,children:r(S,{})}),o[34]=a):a=o[34],o[35]!==xe?(d=r(m,{dimColor:!0,children:xe}),o[35]=xe,o[36]=d):d=o[36],o[37]===Symbol.for("react.memo_cache_sentinel")?(p=r(B,{}),C=r(q,{}),E=J&&r(J.ChannelsNotice,{}),o[37]=p,o[38]=C,o[39]=E):(p=o[37],C=o[38],E=o[39]),o[40]!==le?(u=le&&r(l,{marginTop:1,flexDirection:"column",children:r(m,{color:"warning",children:"Tus comandos bash se ejecutarán en sandbox. Desactiva con /sandbox."})}),o[40]=le,o[41]=u):u=o[41],o[42]===Symbol.for("react.memo_cache_sentinel")?(O=!1,T=!1,o[42]=O,o[43]=T):(O=o[42],T=o[43]),n(t,{children:[r(V,{children:n(l,{flexDirection:"column",borderStyle:"round",borderColor:"claude",borderText:c,paddingX:2,paddingY:1,alignItems:"center",width:X,children:[r(m,{color:"claude",children:"CTX"}),r(m,{bold:!0,children:e}),a,r(m,{dimColor:!0,children:xe}),r(m,{dimColor:!0,children:Ie}),be?n(m,{dimColor:!0,children:["@",be]}):null,r(m,{dimColor:!0,children:s})]})}),p,C,E,u,O,T]})}const $e=f(i),we=!process.env.IS_DEMO&&pe.oauthAccount?.organizationName?`${xe} · ${Ie} · ${pe.oauthAccount.organizationName}`:`${xe} · ${Ie}`,ze=be?49-_(be)-3:50,Ve=h(ve,Math.max(ze,10)),Ge=be?`@${be} · ${Ve}`:Ve,ke=E($e,Ge,we),{leftWidth:We,rightWidth:He}=C(X,Re,ke),Ke=V,Ye=l;let Be;o[44]!==ye?(Be={content:ye,position:"top",align:"start",offset:3},o[44]=ye,o[45]=Be):Be=o[45];const qe=l,Je="column";let Qe,Ze,eo,oo,ro,no,to;o[46]!==$e?(Qe=r(l,{marginTop:1,children:r(m,{bold:!0,children:$e})}),o[46]=$e,o[47]=Qe):Qe=o[47],o[48]===Symbol.for("react.memo_cache_sentinel")?(Ze=r(S,{}),o[48]=Ze):Ze=o[48],o[49]!==we?(eo=r(m,{dimColor:!0,children:we}),o[49]=we,o[50]=eo):eo=o[50],o[51]!==Ge?(oo=r(m,{dimColor:!0,children:Ge}),o[51]=Ge,o[52]=oo):oo=o[52],o[53]!==eo||o[54]!==oo?(ro=n(l,{flexDirection:"column",alignItems:"center",children:[r(m,{color:"claude",children:"CTX"}),eo,oo]}),o[53]=eo,o[54]=oo,o[55]=ro):ro=o[55],o[56]!==We||o[57]!==Qe||o[58]!==ro?(no=n(l,{flexDirection:"column",width:We,justifyContent:"space-between",alignItems:"center",minHeight:11,children:[Qe,Ze,ro]}),o[56]=We,o[57]=Qe,o[58]=ro,o[59]=no):no=o[59],o[60]!==Re?(to=null,o[60]=Re,o[61]=to):to=o[61];const so=r(g,{feeds:H?[L(P()),N(s)]:me?[N(s),v()]:ae?[N(s),ne()]:[N(s),U(Ce)],maxWidth:Math.max(We,He)});let io,co,lo,mo,ao,_o,po,Co,Eo,fo,ho,uo,Oo,To,Do,Xo;return o[62]!==qe||o[63]!==Je||o[64]!==no||o[65]!==to||o[66]!==so?(io=n(qe,{flexDirection:Je,paddingX:2,gap:2,children:[no,to,so]}),o[62]=qe,o[63]=Je,o[64]=no,o[65]=to,o[66]=so,o[67]=io):io=o[67],o[68]!==Ye||o[69]!==Be||o[70]!==io?(co=r(Ye,{flexDirection:"column",borderStyle:"round",borderColor:"claude",borderText:Be,children:io}),o[68]=Ye,o[69]=Be,o[70]=io,o[71]=co):co=o[71],o[72]!==Ke||o[73]!==co?(lo=r(Ke,{children:co}),o[72]=Ke,o[73]=co,o[74]=lo):lo=o[74],o[75]===Symbol.for("react.memo_cache_sentinel")?(mo=r(B,{}),ao=r(q,{}),_o=J&&r(J.ChannelsNotice,{}),po=F()&&n(l,{paddingLeft:2,flexDirection:"column",children:[r(m,{color:"warning",children:"Debug mode enabled"}),n(m,{dimColor:!0,children:["Logging to: ",x()?"stderr":R()]})]}),Co=r(Y,{}),Eo=(process.env.CONTEXT_CODE_TMUX_SESSION??process.env.CLAUDE_CODE_TMUX_SESSION)&&n(l,{paddingLeft:2,flexDirection:"column",children:[n(m,{dimColor:!0,children:["tmux session: ",process.env.CONTEXT_CODE_TMUX_SESSION??process.env.CLAUDE_CODE_TMUX_SESSION]}),r(m,{dimColor:!0,children:process.env.CONTEXT_CODE_TMUX_PREFIX_CONFLICTS??process.env.CLAUDE_CODE_TMUX_PREFIX_CONFLICTS?`Detach: ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX} ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX} d (press prefix twice - Claude uses ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX})`:`Detach: ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX} d`})]}),o[75]=mo,o[76]=ao,o[77]=_o,o[78]=po,o[79]=Co,o[80]=Eo):(mo=o[75],ao=o[76],_o=o[77],po=o[78],Co=o[79],Eo=o[80]),o[81]!==Ee||o[82]!==pe?(fo=Ee&&n(l,{paddingLeft:2,flexDirection:"column",children:[!process.env.IS_DEMO&&pe.oauthAccount?.organizationName&&n(m,{dimColor:!0,children:["Message from ",pe.oauthAccount.organizationName,":"]}),r(m,{children:Ee})]}),o[81]=Ee,o[82]=pe,o[83]=fo):fo=o[83],o[84]!==le?(ho=le&&r(l,{paddingLeft:2,flexDirection:"column",children:r(m,{color:"warning",children:"Tus comandos bash se ejecutarán en sandbox. Desactiva con /sandbox."})}),o[84]=le,o[85]=ho):ho=o[85],o[86]===Symbol.for("react.memo_cache_sentinel")?(uo=!1,Oo=!1,To=!1,Do=!1,o[86]=uo,o[87]=Oo,o[88]=To,o[89]=Do):(uo=o[86],Oo=o[87],To=o[88],Do=o[89]),o[90]!==lo||o[91]!==fo||o[92]!==ho?(Xo=n(t,{children:[lo,mo,ao,_o,po,Co,Eo,fo,ho,uo,Oo,To,Do]}),o[90]=lo,o[91]=fo,o[92]=ho,o[93]=Xo):Xo=o[93],Xo}function _temp3(o){return o.lastReleaseNotesSeen===e.VERSION?o:{...o,lastReleaseNotesSeen:e.VERSION}}function _temp2(e){return e.effortValue}function _temp(e){return e.agent}
1
+ import{MACRO as e,feature as o}from"../../recovery/bunBundleShim.js";import{jsx as n,jsxs as r,Fragment as t}from"react/jsx-runtime";import{createRequire as i}from"module";const s=i(import.meta.url);import{c}from"react/compiler-runtime";import{Box as l,Text as m,color as a}from"../../ink.js";import{useTerminalSize as d}from"../../hooks/useTerminalSize.js";import{stringWidth as _}from"../../ink/stringWidth.js";import{getLayoutMode as p,calculateLayoutDimensions as C,formatWelcomeMessage as f,truncatePath as h,getRecentActivitySync as E,getRecentReleaseNotesSync as u,getLogoDisplayData as O}from"../../utils/logoV2Utils.js";import{truncate as T}from"../../utils/format.js";import{getDisplayPath as D}from"../../utils/file.js";import{Clawd as X}from"./Clawd.js";import{FeedColumn as g}from"./FeedColumn.js";import{createRecentActivityFeed as S,createWhatsNewFeed as N,createProjectOnboardingFeed as U,createGuestPassesFeed as L}from"./feedConfigs.js";import{getGlobalConfig as I,saveGlobalConfig as x}from"../../utils/config.js";import{resolveThemeSetting as v}from"../../utils/systemTheme.js";import{getInitialSettings as M}from"../../utils/settings/settings.js";import{isDebugMode as j,isDebugToStdErr as F,getDebugLogPath as b}from"../../utils/debug.js";import{useEffect as R,useState as A}from"react";import{getSteps as P,shouldShowProjectOnboarding as y,incrementProjectOnboardingSeenCount as $}from"../../projectOnboardingState.js";import{CondensedLogo as w}from"./CondensedLogo.js";import{OffscreenFreeze as z}from"../OffscreenFreeze.js";import{checkForReleaseNotesSync as V}from"../../utils/releaseNotes.js";import{getDumpPromptsPath as G}from"../../services/api/dumpPrompts.js";import{isEnvTruthy as k}from"../../utils/envUtils.js";import{getStartupPerfLogPath as W,isDetailedProfilingEnabled as H}from"../../utils/startupProfiler.js";import{EmergencyTip as K}from"./EmergencyTip.js";import{VoiceModeNotice as Y}from"./VoiceModeNotice.js";import{Opus1mMergeNotice as B}from"./Opus1mMergeNotice.js";const q=o("KAIROS")||o("KAIROS_CHANNELS")?s("./ChannelsNotice.js"):null;import{SandboxManager as J}from"../../utils/sandbox/sandbox-adapter.js";import{useShowGuestPassesUpsell as Q,incrementGuestPassesSeenCount as Z}from"./GuestPassesUpsell.js";import{useShowOverageCreditUpsell as ee,incrementOverageCreditUpsellSeenCount as oe,createOverageCreditFeed as ne}from"./OverageCreditUpsell.js";import{useAppState as re}from"../../state/AppState.js";import{getEffortSuffix as te}from"../../utils/effort.js";import{useMainLoopModel as ie}from"../../hooks/useMainLoopModel.js";import{renderModelSetting as se}from"../../utils/model/model.js";const ce=120;export function LogoV2(){const o=c(94),i=E(),s=I().oauthAccount?.displayName??"",{columns:D}=d();let G;o[0]===Symbol.for("react.memo_cache_sentinel")?(G=y(),o[0]=G):G=o[0];const W=G;let H;o[1]===Symbol.for("react.memo_cache_sentinel")?(H=J.isSandboxingEnabled(),o[1]=H):H=o[1];const le=H,me=Q(),ae=ee(),de=re(_temp),_e=re(_temp2),pe=I();let Ce;try{Ce=u(3)}catch{Ce=[]}const[fe]=A(()=>{const e=M().companyAnnouncements;if(e&&0!==e.length)return 1===pe.numStartups?e[0]:e[Math.floor(Math.random()*e.length)]}),{hasReleaseNotes:he}=V(pe.lastReleaseNotesSeen);let Ee,ue,Oe;o[2]===Symbol.for("react.memo_cache_sentinel")?(Ee=()=>{I().lastReleaseNotesSeen!==e.VERSION&&(x(_temp3),W&&$())},o[2]=Ee):Ee=o[2],o[3]!==pe?(ue=[pe,W],o[3]=pe,o[4]=ue):ue=o[4],R(Ee,ue),o[5]===Symbol.for("react.memo_cache_sentinel")?(Oe=!(he||W||k(process.env.CONTEXT_CODE_FORCE_FULL_LOGO)||k(process.env.CLAUDE_CODE_FORCE_FULL_LOGO)),o[5]=Oe):Oe=o[5];const Te=Oe;let De,Xe,ge,Se;o[6]!==me?(De=()=>{!me||W||Te||Z()},Xe=[me,W,Te],o[6]=me,o[7]=De,o[8]=Xe):(De=o[7],Xe=o[8]),R(De,Xe),o[9]!==me||o[10]!==ae?(ge=()=>{!ae||W||me||Te||oe()},Se=[ae,W,me,Te],o[9]=me,o[10]=ae,o[11]=ge,o[12]=Se):(ge=o[11],Se=o[12]),R(ge,Se);const Ne=ie(),Ue=se(Ne),{version:Le,cwd:Ie,billingType:xe,agentName:ve}=O(),Me=de??ve,je=Ue+te(Ne,_e);let Fe;o[13]!==je?(Fe=T(je,100),o[13]=je,o[14]=Fe):Fe=o[14];const be=Fe;if(!(he||W||k(process.env.CONTEXT_CODE_FORCE_FULL_LOGO)||k(process.env.CLAUDE_CODE_FORCE_FULL_LOGO))){let e,i,s,c,a,d,_,p,C,f,h,E,u;return o[15]===Symbol.for("react.memo_cache_sentinel")?(e=n(w,{}),i=n(Y,{}),s=n(B,{}),c=q&&n(q.ChannelsNotice,{}),a=j()&&r(l,{paddingLeft:2,flexDirection:"column",children:[n(m,{color:"warning",children:"Debug mode enabled"}),r(m,{dimColor:!0,children:["Logging to: ",F()?"stderr":b()]})]}),d=n(K,{}),_=(process.env.CONTEXT_CODE_TMUX_SESSION??process.env.CLAUDE_CODE_TMUX_SESSION)&&r(l,{paddingLeft:2,flexDirection:"column",children:[r(m,{dimColor:!0,children:["tmux session: ",process.env.CONTEXT_CODE_TMUX_SESSION??process.env.CLAUDE_CODE_TMUX_SESSION]}),n(m,{dimColor:!0,children:process.env.CONTEXT_CODE_TMUX_PREFIX_CONFLICTS??process.env.CLAUDE_CODE_TMUX_PREFIX_CONFLICTS?`Detach: ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX} ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX} d (press prefix twice - Claude uses ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX})`:`Detach: ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX} d`})]}),o[15]=e,o[16]=i,o[17]=s,o[18]=c,o[19]=a,o[20]=d,o[21]=_):(e=o[15],i=o[16],s=o[17],c=o[18],a=o[19],d=o[20],_=o[21]),o[22]!==fe||o[23]!==pe?(p=fe&&r(l,{paddingLeft:2,flexDirection:"column",children:[!process.env.IS_DEMO&&pe.oauthAccount?.organizationName&&r(m,{dimColor:!0,children:["Message from ",pe.oauthAccount.organizationName,":"]}),n(m,{children:fe})]}),o[22]=fe,o[23]=pe,o[24]=p):p=o[24],o[25]===Symbol.for("react.memo_cache_sentinel")?(C=!1,f=!1,h=!1,E=!1,o[25]=C,o[26]=f,o[27]=h,o[28]=E):(C=o[25],f=o[26],h=o[27],E=o[28]),o[29]!==p?(u=r(t,{children:[e,i,s,c,a,d,_,p,C,f,h,E]}),o[29]=p,o[30]=u):u=o[30],u}const Re=p(D),Ae=v(I().theme),Pe=` ${a("context",Ae)("CTX")} ${a("inactive",Ae)(`v${Le}`)} `,ye=a("context",Ae)(" CTX ");if("compact"===Re){let e=f(s);if(_(e)>D-4){let n;o[31]===Symbol.for("react.memo_cache_sentinel")?(n=f(null),o[31]=n):n=o[31],e=n}const i=h(Ie,Math.max(D-4,10));let c,a,d,p,C,E,u,O,T;return o[32]!==ye?(c={content:ye,position:"top",align:"start",offset:1},o[32]=ye,o[33]=c):c=o[33],o[34]===Symbol.for("react.memo_cache_sentinel")?(a=n(l,{marginY:1,children:n(X,{})}),o[34]=a):a=o[34],o[35]!==be?(d=n(m,{dimColor:!0,children:be}),o[35]=be,o[36]=d):d=o[36],o[37]===Symbol.for("react.memo_cache_sentinel")?(p=n(Y,{}),C=n(B,{}),E=q&&n(q.ChannelsNotice,{}),o[37]=p,o[38]=C,o[39]=E):(p=o[37],C=o[38],E=o[39]),o[40]!==le?(u=le&&n(l,{marginTop:1,flexDirection:"column",children:n(m,{color:"warning",children:"Tus comandos bash se ejecutarán en sandbox. Desactiva con /sandbox."})}),o[40]=le,o[41]=u):u=o[41],o[42]===Symbol.for("react.memo_cache_sentinel")?(O=!1,T=!1,o[42]=O,o[43]=T):(O=o[42],T=o[43]),r(t,{children:[n(z,{children:r(l,{flexDirection:"column",paddingX:2,paddingY:1,alignItems:"center",width:D,children:[n(m,{color:"context",children:"CTX"}),n(m,{bold:!0,children:e}),a,n(m,{dimColor:!0,children:be}),n(m,{dimColor:!0,children:xe}),Me?r(m,{dimColor:!0,children:["@",Me]}):null,n(m,{dimColor:!0,children:i})]})}),p,C,E,u,O,T]})}const $e=f(s),we=(ze=pe.oauthAccount?.organizationName,ze?ze.replace(/\s*,\s*(Inc\.|Inc|LLC|Ltd\.|Ltd|S\.A\.|S\.A|Corp\.|Corp)\b/gi,"").trim():"");var ze;const Ve=`${be} · ${xe}`,Ge=!process.env.IS_DEMO&&we?`Organización: ${we}`:null,ke=Me?119-_(Me)-3:ce,We=h(Ie,Math.max(ke,10)),He=Me?`@${Me} · ${We}`:We,Ke=Math.max(_($e),23+_(He),23+_(Ve),Ge?23+_(Ge):0),Ye=Math.min(Ke+4,ce),{leftWidth:Be,rightWidth:qe}=C(D,Re,Ye),Je=z,Qe=l;let Ze;o[44]!==Pe?(Ze={content:Pe,position:"top",align:"start",offset:3},o[44]=Pe,o[45]=Ze):Ze=o[45];const eo=l,oo="column";let no,ro,to,io,so,co,lo;o[46]!==$e?(no=n(l,{marginTop:1,children:n(m,{bold:!0,children:$e})}),o[46]=$e,o[47]=no):no=o[47],o[48]===Symbol.for("react.memo_cache_sentinel")?(ro=n(l,{alignSelf:"flex-start",children:n(X,{})}),o[48]=ro):ro=o[48],o[49]!==Ve||o[50]!==Ge?(to=r(l,{flexDirection:"column",alignItems:"flex-start",children:[n(m,{dimColor:!0,children:Ve}),Ge&&n(m,{dimColor:!0,children:Ge})]}),o[49]=Ve,o[50]=to):to=o[50],o[51]!==He?(io=n(m,{dimColor:!0,children:He}),o[51]=He,o[52]=io):io=o[52],o[53]!==to||o[54]!==io?(so=r(l,{flexDirection:"column",alignItems:"center",children:[n(m,{color:"context",children:"CTX"}),to,io]}),o[53]=to,o[54]=io,o[55]=so):so=o[55],o[56]!==Be||o[57]!==no||o[58]!==so?(co=r(l,{flexDirection:"column",width:Be,minHeight:11,children:[n(l,{alignSelf:"flex-start",children:no}),r(l,{flexDirection:"row",alignItems:"center",gap:3,marginTop:1,children:[n(l,{flexDirection:"column",alignItems:"center",width:20,children:n(X,{})}),r(l,{flexDirection:"column",alignItems:"flex-start",flexGrow:1,width:Be-23,children:[to,io]})]})]}),o[56]=Be,o[57]=no,o[58]=so,o[59]=co):co=o[59],o[60]!==Re?(lo=null,o[60]=Re,o[61]=lo):lo=o[61];const mo=n(g,{feeds:W?[U(P()),S(i)]:me?[S(i),L()]:ae?[S(i),ne()]:[S(i),N(Ce)],maxWidth:Math.max(Be,qe)});let ao,_o,po,Co,fo,ho,Eo,uo,Oo,To,Do,Xo,go,So,No,Uo;return o[62]!==eo||o[63]!==oo||o[64]!==co||o[65]!==lo||o[66]!==mo?(ao=r(eo,{flexDirection:oo,paddingX:2,gap:2,children:[co,lo]}),o[62]=eo,o[63]=oo,o[64]=co,o[65]=lo,o[66]=mo,o[67]=ao):ao=o[67],o[68]!==Qe||o[69]!==Ze||o[70]!==ao?(_o=n(Qe,{flexDirection:"column",children:ao}),o[68]=Qe,o[69]=Ze,o[70]=ao,o[71]=_o):_o=o[71],o[72]!==Je||o[73]!==_o?(po=n(Je,{children:_o}),o[72]=Je,o[73]=_o,o[74]=po):po=o[74],o[75]===Symbol.for("react.memo_cache_sentinel")?(Co=n(Y,{}),fo=n(B,{}),ho=q&&n(q.ChannelsNotice,{}),Eo=j()&&r(l,{paddingLeft:2,flexDirection:"column",children:[n(m,{color:"warning",children:"Debug mode enabled"}),r(m,{dimColor:!0,children:["Logging to: ",F()?"stderr":b()]})]}),uo=n(K,{}),Oo=(process.env.CONTEXT_CODE_TMUX_SESSION??process.env.CLAUDE_CODE_TMUX_SESSION)&&r(l,{paddingLeft:2,flexDirection:"column",children:[r(m,{dimColor:!0,children:["tmux session: ",process.env.CONTEXT_CODE_TMUX_SESSION??process.env.CLAUDE_CODE_TMUX_SESSION]}),n(m,{dimColor:!0,children:process.env.CONTEXT_CODE_TMUX_PREFIX_CONFLICTS??process.env.CLAUDE_CODE_TMUX_PREFIX_CONFLICTS?`Detach: ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX} ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX} d (press prefix twice - Claude uses ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX})`:`Detach: ${process.env.CONTEXT_CODE_TMUX_PREFIX??process.env.CLAUDE_CODE_TMUX_PREFIX} d`})]}),o[75]=Co,o[76]=fo,o[77]=ho,o[78]=Eo,o[79]=uo,o[80]=Oo):(Co=o[75],fo=o[76],ho=o[77],Eo=o[78],uo=o[79],Oo=o[80]),o[81]!==fe||o[82]!==pe?(To=fe&&r(l,{paddingLeft:2,flexDirection:"column",children:[!process.env.IS_DEMO&&pe.oauthAccount?.organizationName&&r(m,{dimColor:!0,children:["Message from ",pe.oauthAccount.organizationName,":"]}),n(m,{children:fe})]}),o[81]=fe,o[82]=pe,o[83]=To):To=o[83],o[84]!==le?(Do=le&&n(l,{paddingLeft:2,flexDirection:"column",children:n(m,{color:"warning",children:"Tus comandos bash se ejecutarán en sandbox. Desactiva con /sandbox."})}),o[84]=le,o[85]=Do):Do=o[85],o[86]===Symbol.for("react.memo_cache_sentinel")?(Xo=!1,go=!1,So=!1,No=!1,o[86]=Xo,o[87]=go,o[88]=So,o[89]=No):(Xo=o[86],go=o[87],So=o[88],No=o[89]),o[90]!==po||o[91]!==To||o[92]!==Do?(Uo=r(t,{children:[po,Co,fo,ho,Eo,uo,Oo,To,Do,Xo,go,So,No]}),o[90]=po,o[91]=To,o[92]=Do,o[93]=Uo):Uo=o[93],Uo}function _temp3(o){return o.lastReleaseNotesSeen===e.VERSION?o:{...o,lastReleaseNotesSeen:e.VERSION}}function _temp2(e){return e.effortValue}function _temp(e){return e.agent}
@@ -1 +1 @@
1
- import{MACRO as r}from"../../recovery/bunBundleShim.js";import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Box as i,Text as n}from"../../ink.js";import{Clawd as d}from"./Clawd.js";export function WelcomeV2(){return e(i,{flexDirection:"column",width:54,children:o(i,{borderStyle:"round",borderColor:"claude",paddingX:3,paddingY:1,flexDirection:"column",alignItems:"center",children:[e(n,{color:"claude",children:"CTX"}),e(n,{bold:!0,children:"Context Code"}),o(n,{dimColor:!0,children:["v",r.VERSION]}),e(i,{marginTop:1,marginBottom:1,children:e(d,{})}),e(n,{children:"Lee, edita y ejecuta sin perder contexto."}),e(n,{dimColor:!0,children:"Configuracion inicial"})]})})}
1
+ import{MACRO as r}from"../../recovery/bunBundleShim.js";import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Box as i,Text as n}from"../../ink.js";import{Clawd as t}from"./Clawd.js";export function WelcomeV2(){return e(i,{flexDirection:"column",width:54,children:o(i,{borderStyle:"round",borderColor:"context",paddingX:3,paddingY:1,flexDirection:"column",alignItems:"center",children:[e(n,{color:"context",children:"CTX"}),e(n,{bold:!0,children:"Context Code"}),o(n,{dimColor:!0,children:["v",r.VERSION]}),e(i,{marginTop:1,marginBottom:1,children:e(t,{})}),e(n,{children:"Lee, edita y ejecuta sin perder contexto."}),e(n,{dimColor:!0,children:"Configuracion inicial"})]})})}
@@ -1 +1 @@
1
- import{feature as e}from"../../recovery/bunBundleShim.js";import{jsxs as t,jsx as o}from"react/jsx-runtime";import{createRequire as r}from"module";const s=r(import.meta.url);import{c as i}from"react/compiler-runtime";const n=e("COORDINATOR_MODE")?s("../../coordinator/coordinatorMode.js"):void 0;import{Box as a,Text as l,Link as c}from"../../ink.js";import m from"figures";import{useEffect as u,useMemo as d,useRef as h,useState as p,useSyncExternalStore as f}from"react";import{isVimModeEnabled as g}from"./utils.js";import{useShortcutDisplay as S}from"../../keybindings/useShortcutDisplay.js";import{isDefaultMode as k,permissionModeSymbol as C,permissionModeTitle as v,getModeColor as j}from"../../utils/permissions/PermissionMode.js";import{BackgroundTaskStatus as O}from"../tasks/BackgroundTaskStatus.js";import{isBackgroundTask as E}from"../../tasks/types.js";import{isPanelAgentTask as b}from"../../tasks/LocalAgentTask/LocalAgentTask.js";import{getVisibleAgentTasks as y}from"../CoordinatorAgentStatus.js";import{count as I}from"../../utils/array.js";import{shouldHideTasksFooter as x}from"../tasks/taskStatusUtils.js";import{isAgentSwarmsEnabled as T}from"../../utils/agentSwarmsEnabled.js";import{TeamStatus as w}from"../teams/TeamStatus.js";import{isInProcessEnabled as M}from"../../utils/swarm/backends/registry.js";import{useAppState as P,useAppStateStore as _}from"../../state/AppState.js";import{getIsRemoteMode as D}from"../../bootstrap/state.js";import V from"./HistorySearchInput.js";import{usePrStatus as A}from"../../hooks/usePrStatus.js";import{KeyboardShortcutHint as F}from"../design-system/KeyboardShortcutHint.js";import{Byline as R}from"../design-system/Byline.js";import{useTerminalSize as H}from"../../hooks/useTerminalSize.js";import{useTasksV2 as L}from"../../hooks/useTasksV2.js";import{formatDuration as U}from"../../utils/format.js";import{VoiceWarmupHint as N}from"./VoiceIndicator.js";import{useVoiceEnabled as B}from"../../hooks/useVoiceEnabled.js";import{useVoiceState as Y}from"../../context/voice.js";import{isFullscreenEnvEnabled as K}from"../../utils/fullscreen.js";import{isXtermJs as Q}from"../../ink/terminal.js";import{useHasSelection as z,useSelection as G}from"../../ink/hooks/use-selection.js";import{getGlobalConfig as W,saveGlobalConfig as q}from"../../utils/config.js";import{getPlatform as J}from"../../utils/platform.js";import{PrBadge as X}from"../PrBadge.js";const Z=e("PROACTIVE")||e("KAIROS")?s("../../proactive/index.js"):null,NO_OP_SUBSCRIBE=e=>()=>{},NULL=()=>null;function ProactiveCountdown(){const e=i(7),o=f(Z?.subscribeToProactiveChanges??NO_OP_SUBSCRIBE,Z?.getNextTickAt??NULL,NULL),[r,s]=p(null);let n,a;if(e[0]!==o?(n=()=>{if(null===o)return void s(null);const update=function(){const e=Math.max(0,Math.ceil((o-Date.now())/1e3));s(e)};update();const e=setInterval(update,1e3);return()=>clearInterval(e)},a=[o],e[0]=o,e[1]=n,e[2]=a):(n=e[1],a=e[2]),u(n,a),null===r)return null;const c=1e3*r;let m,d;return e[3]!==c?(m=U(c,{mostSignificantOnly:!0}),e[3]=c,e[4]=m):m=e[4],e[5]!==m?(d=t(l,{dimColor:!0,children:["esperando"," ",m]}),e[5]=m,e[6]=d):d=e[6],d}export function PromptInputFooterLeftSide(e){const r=i(27),{exitMessage:s,vimMode:n,mode:c,toolPermissionContext:m,suppressHint:u,isLoading:d,tasksSelected:h,teamsSelected:p,tmuxSelected:f,teammateFooterIndex:S,isPasting:k,isSearching:C,historyQuery:v,setHistoryQuery:j,historyFailedMatch:O,onOpenTasksDialog:E}=e;if(s.show){let e;return r[0]!==s.key?(e=t(l,{dimColor:!0,children:["Presiona ",s.key," de nuevo para salir"]},"exit-message"),r[0]=s.key,r[1]=e):e=r[1],e}if(k){let e;return r[2]===Symbol.for("react.memo_cache_sentinel")?(e=o(l,{dimColor:!0,children:"Pegando texto…"},"pasting-message"),r[2]=e):e=r[2],e}let b;r[3]!==C||r[4]!==n?(b=g()&&"INSERT"===n&&!C,r[3]=C,r[4]=n,r[5]=b):b=r[5];const y=b;let I,x;r[6]!==O||r[7]!==v||r[8]!==C||r[9]!==j?(I=C&&o(V,{value:v,onChange:j,historyFailedMatch:O}),r[6]=O,r[7]=v,r[8]=C,r[9]=j,r[10]=I):I=r[10],r[11]!==y?(x=y?o(l,{dimColor:!0,children:"-- INSERT --"},"vim-insert"):null,r[11]=y,r[12]=x):x=r[12];const T=!u&&!y;let w,M;return r[13]!==d||r[14]!==c||r[15]!==E||r[16]!==T||r[17]!==h||r[18]!==S||r[19]!==p||r[20]!==f||r[21]!==m?(w=o(ModeIndicator,{mode:c,toolPermissionContext:m,showHint:T,isLoading:d,tasksSelected:h,teamsSelected:p,teammateFooterIndex:S,tmuxSelected:f,onOpenTasksDialog:E}),r[13]=d,r[14]=c,r[15]=E,r[16]=T,r[17]=h,r[18]=S,r[19]=p,r[20]=f,r[21]=m,r[22]=w):w=r[22],r[23]!==I||r[24]!==x||r[25]!==w?(M=t(a,{justifyContent:"flex-start",gap:1,children:[I,x,w]}),r[23]=I,r[24]=x,r[25]=w,r[26]=M):M=r[26],M}function ModeIndicator({mode:r,toolPermissionContext:s,showHint:i,isLoading:g,tasksSelected:V,teamsSelected:U,tmuxSelected:$,teammateFooterIndex:ee,onOpenTasksDialog:te}){const{columns:oe}=H(),re=S("chat:cycleMode","Chat","shift+tab"),se=P(e=>e.tasks),ie=P(e=>e.teamContext),ne=_(),[ae]=p(()=>ne.getState().remoteSessionUrl),le=P(e=>e.viewSelectionMode),ce=P(e=>e.viewingAgentTaskId),me=P(e=>e.expandedView),ue="teammates"===me,de=A(g,isPrStatusEnabled()),he=(P(e=>"ant"===process.env.USER_TYPE&&void 0!==e.tungstenActiveSession),f(Z?.subscribeToProactiveChanges??NO_OP_SUBSCRIBE,Z?.getNextTickAt??NULL,NULL)),pe=!!e("VOICE_MODE")&&B(),fe=e("VOICE_MODE")?Y(e=>e.voiceState):"idle",ge=!!e("VOICE_MODE")&&Y(e=>e.voiceWarmingUp),Se=z(),ke=G().getState,Ce=null!==he,ve=!!e("COORDINATOR_MODE")&&!0===n?.isCoordinatorMode(),je=d(()=>I(Object.values(se),e=>E(e)&&!("ant"===process.env.USER_TYPE&&b(e))),[se]),Oe=L(),Ee=void 0!==Oe&&Oe.length>0,be=S("chat:cancel","Chat","esc").toLowerCase(),ye=S("app:toggleTodos","Global","ctrl+t"),Ie=S("chat:killAgents","Chat","ctrl+x ctrl+k"),xe=e("VOICE_MODE")?S("voice:pushToTalk","Chat","Space"):"",[Te]=e("VOICE_MODE")?p(()=>(W().voiceFooterHintSeenCount??0)<3):[!1],we=e("VOICE_MODE")?h(!1):null;u(()=>{if(e("VOICE_MODE")){if(!pe||!Te)return;if(we?.current)return;we&&(we.current=!0);const e=(W().voiceFooterHintSeenCount??0)+1;q(t=>(t.voiceFooterHintSeenCount??0)>=e?t:{...t,voiceFooterHintSeenCount:e})}},[pe,Te]);const Me=P(e=>"kill-agents-confirm"===e.notifications.current?.key),Pe=T()&&!M()&&void 0!==ie&&I(Object.values(ie.teammates),e=>"team-lead"!==e.name)>0;if("bash"===r)return o(l,{color:"bashBorder",children:"! para modo bash"});const _e=s?.mode,De=!k(_e),Ve=ce?se[ce]:void 0,Ae="viewing-agent"===le&&"in_process_teammate"===Ve?.type,Fe=Ae&&null!=Ve&&"running"!==Ve.status,Re=je>0||Ae,He=(ve||De?1:0)+(Re?1:0)+(Pe?1:0),Le=isPrStatusEnabled()&&null!==de.number&&null!==de.reviewState&&null!==de.url&&He<2&&(0===He||oe>=80),Ue=He<2,Ne=!ue&&Re&&Object.values(se).some(e=>"in_process_teammate"===e.type)||!ue&&Ae,Be=_e&&De&&!D()?t(l,{color:j(_e),children:[C(_e)," ",v(_e).toLowerCase()," activado",Ue&&t(l,{dimColor:!0,children:[" ",o(F,{shortcut:re,action:"cambiar",parens:!0})]})]},"mode"):null,Ye=[...ae?[o(c,{url:ae,children:t(l,{color:"ide",children:[m.circleDouble," remoto"]})},"remote")]:[],...(process.env.USER_TYPE,[]),...T()&&Pe?[o(w,{teamsSelected:U,showHint:i&&!Re},"teams")]:[],...Le?[o(X,{number:de.number,url:de.url,reviewState:de.reviewState},"pr-status")]:[]],Ke=Object.values(se).some(e=>"in_process_teammate"===e.type&&"running"===e.status),Qe=Object.values(se).some(e=>"local_agent"===e.type&&"running"===e.status),ze=i?function(e,t,r,s,i,n,a,c,m){let u;if(a)switch(n){case"none":u="mostrar tareas";break;case"tasks":u="mostrar compañeros";break;case"teammates":u="ocultar"}else u="tasks"===n?"ocultar tareas":"mostrar tareas";const d=i||a;return[...e?[o(l,{dimColor:!0,children:o(F,{shortcut:t,action:"interrumpir"})},"esc")]:[],...e||!c||m?[]:[o(l,{dimColor:!0,children:o(F,{shortcut:s,action:"detener agentes"})},"kill-agents")],...d?[o(l,{dimColor:!0,children:o(F,{shortcut:r,action:u})},"toggle-tasks")]:[]]}(!!g,be,ye,Ie,!!Ee,me,!!Ke,!!Qe,!!Me):[];if(Fe?Ye.push(o(l,{dimColor:!0,children:o(F,{shortcut:be,action:"volver al líder"})},"esc-return")):(e("PROACTIVE")||e("KAIROS"))&&Ce?Ye.push(o(ProactiveCountdown,{},"proactive")):!Ne&&i&&Ye.push(...ze),Ne){const e=[...Be?[Be]:[],...Ye,...Fe?[]:ze];return t(a,{flexDirection:"column",children:[o(a,{children:o(O,{tasksSelected:V,isViewingTeammate:Ae,teammateFooterIndex:ee,isLeaderIdle:!g,onOpenDialog:te})}),e.length>0&&o(a,{children:o(R,{children:e})})]})}const Ge="ant"===process.env.USER_TYPE&&y(se).length>0,We=!Re||Ne||x(se,ue)?null:o(O,{tasksSelected:V,isViewingTeammate:Ae,teammateFooterIndex:ee,isLeaderIdle:!g,onOpenDialog:te});0!==Ye.length||We||Be||!i||Ye.push(o(l,{dimColor:!0,children:"? para atajos"},"shortcuts-hint"));const qe=W().copyOnSelect??!0,Je=Se&&(!qe||Q());if(e("VOICE_MODE")&&pe&&ge)Ye.push(o(N,{},"voice-warmup"));else if(K()&&Je){const e="macos"===J(),r=e&&(ke()?.lastPressHadAlt??!1);Ye.push(o(l,{dimColor:!0,children:t(R,{children:[!qe&&o(F,{shortcut:"ctrl+c",action:"copy"}),Q()&&(r?o(l,{children:"ajusta macOptionClickForcesSelection en la configuración de VS Code"}):o(F,{shortcut:e?"option+click":"shift+click",action:"selección nativa"}))]})},"selection-copy"))}else e("VOICE_MODE")&&Ye.length>0&&i&&pe&&"idle"===fe&&0===ze.length&&Te&&Ye.push(t(l,{dimColor:!0,children:["mantén ",xe," para hablar"]},"voice-hint"));return(We||Ge)&&i&&!Pe&&Ye.push(o(l,{dimColor:!0,children:o(F,V?{shortcut:"Enter",action:"ver tareas"}:{shortcut:"↓",action:"gestionar"})},"manage-tasks")),0!==Ye.length||We||Be?t(a,{height:1,overflow:"hidden",children:[Be&&t(a,{flexShrink:0,children:[Be,(We||Ye.length>0)&&o(l,{dimColor:!0,children:" · "})]}),We&&t(a,{flexShrink:0,children:[We,Ye.length>0&&o(l,{dimColor:!0,children:" · "})]}),Ye.length>0&&o(l,{wrap:"truncate",children:o(R,{children:Ye})})]}):K()?o(l,{children:" "}):null}function isPrStatusEnabled(){return W().prStatusFooterEnabled??!0}
1
+ import{feature as e}from"../../recovery/bunBundleShim.js";import{jsxs as t,jsx as o}from"react/jsx-runtime";import{createRequire as r}from"module";const s=r(import.meta.url);import{c as i}from"react/compiler-runtime";const n=e("COORDINATOR_MODE")?s("../../coordinator/coordinatorMode.js"):void 0;import{Box as a,Text as l,Link as c}from"../../ink.js";import m from"figures";import{useEffect as u,useMemo as d,useRef as h,useState as p,useSyncExternalStore as f}from"react";import{isVimModeEnabled as g}from"./utils.js";import{useShortcutDisplay as S}from"../../keybindings/useShortcutDisplay.js";import{isDefaultMode as k,permissionModeSymbol as v,permissionModeTitle as C,getModeColor as j}from"../../utils/permissions/PermissionMode.js";import{BackgroundTaskStatus as O}from"../tasks/BackgroundTaskStatus.js";import{isBackgroundTask as E}from"../../tasks/types.js";import{isPanelAgentTask as b}from"../../tasks/LocalAgentTask/LocalAgentTask.js";import{getVisibleAgentTasks as y}from"../CoordinatorAgentStatus.js";import{count as I}from"../../utils/array.js";import{shouldHideTasksFooter as x}from"../tasks/taskStatusUtils.js";import{isAgentSwarmsEnabled as T}from"../../utils/agentSwarmsEnabled.js";import{TeamStatus as w}from"../teams/TeamStatus.js";import{isInProcessEnabled as M}from"../../utils/swarm/backends/registry.js";import{useAppState as P,useAppStateStore as _}from"../../state/AppState.js";import{getIsRemoteMode as D}from"../../bootstrap/state.js";import V from"./HistorySearchInput.js";import{usePrStatus as A}from"../../hooks/usePrStatus.js";import{KeyboardShortcutHint as F}from"../design-system/KeyboardShortcutHint.js";import{Byline as R}from"../design-system/Byline.js";import{useTerminalSize as H}from"../../hooks/useTerminalSize.js";import{useTasksV2 as L}from"../../hooks/useTasksV2.js";import{formatDuration as U}from"../../utils/format.js";import{VoiceWarmupHint as N}from"./VoiceIndicator.js";import{useVoiceEnabled as B}from"../../hooks/useVoiceEnabled.js";import{useVoiceState as Y}from"../../context/voice.js";import{isFullscreenEnvEnabled as K}from"../../utils/fullscreen.js";import{isXtermJs as Q}from"../../ink/terminal.js";import{useHasSelection as z,useSelection as G}from"../../ink/hooks/use-selection.js";import{getGlobalConfig as W,saveGlobalConfig as q}from"../../utils/config.js";import{getPlatform as J}from"../../utils/platform.js";import{PrBadge as X}from"../PrBadge.js";const Z=e("PROACTIVE")||e("KAIROS")?s("../../proactive/index.js"):null,NO_OP_SUBSCRIBE=e=>()=>{},NULL=()=>null;function ProactiveCountdown(){const e=i(7),o=f(Z?.subscribeToProactiveChanges??NO_OP_SUBSCRIBE,Z?.getNextTickAt??NULL,NULL),[r,s]=p(null);let n,a;if(e[0]!==o?(n=()=>{if(null===o)return void s(null);const update=function(){const e=Math.max(0,Math.ceil((o-Date.now())/1e3));s(e)};update();const e=setInterval(update,1e3);return()=>clearInterval(e)},a=[o],e[0]=o,e[1]=n,e[2]=a):(n=e[1],a=e[2]),u(n,a),null===r)return null;const c=1e3*r;let m,d;return e[3]!==c?(m=U(c,{mostSignificantOnly:!0}),e[3]=c,e[4]=m):m=e[4],e[5]!==m?(d=t(l,{dimColor:!0,children:["esperando"," ",m]}),e[5]=m,e[6]=d):d=e[6],d}export function PromptInputFooterLeftSide(e){const r=i(27),{exitMessage:s,vimMode:n,mode:c,toolPermissionContext:m,suppressHint:u,isLoading:d,tasksSelected:h,teamsSelected:p,tmuxSelected:f,teammateFooterIndex:S,isPasting:k,isSearching:v,historyQuery:C,setHistoryQuery:j,historyFailedMatch:O,onOpenTasksDialog:E}=e;if(s.show){let e;return r[0]!==s.key?(e=t(l,{dimColor:!0,children:["Presiona ",s.key," de nuevo para salir"]},"exit-message"),r[0]=s.key,r[1]=e):e=r[1],e}if(k){let e;return r[2]===Symbol.for("react.memo_cache_sentinel")?(e=o(l,{dimColor:!0,children:"Pegando texto…"},"pasting-message"),r[2]=e):e=r[2],e}let b;r[3]!==v||r[4]!==n?(b=g()&&"INSERT"===n&&!v,r[3]=v,r[4]=n,r[5]=b):b=r[5];const y=b;let I,x;r[6]!==O||r[7]!==C||r[8]!==v||r[9]!==j?(I=v&&o(V,{value:C,onChange:j,historyFailedMatch:O}),r[6]=O,r[7]=C,r[8]=v,r[9]=j,r[10]=I):I=r[10],r[11]!==y?(x=y?o(l,{dimColor:!0,children:"-- INSERT --"},"vim-insert"):null,r[11]=y,r[12]=x):x=r[12];const T=!u&&!y;let w,M;return r[13]!==d||r[14]!==c||r[15]!==E||r[16]!==T||r[17]!==h||r[18]!==S||r[19]!==p||r[20]!==f||r[21]!==m?(w=o(ModeIndicator,{mode:c,toolPermissionContext:m,showHint:T,isLoading:d,tasksSelected:h,teamsSelected:p,teammateFooterIndex:S,tmuxSelected:f,onOpenTasksDialog:E}),r[13]=d,r[14]=c,r[15]=E,r[16]=T,r[17]=h,r[18]=S,r[19]=p,r[20]=f,r[21]=m,r[22]=w):w=r[22],r[23]!==I||r[24]!==x||r[25]!==w?(M=t(a,{justifyContent:"flex-start",gap:1,children:[I,x,w]}),r[23]=I,r[24]=x,r[25]=w,r[26]=M):M=r[26],M}function ModeIndicator({mode:r,toolPermissionContext:s,showHint:i,isLoading:g,tasksSelected:V,teamsSelected:U,tmuxSelected:$,teammateFooterIndex:ee,onOpenTasksDialog:te}){const{columns:oe}=H(),re=S("chat:cycleMode","Chat","shift+tab"),se=P(e=>e.tasks),ie=P(e=>e.teamContext),ne=_(),[ae]=p(()=>ne.getState().remoteSessionUrl),le=P(e=>e.viewSelectionMode),ce=P(e=>e.viewingAgentTaskId),me=P(e=>e.expandedView),ue="teammates"===me,de=A(g,isPrStatusEnabled()),he=(P(e=>"ant"===process.env.USER_TYPE&&void 0!==e.tungstenActiveSession),f(Z?.subscribeToProactiveChanges??NO_OP_SUBSCRIBE,Z?.getNextTickAt??NULL,NULL)),pe=!!e("VOICE_MODE")&&B(),fe=e("VOICE_MODE")?Y(e=>e.voiceState):"idle",ge=!!e("VOICE_MODE")&&Y(e=>e.voiceWarmingUp),Se=z(),ke=G().getState,ve=null!==he,Ce=!!e("COORDINATOR_MODE")&&!0===n?.isCoordinatorMode(),je=d(()=>I(Object.values(se),e=>E(e)&&!("ant"===process.env.USER_TYPE&&b(e))),[se]),Oe=L(),Ee=void 0!==Oe&&Oe.length>0,be=S("chat:cancel","Chat","esc").toLowerCase(),ye=S("app:toggleTodos","Global","ctrl+t"),Ie=S("chat:killAgents","Chat","ctrl+x ctrl+k"),xe=e("VOICE_MODE")?S("voice:pushToTalk","Chat","Space"):"",[Te]=e("VOICE_MODE")?p(()=>(W().voiceFooterHintSeenCount??0)<3):[!1],we=e("VOICE_MODE")?h(!1):null;u(()=>{if(e("VOICE_MODE")){if(!pe||!Te)return;if(we?.current)return;we&&(we.current=!0);const e=(W().voiceFooterHintSeenCount??0)+1;q(t=>(t.voiceFooterHintSeenCount??0)>=e?t:{...t,voiceFooterHintSeenCount:e})}},[pe,Te]);const Me=P(e=>"kill-agents-confirm"===e.notifications.current?.key),Pe=T()&&!M()&&void 0!==ie&&I(Object.values(ie.teammates),e=>"team-lead"!==e.name)>0;if("bash"===r)return o(l,{color:"bashBorder",children:"! para modo bash"});const _e=s?.mode,De=!k(_e),Ve=ce?se[ce]:void 0,Ae="viewing-agent"===le&&"in_process_teammate"===Ve?.type,Fe=Ae&&null!=Ve&&"running"!==Ve.status,Re=je>0||Ae,He=(Ce||De?1:0)+(Re?1:0)+(Pe?1:0),Le=isPrStatusEnabled()&&null!==de.number&&null!==de.reviewState&&null!==de.url&&He<2&&(0===He||oe>=80),Ue=He<2,Ne=!ue&&Re&&Object.values(se).some(e=>"in_process_teammate"===e.type)||!ue&&Ae,Be=_e&&De&&!D()?t(l,{color:j(_e),children:[v(_e)," ",C(_e).toLowerCase()," activado",Ue&&t(l,{dimColor:!0,children:[" ",o(F,{shortcut:re,action:"cambiar",parens:!0})]})]},"mode"):null,Ye=[...ae?[o(c,{url:ae,children:t(l,{color:"ide",children:[m.circleDouble," remoto"]})},"remote")]:[],...(process.env.USER_TYPE,[]),...T()&&Pe?[o(w,{teamsSelected:U,showHint:i&&!Re},"teams")]:[],...Le?[o(X,{number:de.number,url:de.url,reviewState:de.reviewState},"pr-status")]:[]],Ke=Object.values(se).some(e=>"in_process_teammate"===e.type&&"running"===e.status),Qe=Object.values(se).some(e=>"local_agent"===e.type&&"running"===e.status),ze=i?function(e,t,r,s,i,n,a,c,m){let u;if(a)switch(n){case"none":u="mostrar tareas";break;case"tasks":u="mostrar compañeros";break;case"teammates":u="ocultar"}else u="tasks"===n?"ocultar tareas":"mostrar tareas";const d=i||a;return[...e?[o(l,{dimColor:!0,children:o(F,{shortcut:t,action:"interrumpir"})},"esc")]:[],...e||!c||m?[]:[o(l,{dimColor:!0,children:o(F,{shortcut:s,action:"detener agentes"})},"kill-agents")],...d?[o(l,{dimColor:!0,children:o(F,{shortcut:r,action:u})},"toggle-tasks")]:[]]}(!!g,be,ye,Ie,!!Ee,me,!!Ke,!!Qe,!!Me):[];if(Fe?Ye.push(o(l,{dimColor:!0,children:o(F,{shortcut:be,action:"volver al líder"})},"esc-return")):(e("PROACTIVE")||e("KAIROS"))&&ve?Ye.push(o(ProactiveCountdown,{},"proactive")):!Ne&&i&&Ye.push(...ze),Ne){const e=[...Be?[Be]:[],...Ye,...Fe?[]:ze];return t(a,{flexDirection:"column",children:[o(a,{children:o(O,{tasksSelected:V,isViewingTeammate:Ae,teammateFooterIndex:ee,isLeaderIdle:!g,onOpenDialog:te})}),e.length>0&&o(a,{children:o(R,{children:e})})]})}const Ge="ant"===process.env.USER_TYPE&&y(se).length>0,We=!Re||Ne||x(se,ue)?null:o(O,{tasksSelected:V,isViewingTeammate:Ae,teammateFooterIndex:ee,isLeaderIdle:!g,onOpenDialog:te}),qe=W().copyOnSelect??!0,Je=Se&&(!qe||Q());if(e("VOICE_MODE")&&pe&&ge)Ye.push(o(N,{},"voice-warmup"));else if(K()&&Je){const e="macos"===J(),r=e&&(ke()?.lastPressHadAlt??!1);Ye.push(o(l,{dimColor:!0,children:t(R,{children:[!qe&&o(F,{shortcut:"ctrl+c",action:"copy"}),Q()&&(r?o(l,{children:"ajusta macOptionClickForcesSelection en la configuración de VS Code"}):o(F,{shortcut:e?"option+click":"shift+click",action:"selección nativa"}))]})},"selection-copy"))}else e("VOICE_MODE")&&Ye.length>0&&i&&pe&&"idle"===fe&&0===ze.length&&Te&&Ye.push(t(l,{dimColor:!0,children:["mantén ",xe," para hablar"]},"voice-hint"));return(We||Ge)&&i&&!Pe&&Ye.push(o(l,{dimColor:!0,children:o(F,V?{shortcut:"Enter",action:"ver tareas"}:{shortcut:"↓",action:"gestionar"})},"manage-tasks")),0!==Ye.length||We||Be?t(a,{height:1,overflow:"hidden",children:[Be&&t(a,{flexShrink:0,children:[Be,(We||Ye.length>0)&&o(l,{dimColor:!0,children:" · "})]}),We&&t(a,{flexShrink:0,children:[We,Ye.length>0&&o(l,{dimColor:!0,children:" · "})]}),Ye.length>0&&o(l,{wrap:"truncate",children:o(R,{children:Ye})})]}):K()?o(l,{children:" "}):null}function isPrStatusEnabled(){return W().prStatusFooterEnabled??!0}
@@ -1 +1 @@
1
- import{jsxs as o,jsx as r}from"react/jsx-runtime";import{getTotalCost as e,getTotalInputTokens as t,getTotalOutputTokens as i}from"../cost-tracker.js";import{useMainLoopModel as n}from"../hooks/useMainLoopModel.js";import{Box as s,Text as m}from"../ink.js";import{getAPIProvider as l}from"../utils/model/providers.js";import{getCurrentUsage as d}from"../utils/tokens.js";function formatNumber(o){return o>=1e6?`${(o/1e6).toFixed(2)}M`:o>=1e3?`${(o/1e3).toFixed(1)}k`:String(o)}export const SessionTokenFooter=({messages:c})=>{const a=l(),u=n(),f=t(),p=i(),h=d(c),k=h?.input_tokens??0,j=h?.output_tokens??0,x=e(),b="firstParty"===a||"openai"===a||"bedrock"===a||"vertex"===a||"foundry"===a;return r(s,{paddingX:1,children:o(m,{dimColor:!0,children:[a," · ",u||"sin modelo"," ",o(m,{color:"cyan",children:["↑ ",formatNumber(f)]})," / ",o(m,{color:"green",children:["↓ ",formatNumber(p)]})," tokens en esta sesion",h&&o(m,{dimColor:!0,children:[" · ultima respuesta: ",r(m,{color:"cyan",children:formatNumber(k)})," / ",r(m,{color:"green",children:formatNumber(j)})]}),x>0&&o(m,{dimColor:!0,children:[" · ",o(m,{color:"yellow",children:["$",x.toFixed(4)]}),b?"":" (estimado)"]})]})})};
1
+ import{jsxs as o,jsx as r}from"react/jsx-runtime";import{getTotalCost as e,getTotalInputTokens as t,getTotalOutputTokens as i}from"../cost-tracker.js";import{useMainLoopModel as n}from"../hooks/useMainLoopModel.js";import{Box as s,Text as m}from"../ink.js";import{getAPIProvider as l}from"../utils/model/providers.js";import{getCurrentUsage as d}from"../utils/tokens.js";function formatNumber(o){return o>=1e6?`${(o/1e6).toFixed(2)}M`:o>=1e3?`${(o/1e3).toFixed(1)}k`:String(o)}export const SessionTokenFooter=({messages:c})=>{const a=l(),u=n(),f=t(),p=i(),h=d(c),k=h?.input_tokens??0,j=h?.output_tokens??0,x=e(),b="firstParty"===a||"openai"===a||"bedrock"===a||"vertex"===a||"foundry"===a;return r(s,{paddingX:2,children:o(m,{dimColor:!0,children:[a," · ",u||"sin modelo"," ",o(m,{color:"cyan",children:["↑ ",formatNumber(f)]})," / ",o(m,{color:"green",children:["↓ ",formatNumber(p)]})," tokens en esta sesion",h&&o(m,{dimColor:!0,children:[" · ultima respuesta: ",r(m,{color:"cyan",children:formatNumber(k)})," / ",r(m,{color:"green",children:formatNumber(j)})]}),x>0&&o(m,{dimColor:!0,children:[" · ",o(m,{color:"yellow",children:["$",x.toFixed(4)]}),b?"":" (estimado)"]})]})})};
@@ -1 +1 @@
1
- import{feature as e}from"../recovery/bunBundleShim.js";import{jsx as t,jsxs as r,Fragment as n}from"react/jsx-runtime";import{c as o}from"react/compiler-runtime";import{Box as i,Text as s}from"../ink.js";import{useEffect as a,useMemo as l,useRef as c,useState as m}from"react";import{computeGlimmerIndex as d,computeShimmerSegments as u,SHIMMER_INTERVAL_MS as p}from"../bridge/bridgeStatusUtil.js";import{getKairosActive as f,getUserMsgOptIn as h}from"../bootstrap/state.js";import{getFeatureValue_CACHED_MAY_BE_STALE as g}from"../services/analytics/growthbook.js";import{isEnvTruthy as v}from"../utils/envUtils.js";import{count as I}from"../utils/array.js";import j from"lodash-es/sample.js";import{formatDuration as T,formatNumber as b}from"../utils/format.js";import{activityManager as k}from"../utils/activityManager.js";import{getSpinnerVerbs as x}from"../constants/spinnerVerbs.js";import{MessageResponse as S}from"./MessageResponse.js";import{TaskListV2 as w}from"./TaskListV2.js";import{useTasksV2 as C}from"../hooks/useTasksV2.js";import{useAppState as M}from"../state/AppState.js";import{useTerminalSize as R}from"../hooks/useTerminalSize.js";import{stringWidth as _}from"../ink/stringWidth.js";import{getDefaultCharacters as D}from"./Spinner/index.js";import{SpinnerAnimationRow as y}from"./Spinner/SpinnerAnimationRow.js";import{useSettings as A}from"../hooks/useSettings.js";import{isInProcessTeammateTask as O}from"../tasks/InProcessTeammateTask/types.js";import{isBackgroundTask as $}from"../tasks/types.js";import{getAllInProcessTeammateTasks as B}from"../tasks/InProcessTeammateTask/InProcessTeammateTask.js";import{getEffortSuffix as E}from"../utils/effort.js";import{getMainLoopModel as V}from"../utils/model/model.js";import{getViewedTeammateTask as L}from"../state/selectors.js";import{TEARDROP_ASTERISK as U}from"../constants/figures.js";import P from"figures";import{getCurrentTurnTokenBudget as W,getTurnOutputTokens as F}from"../bootstrap/state.js";import{TeammateSpinnerTree as K}from"./Spinner/TeammateSpinnerTree.js";import{useAnimationFrame as q}from"../ink.js";import{getGlobalConfig as z}from"../utils/config.js";const N=D(),G=[...N,...[...N].reverse()];export function SpinnerWithVerb(r){const n=M(e=>e.isBriefOnly),o=M(e=>e.viewingAgentTaskId),i=!(!e("KAIROS")&&!e("KAIROS_BRIEF"))&&l(()=>v(process.env.CONTEXT_CODE_BRIEF)||v(process.env.CLAUDE_CODE_BRIEF),[]);return(e("KAIROS")||e("KAIROS_BRIEF"))&&(f()||h()&&(i||g("tengu_kairos_brief",!1)))&&n&&!o?t(BriefSpinner,{mode:r.mode,overrideMessage:r.overrideMessage}):t(SpinnerWithVerbInner,{...r})}function SpinnerWithVerbInner({mode:n,loadingStartTimeRef:o,totalPausedMsRef:l,pauseStartTimeRef:d,spinnerTip:u,responseLengthRef:p,overrideColor:f,overrideShimmerColor:h,overrideMessage:g,spinnerSuffix:v,verbose:I,hasActiveTools:_=!1,leaderIsIdle:D=!1}){const $=A().prefersReducedMotion??!1,q=M(e=>e.tasks),z=M(e=>e.viewingAgentTaskId),N=M(e=>e.expandedView),G="tasks"===N,X="teammates"===N,H=M(e=>e.selectedIPAgentIndex),J=M(e=>e.viewSelectionMode),Q=z?L({viewingAgentTaskId:z,tasks:q}):void 0,{columns:Y}=R(),Z=C(),[ee,te]=m(null),re=c(null);a(()=>{let e=null,t=null;if("thinking"===n)null===re.current&&(re.current=Date.now(),te("thinking"));else if(null!==re.current){const r=Date.now()-re.current,n=Date.now()-re.current,o=Math.max(0,2e3-n);re.current=null;const showDuration=()=>{te(r),t=setTimeout(te,2e3,null)};o>0?e=setTimeout(showDuration,o):showDuration()}return()=>{e&&clearTimeout(e),t&&clearTimeout(t)}},[n]);const ne=Z?.find(e=>"pending"!==e.status&&"completed"!==e.status),oe=function(e){if(!e)return;const t=e.filter(e=>"pending"===e.status);if(0===t.length)return;const r=new Set(e.filter(e=>"completed"!==e.status).map(e=>e.id));return t.find(e=>!e.blockedBy.some(e=>r.has(e)))??t[0]}(Z),[ie]=m(()=>j(x())),se=g??ne?.activeForm??ne?.subject??ie,ae=(Q&&!Q.isIdle?Q.spinnerVerb??ie:se)+"...";a(()=>{const e="spinner-"+n;return k.startCLIActivity(e),()=>{k.endCLIActivity(e)}},[n]);const le=M(e=>e.effortValue),ce=E(V(),le),me=B(q).filter(e=>"running"===e.status),de=me.length>0,ue=de&&me.every(e=>e.isIdle);let pe=0;if(!X)for(const e of Object.values(q))O(e)&&"running"===e.status&&e.progress?.tokenCount&&(pe+=e.progress.tokenCount);const fe=null!==d.current?d.current-o.current-l.current:Date.now()-o.current-l.current,he=Math.round(p.current/4),ge=f??"claude",ve=h??"claudeShimmer";if(D&&de&&!Q)return r(i,{flexDirection:"column",width:"100%",alignItems:"flex-start",children:[t(i,{flexDirection:"row",flexWrap:"wrap",marginTop:1,width:"100%",children:r(s,{dimColor:!0,children:[U," Inactivo",!ue&&" · companeros ejecutandose"]})}),X&&t(K,{selectedIndex:H,isInSelectionMode:"selecting-agent"===J,allIdle:ue,leaderTokenCount:he,leaderIdleText:"Inactivo"})]});if(Q?.isIdle){const e=ue?`${U} Trabajo durante ${T(Date.now()-Q.startTime)}`:`${U} Inactivo`;return r(i,{flexDirection:"column",width:"100%",alignItems:"flex-start",children:[t(i,{flexDirection:"row",flexWrap:"wrap",marginTop:1,width:"100%",children:t(s,{dimColor:!0,children:e})}),X&&de&&t(K,{selectedIndex:H,isInSelectionMode:"selecting-agent"===J,allIdle:ue,leaderVerb:D?void 0:se,leaderIdleText:D?"Inactivo":void 0,leaderTokenCount:he})]})}const Ie=u;let je=null;if(e("TOKEN_BUDGET")){const e=W();if(null!==e&&e>0){const t=F();if(t>=e)je=`Objetivo: ${b(t)} usados (${b(e)} min ${P.tick})`;else{const r=Math.round(t/e*100),n=fe>5e3&&t>=2e3?t/fe:0,o=n>0?` · ~${T((e-t)/n,{mostSignificantOnly:!0})}`:"";je=`Objetivo: ${b(t)} / ${b(e)} (${r}%)${o}`}}}return r(i,{flexDirection:"column",width:"100%",alignItems:"flex-start",children:[t(y,{mode:n,reducedMotion:$,hasActiveTools:_,responseLengthRef:p,message:ae,messageColor:ge,shimmerColor:ve,overrideColor:f,loadingStartTimeRef:o,totalPausedMsRef:l,pauseStartTimeRef:d,spinnerSuffix:v,verbose:I,columns:Y,hasRunningTeammates:de,teammateTokens:pe,foregroundedTeammate:Q,leaderIsIdle:D,thinkingStatus:ee,effortSuffix:ce}),X&&de?t(K,{selectedIndex:H,isInSelectionMode:"selecting-agent"===J,allIdle:ue,leaderVerb:D?void 0:se,leaderIdleText:D?"Inactivo":void 0,leaderTokenCount:he}):G&&Z&&Z.length>0?t(i,{width:"100%",flexDirection:"column",children:t(S,{children:t(w,{tasks:Z})})}):oe||Ie||je?r(i,{width:"100%",flexDirection:"column",children:[je&&t(S,{children:t(s,{dimColor:!0,children:je})}),(oe||Ie)&&t(S,{children:t(s,{dimColor:!0,children:oe?`Siguiente: ${oe.subject}`:`Consejo: ${Te=Ie,"Double-tap esc to rewind the code and/or conversation to a previous point in time"===Te?"Pulsa dos veces Esc para rebobinar el codigo y/o la conversacion a un punto anterior en el tiempo":"Double-tap esc to rewind the conversation to a previous point in time"===Te?"Pulsa dos veces Esc para rebobinar la conversacion a un punto anterior en el tiempo":"Use /btw to ask a quick side question without interrupting Claude's current work"===Te||"Usa /btw para hacer una pregunta rapida sin interrumpir el trabajo actual de Context"===Te?"Usa /btw para hacer una pregunta rápida sin interrumpir el trabajo actual de Context":"Use /clear to start fresh when switching topics and free up context"===Te?"Usa /clear para empezar de cero al cambiar de tema y liberar contexto":Te}`})})]}):null]});var Te}function BriefSpinner(e){const l=o(31),{mode:c,overrideMessage:f}=e,h=A().prefersReducedMotion??!1,[g]=m(_temp4),v=f??g,I=M(_temp5);let j,T;l[0]!==c?(j=()=>{const e="spinner-"+c;return k.startCLIActivity(e),()=>{k.endCLIActivity(e)}},T=[c],l[0]=c,l[1]=j,l[2]=T):(j=l[1],T=l[2]),a(j,T);const[,b]=q(h?null:120),x=M(_temp6),S="reconnecting"===I||"disconnected"===I,w="reconnecting"===I?"Reconectando":"Desconectado",C=Math.floor(b/300)%3;let D;l[3]!==C||l[4]!==h?(D=h?"… ":".".repeat(C+1).padEnd(3),l[3]=C,l[4]=h,l[5]=D):D=l[5];const y=D;let O;l[6]!==v?(O=_(v),l[6]=v,l[7]=O):O=l[7];const $=O;let B;if(l[8]!==h||l[9]!==S||l[10]!==b||l[11]!==v||l[12]!==$){const e=h||S?-100:d(Math.floor(b/p),$);B=u(v,e),l[8]=h,l[9]=S,l[10]=b,l[11]=v,l[12]=$,l[13]=B}else B=l[13];const{before:E,shimmer:V,after:L}=B,{columns:U}=R(),P=x>0?`${x} en segundo plano`:"";let W;l[14]!==w||l[15]!==S||l[16]!==$?(W=S?_(w):$,l[14]=w,l[15]=S,l[16]=$,l[17]=W):W=l[17];const F=W+3,K=Math.max(1,U-2-F-_(P));let z,N,G;return l[18]!==L||l[19]!==E||l[20]!==w||l[21]!==y||l[22]!==V||l[23]!==S?(z=S?t(s,{color:"error",children:w+y}):r(n,{children:[E?t(s,{dimColor:!0,children:E}):null,V?t(s,{children:V}):null,L?t(s,{dimColor:!0,children:L}):null,t(s,{dimColor:!0,children:y})]}),l[18]=L,l[19]=E,l[20]=w,l[21]=y,l[22]=V,l[23]=S,l[24]=z):z=l[24],l[25]!==K||l[26]!==P?(N=P?r(n,{children:[t(s,{children:" ".repeat(K)}),t(s,{color:"subtle",children:P})]}):null,l[25]=K,l[26]=P,l[27]=N):N=l[27],l[28]!==z||l[29]!==N?(G=r(i,{flexDirection:"row",width:"100%",marginTop:1,paddingLeft:2,children:[z,N]}),l[28]=z,l[29]=N,l[30]=G):G=l[30],G}function _temp6(e){return I(Object.values(e.tasks),$)+e.remoteBackgroundTaskCount}function _temp5(e){return e.remoteConnectionStatus}function _temp4(){return j(x())??"Trabajando"}export function BriefIdleStatus(){const e=o(9),a=M(_temp7),l=M(_temp8),{columns:c}=R(),m="reconnecting"===a||"disconnected"===a?"reconnecting"===a?"Reconectando…":"Desconectado":"",d=l>0?`${l} en segundo plano`:"";if(!m&&!d){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t(i,{height:2}),e[0]=r):r=e[0],r}const u=Math.max(1,c-2-_(m)-_(d));let p,f,h;return e[1]!==m?(p=m?t(s,{color:"error",children:m}):null,e[1]=m,e[2]=p):p=e[2],e[3]!==u||e[4]!==d?(f=d?r(n,{children:[t(s,{children:" ".repeat(u)}),t(s,{color:"subtle",children:d})]}):null,e[3]=u,e[4]=d,e[5]=f):f=e[5],e[6]!==p||e[7]!==f?(h=t(i,{marginTop:1,paddingLeft:2,children:r(s,{children:[p,f]})}),e[6]=p,e[7]=f,e[8]=h):h=e[8],h}function _temp8(e){return I(Object.values(e.tasks),$)+e.remoteBackgroundTaskCount}function _temp7(e){return e.remoteConnectionStatus}export function Spinner(){const e=o(8),r=A().prefersReducedMotion??!1,[n,a]=q(r?null:120);if(r){let r,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t(s,{color:"text",children:"*"}),e[0]=r):r=e[0],e[1]!==n?(o=t(i,{ref:n,flexWrap:"wrap",height:1,width:2,children:r}),e[1]=n,e[2]=o):o=e[2],o}const l=Math.floor(a/120)%G.length,c=G[l];let m,d;return e[3]!==c?(m=t(s,{color:"text",children:c}),e[3]=c,e[4]=m):m=e[4],e[5]!==n||e[6]!==m?(d=t(i,{ref:n,flexWrap:"wrap",height:1,width:2,children:m}),e[5]=n,e[6]=m,e[7]=d):d=e[7],d}
1
+ import{feature as e}from"../recovery/bunBundleShim.js";import{jsx as t,jsxs as r,Fragment as n}from"react/jsx-runtime";import{c as o}from"react/compiler-runtime";import{Box as i,Text as s}from"../ink.js";import{useEffect as a,useMemo as l,useRef as c,useState as m}from"react";import{computeGlimmerIndex as d,computeShimmerSegments as u,SHIMMER_INTERVAL_MS as p}from"../bridge/bridgeStatusUtil.js";import{getKairosActive as f,getUserMsgOptIn as h}from"../bootstrap/state.js";import{getFeatureValue_CACHED_MAY_BE_STALE as g}from"../services/analytics/growthbook.js";import{isEnvTruthy as v}from"../utils/envUtils.js";import{count as I}from"../utils/array.js";import j from"lodash-es/sample.js";import{formatDuration as T,formatNumber as b}from"../utils/format.js";import{activityManager as x}from"../utils/activityManager.js";import{getSpinnerVerbs as k}from"../constants/spinnerVerbs.js";import{MessageResponse as S}from"./MessageResponse.js";import{TaskListV2 as w}from"./TaskListV2.js";import{useTasksV2 as C}from"../hooks/useTasksV2.js";import{useAppState as M}from"../state/AppState.js";import{useTerminalSize as R}from"../hooks/useTerminalSize.js";import{stringWidth as _}from"../ink/stringWidth.js";import{getDefaultCharacters as D}from"./Spinner/index.js";import{SpinnerAnimationRow as y}from"./Spinner/SpinnerAnimationRow.js";import{useSettings as A}from"../hooks/useSettings.js";import{isInProcessTeammateTask as O}from"../tasks/InProcessTeammateTask/types.js";import{isBackgroundTask as $}from"../tasks/types.js";import{getAllInProcessTeammateTasks as B}from"../tasks/InProcessTeammateTask/InProcessTeammateTask.js";import{getEffortSuffix as E}from"../utils/effort.js";import{getMainLoopModel as V}from"../utils/model/model.js";import{getViewedTeammateTask as L}from"../state/selectors.js";import{TEARDROP_ASTERISK as U}from"../constants/figures.js";import P from"figures";import{getCurrentTurnTokenBudget as W,getTurnOutputTokens as F}from"../bootstrap/state.js";import{TeammateSpinnerTree as K}from"./Spinner/TeammateSpinnerTree.js";import{useAnimationFrame as q}from"../ink.js";import{getGlobalConfig as z}from"../utils/config.js";const N=D(),G=[...N,...[...N].reverse()];export function SpinnerWithVerb(r){const n=M(e=>e.isBriefOnly),o=M(e=>e.viewingAgentTaskId),i=!(!e("KAIROS")&&!e("KAIROS_BRIEF"))&&l(()=>v(process.env.CONTEXT_CODE_BRIEF)||v(process.env.CLAUDE_CODE_BRIEF),[]);return(e("KAIROS")||e("KAIROS_BRIEF"))&&(f()||h()&&(i||g("tengu_kairos_brief",!1)))&&n&&!o?t(BriefSpinner,{mode:r.mode,overrideMessage:r.overrideMessage}):t(SpinnerWithVerbInner,{...r})}function SpinnerWithVerbInner({mode:n,loadingStartTimeRef:o,totalPausedMsRef:l,pauseStartTimeRef:d,spinnerTip:u,responseLengthRef:p,overrideColor:f,overrideShimmerColor:h,overrideMessage:g,spinnerSuffix:v,verbose:I,hasActiveTools:_=!1,leaderIsIdle:D=!1}){const $=A().prefersReducedMotion??!1,q=M(e=>e.tasks),z=M(e=>e.viewingAgentTaskId),N=M(e=>e.expandedView),G="tasks"===N,X="teammates"===N,H=M(e=>e.selectedIPAgentIndex),J=M(e=>e.viewSelectionMode),Q=z?L({viewingAgentTaskId:z,tasks:q}):void 0,{columns:Y}=R(),Z=C(),[ee,te]=m(null),re=c(null);a(()=>{let e=null,t=null;if("thinking"===n)null===re.current&&(re.current=Date.now(),te("thinking"));else if(null!==re.current){const r=Date.now()-re.current,n=Date.now()-re.current,o=Math.max(0,2e3-n);re.current=null;const showDuration=()=>{te(r),t=setTimeout(te,2e3,null)};o>0?e=setTimeout(showDuration,o):showDuration()}return()=>{e&&clearTimeout(e),t&&clearTimeout(t)}},[n]);const ne=Z?.find(e=>"pending"!==e.status&&"completed"!==e.status),oe=function(e){if(!e)return;const t=e.filter(e=>"pending"===e.status);if(0===t.length)return;const r=new Set(e.filter(e=>"completed"!==e.status).map(e=>e.id));return t.find(e=>!e.blockedBy.some(e=>r.has(e)))??t[0]}(Z),[ie]=m(()=>j(k())),se=g??ne?.activeForm??ne?.subject??ie,ae=(Q&&!Q.isIdle?Q.spinnerVerb??ie:se)+"...";a(()=>{const e="spinner-"+n;return x.startCLIActivity(e),()=>{x.endCLIActivity(e)}},[n]);const le=M(e=>e.effortValue),ce=E(V(),le),me=B(q).filter(e=>"running"===e.status),de=me.length>0,ue=de&&me.every(e=>e.isIdle);let pe=0;if(!X)for(const e of Object.values(q))O(e)&&"running"===e.status&&e.progress?.tokenCount&&(pe+=e.progress.tokenCount);const fe=null!==d.current?d.current-o.current-l.current:Date.now()-o.current-l.current,he=Math.round(p.current/4),ge=f??"context",ve=h??"contextShimmer";if(D&&de&&!Q)return r(i,{flexDirection:"column",width:"100%",alignItems:"flex-start",children:[t(i,{flexDirection:"row",flexWrap:"wrap",marginTop:1,width:"100%",children:r(s,{dimColor:!0,children:[U," Inactivo",!ue&&" · companeros ejecutandose"]})}),X&&t(K,{selectedIndex:H,isInSelectionMode:"selecting-agent"===J,allIdle:ue,leaderTokenCount:he,leaderIdleText:"Inactivo"})]});if(Q?.isIdle){const e=ue?`${U} Trabajo durante ${T(Date.now()-Q.startTime)}`:`${U} Inactivo`;return r(i,{flexDirection:"column",width:"100%",alignItems:"flex-start",children:[t(i,{flexDirection:"row",flexWrap:"wrap",marginTop:1,width:"100%",children:t(s,{dimColor:!0,children:e})}),X&&de&&t(K,{selectedIndex:H,isInSelectionMode:"selecting-agent"===J,allIdle:ue,leaderVerb:D?void 0:se,leaderIdleText:D?"Inactivo":void 0,leaderTokenCount:he})]})}const Ie=u;let je=null;if(e("TOKEN_BUDGET")){const e=W();if(null!==e&&e>0){const t=F();if(t>=e)je=`Objetivo: ${b(t)} usados (${b(e)} min ${P.tick})`;else{const r=Math.round(t/e*100),n=fe>5e3&&t>=2e3?t/fe:0,o=n>0?` · ~${T((e-t)/n,{mostSignificantOnly:!0})}`:"";je=`Objetivo: ${b(t)} / ${b(e)} (${r}%)${o}`}}}return r(i,{flexDirection:"column",width:"100%",alignItems:"flex-start",children:[t(y,{mode:n,reducedMotion:$,hasActiveTools:_,responseLengthRef:p,message:ae,messageColor:ge,shimmerColor:ve,overrideColor:f,loadingStartTimeRef:o,totalPausedMsRef:l,pauseStartTimeRef:d,spinnerSuffix:v,verbose:I,columns:Y,hasRunningTeammates:de,teammateTokens:pe,foregroundedTeammate:Q,leaderIsIdle:D,thinkingStatus:ee,effortSuffix:ce}),X&&de?t(K,{selectedIndex:H,isInSelectionMode:"selecting-agent"===J,allIdle:ue,leaderVerb:D?void 0:se,leaderIdleText:D?"Inactivo":void 0,leaderTokenCount:he}):G&&Z&&Z.length>0?t(i,{width:"100%",flexDirection:"column",children:t(S,{children:t(w,{tasks:Z})})}):oe||Ie||je?r(i,{width:"100%",flexDirection:"column",children:[je&&t(S,{children:t(s,{dimColor:!0,children:je})}),(oe||Ie)&&t(S,{children:t(s,{dimColor:!0,children:oe?`Siguiente: ${oe.subject}`:`Consejo: ${Te=Ie,"Double-tap esc to rewind the code and/or conversation to a previous point in time"===Te?"Pulsa dos veces Esc para rebobinar el codigo y/o la conversacion a un punto anterior en el tiempo":"Double-tap esc to rewind the conversation to a previous point in time"===Te?"Pulsa dos veces Esc para rebobinar la conversacion a un punto anterior en el tiempo":"Use /btw to ask a quick side question without interrupting Claude's current work"===Te||"Usa /btw para hacer una pregunta rapida sin interrumpir el trabajo actual de Context"===Te?"Usa /btw para hacer una pregunta rápida sin interrumpir el trabajo actual de Context":"Use /clear to start fresh when switching topics and free up context"===Te?"Usa /clear para empezar de cero al cambiar de tema y liberar contexto":Te}`})})]}):null]});var Te}function BriefSpinner(e){const l=o(31),{mode:c,overrideMessage:f}=e,h=A().prefersReducedMotion??!1,[g]=m(_temp4),v=f??g,I=M(_temp5);let j,T;l[0]!==c?(j=()=>{const e="spinner-"+c;return x.startCLIActivity(e),()=>{x.endCLIActivity(e)}},T=[c],l[0]=c,l[1]=j,l[2]=T):(j=l[1],T=l[2]),a(j,T);const[,b]=q(h?null:120),k=M(_temp6),S="reconnecting"===I||"disconnected"===I,w="reconnecting"===I?"Reconectando":"Desconectado",C=Math.floor(b/300)%3;let D;l[3]!==C||l[4]!==h?(D=h?"… ":".".repeat(C+1).padEnd(3),l[3]=C,l[4]=h,l[5]=D):D=l[5];const y=D;let O;l[6]!==v?(O=_(v),l[6]=v,l[7]=O):O=l[7];const $=O;let B;if(l[8]!==h||l[9]!==S||l[10]!==b||l[11]!==v||l[12]!==$){const e=h||S?-100:d(Math.floor(b/p),$);B=u(v,e),l[8]=h,l[9]=S,l[10]=b,l[11]=v,l[12]=$,l[13]=B}else B=l[13];const{before:E,shimmer:V,after:L}=B,{columns:U}=R(),P=k>0?`${k} en segundo plano`:"";let W;l[14]!==w||l[15]!==S||l[16]!==$?(W=S?_(w):$,l[14]=w,l[15]=S,l[16]=$,l[17]=W):W=l[17];const F=W+3,K=Math.max(1,U-2-F-_(P));let z,N,G;return l[18]!==L||l[19]!==E||l[20]!==w||l[21]!==y||l[22]!==V||l[23]!==S?(z=S?t(s,{color:"error",children:w+y}):r(n,{children:[E?t(s,{dimColor:!0,children:E}):null,V?t(s,{children:V}):null,L?t(s,{dimColor:!0,children:L}):null,t(s,{dimColor:!0,children:y})]}),l[18]=L,l[19]=E,l[20]=w,l[21]=y,l[22]=V,l[23]=S,l[24]=z):z=l[24],l[25]!==K||l[26]!==P?(N=P?r(n,{children:[t(s,{children:" ".repeat(K)}),t(s,{color:"subtle",children:P})]}):null,l[25]=K,l[26]=P,l[27]=N):N=l[27],l[28]!==z||l[29]!==N?(G=r(i,{flexDirection:"row",width:"100%",marginTop:1,paddingLeft:2,children:[z,N]}),l[28]=z,l[29]=N,l[30]=G):G=l[30],G}function _temp6(e){return I(Object.values(e.tasks),$)+e.remoteBackgroundTaskCount}function _temp5(e){return e.remoteConnectionStatus}function _temp4(){return j(k())??"Trabajando"}export function BriefIdleStatus(){const e=o(9),a=M(_temp7),l=M(_temp8),{columns:c}=R(),m="reconnecting"===a||"disconnected"===a?"reconnecting"===a?"Reconectando…":"Desconectado":"",d=l>0?`${l} en segundo plano`:"";if(!m&&!d){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t(i,{height:2}),e[0]=r):r=e[0],r}const u=Math.max(1,c-2-_(m)-_(d));let p,f,h;return e[1]!==m?(p=m?t(s,{color:"error",children:m}):null,e[1]=m,e[2]=p):p=e[2],e[3]!==u||e[4]!==d?(f=d?r(n,{children:[t(s,{children:" ".repeat(u)}),t(s,{color:"subtle",children:d})]}):null,e[3]=u,e[4]=d,e[5]=f):f=e[5],e[6]!==p||e[7]!==f?(h=t(i,{marginTop:1,paddingLeft:2,children:r(s,{children:[p,f]})}),e[6]=p,e[7]=f,e[8]=h):h=e[8],h}function _temp8(e){return I(Object.values(e.tasks),$)+e.remoteBackgroundTaskCount}function _temp7(e){return e.remoteConnectionStatus}export function Spinner(){const e=o(8),r=A().prefersReducedMotion??!1,[n,a]=q(r?null:120);if(r){let r,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t(s,{color:"text",children:"*"}),e[0]=r):r=e[0],e[1]!==n?(o=t(i,{ref:n,flexWrap:"wrap",height:1,width:2,children:r}),e[1]=n,e[2]=o):o=e[2],o}const l=Math.floor(a/120)%G.length,c=G[l];let m,d;return e[3]!==c?(m=t(s,{color:"text",children:c}),e[3]=c,e[4]=m):m=e[4],e[5]!==n||e[6]!==m?(d=t(i,{ref:n,flexWrap:"wrap",height:1,width:2,children:m}),e[5]=n,e[6]=m,e[7]=d):d=e[7],d}
@@ -1 +1 @@
1
- import{feature as e}from"../recovery/bunBundleShim.js";import{jsx as t,jsxs as n,Fragment as o}from"react/jsx-runtime";import{c as r}from"react/compiler-runtime";import{plot as s}from"asciichart";import i from"chalk";import a from"figures";import{Suspense as l,use as c,useEffect as u,useMemo as d,useState as m}from"react";import p from"strip-ansi";import{useTerminalSize as g}from"../hooks/useTerminalSize.js";import{applyColor as f}from"../ink/colorize.js";import{stringWidth as k}from"../ink/stringWidth.js";import{Ansi as b,Box as T,Text as y,useInput as w}from"../ink.js";import{useKeybinding as S}from"../keybindings/useKeybinding.js";import{getGlobalConfig as x}from"../utils/config.js";import{formatDuration as D,formatNumber as v}from"../utils/format.js";import{generateHeatmap as M}from"../utils/heatmap.js";import{renderModelName as j}from"../utils/model/model.js";import{copyAnsiToClipboard as $}from"../utils/screenshotClipboard.js";import{aggregateClaudeCodeStatsForRange as C}from"../utils/stats.js";import{resolveThemeSetting as _}from"../utils/systemTheme.js";import{getTheme as A,themeColorToAnsi as O}from"../utils/theme.js";import{Pane as F}from"./design-system/Pane.js";import{Tab as L,Tabs as R,useTabHeaderFocus as P}from"./design-system/Tabs.js";import{Spinner as B}from"./Spinner.js";const E={"7d":"Últimos 7 días","30d":"Últimos 30 días",all:"Todo el tiempo"},H=["all","7d","30d"];export function Stats(e){const o=r(4),{onClose:s}=e;let i;o[0]===Symbol.for("react.memo_cache_sentinel")?(i=C("all").then(e=>e&&0!==e.totalSessions?{type:"success",data:e}:{type:"empty"}).catch(e=>({type:"error",message:e instanceof Error?e.message:"Failed to load stats"})),o[0]=i):i=o[0];const a=i;let c,u;return o[1]===Symbol.for("react.memo_cache_sentinel")?(c=n(T,{marginTop:1,children:[t(B,{}),t(y,{children:" Cargando tus estadísticas de Context Code…"})]}),o[1]=c):c=o[1],o[2]!==s?(u=t(l,{fallback:c,children:t(StatsContent,{allTimePromise:a,onClose:s})}),o[2]=s,o[3]=u):u=o[3],u}function StatsContent(o){const s=r(34),{allTimePromise:l,onClose:d}=o,g=c(l),[b,O]=m("all");let P;s[0]===Symbol.for("react.memo_cache_sentinel")?(P={},s[0]=P):P=s[0];const[E,I]=m(P),[U,W]=m(!1),[N,z]=m("Overview"),[q,G]=m(null);let K,Q;s[1]!==b||s[2]!==E?(K=()=>{if("all"===b)return;if(E[b])return;let e=!1;return W(!0),C(b).then(t=>{e||(I(e=>({...e,[b]:t})),W(!1))}).catch(()=>{e||W(!1)}),()=>{e=!0}},Q=[b,E],s[1]=b,s[2]=E,s[3]=K,s[4]=Q):(K=s[3],Q=s[4]),u(K,Q);const J="all"===b?"success"===g.type?g.data:null:E[b]??("success"===g.type?g.data:null),V="success"===g.type?g.data:null;let X;s[5]!==d?(X=()=>{d("Stats dialog dismissed",{display:"system"})},s[5]=d,s[6]=X):X=s[6];const Y=X;let Z,ee,te,ne,oe;if(s[7]===Symbol.for("react.memo_cache_sentinel")?(Z={context:"Confirmation"},s[7]=Z):Z=s[7],S("confirm:no",Y,Z),s[8]!==N||s[9]!==b||s[10]!==J||s[11]!==d?(ee=(t,n)=>{!n.ctrl||"c"!==t&&"d"!==t||d("Stats dialog dismissed",{display:"system"}),n.tab&&z(_temp),"r"!==t||n.ctrl||n.meta||O(function(e){const t=H.indexOf(e);return H[(t+1)%H.length]}(b)),n.ctrl&&"s"===t&&J&&async function(t,n,o){o("copying…");const r=function(t,n){const o=[];"Overview"===n?o.push(...function(t){const n=[],o=A(_(x().theme)),h=e=>f(e,o.claude),r=18,s=40,a=18,row=(e,t,n,o)=>{const i=(e+":").padEnd(r),l=i.length+t.length,c=Math.max(2,s-l),u=(n+":").padEnd(a);return i+h(t)+" ".repeat(c)+u+h(o)};t.dailyActivity.length>0&&(n.push(M(t.dailyActivity,{terminalWidth:56})),n.push(""));const l=Object.entries(t.modelUsage).sort(([,e],[,t])=>t.inputTokens+t.outputTokens-(e.inputTokens+e.outputTokens)),c=l[0],u=l.reduce((e,[,t])=>e+t.inputTokens+t.outputTokens,0);c&&n.push(row("Favorite model",j(c[0]),"Total tokens",v(u)));n.push(""),n.push(row("Sessions",v(t.totalSessions),"Longest session",t.longestSession?D(t.longestSession.duration):"N/A"));const d=`${t.streaks.currentStreak} ${1===t.streaks.currentStreak?"day":"days"}`,m=`${t.streaks.longestStreak} ${1===t.streaks.longestStreak?"day":"days"}`;n.push(row("Current streak",d,"Longest streak",m));const p=`${t.activeDays}/${t.totalDays}`,g=null!==t.peakActivityHour?`${t.peakActivityHour}:00-${t.peakActivityHour+1}:00`:"N/A";n.push(row("Active days",p,"Peak hour",g)),!1;if(e("SHOT_STATS")&&t.shotDistribution){const e=t.shotDistribution,o=Object.values(e).reduce((e,t)=>e+t,0);if(o>0){const t=(Object.entries(e).reduce((e,[t,n])=>e+parseInt(t,10)*n,0)/o).toFixed(1),bucket=(t,n)=>Object.entries(e).filter(([e])=>{const o=parseInt(e,10);return o>=t&&(void 0===n||o<=n)}).reduce((e,[,t])=>e+t,0),pct=e=>Math.round(e/o*100),fmtBucket=(e,t)=>`${e} (${t}%)`,s=bucket(1,1),i=bucket(2,5),a=bucket(6,10),l=bucket(11);n.push(""),n.push("Shot distribution"),n.push(row("1-shot",fmtBucket(s,pct(s)),"2–5 shot",fmtBucket(i,pct(i)))),n.push(row("6–10 shot",fmtBucket(a,pct(a)),"11+ shot",fmtBucket(l,pct(l)))),n.push(`${"Avg/session:".padEnd(r)}${h(t)}`)}}n.push("");const k=generateFunFactoid(t,u);return n.push(h(k)),n.push(i.gray(`Stats from the last ${t.totalDays} days`)),n}(t)):o.push(...function(e){const t=[],n=Object.entries(e.modelUsage).sort(([,e],[,t])=>t.inputTokens+t.outputTokens-(e.inputTokens+e.outputTokens));if(0===n.length)return t.push(i.gray("No model usage data available")),t;const o=n[0],r=n.reduce((e,[,t])=>e+t.inputTokens+t.outputTokens,0),s=generateTokenChart(e.dailyModelTokens,n.map(([e])=>e),80);if(s){t.push(i.bold("Tokens per Day")),t.push(s.chart),t.push(i.gray(s.xAxisLabels));const e=s.legend.map(e=>`${e.coloredBullet} ${e.model}`).join(" · ");t.push(e),t.push("")}t.push(`${a.star} Favorite: ${i.magenta.bold(j(o?.[0]||""))} · ${a.circle} Total: ${i.magenta(v(r))} tokens`),t.push("");const l=n.slice(0,3);for(const[e,n]of l){const o=((n.inputTokens+n.outputTokens)/r*100).toFixed(1);t.push(`${a.bullet} ${i.bold(j(e))} ${i.gray(`(${o}%)`)}`),t.push(i.dim(` In: ${v(n.inputTokens)} · Out: ${v(n.outputTokens)}`))}return t}(t));for(;o.length>0&&""===p(o[o.length-1]).trim();)o.pop();if(o.length>0){const e=o[o.length-1],t=k(e),r="Overview"===n?70:80,s="/stats",a=Math.max(2,r-t-s.length);o[o.length-1]=e+" ".repeat(a)+i.gray(s)}return o.join("\n")}(t,n),s=await $(r);o(s.success?"copied!":"copy failed"),setTimeout(o,2e3,null)}(J,N,G)},s[8]=N,s[9]=b,s[10]=J,s[11]=d,s[12]=ee):ee=s[12],w(ee),"error"===g.type){let e;return s[13]!==g.message?(e=t(T,{marginTop:1,children:n(y,{color:"error",children:["Error al cargar estadísticas: ",g.message]})}),s[13]=g.message,s[14]=e):e=s[14],e}if("empty"===g.type){let e;return s[15]===Symbol.for("react.memo_cache_sentinel")?(e=t(T,{marginTop:1,children:t(y,{color:"warning",children:"Aún no hay estadísticas disponibles. ¡Comienza a usar Context Code!"})}),s[15]=e):e=s[15],e}if(!J||!V){let e;return s[16]===Symbol.for("react.memo_cache_sentinel")?(e=n(T,{marginTop:1,children:[t(B,{}),t(y,{children:" Cargando estadísticas…"})]}),s[16]=e):e=s[16],e}s[17]!==V||s[18]!==b||s[19]!==J||s[20]!==U?(te=t(L,{title:"Resumen",children:t(OverviewTab,{stats:J,allTimeStats:V,dateRange:b,isLoading:U})}),s[17]=V,s[18]=b,s[19]=J,s[20]=U,s[21]=te):te=s[21],s[22]!==b||s[23]!==J||s[24]!==U?(ne=t(L,{title:"Modelos",children:t(ModelsTab,{stats:J,dateRange:b,isLoading:U})}),s[22]=b,s[23]=J,s[24]=U,s[25]=ne):ne=s[25],s[26]!==te||s[27]!==ne?(oe=t(T,{flexDirection:"row",gap:1,marginBottom:1,children:n(R,{title:"",color:"claude",defaultTab:"Resumen",children:[te,ne]})}),s[26]=te,s[27]=ne,s[28]=oe):oe=s[28];const re=q?` · ${"copying…"===q?"copiando…":"copied!"===q?"¡copiado!":"copy failed"===q?"copia fallida":q}`:"";let se,ie;return s[29]!==re?(se=t(T,{paddingLeft:2,children:n(y,{dimColor:!0,children:["Esc para cancelar · r para recorrer fechas · ctrl+s para copiar",re]})}),s[29]=re,s[30]=se):se=s[30],s[31]!==se||s[32]!==oe?(ie=n(F,{color:"claude",children:[oe,se]}),s[31]=se,s[32]=oe,s[33]=ie):ie=s[33],ie}function _temp(e){return"Overview"===e?"Models":"Overview"}function DateRangeSelector(e){const o=r(9),{dateRange:s,isLoading:i}=e;let a,l,c,u;return o[0]!==s?(a=H.map((e,o)=>n(y,{children:[o>0&&t(y,{dimColor:!0,children:" · "}),t(y,e===s?{bold:!0,color:"claude",children:E[e]}:{dimColor:!0,children:E[e]})]},e)),o[0]=s,o[1]=a):a=o[1],o[2]!==a?(l=t(T,{children:a}),o[2]=a,o[3]=l):l=o[3],o[4]!==i?(c=i&&t(B,{}),o[4]=i,o[5]=c):c=o[5],o[6]!==l||o[7]!==c?(u=n(T,{marginBottom:1,gap:1,children:[l,c]}),o[6]=l,o[7]=c,o[8]=u):u=o[8],u}function OverviewTab({stats:r,allTimeStats:s,dateRange:i,isLoading:a}){const{columns:l}=g(),c=Object.entries(r.modelUsage).sort(([,e],[,t])=>t.inputTokens+t.outputTokens-(e.inputTokens+e.outputTokens)),u=c[0],m=c.reduce((e,[,t])=>e+t.inputTokens+t.outputTokens,0),p=d(()=>generateFunFactoid(r,m),[r,m]),f="7d"===i?7:"30d"===i?30:r.totalDays;let k=null;if(e("SHOT_STATS")&&r.shotDistribution){const e=r.shotDistribution,t=Object.values(e).reduce((e,t)=>e+t,0);if(t>0){const n=Object.entries(e).reduce((e,[t,n])=>e+parseInt(t,10)*n,0),bucket=(t,n)=>Object.entries(e).filter(([e])=>{const o=parseInt(e,10);return o>=t&&(void 0===n||o<=n)}).reduce((e,[,t])=>e+t,0),pct=e=>Math.round(e/t*100),o=bucket(1,1),r=bucket(2,5),s=bucket(6,10),i=bucket(11);k={avgShots:(n/t).toFixed(1),buckets:[{label:"1-shot",count:o,pct:pct(o)},{label:"2–5 shot",count:r,pct:pct(r)},{label:"6–10 shot",count:s,pct:pct(s)},{label:"11+ shot",count:i,pct:pct(i)}]}}}return n(T,{flexDirection:"column",marginTop:1,children:[s.dailyActivity.length>0&&t(T,{flexDirection:"column",marginBottom:1,children:t(b,{children:M(s.dailyActivity,{terminalWidth:l})})}),t(DateRangeSelector,{dateRange:i,isLoading:a}),n(T,{flexDirection:"row",gap:4,marginBottom:1,children:[t(T,{flexDirection:"column",width:28,children:u&&n(y,{wrap:"truncate",children:["Modelo favorito:"," ",t(y,{color:"claude",bold:!0,children:j(u[0])})]})}),t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:["Tokens totales:"," ",t(y,{color:"claude",children:v(m)})]})})]}),n(T,{flexDirection:"row",gap:4,children:[t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:["Sesiones:"," ",t(y,{color:"claude",children:v(r.totalSessions)})]})}),t(T,{flexDirection:"column",width:28,children:r.longestSession&&n(y,{wrap:"truncate",children:["Sesión más larga:"," ",t(y,{color:"claude",children:D(r.longestSession.duration)})]})})]}),n(T,{flexDirection:"row",gap:4,children:[t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:["Días activos: ",t(y,{color:"claude",children:r.activeDays}),n(y,{color:"subtle",children:["/",f]})]})}),t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:["Racha más larga:"," ",t(y,{color:"claude",bold:!0,children:r.streaks.longestStreak})," ",1===r.streaks.longestStreak?"día":"días"]})})]}),n(T,{flexDirection:"row",gap:4,children:[t(T,{flexDirection:"column",width:28,children:r.peakActivityDay&&n(y,{wrap:"truncate",children:["Día más activo:"," ",t(y,{color:"claude",children:(w=r.peakActivityDay,new Date(w).toLocaleDateString("en-US",{month:"short",day:"numeric"}))})]})}),t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:["Racha actual:"," ",t(y,{color:"claude",bold:!0,children:s.streaks.currentStreak})," ",1===s.streaks.currentStreak?"día":"días"]})})]}),!1,k&&n(o,{children:[t(T,{marginTop:1,children:t(y,{children:"Distribución de turnos (shots)"})}),n(T,{flexDirection:"row",gap:4,children:[t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:[k.buckets[0].label,":"," ",t(y,{color:"claude",children:k.buckets[0].count}),n(y,{color:"subtle",children:[" (",k.buckets[0].pct,"%)"]})]})}),t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:[k.buckets[1].label,":"," ",t(y,{color:"claude",children:k.buckets[1].count}),n(y,{color:"subtle",children:[" (",k.buckets[1].pct,"%)"]})]})})]}),n(T,{flexDirection:"row",gap:4,children:[t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:[k.buckets[2].label,":"," ",t(y,{color:"claude",children:k.buckets[2].count}),n(y,{color:"subtle",children:[" (",k.buckets[2].pct,"%)"]})]})}),t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:[k.buckets[3].label,":"," ",t(y,{color:"claude",children:k.buckets[3].count}),n(y,{color:"subtle",children:[" (",k.buckets[3].pct,"%)"]})]})})]}),t(T,{flexDirection:"row",gap:4,children:t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:["Promedio/sesión:"," ",t(y,{color:"claude",children:k.avgShots})]})})})]}),p&&t(T,{marginTop:1,children:t(y,{color:"suggestion",children:p})})]});var w}const I=[{name:"The Little Prince",tokens:22e3},{name:"The Old Man and the Sea",tokens:35e3},{name:"A Christmas Carol",tokens:37e3},{name:"Animal Farm",tokens:39e3},{name:"Fahrenheit 451",tokens:6e4},{name:"The Great Gatsby",tokens:62e3},{name:"Slaughterhouse-Five",tokens:64e3},{name:"Brave New World",tokens:83e3},{name:"The Catcher in the Rye",tokens:95e3},{name:"Harry Potter and the Philosopher's Stone",tokens:103e3},{name:"The Hobbit",tokens:123e3},{name:"1984",tokens:123e3},{name:"To Kill a Mockingbird",tokens:13e4},{name:"Pride and Prejudice",tokens:156e3},{name:"Dune",tokens:244e3},{name:"Moby-Dick",tokens:268e3},{name:"Crime and Punishment",tokens:274e3},{name:"A Game of Thrones",tokens:381e3},{name:"Anna Karenina",tokens:468e3},{name:"Don Quixote",tokens:52e4},{name:"The Lord of the Rings",tokens:576e3},{name:"The Count of Monte Cristo",tokens:603e3},{name:"Les Misérables",tokens:689e3},{name:"War and Peace",tokens:73e4}],U=[{name:"a TED talk",minutes:18},{name:"an episode of The Office",minutes:22},{name:"listening to Abbey Road",minutes:47},{name:"a yoga class",minutes:60},{name:"a World Cup soccer match",minutes:90},{name:"a half marathon (average time)",minutes:120},{name:"the movie Inception",minutes:148},{name:"watching Titanic",minutes:195},{name:"a transatlantic flight",minutes:420},{name:"a full night of sleep",minutes:480}];function generateFunFactoid(e,t){const n=[];if(t>0){const e=I.filter(e=>t>=e.tokens);for(const o of e){const e=t/o.tokens;e>=2?n.push(`Has usado ~${Math.floor(e)} veces más tokens que en ${o.name}`):n.push(`Has usado el mismo número de tokens que en ${o.name}`)}}if(e.longestSession){const t=e.longestSession.duration/6e4;for(const e of U){const o=t/e.minutes;o>=2&&n.push(`Tu sesión más larga es ~${Math.floor(o)} veces más larga que ${e.name}`)}}if(0===n.length)return"";return n[Math.floor(Math.random()*n.length)]}function ModelsTab(e){const o=r(15),{stats:s,dateRange:i,isLoading:l}=e,{headerFocused:c,focusHeader:u}=P(),[d,p]=m(0),{columns:f}=g(),k=Object.entries(s.modelUsage).sort(_temp7),S=!c;let x;if(o[0]!==S?(x={isActive:S},o[0]=S,o[1]=x):x=o[1],w((e,t)=>{t.downArrow&&d<k.length-4&&p(e=>Math.min(e+2,k.length-4)),t.upArrow&&(d>0?p(_temp8):u())},x),0===k.length){let e;return o[2]===Symbol.for("react.memo_cache_sentinel")?(e=t(T,{children:t(y,{color:"subtle",children:"No model usage data available"})}),o[2]=e):e=o[2],e}const D=k.reduce(_temp9,0),v=generateTokenChart(s.dailyModelTokens,k.map(_temp0),f),M=k.slice(d,d+4),j=Math.ceil(M.length/2),$=M.slice(0,j),C=M.slice(j),_=d>0,A=d<k.length-4,O=k.length>4;let F;o[3]!==i||o[4]!==l?(F=t(DateRangeSelector,{dateRange:i,isLoading:l}),o[3]=i,o[4]=l,o[5]=F):F=o[5];const L=T,R=C.map(e=>{const[n,o]=e;return t(ModelEntry,{model:n,usage:o,totalTokens:D},n)});let B,E;return o[6]!==L||o[7]!==R?(B=t(L,{flexDirection:"column",width:36,children:R}),o[6]=L,o[7]=R,o[8]=B):B=o[8],o[9]!==A||o[10]!==_||o[11]!==k||o[12]!==d||o[13]!==O?(E=O&&t(T,{marginTop:1,children:n(y,{color:"subtle",children:[_?a.arrowUp:" "," ",A?a.arrowDown:" "," ",d+1,"-",Math.min(d+4,k.length)," de"," ",k.length," modelos (↑↓ para desplazar)"]})}),o[9]=A,o[10]=_,o[11]=k,o[12]=d,o[13]=O,o[14]=E):E=o[14],n(T,{flexDirection:"column",marginTop:1,children:[v&&n(T,{flexDirection:"column",marginBottom:1,children:[t(y,{bold:!0,children:"Tokens por día"}),t(b,{children:v.chart}),t(y,{color:"subtle",children:v.xAxisLabels}),t(T,{children:v.legend.map(_temp1)})]}),F,n(T,{flexDirection:"row",gap:4,children:[t(T,{flexDirection:"column",width:36,children:$.map(e=>{const[n,o]=e;return t(ModelEntry,{model:n,usage:o,totalTokens:D},n)})}),B]}),E]})}function _temp1(e,o){return n(y,{children:[o>0?" · ":"",t(b,{children:e.coloredBullet})," ",e.model]},e.model)}function _temp0(e){const[t]=e;return t}function _temp9(e,t){const[,n]=t;return e+n.inputTokens+n.outputTokens}function _temp8(e){return Math.max(e-2,0)}function _temp7(e,t){const[,n]=e,[,o]=t;return o.inputTokens+o.outputTokens-(n.inputTokens+n.outputTokens)}function ModelEntry(e){const o=r(21),{model:s,usage:i,totalTokens:l}=e,c=(i.inputTokens+i.outputTokens)/l*100;let u;o[0]!==c?(u=c.toFixed(1),o[0]=c,o[1]=u):u=o[1];const d=u;let m,p,g,f,k,b,w,S;return o[2]!==s?(m=j(s),o[2]=s,o[3]=m):m=o[3],o[4]!==m?(p=t(y,{bold:!0,children:m}),o[4]=m,o[5]=p):p=o[5],o[6]!==d?(g=n(y,{color:"subtle",children:["(",d,"%)"]}),o[6]=d,o[7]=g):g=o[7],o[8]!==p||o[9]!==g?(f=n(y,{children:[a.bullet," ",p," ",g]}),o[8]=p,o[9]=g,o[10]=f):f=o[10],o[11]!==i.inputTokens?(k=v(i.inputTokens),o[11]=i.inputTokens,o[12]=k):k=o[12],o[13]!==i.outputTokens?(b=v(i.outputTokens),o[13]=i.outputTokens,o[14]=b):b=o[14],o[15]!==k||o[16]!==b?(w=n(y,{color:"subtle",children:[" ","In: ",k," · Out:"," ",b]}),o[15]=k,o[16]=b,o[17]=w):w=o[17],o[18]!==f||o[19]!==w?(S=n(T,{flexDirection:"column",children:[f,w]}),o[18]=f,o[19]=w,o[20]=S):S=o[20],S}function generateTokenChart(e,t,n){if(e.length<2||0===t.length)return null;const o=n-7,r=Math.min(52,Math.max(20,o));let i;if(e.length>=r)i=e.slice(-r);else{const t=Math.floor(r/e.length);i=[];for(const n of e)for(let e=0;e<t;e++)i.push(n)}const l=A(_(x().theme)),c=[O(l.suggestion),O(l.success),O(l.warning)],u=[],d=[],m=t.slice(0,3);for(let e=0;e<m.length;e++){const t=m[e],n=i.map(e=>e.tokensByModel[t]||0);if(n.some(e=>e>0)){u.push(n);const o=[l.suggestion,l.success,l.warning];d.push({model:j(t),coloredBullet:f(a.bullet,o[e%o.length])})}}if(0===u.length)return null;return{chart:s(u,{height:8,colors:c.slice(0,u.length),format:e=>{let t;return t=e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(0)+"k":e.toFixed(0),t.padStart(6)}}),legend:d,xAxisLabels:function(e,t,n){if(0===e.length)return"";const o=Math.min(4,Math.max(2,Math.floor(e.length/8))),r=e.length-6,s=Math.floor(r/(o-1))||1,i=[];for(let t=0;t<o;t++){const n=Math.min(t*s,e.length-1),o=new Date(e[n].date).toLocaleDateString("en-US",{month:"short",day:"numeric"});i.push({pos:n,label:o})}let a=" ".repeat(n),l=0;for(const{pos:e,label:t}of i){const n=Math.max(1,e-l);a+=" ".repeat(n)+t,l=e+t.length}return a}(i,i.length,7)}}
1
+ import{feature as e}from"../recovery/bunBundleShim.js";import{jsx as t,jsxs as n,Fragment as o}from"react/jsx-runtime";import{c as r}from"react/compiler-runtime";import{plot as s}from"asciichart";import i from"chalk";import a from"figures";import{Suspense as l,use as c,useEffect as u,useMemo as d,useState as m}from"react";import p from"strip-ansi";import{useTerminalSize as g}from"../hooks/useTerminalSize.js";import{applyColor as f}from"../ink/colorize.js";import{stringWidth as k}from"../ink/stringWidth.js";import{Ansi as b,Box as T,Text as y,useInput as x}from"../ink.js";import{useKeybinding as w}from"../keybindings/useKeybinding.js";import{getGlobalConfig as S}from"../utils/config.js";import{formatDuration as D,formatNumber as v}from"../utils/format.js";import{generateHeatmap as M}from"../utils/heatmap.js";import{renderModelName as j}from"../utils/model/model.js";import{copyAnsiToClipboard as $}from"../utils/screenshotClipboard.js";import{aggregateClaudeCodeStatsForRange as C}from"../utils/stats.js";import{resolveThemeSetting as _}from"../utils/systemTheme.js";import{getTheme as A,themeColorToAnsi as O}from"../utils/theme.js";import{Pane as F}from"./design-system/Pane.js";import{Tab as L,Tabs as R,useTabHeaderFocus as P}from"./design-system/Tabs.js";import{Spinner as B}from"./Spinner.js";const E={"7d":"Últimos 7 días","30d":"Últimos 30 días",all:"Todo el tiempo"},H=["all","7d","30d"];export function Stats(e){const o=r(4),{onClose:s}=e;let i;o[0]===Symbol.for("react.memo_cache_sentinel")?(i=C("all").then(e=>e&&0!==e.totalSessions?{type:"success",data:e}:{type:"empty"}).catch(e=>({type:"error",message:e instanceof Error?e.message:"Failed to load stats"})),o[0]=i):i=o[0];const a=i;let c,u;return o[1]===Symbol.for("react.memo_cache_sentinel")?(c=n(T,{marginTop:1,children:[t(B,{}),t(y,{children:" Cargando tus estadísticas de Context Code…"})]}),o[1]=c):c=o[1],o[2]!==s?(u=t(l,{fallback:c,children:t(StatsContent,{allTimePromise:a,onClose:s})}),o[2]=s,o[3]=u):u=o[3],u}function StatsContent(o){const s=r(34),{allTimePromise:l,onClose:d}=o,g=c(l),[b,O]=m("all");let P;s[0]===Symbol.for("react.memo_cache_sentinel")?(P={},s[0]=P):P=s[0];const[E,I]=m(P),[U,W]=m(!1),[N,z]=m("Overview"),[q,G]=m(null);let K,Q;s[1]!==b||s[2]!==E?(K=()=>{if("all"===b)return;if(E[b])return;let e=!1;return W(!0),C(b).then(t=>{e||(I(e=>({...e,[b]:t})),W(!1))}).catch(()=>{e||W(!1)}),()=>{e=!0}},Q=[b,E],s[1]=b,s[2]=E,s[3]=K,s[4]=Q):(K=s[3],Q=s[4]),u(K,Q);const J="all"===b?"success"===g.type?g.data:null:E[b]??("success"===g.type?g.data:null),V="success"===g.type?g.data:null;let X;s[5]!==d?(X=()=>{d("Stats dialog dismissed",{display:"system"})},s[5]=d,s[6]=X):X=s[6];const Y=X;let Z,ee,te,ne,oe;if(s[7]===Symbol.for("react.memo_cache_sentinel")?(Z={context:"Confirmation"},s[7]=Z):Z=s[7],w("confirm:no",Y,Z),s[8]!==N||s[9]!==b||s[10]!==J||s[11]!==d?(ee=(t,n)=>{!n.ctrl||"c"!==t&&"d"!==t||d("Stats dialog dismissed",{display:"system"}),n.tab&&z(_temp),"r"!==t||n.ctrl||n.meta||O(function(e){const t=H.indexOf(e);return H[(t+1)%H.length]}(b)),n.ctrl&&"s"===t&&J&&async function(t,n,o){o("copying…");const r=function(t,n){const o=[];"Overview"===n?o.push(...function(t){const n=[],o=A(_(S().theme)),h=e=>f(e,o.context),r=18,s=40,a=18,row=(e,t,n,o)=>{const i=(e+":").padEnd(r),l=i.length+t.length,c=Math.max(2,s-l),u=(n+":").padEnd(a);return i+h(t)+" ".repeat(c)+u+h(o)};t.dailyActivity.length>0&&(n.push(M(t.dailyActivity,{terminalWidth:56})),n.push(""));const l=Object.entries(t.modelUsage).sort(([,e],[,t])=>t.inputTokens+t.outputTokens-(e.inputTokens+e.outputTokens)),c=l[0],u=l.reduce((e,[,t])=>e+t.inputTokens+t.outputTokens,0);c&&n.push(row("Favorite model",j(c[0]),"Total tokens",v(u)));n.push(""),n.push(row("Sessions",v(t.totalSessions),"Longest session",t.longestSession?D(t.longestSession.duration):"N/A"));const d=`${t.streaks.currentStreak} ${1===t.streaks.currentStreak?"day":"days"}`,m=`${t.streaks.longestStreak} ${1===t.streaks.longestStreak?"day":"days"}`;n.push(row("Current streak",d,"Longest streak",m));const p=`${t.activeDays}/${t.totalDays}`,g=null!==t.peakActivityHour?`${t.peakActivityHour}:00-${t.peakActivityHour+1}:00`:"N/A";n.push(row("Active days",p,"Peak hour",g)),!1;if(e("SHOT_STATS")&&t.shotDistribution){const e=t.shotDistribution,o=Object.values(e).reduce((e,t)=>e+t,0);if(o>0){const t=(Object.entries(e).reduce((e,[t,n])=>e+parseInt(t,10)*n,0)/o).toFixed(1),bucket=(t,n)=>Object.entries(e).filter(([e])=>{const o=parseInt(e,10);return o>=t&&(void 0===n||o<=n)}).reduce((e,[,t])=>e+t,0),pct=e=>Math.round(e/o*100),fmtBucket=(e,t)=>`${e} (${t}%)`,s=bucket(1,1),i=bucket(2,5),a=bucket(6,10),l=bucket(11);n.push(""),n.push("Shot distribution"),n.push(row("1-shot",fmtBucket(s,pct(s)),"2–5 shot",fmtBucket(i,pct(i)))),n.push(row("6–10 shot",fmtBucket(a,pct(a)),"11+ shot",fmtBucket(l,pct(l)))),n.push(`${"Avg/session:".padEnd(r)}${h(t)}`)}}n.push("");const k=generateFunFactoid(t,u);return n.push(h(k)),n.push(i.gray(`Stats from the last ${t.totalDays} days`)),n}(t)):o.push(...function(e){const t=[],n=Object.entries(e.modelUsage).sort(([,e],[,t])=>t.inputTokens+t.outputTokens-(e.inputTokens+e.outputTokens));if(0===n.length)return t.push(i.gray("No model usage data available")),t;const o=n[0],r=n.reduce((e,[,t])=>e+t.inputTokens+t.outputTokens,0),s=generateTokenChart(e.dailyModelTokens,n.map(([e])=>e),80);if(s){t.push(i.bold("Tokens per Day")),t.push(s.chart),t.push(i.gray(s.xAxisLabels));const e=s.legend.map(e=>`${e.coloredBullet} ${e.model}`).join(" · ");t.push(e),t.push("")}t.push(`${a.star} Favorite: ${i.magenta.bold(j(o?.[0]||""))} · ${a.circle} Total: ${i.magenta(v(r))} tokens`),t.push("");const l=n.slice(0,3);for(const[e,n]of l){const o=((n.inputTokens+n.outputTokens)/r*100).toFixed(1);t.push(`${a.bullet} ${i.bold(j(e))} ${i.gray(`(${o}%)`)}`),t.push(i.dim(` In: ${v(n.inputTokens)} · Out: ${v(n.outputTokens)}`))}return t}(t));for(;o.length>0&&""===p(o[o.length-1]).trim();)o.pop();if(o.length>0){const e=o[o.length-1],t=k(e),r="Overview"===n?70:80,s="/stats",a=Math.max(2,r-t-s.length);o[o.length-1]=e+" ".repeat(a)+i.gray(s)}return o.join("\n")}(t,n),s=await $(r);o(s.success?"copied!":"copy failed"),setTimeout(o,2e3,null)}(J,N,G)},s[8]=N,s[9]=b,s[10]=J,s[11]=d,s[12]=ee):ee=s[12],x(ee),"error"===g.type){let e;return s[13]!==g.message?(e=t(T,{marginTop:1,children:n(y,{color:"error",children:["Error al cargar estadísticas: ",g.message]})}),s[13]=g.message,s[14]=e):e=s[14],e}if("empty"===g.type){let e;return s[15]===Symbol.for("react.memo_cache_sentinel")?(e=t(T,{marginTop:1,children:t(y,{color:"warning",children:"Aún no hay estadísticas disponibles. ¡Comienza a usar Context Code!"})}),s[15]=e):e=s[15],e}if(!J||!V){let e;return s[16]===Symbol.for("react.memo_cache_sentinel")?(e=n(T,{marginTop:1,children:[t(B,{}),t(y,{children:" Cargando estadísticas…"})]}),s[16]=e):e=s[16],e}s[17]!==V||s[18]!==b||s[19]!==J||s[20]!==U?(te=t(L,{title:"Resumen",children:t(OverviewTab,{stats:J,allTimeStats:V,dateRange:b,isLoading:U})}),s[17]=V,s[18]=b,s[19]=J,s[20]=U,s[21]=te):te=s[21],s[22]!==b||s[23]!==J||s[24]!==U?(ne=t(L,{title:"Modelos",children:t(ModelsTab,{stats:J,dateRange:b,isLoading:U})}),s[22]=b,s[23]=J,s[24]=U,s[25]=ne):ne=s[25],s[26]!==te||s[27]!==ne?(oe=t(T,{flexDirection:"row",gap:1,marginBottom:1,children:n(R,{title:"",color:"context",defaultTab:"Resumen",children:[te,ne]})}),s[26]=te,s[27]=ne,s[28]=oe):oe=s[28];const re=q?` · ${"copying…"===q?"copiando…":"copied!"===q?"¡copiado!":"copy failed"===q?"copia fallida":q}`:"";let se,ie;return s[29]!==re?(se=t(T,{paddingLeft:2,children:n(y,{dimColor:!0,children:["Esc para cancelar · r para recorrer fechas · ctrl+s para copiar",re]})}),s[29]=re,s[30]=se):se=s[30],s[31]!==se||s[32]!==oe?(ie=n(F,{color:"context",children:[oe,se]}),s[31]=se,s[32]=oe,s[33]=ie):ie=s[33],ie}function _temp(e){return"Overview"===e?"Models":"Overview"}function DateRangeSelector(e){const o=r(9),{dateRange:s,isLoading:i}=e;let a,l,c,u;return o[0]!==s?(a=H.map((e,o)=>n(y,{children:[o>0&&t(y,{dimColor:!0,children:" · "}),t(y,e===s?{bold:!0,color:"context",children:E[e]}:{dimColor:!0,children:E[e]})]},e)),o[0]=s,o[1]=a):a=o[1],o[2]!==a?(l=t(T,{children:a}),o[2]=a,o[3]=l):l=o[3],o[4]!==i?(c=i&&t(B,{}),o[4]=i,o[5]=c):c=o[5],o[6]!==l||o[7]!==c?(u=n(T,{marginBottom:1,gap:1,children:[l,c]}),o[6]=l,o[7]=c,o[8]=u):u=o[8],u}function OverviewTab({stats:r,allTimeStats:s,dateRange:i,isLoading:a}){const{columns:l}=g(),c=Object.entries(r.modelUsage).sort(([,e],[,t])=>t.inputTokens+t.outputTokens-(e.inputTokens+e.outputTokens)),u=c[0],m=c.reduce((e,[,t])=>e+t.inputTokens+t.outputTokens,0),p=d(()=>generateFunFactoid(r,m),[r,m]),f="7d"===i?7:"30d"===i?30:r.totalDays;let k=null;if(e("SHOT_STATS")&&r.shotDistribution){const e=r.shotDistribution,t=Object.values(e).reduce((e,t)=>e+t,0);if(t>0){const n=Object.entries(e).reduce((e,[t,n])=>e+parseInt(t,10)*n,0),bucket=(t,n)=>Object.entries(e).filter(([e])=>{const o=parseInt(e,10);return o>=t&&(void 0===n||o<=n)}).reduce((e,[,t])=>e+t,0),pct=e=>Math.round(e/t*100),o=bucket(1,1),r=bucket(2,5),s=bucket(6,10),i=bucket(11);k={avgShots:(n/t).toFixed(1),buckets:[{label:"1-shot",count:o,pct:pct(o)},{label:"2–5 shot",count:r,pct:pct(r)},{label:"6–10 shot",count:s,pct:pct(s)},{label:"11+ shot",count:i,pct:pct(i)}]}}}return n(T,{flexDirection:"column",marginTop:1,children:[s.dailyActivity.length>0&&t(T,{flexDirection:"column",marginBottom:1,children:t(b,{children:M(s.dailyActivity,{terminalWidth:l})})}),t(DateRangeSelector,{dateRange:i,isLoading:a}),n(T,{flexDirection:"row",gap:4,marginBottom:1,children:[t(T,{flexDirection:"column",width:28,children:u&&n(y,{wrap:"truncate",children:["Modelo favorito:"," ",t(y,{color:"context",bold:!0,children:j(u[0])})]})}),t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:["Tokens totales:"," ",t(y,{color:"context",children:v(m)})]})})]}),n(T,{flexDirection:"row",gap:4,children:[t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:["Sesiones:"," ",t(y,{color:"context",children:v(r.totalSessions)})]})}),t(T,{flexDirection:"column",width:28,children:r.longestSession&&n(y,{wrap:"truncate",children:["Sesión más larga:"," ",t(y,{color:"context",children:D(r.longestSession.duration)})]})})]}),n(T,{flexDirection:"row",gap:4,children:[t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:["Días activos: ",t(y,{color:"context",children:r.activeDays}),n(y,{color:"subtle",children:["/",f]})]})}),t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:["Racha más larga:"," ",t(y,{color:"context",bold:!0,children:r.streaks.longestStreak})," ",1===r.streaks.longestStreak?"día":"días"]})})]}),n(T,{flexDirection:"row",gap:4,children:[t(T,{flexDirection:"column",width:28,children:r.peakActivityDay&&n(y,{wrap:"truncate",children:["Día más activo:"," ",t(y,{color:"context",children:(x=r.peakActivityDay,new Date(x).toLocaleDateString("en-US",{month:"short",day:"numeric"}))})]})}),t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:["Racha actual:"," ",t(y,{color:"context",bold:!0,children:s.streaks.currentStreak})," ",1===s.streaks.currentStreak?"día":"días"]})})]}),!1,k&&n(o,{children:[t(T,{marginTop:1,children:t(y,{children:"Distribución de turnos (shots)"})}),n(T,{flexDirection:"row",gap:4,children:[t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:[k.buckets[0].label,":"," ",t(y,{color:"context",children:k.buckets[0].count}),n(y,{color:"subtle",children:[" (",k.buckets[0].pct,"%)"]})]})}),t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:[k.buckets[1].label,":"," ",t(y,{color:"context",children:k.buckets[1].count}),n(y,{color:"subtle",children:[" (",k.buckets[1].pct,"%)"]})]})})]}),n(T,{flexDirection:"row",gap:4,children:[t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:[k.buckets[2].label,":"," ",t(y,{color:"context",children:k.buckets[2].count}),n(y,{color:"subtle",children:[" (",k.buckets[2].pct,"%)"]})]})}),t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:[k.buckets[3].label,":"," ",t(y,{color:"context",children:k.buckets[3].count}),n(y,{color:"subtle",children:[" (",k.buckets[3].pct,"%)"]})]})})]}),t(T,{flexDirection:"row",gap:4,children:t(T,{flexDirection:"column",width:28,children:n(y,{wrap:"truncate",children:["Promedio/sesión:"," ",t(y,{color:"context",children:k.avgShots})]})})})]}),p&&t(T,{marginTop:1,children:t(y,{color:"suggestion",children:p})})]});var x}const I=[{name:"The Little Prince",tokens:22e3},{name:"The Old Man and the Sea",tokens:35e3},{name:"A Christmas Carol",tokens:37e3},{name:"Animal Farm",tokens:39e3},{name:"Fahrenheit 451",tokens:6e4},{name:"The Great Gatsby",tokens:62e3},{name:"Slaughterhouse-Five",tokens:64e3},{name:"Brave New World",tokens:83e3},{name:"The Catcher in the Rye",tokens:95e3},{name:"Harry Potter and the Philosopher's Stone",tokens:103e3},{name:"The Hobbit",tokens:123e3},{name:"1984",tokens:123e3},{name:"To Kill a Mockingbird",tokens:13e4},{name:"Pride and Prejudice",tokens:156e3},{name:"Dune",tokens:244e3},{name:"Moby-Dick",tokens:268e3},{name:"Crime and Punishment",tokens:274e3},{name:"A Game of Thrones",tokens:381e3},{name:"Anna Karenina",tokens:468e3},{name:"Don Quixote",tokens:52e4},{name:"The Lord of the Rings",tokens:576e3},{name:"The Count of Monte Cristo",tokens:603e3},{name:"Les Misérables",tokens:689e3},{name:"War and Peace",tokens:73e4}],U=[{name:"a TED talk",minutes:18},{name:"an episode of The Office",minutes:22},{name:"listening to Abbey Road",minutes:47},{name:"a yoga class",minutes:60},{name:"a World Cup soccer match",minutes:90},{name:"a half marathon (average time)",minutes:120},{name:"the movie Inception",minutes:148},{name:"watching Titanic",minutes:195},{name:"a transatlantic flight",minutes:420},{name:"a full night of sleep",minutes:480}];function generateFunFactoid(e,t){const n=[];if(t>0){const e=I.filter(e=>t>=e.tokens);for(const o of e){const e=t/o.tokens;e>=2?n.push(`Has usado ~${Math.floor(e)} veces más tokens que en ${o.name}`):n.push(`Has usado el mismo número de tokens que en ${o.name}`)}}if(e.longestSession){const t=e.longestSession.duration/6e4;for(const e of U){const o=t/e.minutes;o>=2&&n.push(`Tu sesión más larga es ~${Math.floor(o)} veces más larga que ${e.name}`)}}if(0===n.length)return"";return n[Math.floor(Math.random()*n.length)]}function ModelsTab(e){const o=r(15),{stats:s,dateRange:i,isLoading:l}=e,{headerFocused:c,focusHeader:u}=P(),[d,p]=m(0),{columns:f}=g(),k=Object.entries(s.modelUsage).sort(_temp7),w=!c;let S;if(o[0]!==w?(S={isActive:w},o[0]=w,o[1]=S):S=o[1],x((e,t)=>{t.downArrow&&d<k.length-4&&p(e=>Math.min(e+2,k.length-4)),t.upArrow&&(d>0?p(_temp8):u())},S),0===k.length){let e;return o[2]===Symbol.for("react.memo_cache_sentinel")?(e=t(T,{children:t(y,{color:"subtle",children:"No model usage data available"})}),o[2]=e):e=o[2],e}const D=k.reduce(_temp9,0),v=generateTokenChart(s.dailyModelTokens,k.map(_temp0),f),M=k.slice(d,d+4),j=Math.ceil(M.length/2),$=M.slice(0,j),C=M.slice(j),_=d>0,A=d<k.length-4,O=k.length>4;let F;o[3]!==i||o[4]!==l?(F=t(DateRangeSelector,{dateRange:i,isLoading:l}),o[3]=i,o[4]=l,o[5]=F):F=o[5];const L=T,R=C.map(e=>{const[n,o]=e;return t(ModelEntry,{model:n,usage:o,totalTokens:D},n)});let B,E;return o[6]!==L||o[7]!==R?(B=t(L,{flexDirection:"column",width:36,children:R}),o[6]=L,o[7]=R,o[8]=B):B=o[8],o[9]!==A||o[10]!==_||o[11]!==k||o[12]!==d||o[13]!==O?(E=O&&t(T,{marginTop:1,children:n(y,{color:"subtle",children:[_?a.arrowUp:" "," ",A?a.arrowDown:" "," ",d+1,"-",Math.min(d+4,k.length)," de"," ",k.length," modelos (↑↓ para desplazar)"]})}),o[9]=A,o[10]=_,o[11]=k,o[12]=d,o[13]=O,o[14]=E):E=o[14],n(T,{flexDirection:"column",marginTop:1,children:[v&&n(T,{flexDirection:"column",marginBottom:1,children:[t(y,{bold:!0,children:"Tokens por día"}),t(b,{children:v.chart}),t(y,{color:"subtle",children:v.xAxisLabels}),t(T,{children:v.legend.map(_temp1)})]}),F,n(T,{flexDirection:"row",gap:4,children:[t(T,{flexDirection:"column",width:36,children:$.map(e=>{const[n,o]=e;return t(ModelEntry,{model:n,usage:o,totalTokens:D},n)})}),B]}),E]})}function _temp1(e,o){return n(y,{children:[o>0?" · ":"",t(b,{children:e.coloredBullet})," ",e.model]},e.model)}function _temp0(e){const[t]=e;return t}function _temp9(e,t){const[,n]=t;return e+n.inputTokens+n.outputTokens}function _temp8(e){return Math.max(e-2,0)}function _temp7(e,t){const[,n]=e,[,o]=t;return o.inputTokens+o.outputTokens-(n.inputTokens+n.outputTokens)}function ModelEntry(e){const o=r(21),{model:s,usage:i,totalTokens:l}=e,c=(i.inputTokens+i.outputTokens)/l*100;let u;o[0]!==c?(u=c.toFixed(1),o[0]=c,o[1]=u):u=o[1];const d=u;let m,p,g,f,k,b,x,w;return o[2]!==s?(m=j(s),o[2]=s,o[3]=m):m=o[3],o[4]!==m?(p=t(y,{bold:!0,children:m}),o[4]=m,o[5]=p):p=o[5],o[6]!==d?(g=n(y,{color:"subtle",children:["(",d,"%)"]}),o[6]=d,o[7]=g):g=o[7],o[8]!==p||o[9]!==g?(f=n(y,{children:[a.bullet," ",p," ",g]}),o[8]=p,o[9]=g,o[10]=f):f=o[10],o[11]!==i.inputTokens?(k=v(i.inputTokens),o[11]=i.inputTokens,o[12]=k):k=o[12],o[13]!==i.outputTokens?(b=v(i.outputTokens),o[13]=i.outputTokens,o[14]=b):b=o[14],o[15]!==k||o[16]!==b?(x=n(y,{color:"subtle",children:[" ","In: ",k," · Out:"," ",b]}),o[15]=k,o[16]=b,o[17]=x):x=o[17],o[18]!==f||o[19]!==x?(w=n(T,{flexDirection:"column",children:[f,x]}),o[18]=f,o[19]=x,o[20]=w):w=o[20],w}function generateTokenChart(e,t,n){if(e.length<2||0===t.length)return null;const o=n-7,r=Math.min(52,Math.max(20,o));let i;if(e.length>=r)i=e.slice(-r);else{const t=Math.floor(r/e.length);i=[];for(const n of e)for(let e=0;e<t;e++)i.push(n)}const l=A(_(S().theme)),c=[O(l.suggestion),O(l.success),O(l.warning)],u=[],d=[],m=t.slice(0,3);for(let e=0;e<m.length;e++){const t=m[e],n=i.map(e=>e.tokensByModel[t]||0);if(n.some(e=>e>0)){u.push(n);const o=[l.suggestion,l.success,l.warning];d.push({model:j(t),coloredBullet:f(a.bullet,o[e%o.length])})}}if(0===u.length)return null;return{chart:s(u,{height:8,colors:c.slice(0,u.length),format:e=>{let t;return t=e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(0)+"k":e.toFixed(0),t.padStart(6)}}),legend:d,xAxisLabels:function(e,t,n){if(0===e.length)return"";const o=Math.min(4,Math.max(2,Math.floor(e.length/8))),r=e.length-6,s=Math.floor(r/(o-1))||1,i=[];for(let t=0;t<o;t++){const n=Math.min(t*s,e.length-1),o=new Date(e[n].date).toLocaleDateString("en-US",{month:"short",day:"numeric"});i.push({pos:n,label:o})}let a=" ".repeat(n),l=0;for(const{pos:e,label:t}of i){const n=Math.max(1,e-l);a+=" ".repeat(n)+t,l=e+t.length}return a}(i,i.length,7)}}
@@ -1 +1 @@
1
- import{jsxs as e,jsx as r}from"react/jsx-runtime";import{c as n}from"react/compiler-runtime";import o from"figures";import{useState as t}from"react";import{Box as i,Text as l,useAnimationFrame as a}from"../ink.js";import{AppStateProvider as c}from"../state/AppState.js";import{checkOutTeleportedSessionBranch as s,processMessagesForTeleportResume as d,teleportResumeCodeSession as m}from"../utils/teleport.js";const h=["◐","◓","◑","◒"],p=[{key:"validating",label:"Validando sesión"},{key:"fetching_logs",label:"Obteniendo registros de la sesión"},{key:"fetching_branch",label:"Obteniendo información de la rama"},{key:"checking_out",label:"Cambiando a la rama"}];export function TeleportProgress(t){const c=n(16),{currentStep:s,sessionId:d}=t,[m,f]=a(100),g=Math.floor(f/100)%h.length;let u;c[0]!==s?(u=e=>e.key===s,c[0]=s,c[1]=u):u=c[1];const b=p.findIndex(u),k=h[g];let x,y,j,w,C;return c[2]!==k?(x=r(i,{marginBottom:1,children:e(l,{bold:!0,color:"claude",children:[k," Teletransportando sesión…"]})}),c[2]=k,c[3]=x):x=c[3],c[4]!==d?(y=d&&r(i,{marginBottom:1,children:r(l,{dimColor:!0,children:d})}),c[4]=d,c[5]=y):y=c[5],c[6]!==b||c[7]!==g?(j=p.map((n,t)=>{const a=t===b,c=t>b;let s,d;return t<b?(s=o.tick,d="green"):a?(s=h[g],d="claude"):(s=o.circle,d=void 0),e(i,{flexDirection:"row",children:[r(i,{width:2,children:r(l,{color:d,dimColor:c,children:s})}),r(l,{dimColor:c,bold:a,children:n.label})]},n.key)}),c[6]=b,c[7]=g,c[8]=j):j=c[8],c[9]!==j?(w=r(i,{flexDirection:"column",marginLeft:2,children:j}),c[9]=j,c[10]=w):w=c[10],c[11]!==m||c[12]!==x||c[13]!==y||c[14]!==w?(C=e(i,{ref:m,flexDirection:"column",paddingX:1,paddingY:1,children:[x,y,w]}),c[11]=m,c[12]=x,c[13]=y,c[14]=w,c[15]=C):C=c[15],C}export async function teleportWithProgress(e,n){let setStep=()=>{};e.render(r(c,{children:r(function(){const[e,o]=t("validating");return setStep=o,r(TeleportProgress,{currentStep:e,sessionId:n})},{})}));const o=await m(n,setStep);setStep("checking_out");const{branchName:i,branchError:l}=await s(o.branch);return{messages:d(o.log,l),branchName:i}}
1
+ import{jsxs as e,jsx as r}from"react/jsx-runtime";import{c as n}from"react/compiler-runtime";import t from"figures";import{useState as o}from"react";import{Box as i,Text as l,useAnimationFrame as c}from"../ink.js";import{AppStateProvider as a}from"../state/AppState.js";import{checkOutTeleportedSessionBranch as s,processMessagesForTeleportResume as d,teleportResumeCodeSession as m}from"../utils/teleport.js";const h=["◐","◓","◑","◒"],p=[{key:"validating",label:"Validando sesión"},{key:"fetching_logs",label:"Obteniendo registros de la sesión"},{key:"fetching_branch",label:"Obteniendo información de la rama"},{key:"checking_out",label:"Cambiando a la rama"}];export function TeleportProgress(o){const a=n(16),{currentStep:s,sessionId:d}=o,[m,f]=c(100),g=Math.floor(f/100)%h.length;let u;a[0]!==s?(u=e=>e.key===s,a[0]=s,a[1]=u):u=a[1];const b=p.findIndex(u),x=h[g];let k,y,j,w,C;return a[2]!==x?(k=r(i,{marginBottom:1,children:e(l,{bold:!0,color:"context",children:[x," Teletransportando sesión…"]})}),a[2]=x,a[3]=k):k=a[3],a[4]!==d?(y=d&&r(i,{marginBottom:1,children:r(l,{dimColor:!0,children:d})}),a[4]=d,a[5]=y):y=a[5],a[6]!==b||a[7]!==g?(j=p.map((n,o)=>{const c=o===b,a=o>b;let s,d;return o<b?(s=t.tick,d="green"):c?(s=h[g],d="context"):(s=t.circle,d=void 0),e(i,{flexDirection:"row",children:[r(i,{width:2,children:r(l,{color:d,dimColor:a,children:s})}),r(l,{dimColor:a,bold:c,children:n.label})]},n.key)}),a[6]=b,a[7]=g,a[8]=j):j=a[8],a[9]!==j?(w=r(i,{flexDirection:"column",marginLeft:2,children:j}),a[9]=j,a[10]=w):w=a[10],a[11]!==m||a[12]!==k||a[13]!==y||a[14]!==w?(C=e(i,{ref:m,flexDirection:"column",paddingX:1,paddingY:1,children:[k,y,w]}),a[11]=m,a[12]=k,a[13]=y,a[14]=w,a[15]=C):C=a[15],C}export async function teleportWithProgress(e,n){let setStep=()=>{};e.render(r(a,{children:r(function(){const[e,t]=o("validating");return setStep=t,r(TeleportProgress,{currentStep:e,sessionId:n})},{})}));const t=await m(n,setStep);setStep("checking_out");const{branchName:i,branchError:l}=await s(t.branch);return{messages:d(t.log,l),branchName:i}}
@@ -1 +1 @@
1
- import{feature as e}from"../recovery/bunBundleShim.js";import{jsx as o,jsxs as r}from"react/jsx-runtime";import t from"chalk";import{useMemo as i,useRef as n,useState as s,useEffect as l}from"react";import{useVoiceState as a}from"../context/voice.js";import{useClipboardImageHint as c}from"../hooks/useClipboardImageHint.js";import{useSettings as u}from"../hooks/useSettings.js";import{useTextInput as d}from"../hooks/useTextInput.js";import{Box as m,color as p,useAnimationFrame as h,useTerminalFocus as f,useTheme as g,Text as v}from"../ink.js";import{isEnvTruthy as C}from"../utils/envUtils.js";import{BaseTextInput as x}from"./BaseTextInput.js";import{hueToRgb as b}from"./Spinner/utils.js";import{isWebappRunning as E,broadcastInteractiveInput as I,getWebappUrl as y}from"../webapp/server.js";const S=" ▁▂▃▄▅▆▇█";export default function TextInput(T){const[k,D]=s(!1),[j,M]=s(!1),[O,P]=s(null);l(()=>{if(E()&&!T.multiline){D(!0);const e=Math.random().toString(36).substring(2,9),{title:o,description:r,placeholder:t}=function(e){const o=(e.placeholder||e.value||"").toLowerCase();return e.mask||o.includes("api")||o.includes("key")||o.includes("token")||o.includes("password")||o.includes("contraseña")?{title:"Introducir Clave de API / Token Confidencial",description:"Por seguridad, introduce tu API Key o Token de acceso en este campo seguro y enmascarado.",placeholder:"sk-..."}:o.includes("host")||o.includes("url")||o.includes("puerto")||o.includes("port")?{title:"Configurar Dirección / Servidor",description:"Introduce la dirección URL, host o puerto del servicio que deseas configurar.",placeholder:"http://localhost:..."}:{title:"Entrada de Texto Requerida",description:"Por favor, introduce el valor solicitado para continuar con la operación en curso.",placeholder:"Escribe aquí..."}}(T),i=T.value?String(T.value):void 0;I(e,o,r,T.placeholder||t,T.mask,i).then(e=>{M(!0),T.onSubmit?.(e)}).catch(e=>{P(e.message||String(e)),T.onExit?.()})}},[T.multiline,T.value]);const[w]=g(),A=f();if(k&&!j)return r(m,{flexDirection:"column",padding:1,borderStyle:"round",borderColor:"cyan",children:[o(v,{color:"cyan",bold:!0,children:"✨ Interacción de Entrada Transferida a la WebApp"}),o(v,{color:"white",children:"Por favor, escribe el valor requerido en tu navegador:"}),o(v,{bold:!0,color:"cyan",children:y()}),O?r(v,{color:"red",children:["Error: ",O]}):o(v,{dimColor:!0,children:"Esperando respuesta del usuario..."})]});const L=i(()=>C(process.env.CONTEXT_CODE_ACCESSIBILITY)||C(process.env.CLAUDE_CODE_ACCESSIBILITY),[]),H=u().prefersReducedMotion??!1,U="recording"===(e("VOICE_MODE")?a(e=>e.voiceState):"idle"),_=e("VOICE_MODE")?a(e=>e.voiceAudioLevels):[],F=n(new Array(1).fill(0)),R=U&&!H,[V,q]=e("VOICE_MODE")?h(R?50:null):[()=>{},0];c(A,!!T.onImagePaste);let B;if(A&&!L)if(U&&!H){const e=F.current,o=_.length>0?_[_.length-1]??0:0,r=Math.min(1.8*o,1);e[0]=.7*(e[0]??0)+r*(1-.7);const i=e[0]??0,n=Math.max(1,Math.min(Math.round(8*i),8)),s=o<.15,l=q/1e3*90%360,{r:a,g:c,b:u}=s?{r:128,g:128,b:128}:b(l);B=()=>t.rgb(a,c,u)(S[n])}else B=t.inverse;else B=e=>e;const K=d({value:T.value,onChange:T.onChange,onSubmit:T.onSubmit,onExit:T.onExit,onExitMessage:T.onExitMessage,onHistoryReset:T.onHistoryReset,onHistoryUp:T.onHistoryUp,onHistoryDown:T.onHistoryDown,onClearInput:T.onClearInput,focus:T.focus,mask:T.mask,multiline:T.multiline,cursorChar:T.showCursor?" ":"",highlightPastedText:T.highlightPastedText,invert:B,themeText:p("text",w),columns:T.columns,maxVisibleLines:T.maxVisibleLines,onImagePaste:T.onImagePaste,disableCursorMovementForUpDownKeys:T.disableCursorMovementForUpDownKeys,disableEscapeDoublePress:T.disableEscapeDoublePress,externalOffset:T.cursorOffset,onOffsetChange:T.onChangeCursorOffset,inputFilter:T.inputFilter,inlineGhostText:T.inlineGhostText,dim:t.dim});return o(m,{ref:V,children:o(x,{inputState:K,terminalFocus:A,highlights:T.highlights,invert:B,hidePlaceholderText:U,...T})})}
1
+ import{feature as e}from"../recovery/bunBundleShim.js";import{jsx as o,jsxs as r}from"react/jsx-runtime";import t from"chalk";import{useMemo as i,useRef as n,useState as s,useEffect as l}from"react";import{useVoiceState as a}from"../context/voice.js";import{useClipboardImageHint as c}from"../hooks/useClipboardImageHint.js";import{useSettings as u}from"../hooks/useSettings.js";import{useTextInput as d}from"../hooks/useTextInput.js";import{Box as m,color as p,useAnimationFrame as h,useTerminalFocus as f,useTheme as g,Text as v}from"../ink.js";import{isEnvTruthy as C}from"../utils/envUtils.js";import{BaseTextInput as x}from"./BaseTextInput.js";import{hueToRgb as b}from"./Spinner/utils.js";import{isWebappRunning as E,broadcastInteractiveInput as I,getWebappUrl as y}from"../webapp/server.js";const S=" ▁▂▃▄▅▆▇█";export default function TextInput(T){const[k,D]=s(!1),[j,M]=s(!1),[O,P]=s(null);l(()=>{if(E()&&!T.multiline&&!T.mask){D(!0);const e=Math.random().toString(36).substring(2,9),{title:o,description:r,placeholder:t}=function(e){const o=(e.placeholder||e.value||"").toLowerCase();return e.mask||o.includes("api")||o.includes("key")||o.includes("token")||o.includes("password")||o.includes("contraseña")?{title:"Introducir Clave de API / Token Confidencial",description:"Por seguridad, introduce tu API Key o Token de acceso en este campo seguro y enmascarado.",placeholder:"sk-..."}:o.includes("host")||o.includes("url")||o.includes("puerto")||o.includes("port")?{title:"Configurar Dirección / Servidor",description:"Introduce la dirección URL, host o puerto del servicio que deseas configurar.",placeholder:"http://localhost:..."}:{title:"Entrada de Texto Requerida",description:"Por favor, introduce el valor solicitado para continuar con la operación en curso.",placeholder:"Escribe aquí..."}}(T),i=T.value?String(T.value):void 0;I(e,o,r,T.placeholder||t,T.mask,i).then(e=>{M(!0),T.onSubmit?.(e)}).catch(e=>{P(e.message||String(e)),T.onExit?.()})}},[T.multiline,T.value]);const[w]=g(),A=f();if(k&&!j)return r(m,{flexDirection:"column",padding:1,borderStyle:"round",borderColor:"cyan",children:[o(v,{color:"cyan",bold:!0,children:"✨ Interacción de Entrada Transferida a la WebApp"}),o(v,{color:"white",children:"Por favor, escribe el valor requerido en tu navegador:"}),o(v,{bold:!0,color:"cyan",children:y()}),O?r(v,{color:"red",children:["Error: ",O]}):o(v,{dimColor:!0,children:"Esperando respuesta del usuario..."})]});const L=i(()=>C(process.env.CONTEXT_CODE_ACCESSIBILITY)||C(process.env.CLAUDE_CODE_ACCESSIBILITY),[]),H=u().prefersReducedMotion??!1,U="recording"===(e("VOICE_MODE")?a(e=>e.voiceState):"idle"),_=e("VOICE_MODE")?a(e=>e.voiceAudioLevels):[],F=n(new Array(1).fill(0)),R=U&&!H,[V,q]=e("VOICE_MODE")?h(R?50:null):[()=>{},0];c(A,!!T.onImagePaste);let B;if(A&&!L)if(U&&!H){const e=F.current,o=_.length>0?_[_.length-1]??0:0,r=Math.min(1.8*o,1);e[0]=.7*(e[0]??0)+r*(1-.7);const i=e[0]??0,n=Math.max(1,Math.min(Math.round(8*i),8)),s=o<.15,l=q/1e3*90%360,{r:a,g:c,b:u}=s?{r:128,g:128,b:128}:b(l);B=()=>t.rgb(a,c,u)(S[n])}else B=t.inverse;else B=e=>e;const K=d({value:T.value,onChange:T.onChange,onSubmit:T.onSubmit,onExit:T.onExit,onExitMessage:T.onExitMessage,onHistoryReset:T.onHistoryReset,onHistoryUp:T.onHistoryUp,onHistoryDown:T.onHistoryDown,onClearInput:T.onClearInput,focus:T.focus,mask:T.mask,multiline:T.multiline,cursorChar:T.showCursor?" ":"",highlightPastedText:T.highlightPastedText,invert:B,themeText:p("text",w),columns:T.columns,maxVisibleLines:T.maxVisibleLines,onImagePaste:T.onImagePaste,disableCursorMovementForUpDownKeys:T.disableCursorMovementForUpDownKeys,disableEscapeDoublePress:T.disableEscapeDoublePress,externalOffset:T.cursorOffset,onOffsetChange:T.onChangeCursorOffset,inputFilter:T.inputFilter,inlineGhostText:T.inlineGhostText,dim:t.dim});return o(m,{ref:V,children:o(x,{inputState:K,terminalFocus:A,highlights:T.highlights,invert:B,hidePlaceholderText:U,...T})})}
@@ -1 +1 @@
1
- import{feature as e}from"../../recovery/bunBundleShim.js";import{jsx as t}from"react/jsx-runtime";import{c as r}from"react/compiler-runtime";import{createContext as i,useContext as n,useEffect as m,useMemo as o,useState as u}from"react";import s from"../../ink/hooks/use-stdin.js";import{getGlobalConfig as a,saveGlobalConfig as l}from"../../utils/config.js";import{getSystemThemeName as h}from"../../utils/systemTheme.js";import{bootstrapDynamicThemes as c}from"../../utils/themes/bootstrap.js";c();const v="dark",T=i({themeSetting:v,setThemeSetting:()=>{},setPreviewTheme:()=>{},savePreview:()=>{},cancelPreview:()=>{},currentTheme:v});function defaultInitialTheme(){return a().theme}function defaultSaveTheme(e){l(t=>({...t,theme:e}))}export function ThemeProvider({children:r,initialState:i,onThemeSave:n=defaultSaveTheme}){const[a,l]=u(i??defaultInitialTheme),[c,v]=u(null),[f,p]=u(()=>"auto"===(i??a)?h():"dark"),P=c??a,{internal_querier:w}=s();m(()=>{if(e("AUTO_THEME")){if("auto"!==P||!w)return;let e,t=!1;return import("../../utils/systemThemeWatcher.js").then(({watchSystemTheme:r})=>{t||(e=r(w,p))}),()=>{t=!0,e?.()}}},[P,w]);const S="auto"===P?f:P,d=o(()=>({themeSetting:a,setThemeSetting:e=>{l(e),v(null),"auto"===e&&p(h()),n?.(e)},setPreviewTheme:e=>{v(e),"auto"===e&&p(h())},savePreview:()=>{null!==c&&(l(c),v(null),n?.(c))},cancelPreview:()=>{null!==c&&v(null)},currentTheme:S}),[a,c,S,n]);return t(T.Provider,{value:d,children:r})}export function useTheme(){const e=r(3),{currentTheme:t,setThemeSetting:i}=n(T);let m;return e[0]!==t||e[1]!==i?(m=[t,i],e[0]=t,e[1]=i,e[2]=m):m=e[2],m}export function useThemeSetting(){return n(T).themeSetting}export function usePreviewTheme(){const e=r(4),{setPreviewTheme:t,savePreview:i,cancelPreview:m}=n(T);let o;return e[0]!==m||e[1]!==i||e[2]!==t?(o={setPreviewTheme:t,savePreview:i,cancelPreview:m},e[0]=m,e[1]=i,e[2]=t,e[3]=o):o=e[3],o}
1
+ import{feature as e}from"../../recovery/bunBundleShim.js";import{jsx as t}from"react/jsx-runtime";import{c as r}from"react/compiler-runtime";import{createContext as n,useContext as i,useEffect as m,useMemo as o,useState as u}from"react";import s from"../../ink/hooks/use-stdin.js";import{getGlobalConfig as a,saveGlobalConfig as c}from"../../utils/config.js";import{getSystemThemeName as h}from"../../utils/systemTheme.js";import{bootstrapDynamicThemes as l}from"../../utils/themes/bootstrap.js";l();const f="dark",v=n({themeSetting:f,setThemeSetting:()=>{},setPreviewTheme:()=>{},savePreview:()=>{},cancelPreview:()=>{},currentTheme:f});function defaultInitialTheme(){return a().theme}function defaultSaveTheme(e){c(t=>({...t,theme:e}))}export function ThemeProvider({children:r,initialState:n,onThemeSave:i=defaultSaveTheme}){const[a,c]=u(n??defaultInitialTheme),[l,f]=u(null),[T,p]=u(()=>"auto"===(n??a)?h():"dark"),P=l??a,{internal_querier:w}=s();m(()=>{if(e("AUTO_THEME")){if("auto"!==P||!w)return;let e,t=!1;return import("../../utils/systemThemeWatcher.js").then(r=>{if(t)return;const n=r.watchSystemTheme;"function"==typeof n&&(e=n(w,p))}).catch(()=>{}),()=>{t=!0,e?.()}}},[P,w]);const S="auto"===P?T:P,d=o(()=>({themeSetting:a,setThemeSetting:e=>{c(e),f(null),"auto"===e&&p(h()),i?.(e)},setPreviewTheme:e=>{f(e),"auto"===e&&p(h())},savePreview:()=>{null!==l&&(c(l),f(null),i?.(l))},cancelPreview:()=>{null!==l&&f(null)},currentTheme:S}),[a,l,S,i]);return t(v.Provider,{value:d,children:r})}export function useTheme(){const e=r(3),{currentTheme:t,setThemeSetting:n}=i(v);let m;return e[0]!==t||e[1]!==n?(m=[t,n],e[0]=t,e[1]=n,e[2]=m):m=e[2],m}export function useThemeSetting(){return i(v).themeSetting}export function usePreviewTheme(){const e=r(4),{setPreviewTheme:t,savePreview:n,cancelPreview:m}=i(v);let o;return e[0]!==m||e[1]!==n||e[2]!==t?(o={setPreviewTheme:t,savePreview:n,cancelPreview:m},e[0]=m,e[1]=n,e[2]=t,e[3]=o):o=e[3],o}
@@ -1 +1 @@
1
- import{jsx as e,Fragment as t}from"react/jsx-runtime";import{c as n}from"react/compiler-runtime";import{Suspense as s,use as o,useRef as i,useState as a}from"react";import{useSettings as r}from"../../../hooks/useSettings.js";import{useTerminalSize as u}from"../../../hooks/useTerminalSize.js";import{stringWidth as l}from"../../../ink/stringWidth.js";import{useTheme as c}from"../../../ink.js";import{useKeybindings as m}from"../../../keybindings/useKeybinding.js";import{logEvent as p}from"../../../services/analytics/index.js";import{useAppState as h}from"../../../state/AppState.js";import{AskUserQuestionTool as g}from"../../../tools/AskUserQuestionTool/AskUserQuestionTool.js";import{getCliHighlightPromise as d}from"../../../utils/cliHighlight.js";import{maybeResizeAndDownsampleImageBlock as f}from"../../../utils/imageResizer.js";import{cacheImagePath as _,storeImage as q}from"../../../utils/imageStore.js";import{logError as j}from"../../../utils/log.js";import{applyMarkdown as v}from"../../../utils/markdown.js";import{isPlanModeInterviewPhaseEnabled as b}from"../../../utils/planModeV2.js";import{getPlanFilePath as y}from"../../../utils/plans.js";import{QuestionView as w}from"./QuestionView.js";import{SubmitQuestionsView as x}from"./SubmitQuestionsView.js";import{useMultipleChoiceState as k}from"./use-multiple-choice-state.js";export function AskUserQuestionPermissionRequest(t){const o=n(4);if(r().syntaxHighlightingDisabled){let n;return o[0]!==t?(n=e(AskUserQuestionPermissionRequestBody,{...t,highlight:null}),o[0]=t,o[1]=n):n=o[1],n}let i;return o[2]!==t?(i=e(s,{fallback:e(AskUserQuestionPermissionRequestBody,{...t,highlight:null}),children:e(AskUserQuestionWithHighlight,{...t})}),o[2]=t,o[3]=i):i=o[3],i}function AskUserQuestionWithHighlight(t){const s=n(4);let i;s[0]===Symbol.for("react.memo_cache_sentinel")?(i=d(),s[0]=i):i=s[0];const a=o(i);let r;return s[1]!==a||s[2]!==t?(r=e(AskUserQuestionPermissionRequestBody,{...t,highlight:a}),s[1]=a,s[2]=t,s[3]=r):r=s[3],r}function AskUserQuestionPermissionRequestBody(s){const o=n(115),{toolUseConfirm:r,onDone:d,onReject:f,highlight:I}=s;let P;o[0]!==r.input?(P=g.inputSchema.safeParse(r.input),o[0]=r.input,o[1]=P):P=o[1];const R=P;let C;o[2]!==R.data||o[3]!==R.success?(C=R.success&&R.data.questions||[],o[2]=R.data,o[3]=R.success,o[4]=C):C=o[4];const Q=C,{rows:T}=u(),[A]=c();let M=0,S=0;const U=Math.max(12,T-15);if(o[5]!==I||o[6]!==U||o[7]!==M||o[8]!==S||o[9]!==Q||o[10]!==A){for(const e of Q){if(e.options.some(_temp)){const t=Math.max(1,U-11);let n=0;for(const s of e.options)if(s.preview){const e=v(s.preview,A,I).split("\n"),o=e.length>t,i=o?t:e.length;n=Math.max(n,i+(o?1:0)+2);for(const t of e)S=Math.max(S,l(t))}const s=n+2,o=e.options.length+2,i=Math.max(o,s);M=Math.max(M,i+7)}else M=Math.max(M,e.options.length+3+7)}o[5]=I,o[6]=U,o[7]=M,o[8]=S,o[9]=Q,o[10]=A,o[11]=M}else M=o[11];const $=Math.min(Math.max(M,12),U),B=Math.max(S,40);let H;o[12]!==$||o[13]!==B?(H={globalContentHeight:$,globalContentWidth:B},o[12]=$,o[13]=B,o[14]=H):H=o[14];const{globalContentHeight:E,globalContentWidth:z}=H,O=R.success?R.data.metadata?.source:void 0;let W;o[15]===Symbol.for("react.memo_cache_sentinel")?(W={},o[15]=W):W=o[15];const[F,V]=a(W),D=i(0);let N;o[16]===Symbol.for("react.memo_cache_sentinel")?(N=function(e,t,n,s,o,i){D.current=D.current+1;const a=D.current,r={id:a,type:"image",content:t,mediaType:n||"image/png",filename:s||"Imagen pegada",dimensions:o};_(r),q(r),V(t=>({...t,[e]:{...t[e]??{},[a]:r}}))},o[16]=N):N=o[16];const K=N;let G;o[17]===Symbol.for("react.memo_cache_sentinel")?(G=(e,t)=>{V(n=>{const s={...n[e]??{}};return delete s[t],{...n,[e]:s}})},o[17]=G):G=o[17];const J=G;let L;o[18]!==F?(L=Object.values(F).flatMap(_temp2).filter(_temp3),o[18]=F,o[19]=L):L=o[19];const X=L,Y="plan"===h(_temp4);let Z;o[20]!==Y?(Z=Y?y():void 0,o[20]=Y,o[21]=Z):Z=o[21];const ee=Z,te=k(),{currentQuestionIndex:ne,answers:se,questionStates:oe,isInTextInput:ie,nextQuestion:ae,prevQuestion:re,updateQuestionState:ue,setAnswer:le,setTextInputMode:ce}=te,me=ne<(Q?.length||0)?Q?.[ne]:null,pe=ne===(Q?.length||0);let he;o[22]!==se||o[23]!==Q?(he=Q?.every(e=>e?.question&&!!se[e.question])??!1,o[22]=se,o[23]=Q,o[24]=he):he=o[24];const ge=he,de=1===Q.length&&!Q[0]?.multiSelect;let fe;o[25]!==Y||o[26]!==O||o[27]!==d||o[28]!==f||o[29]!==Q.length||o[30]!==r?(fe=()=>{O&&p("tengu_ask_user_question_rejected",{source:O,questionCount:Q.length,isInPlanMode:Y,interviewPhaseEnabled:Y&&b()}),d(),f(),r.onReject()},o[25]=Y,o[26]=O,o[27]=d,o[28]=f,o[29]=Q.length,o[30]=r,o[31]=fe):fe=o[31];const _e=fe;let qe;o[32]!==X||o[33]!==se||o[34]!==Y||o[35]!==O||o[36]!==d||o[37]!==Q||o[38]!==r?(qe=async()=>{const e=`El usuario desea aclarar estas preguntas.\n Esto significa que pueden tener información adicional, contexto o preguntas para ti.\n Ten en cuenta su respuesta y reformula las preguntas si es apropiado.\n Comienza preguntándoles qué desearían aclarar.\n\n Preguntas realizadas:\n${Q.map(e=>{const t=se[e.question];return t?`- "${e.question}"\n Respuesta: ${t}`:`- "${e.question}"\n (No se proporcionó respuesta)`}).join("\n")}`;O&&p("tengu_ask_user_question_respond_to_claude",{source:O,questionCount:Q.length,isInPlanMode:Y,interviewPhaseEnabled:Y&&b()});const t=await convertImagesToBlocks(X);d(),r.onReject(e,t&&t.length>0?t:void 0)},o[32]=X,o[33]=se,o[34]=Y,o[35]=O,o[36]=d,o[37]=Q,o[38]=r,o[39]=qe):qe=o[39];const je=qe;let ve;o[40]!==X||o[41]!==se||o[42]!==Y||o[43]!==O||o[44]!==d||o[45]!==Q||o[46]!==r?(ve=async()=>{const e=`El usuario ha indicado que ha proporcionado suficientes respuestas para la entrevista del plan.\nDeja de hacer preguntas aclaratorias y procede a finalizar el plan con la información que tienes.\n\nPreguntas realizadas y respuestas proporcionadas:\n${Q.map(e=>{const t=se[e.question];return t?`- "${e.question}"\n Respuesta: ${t}`:`- "${e.question}"\n (No se proporcionó respuesta)`}).join("\n")}`;O&&p("tengu_ask_user_question_finish_plan_interview",{source:O,questionCount:Q.length,isInPlanMode:Y,interviewPhaseEnabled:Y&&b()});const t=await convertImagesToBlocks(X);d(),r.onReject(e,t&&t.length>0?t:void 0)},o[40]=X,o[41]=se,o[42]=Y,o[43]=O,o[44]=d,o[45]=Q,o[46]=r,o[47]=ve):ve=o[47];const be=ve;let ye;o[48]!==X||o[49]!==Y||o[50]!==O||o[51]!==d||o[52]!==oe||o[53]!==Q||o[54]!==r?(ye=async e=>{O&&p("tengu_ask_user_question_accepted",{source:O,questionCount:Q.length,answerCount:Object.keys(e).length,isInPlanMode:Y,interviewPhaseEnabled:Y&&b()});const t={};for(const n of Q){const s=e[n.question],o=oe[n.question]?.textInputValue,i=s?n.options.find(e=>e.label===s):void 0,a=i?.preview;(a||o?.trim())&&(t[n.question]={...a&&{preview:a},...o?.trim()&&{notes:o.trim()}})}const n={...r.input,answers:e,...Object.keys(t).length>0&&{annotations:t}},s=await convertImagesToBlocks(X);d(),r.onAllow(n,[],void 0,s&&s.length>0?s:void 0)},o[48]=X,o[49]=Y,o[50]=O,o[51]=d,o[52]=oe,o[53]=Q,o[54]=r,o[55]=ye):ye=o[55];const we=ye;let xe;o[56]!==se||o[57]!==F||o[58]!==Q.length||o[59]!==le||o[60]!==we?(xe=(e,t,n,s)=>{const o=void 0===s||s;let i;const a=Array.isArray(t);if(a)i=t.join(", ");else if(n){i=Object.values(F[e]??{}).filter(_temp5).length>0?`${n} (Imagen adjunta)`:n}else if("__other__"===t){i=Object.values(F[e]??{}).filter(_temp6).length>0?"(Imagen adjunta)":t}else i=t;const r=1===Q.length;if(!a&&r&&o){const t={...se,[e]:i};return void we(t).catch(j)}le(e,i,o)},o[56]=se,o[57]=F,o[58]=Q.length,o[59]=le,o[60]=we,o[61]=xe):xe=o[61];const ke=xe;let Ie;o[62]!==se||o[63]!==_e||o[64]!==we?(Ie=function(e){"cancel"!==e?"submit"===e&&we(se).catch(j):_e()},o[62]=se,o[63]=_e,o[64]=we,o[65]=Ie):Ie=o[65];const Pe=Ie,Re=de?(Q?.length||1)-1:Q?.length||0;let Ce;o[66]!==ne||o[67]!==re?(Ce=()=>{ne>0&&re()},o[66]=ne,o[67]=re,o[68]=Ce):Ce=o[68];const Qe=Ce;let Te;o[69]!==ne||o[70]!==Re||o[71]!==ae?(Te=()=>{ne<Re&&ae()},o[69]=ne,o[70]=Re,o[71]=ae,o[72]=Te):Te=o[72];const Ae=Te;let Me;o[73]!==Ae||o[74]!==Qe?(Me={"tabs:previous":Qe,"tabs:next":Ae},o[73]=Ae,o[74]=Qe,o[75]=Me):Me=o[75];const Se=!(ie&&!pe);let Ue;if(o[76]!==Se?(Ue={context:"Tabs",isActive:Se},o[76]=Se,o[77]=Ue):Ue=o[77],m(Me,Ue),me){let n,s,i,a;return o[78]!==me.question?(n=(e,t,n,s,o)=>K(me.question,e,t,n,s,o),o[78]=me.question,o[79]=n):n=o[79],o[80]!==me.question||o[81]!==F?(s=F[me.question]??{},o[80]=me.question,o[81]=F,o[82]=s):s=o[82],o[83]!==me.question?(i=e=>J(me.question,e),o[83]=me.question,o[84]=i):i=o[84],o[85]!==se||o[86]!==me||o[87]!==ne||o[88]!==E||o[89]!==z||o[90]!==_e||o[91]!==be||o[92]!==ke||o[93]!==je||o[94]!==Ae||o[95]!==Qe||o[96]!==de||o[97]!==ae||o[98]!==ee||o[99]!==oe||o[100]!==Q||o[101]!==ce||o[102]!==n||o[103]!==s||o[104]!==i||o[105]!==ue?(a=e(t,{children:e(w,{question:me,questions:Q,currentQuestionIndex:ne,answers:se,questionStates:oe,hideSubmitTab:de,minContentHeight:E,minContentWidth:z,planFilePath:ee,onUpdateQuestionState:ue,onAnswer:ke,onTextInputFocus:ce,onCancel:_e,onSubmit:ae,onTabPrev:Qe,onTabNext:Ae,onRespondToContext:je,onFinishPlanInterview:be,onImagePaste:n,pastedContents:s,onRemoveImage:i})}),o[85]=se,o[86]=me,o[87]=ne,o[88]=E,o[89]=z,o[90]=_e,o[91]=be,o[92]=ke,o[93]=handleRespondToClaude,o[94]=Ae,o[95]=Qe,o[96]=de,o[97]=ae,o[98]=ee,o[99]=oe,o[100]=Q,o[101]=ce,o[102]=n,o[103]=s,o[104]=i,o[105]=ue,o[106]=a):a=o[106],a}if(pe){let n;return o[107]!==ge||o[108]!==se||o[109]!==ne||o[110]!==E||o[111]!==Pe||o[112]!==Q||o[113]!==r.permissionResult?(n=e(t,{children:e(x,{questions:Q,currentQuestionIndex:ne,answers:se,allQuestionsAnswered:ge,permissionResult:r.permissionResult,minContentHeight:E,onFinalResponse:Pe})}),o[107]=ge,o[108]=se,o[109]=ne,o[110]=E,o[111]=Pe,o[112]=Q,o[113]=r.permissionResult,o[114]=n):n=o[114],n}return null}function _temp6(e){return"image"===e.type}function _temp5(e){return"image"===e.type}function _temp4(e){return e.toolPermissionContext.mode}function _temp3(e){return"image"===e.type}function _temp2(e){return Object.values(e)}function _temp(e){return e.preview}async function convertImagesToBlocks(e){if(0!==e.length)return Promise.all(e.map(async e=>{const t={type:"image",source:{type:"base64",media_type:e.mediaType||"image/png",data:e.content}};return(await f(t)).block}))}
1
+ import{jsx as e,Fragment as t}from"react/jsx-runtime";import{c as n}from"react/compiler-runtime";import{Suspense as s,use as o,useRef as i,useState as a}from"react";import{useSettings as r}from"../../../hooks/useSettings.js";import{useTerminalSize as u}from"../../../hooks/useTerminalSize.js";import{stringWidth as l}from"../../../ink/stringWidth.js";import{useTheme as c}from"../../../ink.js";import{useKeybindings as m}from"../../../keybindings/useKeybinding.js";import{logEvent as p}from"../../../services/analytics/index.js";import{useAppState as h}from"../../../state/AppState.js";import{AskUserQuestionTool as g}from"../../../tools/AskUserQuestionTool/AskUserQuestionTool.js";import{getCliHighlightPromise as d}from"../../../utils/cliHighlight.js";import{maybeResizeAndDownsampleImageBlock as f}from"../../../utils/imageResizer.js";import{cacheImagePath as _,storeImage as q}from"../../../utils/imageStore.js";import{logError as j}from"../../../utils/log.js";import{applyMarkdown as v}from"../../../utils/markdown.js";import{isPlanModeInterviewPhaseEnabled as b}from"../../../utils/planModeV2.js";import{getPlanFilePath as y}from"../../../utils/plans.js";import{QuestionView as w}from"./QuestionView.js";import{SubmitQuestionsView as x}from"./SubmitQuestionsView.js";import{useMultipleChoiceState as k}from"./use-multiple-choice-state.js";export function AskUserQuestionPermissionRequest(t){const o=n(4);if(r().syntaxHighlightingDisabled){let n;return o[0]!==t?(n=e(AskUserQuestionPermissionRequestBody,{...t,highlight:null}),o[0]=t,o[1]=n):n=o[1],n}let i;return o[2]!==t?(i=e(s,{fallback:e(AskUserQuestionPermissionRequestBody,{...t,highlight:null}),children:e(AskUserQuestionWithHighlight,{...t})}),o[2]=t,o[3]=i):i=o[3],i}function AskUserQuestionWithHighlight(t){const s=n(4);let i;s[0]===Symbol.for("react.memo_cache_sentinel")?(i=d(),s[0]=i):i=s[0];const a=o(i);let r;return s[1]!==a||s[2]!==t?(r=e(AskUserQuestionPermissionRequestBody,{...t,highlight:a}),s[1]=a,s[2]=t,s[3]=r):r=s[3],r}function AskUserQuestionPermissionRequestBody(s){const o=n(115),{toolUseConfirm:r,onDone:d,onReject:f,highlight:I}=s;let P;o[0]!==r.input?(P=g.inputSchema.safeParse(r.input),o[0]=r.input,o[1]=P):P=o[1];const Q=P;let R;o[2]!==Q.data||o[3]!==Q.success?(R=Q.success&&Q.data.questions||[],o[2]=Q.data,o[3]=Q.success,o[4]=R):R=o[4];const C=R,{rows:T}=u(),[A]=c();let M=0,S=0;const U=Math.max(12,T-15);if(o[5]!==I||o[6]!==U||o[7]!==M||o[8]!==S||o[9]!==C||o[10]!==A){for(const e of C){if(e.options.some(_temp)){const t=Math.max(1,U-11);let n=0;for(const s of e.options)if(s.preview){const e=v(s.preview,A,I).split("\n"),o=e.length>t,i=o?t:e.length;n=Math.max(n,i+(o?1:0)+2);for(const t of e)S=Math.max(S,l(t))}const s=n+2,o=e.options.length+2,i=Math.max(o,s);M=Math.max(M,i+7)}else M=Math.max(M,e.options.length+3+7)}o[5]=I,o[6]=U,o[7]=M,o[8]=S,o[9]=C,o[10]=A,o[11]=M}else M=o[11];const $=Math.min(Math.max(M,12),U),B=Math.max(S,40);let H;o[12]!==$||o[13]!==B?(H={globalContentHeight:$,globalContentWidth:B},o[12]=$,o[13]=B,o[14]=H):H=o[14];const{globalContentHeight:E,globalContentWidth:z}=H,O=Q.success?Q.data.metadata?.source:void 0;let W;o[15]===Symbol.for("react.memo_cache_sentinel")?(W={},o[15]=W):W=o[15];const[F,V]=a(W),D=i(0);let N;o[16]===Symbol.for("react.memo_cache_sentinel")?(N=function(e,t,n,s,o,i){D.current=D.current+1;const a=D.current,r={id:a,type:"image",content:t,mediaType:n||"image/png",filename:s||"Imagen pegada",dimensions:o};_(r),q(r),V(t=>({...t,[e]:{...t[e]??{},[a]:r}}))},o[16]=N):N=o[16];const K=N;let G;o[17]===Symbol.for("react.memo_cache_sentinel")?(G=(e,t)=>{V(n=>{const s={...n[e]??{}};return delete s[t],{...n,[e]:s}})},o[17]=G):G=o[17];const J=G;let L;o[18]!==F?(L=Object.values(F).flatMap(_temp2).filter(_temp3),o[18]=F,o[19]=L):L=o[19];const X=L,Y="plan"===h(_temp4);let Z;o[20]!==Y?(Z=Y?y():void 0,o[20]=Y,o[21]=Z):Z=o[21];const ee=Z,te=k(),{currentQuestionIndex:ne,answers:se,questionStates:oe,isInTextInput:ie,nextQuestion:ae,prevQuestion:re,updateQuestionState:ue,setAnswer:le,setTextInputMode:ce}=te,me=ne<(C?.length||0)?C?.[ne]:null,pe=ne===(C?.length||0);let he;o[22]!==se||o[23]!==C?(he=C?.every(e=>e?.question&&!!se[e.question])??!1,o[22]=se,o[23]=C,o[24]=he):he=o[24];const ge=he,de=1===C.length&&!C[0]?.multiSelect;let fe;o[25]!==Y||o[26]!==O||o[27]!==d||o[28]!==f||o[29]!==C.length||o[30]!==r?(fe=()=>{O&&p("tengu_ask_user_question_rejected",{source:O,questionCount:C.length,isInPlanMode:Y,interviewPhaseEnabled:Y&&b()}),d(),f(),r.onReject()},o[25]=Y,o[26]=O,o[27]=d,o[28]=f,o[29]=C.length,o[30]=r,o[31]=fe):fe=o[31];const _e=fe;let qe;o[32]!==X||o[33]!==se||o[34]!==Y||o[35]!==O||o[36]!==d||o[37]!==C||o[38]!==r?(qe=async()=>{const e=`El usuario desea aclarar estas preguntas.\n Esto significa que pueden tener información adicional, contexto o preguntas para ti.\n Ten en cuenta su respuesta y reformula las preguntas si es apropiado.\n Comienza preguntándoles qué desearían aclarar.\n\n Preguntas realizadas:\n${C.map(e=>{const t=se[e.question];return t?`- "${e.question}"\n Respuesta: ${t}`:`- "${e.question}"\n (No se proporcionó respuesta)`}).join("\n")}`;O&&p("tengu_ask_user_question_respond_to_claude",{source:O,questionCount:C.length,isInPlanMode:Y,interviewPhaseEnabled:Y&&b()});const t=await convertImagesToBlocks(X);d(),r.onReject(e,t&&t.length>0?t:void 0)},o[32]=X,o[33]=se,o[34]=Y,o[35]=O,o[36]=d,o[37]=C,o[38]=r,o[39]=qe):qe=o[39];const je=qe;let ve;o[40]!==X||o[41]!==se||o[42]!==Y||o[43]!==O||o[44]!==d||o[45]!==C||o[46]!==r?(ve=async()=>{const e=`El usuario ha indicado que ha proporcionado suficientes respuestas para la entrevista del plan.\nDeja de hacer preguntas aclaratorias y procede a finalizar el plan con la información que tienes.\n\nPreguntas realizadas y respuestas proporcionadas:\n${C.map(e=>{const t=se[e.question];return t?`- "${e.question}"\n Respuesta: ${t}`:`- "${e.question}"\n (No se proporcionó respuesta)`}).join("\n")}`;O&&p("tengu_ask_user_question_finish_plan_interview",{source:O,questionCount:C.length,isInPlanMode:Y,interviewPhaseEnabled:Y&&b()});const t=await convertImagesToBlocks(X);d(),r.onReject(e,t&&t.length>0?t:void 0)},o[40]=X,o[41]=se,o[42]=Y,o[43]=O,o[44]=d,o[45]=C,o[46]=r,o[47]=ve):ve=o[47];const be=ve;let ye;o[48]!==X||o[49]!==Y||o[50]!==O||o[51]!==d||o[52]!==oe||o[53]!==C||o[54]!==r?(ye=async e=>{O&&p("tengu_ask_user_question_accepted",{source:O,questionCount:C.length,answerCount:Object.keys(e).length,isInPlanMode:Y,interviewPhaseEnabled:Y&&b()});const t={};for(const n of C){const s=e[n.question],o=oe[n.question]?.textInputValue,i=s?n.options.find(e=>e.label===s):void 0,a=i?.preview;(a||o?.trim())&&(t[n.question]={...a&&{preview:a},...o?.trim()&&{notes:o.trim()}})}const n={...r.input,answers:e,...Object.keys(t).length>0&&{annotations:t}},s=await convertImagesToBlocks(X);d(),r.onAllow(n,[],void 0,s&&s.length>0?s:void 0)},o[48]=X,o[49]=Y,o[50]=O,o[51]=d,o[52]=oe,o[53]=C,o[54]=r,o[55]=ye):ye=o[55];const we=ye;let xe;o[56]!==se||o[57]!==F||o[58]!==C.length||o[59]!==le||o[60]!==we?(xe=(e,t,n,s)=>{const o=void 0===s||s;let i;const a=Array.isArray(t);if(a)i=t.join(", ");else if(n){i=Object.values(F[e]??{}).filter(_temp5).length>0?`${n} (Imagen adjunta)`:n}else if("__other__"===t){i=Object.values(F[e]??{}).filter(_temp6).length>0?"(Imagen adjunta)":t}else i=t;const r=1===C.length;if(!a&&r&&o){const t={...se,[e]:i};return void we(t).catch(j)}le(e,i,o)},o[56]=se,o[57]=F,o[58]=C.length,o[59]=le,o[60]=we,o[61]=xe):xe=o[61];const ke=xe;let Ie;o[62]!==se||o[63]!==_e||o[64]!==we?(Ie=function(e){"cancel"!==e?"submit"===e&&we(se).catch(j):_e()},o[62]=se,o[63]=_e,o[64]=we,o[65]=Ie):Ie=o[65];const Pe=Ie,Qe=de?(C?.length||1)-1:C?.length||0;let Re;o[66]!==ne||o[67]!==re?(Re=()=>{ne>0&&re()},o[66]=ne,o[67]=re,o[68]=Re):Re=o[68];const Ce=Re;let Te;o[69]!==ne||o[70]!==Qe||o[71]!==ae?(Te=()=>{ne<Qe&&ae()},o[69]=ne,o[70]=Qe,o[71]=ae,o[72]=Te):Te=o[72];const Ae=Te;let Me;o[73]!==Ae||o[74]!==Ce?(Me={"tabs:previous":Ce,"tabs:next":Ae},o[73]=Ae,o[74]=Ce,o[75]=Me):Me=o[75];const Se=!(ie&&!pe);let Ue;if(o[76]!==Se?(Ue={context:"Tabs",isActive:Se},o[76]=Se,o[77]=Ue):Ue=o[77],m(Me,Ue),me){let n,s,i,a;return o[78]!==me.question?(n=(e,t,n,s,o)=>K(me.question,e,t,n,s,o),o[78]=me.question,o[79]=n):n=o[79],o[80]!==me.question||o[81]!==F?(s=F[me.question]??{},o[80]=me.question,o[81]=F,o[82]=s):s=o[82],o[83]!==me.question?(i=e=>J(me.question,e),o[83]=me.question,o[84]=i):i=o[84],o[85]!==se||o[86]!==me||o[87]!==ne||o[88]!==E||o[89]!==z||o[90]!==_e||o[91]!==be||o[92]!==ke||o[93]!==je||o[94]!==Ae||o[95]!==Ce||o[96]!==de||o[97]!==ae||o[98]!==ee||o[99]!==oe||o[100]!==C||o[101]!==ce||o[102]!==n||o[103]!==s||o[104]!==i||o[105]!==ue?(a=e(t,{children:e(w,{question:me,questions:C,currentQuestionIndex:ne,answers:se,questionStates:oe,hideSubmitTab:de,minContentHeight:E,minContentWidth:z,planFilePath:ee,onUpdateQuestionState:ue,onAnswer:ke,onTextInputFocus:ce,onCancel:_e,onSubmit:ae,onTabPrev:Ce,onTabNext:Ae,onRespondToContext:je,onFinishPlanInterview:be,onImagePaste:n,pastedContents:s,onRemoveImage:i})}),o[85]=se,o[86]=me,o[87]=ne,o[88]=E,o[89]=z,o[90]=_e,o[91]=be,o[92]=ke,o[93]=je,o[94]=Ae,o[95]=Ce,o[96]=de,o[97]=ae,o[98]=ee,o[99]=oe,o[100]=C,o[101]=ce,o[102]=n,o[103]=s,o[104]=i,o[105]=ue,o[106]=a):a=o[106],a}if(pe){let n;return o[107]!==ge||o[108]!==se||o[109]!==ne||o[110]!==E||o[111]!==Pe||o[112]!==C||o[113]!==r.permissionResult?(n=e(t,{children:e(x,{questions:C,currentQuestionIndex:ne,answers:se,allQuestionsAnswered:ge,permissionResult:r.permissionResult,minContentHeight:E,onFinalResponse:Pe})}),o[107]=ge,o[108]=se,o[109]=ne,o[110]=E,o[111]=Pe,o[112]=C,o[113]=r.permissionResult,o[114]=n):n=o[114],n}return null}function _temp6(e){return"image"===e.type}function _temp5(e){return"image"===e.type}function _temp4(e){return e.toolPermissionContext.mode}function _temp3(e){return"image"===e.type}function _temp2(e){return Object.values(e)}function _temp(e){return e.preview}async function convertImagesToBlocks(e){if(0!==e.length)return Promise.all(e.map(async e=>{const t={type:"image",source:{type:"base64",media_type:e.mediaType||"image/png",data:e.content}};return(await f(t)).block}))}