cli-jaw 2.17.75 → 2.17.76
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.
- package/dist/src/code-mode/manager.js +51 -7
- package/dist/src/code-mode/manager.js.map +1 -1
- package/dist/src/code-mode/normalize.js +3 -2
- package/dist/src/code-mode/normalize.js.map +1 -1
- package/dist/src/code-mode/session.js +10 -2
- package/dist/src/code-mode/session.js.map +1 -1
- package/dist/src/code-mode/store.js +265 -27
- package/dist/src/code-mode/store.js.map +1 -1
- package/dist/src/code-mode/wire.js +4 -1
- package/dist/src/code-mode/wire.js.map +1 -1
- package/dist/src/routes/code-native.js +56 -5
- package/dist/src/routes/code-native.js.map +1 -1
- package/dist/src/slack/blocks.js +22 -3
- package/dist/src/slack/blocks.js.map +1 -1
- package/dist/src/slack/bot.js +239 -26
- package/dist/src/slack/bot.js.map +1 -1
- package/dist/src/slack/events.js +99 -2
- package/dist/src/slack/events.js.map +1 -1
- package/dist/src/slack/identity.js +30 -0
- package/dist/src/slack/identity.js.map +1 -1
- package/dist/src/slack/ingress.js +5 -4
- package/dist/src/slack/ingress.js.map +1 -1
- package/package.json +1 -1
- package/public/dist/.vite/manifest.json +3 -3
- package/public/dist/assets/CodeCanvas-DLXPccm9.js +3 -0
- package/public/dist/assets/manager-CZcR8tfs.css +1 -0
- package/public/dist/assets/{manager-DIaOU2Vf.js → manager-HCkO4cai.js} +1 -1
- package/public/dist/manager/index.html +2 -2
- package/public/manager/src/code/CodeWorkbench.tsx +48 -4
- package/public/manager/src/code/ComposerFooter.tsx +21 -7
- package/public/manager/src/code/code-composer.css +1 -0
- package/public/manager/src/code/code-controller-draft-storage.ts +45 -6
- package/public/manager/src/code/code-controller-drafts.ts +14 -2
- package/public/manager/src/code/code-controller-runtime.ts +312 -17
- package/public/manager/src/code/code-controller-types.ts +43 -0
- package/public/manager/src/code/code-session-client.ts +22 -3
- package/public/manager/src/code/code-session-state.ts +1 -0
- package/public/manager/src/code/code-ulid.ts +19 -0
- package/public/manager/src/code/code-workbench.css +3 -0
- package/public/dist/assets/CodeCanvas-Ba7ROkA8.js +0 -3
- package/public/dist/assets/manager-DQjyj2aO.css +0 -1
|
@@ -14,6 +14,36 @@ import { slackApi, describeSlackError, neededScopeFrom } from './api.js';
|
|
|
14
14
|
import { getSlackScopeStatus } from './scope-status.js';
|
|
15
15
|
import { getSlackSendClient } from './send-only-client.js';
|
|
16
16
|
import { EnrichmentCache } from './enrichment-cache.js';
|
|
17
|
+
/** Verify the app id against the authenticated bot, independently of the click. */
|
|
18
|
+
export async function lookupSlackBotApp(token, botId, userId, opts = {}) {
|
|
19
|
+
try {
|
|
20
|
+
const result = await slackApi(token, 'bots.info', { bot: botId }, { form: true, timeoutMs: 5000, ...opts });
|
|
21
|
+
const bot = result.ok ? result.data?.bot : undefined;
|
|
22
|
+
if (!bot || (bot.id !== undefined && bot.id !== botId) || bot.user_id !== userId || bot.deleted === true
|
|
23
|
+
|| typeof bot.app_id !== 'string' || !/^A[A-Z0-9]+$/.test(bot.app_id))
|
|
24
|
+
return null;
|
|
25
|
+
return bot.app_id;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Verify a clicker's bot status before durable admission. */
|
|
32
|
+
export async function lookupSlackClicker(token, userId, opts = {}) {
|
|
33
|
+
try {
|
|
34
|
+
const result = await slackApi(token, 'users.info', { user: userId }, { form: true, timeoutMs: 5000, ...opts });
|
|
35
|
+
const user = result.ok ? result.data?.user : undefined;
|
|
36
|
+
if (!user || user.id !== userId || user.deleted === true || typeof user.is_bot !== 'boolean')
|
|
37
|
+
return { ok: false };
|
|
38
|
+
const botId = user.profile?.bot_id;
|
|
39
|
+
const isBot = user.is_bot || user.is_workflow_bot === true || user.is_agentforce_bot === true
|
|
40
|
+
|| user.profile?.is_sidekick_bot === true || (typeof botId === 'string' && botId.length > 0) || user.id === 'USLACKBOT';
|
|
41
|
+
return { ok: true, isBot, ...(isBot && typeof botId === 'string' && /^B[A-Z0-9]+$/.test(botId) ? { botId } : {}) };
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return { ok: false };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
17
47
|
const DEFAULT_TTL_MS = 6 * 60 * 60 * 1000;
|
|
18
48
|
const MIN_TTL_MS = 60 * 1000;
|
|
19
49
|
const MAX_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../src/slack/identity.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAChF,8BAA8B;AAE9B,+CAA+C;AAC/C,8EAA8E;AAC9E,2EAA2E;AAC3E,8EAA8E;AAC9E,sDAAsD;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,eAAe,EAAmB,MAAM,UAAU,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAoB,MAAM,uBAAuB,CAAC;AAoD1E,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC1C,MAAM,UAAU,GAAG,EAAE,GAAG,IAAI,CAAC;AAC7B,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC3C,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAC/B;;;;;GAKG;A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AAI,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB;IACrC,OAAO,kBAAkB,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB;IACnC,4EAA4E;IAC5E,sBAAsB;IACtB,aAAa,CAAC,KAAK,EAAE,CAAC;IACtB,kBAAkB,GAAG,KAAK,CAAC;AAC/B,CAAC"}
|
|
@@ -260,12 +260,13 @@ export function admitSlackRun(params) {
|
|
|
260
260
|
} } : {}),
|
|
261
261
|
target: params.target, chatId: params.chatId,
|
|
262
262
|
...(params.preSendContext ? { preSendContext: params.preSendContext } : {}),
|
|
263
|
-
//
|
|
263
|
+
// An ordinary tool turn keeps the default steer policy: its grant is reserved at
|
|
264
264
|
// admission (gateway onAdmitted) under the same requestId the kill-steer
|
|
265
265
|
// follow-up continues with, so the follow-up spawn re-activates it.
|
|
266
|
-
//
|
|
267
|
-
//
|
|
268
|
-
...(params.workflow || params.target.threadIsSynthetic === true
|
|
266
|
+
// Synthetic thread addresses, configured automations and block-action
|
|
267
|
+
// clicks are their own tasks and never steer into someone else's run.
|
|
268
|
+
...(params.workflow || params.target.threadIsSynthetic === true || params.preSendContext?.jobKind === 'slack_block_action'
|
|
269
|
+
? { midRunPolicy: 'followup' } : {}),
|
|
269
270
|
...(remoteKey ? { remoteKey } : {}), chatSessionId, scope,
|
|
270
271
|
});
|
|
271
272
|
const session = result.sessionContext || { scope, chatSessionId, ...(remoteKey ? { remoteKey } : {}) };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingress.js","sourceRoot":"","sources":["../../../src/slack/ingress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAwB,MAAM,mBAAmB,CAAC;AACtG,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC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YAAE,YAAY,CAAC,UAAU,CAAC,CAAC;QACzC,KAAK,MAAM,OAAO,IAAI,OAAO;YAAE,KAAK,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACvE,CAAC;IACD,yEAAyE;IACzE,2EAA2E;IAC3E,yEAAyE;IACzE,oCAAoC;IACpC,WAAW,CAAC,KAAK,EAAE,CAAC;IACpB,OAAO,CAAC,KAAK,EAAE,CAAC;IAChB,YAAY,CAAC,KAAK,EAAE,CAAC;IACrB,4EAA4E;IAC5E,oBAAoB,EAAE,CAAC;IACvB,SAAS,GAAG,KAAK,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC7B,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC;AACzD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cli-jaw",
|
|
3
|
-
"version": "2.17.
|
|
3
|
+
"version": "2.17.76",
|
|
4
4
|
"description": "Personal AI assistant powered by Pi, Antigravity, Claude, Codex, Codex App, Cursor, Grok, Kiro, OpenCode, and Copilot — Web, Terminal, Slack, Telegram, and Discord interfaces with 33 skills active by default from a 230-skill reference library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -3351,7 +3351,7 @@
|
|
|
3351
3351
|
]
|
|
3352
3352
|
},
|
|
3353
3353
|
"manager/index.html": {
|
|
3354
|
-
"file": "assets/manager-
|
|
3354
|
+
"file": "assets/manager-HCkO4cai.js",
|
|
3355
3355
|
"name": "manager",
|
|
3356
3356
|
"src": "manager/index.html",
|
|
3357
3357
|
"isEntry": true,
|
|
@@ -3509,7 +3509,7 @@
|
|
|
3509
3509
|
"manager/src/code/CodeCanvas.tsx"
|
|
3510
3510
|
],
|
|
3511
3511
|
"css": [
|
|
3512
|
-
"assets/manager-
|
|
3512
|
+
"assets/manager-CZcR8tfs.css"
|
|
3513
3513
|
],
|
|
3514
3514
|
"assets": [
|
|
3515
3515
|
"assets/icon-192-CADbZUeU.png"
|
|
@@ -3530,7 +3530,7 @@
|
|
|
3530
3530
|
]
|
|
3531
3531
|
},
|
|
3532
3532
|
"manager/src/code/CodeCanvas.tsx": {
|
|
3533
|
-
"file": "assets/CodeCanvas-
|
|
3533
|
+
"file": "assets/CodeCanvas-DLXPccm9.js",
|
|
3534
3534
|
"name": "CodeCanvas",
|
|
3535
3535
|
"src": "manager/src/code/CodeCanvas.tsx",
|
|
3536
3536
|
"isDynamicEntry": true,
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-render-DSSkXCir.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./jsx-runtime-DZDtxMw1.js";import{t as r}from"./react-dom-W24aPQgI.js";import{i,t as a}from"./manager-shortcuts-Cqmr0mEq.js";import{c as o,h as s,l as c,m as l,o as u,r as d,t as f,u as p}from"./icons-ChnWzzCc.js";import{t as m}from"./copy-text-WsUHYigB.js";import{a as h,i as g,n as _,r as v,t as y}from"./esm-DiXGSyHP.js";import{a as b,c as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./tool-input-C7u0AQMw.js";import{t as O}from"./preload-helper-BZ2o5wmf.js";var k=e(t(),1),A=r();function j(e){return{mutation:e.mutation,watermark:typeof e.watermark==`string`?e.watermark:null}}var M={creation_key_conflict:`This creation key belongs to different settings. Start another session to continue.`,creation_not_found:`The original session was not found yet. Refresh to check again or start another session.`,unknown_field:`This instance runs an older Code server that cannot recover a lost create. Restart that instance to update it, then send again.`,session_busy:`This session is busy. Wait for it to finish or stop the current turn.`,request_not_current:`This approval is no longer current. Refreshing its status.`,invalid_option:`This approval option is no longer available. Refreshing its status.`,revision_conflict:`Session settings changed elsewhere. Review the updated values and try again.`,mutation_fenced:`This settings change was fenced before it applied.`,mutation_outcome_expired:`The settings outcome has expired. Choose Re-apply or Discard.`,mutation_not_found:`The settings outcome is not recorded yet.`,mutation_id_conflict:`This settings mutation identity belongs to another request.`,invalid_mutation_id:`The settings mutation identity is invalid.`,invalid_sequence:`Conversation history needs to be refreshed.`,snapshot_limit:`This conversation exceeds the snapshot limit. Stop and recovery controls remain available.`,transcript_limit:`The conversation has reached its storage limit.`,event_too_large:`A conversation update exceeds the supported size.`,provider_unavailable:`This runtime is unavailable. Check its installation and authentication.`,unsupported_model:`This model is not available for the selected runtime.`,unsupported_effort:`This effort is not supported by the selected runtime.`,unsupported_policy:`This permission mode is not supported by the selected runtime.`,unsupported_capability:`This runtime does not support this action.`,session_not_steerable:`This turn cannot take a follow-up right now. Your text is kept.`,steer_queue_full:`This turn already has its follow-up. Send this after the turn finishes.`,steer_in_flight:`This follow-up is still being delivered.`,steer_key_spent:`This follow-up was not delivered. Your text is kept; send it again when ready.`,steer_outcome_unknown:`Follow-up delivery not confirmed. It was not resent.`,steer_command_unsupported:`A slash command cannot be sent as a follow-up. Send it after this turn finishes.`,session_not_found:`This session is no longer available. Its local draft is retained.`,rollback_unavailable:`Rollback is unavailable after this conversation was compacted, or while its history cannot be read.`,rollback_boundary_unavailable:`This turn can't be a rollback point: it or a later turn never reached Claude, or the conversation was compacted.`,rollback_noop:`This is already the latest turn, so there is nothing to roll back.`,rollback_target_not_found:`This message is no longer in the conversation. Refreshing the session.`,cleanup_pending:`The previous runtime is still closing. Try again in a moment.`,unauthorized:`Authentication is required to access this instance.`},N=class extends Error{code;status;session;mutation;watermark;constructor(e,t,n,r,i){super(M[e]??`The request could not be completed. Refresh the session and try again.`),this.code=e,this.status=t,this.session=n,this.mutation=r,this.watermark=i,this.name=`CodeClientError`}};function P(e){return typeof window<`u`&&window.location.port===String(e)?window.location.origin:`http://127.0.0.1:${e}`}function F(e){let t=P(e);async function n(e,n,r,i){let a=await fetch(`${t}/api/code${n}`,{method:e,...i===void 0?{}:{signal:i},...r===void 0?{}:{headers:{"Content-Type":`application/json`},body:JSON.stringify(r)}}),o=await a.json();if(!a.ok||o.ok!==!0)throw new N(typeof o.error==`string`?o.error:`code_request_failed`,a.status,o.session,o.mutation,o.watermark);return o}let r=e=>`/sessions/${encodeURIComponent(e)}`,i=async(e,t,r)=>(await n(e,t,r)).session;return{listSessions(e={},t){let r=new URLSearchParams;for(let[t,n]of Object.entries(e))n!==void 0&&r.set(t,String(n));return n(`GET`,`/sessions?${r}`,void 0,t)},listModelOptions:e=>n(`GET`,`/models`,void 0,e),snapshot:(e,t)=>n(`GET`,r(e),void 0,t),events:(e,t,i)=>n(`GET`,`${r(e)}/events?afterSequence=${t}&limit=500`,void 0,i),history:(e,t,i)=>n(`GET`,`${r(e)}/items?beforeSequence=${t}&limit=200`,void 0,i),createSession:e=>i(`POST`,`/sessions`,e),patchSession:(e,t)=>i(`PATCH`,r(e),t),patchSettings:(e,t)=>n(`PATCH`,r(e),t),readMutation:async(e,t)=>j(await n(`GET`,`${r(e)}/mutations/${encodeURIComponent(t)}`)),fenceMutation:async(e,t)=>j(await n(`POST`,`${r(e)}/mutations/${encodeURIComponent(t)}/fence`,{})),sendPrompt:(e,t)=>n(`POST`,`${r(e)}/prompt`,t),steerSession:(e,t)=>n(`POST`,`${r(e)}/steer`,t),cancelPrompt:(e,t)=>i(`POST`,`${r(e)}/cancel`,t),findCreation:async(e,t)=>(await n(`GET`,`/creations/${encodeURIComponent(e)}`,void 0,t)).session,attachSession:async(e,t,i)=>{let a=!t,o;try{o=await n(`POST`,`${r(e)}/attach`,t?{operationId:t}:{})}catch(s){if(!t||!(s instanceof N)||s.status!==400||s.code!==`unknown_field`)throw s;a=!0,i?.(),o=await n(`POST`,`${r(e)}/attach`,{})}return{session:o.session,attach:o.attach??null,identityUnknown:a}},rollbackSession:(e,t)=>i(`POST`,`${r(e)}/rollback`,t),visitSession:e=>i(`POST`,`${r(e)}/visit`,{}),async answerPermission(e,t){await n(`POST`,`/permissions/${encodeURIComponent(e)}`,t)},getGitInfo:(e,t)=>n(`GET`,`/git-info?cwd=${encodeURIComponent(e)}`,void 0,t),pickWorkspace:()=>n(`POST`,`/workspace/pick`)}}var I=512,L=2097152,ee=2e3,te=16777216;function ne(e){return{sessionId:e,session:null,items:[],permissions:[],cursor:0,hydrated:!1,hydrating:!1,synced:!1,needsSnapshot:!1,buffered:[],hasOlder:!1,beforeSequence:null,error:null}}function R(e){return!!e&&[`starting`,`streaming`,`stopping`].includes(e.status)}var re=e=>e.sort((e,t)=>(e.firstSequence??0)-(t.firstSequence??0)),ie=e=>e.reduce((e,t)=>e+JSON.stringify(t).length,0);function ae(e){let t=e.items,n=ie(t);if(t.length<=ee&&n<=te)return e;for(t=[...t];t.length>ee||n>te;){let r=t.findIndex(t=>!e.session?.turnId||t.turnId!==e.session.turnId);if(r<0)return{...e,items:[],synced:!1,needsSnapshot:!0,error:`Conversation exceeds the display capacity.`};n-=JSON.stringify(t[r]).length,t.splice(r,1)}return{...e,items:t,hasOlder:!0,beforeSequence:t[0]?.firstSequence??null}}function oe(e,t){let{items:n,session:r,permissions:i}=e;if(t.event===`code_session`){if(!t.session||t.session.sessionId!==e.sessionId||(t.session.historyGeneration??0)>(e.session?.historyGeneration??0))return{...e,needsSnapshot:!0,synced:!1};r=t.session.contextUsage===void 0&&r?.contextUsage!==void 0?{...t.session,contextUsage:r.contextUsage}:t.session,i=i.filter(e=>e.epoch===r.epoch&&e.turnId===r.turnId)}else{let a=t.item?.itemId??t.update?.itemId,o=n.find(e=>e.itemId===a),s;if(t.event===`code_item`&&t.item)s={...t.item,firstSequence:o?.firstSequence??t.item.firstSequence??t.sequence};else if(t.event===`code_item_update`&&t.update&&o&&o.turnId===t.update.turnId){let n=t.update;if(n.appendToolOutput!==void 0&&!o.tool)return{...e,needsSnapshot:!0,synced:!1};s={...o,updatedAt:n.updatedAt,...n.appendText===void 0?{}:{text:(o.text??``)+n.appendText},...n.appendToolOutput===void 0?{}:{tool:{...o.tool,output:(o.tool.output??``)+n.appendToolOutput}},...n.status===void 0?{}:{status:n.status},...n.phase===void 0?{}:{phase:n.phase},...n.truncation===void 0?{}:{truncation:n.truncation}}}else return{...e,needsSnapshot:!0,synced:!1};n=re([...n.filter(e=>e.itemId!==s.itemId),s]),s.permission&&(i=i.filter(e=>e.permissionId!==s.permission.permissionId),s.status===`pending`&&s.permission.epoch===r?.epoch&&s.permission.turnId===r?.turnId&&(i=[...i,s.permission]))}return ae({...e,items:n,session:r,permissions:i,cursor:t.sequence})}function se(e){let t=e;if(!t.hydrated||t.hydrating||t.needsSnapshot)return t;let n=t.buffered.filter(e=>e.sequence>t.cursor);for(;n[0]?.sequence===t.cursor+1;){let e=n[0];if(t=oe(t,e),t.needsSnapshot)break;n.shift()}return{...t,buffered:n,synced:t.synced&&!n.length&&!t.needsSnapshot}}function ce(e,t){if(t.sessionId!==e.sessionId||t.sequence<=e.cursor||e.buffered.some(e=>e.sequence===t.sequence))return e;let n=[...e.buffered,t].sort((e,t)=>e.sequence-t.sequence);return n.length>I||JSON.stringify(n).length>L?{...e,buffered:[],synced:!1,needsSnapshot:!0,error:`Live updates exceeded the buffer. Refreshing history.`}:se({...e,buffered:n})}function z(e,t){switch(t.type){case`stale`:return{...e,synced:!1};case`error`:return{...e,hydrating:!1,synced:!1,error:t.error};case`snapshot-start`:return{...e,hydrating:!0,synced:!1,error:null};case`event`:return ce(e,t.event);case`snapshot`:{let n=t.snapshot;if(n.session.sessionId!==e.sessionId||n.sequence<e.cursor)return{...e,hydrating:!1,synced:!1,needsSnapshot:!0};let r=re([...n.items]);return se(ae({...e,session:n.session,items:r,permissions:n.pendingPermissions,cursor:n.sequence,hydrated:!0,hydrating:!1,synced:!0,needsSnapshot:!1,hasOlder:n.truncated,beforeSequence:r[0]?.firstSequence??null,error:null}))}case`page`:{let n=e;for(let e of t.page.events)n=ce(n,e);let r=n.cursor>=t.page.throughSequence&&!n.buffered.length&&!n.needsSnapshot;return{...n,synced:r,error:r?null:n.error}}case`history`:{let n=new Set(e.items.map(e=>e.itemId)),r=re([...e.items,...t.page.items.filter(e=>!n.has(e.itemId))]);return r.length>ee||ie(r)>te?{...e,error:`Older history exceeds the display capacity. Reload to return to recent items.`}:{...e,items:r,hasOlder:t.page.hasMore,beforeSequence:t.page.beforeSequence}}}}var le=`cli-jaw:code-drafts:v1`,ue=`cli-jaw:code-draft-warnings:v1`,B=1,de=4,fe=32,pe=262144,me=1048576,he=2097152,ge=`Draft recovery is unavailable in this tab. Your current text remains in memory.`,_e=`Draft recovery is incomplete: some recent text or request state was not saved for reload. Check your draft before sending.`,V=`Draft recovery is incomplete: some text was not saved for reload because this tab reached its recovery limit.`,H=e=>!!e&&typeof e==`object`&&!Array.isArray(e),U=(e,t)=>typeof e==`string`&&e.length<=t,ve=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0,ye=e=>e===null||typeof e==`string`&&/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/.test(e);function be(e){if(e==null)return null;if(!H(e)||!Array.isArray(e.fields)||!e.fields.length||e.fields.length>4||![`pending`,`sent`,`unknown`,`conflict`,`rejected`].includes(String(e.state))||!ye(e.mutationId)||!ye(e.watermark)||!(e.expectedRevision===null||ve(e.expectedRevision))||typeof e.expired!=`boolean`||typeof e.autoRetried!=`boolean`||e.retryReady!==void 0&&typeof e.retryReady!=`boolean`||!(e.error===null||U(e.error,4096)))return;let t=[];for(let n of e.fields){if(!H(n)||![`model`,`effort`,`permissionMode`,`thinking`].includes(String(n.field))||t.some(e=>e.field===n.field))return;let e=e=>n.field===`thinking`?e===null||typeof e==`boolean`:e===null||U(e,n.field===`model`?1024:80);if(!e(n.baseline)||!e(n.value))return;let r=n.conflict;if(r!==void 0&&(!H(r)||!e(r.theirs)||r.resolution!==void 0&&r.resolution!==`mine`&&r.resolution!==`theirs`))return;t.push({field:n.field,baseline:n.baseline,value:n.value,...r===void 0?{}:{conflict:{theirs:r.theirs,...r.resolution?{resolution:r.resolution}:{}}}})}if(e.state===`pending`||e.mutationId!==null||e.state===`conflict`)return{fields:t,state:e.state,mutationId:e.mutationId,expectedRevision:e.expectedRevision,watermark:e.watermark,expired:e.expired,autoRetried:e.autoRetried,retryReady:e.retryReady===!0,error:e.error}}function xe(e){if(!H(e)||!U(e.input,pe)||!ve(e.edit)||!ve(e.selectionEdit)||typeof e.creating!=`boolean`)return null;let t=be(e.settings);if(t===void 0)return null;let n=e.selection;if(!H(n)||![`codex-app`,`claude`,`cursor`,`grok`].includes(String(n.provider))||!U(n.cwd,4096)||!U(n.model,1024)||!(n.effort===null||U(n.effort,80))||![`ask`,`auto`,`read-only`,`plan`,`accept-edits`,`dont-ask`,`auto-review`].includes(String(n.permissionMode))||n.thinking!==void 0&&typeof n.thinking!=`boolean`)return null;let r=e.creationKey;if(r!==void 0&&(typeof r!=`string`||!/^[A-Za-z0-9_-]{1,128}$/.test(r)||!e.creating))return null;let i=e.retry,a=e.stop;return i!==null&&(!H(i)||!U(i.text,pe)||!U(i.key,240)||!i.key||!ve(i.edit)||i.edit>e.edit)||a!==null&&(!H(a)||!ve(a.epoch)||!(U(a.turnId,240)&&a.turnId&&a.operationId===void 0||a.turnId===null&&U(a.operationId,240)&&a.operationId))?null:{settings:t,...typeof r==`string`?{creationKey:r}:{},input:e.input,edit:e.edit,selectionEdit:e.selectionEdit,creating:e.creating,selection:{provider:n.provider,cwd:n.cwd,model:n.model,effort:n.effort,permissionMode:n.permissionMode,...typeof n.thinking==`boolean`?{thinking:n.thinking}:{}},retry:i===null?null:{text:i.text,key:i.key,edit:i.edit,...i.resend===!0?{resend:!0}:{},...i.resend===!0&&i.resendReason===`rolled-back`?{resendReason:`rolled-back`}:{}},stop:a===null?null:{turnId:a.turnId,...typeof a.operationId==`string`?{operationId:a.operationId}:{},epoch:a.epoch}}}function Se(e){if(e===null)return{version:B,endpoints:[]};if(e.length>he)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!H(t)||t.version!==B||!Array.isArray(t.endpoints)||t.endpoints.length>de)return null;let n=[];for(let e of t.endpoints){if(!H(e)||!U(e.endpoint,2048)||!(e.selectedId===null||U(e.selectedId,240))||!Array.isArray(e.sessions)||e.sessions.length>fe)return null;let t=xe(e.fresh);if(!t||t.retry||t.stop)return null;let r=[];for(let t of e.sessions){if(!H(t)||!U(t.id,240)||!t.id)return null;let e=xe(t.draft);if(!e||e.creating||r.some(e=>e.id===t.id))return null;r.push({id:t.id,draft:e})}if(e.selectedId!==null&&!r.some(t=>t.id===e.selectedId)||n.some(t=>t.endpoint===e.endpoint)||JSON.stringify(e).length>me)return null;n.push({endpoint:e.endpoint,selectedId:e.selectedId,fresh:t,sessions:r})}return{version:B,endpoints:n}}function Ce(e){let t=e.getItem(ue);if(!t||t.length>16384)return[];try{let e=JSON.parse(t);return Array.isArray(e)&&e.length<=de&&e.every(e=>U(e,2048))?e:[]}catch{return[]}}function W(e,t,n){try{let r=Ce(e).filter(e=>e!==t);n&&r.push(t),r.length?e.setItem(ue,JSON.stringify(r.slice(-4))):e.removeItem(ue)}catch{}}function we(){if(typeof window>`u`)return{storage:null,warning:null};try{return{storage:window.sessionStorage,warning:null}}catch{return{storage:null,warning:ge}}}function Te(e,t){try{let n=Se(e.getItem(le));if(!n)return{data:null,warning:`Saved Code drafts could not be read. No saved requests were sent.`};let r=n.endpoints.find(e=>e.endpoint===t)??null,i=Ce(e);return{data:r,warning:i.includes(t)||!r&&i.length>0?_e:null}}catch{return{data:null,warning:ge}}}function Ee(e){let{provider:t,cwd:n,model:r,effort:i,permissionMode:a,thinking:o}=e.selection;return xe({input:e.input,edit:e.edit,selection:{provider:t,cwd:n,model:r,effort:i,permissionMode:a,...o===void 0?{}:{thinking:o}},selectionEdit:e.selectionEdit,creating:e.createUnknown||e.operation.kind===`creating`,...e.creationKey?{creationKey:e.creationKey}:{},settings:e.settings?{fields:e.settings.fields,state:e.settings.state,mutationId:e.settings.mutationId,expectedRevision:e.settings.expectedRevision,watermark:e.settings.watermark,expired:e.settings.expired,autoRetried:e.settings.autoRetried,retryReady:e.settings.retryReady,error:e.settings.error}:null,retry:e.retry?{text:e.retry.text,key:e.retry.key,edit:e.retry.edit,...e.retry.resend?{resend:!0}:{},...e.retry.resend&&e.retry.resendReason?{resendReason:e.retry.resendReason}:{}}:null,stop:e.stopTarget?{turnId:e.stopTarget.turnId,...e.stopTarget.operationId?{operationId:e.stopTarget.operationId}:{},epoch:e.stopTarget.epoch}:null})}function De(e,t,n){try{let r=Ee(n.fresh);if(!r)return W(e,t,!0),V;let i={endpoint:t,selectedId:null,fresh:r,sessions:[]},a=!1,o=[...n.sessions].sort(([e,t],[r,i])=>Number(r===n.selectedId)-Number(e===n.selectedId)||Number(!!i.settings)-Number(!!t.settings));for(let[r,s]of o){if(r!==n.selectedId&&!s.input&&!s.retry&&!s.stopTarget&&!s.settings)continue;let o=Ee(s);if(!o)return W(e,t,!0),V;if(i.sessions.length>=fe){if(s.settings)return W(e,t,!0),V;a=!0;continue}let c={...i,selectedId:r===n.selectedId?r:i.selectedId,sessions:[...i.sessions,{id:r,draft:o}]};if(JSON.stringify(c).length>me){if(s.settings)return W(e,t,!0),V;a=!0}else i.sessions=c.sessions,i.selectedId=c.selectedId}if(n.selectedId!==null&&i.selectedId===null||JSON.stringify(i).length>me)return W(e,t,!0),V;let s=e.getItem(le),c=[...(Se(s)??{version:B,endpoints:[]}).endpoints.filter(e=>e.endpoint!==t),i],l=JSON.stringify({version:B,endpoints:c});for(;c.length>de||l.length>he;){let n=c.findIndex(e=>e.endpoint!==t&&!e.fresh.settings&&!e.sessions.some(e=>e.draft.settings));if(n<0)return W(e,t,!0),V;let[r]=c.splice(n,1);r&&W(e,r.endpoint,!0),l=JSON.stringify({version:B,endpoints:c})}return l!==s&&e.setItem(le,l),W(e,t,a||n.recoveryWarning!==null),a?V:null}catch{return W(e,t,!0),ge}}var G={"codex-app":`Codex`,claude:`Claude`,cursor:`Cursor`,grok:`Grok`},Oe={ask:`Ask first`,auto:`Auto (YOLO)`,"read-only":`Read only`,plan:`Plan`,"accept-edits":`Accept edits`,"dont-ask":`Don't ask`,"auto-review":`Auto review`},ke={ask:`Review native permission requests before allowing actions.`,auto:`The native runtime may execute actions without asking for approval.`,"read-only":`The native runtime restricts actions to read-only access.`,plan:`Claude plans without applying edits.`,"accept-edits":`File edits proceed; other actions still ask.`,"dont-ask":`Actions not already allowed for this session are denied without asking.`,"auto-review":`A classifier approves or denies each action; unsure calls still ask.`},Ae={idle:`Ready`,starting:`Starting`,streaming:`Running`,stopping:`Stopping`,suspended:`Suspended`,failed:`Runtime failed`};function je(e){return e.status===`starting`||e.status===`streaming`||e.status===`stopping`}function Me(e){return e===`rolled-back`?{heading:`Turn rolled back`,detail:`This message's turn was removed by a rollback. Files it changed were not reverted. Retry sends it as a new message.`,error:`This message's turn was removed by a rollback. The message was not resent; Retry will submit it as a new message.`}:{heading:`Send did not start`,detail:`The original attempt ended on the server without running. Retry sends this as a new message.`,error:`The original attempt ended on the server without running. The message was not resent; Retry will submit it as a new message.`}}function Ne(e){return e.archivedAt===null&&e.capabilities.resume&&e.resume.available&&(e.status===`suspended`||e.status===`failed`&&e.error?.recoverable===!0)}function Pe(e,t,n){return!!e&&e.rollback?.available===!0&&e.archivedAt===null&&t&&n&&(e.status===`idle`||e.status===`failed`)}function Fe(e,t){let n=new Set;if(t==null)return n;let r=new Set(e.filter(e=>e.kind===`turn_completed`||e.kind===`turn_failed`||e.kind===`turn_cancelled`).map(e=>e.turnId)),i=e.filter(e=>e.kind===`user_message`&&e.turnId!==null&&e.itemId===`${e.turnId}:user`&&e.firstSequence!==void 0),a=Math.max(...i.map(e=>e.firstSequence));for(let e of i)e.firstSequence>=t&&e.firstSequence<a&&r.has(e.turnId)&&n.add(e.itemId);return n}function Ie(e){return e.kind===`turn_cancelled`||e.status===`cancelled`?`Stopped`:e.kind===`turn_failed`||e.status===`error`?`Failed`:e.kind===`turn_completed`?`Completed`:{pending:`Pending`,running:`Running`,done:`Done`,error:`Failed`,cancelled:`Stopped`}[e.status]}function K(e){return e.operationId??null}function Le(e){return!!e&&(e.status===`starting`||e.status===`streaming`)&&(e.turnId?e.capabilities.interrupt:e.status===`starting`&&!!K(e))}var Re=new Map,ze=new WeakMap;function q(e){return{input:``,edit:0,selection:{...e},selectionEdit:0,settings:null,operation:{kind:`idle`,error:null},retry:null,createUnknown:!1,creationKey:null,attachToken:0,requiredSequence:0,restore:null,stopTarget:null,permissionOperations:{},awaitingTurn:null,steer:null}}function Be(e){let t=q(e.selection);return t.input=e.input,t.edit=e.edit,t.selectionEdit=e.selectionEdit,t.createUnknown=e.creating,t.creationKey=e.creationKey??null,t.retry=e.retry,t.settings=e.settings?{...e.settings,state:e.settings.state===`sent`?`unknown`:e.settings.state,op:null}:null,e.creating&&(t.operation={kind:`creating`,error:`Creation was interrupted by reload. The original session may exist; no request has been retried.`}),e.retry&&(t.operation={kind:`unknown-send`,error:e.retry.resend?Me(e.retry.resendReason).error:`The original message has not been reconciled after reload. It will not be sent automatically.`}),e.stop&&(t.stopTarget={...e.stop,outcome:`unknown`},t.operation={kind:`stopping`,error:`Checking the captured Stop after reload. No cancellation has been resent.`}),t}function Ve(e,t){let n=we(),r=n.storage?ze.get(n.storage):Re;r||(r=new Map,ze.set(n.storage,r));let i=r.get(e);if(!i){let a=n.storage?Te(n.storage,e):{data:null,warning:n.warning};i={endpoint:e,storage:n.storage,storageWarning:n.warning,recoveryWarning:a.warning,selectedId:a.data?.selectedId??null,navigation:0,fresh:a.data?Be(a.data.fresh):q({provider:`codex-app`,cwd:t,model:``,effort:null,permissionMode:`ask`}),sessions:new Map(a.data?.sessions.map(e=>[e.id,Be(e.draft)])??[]),listeners:new Set},r.set(e,i)}return i}function He(e){e.storage&&(e.storageWarning=De(e.storage,e.endpoint,e))}function Ue(e){return{provider:e.provider,cwd:e.cwd,model:e.model,effort:e.effort,permissionMode:e.permissionMode,...e.thinking===null?{}:{thinking:e.thinking}}}function We(e,t,n=!1){let r=e.providers.find(e=>e.id===t.provider);if(!r)return t;let i=r.capabilities,{thinking:a,...o}=t;return{...o,...r.id===`claude`&&a!==void 0?{thinking:a}:{},model:!n&&r.models.includes(t.model)?t.model:r.defaultModel,effort:!n&&t.effort!==null&&i.efforts.includes(t.effort)?t.effort:null,permissionMode:i.permissions?!n&&i.permissionModes.includes(t.permissionMode)?t.permissionMode:i.permissions&&i.permissionModes.includes(`ask`)?`ask`:i.permissionModes.includes(`auto`)?`auto`:`read-only`:`auto`}}function Ge(e,t){e.steer?.key===t&&(e.edit===e.steer.edit&&(e.input=``,e.edit++),e.steer=null)}function Ke(e,t){e.retry?.key===t&&(e.edit===e.retry.edit&&(e.input=``,e.edit++),e.retry=null,(e.operation.kind===`sending`||e.operation.kind===`unknown-send`)&&(e.operation={kind:`idle`,error:null}))}var qe=`0123456789ABCDEFGHJKMNPQRSTVWXYZ`,Je=/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/;function Ye(e=Date.now(),t=null){if(!Number.isSafeInteger(e)||e<0||t!==null&&!Je.test(t))throw Error(`Invalid mutation clock or watermark`);let n=e;if(t){let e=0;for(let n of t.slice(0,10))e=e*32+qe.indexOf(n);e>=n&&(n=e+1)}if(n>0xffffffffffff)throw Error(`Mutation clock exhausted`);let r=``;for(let e=0;e<10;e++)r=qe[n%32]+r,n=Math.floor(n/32);let i=crypto.getRandomValues(new Uint8Array(16));return r+Array.from(i,e=>qe[e&31]).join(``)}var Xe=`pending:user`;function Ze(e,t,n=Date.now()){let r=e.retry;if(!r||r.resend||t.some(e=>e.kind===`user_message`&&e.clientTurnKey===r.key))return null;let i=e.operation.kind===`unknown-send`;return{itemId:Xe,turnId:null,kind:`user_message`,status:`pending`,text:r.text,clientTurnKey:r.key,firstSequence:2**53-1,createdAt:n,updatedAt:n,...i?{phase:`unknown`}:{}}}function Qe(e,t,n=Date.now()){let r=Ze(e,t,n);return r?[...t,r]:t}var $e=6,et=1e3,tt=100,nt=32,rt=150,it=1500,at=`Stop requested before the restore reached the server. Your text will not be sent; the restore is cancelled if it starts while this page is connected.`,J=e=>e instanceof N?e.message:`Connection lost. Refresh to check the current state.`,Y=e=>e instanceof N&&e.status>=400&&e.status<500,ot=`Follow-up delivery not confirmed. It was not resent; it appears in the conversation if Claude received it.`,st=`Follow-up delivery not confirmed. Claude may have received it, but it will not appear in the conversation. It was not resent.`,ct=`The conversation changed since you chose this point. Review it and try again.`,lt=`The conversation was rolled back elsewhere; this message was not sent.`,ut=(e,t)=>!t||e.epoch>t.epoch||e.epoch===t.epoch&&(e.sequence>t.sequence||e.sequence===t.sequence&&e.revision>=t.revision),dt=e=>e===`failed`||e===`cancelled`,ft=e=>!!e&&(e.input.length>0||!!e.retry||!!e.stopTarget||!!e.steer||!!e.settings||e.operation.kind!==`idle`),pt=[`model`,`effort`,`permissionMode`,`thinking`],mt=(e,t)=>t===`thinking`&&e.provider===`claude`?e.thinking??!0:e[t]??null;function ht(e,t){let n={...e};for(let e of t?.fields??[])e.field===`thinking`?typeof e.value==`boolean`?n.thinking=e.value:delete n.thinking:e.field===`model`&&typeof e.value==`string`?n.model=e.value:e.field===`effort`&&(typeof e.value==`string`||e.value===null)?n.effort=e.value:e.field===`permissionMode`&&typeof e.value==`string`&&(n.permissionMode=e.value);return n}var gt=(e,t)=>e===null?t:t===null||e>t?e:t;function _t(e,t){let n=e?.items.find(e=>e.kind===`user_message`&&e.clientTurnKey===t);return n?e.items.some(e=>e.turnId===n.turnId&&(e.kind===`turn_failed`||e.kind===`turn_cancelled`)):!1}var vt=class{client;book;details=new Map;summaries=new Map;pinnedOverlay=[];attention=new Map;rows=[];catalog=null;catalogError=null;transport=`disconnected`;filter={scope:`all`,archived:!1};workingDir;gitInfo=null;gitError=null;gitGeneration=0;pickerGeneration=0;workspacePicking=!1;indexGeneration=0;catalogGeneration=0;lifetime=0;active=!1;abort=new AbortController;syncing=new Map;detailReads=new Map;historyLoading=new Set;indexLoading=!1;moreSessions=!1;cursor=null;fetched=0;indexError=null;timer;listeners=new Set;model;draftSyncQueued=!1;settingsToken=0;settingsTimers=new Map;settingsDelays=new Map;constructor(e){this.client=F(e.port),this.workingDir=e.workingDir,this.book=Ve(P(e.port),e.workingDir),this.model=this.makeModel()}getModel=()=>this.model;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));changed=()=>{this.model=this.makeModel();for(let e of this.listeners)e();let e=this.book.selectedId,t=e?this.details.get(e):void 0;this.active&&e&&!t?.error&&(!t||this.draft(e).requiredSequence>t.cursor)&&!this.draftSyncQueued&&(this.draftSyncQueued=!0,queueMicrotask(()=>{this.draftSyncQueued=!1,this.active&&this.book.selectedId===e&&!this.syncing.has(e)&&this.sync(e)}))};notify(){He(this.book),this.changed();for(let e of this.book.listeners)e!==this.changed&&e()}mount=()=>(this.active=!0,this.lifetime++,this.abort=new AbortController,this.book.listeners.add(this.changed),this.refresh(),()=>{this.active=!1,this.lifetime++;for(let e of[this.book.fresh,...this.book.sessions.values()])e.settings?.op&&(e.settings.op=null,e.settings.state===`sent`&&(e.settings.state=`unknown`));for(let e of this.settingsTimers.values())clearTimeout(e);this.settingsTimers.clear(),this.settingsDelays.clear(),He(this.book),this.abort.abort(),this.syncing.clear();for(let e of this.detailReads.values())e.abort();this.detailReads.clear(),this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0,this.book.listeners.delete(this.changed),this.details.clear(),this.summaries.clear(),this.pinnedOverlay=[],this.attention.clear(),this.rows=[],this.cursor=null,this.fetched=0,this.gitGeneration++,this.pickerGeneration++});setWorkingDir(e){if(e===this.workingDir)return;this.workingDir=e;let t=this.book.fresh;t.selectionEdit||t.input||t.operation.kind!==`idle`||t.createUnknown||(t.selection={...t.selection,cwd:e}),this.filter.scope===`cwd`&&this.readIndex(),this.readGit(),this.notify()}draft(e=this.book.selectedId){if(e===null)return this.book.fresh;let t=this.book.sessions.get(e);if(!t){let n=this.info(e);t=q(n?Ue(n):this.book.fresh.selection),this.book.sessions.set(e,t)}return t}info(e){return e?[this.details.get(e)?.session,this.summaries.get(e),this.pinnedOverlay.find(t=>t.sessionId===e)].reduce((e,t)=>t&&ut(t,e)?t:e,null):null}observe(e){let t=this.attention.get(e.sessionId);(!t||ut(e,{...e,epoch:t.epoch,sequence:t.sequence,revision:t.revision}))&&this.attention.set(e.sessionId,{epoch:e.epoch,sequence:e.sequence,revision:e.revision,...e.pendingPermissionCount===void 0?{}:{pendingPermissionCount:e.pendingPermissionCount},...e.contextUsage===void 0?{}:{contextUsage:e.contextUsage}})}resolve(e,t){let n=this.attention.get(e),{contextUsage:r,pendingPermissionCount:i,...a}=t;return{...a,...n?.pendingPermissionCount===void 0?{}:{pendingPermissionCount:n.pendingPermissionCount},...n?.contextUsage===void 0?{}:{contextUsage:n.contextUsage}}}accept(e){if(!this.active)return;let t=this.info(e.sessionId);if(!ut(e,t))return;e.sessionId===this.book.selectedId&&t&&(e.lastTurnCompletedAt??0)>(t.lastTurnCompletedAt??0)&&this.markVisited(e.sessionId);let{contextUsage:n,pendingPermissionCount:r,...i}=e,a=this.pinnedOverlay.findIndex(e=>e.sessionId===i.sessionId);if(a!==-1&&(i.pinnedAt===null||i.archivedAt!==null?this.pinnedOverlay.splice(a,1):this.pinnedOverlay[a]=i),this.summaries.set(i.sessionId,i),this.summaries.size>1006){let e=[...this.summaries.keys()].find(e=>e!==this.book.selectedId&&!this.details.has(e)&&!this.rows.includes(e)&&!this.pinnedOverlay.some(t=>t.sessionId===e));e&&(this.summaries.delete(e),this.attention.delete(e))}let o=this.book.sessions.get(i.sessionId);o?.restore?.stopRequested&&!o.restore.settled&&o.restore.cancel===`none`&&this.cancelRestore(i.sessionId,o,o.restore,i),o?.awaitingTurn&&R(i)&&(o.awaitingTurn=null),o?.stopTarget&&((o.stopTarget.operationId?K(i)!==o.stopTarget.operationId:i.turnId!==o.stopTarget.turnId)||i.epoch!==o.stopTarget.epoch||!R(i))&&(o.stopTarget=null,o.operation.kind===`stopping`&&(o.operation=o.retry?{kind:`unknown-send`,error:`The original message still needs reconciliation.`}:{kind:`idle`,error:null}))}state(e){let t=this.details.get(e);return t||(t=ne(e),this.details.set(e,t),this.trimDetails()),t}trimDetails(){for(let e of this.details.keys()){if(this.details.size<=$e)break;e!==this.book.selectedId&&(this.details.delete(e),this.detailReads.get(e)?.abort(),this.detailReads.delete(e),this.syncing.delete(e))}}update(e,t){let n=this.details.get(e)?.session??this.summaries.get(e);this.details.set(e,t),t.session&&this.accept(t.session);let r=this.book.sessions.get(e);if(r&&t.session&&t.hydrated&&!t.needsSnapshot){let e=t.session.historyGeneration??0;n&&e>(n.historyGeneration??0)&&this.rolledBack(r,t);let i=r.steer;e>0&&i?.state===`unknown`&&!t.items.some(e=>e.turnId===i.turnId)&&(r.steer=null)}if(r?.retry&&t.items.some(e=>e.kind===`user_message`&&e.clientTurnKey===r.retry.key)&&(_t(t,r.retry.key)?this.requireNewKey(r):Ke(r,r.retry.key)),r?.steer&&t.items.some(e=>e.kind===`user_message`&&e.clientTurnKey===r.steer.key)&&Ge(r,r.steer.key),r?.awaitingTurn){let e=t.items.find(e=>e.kind===`user_message`&&e.clientTurnKey===r.awaitingTurn)?.turnId;e&&t.items.some(t=>t.turnId===e&&(t.kind===`turn_completed`||t.kind===`turn_failed`||t.kind===`turn_cancelled`))&&(r.awaitingTurn=null)}if(r&&t.synced){let e=new Set(t.permissions.map(e=>e.permissionId));for(let t of Object.keys(r.permissionOperations))!e.has(t)&&!r.permissionOperations[t].pending&&delete r.permissionOperations[t]}this.notify()}requireNewKey(e,t){if(!e.retry)return;let{resendReason:n,...r}=e.retry;e.retry={...r,key:crypto.randomUUID(),resend:!0,...t?{resendReason:t}:{}},e.operation={kind:`unknown-send`,error:Me(t).error}}rolledBack(e,t){let n=e=>t.items.some(t=>t.kind===`user_message`&&t.clientTurnKey===e);e.awaitingTurn&&!n(e.awaitingTurn)&&(e.awaitingTurn=null),!e.retry||e.retry.resend||n(e.retry.key)||e.operation.kind!==`idle`&&e.operation.kind!==`unknown-send`||(e.operation={kind:`unknown-send`,error:lt})}removedByRollback(e,t){let n=this.details.get(e);return t.status===`cancelled`&&!!n?.hydrated&&(n.session?.historyGeneration??0)>0&&t.sequence<=n.cursor&&(!n.hasOlder||(n.beforeSequence??1/0)<=t.sequence)&&!n.items.some(e=>e.turnId===t.turnId)}makeModel(){let e=this.book.selectedId,t=this.info(e),n=this.draft(e),r=e?this.details.get(e):void 0,i=(e,t)=>{let n=this.resolve(e.sessionId,e);return t?.synced?{...n,pendingPermissionCount:t.permissions.length}:n},a=t&&i(t,r),o=n.operation,s=this.book.storageWarning??this.book.recoveryWarning,c=[`creating`,`sending`,`stopping`,`resuming`,`patching`,`rolling-back`].includes(o.kind)&&!o.error,l=e===null?!!this.catalog:!!r?.synced&&(!a||a.sequence<=r.cursor)&&n.requiredSequence<=(r?.cursor??0),u=!!a&&l&&a.provider===`claude`&&a.status===`streaming`&&!!a.turnId&&a.archivedAt===null,d=u&&!!a&&(r?.items??[]).some(e=>e.kind===`user_message`&&e.itemId.startsWith(`${a.turnId}:steer:`)),f=n.steer?.state===`unknown`?n.steer.unrecorded?st:ot:null;return{catalog:this.catalog,sessions:[...this.rows,...this.pinnedOverlay.map(e=>e.sessionId).filter(e=>!this.rows.includes(e))].map(e=>{let t=this.info(e),n=this.details.get(e);return t&&i(t,n)}).filter(e=>!!e),selectedId:e,session:a,items:Qe(n,r?.items??[]),hasUnsentDraft:!!this.book.fresh.input.trim()||this.book.fresh.createUnknown||!!this.book.fresh.retry,permissions:r?.permissions??[],input:n.input,selection:ht(a?Ue(a):n.selection,n.settings),gitInfo:this.gitInfo,loading:this.indexLoading||!!r?.hydrating||!!e&&!r?.hydrated&&!r?.error,pending:c,busy:R(a),working:!!n.awaitingTurn||R(a),workingIds:new Set([...this.rows,...this.pinnedOverlay.map(e=>e.sessionId)].filter(e=>{let t=this.info(e);return!!this.book.sessions.get(e)?.awaitingTurn||!!t&&R(t)})),followUp:u,followUpSent:d,steering:n.steer?.state===`sending`,synced:l,transport:this.transport,workspacePicking:this.workspacePicking,error:[o.error??f??r?.error??this.indexError??this.catalogError??this.gitError??a?.error?.message,s].filter(Boolean).join(` `)||null,operation:{...o,error:o.error&&s?`${o.error} ${s}`:o.error},retryText:n.retry?.text??null,canRetrySameSend:!!e&&!n.settings&&o.kind===`unknown-send`&&!!n.retry&&l&&a?.archivedAt===null,resendRequired:!!n.retry?.resend,resendReason:n.retry?.resend?n.retry.resendReason??null:null,permissionOperations:{...n.permissionOperations},hasMoreSessions:this.moreSessions,hasOlderHistory:r?.hasOlder??!1,filter:this.filter,creationUnknown:e===null&&n.createUnknown,creationPending:e===null&&(n.createUnknown||n.operation.kind===`creating`),settings:n.settings?{state:n.settings.state,fields:n.settings.fields.map(e=>({field:e.field,baseline:e.baseline,value:e.value,...e.conflict?{theirs:e.conflict.theirs,...e.conflict.resolution?{resolution:e.conflict.resolution}:{}}:{}})),expired:n.settings.expired,busy:!!n.settings.op,waitingForSession:e===null,error:n.settings.error}:null,restoring:e!==null&&!!n.restore&&!n.restore.stopRequested,checkSettings:this.checkSettings,reapplySettings:this.reapplySettings,discardSettings:this.discardSettings,resolveSettingsConflict:this.resolveSettingsConflict,applyResolvedSettings:this.applyResolvedSettings,startAnotherSession:this.startAnotherSession,newSession:this.newSession,selectSession:this.selectSession,setInput:this.setInput,setSelection:this.setSelection,pickWorkspace:this.pickWorkspace,send:this.send,retrySameSend:this.retrySameSend,stop:this.stop,resume:this.resume,rollbackSession:this.rollbackSession,rename:this.rename,archive:this.archive,pin:this.pin,markUnread:this.markUnread,answer:this.answer,refresh:this.refresh,loadMoreSessions:this.loadMoreSessions,loadOlderHistory:this.loadOlderHistory,setFilter:this.setFilter,clearError:this.clearError}}async readCatalog(){let e=++this.catalogGeneration,t=this.lifetime;try{let n=await this.client.listModelOptions(this.abort.signal);if(!this.active||t!==this.lifetime||e!==this.catalogGeneration)return;this.catalog=n,this.catalogError=null;let r=this.book.fresh;!r.selection.model&&!r.selectionEdit&&r.operation.kind===`idle`&&(r.selection=We(n,{...r.selection,provider:n.defaultProvider})),this.notify()}catch(n){this.active&&t===this.lifetime&&e===this.catalogGeneration&&(this.catalogError=J(n),this.notify())}}async readIndex(e=!1){let t=++this.indexGeneration,n=this.lifetime,r=e?this.cursor:null,i=e?tt:Math.min(et,Math.max(tt,this.fetched));this.indexLoading=!0,this.notify();try{let a=await this.client.listSessions({...this.filter,limit:i,...r===null?{}:{cursor:r},...this.filter.scope===`cwd`?{cwd:this.workingDir}:{}},this.abort.signal),o=e||this.filter.archived?null:await this.client.listSessions({...this.filter.scope===`cwd`?{cwd:this.workingDir}:{},archived:!1,pinned:!0,limit:et},this.abort.signal).catch(()=>null);if(!this.active||n!==this.lifetime||t!==this.indexGeneration)return;!e&&!o&&(this.pinnedOverlay=[]),this.rows=[...new Set([...e?this.rows:[],...a.sessions.map(e=>e.sessionId)])].slice(0,et);for(let e of a.sessions){this.observe(e),this.accept(e);let t=this.details.get(e.sessionId);t?.hydrated&&!t.hydrating&&e.sequence>t.cursor&&(this.details.set(e.sessionId,z(t,{type:`stale`})),this.sync(e.sessionId))}if(o){let e=[];for(let t of o.sessions){let n=this.info(t.sessionId),r=n&&!ut(t,n)?n:t;r.pinnedAt!==null&&r.archivedAt===null&&(e.push(r),r===t&&(this.observe(r),this.accept(r)))}this.pinnedOverlay=e}this.cursor=a.nextCursor,this.fetched=(e?this.fetched:0)+a.sessions.length,this.moreSessions=a.hasMore&&this.rows.length<et,this.indexError=null;let s=new Set([...this.rows,...this.pinnedOverlay.map(e=>e.sessionId),...this.details.keys(),...this.book.selectedId?[this.book.selectedId]:[]]);for(let e of this.summaries.keys())s.has(e)||(this.summaries.delete(e),this.attention.delete(e))}catch(e){this.active&&n===this.lifetime&&t===this.indexGeneration&&(this.indexError=J(e))}finally{this.active&&n===this.lifetime&&t===this.indexGeneration&&(this.indexLoading=!1,this.notify())}}scheduleIndex(){this.active&&this.timer===void 0&&(this.timer=setTimeout(()=>{this.timer=void 0,this.readIndex()},rt))}sync(e,t=!1){let n=this.syncing.get(e);if(n)return n;let r=this.lifetime,i=new AbortController;this.detailReads.set(e,i),this.state(e);let a=()=>this.active&&r===this.lifetime&&this.detailReads.get(e)===i&&this.details.has(e),o=(async()=>{let n=0,r=null;try{for(let o=0;o<nt&&a();o++){let o=this.state(e);if(t||!o.hydrated||o.needsSnapshot){if(++n>2)throw Error(`snapshot did not cover live updates`);t=!1,this.update(e,z(o,{type:`snapshot-start`}));let s=this.book.sessions.get(e)?.stopTarget,c=s?.outcome===`unknown`?s:null,l=await this.client.snapshot(e,i.signal);if(!a())return;r=c,this.observe(l.session),this.update(e,z(this.state(e),{type:`snapshot`,snapshot:l}))}if(o=this.state(e),o.needsSnapshot)continue;let s=o.cursor,c=await this.client.events(e,s,i.signal);if(!a())return;let l=z(this.state(e),{type:`page`,page:c});if(this.update(e,l),!l.needsSnapshot){if(l.synced&&l.cursor>=(this.book.sessions.get(e)?.requiredSequence??0)){this.reconcileStop(e,r);return}l.cursor<=s&&(t=!0)}}a()&&this.update(e,z(this.state(e),{type:`error`,error:`History is still catching up. Refresh to continue.`}))}catch(t){if(!a())return;if(t instanceof N&&t.code===`invalid_sequence`&&n<2){let t=await this.client.snapshot(e,i.signal).catch(()=>null);if(!a())return;if(t){this.update(e,z(this.state(e),{type:`snapshot`,snapshot:t}));return}}this.update(e,z(this.state(e),{type:`error`,error:J(t)})),t instanceof N&&t.code===`session_not_found`&&this.scheduleIndex()}})().finally(()=>{this.syncing.get(e)===o&&this.syncing.delete(e),this.detailReads.get(e)===i&&this.detailReads.delete(e),this.trimDetails()});return this.syncing.set(e,o),o}onEvent=e=>{if(!this.active)return;e.session?.sessionId===e.sessionId&&this.accept(e.session),(e.event===`code_session`||e.item?.kind===`permission_request`||e.update?.status)&&this.scheduleIndex();let t=this.book.sessions.get(e.sessionId);e.item?.kind===`user_message`&&e.item.clientTurnKey&&t?.steer?.key===e.item.clientTurnKey&&(t.requiredSequence=Math.max(t.requiredSequence,e.sequence),Ge(t,e.item.clientTurnKey)),e.item?.kind===`user_message`&&e.item.clientTurnKey&&t?.retry?.key===e.item.clientTurnKey&&(t.requiredSequence=Math.max(t.requiredSequence,e.sequence),_t(this.details.get(e.sessionId),e.item.clientTurnKey)?this.requireNewKey(t):Ke(t,e.item.clientTurnKey));let n=this.details.get(e.sessionId);if(!n){this.notify();return}let r=z(n,{type:`event`,event:e});this.update(e.sessionId,r),!r.synced&&!r.hydrating&&this.sync(e.sessionId)};onTransport=e=>{this.transport=e;for(let[e,t]of this.details)this.details.set(e,z(t,{type:`stale`}));if(this.notify(),e===`connected`&&this.active){this.readIndex();for(let e of this.details.keys())this.sync(e,!0);for(let[e,t]of this.book.sessions)t.settings?.state===`unknown`&&!t.settings.expired&&(this.clearSettingsTimer(t),this.scheduleSettingsLookup(e,t,!0))}};refresh=async()=>{let e=this.book.selectedId;if(await Promise.all([this.readCatalog(),this.readIndex(),e?this.sync(e,!0):Promise.resolve(),this.readGit(),this.reconnectCreation()]),this.active)for(let[e,t]of this.book.sessions)t.settings?.state===`unknown`&&!t.settings.expired?this.scheduleSettingsLookup(e,t,!0):t.settings?.state===`pending`&&!t.settings.op&&!t.settings.autoRetried&&this.resumePendingSettings(e,t)};async reconnectCreation(){let e=this.book.fresh,t=e.creationKey,n=this.lifetime,r=this.book.navigation;if(!e.createUnknown||!t)return;let i=()=>this.active&&n===this.lifetime&&this.book.fresh===e&&e.creationKey===t&&e.createUnknown;try{let n=await this.client.findCreation(t,this.abort.signal);if(!i())return;this.accept(n);let a=this.book.sessions.get(n.sessionId);e.creationKey=null,e.createUnknown=!1,ft(a)?(e.selection=ht(e.selection,e.settings),e.settings=null,e.operation={kind:`idle`,error:`The original session was found and already has its own draft. This text and settings stay here as a new draft; sending it creates another session.`}):(e.operation={kind:`idle`,error:null},this.book.sessions.set(n.sessionId,e),this.book.fresh=q(e.selection),this.book.selectedId===null&&this.book.navigation===r&&(this.book.selectedId=n.sessionId,this.book.navigation++,this.state(n.sessionId)),this.notify(),e.settings&&await this.resumePendingSettings(n.sessionId,e)),this.scheduleIndex(),this.notify()}catch(t){i()&&(e.operation={kind:`creating`,error:J(t)},this.notify())}}loadMoreSessions=async()=>{this.moreSessions&&!this.indexLoading&&await this.readIndex(!0)};setFilter=e=>{this.filter={...e},this.cursor=null,this.fetched=0,this.rows=[],this.pinnedOverlay=[],this.moreSessions=!1,this.notify(),this.readIndex()};startAnotherSession=()=>{let e=this.book.fresh;if(this.book.selectedId!==null||!e.createUnknown)return;let t=q(ht(e.selection,e.settings));t.input=e.input,t.edit=e.edit,t.selectionEdit=e.selectionEdit,t.operation.error=`The original session may still exist. Your text is preserved; Send will create another session.`,this.book.fresh=t,this.book.navigation++,this.pickerGeneration++,this.notify()};newSession=()=>{this.book.selectedId=null,this.book.navigation++,this.gitInfo=null,this.notify(),this.readGit()};selectSession=async e=>{this.book.selectedId=e,this.book.navigation++,this.draft(e),this.state(e),this.gitInfo=null,this.notify(),await this.sync(e,!0),this.book.selectedId===e&&this.markVisited(e),this.book.selectedId===e&&await this.readGit()};async markVisited(e){try{this.accept(await this.client.visitSession(e)),this.notify()}catch{}}setInput=e=>{let t=this.draft();t.input=e,t.edit++,this.notify()};clearError=()=>{let e=this.draft();e.operation.kind===`idle`&&(e.operation={kind:`idle`,error:null}),e.steer?.state===`unknown`&&(e.steer=null),this.indexError=null,this.book.recoveryWarning=null,this.notify()};async readGit(){let e=++this.gitGeneration,t=this.lifetime,n=this.book.selectedId,r=this.info(n)?.cwd??(n===null?this.book.fresh.selection.cwd:``);if(this.gitInfo=null,this.gitError=null,r&&this.active)try{let i=await this.client.getGitInfo(r,this.abort.signal);this.active&&t===this.lifetime&&e===this.gitGeneration&&n===this.book.selectedId&&(this.gitInfo=i,this.notify())}catch(r){this.active&&t===this.lifetime&&e===this.gitGeneration&&n===this.book.selectedId&&(this.gitError=J(r),this.notify())}}pickWorkspace=async()=>{let e=this.book.fresh;if(this.book.selectedId!==null||e.operation.kind!==`idle`||e.createUnknown||this.workspacePicking)return;let t=this.book.navigation,n=e.selectionEdit,r=++this.pickerGeneration;this.workspacePicking=!0,this.notify();try{let i=await this.client.pickWorkspace();if(!this.active||r!==this.pickerGeneration||t!==this.book.navigation||n!==e.selectionEdit||e!==this.book.fresh||e.operation.kind!==`idle`)return;!i.cancelled&&i.path&&(e.selection={...e.selection,cwd:i.path},e.selectionEdit++,this.notify(),await this.readGit())}catch(i){this.active&&r===this.pickerGeneration&&t===this.book.navigation&&n===e.selectionEdit&&e===this.book.fresh&&e.operation.kind===`idle`&&(e.operation.error=J(i),this.notify())}finally{this.workspacePicking=!1,this.notify()}};setSelection=async e=>{let t=this.book.selectedId,n=this.info(t),r=this.draft(),i=!t&&(r.operation.kind===`creating`||r.createUnknown);if(r.settings&&(!i||r.settings.state!==`pending`||r.settings.op))return;if(n&&e.provider&&e.provider!==n.provider){this.newSession(),await this.setSelection({...e,cwd:n.cwd});return}if(i){if(e.provider!==void 0&&e.provider!==r.selection.provider||e.cwd!==void 0&&e.cwd!==r.selection.cwd){r.operation.error=`Runtime and workspace cannot change while session creation is unconfirmed.`,this.notify();return}this.editSettings(r,r.selection,e),this.notify();return}if(r.operation.kind!==`idle`||r.createUnknown)return;if(n&&t){if(e.cwd!==void 0&&e.cwd!==n.cwd||e.provider&&e.provider!==n.provider){r.operation.error=`Runtime and workspace are fixed for this session. Create a new session to change them.`,this.notify();return}if(n.status!==`idle`||!this.model.synced||n.archivedAt!==null){r.operation.error=`Wait for this session to be idle and synchronized before changing settings.`,this.notify();return}this.editSettings(r,n,e),this.notify(),r.settings&&await this.applySettings(t,r);return}if(t)return;let a=e.provider!==void 0&&e.provider!==r.selection.provider,o={...r.selection,...e};this.catalog&&a&&(o=We(this.catalog,o,!0));let s=this.catalog?.providers.find(e=>e.id===o.provider);o.effort!==null&&s&&!s.capabilities.efforts.includes(o.effort)&&(o.effort=null),r.selection=o,r.selectionEdit++,this.notify(),e.cwd!==void 0&&await this.readGit()};editSettings(e,t,n){let r=e.settings??{fields:[],state:`pending`,mutationId:null,expectedRevision:null,watermark:null,expired:!1,autoRetried:!1,retryReady:!1,error:null,op:null};for(let e of pt){if(n[e]===void 0)continue;let i=n[e]??null,a=r.fields.find(t=>t.field===e)?.baseline??mt(t,e);r.fields=r.fields.filter(t=>t.field!==e),i!==a&&r.fields.push({field:e,baseline:a,value:i})}e.settings=r.fields.length?r:null}clearSettingsTimer(e){let t=this.settingsTimers.get(e);t!==void 0&&clearTimeout(t),this.settingsTimers.delete(e),this.settingsDelays.delete(e)}settingsOwner(e,t,n,r,i,a){return this.active&&this.lifetime===a&&this.book.sessions.get(e)===t&&t.settings===n&&n.mutationId===i&&n.op?.token===r}compareSettings(e,t){e.fields=e.fields.filter(e=>mt(t,e.field)!==e.value);let n=!1;for(let r of e.fields){let e=mt(t,r.field);e===r.baseline?delete r.conflict:(r.conflict={theirs:e},n=!0)}return n}reconcileRejected(e,t,n,r){if(t.watermark=gt(t.watermark,r),this.compareSettings(t,n))return t.state=`conflict`,t.error=`Session settings changed elsewhere.`,!1;if(!t.fields.length)return e.settings=null,!1;for(let e of t.fields)e.baseline=mt(n,e.field);return t.state=`pending`,t.mutationId=null,t.autoRetried?(t.error=`Session settings changed again elsewhere. Apply your settings again or discard them.`,!1):(t.retryReady=!0,t.error=null,!0)}async syncSettings(e,t){let n=this.syncing.get(e);n&&(await n,!t())||t()&&await this.sync(e,!0)}async resumePendingSettings(e,t){let n=t.settings,r=this.lifetime;if(!n||n.state!==`pending`||n.op||!this.active)return;let i=++this.settingsToken,a=n.mutationId;n.op={token:i,kind:`check`},this.notify(),await this.syncSettings(e,()=>this.settingsOwner(e,t,n,i,a,r)),this.settingsOwner(e,t,n,i,a,r)&&(n.op=null,!this.details.get(e)?.synced||this.details.get(e)?.error?(n.error=`Could not refresh the session to apply settings.`,this.notify()):await this.applySettings(e,t))}async applySettings(e,t){let n=t.settings,r=this.info(e);if(!this.active||!n||n.state!==`pending`||n.op||!r)return;if(this.compareSettings(n,r)){n.state=`conflict`,n.error=`Session settings changed elsewhere.`,this.notify();return}if(!n.fields.length){t.settings=null,this.notify();return}try{n.mutationId=Ye(Date.now(),n.watermark)}catch(e){n.error=e instanceof Error?e.message:`Could not create a settings identity.`,this.notify();return}n.expectedRevision=r.revision,n.state=`sent`,n.error=null;let i=n.retryReady,a=n.autoRetried;i&&(n.autoRetried=!0,n.retryReady=!1);let o=n.mutationId,s=++this.settingsToken,c=this.lifetime;n.op={token:s,kind:`send`},this.notify();let l=this.book.storage&&Te(this.book.storage,this.book.endpoint).data?.sessions.find(t=>t.id===e)?.draft.settings;if(!l||l.state!==`sent`||l.mutationId!==o){n.state=`pending`,n.mutationId=null,n.op=null,n.retryReady=i,n.autoRetried=a,n.error=`Draft recovery could not save the settings change, so it was not sent.`,this.notify();return}let u={expectedRevision:r.revision,clientMutationId:o,model:r.model,effort:r.effort,permissionMode:r.permissionMode,...r.provider===`claude`&&r.thinking!==null?{thinking:r.thinking}:{}};for(let e of n.fields)e.field===`model`&&typeof e.value==`string`?u.model=e.value:e.field===`effort`&&(typeof e.value==`string`||e.value===null)?u.effort=e.value:e.field===`permissionMode`&&typeof e.value==`string`?u.permissionMode=e.value:e.field===`thinking`&&typeof e.value==`boolean`&&(u.thinking=e.value);let d=!1;try{let r=await this.client.patchSettings(e,u);if(!this.settingsOwner(e,t,n,s,o,c))return;this.accept(r.session),t.settings=null}catch(r){if(!this.settingsOwner(e,t,n,s,o,c))return;r instanceof N&&r.code===`revision_conflict`&&r.session?.sessionId===e?(this.observe(r.session),this.accept(r.session),n.watermark=gt(n.watermark,r.watermark??null),d=this.reconcileRejected(t,n,r.session,o)):r instanceof N&&r.code===`mutation_fenced`?(n.state=`rejected`,n.error=r.message):r instanceof N&&r.status===410&&r.code===`mutation_outcome_expired`?(n.state=`unknown`,n.expired=!0,n.watermark=r.watermark??n.watermark,n.error=r.message):(n.state=r instanceof N&&(r.status===400&&(/^(invalid_|unsupported_)/.test(r.code)||[`unknown_field`,`empty_patch`].includes(r.code))||r.status===404&&r.code===`session_not_found`||r.status===409&&[`session_busy`,`resume_unavailable`,`session_archived`,`cleanup_pending`,`mutation_id_conflict`].includes(r.code))?`rejected`:`unknown`,n.error=J(r))}t.settings===n&&(n.op=null),this.notify(),this.scheduleIndex(),d&&t.settings===n?await this.applySettings(e,t):t.settings===n&&n.state===`unknown`&&!n.expired&&this.scheduleSettingsLookup(e,t)}scheduleSettingsLookup(e,t,n=!1){if(!this.active||this.settingsTimers.has(t)||t.settings?.state!==`unknown`||t.settings.expired)return;let r=n?0:this.settingsDelays.get(t)??1e3;this.settingsDelays.set(t,Math.min(r?r*2:1e3,3e4)),this.settingsTimers.set(t,setTimeout(()=>{this.settingsTimers.delete(t),this.lookupSettings(e,t,`lookup`)},r))}async lookupSettings(e,t,n){let r=t.settings;if(!this.active||!r||r.state!==`unknown`||r.expired||!r.mutationId||r.op)return;let i=r.mutationId,a=++this.settingsToken,o=this.lifetime;r.op={token:a,kind:n},this.notify();let s=!1;try{let{mutation:n,watermark:c}=await this.client.readMutation(e,i);if(!this.settingsOwner(e,t,r,a,i,o))return;if(r.watermark=gt(r.watermark,c),n.status===`applied`||n.status===`rejected_conflict`){if(await this.syncSettings(e,()=>this.settingsOwner(e,t,r,a,i,o)),!this.settingsOwner(e,t,r,a,i,o))return;if(!this.details.get(e)?.synced||this.details.get(e)?.error)throw Error(`Session refresh failed`)}if(n.status===`applied`)t.settings=null,this.clearSettingsTimer(t);else if(n.status===`rejected_conflict`){let n=this.info(e);n?s=this.reconcileRejected(t,r,n,i):(r.state=`unknown`,r.error=`Could not refresh the session to review settings.`)}else r.state=`rejected`,r.error=`This settings change was fenced before it applied.`}catch(n){if(!this.settingsOwner(e,t,r,a,i,o))return;n instanceof N&&n.status===410&&(r.expired=!0,r.watermark=n.watermark??r.watermark),n instanceof N&&n.code===`mutation_not_found`||(r.error=J(n))}t.settings===r&&(r.op=null),this.notify(),s&&t.settings===r?await this.applySettings(e,t):t.settings===r&&r.state===`unknown`&&!r.expired&&this.scheduleSettingsLookup(e,t)}checkSettings=async()=>{let e=this.book.selectedId;if(!e)return;let t=this.draft(e);this.clearSettingsTimer(t),await this.lookupSettings(e,t,`check`)};async settleSettings(e){let t=this.book.selectedId,n=this.draft(t),r=n.settings;if(!r||r.op)return;if(r.state===`pending`){e===`discard`?(n.settings=null,this.notify()):t&&(r.error=null,await this.resumePendingSettings(t,n));return}if(!t||r.state===`conflict`){e===`discard`&&(n.settings=null,this.notify());return}if(![`unknown`,`rejected`].includes(r.state)||!r.mutationId)return;this.clearSettingsTimer(n);let i=r.mutationId,a=++this.settingsToken,o=this.lifetime;r.op={token:a,kind:`fence`},this.notify();let s=`fenced`;try{if(!r.expired){let e=await this.client.fenceMutation(t,i);s=e.mutation.status,this.settingsOwner(t,n,r,a,i,o)&&(r.watermark=gt(r.watermark,e.watermark))}if(!this.settingsOwner(t,n,r,a,i,o))return}catch(e){if(!this.settingsOwner(t,n,r,a,i,o))return;if(e instanceof N&&e.status===410)r.watermark=e.watermark??r.watermark,r.expired=!0;else{r.op=null,r.error=J(e),this.notify(),r.state===`unknown`&&this.scheduleSettingsLookup(t,n);return}}if(s===`applied`||s===`rejected_conflict`){if(await this.syncSettings(t,()=>this.settingsOwner(t,n,r,a,i,o)),!this.settingsOwner(t,n,r,a,i,o))return;if(!this.details.get(t)?.synced||this.details.get(t)?.error){r.op=null,r.error=`Could not refresh the session to review settings.`,this.notify();return}}let c=!1;if(s===`applied`||s===`rejected_conflict`&&e===`discard`)n.settings=null;else if(s===`rejected_conflict`){let e=this.info(t);if(!e){r.op=null,r.error=`Could not refresh the session to review settings.`,this.notify();return}r.autoRetried=!1,r.retryReady=!1,c=this.reconcileRejected(n,r,e,i)}else e===`discard`?n.settings=null:(r.state=`pending`,r.watermark=gt(r.watermark,i),r.expired=!1,r.autoRetried=!1,r.retryReady=!1,r.error=null,r.mutationId=null,c=!0);n.settings===r&&(r.op=null),this.notify(),c&&e===`reapply`&&n.settings===r&&r.state===`pending`&&await this.applySettings(t,n)}reapplySettings=async()=>{await this.settleSettings(`reapply`)};discardSettings=async()=>{await this.settleSettings(`discard`)};resolveSettingsConflict=(e,t)=>{let n=this.draft().settings,r=n?.fields.find(t=>t.field===e);n&&n.state===`conflict`&&!n.op&&r?.conflict&&(r.conflict.resolution=t,this.notify())};applyResolvedSettings=async()=>{let e=this.book.selectedId,t=this.draft(e),n=t.settings,r=this.info(e);if(e&&n&&n.state===`conflict`&&!n.op&&r&&!n.fields.some(e=>e.conflict&&!e.conflict.resolution)){n.fields=n.fields.filter(e=>e.conflict?.resolution!==`theirs`);for(let e of n.fields)e.conflict&&(e.baseline=e.conflict.theirs),delete e.conflict;n.fields.length?(n.mutationId&&(!n.watermark||n.mutationId>n.watermark)&&(n.watermark=n.mutationId),n.state=`pending`,n.mutationId=null,n.autoRetried=!1,n.retryReady=!1,n.error=null,this.notify(),await this.applySettings(e,t)):(t.settings=null,this.notify())}};async patch(e,t,n=!1){let r=this.draft(e),i=this.info(e);if(!i||r.operation.kind!==`idle`||R(i)){let e=Error(i?`Wait for the current session action to finish before changing it.`:`Refresh this session before changing it.`);if(r.operation.error=e.message,this.notify(),n)throw e;return}let a=null;r.operation={kind:`patching`,error:null},this.notify();try{this.accept(await this.client.patchSession(e,{...t,expectedRevision:i.revision})),r.operation={kind:`idle`,error:null}}catch(t){t instanceof N&&t.session?.sessionId===e&&(this.observe(t.session),this.accept(t.session)),a=t instanceof N?t:Error(J(t)),r.operation={kind:`idle`,error:a.message}}if(this.notify(),this.scheduleIndex(),this.active&&await this.sync(e,!0),n&&a)throw a}rename=async(e,t)=>{await this.patch(e,{title:t},!0)};archive=async(e,t)=>{await this.patch(e,{archived:t},!0)};async sidebarPatch(e,t){let n=this.draft(e),r=this.info(e);if(!r||n.operation.kind!==`idle`){let e=Error(r?`Wait for the current session action to finish before changing it.`:`Refresh this session before changing it.`);throw n.operation.error=e.message,this.notify(),e}let i=null;n.operation={kind:`patching`,error:null},this.notify();try{this.accept(await this.client.patchSession(e,{...t,expectedRevision:r.revision})),n.operation={kind:`idle`,error:null}}catch(t){t instanceof N&&t.session?.sessionId===e&&(this.observe(t.session),this.accept(t.session)),i=t instanceof N?t:Error(J(t)),n.operation={kind:`idle`,error:i.message}}if(this.notify(),this.scheduleIndex(),i)throw i}pin=async(e,t)=>{await this.sidebarPatch(e,{pinned:t})};markUnread=async(e,t)=>{await this.sidebarPatch(e,{unread:t})};async restoreSession(e,t,n){if(t.restore)return t.operation={kind:`idle`,error:`The previous restore is still stopping. Try again once it finishes; your text is kept.`},this.notify(),null;let r={token:++t.attachToken,operationId:crypto.randomUUID(),settled:!1,stopRequested:!1,cancel:`none`};t.restore=r,t.operation={kind:`resuming`,error:null},this.notify();let i=null,a=null;try{a=await this.client.attachSession(e,r.operationId,()=>{r.operationId=null}),a.identityUnknown&&(r.operationId=null)}catch(e){i=e}finally{r.settled=!0}if(a&&this.accept(a.session),t.attachToken!==r.token){if(t.restore===r){t.restore=null;let e=a&&!a.attach?a.session.status:null,r=a?.attach?.outcome??(e===`failed`?`failed`:e===`idle`?`completed`:void 0),i=r===`cancelled`?`Restore stopped.`:r===`completed`?`The session was restored before Stop took effect.`:r===`failed`?`Restore failed.`:`The restore outcome is unknown after Stop; refresh to check the session.`;t.operation={kind:`idle`,error:n?`${i} Your text was not sent.`:i},this.notify(),this.scheduleIndex()}return null}return i||a?.attach&&a.attach.outcome!==`completed`?(t.restore=null,t.operation={kind:`idle`,error:i?J(i):n?a?.attach?.outcome===`cancelled`?`Resume was stopped. Your text was not sent.`:`Resume failed. Your text was not sent.`:`Resume did not complete.`},this.notify(),this.scheduleIndex(),null):(this.notify(),this.scheduleIndex(),r)}send=async()=>{let e=this.book.selectedId,t=this.draft(e);if(t.operation.kind!==`idle`||t.createUnknown||!t.input.trim()||t.steer?.state===`sending`)return;if(t.settings){t.operation.error=`Apply or discard pending settings before sending.`,this.notify();return}let n=this.info(e),r={text:t.input,edit:t.edit,key:crypto.randomUUID()},i=null,a=null;try{if(e&&n&&this.model.followUp){this.model.followUpSent||await this.steer(e,t,n);return}if(t.steer?.state===`unknown`&&(t.steer=null),e&&n&&Ne(n)&&this.model.synced){if(a=await this.restoreSession(e,t,!0),!a||(i=a.token,t.attachToken!==i))return;try{this.active&&await this.sync(e,!0)}catch(e){t.attachToken===i&&(t.operation={kind:`idle`,error:J(e)},this.notify(),this.scheduleIndex());return}if(t.attachToken!==i)return;n=this.info(e)}if(e&&(!n||n.status!==`idle`||n.archivedAt!==null||!this.model.synced)){if(i!==null&&t.attachToken!==i)return;t.operation={kind:`idle`,error:`Wait for the session to be idle and synchronized before sending.`},this.notify();return}let o=this.book.navigation;if(!e){let n={...t.selection},r=this.catalog?.providers.find(e=>e.id===n.provider);if(!r?.available||!n.cwd.trim()||!r.models.includes(n.model)||!r.capabilities.permissionModes.includes(n.permissionMode)||n.effort!==null&&!r.capabilities.efforts.includes(n.effort)){t.operation.error=`Choose an available runtime, workspace, model and supported settings before sending.`,this.notify();return}t.creationKey=crypto.randomUUID(),t.operation={kind:`creating`,error:null},this.notify();let i=this.book.storage&&Te(this.book.storage,this.book.endpoint).data?.fresh;if(!this.book.storage||!i?.creating||i.creationKey!==t.creationKey){t.creationKey=null,t.operation={kind:`idle`,error:`Draft recovery cannot save this request in this tab, so the session was not created. Reload the Manager or free browser storage, then try again.`},this.notify();return}try{let r=await this.client.createSession({...n,clientCreationKey:t.creationKey});if(t.creationKey=null,e=r.sessionId,ft(this.book.sessions.get(e))&&this.book.sessions.get(e)!==t){this.accept(r),t.selection=ht(t.selection,t.settings),t.settings=null,t.operation={kind:`idle`,error:`The new session already has its own draft, so this text and settings stayed here and were not sent. Sending it creates another session.`},this.notify(),this.scheduleIndex();return}if(this.book.sessions.set(e,t),this.book.fresh===t&&(this.book.fresh=q(n)),this.book.navigation===o&&this.book.selectedId===null&&(this.book.selectedId=e,this.book.navigation++),this.accept(r),this.active&&this.state(e),t.operation={kind:`idle`,error:null},this.notify(),t.settings&&(await this.resumePendingSettings(e,t),t.settings||!this.active)){t.operation={kind:`idle`,error:`Your message was not sent because the pending settings are not applied yet.`},this.notify();return}this.scheduleIndex()}catch(e){t.createUnknown=!Y(e),t.createUnknown||(t.creationKey=null,t.selection=ht(t.selection,t.settings),t.settings=null),t.operation={kind:t.createUnknown?`creating`:`idle`,error:t.createUnknown?`Session creation could not be confirmed. The original session may exist. Refresh the list, or choose Start another session to keep this text in a new draft.`:J(e)},this.notify(),this.scheduleIndex();return}}if(t=this.draft(e),i!==null&&t.attachToken!==i)return;if(t.settings){t.operation={kind:`idle`,error:`Your message was not sent because the pending settings are not applied yet.`},this.notify();return}t.retry=r,a&&t.restore===a&&(t.restore=null),await this.submit(e,t)}finally{a&&t.restore===a&&(t.restore=null,this.notify())}};async submit(e,t){let n=t.retry;if(n){t.operation={kind:`sending`,error:null},t.awaitingTurn=n.key,this.notify();try{let r=await this.client.sendPrompt(e,{text:n.text,clientTurnKey:n.key});if(r.clientTurnKey!==n.key)throw Error(`Mismatched prompt receipt`);t.requiredSequence=Math.max(t.requiredSequence,r.sequence);let i=this.details.get(e);i&&this.details.set(e,z(i,{type:`stale`})),dt(r.status)?(this.requireNewKey(t,this.removedByRollback(e,r)?`rolled-back`:void 0),t.awaitingTurn=null):Ke(t,n.key)}catch(e){t.retry?.key===n.key&&(t.operation={kind:Y(e)?`idle`:`unknown-send`,error:Y(e)?J(e):`Message acceptance is unknown. Refresh, or explicitly retry the original message with the same key.`},Y(e)&&(t.retry=null,t.awaitingTurn=null))}this.notify(),this.scheduleIndex(),this.active&&await this.sync(e,!0)}}async steer(e,t,n){if(!n.turnId||t.stopTarget&&t.stopTarget.outcome!==`retryable`)return;let r={key:crypto.randomUUID(),text:t.input,edit:t.edit,turnId:n.turnId,epoch:n.epoch,state:`sending`};t.steer=r,t.operation.error&&(t.operation={...t.operation,error:null}),this.notify();try{let n=await this.client.steerSession(e,{text:r.text,clientTurnKey:r.key,turnId:r.turnId,epoch:r.epoch});if(n.clientTurnKey!==r.key)throw Error(`Mismatched follow-up receipt`);t.requiredSequence=Math.max(t.requiredSequence,n.sequence);let i=this.details.get(e);i&&this.details.set(e,z(i,{type:`stale`})),Ge(t,r.key)}catch(e){t.steer===r&&(Y(e)?(t.steer=null,t.operation.kind===`idle`&&(t.operation={kind:`idle`,error:J(e)})):(r.state=`unknown`,r.unrecorded=e instanceof N&&e.code===`steer_outcome_unknown`))}this.notify(),this.scheduleIndex(),this.active&&await this.sync(e,!0)}retrySameSend=async()=>{let e=this.book.selectedId,t=this.draft(e);e&&this.model.canRetrySameSend&&t.operation.kind===`unknown-send`&&await this.submit(e,t)};reconcileStop(e,t){let n=this.book.sessions.get(e),r=this.details.get(e),i=this.info(e);!t||t.outcome!==`unknown`||n?.stopTarget!==t||!r?.synced||!i||i.sequence>r.cursor||(t.operationId?K(i)!==t.operationId:i.turnId!==t.turnId)||i.epoch!==t.epoch||(i.status===`starting`||i.status===`streaming`?(t.outcome=`retryable`,n.operation={kind:n.retry?`unknown-send`:`idle`,error:`Stop could not be confirmed. The same turn is still running. Press Stop to retry for this turn.`}):i.status===`stopping`&&(t.outcome=`accepted`,n.operation={kind:`stopping`,error:null}),this.notify())}async cancelRestore(e,t,n,r=this.info(e)){if(n.cancel===`none`&&!n.settled&&n.operationId&&r&&r.status===`starting`&&K(r)===n.operationId&&r.turnId===null){n.cancel=`sending`;try{this.accept(await this.client.cancelPrompt(e,{operationId:n.operationId,epoch:r.epoch})),n.cancel=`accepted`}catch(e){n.cancel=`failed`,t.restore===n&&!n.settled&&(t.operation={kind:`idle`,error:Y(e)?`Stop was refused: ${J(e)}`:`Stop could not be confirmed. The restore may still be running; press Stop to retry.`})}this.notify(),this.scheduleIndex()}}async reconcileRestore(e,t,n){let r=()=>this.active&&t.restore===n&&!n.settled&&n.cancel===`none`;if(!r())return;let i=new AbortController,a=()=>i.abort();this.abort.signal.addEventListener(`abort`,a,{once:!0});let o,s=new Promise(e=>{o=setTimeout(()=>{a(),e(null)},it)});try{let a=await Promise.race([this.client.snapshot(e,i.signal),s]);a&&r()&&(this.observe(a.session),this.accept(a.session),await this.cancelRestore(e,t,n))}catch{}finally{clearTimeout(o),this.abort.signal.removeEventListener(`abort`,a)}r()&&t.operation.kind===`stopping`&&(t.operation={kind:`idle`,error:at},this.notify())}stop=async()=>{let e=this.book.selectedId,t=this.info(e);if(!e)return;let n=this.draft(e),r=n.restore;if(r){if(!r.stopRequested)n.attachToken++,r.stopRequested=!0;else if(r.cancel===`sending`||r.cancel===`accepted`)return;if(r.settled){n.restore=null,n.operation={kind:`idle`,error:`Stopped before sending. Your text was not sent.`},this.notify();return}r.cancel===`failed`&&(r.cancel=`none`),n.operation={kind:`stopping`,error:null},this.notify(),await this.cancelRestore(e,n,r,t),r.cancel===`none`&&await this.reconcileRestore(e,n,r);return}if(!t||!Le(t))return;let i=n.stopTarget;if(i&&(i.outcome!==`retryable`||!this.model.synced||(i.operationId?i.operationId!==K(t):i.turnId!==t.turnId)||i.epoch!==t.epoch))return;let a=i??(t.turnId?{turnId:t.turnId,epoch:t.epoch,outcome:`pending`}:{turnId:null,operationId:K(t),epoch:t.epoch,outcome:`pending`});n.attachToken++,a.outcome=`pending`,n.stopTarget=a,n.operation={kind:`stopping`,error:null},this.notify();try{let t=await this.client.cancelPrompt(e,a.operationId?{operationId:a.operationId,epoch:a.epoch}:{turnId:a.turnId,epoch:a.epoch});n.stopTarget===a&&(a.outcome=`accepted`),this.accept(t)}catch(e){n.stopTarget===a&&(a.outcome=`unknown`,n.operation={kind:`stopping`,error:J(e)},Y(e)&&(n.stopTarget=null,n.operation.kind=`idle`))}this.notify(),this.scheduleIndex(),this.active&&(a.outcome===`unknown`&&await this.syncing.get(e),this.active&&await this.sync(e,!0))};resume=async()=>{let e=this.book.selectedId,t=this.info(e),n=this.draft(e);if(!e||!t||!this.model.synced||n.operation.kind!==`idle`||t.archivedAt!==null||![`suspended`,`failed`].includes(t.status)||!t.capabilities.resume||!t.resume.available||t.status===`failed`&&!t.error?.recoverable)return;let r=await this.restoreSession(e,n,!1);r&&(n.restore===r&&(n.restore=null),n.operation={kind:`idle`,error:null},this.notify(),this.scheduleIndex(),this.active&&await this.sync(e,!0))};rollbackSession=async e=>{let t=this.book.selectedId,n=this.info(t),r=this.draft(t);if(t&&n&&Pe(n,this.model.synced,r.operation.kind===`idle`&&r.steer?.state!==`sending`)){r.operation={kind:`rolling-back`,error:null},this.notify();try{this.accept(await this.client.rollbackSession(t,{expectedRevision:n.revision,expectedEpoch:n.epoch,upToItemId:e})),r.operation={kind:`idle`,error:null}}catch(e){e instanceof N&&e.session?.sessionId===t&&(this.observe(e.session),this.accept(e.session)),r.operation={kind:`idle`,error:e instanceof N&&e.code===`revision_conflict`?ct:J(e)}}this.notify(),this.scheduleIndex(),this.active&&await this.sync(t,!0)}};answer=async(e,t)=>{let n=e.sessionId,r=this.details.get(n),i=this.info(n),a=this.draft(n);if(a.permissionOperations[e.permissionId]?.pending)return;let o=r?.permissions.find(t=>t.permissionId===e.permissionId);if(!r?.synced||!i||i.sequence>r.cursor||!o||o.turnId!==e.turnId||o.epoch!==e.epoch||i.turnId!==e.turnId||i.epoch!==e.epoch||!o.options.some(e=>e.optionId===t)){a.permissionOperations[e.permissionId]={pending:!1,error:`This approval is no longer current. Refresh its status.`},this.notify(),this.active&&await this.sync(n,!0);return}a.permissionOperations[e.permissionId]={pending:!0,error:null},this.notify();try{await this.client.answerPermission(e.permissionId,{sessionId:n,turnId:e.turnId,epoch:e.epoch,optionId:t}),a.permissionOperations[e.permissionId]={pending:!0,error:null}}catch(t){a.permissionOperations[e.permissionId]={pending:!0,error:J(t)}}this.notify(),this.scheduleIndex(),this.active&&await this.sync(n,!0);let s=this.details.get(n),c=!s?.synced||s.permissions.some(t=>t.permissionId===e.permissionId),l=a.permissionOperations[e.permissionId];c&&l?a.permissionOperations[e.permissionId]={pending:!1,error:l.error}:delete a.permissionOperations[e.permissionId],this.notify()};loadOlderHistory=async()=>{let e=this.book.selectedId;if(!e||this.historyLoading.has(e))return;let t=this.details.get(e);if(!t?.hydrated||!t.hasOlder||t.beforeSequence===null)return;let n=this.lifetime;this.historyLoading.add(e);try{let r=await this.client.history(e,t.beforeSequence,this.abort.signal);this.active&&n===this.lifetime&&this.details.get(e)?.beforeSequence===t.beforeSequence&&this.update(e,z(this.state(e),{type:`history`,page:r}))}catch(t){this.active&&n===this.lifetime&&(this.draft(e).operation.error=J(t),this.notify())}finally{this.historyLoading.delete(e)}}};function yt({port:e,onEvent:t,onTransport:n}){let r=(0,k.useRef)({onEvent:t,onTransport:n});r.current={onEvent:t,onTransport:n},(0,k.useEffect)(()=>{if(!e)return;let t=!0,n=new EventSource(`${P(e)}/api/events`);return n.onopen=()=>{t&&r.current.onTransport?.(`connected`)},n.onmessage=e=>{if(!t)return;let n;try{n=JSON.parse(e.data)}catch{return}n?.topic!==`code`||typeof n.sessionId!=`string`||!Number.isSafeInteger(n.sequence)||n.sequence<1||!Number.isSafeInteger(n.epoch)||(n.event===`code_item`||n.event===`code_item_update`||n.event===`code_session`)&&r.current.onEvent(n)},n.onerror=()=>{t&&r.current.onTransport?.(n.readyState===EventSource.CLOSED?`disconnected`:`reconnecting`)},()=>{t=!1,n.close()}},[e])}function bt({port:e,workingDir:t}){let n=P(e),r=(0,k.useMemo)(()=>new vt({port:e,workingDir:t}),[n,e]);return(0,k.useEffect)(()=>r.mount(),[r]),(0,k.useEffect)(()=>r.setWorkingDir(t),[r,t]),yt({port:e,onEvent:r.onEvent,onTransport:r.onTransport}),(0,k.useSyncExternalStore)(r.subscribe,r.getModel,r.getModel)}function xt(e){return e.archivedAt===null?`active`:`archived`}function St(e,t){return t.createdAt-e.createdAt||e.sessionId.localeCompare(t.sessionId)}function Ct(e,t){return(t.pinnedAt??0)-(e.pinnedAt??0)||St(e,t)}function wt(e){let t=e.filter(e=>xt(e)===`active`).sort(St),n=e.filter(e=>xt(e)===`archived`).sort((e,t)=>(t.archivedAt??t.createdAt)-(e.archivedAt??e.createdAt)||e.sessionId.localeCompare(t.sessionId)),r=[];return t.length&&r.push({section:`active`,sessions:t}),n.length&&r.push({section:`archived`,sessions:n}),r}function Tt(e){return e===void 0?{kind:`unknown`}:e>0?{kind:`approvals`,count:e}:{kind:`none`}}function Et(e){return e.kind===`unknown`?`Approval status unknown`:e.kind===`none`?`No pending approvals`:`${e.count} pending approval${e.count===1?``:`s`}`}function Dt(e){if(e.archivedAt!==null)return!1;if(e.markedUnread)return!0;let t=e.lastTurnCompletedAt,n=e.lastVisitedAt;return t===null||n===null?!1:t>n}function Ot(e){let t=new Map;for(let n of[...e].sort(St)){let e=t.get(n.cwd)??[];e.push(n),t.set(n.cwd,e)}return[...t].map(([e,t])=>({cwd:e,sessions:t}))}var kt=[`priority`,`today`,`yesterday`,`earlier`],At={priority:`Priority`,today:`Today`,yesterday:`Yesterday`,earlier:`Earlier`};function jt(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function Mt(e,t=Date.now(),n=null){let r=jt(t),i=jt(r-1),a=new Map;for(let t of e){let e=t.sessionId!==n&&Dt(t)?`priority`:t.lastUsedAt>=r?`today`:t.lastUsedAt>=i?`yesterday`:`earlier`,o=a.get(e)??[];o.push(t),a.set(e,o)}let o=(e,t)=>e===`priority`?t.lastTurnCompletedAt??t.lastUsedAt:t.lastUsedAt;return kt.filter(e=>a.has(e)).map(e=>({bucket:e,sessions:a.get(e).sort((t,n)=>o(e,n)-o(e,t)||t.sessionId.localeCompare(n.sessionId))}))}function Nt(e){return e.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||e}var X=n(),Pt=a.newCodeSession,Ft=`jaw.code.sidebarView`;function It(){try{return localStorage.getItem(Ft)===`activity`?`activity`:`projects`}catch{return`projects`}}function Lt(){return(0,X.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`15`,height:`15`,"aria-hidden":`true`,focusable:`false`,children:(0,X.jsx)(`path`,{d:`M8 2.5a3.5 3.5 0 0 0-3.5 3.5v2.3L3.3 10.6h9.4L11.5 8.3V6A3.5 3.5 0 0 0 8 2.5Z M6.6 12.4a1.5 1.5 0 0 0 2.8 0`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinejoin:`round`,strokeLinecap:`round`})})}function Rt(){return(0,X.jsxs)(`svg`,{viewBox:`0 0 16 16`,width:`15`,height:`15`,"aria-hidden":`true`,focusable:`false`,children:[(0,X.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`}),(0,X.jsx)(`path`,{d:`M10.2 10.2 13.5 13.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`})]})}function zt(){return(0,X.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`,focusable:`false`,children:(0,X.jsx)(`path`,{d:`M8 3.5v9M3.5 8h9`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`})})}function Bt({session:e,controller:t,view:n}){let[r,i]=(0,k.useState)(!1),[a,h]=(0,k.useState)(e.title??``),[g,_]=(0,k.useState)(!1),[v,y]=(0,k.useState)(null),b=s(),x=(0,k.useRef)(!1),S=(0,k.useRef)(null),C=(0,k.useId)(),w=t.selectedId===e.sessionId,T=je(e),E=e.archivedAt!==null,D=e.pinnedAt!==null,O=Tt(w&&t.synced?t.permissions.length:e.pendingPermissionCount),A=!w&&(e.markedUnread||Dt(e)),j=t.workingIds?.has(e.sessionId)??!1,M=j&&e.status===`idle`,N=e.title||`Untitled session`;async function P(e,t){if(!x.current){x.current=!0,_(!0),y(null);try{await e(),t?.()}catch(e){y(e instanceof Error?e.message:String(e))}finally{x.current=!1,_(!1)}}}function F(){i(!1),S.current?.focus()}async function I(e){let t=await m(e);if(!t.ok)throw Error(t.error??`Copy failed.`)}let L=[{id:`rename`,label:`Rename`,icon:(0,X.jsx)(o,{}),disabled:g||T,...T?{title:`Stop before renaming`}:{},onSelect:()=>{h(e.title??``),i(!0)}},{id:`pin`,label:D?`Unpin`:`Pin`,icon:(0,X.jsx)(c,{}),disabled:g,onSelect:()=>void P(()=>t.pin(e.sessionId,!D))},{id:`unread`,label:A?`Mark as read`:`Mark as unread`,icon:(0,X.jsx)(u,{}),disabled:g||w,...w?{title:`The open session is already read`}:{},onSelect:()=>void P(()=>t.markUnread(e.sessionId,!A))},{id:`archive`,label:E?`Restore`:`Archive`,icon:(0,X.jsx)(f,{}),disabled:g||T,...T?{title:`Stop before archiving`}:{},onSelect:()=>void P(()=>t.archive(e.sessionId,!E))},...Ne(e)?[{kind:`separator`,id:`resume-sep`},{id:`resume`,label:`Resume`,icon:(0,X.jsx)(p,{}),disabled:g||!w||!t.synced||t.pending,title:w?`Resume without resending a prompt`:`Select this session to resume it`,onSelect:()=>void P(t.resume)}]:[],{kind:`separator`,id:`copy-sep`},{id:`copy-id`,label:`Copy session ID`,icon:(0,X.jsx)(d,{}),onSelect:()=>void P(()=>I(e.sessionId))},{id:`copy-cwd`,label:`Copy working directory`,icon:(0,X.jsx)(d,{}),onSelect:()=>void P(()=>I(e.cwd))}];function ee(e){(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)&&b.openAt(e)}return(0,X.jsxs)(`li`,{className:`code-session-row`,onContextMenu:e=>{e.target.closest(`.code-session-rename`)||b.openAt(e)},children:[(0,X.jsxs)(`div`,{className:`code-session-item-wrap`,onKeyDown:ee,children:[(0,X.jsxs)(`button`,{ref:S,type:`button`,className:`code-session-item${w?` active`:``}`,"aria-current":w?`true`:void 0,onClick:()=>void P(()=>t.selectSession(e.sessionId)),children:[(0,X.jsxs)(`span`,{className:`code-session-cwd`,children:[A&&(0,X.jsx)(`span`,{className:`code-session-unread-dot`,role:`img`,"aria-label":`Unread`}),N]}),(0,X.jsx)(`span`,{className:`code-session-meta`,title:e.cwd,children:n===`activity`?`${Nt(e.cwd)} · ${G[e.provider]}`:G[e.provider]}),(0,X.jsxs)(`span`,{className:`code-session-status code-session-status-${M?`starting`:e.status}`,"data-quiet":e.status===`idle`&&!j?`true`:void 0,children:[j&&(0,X.jsx)(`span`,{className:`code-session-spinner`,"aria-hidden":`true`}),M?Ae.starting:Ae[e.status]]}),(0,X.jsx)(`span`,{className:`code-session-attention code-session-attention-${O.kind}`,"data-quiet":O.kind===`none`?`true`:void 0,children:Et(O)})]}),(0,X.jsxs)(`span`,{className:`code-session-hover-actions`,children:[(0,X.jsx)(`button`,{type:`button`,className:`code-session-hover-btn${D?` is-on`:``}`,"aria-label":D?`Unpin ${N}`:`Pin ${N}`,"aria-pressed":D,title:D?`Unpin`:`Pin`,disabled:g,onClick:n=>{n.stopPropagation(),P(()=>t.pin(e.sessionId,!D))},children:(0,X.jsx)(c,{})}),(0,X.jsx)(`button`,{type:`button`,className:`code-session-hover-btn`,"aria-label":E?`Restore ${N}`:`Archive ${N}`,title:T?`Stop before archiving`:E?`Restore`:`Archive`,disabled:g||T,onClick:n=>{n.stopPropagation(),P(()=>t.archive(e.sessionId,!E))},children:(0,X.jsx)(f,{})}),(0,X.jsx)(`button`,{type:`button`,className:`code-session-hover-btn`,"aria-label":`More actions for ${N}`,"aria-haspopup":`menu`,title:`More actions`,onClick:e=>{e.stopPropagation(),b.openAtElement(e.currentTarget)},children:(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`⋯`})})]})]}),r&&(0,X.jsxs)(`form`,{className:`code-session-rename`,onSubmit:n=>{n.preventDefault(),a.trim()&&P(()=>t.rename(e.sessionId,a.trim()),F)},children:[(0,X.jsx)(`input`,{autoFocus:!0,"aria-label":`Session title`,"aria-describedby":v?C:void 0,value:a,disabled:g,onChange:e=>h(e.target.value),onKeyDown:t=>{t.key===`Escape`&&!g&&(t.preventDefault(),h(e.title??``),F())}}),(0,X.jsx)(`button`,{type:`submit`,disabled:g||!a.trim(),children:`Save`}),(0,X.jsx)(`button`,{type:`button`,disabled:g,onClick:F,children:`Cancel`})]}),(0,X.jsx)(l,{state:b.state,entries:L,label:`Actions for ${N}`,onClose:b.close}),g&&(0,X.jsx)(`span`,{className:`code-session-view-hint`,role:`status`,children:`Updating session…`}),v&&(0,X.jsx)(`div`,{id:C,className:`code-session-list-error`,role:`alert`,children:v})]})}function Vt({controller:e,newSessionShortcut:t=Pt}){let[n,r]=(0,k.useState)(``),[a,o]=(0,k.useState)(!1),s=(0,k.useRef)(null);function c(){a?(o(!1),r(``)):(o(!0),queueMicrotask(()=>s.current?.focus()))}let l=(0,k.useId)(),[u,d]=(0,k.useState)(It);function f(e){d(e);try{localStorage.setItem(Ft,e)}catch{}}let[p,m]=(0,k.useState)(null),[h,g]=(0,k.useState)(!1),_=(0,k.useRef)(!1),v=e.sessions.filter(e=>`${e.title??``} ${e.cwd} ${G[e.provider]}`.toLowerCase().includes(n.toLowerCase())),y=e.sessions.some(t=>t.sessionId!==e.selectedId&&Dt(t)),b=v.filter(e=>e.archivedAt===null&&e.pinnedAt!==null).sort(Ct),x=v.filter(e=>e.archivedAt===null&&e.pinnedAt===null),S=v.filter(e=>e.archivedAt!==null),C=u===`activity`?Mt(x,Date.now(),e.selectedId).map(e=>({key:e.bucket,title:At[e.bucket],cwd:null,sessions:e.sessions})):Ot(x).map(e=>({key:e.cwd,title:e.cwd,cwd:e.cwd,sessions:e.sessions}));b.length&&C.unshift({key:`pinned`,title:`Pinned`,cwd:null,sessions:b}),S.length&&C.push({key:`archived`,title:`Archived`,cwd:null,sessions:wt(S).flatMap(e=>e.sessions)});let w=e.newSession;(0,k.useEffect)(()=>{function e(e){e.detail===`newCodeSession`&&w()}return document.addEventListener(`jaw:shortcut-action`,e),()=>document.removeEventListener(`jaw:shortcut-action`,e)},[w]);async function T(t){if(e.newSession(),e.hasUnsentDraft)m(`Send or clear the current draft before choosing another workspace.`);else if(e.selectedId===null&&e.pending)m(`Wait for the current change to finish before choosing another workspace.`);else{m(null);try{await e.setSelection({cwd:t})}catch(e){m(e instanceof Error?e.message:String(e))}}}async function E(){if(!_.current){_.current=!0,g(!0),m(null);try{await e.loadMoreSessions()}catch(e){m(e instanceof Error?e.message:String(e))}finally{_.current=!1,g(!1)}}}return(0,X.jsxs)(`nav`,{className:`code-session-list`,"aria-label":`Code sessions`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`code-session-new-primary${e.selectedId===null?` active`:``}`,"aria-current":e.selectedId===null?`true`:void 0,"aria-label":`New Code session`,"aria-describedby":e.hasUnsentDraft?l:void 0,title:`Start a new session (${i(t)})`,onClick:e.newSession,children:[(0,X.jsx)(zt,{}),(0,X.jsx)(`span`,{className:`code-session-new-label`,children:`New session`}),e.hasUnsentDraft&&(0,X.jsx)(`span`,{id:l,className:`code-session-draft-badge`,children:`Draft`}),(0,X.jsx)(`kbd`,{className:`code-session-new-hint`,"aria-hidden":`true`,children:i(t)})]}),(0,X.jsxs)(`div`,{className:`code-session-list-header`,children:[(0,X.jsx)(`span`,{className:`code-session-list-title`,children:u===`activity`?`Recent activity`:`Projects`}),(0,X.jsxs)(`span`,{className:`code-session-header-actions`,children:[(0,X.jsx)(`button`,{type:`button`,className:`code-session-header-btn code-session-search-btn${a?` active`:``}`,"aria-pressed":a,"aria-label":`Search sessions`,title:`Search sessions`,onClick:c,children:(0,X.jsx)(Rt,{})}),(0,X.jsxs)(`button`,{type:`button`,className:`code-session-header-btn code-session-bell${u===`activity`?` active`:``}`,"aria-pressed":u===`activity`,"aria-label":y?`Recent activity (unread sessions)`:`Recent activity`,title:u===`activity`?`Back to projects`:`Recent activity`,onClick:()=>f(u===`activity`?`projects`:`activity`),children:[(0,X.jsx)(Lt,{}),y&&(0,X.jsx)(`span`,{className:`code-session-unread-dot`,"aria-hidden":`true`})]})]})]}),a&&(0,X.jsxs)(`div`,{className:`code-session-search-row`,children:[(0,X.jsx)(`input`,{ref:s,className:`code-session-search`,type:`search`,"aria-label":`Search loaded sessions`,placeholder:`Search sessions…`,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),c())}}),(0,X.jsx)(`button`,{type:`button`,className:`code-session-archived-btn${e.filter.archived?` active`:``}`,"aria-pressed":e.filter.archived,title:`Include archived sessions`,onClick:()=>e.setFilter({...e.filter,archived:!e.filter.archived}),children:`Archived`})]}),e.loading&&(0,X.jsx)(`div`,{className:`code-session-list-loading`,role:`status`,children:`Loading sessions…`}),C.map(t=>(0,X.jsxs)(`section`,{className:`code-session-group`,children:[t.title&&(0,X.jsxs)(`h3`,{className:`code-session-group-title${t.key===`priority`?` code-session-group-priority`:``}`,title:t.title,children:[(0,X.jsx)(`span`,{children:t.cwd===null?t.title:Nt(t.cwd)}),t.cwd!==null&&(0,X.jsx)(`button`,{type:`button`,className:`code-session-group-new`,"aria-label":`New session in ${t.cwd}`,title:`New session in ${t.cwd}`,onClick:()=>void T(t.cwd),children:`+`})]}),(0,X.jsx)(`ul`,{className:`code-session-list-items`,children:t.sessions.map(t=>(0,X.jsx)(Bt,{session:t,controller:e,view:u},t.sessionId))})]},t.key)),!e.loading&&!v.length&&(0,X.jsx)(`p`,{className:`code-session-list-empty`,children:n?`No loaded sessions match. Clear search or load more.`:`No sessions here. Start a new session above.`}),e.hasMoreSessions&&(0,X.jsx)(`button`,{type:`button`,className:`code-inline-action`,disabled:h,onClick:()=>void E(),children:h?`Loading…`:`Load more sessions`}),(0,X.jsx)(`button`,{type:`button`,className:`code-inline-action`,onClick:()=>{m(null),e.refresh().catch(e=>m(e instanceof Error?e.message:String(e)))},children:`Refresh sessions`}),p&&(0,X.jsx)(`div`,{className:`code-session-list-error`,role:`alert`,children:p})]})}var Ht={"codex-app":{viewBox:`0 0 24 24`,rule:`evenodd`,d:`M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z`},claude:{viewBox:`0 0 24 24`,rule:`evenodd`,d:`M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z`},cursor:{viewBox:`675 357 250 286`,d:`M920.015 424.958L805.919 359.086C802.256 356.97 797.735 356.97 794.071 359.086L679.981 424.958C676.901 426.736 675 430.025 675 433.587V566.419C675 569.981 676.901 573.269 679.981 575.048L794.077 640.92C797.74 643.036 802.261 643.036 805.925 640.92L920.02 575.048C923.1 573.269 925.001 569.981 925.001 566.419V433.587C925.001 430.025 923.1 426.736 920.02 424.958H920.015ZM912.848 438.911L802.706 629.682C801.961 630.968 799.995 630.443 799.995 628.954V504.039C799.995 501.543 798.662 499.234 796.498 497.981L688.321 435.526C687.036 434.781 687.561 432.816 689.05 432.816H909.334C912.462 432.816 914.417 436.206 912.853 438.917H912.848V438.911Z`},grok:{viewBox:`0 0 24 24`,rule:`evenodd`,d:`M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815`}};function Ut({provider:e}){let t=Ht[e];return(0,X.jsx)(`svg`,{className:`code-provider-glyph`,viewBox:t.viewBox,width:`16`,height:`16`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,...t.rule?{fillRule:`evenodd`,clipRule:`evenodd`}:{},children:(0,X.jsx)(`path`,{d:t.d})})}function Wt(){return(0,X.jsx)(`svg`,{viewBox:`0 0 20 20`,width:`16`,height:`16`,"aria-hidden":`true`,focusable:`false`,children:(0,X.jsx)(`path`,{d:`M10 16V4.6M5.2 9.4 10 4.4l4.8 5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Gt(){return(0,X.jsx)(`svg`,{viewBox:`0 0 20 20`,width:`16`,height:`16`,"aria-hidden":`true`,focusable:`false`,children:(0,X.jsx)(`rect`,{x:`6`,y:`6`,width:`8`,height:`8`,rx:`1.6`,fill:`currentColor`})})}function Kt({muted:e}){return(0,X.jsxs)(`svg`,{viewBox:`0 0 20 20`,width:`16`,height:`16`,"aria-hidden":`true`,focusable:`false`,children:[(0,X.jsx)(`path`,{d:`M10 3.6a2 2 0 0 1 2 2v4.2a2 2 0 0 1-4 0V5.6a2 2 0 0 1 2-2ZM5.4 9.6a4.6 4.6 0 0 0 9.2 0M10 14.4V16.4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`}),e&&(0,X.jsx)(`path`,{d:`M4.6 4.6 15.4 15.4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`})]})}function qt(){return(0,X.jsx)(`svg`,{className:`code-footer-check`,viewBox:`0 0 20 20`,width:`16`,height:`16`,"aria-hidden":`true`,focusable:`false`,children:(0,X.jsx)(`path`,{d:`m4.8 10.4 3.3 3.3 7.1-7.4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Jt(){if(typeof MediaRecorder>`u`)return``;for(let e of[`audio/webm;codecs=opus`,`audio/mp4`,`audio/ogg;codecs=opus`])if(MediaRecorder.isTypeSupported(e))return e;return``}function Yt(e){return e.includes(`mp4`)?`.mp4`:e.includes(`ogg`)?`.ogg`:`.webm`}function Xt(e){let t=e?.name;return t===`NotAllowedError`?`Microphone access was denied.`:t===`NotFoundError`?`No microphone was found.`:t===`NotReadableError`||t===`AbortError`?`The microphone is in use by another application.`:e instanceof Error?e.message:`Dictation failed.`}function Zt(e,t){let[n,r]=(0,k.useState)(`unsupported`),[i,a]=(0,k.useState)(null),o=(0,k.useRef)(null),s=(0,k.useRef)(null),c=(0,k.useRef)([]),l=(0,k.useRef)(!0);(0,k.useEffect)(()=>{let e=typeof MediaRecorder<`u`&&typeof navigator<`u`&&!!navigator.mediaDevices?.getUserMedia;return r(e?`idle`:`unsupported`),()=>{l.current=!1,o.current?.state===`recording`&&o.current.stop(),s.current?.getTracks().forEach(e=>e.stop())}},[]);let u=(0,k.useCallback)(async(t,n)=>{r(`transcribing`);try{let r=await fetch(`/api/voice`,{method:`POST`,headers:{"Content-Type":n||`audio/webm`,"X-Voice-Ext":Yt(n),"X-Stt-Only":`true`},body:t}),i=await r.json().catch(()=>null);if(!r.ok)throw Error(i?.error||`Transcription failed (${r.status}).`);let o=i?.text?.trim();if(!l.current)return;o?e(o):a(`Nothing was transcribed.`)}catch(e){l.current&&a(Xt(e))}finally{l.current&&r(`idle`)}},[e]),d=(0,k.useCallback)(()=>{n===`unsupported`||n===`transcribing`||t||(n===`recording`?o.current?.stop():(a(null),(async()=>{let e;try{e=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){a(Xt(e));return}if(!l.current){e.getTracks().forEach(e=>e.stop());return}s.current=e;let t=Jt(),n;try{n=new MediaRecorder(e,t?{mimeType:t}:{})}catch(t){e.getTracks().forEach(e=>e.stop()),a(Xt(t));return}o.current=n,c.current=[],n.ondataavailable=e=>{e.data.size>0&&c.current.push(e.data)},n.onerror=()=>{a(`Recording failed.`)},n.onstop=()=>{e.getTracks().forEach(e=>e.stop()),s.current=null,o.current=null;let n=new Blob(c.current,{type:t||`audio/webm`});c.current=[],l.current&&(n.size===0?(r(`idle`),a(`Nothing was recorded.`)):u(n,t))},n.start(),r(`recording`)})()))},[t,n,u]);return{status:n,reason:n===`unsupported`?`Dictation needs microphone access, which this browser context does not provide.`:n===`recording`?`Stop dictation`:n===`transcribing`?`Transcribing…`:`Dictation`,error:i,toggle:d}}function Qt(e){let t=(0,k.useRef)(!1),n=(0,k.useRef)(!1),r=(0,k.useRef)(!1),[i,a]=(0,k.useState)(null),o=Zt((0,k.useCallback)(t=>{let n=e.inputText;e.onInputChange(n?`${n.replace(/\s+$/,``)} ${t}`:t)},[e.inputText,e.onInputChange]),e.readOnly);async function s(){if(e.canSend&&e.inputText.trim()&&!n.current){n.current=!0,a(null);try{await e.onSubmit()}catch(e){a(e instanceof Error?e.message:String(e))}finally{n.current=!1}}}async function c(){if(e.canStop&&!r.current){r.current=!0,a(null);try{await e.onStop()}catch(e){a(e instanceof Error?e.message:String(e))}finally{r.current=!1}}}function l(e){e.nativeEvent.isComposing||t.current||e.nativeEvent.keyCode===229||e.key!==`Enter`||e.shiftKey||e.altKey||e.ctrlKey||e.metaKey||(e.preventDefault(),s())}return(0,X.jsxs)(`div`,{className:`code-composer`,children:[(0,X.jsxs)(`div`,{className:`code-composer-input-shell`,children:[(0,X.jsx)(`textarea`,{className:`code-composer-input`,"aria-label":`Code prompt`,value:e.inputText,autoFocus:e.autoFocus,onChange:t=>e.onInputChange(t.target.value),onKeyDown:l,onCompositionStart:()=>{t.current=!0},onCompositionEnd:()=>{t.current=!1},placeholder:e.followUpSent?`This turn already has its follow-up. Draft the next message…`:e.followUp?`Send a follow-up while this turn runs…`:e.busy?`Draft a follow-up while this turn runs…`:`Describe a task or ask a question…`,rows:2,readOnly:e.readOnly}),(0,X.jsx)(`span`,{className:`code-composer-hint`,children:`Enter to send · Shift+Enter for a new line`})]}),(0,X.jsxs)(`div`,{className:`code-composer-actions`,children:[(0,X.jsx)(`button`,{type:`button`,className:`code-composer-icon-button${o.status===`recording`?` is-recording`:``}`,"aria-label":o.status===`recording`?`Stop dictation`:`Dictation`,"aria-pressed":o.status===`recording`,disabled:o.status===`unsupported`||o.status===`transcribing`||e.readOnly,title:o.reason,onClick:o.toggle,children:(0,X.jsx)(Kt,{muted:o.status===`unsupported`})}),e.busy&&(0,X.jsx)(`button`,{type:`button`,className:`code-composer-send code-composer-stop`,"aria-label":`Stop current turn`,title:e.stopping?`Stopping`:`Stop current turn`,disabled:!e.canStop||e.stopping,onClick:()=>void c(),children:(0,X.jsx)(Gt,{})}),(!e.busy||e.followUp)&&(0,X.jsx)(`button`,{type:`button`,className:`code-composer-send`,"aria-label":e.busy?`Send follow-up`:`Send prompt`,title:e.steering?`Sending follow-up`:e.pending?`Sending`:e.busy?`Send follow-up`:`Send prompt`,disabled:!e.canSend||!e.inputText.trim(),onClick:()=>void s(),children:(0,X.jsx)(Wt,{})})]}),(e.stopping||e.steering||e.pending||o.status===`recording`||o.status===`transcribing`)&&(0,X.jsx)(`span`,{className:`code-composer-status`,role:`status`,children:e.stopping?`Stopping…`:e.steering?`Sending follow-up…`:e.pending?e.pendingLabel??`Sending…`:o.status===`recording`?`Recording…`:`Transcribing…`}),(i||o.error)&&(0,X.jsx)(`div`,{className:`code-action-error`,role:`alert`,children:i??o.error})]})}function $t(e){if(!e||!Number.isFinite(e.totalTokens)||e.totalTokens<0)return{state:`hidden`};let t=e.modelContextWindow;if(t===null||!Number.isFinite(t)||t<=0)return{state:`counted`,usedTokens:e.totalTokens};let n=Math.round(e.totalTokens/t*100);return{state:`measured`,usedTokens:e.totalTokens,maxTokens:t,percent:Math.min(100,n),over:n>100}}function en(e,t){let n=e/t;return n<10?n.toFixed(1):String(Math.round(n))}function Z(e){if(!Number.isFinite(e)||e<0)return`—`;let t=Math.round(e);if(t<1e3)return String(t);let n=en(t,1e3);return Number(n)<1e3?`${n}k`:`${en(t,1e6)}M`}function tn(e){return e===null||!Number.isFinite(e)||e<0?`—`:e.toLocaleString(`en-US`)}function nn(e){return e===null?`—`:Z(e)}function rn(e){return e>=90?`critical`:e>=75?`high`:`normal`}function an(e){return e.state===`hidden`?``:e.state===`counted`?`Context: ${Z(e.usedTokens)} tokens used, window unknown`:e.over?`Context: over the window, ${Z(e.usedTokens)} of ${Z(e.maxTokens)} tokens`:`Context: ${e.percent}% used, ${Z(e.usedTokens)} of ${Z(e.maxTokens)} tokens`}function on({usage:e}){let t=$t(e),[n,r]=(0,k.useState)(!1),[i,a]=(0,k.useState)(!1),o=n||i,s=(0,k.useId)();if(t.state===`hidden`)return null;let c=an(t),l=t.state===`measured`?t.over?`critical`:rn(t.percent):`normal`,u=2*Math.PI*7,d=t.state===`measured`?t.percent/100*u:0;return(0,X.jsxs)(`div`,{className:`code-context-usage`,onPointerEnter:()=>r(!0),onPointerLeave:()=>r(!1),children:[(0,X.jsxs)(`button`,{type:`button`,className:`code-context-trigger is-${l}`,"aria-label":c,"aria-describedby":o?s:void 0,onFocus:()=>a(!0),onBlur:()=>a(!1),children:[t.state===`measured`?(0,X.jsxs)(`svg`,{className:`code-context-ring`,viewBox:`0 0 18 18`,"aria-hidden":`true`,children:[(0,X.jsx)(`circle`,{className:`code-context-ring-track`,cx:`9`,cy:`9`,r:`7`}),(0,X.jsx)(`circle`,{className:`code-context-ring-fill`,cx:`9`,cy:`9`,r:`7`,strokeDasharray:`${d} ${u}`})]}):null,(0,X.jsx)(`span`,{className:`code-context-value`,children:t.state===`measured`?t.over?`over`:`${t.percent}%`:Z(t.usedTokens)})]}),o&&(0,X.jsxs)(`div`,{id:s,className:`code-context-detail`,role:`note`,children:[(0,X.jsx)(`p`,{className:`code-context-detail-total`,children:t.state===`measured`?`${Z(t.usedTokens)} of ${Z(t.maxTokens)} tokens`:`${Z(t.usedTokens)} tokens used`}),t.state===`measured`&&t.over&&(0,X.jsx)(`p`,{className:`code-context-detail-note`,children:`Past the window the runtime last reported.`}),t.state===`counted`&&(0,X.jsx)(`p`,{className:`code-context-detail-note`,children:`This runtime did not report a context window.`}),(0,X.jsxs)(`dl`,{className:`code-context-breakdown`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Used`}),(0,X.jsx)(`dd`,{children:tn(e?.totalTokens??null)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Input`}),(0,X.jsx)(`dd`,{children:nn(e?.inputTokens??null)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Cached`}),(0,X.jsx)(`dd`,{children:nn(e?.cachedInputTokens??null)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Output`}),(0,X.jsx)(`dd`,{children:nn(e?.outputTokens??null)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Reasoning`}),(0,X.jsx)(`dd`,{children:nn(e?.reasoningOutputTokens??null)})]})]}),e?.processedTokens!=null&&(0,X.jsxs)(`p`,{className:`code-context-detail-note`,children:[`Processed across the conversation: `,Z(e.processedTokens)]})]})]})}function sn({label:e,value:t,options:n,disabled:r,onChange:i,displayValue:a,triggerContent:o,filterable:s,filterPlaceholder:c,className:l,title:u,marker:d}){let f=(0,k.useId)(),p=(0,k.useRef)(null),m=(0,k.useRef)(null),h=(0,k.useRef)(null),[g,_]=(0,k.useState)(null),[v,y]=(0,k.useState)(``),b=n.find(e=>e.value===t),x=(0,k.useMemo)(()=>{let e=v.trim().toLowerCase();return!s||!e?n:n.filter(t=>t.value.toLowerCase().includes(e)||t.label.toLowerCase().includes(e))},[s,n,v]);function S(e=!0){_(null),y(``),e&&p.current?.focus()}function C(){let e=p.current?.getBoundingClientRect();if(!e||r)return;let t=Math.max(192,Math.min(s?340:260,window.innerWidth-28)),n=Math.max(0,e.top-16),i=Math.max(0,window.innerHeight-e.bottom-16),a={left:Math.max(14,Math.min(e.left,window.innerWidth-t-14)),width:t};_(n>=i?{...a,bottom:window.innerHeight-e.top+8,maxHeight:Math.min(288,n)}:{...a,bottom:`auto`,top:e.bottom+8,maxHeight:Math.min(288,i)})}(0,k.useEffect)(()=>{if(!g)return;if(s)h.current?.focus();else{let e=m.current?.querySelectorAll(`button:not(:disabled)`);([...e??[]].find(e=>e.getAttribute(`aria-selected`)===`true`)??e?.[0])?.focus()}let e=e=>{!m.current?.contains(e.target)&&!p.current?.contains(e.target)&&S(!1)},t=()=>S(!1);return document.addEventListener(`pointerdown`,e),window.addEventListener(`resize`,t),()=>{document.removeEventListener(`pointerdown`,e),window.removeEventListener(`resize`,t)}},[g,s]),(0,k.useEffect)(()=>{r&&(_(null),y(``))},[r]);function w(e){if(e.key===`Escape`){e.preventDefault(),S();return}if(e.key===`Tab`){S(!1);return}let t=[...m.current?.querySelectorAll(`button:not(:disabled)`)??[]];if(t.length===0)return;let n=t.findIndex(e=>e===document.activeElement),r;if(e.key===`ArrowDown`)r=(n+1)%t.length;else if(e.key===`ArrowUp`)r=(n-1+t.length)%t.length;else if(e.key===`Home`)r=0;else if(e.key===`End`)r=t.length-1;else return;e.preventDefault(),t[r]?.focus()}let T=`${e}: ${b?.label??a??(t||`not selected`)}${d?`, ${d}`:``}`;return(0,X.jsxs)(`div`,{className:`code-footer-menu${l?` ${l}`:``}`,children:[(0,X.jsxs)(`button`,{ref:p,type:`button`,className:`code-footer-menu-trigger${o?` is-icon`:``}${d?` is-${d===`Not confirmed`?`unknown`:d.toLowerCase()}`:``}`,"aria-label":T,"aria-haspopup":`listbox`,"aria-expanded":!!g,"aria-controls":g?f:void 0,disabled:r,title:u??b?.detail??T,onClick:()=>g?S():C(),onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),C())},children:[o??(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`code-footer-label`,children:e}),(0,X.jsx)(`strong`,{children:b?.label??a??(t||`Not selected`)})]}),d&&(0,X.jsx)(`span`,{className:`code-footer-pending-badge`,children:d})]}),g&&(0,A.createPortal)((0,X.jsxs)(`div`,{ref:m,id:f,role:`listbox`,"aria-label":e,className:`code-footer-dropup code-footer-floating`,style:g,onKeyDown:w,children:[s&&(0,X.jsx)(`input`,{ref:h,type:`text`,className:`code-footer-filter`,value:v,"aria-label":`Filter ${e.toLowerCase()}`,placeholder:c??`Filter…`,onChange:e=>y(e.target.value)}),(0,X.jsxs)(`div`,{className:`code-footer-dropup-list`,children:[x.map(e=>(0,X.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e.value===t,disabled:e.disabled,className:`code-footer-dropup-option`,title:e.detail??e.label,onClick:()=>{i(e.value),S()},children:[e.icon&&(0,X.jsx)(`span`,{className:`code-footer-option-icon`,children:e.icon}),(0,X.jsxs)(`span`,{className:`code-footer-option-text`,children:[(0,X.jsx)(`strong`,{children:e.label}),e.detail&&(0,X.jsx)(`small`,{children:e.detail})]}),e.value===t&&(0,X.jsx)(qt,{})]},e.value)),x.length===0&&(0,X.jsxs)(`p`,{className:`code-footer-dropup-empty`,role:`note`,children:[`No match for “`,v.trim(),`”.`]})]})]}),document.body)]})}function cn({controller:e,onNotice:t}){let n=e.selection,r=e.catalog?.providers.find(e=>e.id===n.provider),i=e.session?.capabilities??r?.capabilities,a=(n.provider===`claude`?r?.capabilities:i)?.permissionModes??[],o=e.selectedId!==null,s=e.creationPending&&(e.settings===null||e.settings.state===`pending`),c=!s&&(e.pending||e.busy||e.creationUnknown||e.operation.kind!==`idle`||o&&(!e.synced||e.session?.status!==`idle`||e.session?.archivedAt!==null))||e.settings!==null&&(!s||e.settings.busy);function l(t){if(e.settings?.fields.some(e=>e.field===t))return e.settings.state===`conflict`?`Conflict`:e.settings.state===`unknown`||e.settings.state===`rejected`?`Not confirmed`:`Pending`}let[u,d]=(0,k.useState)(!1),[f,p]=(0,k.useState)(null),m=(0,k.useRef)(!1),h=(0,k.useRef)(t);h.current=t,(0,k.useEffect)(()=>{n.permissionMode===`auto`?h.current?.({id:`code:permission-mode`,variant:`warning`,message:`Auto (YOLO): actions may run without approval.`,durationMs:1/0}):h.current?.({id:`code:permission-mode`,clear:!0})},[n.permissionMode]);async function g(t){if(!(c||m.current)){m.current=!0,d(!0),p(null);try{await e.setSelection(t)}catch(e){p(e instanceof Error?e.message:String(e))}finally{m.current=!1,d(!1)}}}let _=c||u,v=r?.effortsByModel?.[n.model]??i?.efforts??[],y=e.session?.capabilities.efforts,b=y?v.filter(e=>y.includes(e)):v,x=r?.models??[];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`code-composer-footer`,children:[(0,X.jsx)(sn,{label:`Runtime`,value:n.provider,className:`code-footer-runtime`,disabled:e.creationPending||(o?!e.catalog:_||!e.catalog),triggerContent:(0,X.jsx)(Ut,{provider:n.provider}),title:G[n.provider],options:Object.keys(G).map(t=>{let r=e.catalog?.providers.find(e=>e.id===t);return{value:t,label:o&&t!==n.provider?`New ${G[t]} session`:G[t],disabled:!r?.available||o&&t===n.provider,icon:(0,X.jsx)(Ut,{provider:t}),detail:r?.reason??(r?.available?void 0:`Availability unknown`)}}),onChange:t=>{o?e.setSelection({provider:t}).catch(e=>p(e instanceof Error?e.message:String(e))):g({provider:t})}}),(0,X.jsx)(sn,{label:`Permission`,value:n.permissionMode,displayValue:Oe[n.permissionMode],marker:l(`permissionMode`),disabled:_||!i?.permissions,options:a.map(e=>({value:e,label:Oe[e],detail:ke[e]})),onChange:e=>void g({permissionMode:e})}),(0,X.jsx)(`span`,{className:`code-composer-footer-spacer`,"aria-hidden":`true`}),(0,X.jsx)(on,{usage:e.session?.contextUsage}),(0,X.jsx)(sn,{label:`Model`,value:n.model,className:`code-footer-model`,marker:l(`model`),disabled:_||x.length===0,filterable:!0,filterPlaceholder:`Filter models…`,displayValue:n.model||`Select model`,options:x.map(e=>({value:e,label:e})),onChange:e=>void g({model:e})}),b.length>0&&(0,X.jsx)(sn,{label:`Effort`,value:n.effort??``,marker:l(`effort`),className:`code-footer-effort`,displayValue:n.effort??`Default`,options:[{value:``,label:`Native default`},...b.map(e=>({value:e,label:e}))],disabled:_,onChange:e=>void g({effort:e||null})}),n.provider===`claude`&&(0,X.jsx)(sn,{label:`Thinking`,value:n.thinking===!1?`off`:`on`,marker:l(`thinking`),className:`code-footer-thinking`,options:[{value:`on`,label:`Thinking on`,detail:`Adaptive thinking with summaries`},{value:`off`,label:`Thinking off`,detail:`Answer without extended thinking`}],disabled:_,onChange:e=>void g({thinking:e===`on`})}),o&&(0,X.jsx)(`button`,{type:`button`,className:`code-inline-action`,onClick:e.newSession,children:`New session`})]}),x.length===0&&r?.available&&(0,X.jsxs)(`div`,{className:`code-selection-notice`,children:[`This runtime published no models.`,(0,X.jsx)(`button`,{type:`button`,className:`code-inline-action`,onClick:()=>{e.refresh().catch(e=>p(e instanceof Error?e.message:String(e)))},children:`Refresh catalog`})]}),!r?.available&&(0,X.jsxs)(`div`,{className:`code-selection-notice`,children:[r?.reason??`Runtime availability has not been confirmed.`,(0,X.jsx)(`button`,{type:`button`,className:`code-inline-action`,onClick:()=>{e.refresh().catch(e=>p(e instanceof Error?e.message:String(e)))},children:`Refresh availability`})]}),(u||e.operation.kind===`patching`)&&(0,X.jsx)(`span`,{role:`status`,children:`Saving settings…`}),f&&(0,X.jsx)(`div`,{className:`code-action-error`,role:`alert`,children:f})]})}function ln(e,t=5){let n=new Set,r=[],i=[...e].sort((e,t)=>t.lastUsedAt-e.lastUsedAt||t.createdAt-e.createdAt||e.sessionId.localeCompare(t.sessionId));for(let e of i){let i=e.cwd;if(i.trim()&&!n.has(i)&&(n.add(i),r.push(i),r.length>=t))break}return r}var un=[`Explain this codebase`,`Find and fix a bug`,`Write tests for the module I name`,`Review uncommitted changes`];function dn(){document.querySelector(`textarea[aria-label="Code prompt"]`)?.focus()}function fn({controller:e}){let t=e.selection.cwd,n=e.selectedId!==null||e.pending||e.creationUnknown||e.operation.kind!==`idle`,r=e.workspacePicking,i=ln(e.sessions.filter(e=>e.cwd!==t));function a(){n||r||e.pickWorkspace()}function o(t){n||(e.setSelection({cwd:t}),dn())}return(0,X.jsxs)(`section`,{className:`code-draft-empty`,"aria-label":`New session draft`,children:[(0,X.jsx)(`h2`,{className:`code-draft-empty-title`,children:`New session`}),n?(0,X.jsx)(`span`,{className:`code-workspace-chip`,title:t,children:t||`Workspace not set`}):(0,X.jsx)(`button`,{type:`button`,className:`code-workspace-picker code-draft-empty-picker`,"aria-label":`Choose workspace for the new session`,disabled:r,title:t||`Choose a folder`,onClick:a,children:(0,X.jsx)(`span`,{className:`code-workspace-picker-label`,children:r?`Choosing folder…`:t||`Choose workspace`})}),(0,X.jsxs)(`p`,{className:`code-draft-empty-selection`,children:[G[e.selection.provider],` · `,e.selection.model||`No model selected`]}),i.length>0&&(0,X.jsxs)(`div`,{className:`code-draft-recents`,children:[(0,X.jsx)(`span`,{className:`code-draft-recents-label`,children:`Recent workspaces`}),i.map(e=>(0,X.jsx)(`button`,{type:`button`,className:`code-draft-recent`,title:e,disabled:n,onClick:()=>o(e),children:e},e))]}),!e.input.trim()&&(0,X.jsx)(`div`,{className:`code-draft-prompts`,children:un.map(t=>(0,X.jsx)(`button`,{type:`button`,className:`code-draft-prompt`,disabled:n,onClick:()=>{e.setInput(t),dn()},children:t},t))})]})}function pn({permission:e,operation:t,eligible:n,onAnswer:r}){let i=(0,k.useRef)(!1),[a,o]=(0,k.useState)(!1),[s,c]=(0,k.useState)(null);async function l(a){if(!(!n||i.current||t?.pending)){i.current=!0,o(!0),c(null);try{await r(e,a)}catch(e){c(e instanceof Error?e.message:String(e))}finally{i.current=!1,o(!1)}}}return(0,X.jsxs)(`section`,{className:`code-permission-card`,"aria-label":e.title,children:[(0,X.jsxs)(`div`,{className:`code-permission-title`,children:[(0,X.jsx)(`strong`,{children:e.title}),(0,X.jsx)(`p`,{children:e.detail}),!n&&(0,X.jsx)(`small`,{children:`Updating permission availability…`}),(a||t?.pending)&&(0,X.jsx)(`small`,{role:`status`,children:`Checking decision…`}),(t?.error||s)&&(0,X.jsx)(`div`,{className:`code-action-error`,role:`alert`,children:t?.error||s})]}),(0,X.jsxs)(`div`,{className:`code-permission-actions`,children:[e.options.map(e=>(0,X.jsx)(`button`,{type:`button`,className:`code-permission-btn`,disabled:!n||a||t?.pending,onClick:()=>void l(e.optionId),children:e.label},e.optionId)),e.options.length===0&&(0,X.jsx)(`span`,{children:`No native actions available. Refresh this session.`})]})]})}function mn({permissions:e,operations:t,session:n,synced:r,onAnswer:i}){return e.length?(0,X.jsxs)(`aside`,{className:`code-permissions`,"aria-label":`Pending permissions`,tabIndex:-1,id:`code-pending-permissions`,children:[(0,X.jsxs)(`div`,{className:`code-permissions-heading`,role:`status`,children:[e.length,` pending · `,n?G[n.provider]:`Session updating`]}),e.map(e=>(0,X.jsx)(pn,{permission:e,operation:t[e.permissionId],eligible:r&&n!==null&&n.archivedAt===null&&n.sessionId===e.sessionId&&n.turnId===e.turnId&&n.epoch===e.epoch&&(n.status===`starting`||n.status===`streaming`),onAnswer:i},`${e.sessionId}:${e.permissionId}`))]}):null}var hn=92,gn=6;function _n(e){let[{virtualItems:t,totalSize:n},r]=(0,k.useState)({virtualItems:[],totalSize:0}),i=(0,k.useRef)(null),a=(0,k.useRef)(new Set);i.current||=new y({count:e.count,getScrollElement:()=>e.scrollElementRef.current,estimateSize:e.estimateSize||(()=>hn),overscan:gn,getItemKey:e.getItemKey,indexAttribute:`data-code-transcript-idx`,useAnimationFrameWithResizeObserver:!0,observeElementRect:h,observeElementOffset:g,scrollToFn:_,measureElement:(e,t,n)=>{let r=n.indexFromElement(e);return r>=0&&a.current.add(n.options.getItemKey(r)),v(e,t,n)},onChange:e=>{r({virtualItems:e.getVirtualItems(),totalSize:e.getTotalSize()})}});let o=i.current;return(0,k.useEffect)(()=>o._didMount(),[o]),(0,k.useEffect)(()=>{a.current.clear(),o.measure()},[o,e.resetKey]),(0,k.useEffect)(()=>()=>{i.current=null},[]),(0,k.useLayoutEffect)(()=>{o.setOptions({...o.options,count:e.count,getItemKey:e.getItemKey,estimateSize:e.estimateSize||(()=>hn)}),o._willUpdate(),r({virtualItems:o.getVirtualItems(),totalSize:o.getTotalSize()})},[e.count,e.estimateSize,e.getItemKey,o]),{remeasure:t=>{let n=e.scrollElementRef.current?.querySelector(`[data-code-transcript-idx="${t}"]`);n&&o.measureElement(n)},isMeasured:e=>a.current.has(o.options.getItemKey(e)),scrollOffset:()=>o.scrollOffset??0,restoreAnchor:(e,t)=>{let n=o.getOffsetForIndex(e,`start`);n&&o.scrollToOffset(n[0]+t,{behavior:`auto`})},measureElement:e=>{e&&o.measureElement(e)},virtualItems:t,totalSize:n}}var Q=new Map;function vn(e){return{open:new Map(e.open),anchor:e.anchor?{...e.anchor,successors:e.anchor.successors.slice(0,16)}:null}}function $(e){let t=Q.get(e);return t?(Q.delete(e),Q.set(e,t),vn(t)):{open:new Map,anchor:null}}function yn(e,t){let n=vn({...$(e),...t});for(;n.open.size>64;)n.open.delete(n.open.keys().next().value);Q.delete(e),Q.set(e,n),Q.size>32&&Q.delete(Q.keys().next().value)}var bn=64;function xn({items:e,sessionKey:t,transcriptRef:n,virtual:r,hydrating:i}){let[a,o]=(0,k.useState)(!1),s=(0,k.useRef)(null);if(!s.current||s.current.key!==t){let e=$(t).anchor;s.current={key:t,saved:e,following:e?.following??!0,pending:!!e&&!e.following,userWon:!1,passes:0,stable:0,firstId:``}}let c=s.current,l=(0,k.useRef)({items:e,virtual:r,hydrating:i});l.current={items:e,virtual:r,hydrating:i};let u=(0,k.useCallback)((e,t)=>{if(s.current!==e||e.pending||l.current.hydrating||!l.current.items.length)return;let n=l.current,r=n.virtual.virtualItems.find(e=>e.end>t.scrollTop),i=r?.index??-1,a=n.items[i],o={itemId:a?.itemId??null,offset:r?t.scrollTop-r.start:0,firstSequence:a?.firstSequence??null,successors:i>=0?n.items.slice(i+1,i+17).map(e=>e.itemId):[],following:e.following};e.saved=o,yn(e.key,{anchor:o})},[]),d=(0,k.useCallback)((e,t)=>{e.following=t.scrollHeight-t.scrollTop-t.clientHeight<=bn,o(!e.following),u(e,t)},[u]),f=(0,k.useCallback)(()=>{let e=n.current,t=s.current;e&&t&&(t.pending=!1,t.following=!0,t.userWon=!1,e.scrollTop=e.scrollHeight,o(!1),u(t,e))},[n,u]);return(0,k.useLayoutEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{!c.pending&&!l.current.hydrating&&(c.userWon=!1,d(c,e))},r=()=>{(c.pending||l.current.hydrating)&&(c.userWon=!0),c.pending=!1},i=t=>{t.target===e&&!t.altKey&&!t.ctrlKey&&!t.metaKey&&[`j`,`d`,`k`,`u`,`PageDown`,`PageUp`,`Home`,`End`].includes(t.key)&&r()},a=t=>{t.target===e&&r()};return e.addEventListener(`scroll`,t,{passive:!0}),e.addEventListener(`wheel`,r,{passive:!0}),e.addEventListener(`touchmove`,r,{passive:!0}),e.addEventListener(`keydown`,i),e.addEventListener(`pointerdown`,a),()=>{e.removeEventListener(`scroll`,t),e.removeEventListener(`wheel`,r),e.removeEventListener(`touchmove`,r),e.removeEventListener(`keydown`,i),e.removeEventListener(`pointerdown`,a)}},[c,n,d]),(0,k.useLayoutEffect)(()=>{let e=n.current;if(!e)return;let t=0,r=n=>{if(s.current!==c||l.current.hydrating||!l.current.items.length)return;let i=l.current;if(c.userWon){d(c,e);return}let a=i.items[0]?.itemId??``;if(!c.pending&&!c.following&&c.firstId&&c.firstId!==a&&c.saved&&(c.pending=!0,c.passes=0,c.stable=0),c.firstId=a,c.following){e.scrollTop=e.scrollHeight,u(c,e),o(!1);return}if(!c.pending||!c.saved)return;let f=c.saved,p=i.items.findIndex(e=>e.itemId===f.itemId);if(p<0&&f.firstSequence!==null&&(p=i.items.findIndex(e=>e.firstSequence!==void 0&&e.firstSequence>f.firstSequence)),p<0&&(p=f.successors.map(e=>i.items.findIndex(t=>t.itemId===e)).find(e=>e>=0)??-1),p<0){c.pending=!1,c.following=!0,e.scrollTop=e.scrollHeight,u(c,e),o(!1);return}i.virtual.restoreAnchor(p,f.offset);let m=i.virtual.virtualItems.find(e=>e.index===p),h=!!m&&i.virtual.isMeasured(p)&&i.virtual.virtualItems.filter(t=>t.start<m.start+e.clientHeight).every(e=>i.virtual.isMeasured(e.index)),g=m?Math.max(0,Math.min(m.start+f.offset,e.scrollHeight-e.clientHeight)):NaN;c.stable=h&&Math.abs(e.scrollTop-g)<=1?c.stable+1:0,n&&c.passes++,c.stable>=2||c.passes>=24?(c.pending=!1,d(c,e)):t=window.requestAnimationFrame(()=>r(!0))};return r(!1),()=>{t&&window.cancelAnimationFrame(t)}},[c,e,r.totalSize,r.virtualItems,i,n,d,u]),{showJump:a,jumpToLatest:f}}var Sn=2e3,Cn=80,wn=400;function Tn(e){return e<=Sn?Cn:Math.min(wn,Math.round(Cn*e/Sn))}function En(e,t=!1,n=``){let[r,i]=(0,k.useState)({text:e,identity:n}),a=(0,k.useRef)(0),o=t||r.identity!==n||!e.startsWith(r.text);return(0,k.useEffect)(()=>{if(r.text===e&&r.identity===n)return;let t=()=>{a.current=Date.now(),i({text:e,identity:n})},s=Tn(e.length)-(Date.now()-a.current);if(o||s<=0){t();return}let c=window.setTimeout(t,s);return()=>window.clearTimeout(c)},[e,n,o,r]),o?e:r.text}var Dn=[[/^(read|read_file|get_file|open_file|view|cat)$/i,`Read`,`Reading`],[/^(write|write_file|create_file|edit|edit_file|apply_patch|str_replace\w*|update_file)$/i,`Edit`,`Editing`],[/^(bash|shell|exec|exec_command|run|run_command|terminal)$/i,`Bash`,`Running`],[/^(search|grep|rg|ripgrep|glob|find|codebase_search)$/i,`Search`,`Searching`],[/^(fetch|browser\w*|web_\w*|open_url|http)$/i,`Open`,`Opening`],[/^(list|ls|list_dir|list_files)$/i,`List`,`Listing`]];function On(e){return e===`running`||e===`pending`}function kn(e,t){let n=e.trim(),r=t.replace(/[\\/]+$/,``)||t;if(r&&n.startsWith(r)&&(/[\\/]$/.test(r)||/^[\\/]/.test(n.slice(r.length)))){let e=n.slice(r.length).replace(/^[\\/]+/,``);if(e)return e}if(n.length<=64)return n;let i=n.split(/[\\/]/).filter(Boolean);return i.length>2?`…/${i.slice(-2).join(`/`)}`:`…${n.slice(-60)}`}function An(e){let t=(e.split(/\r?\n/).find(e=>e.trim())??``).replace(/\s+/g,` `).trim();return t.length>96?`${t.slice(0,95)}…`:t}function jn(e,t){if(!e)return``;let n=e.trim();if(!n)return``;let r=w(n);if(r){for(let e of T){let n=b(r,[e]);if(n!==null)return e===`path`||e===`file`||e===`file_path`?kn(n,t):An(n)}return``}return n.includes(`/`)&&!n.includes(` `)?kn(n,t):An(n)}function Mn(e){let t=E(e).description;return t===null?``:S(t)}function Nn(e){if(e===void 0)return null;let t=E(e),n=null;if(t.object&&t.field===`command`){let e=new Set([...C.command,...D]),r=Object.fromEntries(Object.entries(t.object).filter(([t])=>!e.has(t)));Object.keys(r).length&&(n=JSON.stringify(r,null,2))}let r=t.field===`command`&&t.value!==null;return{content:r?t.value:t.object?x(e):t.value??e,command:r,parameters:n,description:t.description}}function Pn(e,t){let n=On(e.status),r=e.fileChange;if(r){let e=r.changes.length+(r.omittedChanges??0);if(r.schema===`unknown`&&(r.changes.length!==1||r.unrecognizedChanges||r.omittedChanges))return`File change (unrecognized format)`;if(e>1)return`${n?`Editing`:`Edit`} ${e} files`;let i=r.changes[0];return i?`${{add:[`Create`,`Creating`],delete:[`Delete`,`Deleting`],rename:[`Rename`,`Renaming`],update:[`Edit`,`Editing`],unknown:[`Edit`,`Editing`]}[i.kind][+!!n]} ${kn(i.path,t)}${i.kind===`rename`&&i.movePath?` → ${kn(i.movePath,t)}`:``}`:r.schema===`unknown`?`File change (unrecognized format)`:`File change`}if(e.truncation?.reason.includes(`file_change_limit`))return`File change details unavailable`;let i=jn(e.tool?.input,t)||e.tool?.detail||``;return i?`${n?`Editing`:`Edit`} ${i}`:`File change`}function Fn(e,t){let n=On(e.status);if(e.kind===`file_change`)return Pn(e,t);let r=e.tool?.name?.trim()||`Tool`,i=Dn.find(([e])=>e.test(r)),a=i?n?i[2]:i[1]:void 0,o=jn(e.tool?.input,t);return a?o?`${a} ${o}`:a:o?`${r} ${o}`:r}function In(e){return e.kind===`turn_cancelled`||e.status===`cancelled`?`Stopped`:e.kind===`turn_failed`||e.status===`error`?`Failed`:e.status===`running`?`Running`:e.status===`pending`?`Pending`:null}var Ln=(0,k.lazy)(()=>O(()=>import(`./MarkdownRenderer-CYlCMwtr.js`).then(e=>({default:e.MarkdownRenderer})),__vite__mapDeps([0]))),Rn=new Set([`turn_started`,`turn_completed`]),zn=44,Bn=480;function Vn(e){return e.length>1400||e.split(`
|
|
3
|
+
`).length>14}function Hn(e,t,n){let r=e.get(`${t}:${n.itemId}`);return r===void 0?n.status===`error`&&n.kind!==`reasoning`:r}function Un({item:e,identity:t,onOpenLocalFile:n}){let r=En(e.text??``,e.status!==`running`&&e.status!==`pending`,t);return r.trim()?(0,X.jsx)(k.Suspense,{fallback:(0,X.jsx)(`span`,{className:`code-plain-text`,children:r}),children:(0,X.jsx)(Ln,{markdown:r,tableMode:`linear`,tableActions:e.status!==`running`&&e.status!==`pending`,onLocalFileOpen:n})}):(0,X.jsx)(`span`,{className:`code-plain-text`,children:r})}function Wn({item:e,provider:t,sessionKey:n,workingDir:r=``,onOpenLocalFile:i,expanded:a,onExpandedChange:o,onRollback:s,choices:c,onChoiceChange:l,onLayoutChange:u}){let d=e.kind===`tool_call`||e.kind===`file_change`,f=e.kind===`reasoning`,p=e.kind===`assistant_message`,h=e.kind===`user_message`,g=Ie(e),_=In(e),v=e.itemId===Xe,y=a??(e.status===`error`&&e.kind!==`reasoning`),b=e.status===`running`||e.status===`pending`,x=b?null:_,S=d?Mn(e.tool?.input):``,C=d?Nn(e.tool?.input):null,w=[];d&&(C&&w.push({key:`input`,label:`Input`,content:C.content,className:`code-tool-args`,copyable:!0}),C?.parameters&&w.push({key:`params`,label:`Parameters`,content:C.parameters,className:`code-tool-json`,copyable:!1}),C?.description&&w.push({key:`description`,label:`Description`,content:C.description,className:`code-tool-text`,copyable:!1}),e.tool?.output!==void 0&&w.push({key:`output`,label:`Output`,content:e.tool.output,className:`code-tool-output`,copyable:!1}));let T=w.some(e=>Vn(e.content))||e.tool?.detail!==void 0&&Vn(e.tool.detail)||e.text!==void 0&&Vn(e.text),[E,D]=(0,k.useState)(!1),[O,A]=(0,k.useState)(new Map),j=(0,k.useRef)(null),[M,N]=(0,k.useState)(null);(0,k.useEffect)(()=>{N(null)},[T]),(0,k.useEffect)(()=>{if(!y||E)return;let e=j.current?.querySelectorAll(`pre, .code-tool-body > .code-tool-text`);if(!e||e.length===0){N(null);return}let t=[...e],n=t.some(e=>e.scrollHeight>e.clientHeight+2);N(n||t.every(e=>e.scrollHeight===0)&&T)},[y,E,T]);let P=M??T;(0,k.useEffect)(()=>{P||D(!1)},[P]);let[F,I]=(0,k.useState)(!1),L=(0,k.useRef)(null);(0,k.useEffect)(()=>()=>{L.current!==null&&window.clearTimeout(L.current)},[]);let ee=(0,k.useCallback)(()=>{I(!0),L.current!==null&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>{L.current=null,I(!1)},1200)},[]),te=h?`You`:p?G[t]:f?`Reasoning`:e.kind===`turn_started`?`Turn started`:e.kind===`session_runtime`?`Runtime`:e.kind===`permission_request`?`Permission record`:e.kind===`notice`?`Notice`:g;return(0,X.jsxs)(`article`,{className:`code-message code-message-${d?`tool`:p?`assistant`:h?`user`:`system`} is-${e.status}${v?` is-unsent`:``}`,"data-code-item-id":e.itemId,"aria-label":`${te} · ${g}`,children:[d?(0,X.jsxs)(`details`,{className:`code-tool-card code-tool-${e.status}`,open:y,onToggle:t=>o?.(e.itemId,t.currentTarget.open),children:[(0,X.jsxs)(`summary`,{className:`code-tool-summary`,children:[(0,X.jsx)(`span`,{className:`code-tool-chevron`,"aria-hidden":`true`,children:`›`}),(0,X.jsxs)(`span`,{className:`code-tool-summary-text`,children:[(0,X.jsx)(`span`,{className:`code-tool-name${b?` code-tool-name-running`:``}`,children:Fn(e,r)}),S!==``&&(0,X.jsx)(`span`,{className:`code-tool-desc`,children:S})]}),x&&(0,X.jsx)(`span`,{className:`code-tool-status`,children:x})]}),y&&(0,X.jsxs)(`div`,{ref:j,className:`code-tool-body`,"data-expanded":E,children:[e.kind===`file_change`&&e.fileChange&&(0,X.jsxs)(`div`,{className:`code-file-list`,children:[e.fileChange.schema===`unknown`&&(0,X.jsx)(`p`,{className:`code-file-note`,children:`Unrecognized file change format`}),e.fileChange.changes.map((t,n)=>{let i=`${e.itemId}#review:${n}`,a=(c??O).get(i)??!1;return(0,X.jsxs)(`section`,{className:`code-file-entry`,children:[(0,X.jsxs)(`div`,{className:`code-file-path`,children:[(0,X.jsx)(`span`,{className:`code-file-kind`,children:t.kind}),kn(t.path,r),t.movePath&&` → ${kn(t.movePath,r)}`]}),t.patch===`captured`?(0,X.jsxs)(`details`,{className:`code-file-review`,open:a,onToggle:t=>{let n=t.currentTarget.open;n!==a&&(l?l(i,n):A(e=>new Map(e).set(i,n)),u?.(e.itemId))},children:[(0,X.jsx)(`summary`,{children:`Review patch`}),a&&(0,X.jsxs)(X.Fragment,{children:[t.diff===``&&(0,X.jsx)(`span`,{className:`code-file-note`,children:`Empty patch`}),(0,X.jsx)(`pre`,{className:`code-file-diff`,children:t.diff??``})]})]}):(0,X.jsxs)(`p`,{className:`code-file-note`,children:[`Patch `,t.patch===`missing`?`unavailable`:t.patch]})]},n)}),!!e.fileChange.omittedChanges&&(0,X.jsxs)(`p`,{className:`code-file-note`,children:[e.fileChange.omittedChanges,` more files not shown`]})]}),e.kind===`file_change`&&!e.fileChange&&e.truncation?.reason.includes(`file_change_limit`)&&(0,X.jsx)(`p`,{className:`code-file-note code-file-list`,children:`File change details unavailable`}),e.tool?.detail!==void 0&&(0,X.jsx)(`p`,{className:`code-tool-text`,children:e.tool.detail}),w.map(e=>(0,X.jsxs)(`section`,{className:`code-tool-section`,children:[(0,X.jsxs)(`div`,{className:`code-tool-section-head`,children:[(0,X.jsx)(`span`,{className:`code-tool-section-label`,children:e.label}),e.copyable&&(0,X.jsx)(`button`,{type:`button`,className:`code-tool-copy${F?` copied`:``}`,"aria-label":`Copy ${e.label.toLowerCase()}`,onClick:()=>void m(e.content).then(e=>{e.ok&&ee()}),children:F?`Copied`:`Copy`})]}),(0,X.jsx)(`pre`,{className:e.className,children:e.content})]},e.key)),e.text!==void 0&&(0,X.jsx)(`pre`,{className:`code-tool-text`,children:e.text}),b&&e.tool?.output===void 0&&e.tool?.detail===void 0&&(0,X.jsx)(`p`,{className:`code-tool-waiting`,children:`Waiting for output…`}),P&&(0,X.jsx)(`button`,{type:`button`,className:`code-tool-toggle`,"aria-expanded":E,onClick:()=>{D(e=>!e),u?.(e.itemId)},children:E?`Show less`:`Show all`})]})]}):f?(0,X.jsxs)(`details`,{className:`code-thinking`,open:y,onToggle:t=>o?.(e.itemId,t.currentTarget.open),children:[(0,X.jsx)(`summary`,{className:`code-thinking-summary${e.status===`running`?` code-tool-name-running`:``}`,children:e.status===`running`?`Thinking…`:`Reasoning`}),y&&(0,X.jsx)(`div`,{className:`code-thinking-text`,children:e.text})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{className:`code-message-role`,children:[te,p&&e.phase===`commentary`?` · Commentary`:``,_&&` · ${v?`Sending`:_}`,h&&!v&&e.phase===`unknown`&&` · Delivery not confirmed`]}),(0,X.jsx)(`div`,{className:`code-message-text`,children:p?(0,X.jsx)(Un,{item:e,identity:`${n}:${e.itemId}`,onOpenLocalFile:i}):(0,X.jsx)(`span`,{className:`code-plain-text`,children:e.text??e.permission?.title??``})}),e.permission?.detail&&(0,X.jsx)(`p`,{className:`code-plain-text`,children:e.permission.detail}),s&&h&&!v&&(0,X.jsx)(`button`,{type:`button`,className:`code-message-rollback`,onClick:()=>{window.confirm(`Later turns are removed from this conversation. Workspace files are not changed. No prompt is sent.`)&&s(e.itemId)},children:`Roll back conversation to here`})]}),(p||f)&&(e.status===`cancelled`||e.status===`error`)&&(0,X.jsxs)(`span`,{className:`code-partial-label`,children:[`Partial output · `,g]}),e.truncation&&(0,X.jsxs)(`p`,{className:`code-truncation`,role:`note`,children:[`Output truncated: `,e.truncation.storedChars.toLocaleString(),` of `,e.truncation.sourceChars.toLocaleString(),` characters retained.`]})]})}function Gn({items:e,provider:t,sessionKey:n,workingDir:r,loading:i,hasOlderHistory:a,loadOlderHistory:o,permissionCount:s,onOpenLocalFile:c,working:l=!1,rollbackRows:u,onRollback:d}){let f=(0,k.useRef)(null),p=(0,k.useMemo)(()=>e.filter(e=>!Rn.has(e.kind)),[e]),m=(0,k.useRef)(p);m.current=p;let[h,g]=(0,k.useState)(()=>({key:n,rows:$(n).open})),_=h.rows;h.key!==n&&(_=$(n).open,g({key:n,rows:_}));let[v,y]=(0,k.useState)(!1),[b,x]=(0,k.useState)(null),S=(0,k.useRef)(!1),C=p[0]?.itemId,w=(0,k.useCallback)(e=>{let t=m.current[e];return t?`${n}:${t.itemId}`:`${n}:${e}`},[n,C]),T=(0,k.useCallback)(e=>{let t=m.current[e];return t?.kind!==`tool_call`&&t?.kind!==`file_change`&&t?.kind!==`reasoning`?64+Math.min(420,(t?.text?.length??0)/6):t&&Hn(_,n,t)?Bn:zn},[_,n]),E=_n({count:p.length,resetKey:n,scrollElementRef:f,getItemKey:w,estimateSize:T}),{showJump:D,jumpToLatest:O}=xn({items:p,sessionKey:n,transcriptRef:f,virtual:E,hydrating:i||!p.length}),[A,j]=(0,k.useState)({key:n,ids:new Set}),M=(0,k.useCallback)(e=>j(t=>({key:n,ids:new Set([...t.key===n?t.ids:[],e])})),[n]);(0,k.useLayoutEffect)(()=>{if(A.key===n&&A.ids.size){for(let e of A.ids){let t=p.findIndex(t=>t.itemId===e);t>=0&&E.remeasure(t)}j({key:n,ids:new Set})}},[A,n,p,E]);let N=(0,k.useCallback)((e,t)=>{let r=$(n).open;r.get(e)!==t&&(r.delete(e),r.set(e,t),yn(n,{open:r}),g(e=>e.key===n?{key:n,rows:$(n).open}:e))},[n]),P=(0,k.useCallback)((e,t)=>{N(`${n}:${e}`,t),M(e)},[n,N,M]);async function F(){if(!S.current){S.current=!0,y(!0),x(null);try{await o()}catch(e){x({sessionKey:n,message:e instanceof Error?e.message:String(e)})}finally{S.current=!1,y(!1)}}}function I(e){if(e.target!==e.currentTarget||e.altKey||e.ctrlKey||e.metaKey)return;let t=f.current;if(!t)return;let n=Math.max(160,t.clientHeight*.78);[`j`,`d`,`PageDown`].includes(e.key)?(e.preventDefault(),t.scrollBy({top:n,behavior:`auto`})):[`k`,`u`,`PageUp`].includes(e.key)?(e.preventDefault(),t.scrollBy({top:-n,behavior:`auto`})):e.key===`End`?(e.preventDefault(),O()):e.key===`Home`&&(e.preventDefault(),t.scrollTo({top:0,behavior:`auto`}))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`code-transcript-controls`,children:[a&&(0,X.jsx)(`button`,{type:`button`,disabled:v||i,onClick:()=>void F(),children:v?`Loading history…`:`Load older history`}),D&&(0,X.jsx)(`button`,{type:`button`,onClick:O,children:`Jump to latest`}),s>0&&(0,X.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(`code-pending-permissions`)?.focus(),children:[`Jump to permissions (`,s,`)`]}),b?.sessionKey===n&&(0,X.jsx)(`span`,{className:`code-action-error`,role:`alert`,children:b.message})]}),(0,X.jsxs)(`div`,{ref:f,className:`code-transcript`,role:`log`,"aria-label":`Code transcript`,"aria-live":`off`,tabIndex:0,onKeyDown:I,children:[p.length?(0,X.jsx)(`div`,{className:`code-transcript-virtual-spacer`,style:{height:E.totalSize},children:E.virtualItems.map(e=>{let i=p[e.index];return i?(0,X.jsx)(`div`,{ref:E.measureElement,className:`code-transcript-virtual-row`,"data-code-transcript-idx":e.index,style:{transform:`translateY(${e.start}px)`},children:(0,X.jsx)(Wn,{item:i,provider:t,sessionKey:n,workingDir:r,onOpenLocalFile:c,expanded:Hn(_,n,i),onExpandedChange:P,choices:_,onChoiceChange:N,onLayoutChange:M,onRollback:u?.has(i.itemId)?d:void 0})},e.key):null})}):(0,X.jsxs)(`div`,{className:`code-transcript-empty`,children:[(0,X.jsx)(`p`,{children:i?`Loading conversation…`:`Type a prompt below to start this conversation.`}),(0,X.jsxs)(`p`,{className:`code-transcript-cwd`,children:[`Workspace: `,r||`not set`]})]}),l&&p[p.length-1]?.status!==`running`&&(0,X.jsxs)(`div`,{className:`code-transcript-working`,role:`status`,"aria-live":`polite`,children:[(0,X.jsx)(`span`,{className:`code-session-spinner`,"aria-hidden":`true`}),`Working…`]})]})]})}function Kn(e){return Number.isFinite(e.durationMs)&&e.durationMs>0}function qn(e,t){let n=e.find(e=>e.id===t.id),r=e.filter(e=>e.id!==t.id);return r.push({...t,revision:(n?.revision??0)+1}),r.slice(Math.max(0,r.length-3))}function Jn(e,t){let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function Yn(e,t){return`clear`in t?Jn(e,t.id):qn(e,{id:t.id,message:t.message,variant:t.variant,durationMs:t.durationMs??4e3})}function Xn({toast:e,onDismiss:t}){let[n,r]=(0,k.useState)(!1),i=(0,k.useRef)(null);return(0,k.useEffect)(()=>{if(n||!Kn(e))return;let r=setTimeout(()=>t(e.id),e.durationMs);return()=>clearTimeout(r)},[e.id,e.revision,e.durationMs,t,n]),(0,X.jsxs)(`div`,{ref:i,className:`code-toast code-toast-${e.variant}`,onPointerEnter:()=>r(!0),onPointerLeave:()=>r(!1),onFocusCapture:()=>r(!0),onBlurCapture:e=>{i.current?.contains(e.relatedTarget)||r(!1)},children:[(0,X.jsx)(`span`,{className:`code-toast-message`,children:e.message}),(0,X.jsx)(`button`,{type:`button`,className:`code-toast-dismiss`,"aria-label":`Dismiss notice`,onClick:()=>t(e.id),children:`×`})]})}function Zn({toasts:e,onDismiss:t}){return(0,X.jsx)(`div`,{className:`code-toast-host`,children:(0,X.jsx)(`div`,{className:`code-toast-region`,role:`status`,children:e.map(e=>(0,X.jsx)(Xn,{toast:e,onDismiss:t},e.id))})})}function Qn({controller:e}){let t=e.session?.cwd??e.selection.cwd,n=e.selectedId!==null||e.pending||e.creationUnknown||e.operation.kind!==`idle`,r=e.workspacePicking;function i(){n||r||e.pickWorkspace()}return(0,X.jsxs)(`header`,{className:`code-workspace-header`,children:[(0,X.jsxs)(`div`,{className:`code-session-header`,children:[(0,X.jsx)(`span`,{className:`code-session-title`,children:e.session?.title||(e.selectedId?`Untitled session`:`New session draft`)}),(0,X.jsx)(`span`,{children:G[e.session?.provider??e.selection.provider]}),(0,X.jsxs)(`span`,{role:`status`,children:[e.session?Ae[e.session.status]:e.creationUnknown?`Creation unconfirmed`:e.operation.kind===`creating`?`Creating session`:`Draft`,e.session?.archivedAt!==null&&e.session?` · Archived`:``]})]}),(0,X.jsxs)(`div`,{className:`code-workspace-primary`,children:[n?(0,X.jsx)(`span`,{className:`code-workspace-chip`,title:t,children:t||`Workspace not set`}):(0,X.jsx)(`button`,{type:`button`,className:`code-workspace-picker`,"aria-label":`Choose Code workspace`,disabled:r,title:t||`Choose a folder`,onClick:i,children:(0,X.jsx)(`span`,{className:`code-workspace-picker-label`,children:r?`Choosing folder…`:t||`Choose workspace`})}),e.gitInfo?.isRepo&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{className:`code-workspace-pill`,children:[e.gitInfo.branch??`detached`,e.gitInfo.head?` · ${e.gitInfo.head}`:``]}),e.gitInfo.status&&(0,X.jsx)(`span`,{className:`code-workspace-pill${e.gitInfo.status.dirty?` is-dirty`:``}`,children:e.gitInfo.status.dirty?`${e.gitInfo.status.changed} changed · ${e.gitInfo.status.untracked} untracked`:`clean`})]})]})]})}var $n={model:`Model`,effort:`Effort`,permissionMode:`Permission`,thinking:`Thinking`};function er(e){return e==null?`Default`:typeof e==`boolean`?e?`On`:`Off`:e}function tr({controller:e,endpointKey:t,onOpenLocalFile:n}){let r=`${t}:${e.selectedId??`new`}`,[i,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(null),c=(0,k.useRef)(new Set),[l,u]=(0,k.useState)([]),d=(0,k.useCallback)(e=>{u(t=>Yn(t,e))},[]),f=(0,k.useCallback)(e=>u(t=>Jn(t,e)),[]),p=e.session?.archivedAt!=null,m=e.session?.status===`stopping`||e.operation.kind===`stopping`,h=e.busy||e.working||m||!!e.restoring||e.session?.status===`starting`||e.session?.status===`streaming`,g=e.catalog?.providers.find(t=>t.id===e.selection.provider),_=e.operation.kind===`unknown-send`,v=e.settings===null&&!e.steering&&(e.followUp?!e.followUpSent&&!m&&!e.pending&&!p&&e.operation.kind===`idle`:!h&&!e.pending&&!e.creationUnknown&&!p&&e.operation.kind===`idle`&&!!g?.available&&!!e.selection.cwd.trim()&&!!e.selection.model.trim()&&(e.selectedId===null||e.synced&&(e.session?.status===`idle`||!!e.session&&Ne(e.session)))),y=(Le(e.session)||!!e.restoring)&&h&&!m,b=!!e.session&&Ne(e.session)&&e.synced&&!e.pending&&!_,x=e.operation.error||e.error||(i?.key===r?i.message:null),S=Pe(e.session,e.synced,e.operation.kind===`idle`&&!e.steering)?Fe(e.items,e.session?.rollback?.sinceSequence):void 0,C=[...e.items].reverse().find(e=>e.kind===`turn_cancelled`||e.kind===`turn_failed`||e.kind===`turn_completed`),w=C&&C.kind!==`turn_completed`?e.items.find(e=>e.kind===`user_message`&&e.turnId===C.turnId)?.text:void 0;function T(e){a(null),e().catch(e=>a({key:r,message:e instanceof Error?e.message:String(e)}))}async function E(){if(e.settings===null&&e.canRetrySameSend&&!c.current.has(r)){c.current.add(r),s(r),a(null);try{await e.retrySameSend()}catch(e){a({key:r,message:e instanceof Error?e.message:String(e)})}finally{c.current.delete(r),s(e=>e===r?null:e)}}}return(0,X.jsxs)(`div`,{className:`code-canvas-main`,children:[(0,X.jsx)(Qn,{controller:e},r),(e.transport!==`connected`||e.selectedId!==null&&!e.synced)&&(0,X.jsxs)(`section`,{className:`code-transport-status is-${e.transport}`,role:`status`,children:[e.transport===`reconnecting`?`Live updates reconnecting. History may be out of date.`:e.transport===`disconnected`?`Live updates disconnected. History may be out of date.`:`Updating conversation…`,(0,X.jsx)(`button`,{type:`button`,onClick:()=>T(e.refresh),children:`Refresh`})]}),x&&(0,X.jsxs)(`section`,{className:`code-recovery-strip`,role:`alert`,children:[(0,X.jsx)(`p`,{children:x}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>T(e.refresh),children:`Refresh session`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>{e.clearError(),a(null)},children:`Dismiss`})]}),e.creationUnknown&&(0,X.jsxs)(`section`,{className:`code-recovery-strip`,"aria-label":`Unconfirmed session creation`,children:[(0,X.jsx)(`strong`,{children:`Session creation not confirmed`}),(0,X.jsx)(`p`,{children:`The original session may still exist.`}),(0,X.jsx)(`p`,{children:`Your draft and choices are kept. Press Send when you are ready to create another session.`}),(0,X.jsx)(`button`,{type:`button`,onClick:e.startAnotherSession,children:`Start another session`})]}),_&&(0,X.jsxs)(`section`,{className:`code-recovery-strip`,"aria-label":e.resendRequired?e.resendReason===`rolled-back`?`Send rolled back`:`Send not started`:`Unconfirmed send`,children:[(0,X.jsx)(`strong`,{children:e.resendRequired?Me(e.resendReason??void 0).heading:`Send outcome not confirmed`}),(0,X.jsx)(`p`,{children:e.resendRequired?Me(e.resendReason??void 0).detail:`Retry uses the original request. It may submit it if the server has not already accepted it.`}),(0,X.jsx)(`pre`,{className:`code-retry-preview`,"aria-label":`Original prompt`,children:e.retryText}),(0,X.jsx)(`button`,{type:`button`,disabled:e.settings!==null||!e.canRetrySameSend||o===r,onClick:()=>void E(),children:o===r?e.resendRequired?`Sending as a new message…`:`Retrying original send…`:e.resendRequired?`Send as a new message`:`Retry same send`})]}),p?(0,X.jsxs)(`section`,{className:`code-recovery-strip`,children:[(0,X.jsx)(`span`,{children:`Archived · Read-only history`}),(0,X.jsx)(`button`,{type:`button`,disabled:!e.synced||e.pending,onClick:()=>{let t=e.selectedId;t&&T(()=>e.archive(t,!1))},children:`Restore session`})]}):e.session&&(e.session.status===`failed`||e.session.status===`suspended`)&&(0,X.jsxs)(`section`,{className:`code-recovery-strip`,role:`status`,children:[(0,X.jsx)(`p`,{children:e.session.error?.message??`Native session suspended.`}),b?(0,X.jsx)(`button`,{type:`button`,onClick:()=>T(e.resume),children:`Resume session`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:e.session.resume.reason??`Resume is not currently available.`}),(0,X.jsx)(`button`,{type:`button`,onClick:e.newSession,children:`New session`})]})]}),(0,X.jsx)(Zn,{toasts:l,onDismiss:f}),e.selectedId===null&&e.items.length===0?(0,X.jsx)(fn,{controller:e}):(0,X.jsx)(Gn,{items:e.items,provider:e.session?.provider??e.selection.provider,sessionKey:r,workingDir:e.session?.cwd??e.selection.cwd,loading:e.loading,hasOlderHistory:e.hasOlderHistory,loadOlderHistory:e.loadOlderHistory,permissionCount:e.permissions.length,onOpenLocalFile:n,working:e.working,rollbackRows:S,onRollback:t=>T(()=>e.rollbackSession(t))}),(0,X.jsx)(mn,{permissions:e.permissions,operations:e.permissionOperations,session:e.session,synced:e.synced,onAnswer:e.answer}),(0,X.jsxs)(`div`,{className:`code-composer-dock`,children:[w!==void 0&&!h&&!p&&(0,X.jsxs)(`div`,{className:`code-input-recovery`,children:[(0,X.jsx)(`button`,{type:`button`,disabled:!!e.input||_,title:e.input?`Keep or clear your current draft before restoring the submitted prompt`:void 0,onClick:()=>e.setInput(w),children:`Restore submitted prompt`}),(0,X.jsx)(`span`,{children:`Restores text for editing without sending.`})]}),e.settings&&(0,X.jsxs)(`section`,{className:`code-recovery-strip code-settings-strip`,"aria-label":`Settings changes`,role:e.settings.state===`unknown`||e.settings.state===`rejected`||e.settings.state===`conflict`?`alert`:`status`,children:[e.settings.state===`pending`&&e.settings.waitingForSession&&(0,X.jsx)(`p`,{children:`Settings will apply when the session is confirmed`}),(e.settings.state===`sent`||e.settings.state===`pending`&&!e.settings.waitingForSession&&e.settings.busy)&&(0,X.jsx)(`p`,{children:`Applying settings…`}),e.settings.state===`pending`&&!e.settings.waitingForSession&&!e.settings.busy&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{children:`These settings are not applied yet. Your messages wait until they are.`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>T(e.reapplySettings),children:`Apply settings`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>T(e.discardSettings),children:`Discard`})]}),e.settings.state===`unknown`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{children:`The settings change may or may not have applied. It will never be resent automatically.`}),e.settings.expired&&(0,X.jsx)(`p`,{children:`The recorded outcome has expired.`}),(0,X.jsx)(`button`,{type:`button`,disabled:e.settings.busy,onClick:()=>T(e.checkSettings),children:`Check again`}),(0,X.jsx)(`button`,{type:`button`,disabled:e.settings.busy,onClick:()=>T(e.reapplySettings),children:`Re-apply`}),(0,X.jsx)(`button`,{type:`button`,disabled:e.settings.busy,onClick:()=>T(e.discardSettings),children:`Discard`})]}),e.settings.state===`rejected`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{children:e.settings.error??`The settings change was rejected.`}),(0,X.jsx)(`button`,{type:`button`,disabled:e.settings.busy,onClick:()=>T(e.reapplySettings),children:`Re-apply`}),(0,X.jsx)(`button`,{type:`button`,disabled:e.settings.busy,onClick:()=>T(e.discardSettings),children:`Discard`})]}),e.settings.state===`conflict`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`strong`,{children:`Settings conflict`}),e.settings.fields.filter(e=>e.theirs!==void 0).map(t=>(0,X.jsxs)(`div`,{className:`code-settings-conflict`,children:[(0,X.jsxs)(`p`,{children:[$n[t.field],`: yours `,er(t.value),`, now `,er(t.theirs)]}),(0,X.jsxs)(`div`,{role:`group`,"aria-label":`${$n[t.field]} conflict`,children:[(0,X.jsx)(`button`,{type:`button`,disabled:e.settings.busy,"aria-pressed":t.resolution===`mine`,onClick:()=>e.resolveSettingsConflict(t.field,`mine`),children:`Keep mine`}),(0,X.jsx)(`button`,{type:`button`,disabled:e.settings.busy,"aria-pressed":t.resolution===`theirs`,onClick:()=>e.resolveSettingsConflict(t.field,`theirs`),children:`Take theirs`})]})]},t.field)),(0,X.jsx)(`button`,{type:`button`,disabled:e.settings.busy||e.settings.fields.some(e=>e.theirs!==void 0&&!e.resolution),onClick:()=>T(e.applyResolvedSettings),children:`Apply`}),(0,X.jsx)(`button`,{type:`button`,disabled:e.settings.busy,onClick:()=>T(e.discardSettings),children:`Discard`})]}),e.settings.error&&e.settings.state!==`rejected`&&(0,X.jsx)(`p`,{children:e.settings.error})]}),(0,X.jsxs)(`div`,{className:`code-composer-surface`,"aria-label":`Code composer controls`,children:[(0,X.jsx)(Qt,{inputText:e.input,canSend:v,busy:h,canStop:y,stopping:m,pending:e.pending,followUp:e.followUp,followUpSent:e.followUpSent,steering:e.steering,readOnly:p,autoFocus:e.selectedId===null,onInputChange:e.setInput,onSubmit:e.send,onStop:e.stop,...e.operation.kind===`rolling-back`?{pendingLabel:`Rolling back conversation…`}:{}},`composer:${r}`),(0,X.jsx)(cn,{controller:e,onNotice:d},`footer:${r}`)]})]})]})}function nr({port:e,workingDir:t,onWorkingDirChange:n,onOpenLocalFile:r,newSessionShortcut:i}){let a=bt({port:e,workingDir:t}),[o,s]=(0,k.useState)(null),c=(0,k.useRef)({port:e,id:a.selectedId,cwd:a.selection.cwd});(0,k.useEffect)(()=>{s(document.getElementById(`code-session-sidebar-host`))},[]),(0,k.useEffect)(()=>{let t=c.current,r={port:e,id:a.selectedId,cwd:a.selection.cwd};c.current=r,t.port===e&&t.id===null&&r.id===null&&t.cwd!==r.cwd&&n?.(r.cwd||null)},[e,a.selectedId,a.selection.cwd,n]);let l=(0,X.jsx)(Vt,{controller:a,newSessionShortcut:i},e),u=(0,X.jsx)(tr,{controller:a,endpointKey:String(e),onOpenLocalFile:r},e);return o?(0,X.jsxs)(X.Fragment,{children:[(0,A.createPortal)((0,X.jsx)(`div`,{className:`code-manager-session-navigator-content`,children:l}),o),(0,X.jsx)(`div`,{className:`code-canvas code-canvas-workbench`,children:u})]}):(0,X.jsxs)(`div`,{className:`code-canvas`,children:[(0,X.jsx)(`div`,{className:`code-canvas-sidebar`,children:l}),u]})}export{nr as CodeCanvas};
|