@abelxiaoxing/cadence 2.0.14 → 2.0.16

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.
@@ -1,13 +1,13 @@
1
- import{r as e}from"./rolldown-runtime.js";import{n as t,r as n,t as r}from"./react.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./markdown.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var f=e(n(),1),p=t(),m={"Task created, but its conversation link was not confirmed.":`任务已创建,但与普通对话的关联尚未确认。`,"Workbench projects":`工作台项目`,"Your workbench, your projects":`你的工作台,你的项目`,"No default workspace is created. Open an existing folder to use ordinary conversations and Cadence tasks.":`不会创建默认工作区。打开已有文件夹,即可使用普通对话和 Cadence 任务。`,"Opening a project never starts a task. Switching projects keeps admitted work running in its original directory.":`打开项目不会启动任务。切换项目后,已接纳的工作仍在原目录中继续。`,"Selected project is unavailable. Choose a project explicitly; no directory was reconstructed.":`所选项目不可用,请明确选择项目;未重建任何目录。`,"No projects associated yet.":`尚未关联任何项目。`,"Chat ready":`可以开始对话`,"Conversation capture limit exceeded.":`对话记录已达到容量上限。`,"Start a new conversation; incomplete context is not replayed.":`请新建对话;不会重放不完整的上下文。`,"Current metadata unavailable; showing the active turn only. No state was reconstructed.":`当前对话元数据不可用,仅显示仍在运行的轮次,未重建任何状态。`,"Send unavailable. Check the message limit (16 KiB); observe any pending command before sending again.":`暂时无法发送。请检查消息是否超过 16 KiB;如有待确认的命令,请先观察其结果,不要重复发送。`,Files:`文件`,"File list":`文件列表`,"Workspace panels":`工作区面板`,"Task details":`任务详情`,"Switch working folder":`切换工作文件夹`,"Open working folder":`打开工作文件夹`,"Open this project":`打开此项目`,"Opening project…":`正在打开项目…`,"Folder path":`文件夹路径`,Browse:`浏览`,"Parent folder":`上级文件夹`,"Choose a folder on the service host. Opening reuses or starts that project's independent service; current work keeps running.":`选择服务所在主机上的文件夹。打开时将复用或启动该项目的独立服务,当前工作会继续运行。`,"New conversation":`新对话`,Ordinary:`普通对话`,"Ordinary conversation":`普通对话`,"Cadence task":`Cadence 任务`,"Conversation mode":`对话模式`,"Back to ordinary conversation":`返回普通对话`,"What would you like to work on?":`今天想做些什么?`,"Chat normally, or start with /cadence to prepare a task. Nothing starts until you send.":`直接聊天,或以 /cadence 开头准备任务。发送前不会启动任何工作。`,"Message, or /cadence followed by a task…":`输入消息,或使用 /cadence 描述任务…`,Message:`消息`,Send:`发送`,"Stop response":`停止回复`,"Prepare task":`准备任务`,"Prepare a plan first; Start requires confirmation.":`先准备计划,执行需另行确认 Start。`,"Direct host tools · no Cadence task":`直接使用主机工具 · 不创建 Cadence 任务`,"Conversation turn":`对话轮次`,You:`你`,Tool:`工具`,"Earlier messages":`较早的消息`,"Latest messages":`最新消息`,"Send outcome not yet observed:":`尚未观察到此次发送的结果:`,"Observe this send before sending again. No automatic retry.":`请先观察此次发送的结果,不会自动重试。`,"This turn has no complete continuation context. Start a new conversation; retained messages are preserved.":`此轮没有完整的续聊上下文。请新建对话,已记录的消息会保留。`,Subagents:`子代理`,"Subagent roster unavailable":`暂时无法观察子代理列表`,"Cadence subagents appear here when a task runs.":`Cadence 任务运行时,子代理会显示在这里。`,"Refresh files":`刷新文件`,"Reference {path}":`引用 {path}`,"Copy path {path}":`复制路径 {path}`,"No visible files":`没有可显示的文件`,"Close preview":`关闭预览`,"Bounded listing; narrow the directory to see more.":`列表已达到显示上限,请进入更具体的目录查看。`,"File preview is limited; this is not the complete file.":`文件预览已截断,并非完整内容。`,"Readonly preview · references send paths, not file contents":`只读预览 · 引用只发送路径,不自动注入文件内容`,"Hidden thinking, signatures and media are not retained.":`隐藏思考、签名和媒体内容不予保留。`,"Cadence task workspace":`Cadence 任务工作区`,"Presentation unavailable":`界面无法显示`,"No execution result is inferred. Reconnect to observe the owner; accepted work continues.":`不会推断任何执行结果。重新连接以观察所有者服务;已接受的工作会继续进行。`,"Reload observation":`重新加载观察`,"Build information":`构建信息`,Conversation:`对话`,Details:`详情`,"Back to task":`返回任务`,"Task {id}":`任务 {id}`,"{kind} {id}":`{kind} {id}`,Subagent:`子代理`,"Recorded conversation":`已记录对话`,"Recording details":`记录信息`,"Field details":`原文与复制`,"New activity — update conversation":`有新动态 · 更新对话`,"No retained conversations on this page.":`本页没有已保留的对话。`,"Recent projects":`最近项目`,"This service exposes one project. Opening it never starts work.":`当前服务连接一个项目,打开项目不会启动执行。`,"Running conversations":`运行的对话`,"Conversation history":`历史对话`,"Task conversations":`任务对话与子代理`,Tasks:`任务`,"Recorded views":`已记录视图`,messages:`消息`,tools:`工具`,context:`上下文`,timeline:`时间线`,runs:`运行`,outcomes:`结果`,"Export selected scope":`导出所选范围`,"Copy token-free link":`复制不含令牌的链接`,"Link copy unavailable.":`无法复制链接。`,"Observe current state":`重新观察当前状态`,"Choose owner model":`选择所有者模型`,Model:`模型`,"Return — work continues":`返回——工作继续`,"Return — accepted work continues":`返回——已接受的工作会继续`,Return:`返回`,"Plan / review":`计划 / 审阅`,Plan:`计划`,"Execution and cancellation":`执行与取消`,"Open active task":`打开活动任务`,"Cancel run — request stop":`取消运行——请求停止`,"{message}.":`{message}。`,"Context changed. Observe again and request a fresh confirmation.":`上下文已变化。请重新观察并请求新的确认。`,"Explicit service guidance: {status} / {start}. No service is started by this page.":`显式服务操作:{status} / {start}。本页面不会启动任何服务。`,"Close drawer":`关闭抽屉`,"Task navigation drawer":`任务导航抽屉`,"Plan and review drawer":`计划与审阅抽屉`,"Selected {kind}:":`已选{kind}:`,"· snapshot {seq}.":`· 快照 {seq}。`,"Pages and old outcomes are historical observations, not renewed consent.":`分页内容和旧结果是历史观察,不代表重新授权。`,"Open a task or create one explicitly":`打开一个任务,或显式创建一个`,"Plans, children, checks and human review share one service owner. No chat or discovery activates execution.":`计划、子运行、检查和人工审阅共用一个服务所有者。聊天或浏览不会触发执行。`,"Create task":`创建任务`,"No owner run projection in this snapshot.":`此快照中没有所有者运行视图。`,"No snapshot observed yet; absence is not proof of settlement.":`尚未观察到快照;没有记录不代表已结束。`,"Connection freshness is not execution outcome.":`连接是否最新不代表执行结果。`," · transport {status}":` · 传输:{status}`,"{count} active run":`{count} 个活动运行`,"{count} active runs":`{count} 个活动运行`,"No active runs":`没有活动运行`,"Active roster unavailable; absence is not proof of settlement.":`活动运行列表不可用;没有记录不代表已结束。`,"unbuilt source":`未构建的源码`,"Local browser build: {build}.":`本地浏览器构建:{build}。`,"Shared compatibility: {state}.":`共享兼容性:{state}。`,compatible:`兼容`,"unavailable / mismatch — reload built assets; normal actions disabled":`不可用 / 不匹配——请重新加载构建产物;常规操作已禁用`,"Service unavailable":`服务不可用`,"Task snapshot not observed yet":`尚未观察到任务快照`,"No task selected":`未选择任务`,"Resize left pane":`调整左侧面板宽度`,"Resize right pane":`调整右侧面板宽度`,Detached:`已断开`,"Accepted service work continues. No Cancel was requested.":`已接受的服务工作会继续进行。没有请求取消。`,"Observe command after reconnect:":`重新连接后观察命令:`,"Reconnect as a viewer":`以查看者身份重新连接`,"Current action context unavailable; observe again.":`当前操作上下文不可用;请重新观察。`,"Preflight refused: {code}":`预检被拒绝:{code}`,"Preflight unavailable. No automatic retry.":`预检不可用。不会自动重试。`,"Stop requested; settlement is not yet confirmed.":`已请求停止;尚未确认结束。`,"{code}; cancellation effect {effect}. Observe exact receipt.":`{code};取消效果 {effect}。请观察确切回执。`,"Cancellation effect uncertain. Observe exact receipt.":`取消效果不确定。请观察确切回执。`,"Observation unavailable or detach unconfirmed; explicit re-entry required.":`观察不可用或断开未确认;需要显式重新进入。`,"Observation unavailable.":`观察不可用。`,"Access revoked; explicit token re-entry required.":`访问已被撤销;需要显式重新输入令牌。`,Kind:`类型`,Code:`代码`,"Readonly research":`只读调研`,"Readonly diagnosis":`只读诊断`,Goal:`目标`,"Preview Create (does not Start)":`预览创建(不会启动)`,"Close dialog — no cancellation of accepted work":`关闭对话框——不会取消已接受的工作`,"Close — accepted work is not cancelled":`关闭——不会取消已接受的工作`,"Admission pending/unknown — observe this exact receipt.":`准入待定/未知——请观察这个确切回执。`,"{code}; effect {effect}":`{code};效果 {effect}`,"Uncertain; do not repeat the action.":`结果不确定;请勿重复此操作。`,"Confirm {action}":`确认{action}`,"Access is not consent. This confirmation applies only to the displayed context, once.":`访问权限不等于同意。此确认仅对所显示的上下文生效一次。`,Checkout:`工作副本`,"Working directory":`工作目录`,"Model / API / thinking":`模型 / API / 思考`,"Check environment":`检查环境`,"Service launch environment policy, generation {generation}; no browser environment overlays.":`服务启动环境策略,第 {generation} 代;不叠加浏览器环境。`,Observation:`观察`,"Complete within bounded scope":`在限定范围内完整`,"Incomplete bounded coverage":`限定范围覆盖不完整`,Expires:`过期时间`,"Exact parent check":`确切的父级检查`,"{name}; timeout {timeout} ms; cwd above.":`{name};超时 {timeout} 毫秒;工作目录见上。`,"Readonly proposal only. It will not save itself or dispatch editing.":`仅为只读提案。它不会自行保存,也不会分派编辑。`,"Issues: {issues}":`问题:{issues}`,"Context changed or confirmation expired. Close, observe again and request a new preview.":`上下文已变化或确认已过期。请关闭、重新观察并请求新的预览。`,"Back — no new effect":`返回——不产生新效果`,"Create {kind} task":`创建{kind}任务`,"No Start is included.":`不包含启动。`,"Expected: {output}":`预期产出:{output}`,"Exact proposed graph and identities (not yet committed)":`确切的提议任务图与标识(尚未提交)`,"Exact human review targets":`确切的人工审阅对象`,"Human review only; failures, native exit, stale and not-run checks remain unchanged. Issues acknowledgment: {accepted}.":`仅为人工审阅;失败、原生退出、过期和未运行的检查保持不变。问题确认:{accepted}。`,"Explicit owner-wide choice, only while quiescent. This does not resolve credentials, probe a provider, save a plan or Start work.":`显式的所有者级选择,仅在空闲时可用。它不会解析凭据、探测提供方、保存计划或启动工作。`,"Current: {model}":`当前:{model}`,"No model selected":`未选择模型`,"Exact model / API / thinking":`确切的模型 / API / 思考级别`,"Select explicitly":`请显式选择`,"Catalog capacity exceeded; no partial model list is selectable.":`模型目录超出容量;不能从不完整的列表中选择。`,"{error}. No automatic replacement or retry.":`{error}。不会自动替换或重试。`,"{count} model withheld: its provider or model ID contains a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.":`{count} 个模型未列出:其提供方或模型 ID 包含某个凭据值(例如与提供方名称相同的 apiKey)或控制字符。请让每个凭据值都不与任何提供方或模型 ID 重合;修改 models.json 后需重启服务。`,"{count} models withheld: their provider or model IDs contain a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.":`{count} 个模型未列出:其提供方或模型 ID 包含某个凭据值(例如与提供方名称相同的 apiKey)或控制字符。请让每个凭据值都不与任何提供方或模型 ID 重合;修改 models.json 后需重启服务。`,"Model catalog unavailable ({code}); no model is selectable. No automatic retry.":`模型目录不可用({code});无法选择任何模型。不会自动重试。`,"Choice response unconfirmed; observe catalog before another explicit choice.":`选择的响应未确认;请先观察目录再进行下一次显式选择。`,"Confirm owner model choice":`确认所有者模型选择`,"Command receipt":`命令回执`,Admission:`准入`,Execution:`执行`,"not settled":`未结束`,Publication:`发布`,Run:`运行`,"metadata action":`元数据操作`,"{status}. This observation does not authorize replay.":`{status}。此观察不授权重放。`,"Observe exact receipt":`观察确切回执`,"Conflicting receipt observation refused; prior committed facts preserved.":`冲突的回执观察已被拒绝;之前提交的事实已保留。`,"Retained content fields":`保留的内容字段`,"Showing matches for entity {entity} on this page only. Continue paging for other fields/versions.":`仅显示本页中实体 {entity} 的匹配项。继续翻页可查看其他字段/版本。`,"Omitted source block:":`已省略的源块:`,"{bytes} retained bytes":`保留 {bytes} 字节`,"Inspect complete retained field":`查看完整的保留字段`,"Recording: {observed}; source: {source};":`记录:{observed};来源:{source};`,redacted:`已脱敏`,"no reported redaction":`未报告脱敏`,"; omitted: {omissions}":`;已省略:{omissions}`,". Not a guarantee of complete original source or universal secret detection.":`。不保证原始来源完整,也不保证能检测出所有机密。`,"Reading all retained field pages…":`正在读取所有保留字段页…`,"Copied all retained field bytes (source omissions still apply).":`已复制全部保留字段字节(来源省略仍然适用)。`,"Copied retained field bytes; recording is incomplete. No complete-source claim.":`已复制保留字段字节;记录不完整。不声称来源完整。`,"Clipboard unavailable.":`剪贴板不可用。`,"Full-field copy refused/incomplete.":`完整字段复制被拒绝/不完整。`,"Retained field":`保留字段`,"snapshot {seq}":`快照 {seq}`,"Exact hit bytes [{start}, {end}); only this immutable field is highlighted.":`确切命中字节 [{start}, {end});仅高亮这个不可变字段。`,"Markdown page":`Markdown 页`,"Raw page":`原始页`,"Copy full retained field":`复制完整保留字段`,"Copy canceled; execution unchanged.":`复制已取消;执行不受影响。`,"Cancel copy":`取消复制`,"Detail refused: {error}":`详情被拒绝:{error}`,"Reading…":`读取中…`,"Validation in progress. The retained field is not empty.":`正在验证。该保留字段并非为空。`,"Bytes {start}–{end} of {total}.":`第 {start}–{end} 字节,共 {total} 字节。`,"More retained data available.":`还有更多保留数据。`,"End of field.":`字段结束。`,Previous:`上一页`,"Continue validation":`继续验证`,"Next field page":`下一字段页`,"Read unavailable.":`读取不可用。`,"Exact entity metadata":`确切的实体元数据`,"Reading exact entity version…":`正在读取确切的实体版本…`,"Entity refused: {error}":`实体被拒绝:{error}`,"Entity validation in progress, not missing.":`实体正在验证,并非缺失。`,"Continue exact entity validation":`继续确切的实体验证`,"Exact stored owner and associations":`确切存储的所有者与关联`,"Export retained history":`导出保留历史`,"Selected {kind}: {id} · snapshot {seq}":`已选{kind}:{id} · 快照 {seq}`,Format:`格式`,"NDJSON public archive":`NDJSON 公开归档`,"Readable Markdown with footer metadata":`带页脚元数据的可读 Markdown`,"Includes retained context, messages/tools, graph, lifecycle, changes, checks, human review and coverage beyond loaded pages. Redactions and source omissions remain.":`包括已加载页之外的保留上下文、消息/工具、任务图、生命周期、变更、检查、人工审阅和覆盖范围。脱敏和来源省略仍然保留。`,"A native browser download request cannot establish completion. Inspect the original EOF and completion trailer/counts/digest in the downloaded artifact; missing footer means incomplete. Revoked access may terminate without a trailer.":`浏览器原生下载请求无法证明下载完成。请检查下载文件中的原始 EOF 以及完成尾部/计数/摘要;缺少页脚即表示不完整。访问被撤销时可能在没有尾部的情况下终止。`,"Download requested — completion not verified by this browser UI.":`已请求下载——此浏览器界面未验证是否完成。`,"Download unavailable; no archive claimed complete.":`下载不可用;不声称任何归档完整。`,"Request selected-scope download":`请求下载所选范围`,"Search retained history":`搜索保留历史`,"Case-sensitive literal query":`区分大小写的字面查询`,"Case-sensitive literal UTF-8 search. Scope {kind} {id}; snapshot {seq}. No regex, provider request or history repair.":`区分大小写的 UTF-8 字面搜索。范围:{kind} {id};快照 {seq}。不使用正则,不请求提供方,也不修复历史。`,"Searching bounded retained range…":`正在搜索限定的保留范围…`,"Search refused: {error}":`搜索被拒绝:{error}`,"Enter a query to search this selected scope.":`输入查询以搜索所选范围。`,"Matches on this page: {count}":`本页匹配:{count}`,"bytes {start}–{end}":`字节 {start}–{end}`,"Continue same snapshot search":`在同一快照中继续搜索`,"↑↓ Navigate · Enter Open exact hit · Escape Close. Reopening never resumes execution.":`↑↓ 移动 · Enter 打开确切命中 · Escape 关闭。重新打开不会恢复执行。`,"Search unavailable or invalid; no automatic retry.":`搜索不可用或无效;不会自动重试。`,"Query must be 1–1024 UTF-8 bytes; it was not clipped.":`查询必须为 1–1024 个 UTF-8 字节;未做截断。`,"No hits in this bounded window; search is not finished.":`此限定窗口中没有命中;搜索尚未完成。`,"No hits in the final retained window. Coverage limits above still apply.":`最后的保留窗口中没有命中。上方的覆盖范围限制仍然适用。`,"Immutable admitted graph":`不可变的已准入任务图`,"Graph refused: {error}":`任务图被拒绝:{error}`,"Reading graph…":`正在读取任务图…`,"Graph validation in progress; not an empty graph.":`任务图正在验证;并非空图。`,"Continue graph validation":`继续验证任务图`,"Find on displayed field page":`在当前字段页中查找`," (first 1000 visual highlights)":`(前 1000 处可视高亮)`,"; not whole-history search":`;不是全历史搜索`,"Previous match":`上一个匹配`,"Next match":`下一个匹配`,"Read refused: {error}. Retained state has not been repaired.":`读取被拒绝:{error}。保留状态未被修复。`,"Reading bounded history page…":`正在读取限定的历史页…`,"Snapshot selected":`已选择快照`,"Validating retained history":`正在验证保留历史`,"; continue this exact read. No data page yet.":`;请继续这次确切读取。尚无数据页。`,"Previous page":`上一页`,"Next page":`下一页`,"Observe a new snapshot":`观察新快照`,"End of this retained snapshot (incomplete).":`此保留快照已结束(不完整)。`,"End of this retained snapshot.":`此保留快照已结束。`,"Open retained episode/child details":`打开保留的执行轮次/子运行详情`,"Inspect admitted graph and plan":`查看已准入的任务图与计划`,"Search all retained pages in selected scope":`搜索所选范围内的所有保留页`,"Select a task to inspect plans, checks, changes and review.":`选择一个任务以查看计划、检查、变更和审阅。`,Inspector:`检查器`,plan:`计划`,checks:`检查`,changes:`变更`,review:`审阅`,"Owner metadata is stale.":`所有者元数据已过期。`,"Owner metadata unavailable.":`所有者元数据不可用。`,"Plan proposal unavailable.":`计划提案不可用。`,"Current plan metadata unavailable. Observe again; historical text is not action authority.":`当前计划元数据不可用。请重新观察;历史文本不能作为操作依据。`,"Saved graph proof in progress.":`已保存任务图的证明正在进行。`,"Continue saved graph read":`继续读取已保存的任务图`,"Load observed saved plan into local draft":`将观察到的已保存计划载入本地草稿`,"Current control context unavailable. Historical data is not action authority.":`当前控制上下文不可用。历史数据不能作为操作依据。`,"Captured historical observations":`已捕获的历史观察`,"Human review":`人工审阅`,"Done records human acknowledgment, not execution success or certification. It cannot restart a blocked episode.":`“完成”记录的是人工确认,而非执行成功或认证。它不能重新启动被阻塞的执行轮次。`,"Episode to review":`要审阅的执行轮次`,"Select an observed episode":`选择一个已观察的执行轮次`,"I acknowledge current unresolved issues if present; original results will not be rewritten.":`我确认当前存在的未解决问题;原始结果不会被改写。`,"Preview human review / Done":`预览人工审阅 / 完成`,"Observe current obligations in Checks before requesting review.":`请求审阅前,请先在“检查”中观察当前检查项。`,"Readable plan & decomposition":`可读计划与分解`,"{count} required assignments":`{count} 个必需子任务`,"Preview readonly Generate proposal":`预览只读生成提案`,"Preview Save plan":`预览保存计划`,"Preview Start saved graph":`预览启动已保存的任务图`,"Draft changes never execute. Start uses the saved graph shown in its fresh preview, not unsaved text. Generated proposals never save or start themselves.":`草稿修改永远不会执行。启动使用其最新预览中显示的已保存任务图,而不是未保存的文本。生成的提案不会自行保存或启动。`,"Saved assignments name an old model selection. Reading does not rebind them.":`已保存的子任务指定了旧的模型选择。读取不会重新绑定它们。`,"Explicitly rebind draft to current model (requires new Save)":`将草稿显式重新绑定到当前模型(需要重新保存)`,"Readable plan":`可读计划`,"Read rendered plan":`阅读渲染后的计划`,"checkout writer":`工作副本写入者`,readonly:`只读`,Edit:`编辑`,"Remove draft assignment":`移除草稿子任务`,Purpose:`用途`,Instructions:`指令`,"Expected output":`预期产出`,"Current-episode dependencies (whole final text by default)":`本轮依赖(默认使用完整最终文本)`,"Require complete observation":`要求完整观察`,"Selection: {range}":`选择范围:{range}`,"reviewed UTF-8 bytes {start}–{end}":`已审阅的 UTF-8 字节 {start}–{end}`,"whole final text; no silent clipping":`完整最终文本;不会静默截断`,"Reviewed edge JSON (range/null and exact historical identity)":`已审阅的依赖边 JSON(范围/null 与确切历史标识)`,"Remove edge":`移除依赖边`,"Explicit historical/advisory edge JSON":`显式的历史/参考依赖边 JSON`,"Exact committed run/child/result/version plus range and coverage requirement":`确切的已提交运行/子运行/结果/版本,以及范围和覆盖要求`,"Add reviewed historical edge":`添加已审阅的历史依赖边`,"Discard inline edits":`放弃行内编辑`,"Apply to local draft":`应用到本地草稿`,"Role {role}":`角色 {role}`,"Add assignment":`添加子任务`,"Remove dependent edges explicitly before deleting this assignment.":`删除此子任务前,请先显式移除依赖它的边。`,"Invalid dependency. Original edge retained; review before Save.":`依赖无效。已保留原依赖边;请在保存前审阅。`,"Historical edge requires actual committed identity; no guessed result reference.":`历史依赖边需要真实的已提交标识;不接受猜测的结果引用。`,View:`视图`,"Raw text / lines":`原始文本 / 行`,"Safe Markdown":`安全 Markdown`,"Observed diff":`观察到的 diff`,"Wrap: on":`换行:开`,"Wrap: off":`换行:关`,"Zoom +":`放大 +`,"Zoom −":`缩小 −`,"Captured page only, not a current filesystem read. Line numbers are page-local. Full retained paging and copy are available above.":`仅为捕获的页面,不是对当前文件系统的读取。行号仅在本页内有效。上方提供完整的保留分页和复制。`,"Page headings":`页面标题`,"Select page line {line}":`选择页内第 {line} 行`,"Selected page lines {start}–{end}":`已选页内第 {start}–{end} 行`,"Clear selection":`清除选择`,"Current configured obligations":`当前已配置的检查项`,"Observe obligations":`观察检查项`,"Obligations unavailable: {error}":`检查项不可用:{error}`,"Obligations unavailable.":`检查项不可用。`,"No configured obligations. This is not passing check coverage.":`没有已配置的检查项。这不代表检查已通过。`,"Timeout {timeout} ms. Native outcome and freshness remain separate.":`超时 {timeout} 毫秒。原生结果与是否最新分别记录。`,"Preview exact configured check":`预览确切的已配置检查`,"Browser checks are configured selections only. Native-local manual commands are not a browser shell endpoint.":`浏览器中只能运行已配置的检查。本地原生手动命令不是浏览器 shell 端点。`,"Current checkout changes":`当前工作副本变更`,"Current checkout changes (not a captured historical diff)":`当前工作副本变更(不是捕获的历史 diff)`,"Observe current changes":`观察当前变更`,"Current observation unavailable":`当前观察不可用`,"Fingerprint {identity} · {coverage} · includes pre-existing dirt; not attribution.":`指纹 {identity} · {coverage} · 包含既有的未提交修改;不代表归属。`,"complete within bounded scope":`在限定范围内完整`,"incomplete coverage":`覆盖不完整`,"Captured observations include pre-existing dirt. They do not attribute every change to Cadence; bounded fingerprints are not filesystem snapshots.":`捕获的观察包含既有的未提交修改。它们不会把每处变更都归于 Cadence;限定指纹不是文件系统快照。`,"committed #{seq}":`已提交 #{seq}`,"Inspect full retained {field}":`查看完整保留的{field}`,"Copy displayed text":`复制显示的文本`,"Copy unavailable":`无法复制`,"{state} message record, not execution outcome":`{state}消息记录,不代表执行结果`,Collapse:`收起`,"Inspect message":`查看消息`,"Child {child} · message {message} · version {version}":`子运行 {child} · 消息 {message} · 版本 {version}`,"Result call: {call}. Kept visible independently of the tool card.":`结果对应调用:{call}。独立于工具卡片保持可见。`,"unassociated / orphan":`未关联 / 孤立`,"No finalized text field in this snapshot. Inspect retained partial/final blocks and omission metadata below.":`此快照中没有最终文本字段。请在下方查看保留的部分/最终块以及省略元数据。`,"All message blocks, source limits and tool associations":`全部消息块、来源限制与工具关联`,"Latest on loaded page":`跳到已加载页的最新处`,"No message records on this page; more history remains.":`本页没有消息记录;还有更多历史。`,"No message records on this page.":`本页没有消息记录。`,"SDK tool error observed":`观察到 SDK 工具错误`,"SDK tool end observed":`观察到 SDK 工具结束`,"Start observed; end not observed in this snapshot":`已观察到开始;此快照中未观察到结束`,"No start observed":`未观察到开始`,"Inspect recorded tool call":`查看已记录的工具调用`,"Child {child} · call {call} · v{version}":`子运行 {child} · 调用 {call} · v{version}`,"SDK tool observations are not native process launch/close or passing parent checks.":`SDK 工具观察不代表原生进程的启动/关闭,也不代表父级检查已通过。`,"Source ID":`来源 ID`,unavailable:`不可用`,Declaration:`声明`,"No declaration recorded; orphan result remains accessible":`未记录声明;孤立结果仍可访问`,"Recorded tool end (not parsed from output)":`已记录的工具结束(非从输出解析)`,"No end fact in this snapshot.":`此快照中没有结束事实。`,"historical projection":`历史视图`,"owner projection":`所有者视图`,Lifecycle:`生命周期`,unsettled:`未结束`,"Wait/block reason":`等待/阻塞原因`,"none reported":`未报告`,"Summary publication":`摘要发布`,"Native / recording / parent settlement facts (independent of human review)":`原生 / 记录 / 父级结束事实(独立于人工审阅)`,"No settlement recorded":`未记录结束信息`,"New task":`新建任务`,"No retained task on this page.":`本页没有保留的任务。`,"One checkout owner. Open/history never executes.":`每个工作副本一个所有者。打开或查看历史永远不会执行。`,"Active and recent episodes":`活动与近期执行轮次`,"Runs and assignments":`运行与子任务`,"Toggle assignments":`展开/收起子任务`,"{count} descendants":`{count} 个后代`," / failed child":` / 有失败的子运行`," / unknown child":` / 有未知的子运行`,"No active or recent episode observed.":`未观察到活动或近期的执行轮次。`,"All retained episodes for task":`此任务的全部保留执行轮次`,"Committed order, not wall time. Replay advances visualization only. Raw observations retain clock/sequence provenance; unknown timing is not reconstructed.":`按提交顺序排列,而非真实时间。回放只推进可视化。原始观察保留时钟/序号来源;未知的时间不会被重建。`,"Bundled timeline unavailable; retained events remain accessible, no CDN fallback.":`内置时间线不可用;保留的事件仍可访问,不会回退到 CDN。`,Owner:`所有者`,owner:`所有者`,input:`输入`,model:`模型`,"Committed #{seq}; {who}":`已提交 #{seq};{who}`,"recorded fact":`已记录事实`,"Worker-local monotonic observations ({child}): {first}–{last} ms; not aligned to other workers.":`工作进程本地单调时钟观察({child}):{first}–{last} 毫秒;未与其他工作进程对齐。`,"Owner observation ({epoch}): {ms} ms; clock origin not established by this reader.":`所有者观察({epoch}):{ms} 毫秒;此读取器未确定时钟起点。`,"{scope} — loaded committed page":`{scope}——已加载的提交页`,"Committed sequence {seq}; page ordinal {ordinal}. Timing shown in raw facts only; clocks may not be comparable.":`提交序号 {seq};页内序数 {ordinal}。时间只在原始事实中显示;各时钟可能无法比较。`,task:`任务`,run:`运行`,child:`子运行`,workspace:`工作区`,message:`消息`,tool:`工具`,"final-text":`最终文本`,"tool-args":`工具参数`,"tool-update":`工具更新`,"tool-result":`工具结果`,check:`检查`,user:`用户`,assistant:`助手`,partial:`部分`,final:`最终`,observed:`已观察`,create:`创建`,"generate-plan":`生成计划`,"save-plan":`保存计划`,start:`启动`,research:`调研`,diagnosis:`诊断`,edit:`编辑`,current:`最新`,stale:`已过期`,resync:`重新同步中`,closed:`已关闭`,"accepted-unallocated":`已接受未分配`,active:`活动中`,draining:`排空中`,queued:`排队中`,preparing:`准备中`,running:`运行中`,closing:`收尾中`,settled:`已结束`,completed:`已完成`,failed:`失败`,canceled:`已取消`,timeout:`超时`,unknown:`未知`,blocked:`已阻塞`,pending:`待定`,published:`已发布`,conflict:`冲突`,uncertain:`不确定`,accepted:`已接受`,refused:`已拒绝`,absent:`不存在`,inconclusive:`无定论`,"not-run":`未运行`,passed:`已通过`,complete:`完整`,incomplete:`不完整`,limited:`受限`,binary:`二进制`,"hidden-thinking":`隐藏的思考`,"source-limit":`来源限制`,"capture-limit":`捕获限制`,gap:`缺口`,unsupported:`不支持`,capacity:`容量`,dependency:`依赖`,writer:`写入者`,"parent-stopped":`父级已停止`,"wait-expired":`等待超时`,"handoff-overflow":`交接溢出`,"stale-dependency":`依赖已过期`,quarantine:`隔离`,"incomplete-observation":`观察不完整`,"unrun-checks":`有未运行的检查`,"stale-checks":`有过期的检查`,"failed-checks":`有失败的检查`,"partial-results":`结果不完整`,"recording-incomplete":`记录不完整`,"legacy-context":`旧版上下文`},h=r(),g=`cadence-locale`,_=new Map(Object.entries(m));function v(e,t,n){let r=e===`zh`?_.get(t)??t:t;return n?r.replace(/\{(\w+)\}/g,(e,t)=>Object.hasOwn(n,t)?String(n[t]):e):r}function y({text:e,slots:t}){return e.split(/\{(\w+)\}/).map((e,n)=>n%2==0?e:(0,h.jsx)(f.Fragment,{children:Object.hasOwn(t,e)?t[e]:`{${e}}`},e))}function b(){try{let e=localStorage.getItem(g);if(e===`en`||e===`zh`)return e}catch{}return(typeof navigator>`u`?void 0:navigator.languages?.[0]??navigator.language)?.toLowerCase().startsWith(`zh`)?`zh`:`en`}function x(e,t){return{locale:e,t:(t,n)=>v(e,t,n),tx:t=>v(e,t),setLocale:t}}var S=(0,f.createContext)(x(`en`,()=>{}));function C(){return(0,f.useContext)(S)}function w({initial:e,children:t}){let[n,r]=(0,f.useState)(()=>e??b()),i=(0,f.useMemo)(()=>x(n,e=>{try{localStorage.setItem(g,e)}catch{}r(e)}),[n]);return(0,f.useEffect)(()=>{document.documentElement.lang=n===`zh`?`zh-CN`:`en`,document.title=v(n,`Cadence task workspace`)},[n]),(0,h.jsx)(S.Provider,{value:i,children:t})}var T={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},E=f.createContext&&f.createContext(T),D=[`attr`,`size`,`title`];function ee(e,t){if(e==null)return{};var n,r,i=O(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function O(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},k.apply(null,arguments)}function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function j(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?A(Object(n),!0).forEach(function(t){te(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function te(e,t,n){return(t=M(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function M(e){var t=ne(e,`string`);return typeof t==`symbol`?t:t+``}function ne(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function re(e){return e&&e.map((e,t)=>f.createElement(e.tag,j({key:t},e.attr),re(e.child)))}function N(e){return t=>f.createElement(ie,k({attr:j({},e.attr)},t),re(e.child))}function ie(e){var t=t=>{var n=e.attr,r=e.size,i=e.title,a=ee(e,D),o=r||t.size||`1em`,s;return t.className&&(s=t.className),e.className&&(s=(s?s+` `:``)+e.className),f.createElement(`svg`,k({stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`},t.attr,n,a,{className:s,style:j(j({color:e.color||t.color},t.style),e.style),height:o,width:o,xmlns:`http://www.w3.org/2000/svg`}),i&&f.createElement(`title`,null,i),e.children)};return E===void 0?t(T):f.createElement(E.Consumer,null,e=>t(e))}function ae(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`18`,y1:`6`,x2:`6`,y2:`18`},child:[]},{tag:`line`,attr:{x1:`6`,y1:`6`,x2:`18`,y2:`18`},child:[]}]})(e)}function oe(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2`},child:[]},{tag:`circle`,attr:{cx:`8.5`,cy:`7`,r:`4`},child:[]},{tag:`polyline`,attr:{points:`17 11 19 13 23 9`},child:[]}]})(e)}function se(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`3 6 5 6 21 6`},child:[]},{tag:`path`,attr:{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`},child:[]},{tag:`line`,attr:{x1:`10`,y1:`11`,x2:`10`,y2:`17`},child:[]},{tag:`line`,attr:{x1:`14`,y1:`11`,x2:`14`,y2:`17`},child:[]}]})(e)}function ce(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`},child:[]}]})(e)}function le(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`},child:[]}]})(e)}function ue(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`3`,x2:`9`,y2:`21`},child:[]}]})(e)}function de(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`11`,cy:`11`,r:`8`},child:[]},{tag:`line`,attr:{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`},child:[]}]})(e)}function fe(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`23 4 23 10 17 10`},child:[]},{tag:`polyline`,attr:{points:`1 20 1 14 7 14`},child:[]},{tag:`path`,attr:{d:`M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15`},child:[]}]})(e)}function pe(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`12`,y1:`5`,x2:`12`,y2:`19`},child:[]},{tag:`line`,attr:{x1:`5`,y1:`12`,x2:`19`,y2:`12`},child:[]}]})(e)}function me(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`},child:[]}]})(e)}function he(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`3`,y1:`12`,x2:`21`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`6`,x2:`21`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`18`,x2:`21`,y2:`18`},child:[]}]})(e)}function ge(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`},child:[]},{tag:`polyline`,attr:{points:`16 17 21 12 16 7`},child:[]},{tag:`line`,attr:{x1:`21`,y1:`12`,x2:`9`,y2:`12`},child:[]}]})(e)}function _e(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`8`,y1:`6`,x2:`21`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`8`,y1:`12`,x2:`21`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`8`,y1:`18`,x2:`21`,y2:`18`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`6`,x2:`3.01`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`12`,x2:`3.01`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`18`,x2:`3.01`,y2:`18`},child:[]}]})(e)}function ve(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`},child:[]},{tag:`path`,attr:{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`},child:[]}]})(e)}function ye(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polygon`,attr:{points:`12 2 2 7 12 12 22 7 12 2`},child:[]},{tag:`polyline`,attr:{points:`2 17 12 22 22 17`},child:[]},{tag:`polyline`,attr:{points:`2 12 12 17 22 12`},child:[]}]})(e)}function be(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`line`,attr:{x1:`2`,y1:`12`,x2:`22`,y2:`12`},child:[]},{tag:`path`,attr:{d:`M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z`},child:[]}]})(e)}function xe(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`18`,cy:`18`,r:`3`},child:[]},{tag:`circle`,attr:{cx:`6`,cy:`6`,r:`3`},child:[]},{tag:`path`,attr:{d:`M13 6h3a2 2 0 0 1 2 2v7`},child:[]},{tag:`line`,attr:{x1:`6`,y1:`9`,x2:`6`,y2:`21`},child:[]}]})(e)}function Se(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`6`,y1:`3`,x2:`6`,y2:`15`},child:[]},{tag:`circle`,attr:{cx:`18`,cy:`6`,r:`3`},child:[]},{tag:`circle`,attr:{cx:`6`,cy:`18`,r:`3`},child:[]},{tag:`path`,attr:{d:`M18 9a9 9 0 0 1-9 9`},child:[]}]})(e)}function Ce(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},child:[]}]})(e)}function we(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z`},child:[]},{tag:`polyline`,attr:{points:`13 2 13 9 20 9`},child:[]}]})(e)}function Te(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`},child:[]},{tag:`polyline`,attr:{points:`14 2 14 8 20 8`},child:[]},{tag:`line`,attr:{x1:`16`,y1:`13`,x2:`8`,y2:`13`},child:[]},{tag:`line`,attr:{x1:`16`,y1:`17`,x2:`8`,y2:`17`},child:[]},{tag:`polyline`,attr:{points:`10 9 9 9 8 9`},child:[]}]})(e)}function Ee(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`},child:[]},{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`3`},child:[]}]})(e)}function De(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z`},child:[]}]})(e)}function Oe(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`},child:[]},{tag:`polyline`,attr:{points:`7 10 12 15 17 10`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`15`,x2:`12`,y2:`3`},child:[]}]})(e)}function ke(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,ry:`2`},child:[]},{tag:`rect`,attr:{x:`9`,y:`9`,width:`6`,height:`6`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`1`,x2:`9`,y2:`4`},child:[]},{tag:`line`,attr:{x1:`15`,y1:`1`,x2:`15`,y2:`4`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`20`,x2:`9`,y2:`23`},child:[]},{tag:`line`,attr:{x1:`15`,y1:`20`,x2:`15`,y2:`23`},child:[]},{tag:`line`,attr:{x1:`20`,y1:`9`,x2:`23`,y2:`9`},child:[]},{tag:`line`,attr:{x1:`20`,y1:`14`,x2:`23`,y2:`14`},child:[]},{tag:`line`,attr:{x1:`1`,y1:`9`,x2:`4`,y2:`9`},child:[]},{tag:`line`,attr:{x1:`1`,y1:`14`,x2:`4`,y2:`14`},child:[]}]})(e)}function Ae(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`},child:[]},{tag:`path`,attr:{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`},child:[]}]})(e)}function je(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`polyline`,attr:{points:`12 6 12 12 16 14`},child:[]}]})(e)}function Me(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`18 15 12 9 6 15`},child:[]}]})(e)}function Ne(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`9 18 15 12 9 6`},child:[]}]})(e)}function Pe(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`6 9 12 15 18 9`},child:[]}]})(e)}function Fe(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`20 6 9 17 4 12`},child:[]}]})(e)}function Ie(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`9 11 12 14 22 4`},child:[]},{tag:`path`,attr:{d:`M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11`},child:[]}]})(e)}function Le(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M22 11.08V12a10 10 0 1 1-5.93-9.14`},child:[]},{tag:`polyline`,attr:{points:`22 4 12 14.01 9 11.01`},child:[]}]})(e)}function Re(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`12`,y1:`19`,x2:`12`,y2:`5`},child:[]},{tag:`polyline`,attr:{points:`5 12 12 5 19 12`},child:[]}]})(e)}function ze(e){return N({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`12`,y1:`5`,x2:`12`,y2:`19`},child:[]},{tag:`polyline`,attr:{points:`19 12 12 19 5 12`},child:[]}]})(e)}var Be=`cadence-graph/2`,Ve=`cadence-public-export/2`,P=Object.freeze({controlBytes:1048576,admissionCount:16,admissionBytes:33554432,cancelBytes:65536,headerBytes:8192,wsClientFrameBytes:16384,startWaitMs:1e4,stopWaitMs:6e4,authWaitMs:3e4,authValidityMarginMs:12e4,browserLifetimeMs:432e5,terminateGraceMs:1e3,unconfirmedStopMs:3e3,graphBytes:524288,grantMs:12e4,assignments:16,instructionsBytes:16384,expectedOutputBytes:2048,workerRequestBytes:131072,publicRequestBytes:98304,predecessorBytes:16384,handoffBytes:32768,frameBytes:65536,chunkBytes:8192,detailBytes:33554432,childProtocolBytes:134217728,dataFrames:1e5,controlFrames:256,sdkEvents:1e6,workerQueueBytes:4194304,workerQueueFrames:1024,ownerQueueBytes:8388608,ownerQueueFrames:2048,ownerControlBytes:1048576,ownerControlFrames:256,recordingStallMs:5e3,episodes:8,queuedAssignments:128,childReservations:2,episodeMs:216e5,readyWaitMs:6e5,workerMs:12e5,artifactPartBytes:262144,progressBatchMs:100,progressBatchBytes:262144,segmentBytes:8388608,segmentRecords:4096,checkoutQuotaBytes:10737418240,episodeReservationBytes:536870912,freeSpaceFloorBytes:268435456,episodeControlBytes:1048576,searchReaders:2,exportReaders:2,downloadIdleMs:12e4,pageEntries:50,maxPageEntries:200,pageBytes:524288,detailPageBytes:262144,previewBytes:4096,searchBytes:8388608,searchMs:100,queryBytes:1024,navigationBytes:8192,ringEvents:1024,ringBytes:2097152,viewers:16,viewerMessages:256,viewerBytes:1048576,heartbeatMs:5e3,staleMs:15e3,reconcileMs:3e4}),He=[`invalid`,`oversize`,`unauthenticated`,`forbidden`,`stale`,`conflict`,`corrupt-selected`,`expired-grant`,`consumed-grant`,`unsupported-context`,`quarantine`,`capacity`,`unavailable`,`auth-unavailable`,`recording-exhausted`,`receipt-inconclusive`],F=class extends Error{code;constructor(e=`invalid`){super(e),this.code=e}};function Ue(e,t=`none`){return{code:e,effect:t,recovery:t!==`none`||e===`receipt-inconclusive`?`observe`:[`stale`,`expired-grant`,`consumed-grant`].includes(e)?`fresh-confirmation`:`operator`}}function I(){throw new F}function L(e,t,n=!1){if((typeof e!=`string`||e.includes(`\0`)||/[\uD800-\uDFFF]/u.test(e)||n&&!e.trim())&&I(),We(e)>t)throw new F(`oversize`);return e}function We(e){return new TextEncoder().encode(e).length}function R(e,t=0,n=2**53-1){return(typeof e!=`number`||!Number.isSafeInteger(e)||e<t||e>n)&&I(),e}function z(e){return typeof e!=`boolean`&&I(),e}function B(e,t){return(typeof e!=`string`||!t.includes(e))&&I(),e}function V(e,t){return e!==t&&I(),t}function H(e,t){return e===null?null:t(e)}function U(e,t){(typeof e!=`object`||!e||Array.isArray(e)||![null,Object.prototype].includes(Object.getPrototypeOf(e)))&&I();let n=Reflect.ownKeys(e);(n.length!==t.length||n.some(e=>typeof e!=`string`||!t.includes(e)))&&I();let r=Object.create(null);for(let n of t){let t=Object.getOwnPropertyDescriptor(e,n);(!t||!(`value`in t)||!t.enumerable)&&I(),r[n]=t.value}return r}function W(e,t,n){(!Array.isArray(e)||e.length>t||Reflect.ownKeys(e).length!==e.length+1)&&I();let r=[];for(let t=0;t<e.length;t++){let i=Object.getOwnPropertyDescriptor(e,String(t));(!i||!(`value`in i))&&I(),r.push(n(i.value))}return r}function G(e){let t=L(e,36);return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(t)||I(),t}function K(e){let t=L(e,64);return/^[0-9a-f]{64}$/.test(t)||I(),t}function q(e){let t=L(e,P.controlBytes);return/^(0|[1-9][0-9]*)$/.test(t)||I(),t}function Ge(e,t){return q(e),q(t),e.length===t.length?e===t?0:e<t?-1:1:e.length<t.length?-1:1}function Ke(e){let t=L(e,48);return/^[a-z][a-z0-9-]{0,47}$/.test(t)||I(),t}function J(e,t=P.controlBytes){let n=t,r=e=>{if(n-=We(e),n<0)throw new F(`oversize`);return e};function i(e,n){if(n>64&&I(),e===null||typeof e==`boolean`)return r(String(e));if(typeof e==`string`)return L(e,t),r(JSON.stringify(e));if(typeof e==`number`)return Number.isFinite(e)||I(),r(JSON.stringify(e));if(Array.isArray(e)){let a=W(e,t,e=>e);return r(`[]${`,`.repeat(Math.max(0,a.length-1))}`),`[${a.map(e=>i(e,n+1)).join(`,`)}]`}if(e&&typeof e==`object`){let t=Reflect.ownKeys(e);t.some(e=>typeof e!=`string`)&&I();let a=t.sort(),o=U(e,a);return r(`{}${`,`.repeat(Math.max(0,a.length-1))}`),`{${a.map(e=>`${r(`${JSON.stringify(e)}:`)}${i(o[e],n+1)}`).join(`,`)}}`}return I()}return i(e,0)}function qe(e,t=P.controlBytes){L(e,t);let n=0,r=()=>{for(;/[\x20\t\r\n]/.test(e[n]??`!`);)n++};function i(){let r=n++,i=!1;for(;n<e.length;){let a=e[n++];if(!i&&a===`"`)try{return L(JSON.parse(e.slice(r,n)),t)}catch{return I()}i=!i&&a===`\\`}return I()}function a(t){if(t>64&&I(),r(),e[n]===`"`)return i();if(e[n]===`{`||e[n]===`[`){let o=e[n++]===`{`,s=o?`}`:`]`,c=Object.create(null),l=[],u=new Set;if(r(),e[n]===s)return n++,o?c:l;for(;;){r();let d=``;o&&(e[n]!==`"`&&I(),d=i(),u.has(d)&&I(),u.add(d),r(),e[n++]!==`:`&&I());let f=a(t+1);o?c[d]=f:l.push(f),r();let p=e[n++];if(p===s)break;p!==`,`&&I()}return o?c:l}let o=/^(?:true|false|null|-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?)/.exec(e.slice(n))?.[0];o||I(),n+=o.length;let s=JSON.parse(o);return typeof s==`number`&&!Number.isFinite(s)&&I(),s}let o=a(0);return r(),n!==e.length&&I(),o}function Je(e){let t=U(e,[`code`,`effect`,`recovery`]);return{code:B(t.code,He),effect:B(t.effect,[`none`,`accepted`,`uncertain`]),recovery:B(t.recovery,[`observe`,`fresh-confirmation`,`operator`])}}var Ye=[`plan`,`context`,`message`,`final-text`,`tool-args`,`tool-update`,`tool-result`,`check`,`changes`,`review`],Xe=[`completed`,`failed`,`canceled`,`timeout`,`unknown`,`blocked`],Ze=[`not-launched`,`direct-child-closed`,`unconfirmed`],Qe=[`openai-completions`,`openai-responses`,`openai-codex-responses`,`anthropic-messages`,`google-generative-ai`,`mistral-conversations`,`azure-openai-responses`],$e=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`];function et(e){let t=U(e,[`provider`,`model`,`api`,`thinking`]);return{provider:L(t.provider,128,!0),model:L(t.model,256,!0),api:B(t.api,Qe),thinking:B(t.thinking,$e)}}function tt(e){let{sourceSelectionId:t,...n}=U(e,[`sourceSelectionId`,`provider`,`model`,`api`,`thinking`]);return{sourceSelectionId:G(t),...et(n)}}function nt(e){let t=U(e,[`role`,`sha256`]);return{role:B(t.role,[`design-explorer`,`implementation-worker`,`diagnosis-worker`]),sha256:K(t.sha256)}}function rt(e){return e===`edit`?`implementation-worker`:e===`diagnosis`?`diagnosis-worker`:`design-explorer`}function Y(e){let t=U(e,[`recordId`,`version`,`field`,`bytes`,`sha256`]);return{recordId:G(t.recordId),version:R(t.version,1),field:B(t.field,Ye),bytes:R(t.bytes,0,P.detailBytes),sha256:K(t.sha256)}}function it(e){let t=U(e,[`start`,`end`]),n=R(t.start);return{start:n,end:R(t.end,n+1,P.detailBytes)}}function at(e){let t=U(e,[`source`,`range`,`requireCompleteObservation`]),n=X(t.source),r;if(n===`current`)r={kind:n,assignmentId:Ke(U(t.source,[`kind`,`assignmentId`]).assignmentId)};else{let e=U(t.source,[`kind`,`runId`,`childRunId`,`result`]);V(n,`historical`);let i=Y(e.result);V(i.field,`final-text`),r={kind:`historical`,runId:G(e.runId),childRunId:G(e.childRunId),result:i}}let i=H(t.range,it);return r.kind===`historical`&&i&&i.end>r.result.bytes&&I(),{source:r,range:i,requireCompleteObservation:z(t.requireCompleteObservation)}}function X(e,t=`kind`){(typeof e!=`object`||!e)&&I();let n=Object.getOwnPropertyDescriptor(e,t);return(!n||!(`value`in n))&&I(),L(n.value,64,!0)}function ot(e){J(e,P.graphBytes);let t=U(e,[`schema`,`taskId`,`taskKind`,`taskRevision`,`revision`,`planRevision`,`plan`,`assignments`]),n=Y(t.plan);V(n.field,`plan`);let r=R(t.planRevision,1);n.version!==r&&I();let i={schema:V(t.schema,Be),taskId:G(t.taskId),taskKind:B(t.taskKind,[`code`,`research`,`diagnosis`]),taskRevision:R(t.taskRevision,1),revision:R(t.revision,1),planRevision:r,plan:n,assignments:W(t.assignments,P.assignments,e=>{let t=U(e,[`id`,`purpose`,`instructions`,`expectedOutput`,`role`,`model`,`dependencies`]);return{id:Ke(t.id),purpose:B(t.purpose,[`research`,`diagnosis`,`review`,`edit`]),instructions:L(t.instructions,P.instructionsBytes,!0),expectedOutput:L(t.expectedOutput,P.expectedOutputBytes,!0),role:nt(t.role),model:tt(t.model),dependencies:W(t.dependencies,P.assignments,at)}})};i.assignments.length||I();let a=new Map(i.assignments.map(e=>[e.id,e]));a.size!==i.assignments.length&&I();let o=new Set,s=new Set;function c(e){if(o.has(e.id)&&I(),s.has(e.id))return;o.add(e.id);let t=new Set;for(let n of e.dependencies){let e=J(n.source);if(t.has(e)&&I(),t.add(e),n.source.kind===`current`){let e=a.get(n.source.assignmentId);e||I(),c(e)}}o.delete(e.id),s.add(e.id)}for(let e of i.assignments){if(i.taskKind!==`code`&&e.purpose===`edit`||e.role.role!==rt(e.purpose))throw new F(`forbidden`);c(e)}return i}function st(e){let t=U(e,[`id`,`kind`,`revision`,`identity`,`graphRevision`,`graphIdentity`]),n=H(t.graphRevision,e=>R(e,1)),r=H(t.graphIdentity,K);return n===null!=(r===null)&&I(),{id:G(t.id),kind:B(t.kind,[`code`,`research`,`diagnosis`]),revision:R(t.revision,1),identity:K(t.identity),graphRevision:n,graphIdentity:r}}function ct(e){let t=U(e,[`epoch`,`accessGeneration`,`configRev`,`controlRev`,`workspaceId`,`cwdId`,`model`,`checkEnvGeneration`,`checkoutGeneration`,`observation`,`task`]),n=U(t.observation,[`identity`,`complete`]);return{epoch:G(t.epoch),accessGeneration:R(t.accessGeneration,1),configRev:R(t.configRev,1),controlRev:R(t.controlRev,1),workspaceId:G(t.workspaceId),cwdId:G(t.cwdId),model:tt(t.model),checkEnvGeneration:R(t.checkEnvGeneration,1),checkoutGeneration:R(t.checkoutGeneration),observation:{identity:K(n.identity),complete:z(n.complete)},task:H(t.task,st)}}function lt(e){let t=U(e,[`kind`,`name`,`command`,`timeoutMs`]),n={kind:B(t.kind,[`configured`,`manual`]),name:L(t.name,128,!0),command:L(t.command,4096,!0),timeoutMs:R(t.timeoutMs,100,P.workerMs)},r=/[\x00-\x08\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/u;return(r.test(n.name)||r.test(n.command)||/[\n\t]/.test(n.name)||n.name===`Manual command`)&&I(),n.kind===`manual`&&(n.name!==`Manual`||n.timeoutMs!==12e4)&&I(),n}function ut(e){switch(J(e),X(e)){case`create`:{let t=U(e,[`kind`,`taskKind`,`goal`]);return{kind:`create`,taskKind:B(t.taskKind,[`code`,`research`,`diagnosis`]),goal:L(t.goal,8192,!0)}}case`save-plan`:{let t=U(e,[`kind`,`taskId`,`plan`,`graph`]),n=ot(t.graph),r=G(t.taskId);return n.taskId!==r&&I(),{kind:`save-plan`,taskId:r,plan:L(t.plan,32768),graph:n}}case`generate-plan`:case`start`:return{kind:X(e),taskId:G(U(e,[`kind`,`taskId`]).taskId)};case`check`:{let t=U(e,[`kind`,`taskId`,`check`]);return{kind:`check`,taskId:G(t.taskId),check:lt(t.check)}}case`review`:{let t=U(e,[`kind`,`taskId`,`runId`,`changesIdentity`,`checksRevision`,`acceptIssues`]);return{kind:`review`,taskId:G(t.taskId),runId:G(t.runId),changesIdentity:K(t.changesIdentity),checksRevision:R(t.checksRevision),acceptIssues:z(t.acceptIssues)}}default:return I()}}function dt(e){J(e);let t=U(e,[`expected`,`action`]);return{expected:ct(t.expected),action:ut(t.action)}}function ft(e){J(e);let t=U(e,[`commandId`,`grant`,`expected`,`action`]);return{commandId:G(t.commandId),grant:G(t.grant),expected:ct(t.expected),action:ut(t.action)}}function pt(e){if(J(e),X(e)===`action`){let t=U(e,[`kind`,`expected`,`action`]);return{kind:`action`,expected:ct(t.expected),action:ut(t.action)}}let t=U(e,[`kind`,`epoch`,`runId`]);return V(t.kind,`cancel`),{kind:`cancel`,epoch:G(t.epoch),runId:G(t.runId)}}function mt(e){let t=U(e,[`commandId`,`epoch`,`runId`]);return{commandId:G(t.commandId),epoch:G(t.epoch),runId:G(t.runId)}}function ht(e){J(e);let t=typeof e==`object`&&!!e&&Object.hasOwn(e,`checkEnvironmentPolicy`),n=U(e,[`version`,`action`,`rootLabel`,`cwdLabel`,`readablePlan`,`graph`,`activeRunId`,`issues`,`configuredChecks`,`checksRevision`,`reviewRunId`,...t?[`checkEnvironmentPolicy`]:[]]),r=W(n.configuredChecks,32,lt);return(r.some(e=>e.kind!==`configured`)||new Set(r.map(e=>e.name)).size!==r.length)&&I(),{...t?{checkEnvironmentPolicy:V(n.checkEnvironmentPolicy,`service-launch-ordinary/1`)}:{},configuredChecks:r,checksRevision:R(n.checksRevision),reviewRunId:H(n.reviewRunId,G),version:ct(n.version),action:ut(n.action),rootLabel:L(n.rootLabel,4096,!0),cwdLabel:L(n.cwdLabel,4096,!0),readablePlan:L(n.readablePlan,32768),graph:H(n.graph,ot),activeRunId:H(n.activeRunId,G),issues:W(n.issues,7,e=>B(e,[`incomplete-observation`,`unrun-checks`,`stale-checks`,`failed-checks`,`partial-results`,`recording-incomplete`,`legacy-context`]))}}function gt(e){J(e);let t=U(e,[`grant`,`expiresAt`,`preview`]),n=L(t.expiresAt,24);return(!/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/.test(n)||!Number.isFinite(Date.parse(n))||new Date(n).toISOString()!==n)&&I(),{grant:G(t.grant),expiresAt:n,preview:ht(t.preview)}}function Z(e){let t=U(e,[`observed`,`source`,`redacted`,`omissions`]),n={observed:B(t.observed,[`complete`,`incomplete`]),source:B(t.source,[`complete`,`limited`,`unavailable`]),redacted:z(t.redacted),omissions:W(t.omissions,6,e=>B(e,[`binary`,`hidden-thinking`,`source-limit`,`capture-limit`,`gap`,`unsupported`]))};return(new Set(n.omissions).size!==n.omissions.length||n.observed===`complete`&&n.omissions.some(e=>e===`capture-limit`||e===`gap`))&&I(),n}function _t(e){let t=U(e,[`graphRevision`,`inputs`]),n=0,r=new Set;return{graphRevision:R(t.graphRevision,1),inputs:W(t.inputs,P.assignments,e=>{let t=U(e,[`assignmentId`,`dependencyIndex`,`runId`,`childRunId`,`result`,`range`,`text`,`coverage`]),i=Y(t.result);V(i.field,`final-text`);let a=H(t.range,it);a&&a.end>i.bytes&&I();let o=L(t.text,P.predecessorBytes);if(n+=We(o),n>P.handoffBytes)throw new F(`oversize`);let s=R(t.dependencyIndex,0,P.assignments-1);return r.has(s)&&I(),r.add(s),We(o)!==(a?a.end-a.start:i.bytes)&&I(),{assignmentId:Ke(t.assignmentId),dependencyIndex:s,runId:G(t.runId),childRunId:G(t.childRunId),result:i,range:a,text:o,coverage:Z(t.coverage)}})}}function vt(e){let t=U(e,[`outcome`,`closure`,`exitCode`,`signal`,`durationMs`,`stdin`,`final`,`cleanup`,`capture`]),n={outcome:B(t.outcome,[`completed`,`failed`,`canceled`,`timeout`,`unknown`]),closure:B(t.closure,Ze),exitCode:H(t.exitCode,e=>R(e,-2147483648,4294967295)),signal:H(t.signal,e=>L(e,32,!0)),durationMs:R(t.durationMs),stdin:B(t.stdin,[`delivered`,`failed`,`not-required`]),final:B(t.final,[`valid`,`missing`,`invalid`]),cleanup:B(t.cleanup,[`settled`,`failed`,`unconfirmed`]),capture:Z(t.capture)};return n.closure===`not-launched`&&(n.exitCode!==null||n.signal!==null)&&I(),n.outcome===`completed`&&(n.closure!==`direct-child-closed`||n.exitCode!==0||n.signal!==null||n.stdin!==`delivered`||n.final!==`valid`||n.cleanup!==`settled`||n.capture.observed!==`complete`)&&I(),n}function yt(e){let t=U(e,[`kind`,`id`]);return{kind:B(t.kind,[`task`,`run`,`child`]),id:G(t.id)}}function bt(e){let t=L(e,P.navigationBytes,!0);return/^[\x21-\x7e]+$/.test(t)||I(),t}function xt(e){J(e);let t=U(e,[`storeId`,`scope`,`query`,`snapshotSeq`,`recordId`,`recordVersion`,`field`,`offset`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]),n={storeId:G(t.storeId),scope:yt(t.scope),query:H(t.query,e=>{let t=L(e,P.queryBytes);return t.length||I(),t}),snapshotSeq:q(t.snapshotSeq),recordId:H(t.recordId,G),recordVersion:H(t.recordVersion,e=>R(e,1)),field:H(t.field,e=>B(e,Ye)),offset:R(t.offset),...Object.hasOwn(t,`navigation`)?{navigation:bt(t.navigation)}:{}};return(n.recordId===null!=(n.recordVersion===null)||n.recordId===null!=(n.field===null))&&I(),n}function St(e){let t=U(e,[`disposition`,`value`]),n=B(t.disposition,[`observed`,`unavailable`,`redacted`]),r=Dt(t.value);return n===`observed`!=(r!==null)&&I(),{disposition:n,value:r}}function Ct(e){let t=U(e,[`messageId`,`blockId`]);return{messageId:G(t.messageId),blockId:G(t.blockId)}}function wt(e){let t=X(e);if(t===`message-final`)return{kind:t,messageId:G(U(e,[`kind`,`messageId`]).messageId)};if(t===`context`)return{kind:t,component:B(U(e,[`kind`,`component`]).component,[`request-context`,`request-prompt`,`request-instructions`,`role`,`effective-system`])};if(t===`handoff`){let n=U(e,[`kind`,`dependencyIndex`,`source`]),r=Y(n.source);return V(r.field,`final-text`),{kind:t,dependencyIndex:R(n.dependencyIndex,0,P.assignments-1),source:r}}if(t===`message`){let n=U(e,[`kind`,`messageId`,`blockId`,`index`,`stage`]);return{kind:t,messageId:G(n.messageId),blockId:G(n.blockId),index:R(n.index,0,P.dataFrames),stage:B(n.stage,[`stream`,`final`])}}let n=U(e,[`kind`,`callId`,`blockId`,`index`,`stage`]);return V(t,`tool`),{kind:`tool`,callId:G(n.callId),blockId:G(n.blockId),index:R(n.index,0,P.dataFrames),stage:B(n.stage,[`arguments-partial`,`arguments-final`,`execution-arguments`,`update-snapshot`,`result`])}}function Tt(e){let t=U(e,[`owner`,`field`,`encoding`]),n=wt(t.owner),r=B(t.field,[`context`,`message`,`final-text`,`tool-args`,`tool-update`,`tool-result`]),i=B(t.encoding,[`utf8`,`canonical-json`]);return(r!==(n.kind===`context`||n.kind===`handoff`?`context`:n.kind===`message-final`?`final-text`:n.kind===`message`?`message`:n.stage===`result`?`tool-result`:n.stage===`update-snapshot`?`tool-update`:`tool-args`)||n.kind!==`tool`&&i!==`utf8`||r===`tool-args`&&i!==`canonical-json`&&(n.kind!==`tool`||n.stage!==`arguments-partial`))&&I(),{owner:n,field:r,encoding:i}}function Et(e){let t=U(e,[`owner`,`sourceType`,`mimeType`,`reason`]),n=B(t.sourceType,[`image`,`audio`,`binary`,`hidden-thinking`,`unsupported`]),r=B(t.reason,[`binary`,`hidden-thinking`,`unsupported`]),i=H(t.mimeType,e=>L(e,128,!0));return(r!==(n===`hidden-thinking`?`hidden-thinking`:n===`unsupported`?`unsupported`:`binary`)||i!==null&&(n===`hidden-thinking`||!/^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(i)))&&I(),{owner:wt(t.owner),sourceType:n,mimeType:i,reason:r}}function Dt(e){if(e===null)return null;let t=L(e,128,!0);return/^[a-zA-Z0-9_-]+$/.test(t)||I(),t}function Ot(e){let t=X(e);switch(t){case`ready`:return{kind:t,requestProtocol:V(U(e,[`kind`,`requestProtocol`]).requestProtocol,2)};case`message-start`:{let n=U(e,[`kind`,`messageId`,`role`,`source`,`resultCallId`]),r=B(n.role,[`user`,`assistant`,`tool-result`]),i=H(n.resultCallId,G);return r!==`tool-result`&&i!==null&&I(),{kind:t,messageId:G(n.messageId),role:r,source:St(n.source),resultCallId:i}}case`message-text`:{let n=U(e,[`kind`,`messageId`,`blockId`,`detailId`]);return{kind:t,...Ct({messageId:n.messageId,blockId:n.blockId}),detailId:G(n.detailId)}}case`message-end`:{let n=U(e,[`kind`,`messageId`,`finalDetailId`,`finalBlockCount`,`stopReason`]);return{kind:t,messageId:G(n.messageId),finalDetailId:H(n.finalDetailId,G),finalBlockCount:R(n.finalBlockCount,0,P.dataFrames),stopReason:B(n.stopReason,[`stop`,`length`,`toolUse`,`error`,`aborted`,`unknown`])}}case`call-declaration`:{let n=U(e,[`kind`,`callId`,`declaration`,`index`,`source`,`name`,`argsDetailId`,`stage`]);return{kind:t,callId:G(n.callId),declaration:Ct(n.declaration),index:R(n.index,0,P.dataFrames),source:St(n.source),name:L(n.name,128,!0),argsDetailId:H(n.argsDetailId,G),stage:B(n.stage,[`partial`,`final`])}}case`tool-start`:{let n=U(e,[`kind`,`callId`,`declaration`,`source`,`name`,`argsDetailId`]);return{kind:t,callId:G(n.callId),declaration:H(n.declaration,Ct),source:St(n.source),name:L(n.name,128,!0),argsDetailId:H(n.argsDetailId,G)}}case`tool-update`:{let n=U(e,[`kind`,`callId`,`detailId`,`semantics`]);return{kind:t,callId:G(n.callId),detailId:G(n.detailId),semantics:V(n.semantics,`snapshot`)}}case`tool-end`:{let n=U(e,[`kind`,`callId`,`declaration`,`source`,`name`,`resultDetailId`,`isError`,`association`,`startObserved`]),r=B(n.association,[`declared`,`execution-only`,`orphan`,`ambiguous`]),i=H(n.declaration,Ct),a=z(n.startObserved);return(r===`declared`!=(i!==null)||r===`execution-only`&&!a||(r===`orphan`||r===`ambiguous`)&&a)&&I(),{kind:t,callId:G(n.callId),declaration:i,source:St(n.source),name:L(n.name,128,!0),resultDetailId:G(n.resultDetailId),isError:z(n.isError),association:r,startObserved:a}}case`omitted-block`:return{kind:t,block:Et(U(e,[`kind`,`block`]).block)};case`detail-begin`:{let n=U(e,[`kind`,`detailId`,`descriptor`]);return{kind:t,detailId:G(n.detailId),descriptor:Tt(n.descriptor)}}case`detail-chunk`:{let n=U(e,[`kind`,`detailId`,`offset`,`text`]),r=L(n.text,P.chunkBytes),i=R(n.offset,0,P.detailBytes);return i+We(r)>P.detailBytes&&I(),{kind:t,detailId:G(n.detailId),offset:i,text:r}}case`detail-end`:{let n=U(e,[`kind`,`detailId`,`bytes`,`sha256`,`coverage`]);return{kind:t,detailId:G(n.detailId),bytes:R(n.bytes,0,P.detailBytes),sha256:K(n.sha256),coverage:Z(n.coverage)}}case`capture-status`:return{kind:t,coverage:Z(U(e,[`kind`,`coverage`]).coverage)};case`worker-failure`:return{kind:t,code:B(U(e,[`kind`,`code`]).code,[`protocol`,`capture`,`model`,`auth`,`network`,`cleanup`,`prompt`])};case`final`:{let n=U(e,[`kind`,`messageId`,`detailId`,`stopReason`]);return{kind:t,messageId:G(n.messageId),detailId:G(n.detailId),stopReason:V(n.stopReason,`stop`)}}default:return I()}}function kt(e){let t=U(e,[`outcome`,`closure`,`exitCode`,`signal`,`durationMs`,`stdin`]),n={outcome:B(t.outcome,[`completed`,`failed`,`canceled`,`timeout`,`unknown`]),closure:B(t.closure,Ze),exitCode:H(t.exitCode,e=>R(e,-2147483648,4294967295)),signal:H(t.signal,e=>L(e,32,!0)),durationMs:R(t.durationMs),stdin:V(t.stdin,`not-required`)};return(n.closure===`not-launched`&&(n.exitCode!==null||n.signal!==null)||n.outcome===`completed`&&(n.closure!==`direct-child-closed`||n.exitCode!==0||n.signal!==null))&&I(),n}function At(e){let t=U(e,[`messageId`,`detailId`]);return{messageId:G(t.messageId),detailId:G(t.detailId)}}function jt(e){let t=U(e,[`childRunId`,`detailId`,`content`,`committedSeq`]),n=q(t.committedSeq);return n===`0`&&I(),{childRunId:G(t.childRunId),detailId:G(t.detailId),content:Y(t.content),committedSeq:n}}function Mt(e){let t=X(e,`status`);if(t===`committed`){let n=U(e,[`status`,`selected`,`detail`]),r=At(n.selected),i=jt(n.detail);return(r.detailId!==i.detailId||i.content.field!==`final-text`)&&I(),{status:t,selected:r,detail:i}}if(t===`refused`){let n=U(e,[`status`,`selected`,`error`]);return{status:t,selected:H(n.selected,At),error:Je(n.error)}}let n=U(e,[`status`,`selected`]);return{status:B(t,[`pending`,`uncertain`]),selected:H(n.selected,At)}}function Nt(e,t){let n=H(e,q);return(n===`0`||n!==null&&t.status===`committed`&&Ge(n,t.detail.committedSeq)<0)&&I(),n}function Pt(e){return e.native?.outcome===`completed`&&e.recording.status===`committed`&&e.settlementSeq!==null}function Ft(e){return e.kind===`parent`?e.outcome:e.native.outcome===`completed`?e.kind===`sdk`?Pt(e)?`completed`:`failed`:e.capture.observed===`complete`&&e.settlementSeq!==null?`completed`:`failed`:e.native.outcome}function It(e){let t=X(e);if(t===`sdk`){let n=U(e,[`kind`,`native`,`recording`,`settlementSeq`]),r=Mt(n.recording),i=Nt(n.settlementSeq,r);return{kind:t,native:vt(n.native),recording:r,settlementSeq:i}}if(t===`check`){let n=U(e,[`kind`,`native`,`capture`,`settlementSeq`]),r=H(n.settlementSeq,q);return r===`0`&&I(),{kind:t,native:kt(n.native),capture:Z(n.capture),settlementSeq:r}}let n=U(e,[`kind`,`outcome`,`required`]);V(t,`parent`);let r=W(n.required,P.assignments,e=>{let t=U(e,[`assignmentId`,`childRunId`,`native`,`recording`,`settlementSeq`]),n=G(t.childRunId),r=Mt(t.recording);return r.status===`committed`&&r.detail.childRunId!==n&&I(),{assignmentId:Ke(t.assignmentId),childRunId:n,native:H(t.native,vt),recording:r,settlementSeq:Nt(t.settlementSeq,r)}}),i=B(n.outcome,Xe);return(!r.length||new Set(r.map(e=>e.assignmentId)).size!==r.length||new Set(r.map(e=>e.childRunId)).size!==r.length||i===`completed`&&!r.every(Pt))&&I(),{kind:`parent`,outcome:i,required:r}}function Lt(e){let t=U(e,[`first`,`last`,`firstObservedMs`,`lastObservedMs`]),n=R(t.first,1,P.dataFrames+P.controlFrames),r=R(t.last,n,P.dataFrames+P.controlFrames),i=R(t.firstObservedMs),a=R(t.lastObservedMs,i);return n===r&&i!==a&&I(),{first:n,last:r,firstObservedMs:i,lastObservedMs:a}}function Rt(e){let t=U(e,[`source`,`event`]),n=Lt(t.source),r=X(t.event);if(r===`stored-chunk`){let e=U(t.event,[`kind`,`detailId`,`text`]);return{source:n,event:{kind:r,detailId:G(e.detailId),text:L(e.text,P.chunkBytes)}}}if(r===`stored-end`){let e=U(t.event,[`kind`,`detailId`,`coverage`]);return{source:n,event:{kind:r,detailId:G(e.detailId),coverage:Z(e.coverage)}}}let i=Ot(t.event);return(i.kind===`detail-chunk`||i.kind===`detail-end`)&&I(),{source:n,event:i}}function zt(e){let t=U(e,[`epoch`,`taskId`,`runId`,`childRunId`]);return{epoch:G(t.epoch),taskId:G(t.taskId),runId:G(t.runId),childRunId:G(t.childRunId)}}function Bt(e){J({kind:`ok`,value:e},P.pageBytes);let t=Object.getOwnPropertyDescriptor(e??{},`status`)?.value===`complete`,n=U(e,[`storeId`,`workspaceId`,`epoch`,`status`,t?`runs`:`error`]),r={storeId:G(n.storeId),workspaceId:G(n.workspaceId),epoch:G(n.epoch)};if(!t)return V(n.status,`unavailable`),{...r,status:`unavailable`,error:Vt(n.error)};let i=W(n.runs,P.episodes,e=>{let t=U(e,[`taskId`,`runId`,`operationId`,`epoch`,`kind`,`stage`]);return{taskId:G(t.taskId),runId:G(t.runId),operationId:G(t.operationId),epoch:G(t.epoch),kind:B(t.kind,[`start`,`generate-plan`,`check`]),stage:B(t.stage,[`accepted-unallocated`,`active`,`draining`])}});return(i.some(e=>e.epoch!==r.epoch)||new Set(i.map(e=>e.runId)).size!==i.length||new Set(i.map(e=>e.taskId)).size!==i.length||new Set(i.map(e=>e.operationId)).size!==i.length)&&I(),{...r,status:`complete`,runs:i}}function Vt(e){let t=Je(e);return V(t.effect,`none`),t}function Ht(e){let t=U(e,[`sourceHash`,`contractHash`,`buildId`]);return{sourceHash:K(t.sourceHash),contractHash:K(t.contractHash),buildId:K(t.buildId)}}function Ut(e){let t=B(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value,[`native`,`browser`]),n=U(e,t===`native`?[`kind`,`contractHash`]:[`kind`,`contractHash`,`sourceHash`,`buildId`]);return t===`native`?{kind:t,contractHash:K(n.contractHash)}:{kind:t,...Ht({contractHash:n.contractHash,sourceHash:n.sourceHash,buildId:n.buildId})}}function Wt(e){let t=U(e,[`contractHash`,`assets`]);return{contractHash:K(t.contractHash),assets:Ht(t.assets)}}function Gt(e,t,n=!1){return!!e&&!!t&&t.contractHash===e.contractHash&&(n||e.assets.contractHash===e.contractHash&&(t.kind===`native`||t.buildId===e.assets.buildId&&t.sourceHash===e.assets.sourceHash))}function Kt(e){J(e);let t=U(e,[`commandId`,`operationId`,`runId`,`admission`,`committedSeq`,`execution`,`settlement`,`created`,`publication`]),n={commandId:G(t.commandId),operationId:G(t.operationId),runId:H(t.runId,G),admission:B(t.admission,[`accepted`,`refused`,`uncertain`]),committedSeq:q(t.committedSeq),execution:H(t.execution,e=>B(e,Xe)),settlement:H(t.settlement,It),created:H(t.created,e=>{let t=U(e,[`kind`,`taskId`,`state`]);return{kind:V(t.kind,`task`),taskId:G(t.taskId),state:B(t.state,[`reserved`,`published`])}}),publication:B(t.publication,[`pending`,`published`,`conflict`,`uncertain`])};return(n.committedSeq===`0`||n.settlement?.kind===`sdk`||n.execution===`completed`&&!n.settlement||n.execution!==null&&n.settlement!==null&&Ft(n.settlement)!==n.execution||n.created?.state===`published`&&n.publication!==`published`)&&I(),n}function qt(e){J(e);let t=U(e,[`identity`,`receipt`]),n=pt(t.identity),r=Kt(t.receipt);n.kind===`cancel`&&r.runId!==n.runId&&I();let i=n.kind===`action`&&n.action.kind===`create`;if((!i&&r.created!==null||i&&r.admission===`accepted`&&r.created===null)&&I(),n.kind===`action`){let e=[`start`,`generate-plan`,`check`].includes(n.action.kind);(r.admission===`accepted`&&e!==(r.runId!==null)||!e&&(r.execution!==null||r.settlement!==null)||r.settlement!==null&&r.settlement.kind!==(n.action.kind===`check`?`check`:`parent`))&&I()}return{identity:n,receipt:r}}function Q(e,t){if(X(e)===`ok`)return{kind:`ok`,value:t(U(e,[`kind`,`value`]).value)};let n=U(e,[`kind`,`error`]);return V(n.kind,`error`),{kind:`error`,error:Je(n.error)}}function Jt(e){switch(J(e),X(e,`status`)){case`found`:return{status:`found`,receipt:Kt(U(e,[`status`,`receipt`]).receipt)};case`absent`:return{status:`absent`,committedSeq:q(U(e,[`status`,`committedSeq`]).committedSeq)};case`inconclusive`:return{status:`inconclusive`,error:Je(U(e,[`status`,`error`]).error)};default:return I()}}function Yt(e){let t=U(e,[`runId`,`taskId`,`childRunId`,`assignmentId`,`admission`,`lifecycle`,`outcome`,`settlement`,`reason`,`publication`,`coverage`,`result`]),n={runId:G(t.runId),taskId:G(t.taskId),childRunId:H(t.childRunId,G),assignmentId:H(t.assignmentId,Ke),admission:on(t.admission),lifecycle:B(t.lifecycle,[`queued`,`preparing`,`running`,`closing`,`settled`]),outcome:H(t.outcome,e=>B(e,Xe)),settlement:H(t.settlement,It),reason:H(t.reason,e=>B(e,[`capacity`,`dependency`,`writer`,`parent-stopped`,`wait-expired`,`handoff-overflow`,`stale-dependency`,`quarantine`])),publication:B(t.publication,[`pending`,`published`,`conflict`,`uncertain`]),coverage:Z(t.coverage),result:H(t.result,Y)};return(n.admission.context.task?.id!==n.taskId||n.childRunId!==null&&!n.admission.assignments.some(e=>e.childRunId===n.childRunId&&e.assignmentId===n.assignmentId)||n.settlement?.kind===`parent`&&J(n.settlement.required.map(({assignmentId:e,childRunId:t})=>({assignmentId:e,childRunId:t})))!==J(n.admission.assignments)||n.settlement?.kind===`sdk`&&n.settlement.recording.status===`committed`&&(n.settlement.recording.detail.childRunId!==n.childRunId||n.result!==null&&J(n.result)!==J(n.settlement.recording.detail.content))||n.settlement!==null&&(n.childRunId!==null&&n.settlement.kind!==`sdk`||n.childRunId===null&&n.settlement.kind!==(n.admission.kind===`check`?`check`:`parent`)||n.outcome!==null&&Ft(n.settlement)!==n.outcome)||n.childRunId===null!=(n.assignmentId===null)||n.lifecycle===`settled`!=(n.outcome!==null)||n.outcome===`completed`&&(!n.settlement||Ft(n.settlement)!==`completed`||n.coverage.observed!==`complete`))&&I(),n}function Xt(e,t){return t.kind===`task`?e.taskId===t.id:t.kind===`run`?e.runId===t.id:e.childRunId===t.id}function Zt(e,t,n){return Xt(e,t)&&e.taskId===ln(n)&&e.admission.context.workspaceId===cn(n)}function Qt(e){J(e,P.pageBytes);let t=U(e,[`protocol`,`storeId`,`epoch`,`scope`,`committedSeq`,`context`,`runs`,`horizon`]),n={protocol:V(t.protocol,1),storeId:G(t.storeId),epoch:G(t.epoch),scope:yt(t.scope),committedSeq:q(t.committedSeq),context:sn(t.context),runs:W(t.runs,P.maxPageEntries,Yt),horizon:xn(t.horizon)};return(!un(n.context,n.epoch,n.scope)||J(n.horizon.historicalRuns.scope)!==J(n.scope)||n.horizon.historicalRuns.snapshotSeq!==n.committedSeq||n.horizon.historicalRuns.storeId!==n.storeId||n.runs.some(e=>!Zt(e,n.scope,n.context))||new Set(n.runs.map(e=>e.childRunId??e.runId)).size!==n.runs.length)&&I(),n}function $t(e){J(e,P.pageBytes);let t=X(e),n=U(e,t===`update`?[`kind`,`storeId`,`epoch`,`scope`,`previousSeq`,`committedSeq`,`runs`,`removed`,`context`]:[`kind`,`storeId`,`epoch`,`scope`,`committedSeq`]),r={storeId:G(n.storeId),epoch:G(n.epoch),scope:yt(n.scope),committedSeq:q(n.committedSeq)};if(t===`update`){let e=q(n.previousSeq);Ge(r.committedSeq,e)<=0&&I();let i=sn(n.context);un(i,r.epoch,r.scope)||I();let a=W(n.runs,P.maxPageEntries,Yt),o=W(n.removed,P.maxPageEntries,G),s=a.map(e=>e.childRunId??e.runId);return(a.some(e=>!Zt(e,r.scope,i))||new Set(s).size!==s.length||new Set(o).size!==o.length||o.some(e=>s.includes(e)))&&I(),{kind:t,...r,previousSeq:e,runs:a,removed:o,context:i}}return V(t,`heartbeat`),{kind:`heartbeat`,...r}}function en(e){let{navigation:t,...n}=e;return n}function tn(e,t){(!t.navigation||t.navigation===e.navigation||J(en(e))!==J(en(t)))&&I()}function nn(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return rn(e);J({kind:`ok`,value:e},P.pageBytes);let t=U(e,[`kind`,`cursor`,`next`,`coverage`]),n=xt(t.cursor),r=xt(t.next);return tn(n,r),{kind:`progress`,cursor:n,next:r,coverage:Z(t.coverage)}}function rn(e){J({kind:`ok`,value:e},P.pageBytes);let t=U(e,[`cursor`,`content`,`range`,`text`,`next`,`coverage`]),n={cursor:xt(t.cursor),content:Y(t.content),range:H(t.range,it),text:L(t.text,P.detailPageBytes),next:H(t.next,xt),coverage:Z(t.coverage)};return(n.cursor.recordId!==n.content.recordId||n.cursor.recordVersion!==n.content.version||n.cursor.field!==n.content.field||(n.range?n.range.start!==n.cursor.offset||n.range.end>n.content.bytes||n.range.end-n.range.start!==We(n.text):n.content.bytes!==0||n.cursor.offset!==0||n.text!==``))&&I(),n.coverage.observed===`complete`&&n.next!==null!=(n.range?.end??0)<n.content.bytes&&I(),n.next&&(n.next.offset!==n.range?.end||J(en({...n.next,offset:n.cursor.offset}))!==J(en(n.cursor)))&&I(),n}function an(e){J({kind:`ok`,value:e},P.pageBytes);let t=U(e,[`cursor`,`hits`,`next`,`coverage`]),n=xt(t.cursor);n.query||I();let r=We(n.query),i=W(t.hits,P.maxPageEntries,e=>{let t=U(e,[`content`,`range`,`preview`,`cursor`,`owner`]),i=Y(t.content),a=pn(t.owner);mn(a,n.scope)||I();let o=it(t.range),s=xt(t.cursor);return(o.end>i.bytes||o.end-o.start!==r||s.recordId!==i.recordId||s.recordVersion!==i.version||s.field!==i.field||s.offset!==o.start||s.storeId!==n.storeId||J(s.scope)!==J(n.scope)||s.snapshotSeq!==n.snapshotSeq||s.query!==n.query||s.navigation!==void 0)&&I(),{content:i,owner:a,range:o,preview:L(t.preview,P.previewBytes),cursor:s}}),a=H(t.next,xt);return a&&(a.storeId!==n.storeId||J(a.scope)!==J(n.scope)||a.query!==n.query||a.snapshotSeq!==n.snapshotSeq||a.recordId===n.recordId&&a.recordVersion===n.recordVersion&&a.field===n.field&&(a.offset<n.offset||a.offset===n.offset&&(!a.navigation||a.navigation===n.navigation)))&&I(),{cursor:n,hits:i,next:a,coverage:Z(t.coverage)}}function on(e){let t=U(e,[`operationId`,`commandId`,`kind`,`context`,`assignments`,`graph`]),n=ct(t.context),r=H(t.graph,e=>{let t=U(e,[`recordId`,`revision`,`sha256`]);return{recordId:G(t.recordId),revision:R(t.revision,1),sha256:K(t.sha256)}}),i=B(t.kind,[`start`,`generate-plan`,`check`]),a=W(t.assignments,P.assignments,e=>{let t=U(e,[`assignmentId`,`childRunId`]);return{assignmentId:Ke(t.assignmentId),childRunId:G(t.childRunId)}});return(i===`check`!=(a.length===0)||new Set(a.map(e=>e.assignmentId)).size!==a.length||new Set(a.map(e=>e.childRunId)).size!==a.length)&&I(),(!n.task||i===`start`&&(!r||r.revision!==n.task.graphRevision||r.sha256!==n.task.graphIdentity)||i!==`start`&&r!==null)&&I(),{operationId:G(t.operationId),commandId:G(t.commandId),kind:i,context:n,assignments:a,graph:r}}function sn(e){if(X(e,`status`)===`available`)return{status:`available`,version:ct(U(e,[`status`,`version`]).version)};let t=U(e,[`status`,`workspaceId`,`taskId`,`error`]);V(t.status,`unavailable`);let n=Je(t.error);return V(n.effect,`none`),{status:`unavailable`,workspaceId:G(t.workspaceId),taskId:H(t.taskId,G),error:n}}function cn(e){return e.status===`available`?e.version.workspaceId:e.workspaceId}function ln(e){return e.status===`available`?e.version.task?.id??null:e.taskId}function un(e,t,n){return(e.status!==`available`||e.version.epoch===t)&&(n.kind!==`task`||ln(e)===n.id)}function dn(e){let t=U(e,[`protocol`,`storeId`,`epoch`,`accessGeneration`,`authority`,`csrf`,`capabilities`,...Object.getOwnPropertyDescriptor(e??{},`build`)?[`build`]:[]]),n=U(t.capabilities,[`actions`,`manualChecks`,`history`]),r=B(t.authority,[`browser`,`local`]),i=H(t.csrf,G),a={actions:z(n.actions),manualChecks:z(n.manualChecks),history:z(n.history)};return(r===`browser`&&(i===null||a.manualChecks)||r===`local`&&i!==null)&&I(),{...t.build===void 0?{}:{build:Wt(t.build)},protocol:V(t.protocol,1),storeId:G(t.storeId),epoch:G(t.epoch),accessGeneration:R(t.accessGeneration,1),authority:r,csrf:i,capabilities:a}}function fn(e){J({kind:`ok`,value:e},P.pageBytes);let t=U(e,[`workspaceId`,`storeId`,`epoch`,`committedSeq`,`rootLabel`,`context`,`models`,...Object.hasOwn(e??{},`activeRuns`)?[`activeRuns`]:[]]),n={...t.activeRuns===void 0?{}:{activeRuns:Bt(t.activeRuns)},workspaceId:G(t.workspaceId),storeId:G(t.storeId),epoch:G(t.epoch),committedSeq:q(t.committedSeq),rootLabel:L(t.rootLabel,4096,!0),context:sn(t.context),models:W(t.models,P.maxPageEntries,tt)};return n.activeRuns&&(n.activeRuns.storeId!==n.storeId||n.activeRuns.workspaceId!==n.workspaceId||n.activeRuns.epoch!==n.epoch)&&I(),(cn(n.context)!==n.workspaceId||ln(n.context)!==null||n.context.status===`available`&&n.context.version.epoch!==n.epoch)&&I(),n}function pn(e){let t=U(e,[`taskId`,`runId`,`childRunId`,`entity`]),n=U(t.entity,[`kind`,`id`,`version`]),r={taskId:G(t.taskId),runId:H(t.runId,G),childRunId:H(t.childRunId,G),entity:{kind:B(n.kind,[`task`,`run`,`child`,`message`,`tool`,`check`,`changes`,`review`]),id:G(n.id),version:R(n.version,1)}};return(r.childRunId!==null&&r.runId===null||r.entity.kind===`task`&&(r.entity.id!==r.taskId||r.runId!==null)||r.entity.kind===`run`&&(r.entity.id!==r.runId||r.childRunId!==null)||r.entity.kind===`child`&&r.entity.id!==r.childRunId||[`message`,`tool`].includes(r.entity.kind)&&r.childRunId===null||[`check`,`changes`,`review`].includes(r.entity.kind)&&r.childRunId!==null)&&I(),r}function mn(e,t){return t.kind===`task`?e.taskId===t.id:t.kind===`run`?e.runId===t.id:e.childRunId===t.id}function hn(e){let t=U(e,[`identity`,`complete`,`checkoutGeneration`]);return{identity:K(t.identity),complete:z(t.complete),checkoutGeneration:R(t.checkoutGeneration)}}function gn(e){J(e,P.controlBytes);let t=X(e);switch(t){case`assignment-state`:{let n=U(e,[`kind`,`childRunId`,`state`,`reason`]),r=B(n.state,[`waiting`,`ready`,`preparing`,`closing`,`unstarted`]),i=H(n.reason,e=>B(e,[`capacity`,`dependency`,`writer`,`parent-stopped`,`wait-expired`,`handoff-overflow`,`stale-dependency`,`quarantine`]));return(r===`waiting`||r===`unstarted`)&&i===null&&I(),(r===`ready`||r===`preparing`)&&i!==null&&I(),{kind:t,childRunId:G(n.childRunId),state:r,reason:i}}case`admission-closed`:return{kind:t,reason:B(U(e,[`kind`,`reason`]).reason,[`failed`,`canceled`,`timeout`,`wait-expired`,`handoff-overflow`,`stale-dependency`,`quarantine`])};case`parent-admitted`:{let n=U(e,[`kind`,`runId`,`identity`]);return{kind:t,runId:G(n.runId),identity:on(n.identity)}}case`parent-settled`:{let n=U(e,[`kind`,`runId`,`settlement`]),r=It(n.settlement);return r.kind!==`parent`&&I(),{kind:t,runId:G(n.runId),settlement:r}}case`gate`:{let n=typeof e==`object`&&!!e&&Object.hasOwn(e,`reservationId`),r=U(e,[`kind`,`lane`,`state`,`checkoutGeneration`,...n?[`reservationId`]:[]]);return{kind:t,...n?{reservationId:G(r.reservationId)}:{},lane:B(r.lane,[`reader`,`writer`,`check`]),state:B(r.state,[`waiting`,`held`,`released`,`unknown`]),checkoutGeneration:R(r.checkoutGeneration)}}case`handoff`:{let n=U(e,[`kind`,`childRunId`,`handoff`,`observation`]);return{kind:t,childRunId:G(n.childRunId),handoff:_t(n.handoff),observation:hn(n.observation)}}case`changes`:{let n=U(e,[`kind`,`observationId`,`stage`,`observation`,`content`]),r=Y(n.content);return V(r.field,`changes`),{kind:t,observationId:G(n.observationId),stage:B(n.stage,[`before`,`after`,`review`]),observation:hn(n.observation),content:r}}case`check-start`:{let n=U(e,[`kind`,`checkId`,`selection`,`cwdId`,`cwdLabel`,`checkEnvGeneration`,`before`]);return{kind:t,checkId:G(n.checkId),selection:lt(n.selection),cwdId:G(n.cwdId),cwdLabel:L(n.cwdLabel,4096,!0),checkEnvGeneration:R(n.checkEnvGeneration,1),before:hn(n.before)}}case`check-settled`:{let n=typeof e==`object`&&!!e&&Object.hasOwn(e,`ownAdvance`),r=U(e,[`kind`,`checkId`,`native`,`status`,`before`,`after`,`output`,`coverage`,...n?[`ownAdvance`]:[]]),i;if(n){let e=U(r.ownAdvance,[`operationId`,`reservationId`,`from`,`to`]);i={operationId:G(e.operationId),reservationId:G(e.reservationId),from:R(e.from),to:R(e.to)},(i.to!==i.from+1||i.reservationId!==r.checkId)&&I()}let a=kt(r.native),o=B(r.status,[`passed`,`failed`,`canceled`,`stale`]),s=hn(r.before),c=hn(r.after),l=H(r.output,Y),u=Z(r.coverage);return l&&l.field!==`check`&&I(),o===`passed`&&(a.outcome!==`completed`||J({...s,checkoutGeneration:c.checkoutGeneration})!==J(c)||(i?s.checkoutGeneration!==i.from||c.checkoutGeneration!==i.to||l===null:s.checkoutGeneration!==c.checkoutGeneration)||u.observed!==`complete`)&&I(),o===`canceled`&&![`canceled`,`timeout`].includes(a.outcome)&&I(),{kind:t,...i?{ownAdvance:i}:{},checkId:G(r.checkId),native:a,status:o,before:s,after:c,output:l,coverage:u}}case`review`:{let n=U(e,[`kind`,`reviewId`,`runId`,`checksRevision`,`changesIdentity`,`acceptIssues`,`outcome`,`content`]),r=z(n.acceptIssues),i=B(n.outcome,[`reviewed`,`reviewed-with-issues`]),a=Y(n.content);return V(a.field,`review`),i===`reviewed-with-issues`&&!r&&I(),{kind:t,reviewId:G(n.reviewId),runId:G(n.runId),checksRevision:R(n.checksRevision),changesIdentity:K(n.changesIdentity),acceptIssues:r,outcome:i,content:a}}case`publication-intent`:{let n=U(e,[`kind`,`publicationId`,`expectedRevision`,`expectedIdentity`,`nextRevision`,`nextIdentity`]),r=R(n.expectedRevision),i=H(n.expectedIdentity,K),a=R(n.nextRevision,1);return(r===0!=(i===null)||a!==r+1)&&I(),{kind:t,publicationId:G(n.publicationId),expectedRevision:r,expectedIdentity:i,nextRevision:a,nextIdentity:K(n.nextIdentity)}}case`publication-settled`:{let n=U(e,[`kind`,`publicationId`,`status`,`observed`]),r=B(n.status,[`published`,`conflict`,`uncertain`]),i=H(n.observed,e=>{let t=U(e,[`revision`,`identity`]);return{revision:R(t.revision,1),identity:K(t.identity)}});return r===`published`&&i===null&&I(),{kind:t,publicationId:G(n.publicationId),status:r,observed:i}}default:return I()}}function _n(e){let t=U(e,[`epoch`,`operationId`,`taskId`,`runId`]);return{epoch:G(t.epoch),operationId:G(t.operationId),taskId:G(t.taskId),runId:H(t.runId,G)}}function vn(e){J(e,P.ownerQueueBytes);let t=U(e,[`observedMs`,`link`,`events`]),n=_n(t.link),r=W(t.events,P.ownerQueueFrames,e=>{let t=X(e);if(t===`fact`){let r=gn(U(e,[`kind`,`fact`]).fact);return(`runId`in r&&r.runId!==n.runId||r.kind===`parent-admitted`&&(r.identity.context.task?.id!==n.taskId||r.identity.operationId!==n.operationId)||[`gate`,`assignment-state`,`admission-closed`,`handoff`,`check-start`,`check-settled`].includes(r.kind)&&n.runId===null)&&I(),{kind:t,fact:r}}if(t===`content-begin`){let r=U(e,[`kind`,`detailId`,`owner`,`field`,`encoding`]),i=pn(r.owner),a=B(r.field,[`plan`,`check`,`changes`,`review`]);return(i.taskId!==n.taskId||i.runId!==n.runId||i.childRunId!==null||i.entity.kind!==(a===`plan`?`task`:a))&&I(),{kind:t,detailId:G(r.detailId),owner:i,field:a,encoding:V(r.encoding,`utf8`)}}if(t===`content-chunk`){let n=U(e,[`kind`,`detailId`,`text`]);return{kind:t,detailId:G(n.detailId),text:L(n.text,P.chunkBytes)}}let r=U(e,[`kind`,`detailId`,`coverage`]);return V(t,`content-end`),{kind:`content-end`,detailId:G(r.detailId),coverage:Z(r.coverage)}});return{observedMs:R(t.observedMs),link:n,events:r}}var yn=[`tasks`,`runs`,`messages`,`tools`,`contents`,`events`,`checks`,`changes`,`reviews`];function bn(e){let t=U(e,[`reader`,`storeId`,`scope`,`snapshotSeq`,`after`,`limit`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]),n=B(t.reader,yn),r=U(t.scope,[`kind`,`id`]),i={kind:B(r.kind,[`workspace`,`task`,`run`,`child`]),id:G(r.id)},a=H(t.snapshotSeq,q),o=H(t.after,e=>{let t=U(e,[`recordId`,`version`,`offset`]);return{recordId:G(t.recordId),version:R(t.version,1),offset:R(t.offset)}});return(o&&a===null||n===`tasks`!=(i.kind===`workspace`))&&I(),{reader:n,...Object.hasOwn(t,`navigation`)?{navigation:bt(t.navigation)}:{},storeId:G(t.storeId),scope:i,snapshotSeq:a,after:o,limit:R(t.limit,1,P.maxPageEntries)}}function xn(e){let t=U(e,[`policy`,`historicalRuns`]),n=bn(t.historicalRuns);return(n.reader!==`runs`||n.after!==null||n.snapshotSeq===null)&&I(),{policy:V(t.policy,`active-and-recent`),historicalRuns:n}}function Sn(e){let t=X(e);if(t===`run`)return{kind:t,projection:Yt(U(e,[`kind`,`projection`]).projection)};if(t===`capture-fact`){let n=U(e,[`kind`,`recordId`,`committedSeq`,`link`,`capture`]),r=q(n.committedSeq);return r===`0`&&I(),{kind:t,recordId:G(n.recordId),committedSeq:r,link:zt(n.link),capture:Rt(n.capture)}}if(t===`owner-fact`){let n=U(e,[`kind`,`recordId`,`committedSeq`,`observedMs`,`link`,`fact`]),r=vn({observedMs:n.observedMs,link:n.link,events:[{kind:`fact`,fact:n.fact}]}),i=r.events[0];i.kind!==`fact`&&I();let a=q(n.committedSeq);return a===`0`&&I(),{kind:t,recordId:G(n.recordId),committedSeq:a,link:r.link,observedMs:r.observedMs,fact:i.fact}}let n=[`kind`,`owner`,`version`],r=t===`task`?[`goal`,`plan`]:t===`message`?[`role`,`source`,`resultCallId`,`state`,`finalBlockCount`,`finalText`]:t===`tool`?[`source`,`name`,`declaration`,`declarationStage`,`startObserved`,`result`]:t===`content`?[`detailId`,`descriptor`,`content`,`coverage`]:[`block`],i=U(e,[...n,...r]),a=pn(i.owner),o=R(i.version,1);if([`task`,`message`,`tool`].includes(t)&&(a.entity.kind!==t||a.entity.version!==o)&&I(),t===`task`){let e=H(i.plan,Y);return e&&e.field!==`plan`&&I(),{kind:t,owner:a,version:o,goal:L(i.goal,8192,!0),plan:e}}if(t===`message`){let e=B(i.role,[`user`,`assistant`,`tool-result`]),n=B(i.state,[`partial`,`final`]),r=H(i.finalBlockCount,e=>R(e,0,P.dataFrames)),s=H(i.finalText,Y),c=H(i.resultCallId,G);return(n===`final`!=(r!==null)||n===`partial`&&s!==null||s&&s.field!==`final-text`||e!==`tool-result`&&c!==null)&&I(),{kind:t,owner:a,version:o,role:e,state:n,finalBlockCount:r,finalText:s,resultCallId:c,source:St(i.source)}}if(t===`tool`){let e=H(i.declaration,Ct),n=H(i.declarationStage,e=>B(e,[`partial`,`final`])),r=z(i.startObserved),s=H(i.result,e=>{let t=Ot(e);return t.kind!==`tool-end`&&I(),t});return(e===null!=(n===null)||s&&(s.callId!==a.entity.id||s.startObserved!==r||J(s.declaration)!==J(e)))&&I(),{kind:t,owner:a,version:o,declaration:e,declarationStage:n,startObserved:r,result:s,source:St(i.source),name:L(i.name,128,!0)}}if(t===`content`){let e=Tt(i.descriptor),n=Y(i.content);return(e.field!==n.field||!Cn(e.owner,a))&&I(),{kind:t,owner:a,version:o,detailId:G(i.detailId),descriptor:e,content:n,coverage:Z(i.coverage)}}V(t,`omitted`);let s=Et(i.block);return Cn(s.owner,a)||I(),{kind:`omitted`,owner:a,version:o,block:s}}function Cn(e,t){return e.kind===`message`||e.kind===`message-final`?t.entity.kind===`message`&&e.messageId===t.entity.id:e.kind===`tool`?t.entity.kind===`tool`&&e.callId===t.entity.id:t.entity.kind===`child`}function wn(e,t){let{scope:n,reader:r}=t,i=e.kind===`run`?{taskId:e.projection.taskId,runId:e.projection.runId,childRunId:e.projection.childRunId}:e.kind===`owner-fact`?{...e.link,childRunId:null}:e.kind===`capture-fact`?e.link:e.owner;return n.kind!==`workspace`&&!(n.kind===`task`?i.taskId===n.id:n.kind===`run`?i.runId===n.id:i.childRunId===n.id)?!1:r===`tasks`?e.kind===`task`:r===`runs`?e.kind===`run`:r===`messages`?e.kind===`message`:r===`tools`?e.kind===`tool`:r===`contents`?e.kind===`content`||e.kind===`omitted`:e.kind===`capture-fact`?r===`events`:e.kind===`owner-fact`?r===`events`||r===`checks`&&[`check-start`,`check-settled`].includes(e.fact.kind)||r===`changes`&&e.fact.kind===`changes`||r===`reviews`&&e.fact.kind===`review`:!1}function Tn(e){J({kind:`ok`,value:e},P.pageBytes);let t=U(e,[`request`,`records`,`next`,`coverage`]),n=bn(t.request);n.snapshotSeq===null&&I();let r=W(t.records,n.limit,Sn),i=H(t.next,bn);return(r.some(e=>!wn(e,n))||i&&(i.after===null||J(en({...i,after:n.after}))!==J(en(n))||J(i.after)===J(n.after)))&&I(),{request:n,records:r,next:i,coverage:Z(t.coverage)}}function En(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value===`snapshot`){J({kind:`ok`,value:e},P.pageBytes);let t=U(e,[`kind`,`request`,`next`,`coverage`]),n=bn(t.request),r=bn(t.next);return(n.snapshotSeq!==null||n.after!==null||r.snapshotSeq===null||!r.navigation||J(en({...r,snapshotSeq:null}))!==J(en(n)))&&I(),{kind:`snapshot`,request:n,next:r,coverage:Z(t.coverage)}}if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return Tn(e);J({kind:`ok`,value:e},P.pageBytes);let t=U(e,[`kind`,`request`,`next`,`coverage`]),n=bn(t.request),r=bn(t.next);return tn(n,r),{kind:`progress`,request:n,next:r,coverage:Z(t.coverage)}}function Dn(e,t){return J({...t.request,snapshotSeq:e.snapshotSeq})===J(e)&&(e.snapshotSeq===null||e.snapshotSeq===t.request.snapshotSeq)}function On(e){let t=U(e,[`storeId`,`scope`,`snapshotSeq`,`graph`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]),n=U(t.graph,[`recordId`,`revision`,`sha256`]);return{...Object.hasOwn(t,`navigation`)?{navigation:bt(t.navigation)}:{},storeId:G(t.storeId),scope:yt(t.scope),snapshotSeq:q(t.snapshotSeq),graph:{recordId:G(n.recordId),revision:R(n.revision,1),sha256:K(n.sha256)}}}function kn(e){J({kind:`ok`,value:e});let t=U(e,[`request`,`graph`]),n=On(t.request),r=ot(t.graph);return(r.revision!==n.graph.revision||n.scope.kind===`task`&&n.scope.id!==r.taskId)&&I(),{request:n,graph:r}}function An(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return kn(e);J({kind:`ok`,value:e},P.pageBytes);let t=U(e,[`kind`,`request`,`next`,`coverage`]),n=On(t.request),r=On(t.next);return tn(n,r),{kind:`progress`,request:n,next:r,coverage:Z(t.coverage)}}function jn(e){let t=U(e,[`storeId`,`scope`,`snapshotSeq`,`format`]);return{storeId:G(t.storeId),scope:yt(t.scope),snapshotSeq:q(t.snapshotSeq),format:B(t.format,[`ndjson`,`markdown`])}}function Mn(e){J(e,P.controlBytes);let t=U(e,[`exportId`,`ordinal`,`event`]),n=X(t.event),r;switch(n){case`manifest`:{let e=U(t.event,[`kind`,`schema`,`request`,`coverage`,`serviceProtocol`,`workerProtocol`,`provenance`]),i=U(e.provenance,[`exporterBuildSha256`,`capturePolicy`]);r={kind:n,provenance:{exporterBuildSha256:K(i.exporterBuildSha256),capturePolicy:V(i.capturePolicy,`public-text-tools/2`)},schema:V(e.schema,Ve),request:jn(e.request),coverage:Z(e.coverage),serviceProtocol:V(e.serviceProtocol,1),workerProtocol:V(e.workerProtocol,2)};break}case`record`:r={kind:n,record:Sn(U(t.event,[`kind`,`record`]).record)};break;case`graph`:r={kind:n,graph:kn(U(t.event,[`kind`,`graph`]).graph)};break;case`detail`:{let e=U(t.event,[`kind`,`owner`,`content`,`range`,`text`,`coverage`]),i=Y(e.content),a=H(e.range,it),o=L(e.text,P.detailPageBytes);(a?a.end>i.bytes||a.end-a.start!==We(o):i.bytes!==0||o!==``)&&I(),r={kind:n,owner:pn(e.owner),content:i,range:a,text:o,coverage:Z(e.coverage)};break}case`markdown`:r={kind:n,text:L(U(t.event,[`kind`,`text`]).text,P.detailPageBytes)};break;case`trailer`:{let e=U(t.event,[`kind`,`complete`,`frames`,`encodedBytes`,`sha256`,`committedSeq`,`coverage`]),i=Z(e.coverage),a=z(e.complete);a&&i.observed!==`complete`&&I(),r={kind:n,complete:a,frames:R(e.frames,1),encodedBytes:R(e.encodedBytes),sha256:K(e.sha256),committedSeq:q(e.committedSeq),coverage:i};break}default:return I()}return{exportId:G(t.exportId),ordinal:R(t.ordinal,1),event:r}}function Nn(e,t){let n=Mn(e);return t===`ndjson`?`${J(n)}\n`:n.event.kind===`markdown`?n.event.text:(n.event.kind!==`manifest`&&n.event.kind!==`trailer`&&I(),`\n\n\`\`\`json\n${J(n)}\n\`\`\`\n`)}var Pn=class{exportId=null;ordinal=0;bytes=0;ended=!1;complete=!1;request;constructor(e){this.request=jn(e)}receive(e){let t=Mn(e),n=t.event;return(this.ended||t.ordinal!==this.ordinal+1||this.exportId!==null&&this.exportId!==t.exportId)&&I(),this.ordinal===0?(n.kind!==`manifest`||J(n.request)!==J(this.request))&&I():n.kind===`manifest`&&I(),n.kind===`trailer`?((n.frames!==this.ordinal||n.encodedBytes!==this.bytes||n.committedSeq!==this.request.snapshotSeq)&&I(),this.ended=!0,this.complete=n.complete):(this.request.format===`markdown`&&n.kind!==`manifest`&&n.kind!==`markdown`&&I(),this.request.format===`ndjson`&&n.kind===`markdown`&&I(),n.kind===`detail`&&!mn(n.owner,this.request.scope)&&I(),n.kind===`graph`&&(J(n.graph.request.scope)!==J(this.request.scope)||n.graph.request.snapshotSeq!==this.request.snapshotSeq||n.graph.request.storeId!==this.request.storeId)&&I(),n.kind===`record`&&!Fn(n.record,this.request.scope)&&I(),this.bytes+=We(Nn(t,this.request.format))),this.exportId=t.exportId,this.ordinal=t.ordinal,t}get completion(){return this.ended?this.complete?`complete-unverified-digest`:`incomplete`:`missing-trailer`}};function Fn(e,t){return e.kind===`run`?Xt(e.projection,t):e.kind===`owner-fact`?t.kind===`task`?e.link.taskId===t.id:t.kind===`run`&&e.link.runId===t.id:e.kind===`capture-fact`?t.kind===`task`?e.link.taskId===t.id:t.kind===`run`?e.link.runId===t.id:e.link.childRunId===t.id:mn(e.owner,t)}function In(e){let t=U(e,[`taskId`,`revision`,`definitions`]),n=W(t.definitions,32,e=>{let t=U(e,[`selection`,`status`,`checkId`]),n=lt(t.selection),r=B(t.status,[`not-run`,`passed`,`failed`,`canceled`,`stale`]),i=H(t.checkId,G);return(n.kind!==`configured`||r===`not-run`!=(i===null))&&I(),{selection:n,status:r,checkId:i}});return new Set(n.map(e=>e.selection.name)).size!==n.length&&I(),{taskId:G(t.taskId),revision:R(t.revision),definitions:n}}function Ln(e){let t=U(e,[`storeId`,`scope`,`snapshotSeq`,`kind`,`id`,`version`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]);return{...Object.hasOwn(t,`navigation`)?{navigation:bt(t.navigation)}:{},storeId:G(t.storeId),scope:yt(t.scope),snapshotSeq:q(t.snapshotSeq),kind:B(t.kind,[`task`,`message`,`tool`]),id:G(t.id),version:R(t.version,1)}}function Rn(e){J({kind:`ok`,value:e},P.pageBytes);let t=U(e,[`request`,`record`]),n=Ln(t.request),r=Sn(t.record);return(r.kind!==`task`&&r.kind!==`message`&&r.kind!==`tool`||r.kind!==n.kind||r.owner.entity.id!==n.id||r.version!==n.version||!mn(r.owner,n.scope))&&I(),{request:n,record:r}}function zn(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return Rn(e);J({kind:`ok`,value:e},P.pageBytes);let t=U(e,[`kind`,`request`,`next`,`coverage`]),n=Ln(t.request),r=Ln(t.next);return tn(n,r),{kind:`progress`,request:n,next:r,coverage:Z(t.coverage)}}var Bn=e=>{let t=Je(e);return V(t.effect,`none`),t};function Vn(e){let t=U(e,[`storeId`,`taskId`]);return{storeId:G(t.storeId),taskId:H(t.taskId,G)}}function Hn(e){let t=Vn(e);return t.taskId===null&&I(),t}function Un(e){let t=U(e,[`id`,`kind`,`revision`,`identity`]);return{id:G(t.id),kind:B(t.kind,[`code`,`research`,`diagnosis`]),revision:R(t.revision,1),identity:K(t.identity)}}function Wn(e){let t=W(e,3,nt);return(t.length!==3||new Set(t.map(e=>e.role)).size!==3)&&I(),t}function Gn(e){let t=Object.getOwnPropertyDescriptor(e??{},`status`)?.value;if(t===`none`)return U(e,[`status`]),{status:t};if(t===`saved`){let n=U(e,[`status`,`request`,`planRevision`]);return{status:t,request:On(n.request),planRevision:R(n.planRevision,1)}}let n=U(e,[`status`,`error`]);return V(n.status,`unavailable`),{status:`unavailable`,error:Bn(n.error)}}function Kn(e){if((!(e.task?e.task.id===e.request.taskId:e.request.taskId===null||e.context.status===`unavailable`)||cn(e.context)!==e.workspaceId||ln(e.context)!==e.request.taskId)&&I(),e.context.status===`available`){let t=e.context.version;(t.epoch!==e.epoch||!!t.task!=!!e.task||e.task&&(t.task?.revision!==e.task.revision||t.task.identity!==e.task.identity||t.task.kind!==e.task.kind))&&I()}}function qn(e){J({kind:`ok`,value:e},P.pageBytes);let t=U(e,[`request`,`workspaceId`,`epoch`,`committedSeq`,`context`,`task`,`roles`,`readablePlan`,`savedGraph`]),n={request:Vn(t.request),workspaceId:G(t.workspaceId),epoch:G(t.epoch),committedSeq:q(t.committedSeq),context:sn(t.context),task:H(t.task,Un),roles:Wn(t.roles),savedGraph:Gn(t.savedGraph),readablePlan:H(t.readablePlan,e=>{let t=U(e,[`source`,`text`,`editable`,`coverage`]),n=Z(t.coverage),r=z(t.editable);return r&&(n.redacted||n.observed!==`complete`||n.source!==`complete`||n.omissions.length)&&I(),{source:V(t.source,`current-v1`),text:L(t.text,32768),editable:r,coverage:n}})};Kn(n),!!n.task!=!!n.readablePlan&&I();let r=n.savedGraph;return r.status===`saved`&&(r.request.storeId!==n.request.storeId||r.request.scope.kind!==`task`||r.request.scope.id!==n.task?.id||r.request.snapshotSeq!==n.committedSeq||n.context.status===`available`&&(r.request.graph.sha256!==n.context.version.task?.graphIdentity||r.request.graph.revision!==n.context.version.task?.graphRevision))&&I(),r.status===`unavailable`&&n.context.status===`available`&&I(),n}function Jn(e){J({kind:`ok`,value:e},P.pageBytes);let t=U(e,[`request`,`workspaceId`,`epoch`,`committedSeq`,`context`,`task`,`observation`,`text`,`git`,`coverage`]),n=U(t.observation,[`identity`,`complete`,`checkoutGeneration`]),r={request:Hn(t.request),workspaceId:G(t.workspaceId),epoch:G(t.epoch),committedSeq:q(t.committedSeq),context:sn(t.context),task:Un(t.task),observation:{identity:K(n.identity),complete:z(n.complete),checkoutGeneration:R(n.checkoutGeneration,0)},text:L(t.text,131072),git:z(t.git),coverage:Z(t.coverage)};if(Kn(r),r.context.status===`available`){let e=r.context.version;(e.observation.identity!==r.observation.identity||e.observation.complete!==r.observation.complete||e.checkoutGeneration!==r.observation.checkoutGeneration)&&I()}return r}function Yn(e){let t=U(e,[`epoch`,`accessGeneration`,`configRev`,`catalogId`]);return{epoch:G(t.epoch),accessGeneration:R(t.accessGeneration,1),configRev:R(t.configRev,1),catalogId:G(t.catalogId)}}function Xn(e){J({kind:`ok`,value:e},P.pageBytes);let t=U(e,[`version`,`selected`]);return{version:Yn(t.version),selected:H(t.selected,tt)}}function Zn(e){J(e);let t=U(e,[`expected`,`choice`]);return{expected:Yn(t.expected),choice:et(t.choice)}}function Qn(e){let t=U(e,[`provider`,`model`,`api`,`thinking`,`eligibility`]),n={provider:L(t.provider,128,!0),model:L(t.model,256,!0),api:H(t.api,e=>B(e,Qe)),thinking:W(t.thinking,7,e=>{let t=U(e,[`level`,`selectable`]);return{level:B(t.level,$e),selectable:z(t.selectable)}}),eligibility:B(t.eligibility,[`candidate`,`unsupported`,`auth-unavailable`])};return(new Set(n.thinking.map(e=>e.level)).size!==n.thinking.length||n.thinking.some(e=>e.selectable&&(n.api===null||n.eligibility!==`candidate`))||n.eligibility===`candidate`&&!n.thinking.some(e=>e.selectable))&&I(),n}function $n(e){J({kind:`ok`,value:e},P.pageBytes);let t=U(e,[`version`,`selected`,`status`,`entries`,`withheld`]),n=W(t.entries,P.maxPageEntries,Qn),r=B(t.status,[`complete`,`capacity`]),i=R(t.withheld,0,P.maxPageEntries);return(r===`capacity`&&(n.length||i)||n.length+i>P.maxPageEntries||new Set(n.map(e=>J([e.provider,e.model]))).size!==n.length)&&I(),{version:Yn(t.version),selected:H(t.selected,tt),status:r,entries:n,withheld:i}}function er(e){let t=U(e,[`id`,`path`,`cwd`,`epoch`]);return{id:K(t.id),path:L(t.path,4096,!0),cwd:L(t.cwd,4096,!0),epoch:G(t.epoch)}}function tr(e){let t=U(e,[`kind`,`epoch`,`csrf`,`home`,`projects`,`build`]);return{kind:V(t.kind,`workbench`),epoch:G(t.epoch),csrf:G(t.csrf),home:L(t.home,4096,!0),projects:W(t.projects,128,er),build:Wt(t.build)}}var nr=[`queued`,`running`,`completed`,`failed`,`canceled`,`timeout`,`unknown`];function rr(e){let t=Object.getOwnPropertyDescriptor(e??{},`kind`)?.value;switch(t){case`conversations`:case`projects`:return U(e,[`kind`]),{kind:t};case`task-origin`:return{kind:t,taskId:G(U(e,[`kind`,`taskId`]).taskId)};case`conversation`:{let n=U(e,[`kind`,`id`,`before`]);return{kind:t,id:G(n.id),before:H(n.before,G)}}default:{let t=U(e,[`kind`,`path`]);return{kind:B(t.kind,[`files`,`file`,`directories`]),path:L(t.path,4096)}}}}function ir(e){let t=Object.getOwnPropertyDescriptor(e??{},`kind`)?.value;if(t===`link-task`){let n=U(e,[`kind`,`commandId`,`epoch`,`taskId`,`conversationId`]);return{kind:t,commandId:G(n.commandId),epoch:G(n.epoch),taskId:G(n.taskId),conversationId:G(n.conversationId)}}if(t===`send`){let n=U(e,[`kind`,`commandId`,`conversationId`,`head`,`text`,`model`]);return{kind:t,commandId:G(n.commandId),conversationId:G(n.conversationId),head:H(n.head,G),text:L(n.text,16384,!0),model:Yn(n.model)}}if(t===`interrupt`){let n=U(e,[`kind`,`commandId`,`conversationId`,`turnId`,`epoch`]);return{kind:t,commandId:G(n.commandId),conversationId:G(n.conversationId),turnId:G(n.turnId),epoch:G(n.epoch)}}let n=U(e,[`kind`,`commandId`,`path`,`epoch`]);return{kind:B(n.kind,[`open-project`]),commandId:G(n.commandId),path:L(n.path,4096,!0),epoch:G(n.epoch)}}function ar(e){let t=U(e,[`id`,`epoch`,`status`,`items`,`notice`]);return{id:G(t.id),epoch:G(t.epoch),status:B(t.status,nr),notice:L(t.notice,1024),items:W(t.items,256,e=>{let t=U(e,[`id`,`role`,`text`,`name`,`args`,`error`]);return{id:L(t.id,160,!0),role:B(t.role,[`user`,`assistant`,`tool`]),text:L(t.text,262144),name:L(t.name,128),args:L(t.args,65536),error:z(t.error)}})}}function or(e){let t=U(e,[`id`,`title`,`head`,`status`,`updatedAt`]);return{id:G(t.id),title:L(t.title,512,!0),head:G(t.head),status:B(t.status,nr),updatedAt:R(t.updatedAt,0)}}function sr(e){J(e,524288);let t=Object.getOwnPropertyDescriptor(e??{},`kind`)?.value;if(t===`task-origin`){let n=U(e,[`kind`,`taskId`,`conversationId`]);return{kind:t,taskId:G(n.taskId),conversationId:H(n.conversationId,G)}}if(t===`conversations`)return{kind:t,entries:W(U(e,[`kind`,`entries`]).entries,200,or)};if(t===`conversation`){let n=U(e,[`kind`,`summary`,`turns`,`before`]);return{kind:t,summary:H(n.summary,or),turns:W(n.turns,20,ar),before:H(n.before,G)}}if(t===`files`||t===`directories`){let n=U(e,[`kind`,`path`,`parent`,`entries`,`limited`]);return{kind:t,path:L(n.path,4096),parent:H(n.parent,e=>L(e,4096)),limited:z(n.limited),entries:W(n.entries,200,e=>{let t=U(e,[`name`,`path`,`directory`]);return{name:L(t.name,1024,!0),path:L(t.path,4096,!0),directory:z(t.directory)}})}}if(t===`file`){let n=U(e,[`kind`,`path`,`text`,`limited`]);return{kind:t,path:L(n.path,4096),text:L(n.text,262144),limited:z(n.limited)}}if(t===`projects`)return{kind:t,entries:W(U(e,[`kind`,`entries`]).entries,128,e=>{let t=U(e,[`path`,`current`]);return{path:L(t.path,4096,!0),current:z(t.current)}})};if(t===`accepted`)return{kind:t,commandId:G(U(e,[`kind`,`commandId`]).commandId)};let n=U(e,[`kind`,`commandId`,`path`,`link`]);return{kind:B(n.kind,[`project`]),commandId:G(n.commandId),path:L(n.path,4096,!0),link:L(n.link,8192,!0)}}var cr={session:`/api/v1/session`,workbenchRead:`/api/v1/workbench/read`,workbenchCommand:`/api/v1/workbench/command`,current:`/api/v1/current`,currentChanges:`/api/v1/current-changes`,activeRuns:`/api/v1/active-runs`,models:`/api/v1/models`,chooseModel:`/api/v1/model-choice`,workspace:`/api/v1/workspace`,tasks:`/api/v1/tasks`,runs:`/api/v1/runs`,messages:`/api/v1/messages`,tools:`/api/v1/tools`,contents:`/api/v1/contents`,events:`/api/v1/history-events`,checks:`/api/v1/checks`,changes:`/api/v1/changes`,reviews:`/api/v1/reviews`,checkObligations:`/api/v1/check-obligations`,entity:`/api/v1/entity`,graph:`/api/v1/graph`,snapshot:`/api/v1/snapshot`,detail:`/api/v1/details`,search:`/api/v1/search`,export:`/api/v1/export`,download:`/api/v1/download`,preflight:`/api/v1/preflight`,command:`/api/v1/commands`,cancel:`/api/v1/cancel`,receipt:`/api/v1/receipt`,detach:`/api/v1/detach`},lr=`/api/v1/events`,ur=[`tasks`,`runs`,`messages`,`tools`,`contents`,`events`,`checks`,`changes`,`reviews`];function dr(e,t){if(ur.includes(e)||e===`detail`||e===`search`||e===`entity`||e===`current`||e===`currentChanges`||e===`activeRuns`||e===`workspace`||e===`models`||e===`chooseModel`||e===`workbenchRead`||e===`workbenchCommand`)return P.pageBytes;if(e===`graph`){let e=Object.getOwnPropertyDescriptor(t??{},`kind`)?.value,n=Object.getOwnPropertyDescriptor(t??{},`value`)?.value;if(e===`ok`&&Object.getOwnPropertyDescriptor(n??{},`kind`)?.value===`progress`)return P.pageBytes}return P.controlBytes}function fr(e){return[`preflight`,`command`,`cancel`,`detach`,`chooseModel`,`workbenchCommand`].includes(e)}function pr(e,t){switch(e){case`workbenchRead`:return rr(t);case`workbenchCommand`:return ir(t);case`session`:case`models`:case`activeRuns`:case`workspace`:case`detach`:if(t!==null)throw new F(`invalid`);return null;case`tasks`:case`runs`:case`messages`:case`tools`:case`contents`:case`events`:case`checks`:case`changes`:case`reviews`:{let n=bn(t);if(n.reader!==e)throw new F(`invalid`);return n}case`current`:return Vn(t);case`currentChanges`:return Hn(t);case`checkObligations`:case`receipt`:return G(t);case`entity`:return Ln(t);case`graph`:return On(t);case`snapshot`:return yt(t);case`detail`:case`search`:return xt(t);case`export`:case`download`:return jn(t);case`chooseModel`:return Zn(t);case`preflight`:return dt(t);case`command`:return ft(t);case`cancel`:return mt(t)}}function mr(e,t){if(ur.includes(e))return Q(t,En);switch(e){case`workbenchRead`:case`workbenchCommand`:return Q(t,sr);case`current`:return Q(t,qn);case`currentChanges`:return Q(t,Jn);case`activeRuns`:return Q(t,Bt);case`models`:return Q(t,$n);case`chooseModel`:return Q(t,Xn);case`session`:return Q(t,dn);case`workspace`:return Q(t,fn);case`checkObligations`:return Q(t,In);case`entity`:return Q(t,zn);case`graph`:return Q(t,An);case`snapshot`:return Q(t,Qt);case`detail`:return Q(t,nn);case`search`:return Q(t,an);case`preflight`:return Q(t,gt);case`command`:case`cancel`:return Q(t,Kt);case`receipt`:return Jt(t);case`detach`:return Q(t,e=>{if(e!==null)throw new F(`invalid`);return null});default:throw new F(`invalid`)}}function hr(e){return[...ur,`workbenchRead`,`current`,`currentChanges`,`checkObligations`,`entity`,`graph`,`snapshot`,`detail`,`search`,`export`,`download`,`receipt`].includes(e)}function gr(e,t){let n=cr[e];return t===null||fr(e)?n:`${n}?request=${encodeURIComponent(J(t))}`}function _r(e,t){let n=pr(e,t),r=typeof n==`object`&&!!n&&Object.hasOwn(n,`navigation`),i=r?cr[e]:gr(e,n);return fr(e)||hr(e)&&(r||We(i)>P.headerBytes/4)?{path:cr[e],method:`POST`,body:J(n)}:{path:i,method:`GET`}}function vr(e){J(e,P.viewerBytes);let t=B(Object.getOwnPropertyDescriptor(e,`kind`)?.value,[`snapshot`,`event`,`resync`]);return t===`snapshot`?{kind:t,snapshot:Qt(U(e,[`kind`,`snapshot`]).snapshot)}:t===`event`?{kind:t,event:$t(U(e,[`kind`,`event`]).event)}:(U(e,[`kind`]),{kind:t})}var yr=class{options;attachment;csrf=null;fetcher;origin;constructor(e){this.options=e;let t=new URL(e.origin);if(t.origin!==e.origin||t.protocol!==`https:`&&!/^http:\/\/(?:127\.0\.0\.1|\[::1\]):[1-9][0-9]*$/.test(e.origin)||e.project!==void 0&&!/^[a-f0-9]{64}$/.test(e.project))throw new F(`invalid`);this.origin=e.origin,e.build&&=Ut(e.build),this.fetcher=e.fetch??globalThis.fetch.bind(globalThis)}workbenchRead(e,t){return this.request(`workbenchRead`,e,t)}workbenchCommand(e){return this.request(`workbenchCommand`,e)}headers(e){let t={"Cache-Control":`no-store`};if(this.options.build&&(t[`X-Cadence-Build`]=J(this.options.build)),this.attachment&&(t[`X-Cadence-Attachment`]=this.attachment),this.options.localCapability&&(t[`X-Cadence-Local`]=this.options.localCapability),e){if(!this.attachment||!this.options.localCapability&&!this.csrf)throw new F(`stale`);t[`Content-Type`]=`application/json`,this.csrf&&(t[`X-Cadence-CSRF`]=this.csrf)}return t}async request(e,t,n){let r=_r(e,pr(e,t)),i=r.method===`POST`,a=await this.fetcher(`${this.origin}${this.options.project?`/projects/${this.options.project}`:``}${r.path}`,{method:r.method,headers:this.headers(i),credentials:`same-origin`,redirect:`error`,signal:this.options.requestTimeoutMs===void 0?n:AbortSignal.any([...n?[n]:[],AbortSignal.timeout(this.options.requestTimeoutMs)]),...i?{body:r.body}:{}}),o;try{e===`session`&&a.ok&&(o=G(a.headers.get(`x-cadence-attachment`)),this.attachment=o)}catch(e){throw await a.body?.cancel().catch(()=>{}),e}let s=await br(a,dr(e)),c=qe(s);if(We(s)>dr(e,c))throw new F(`oversize`);let l=mr(e,c);if(e===`session`){let e=Q(l,dn);if(e.kind===`ok`){if(e.value.authority===`local`!=!!this.options.localCapability)throw new F(`forbidden`);this.attachment=o??G(a.headers.get(`x-cadence-attachment`)),this.csrf=e.value.csrf}}return l}session(e){return this.request(`session`,null,e)}current(e,t){return this.request(`current`,e,t)}currentChanges(e,t){return this.request(`currentChanges`,e,t)}activeRuns(e){return this.request(`activeRuns`,null,e)}models(e){return this.request(`models`,null,e)}chooseModel(e){return this.request(`chooseModel`,Zn(e))}workspace(e){return this.request(`workspace`,null,e)}checkObligations(e,t){return this.request(`checkObligations`,G(e),t)}entity(e,t){return this.request(`entity`,Ln(e),t)}tasks(e,t){return this.request(`tasks`,bn(e),t)}runs(e,t){return this.request(`runs`,bn(e),t)}messages(e,t){return this.request(`messages`,bn(e),t)}tools(e,t){return this.request(`tools`,bn(e),t)}contents(e,t){return this.request(`contents`,bn(e),t)}events(e,t){return this.request(`events`,bn(e),t)}checks(e,t){return this.request(`checks`,bn(e),t)}changes(e,t){return this.request(`changes`,bn(e),t)}reviews(e,t){return this.request(`reviews`,bn(e),t)}graph(e,t){return this.request(`graph`,On(e),t)}preflight(e){return this.request(`preflight`,dt(e))}command(e){return this.request(`command`,ft(e))}cancel(e){return this.request(`cancel`,mt(e))}receipt(e,t){return this.request(`receipt`,G(e),t)}snapshot(e,t){return this.request(`snapshot`,e,t)}detail(e,t){return this.request(`detail`,e,t)}search(e,t){return this.request(`search`,e,t)}async detach(){let e=this.attachment;if(!e)return;let t=Q(await this.request(`detach`,null),e=>{if(e!==null)throw new F(`invalid`);return null});if(t.kind===`error`&&t.error.code!==`stale`&&t.error.code!==`unauthenticated`)throw new F(t.error.code);return this.attachment===e&&(this.attachment=void 0,this.csrf=null),t}async*export(e,t){let n=_r(`export`,jn(e)),r=await this.fetcher(`${this.origin}${this.options.project?`/projects/${this.options.project}`:``}${n.path}`,{method:n.method,headers:this.headers(n.method===`POST`),...n.body===void 0?{}:{body:n.body},credentials:`same-origin`,redirect:`error`,signal:t});if(!r.ok||!r.body)throw await r.body?.cancel(),new F(`unavailable`);let i=r.body.getReader(),a=new TextDecoder(`utf-8`,{fatal:!0}),o=``;try{for(;;){let{value:e,done:n}=await i.read();if(t.aborted)throw new F(`unavailable`);for(let t=0;t<(n?1:e.byteLength);t+=P.chunkBytes){o+=n?a.decode():a.decode(e.subarray(t,t+P.chunkBytes),{stream:!0});let r=o.indexOf(`
2
- `);for(;r!==-1;){let e=o.slice(0,r);o=o.slice(r+1),yield Mn(qe(e,P.controlBytes)),r=o.indexOf(`
3
- `)}if(new TextEncoder().encode(o).length>P.controlBytes)throw new F(`oversize`)}if(n){if(o)throw new F(`invalid`);break}}}finally{await i.cancel().catch(()=>{}),i.releaseLock()}}subscribe(e,t,n){let r=yt(e);if(!this.attachment||!this.options.socket)throw new F(`unavailable`);let i=this.options.socket(`${this.origin.replace(/^http/,`ws`)}${this.options.project?`/projects/${this.options.project}`:``}${lr}?attachment=${this.attachment}`),a=!1,o=!1,s=Date.now(),c=Date.now(),l=()=>{if(!o){o=!0,a=!1,clearInterval(d);try{i.close()}catch{}u(`closed`)}},u=e=>{try{n(e)}catch{}},d=setInterval(()=>{if(a){Date.now()-s>=P.staleMs&&u(`stale`);try{Date.now()-c>=P.reconcileMs?(i.send(J({kind:`resync`,scope:r})),c=Date.now()):i.send(`{"kind":"ping"}`)}catch{l()}}},P.heartbeatMs);return i.addEventListener(`open`,()=>{if(!o){a=!0;try{i.send(J({kind:`subscribe`,scope:r}))}catch{l()}}}),i.addEventListener(`message`,e=>{if(!o)try{if(typeof e.data!=`string`)throw new F(`invalid`);let n=vr(qe(e.data,P.viewerBytes));s=Date.now(),u(`current`),t(n)}catch{l()}}),i.addEventListener(`error`,l),i.addEventListener(`close`,l),l}};async function br(e,t){if(!e.body)throw new F(`invalid`);let n=e.body.getReader(),r=new TextDecoder(`utf-8`,{fatal:!0}),i=0,a=``;try{for(;;){let{value:e,done:o}=await n.read();if(o)return a+r.decode();if(i+=e.byteLength,i>t)throw new F(`oversize`);a+=r.decode(e,{stream:!0})}}finally{await n.cancel().catch(()=>{}),n.releaseLock()}}async function xr(e,t,n){let r=await e.preflight(t,n);return r.kind===`error`?r:{kind:`ok`,value:{preflight:r.value,commandId:crypto.randomUUID(),submitted:!1}}}function Sr(e,t){if(t.submitted)throw Error(`Already submitted; observe the same receipt.`);t.submitted=!0;let n=t.preflight,r={commandId:t.commandId,expected:n.preview.version,grant:n.grant},i=n.preview.action;switch(i.kind){case`create`:return e.create({...r,action:i});case`save-plan`:return e.savePlan({...r,action:i});case`generate-plan`:return e.generatePlan({...r,action:i});case`start`:return e.start({...r,action:i});case`check`:return e.check({...r,action:i});case`review`:return e.review({...r,action:i})}}var $=e=>({kind:`error`,error:Ue(`unavailable`,e?`uncertain`:`none`)}),Cr=class{transport;constructor(e){this.transport=e}async workbenchRead(e,t){let n=rr(e);try{return this.transport.workbenchRead?Q(await this.transport.workbenchRead(n,t),sr):$(!1)}catch{return $(!1)}}async workbenchCommand(e){let t=ir(e);try{if(!this.transport.workbenchCommand)return $(!0);let e=Q(await this.transport.workbenchCommand(t),sr);return e.kind===`ok`&&(!(`commandId`in e.value)||e.value.commandId!==t.commandId)?$(!0):e}catch{return $(!0)}}async current(e,t){let n=Vn(e);try{if(!this.transport.current)return $(!1);let e=Q(await this.transport.current(n,t),qn);return e.kind===`ok`&&J(e.value.request)!==J(n)?$(!1):e}catch{return $(!1)}}async currentChanges(e,t){let n=Hn(e);try{if(!this.transport.currentChanges)return $(!1);let e=Q(await this.transport.currentChanges(n,t),Jn);return e.kind===`ok`&&J(e.value.request)!==J(n)?$(!1):e}catch{return $(!1)}}async activeRuns(e){try{return this.transport.activeRuns?Q(await this.transport.activeRuns(e),Bt):$(!1)}catch{return $(!1)}}async models(e){try{return this.transport.models?Q(await this.transport.models(e),$n):$(!1)}catch{return $(!1)}}async chooseModel(e){let t=Zn(e);try{if(!this.transport.chooseModel)return $(!1);let e=Q(await this.transport.chooseModel(t),Xn);if(e.kind===`ok`){let{sourceSelectionId:n,...r}=e.value.selected??{};if(J(r)!==J(t.choice)||e.value.version.epoch!==t.expected.epoch||e.value.version.accessGeneration!==t.expected.accessGeneration||![t.expected.configRev,t.expected.configRev+1].includes(e.value.version.configRev)||e.value.version.configRev===t.expected.configRev!=(e.value.version.catalogId===t.expected.catalogId))return $(!0)}return e}catch{return $(!0)}}async checkObligations(e,t){G(e);try{let n=Q(await this.transport.checkObligations(e,t),In);return n.kind===`ok`&&n.value.taskId!==e?$(!1):n}catch{return $(!1)}}task(e,t){return this.entity(`task`,e,t)}message(e,t){return this.entity(`message`,e,t)}tool(e,t){return this.entity(`tool`,e,t)}async entity(e,t,n){let r=Ln({...t,kind:e});try{let e=Q(await this.transport.entity(r,n),zn);return e.kind===`ok`&&J(e.value.request)!==J(r)?$(!1):e}catch{return $(!1)}}async session(e){try{return Q(await this.transport.session(e),dn)}catch{return $(!1)}}async workspace(e){try{return Q(await this.transport.workspace(e),fn)}catch{return $(!1)}}tasks(e,t){return this.page(`tasks`,e,t)}runs(e,t){return this.page(`runs`,e,t)}messages(e,t){return this.page(`messages`,e,t)}tools(e,t){return this.page(`tools`,e,t)}contents(e,t){return this.page(`contents`,e,t)}events(e,t){return this.page(`events`,e,t)}checks(e,t){return this.page(`checks`,e,t)}changes(e,t){return this.page(`changes`,e,t)}reviews(e,t){return this.page(`reviews`,e,t)}async page(e,t,n){let r=bn({...t,reader:e});try{let t=Q(await this.transport[e](r,n),En);return t.kind===`ok`&&!Dn(r,t.value)?$(!1):t}catch{return $(!1)}}async graph(e,t){let n=On(e);try{let e=Q(await this.transport.graph(n,t),An);return e.kind===`ok`&&J(e.value.request)!==J(n)?$(!1):e}catch{return $(!1)}}async*export(e,t){let n=jn(e),r=new Pn(n),i;try{if(t.aborted)throw new F(`unavailable`);for await(let e of this.transport.export(n,t)){if(t.aborted)throw new F(`unavailable`);let n=r.receive(e);n.event.kind===`trailer`?i=n:yield n}if(t.aborted||!i)throw new F(`unavailable`);yield i}catch{throw new F(`unavailable`)}}async preflight(e,t){let n=dt({expected:e,action:t});try{let e=Q(await this.transport.preflight(n),gt);return e.kind===`ok`&&(J(e.value.preview.version)!==J(n.expected)||J(e.value.preview.action)!==J(n.action))?$(!1):e}catch{return $(!1)}}create(e){return this.execute(`create`,e)}savePlan(e){return this.execute(`save-plan`,e)}generatePlan(e){return this.execute(`generate-plan`,e)}start(e){return this.execute(`start`,e)}check(e){return this.execute(`check`,e)}review(e){return this.execute(`review`,e)}async execute(e,t){let n=ft(t);if(n.action.kind!==e)return{kind:`error`,error:Ue(`invalid`)};try{let e=Q(await this.transport.command(n),Kt);if(e.kind===`ok`){if(e.value.commandId!==n.commandId)return $(!0);qt({identity:{kind:`action`,expected:n.expected,action:n.action},receipt:e.value})}return e}catch{return $(!0)}}async cancel(e){let t=mt(e);try{let e=Q(await this.transport.cancel(t),Kt);if(e.kind===`ok`){if(e.value.commandId!==t.commandId)return $(!0);qt({identity:{kind:`cancel`,epoch:t.epoch,runId:t.runId},receipt:e.value})}return e}catch{return $(!0)}}async receipt(e,t){G(e);try{let n=Jt(await this.transport.receipt(e,t));if(n.status===`found`&&n.receipt.commandId!==e)throw Error(`invalid`);return n}catch{return{status:`inconclusive`,error:Ue(`receipt-inconclusive`,`uncertain`)}}}async snapshot(e,t){let n=yt(e);try{let e=Q(await this.transport.snapshot(n,t),Qt);return e.kind===`ok`&&J(e.value.scope)!==J(n)?$(!1):e}catch{return $(!1)}}async detail(e,t){let n=xt(e);try{let e=Q(await this.transport.detail(n,t),nn);return e.kind===`ok`&&J(e.value.cursor)!==J(n)?$(!1):e}catch{return $(!1)}}async search(e,t){let n=xt(e);try{let e=Q(await this.transport.search(n,t),an);return e.kind===`ok`&&J(e.value.cursor)!==J(n)?$(!1):e}catch{return $(!1)}}},wr=class{generation=0;snapshotRequest=0;observation;lastSnapshotMs=0;beginSnapshot(){return++this.snapshotRequest}install(e,t,n){if(n!==this.snapshotRequest)return;let r=Qt(e),i=this.observation?.snapshot;if(i&&i.storeId===r.storeId&&J(i.scope)===J(r.scope)&&Ge(r.committedSeq,i.committedSeq)<0)this.resync();else return this.observation={snapshot:r,connection:`current`,lastObservedMs:t},this.lastSnapshotMs=t,++this.generation}resync(){return this.observation&&(this.observation.connection=`resync`),this.snapshotRequest++,`resync`}get state(){return this.observation&&structuredClone(this.observation)}needsPoll(e){return!this.observation||this.observation.connection===`resync`||e<this.lastSnapshotMs||e-this.lastSnapshotMs>=P.reconcileMs}tick(e){let t=this.observation;t&&t.connection!==`resync`&&(e<t.lastObservedMs||e-t.lastObservedMs>=P.staleMs)&&(t.connection=`stale`)}receive(e,t,n){let r=this.observation;if(!r||t!==this.generation)return`ignored`;if(r.connection===`resync`)return`resync`;let i;try{i=$t(e)}catch{return this.resync()}let a=r.snapshot;if(i.storeId!==a.storeId||i.epoch!==a.epoch||J(i.scope)!==J(a.scope))return this.resync();let o=Ge(i.committedSeq,a.committedSeq);if(o<0)return`duplicate`;if(i.kind===`heartbeat`)return o>0?this.resync():(r.lastObservedMs=n,r.connection=`current`,`applied`);if(o===0)return`duplicate`;if(i.previousSeq!==a.committedSeq||cn(i.context)!==cn(a.context)||ln(i.context)!==ln(a.context)||i.context.status===`available`&&a.context.status===`available`&&i.context.version.controlRev<a.context.version.controlRev)return this.resync();let s=[...a.runs];for(let e of i.removed){let t=s.findIndex(t=>(t.childRunId??t.runId)===e);if(t===-1||s[t].lifecycle!==`settled`)return this.resync();s.splice(t,1)}for(let e of i.runs){let t=e.childRunId??e.runId,n=s.findIndex(e=>(e.childRunId??e.runId)===t);if(n===-1)s.push(e);else{let t=s[n];if(t.runId!==e.runId||t.childRunId!==e.childRunId||t.assignmentId!==e.assignmentId||J(t.admission)!==J(e.admission))return this.resync();s[n]=e}}if(s.length>P.maxPageEntries)return this.resync();let c={...a,runs:s,context:i.context,committedSeq:i.committedSeq,horizon:{...a.horizon,historicalRuns:{...a.horizon.historicalRuns,snapshotSeq:i.committedSeq}}};try{Qt(c)}catch{return this.resync()}return a.runs=s,a.horizon=c.horizon,a.context=i.context,a.committedSeq=i.committedSeq,r.lastObservedMs=n,r.connection=`current`,`applied`}},Tr={sourceHash:`9b1cc986f4dbc46b65d273591022a28d9ad30462ec728844bdacfe3bdd40eb64`,contractHash:`9c917c085d034e08764de359cee49aea748c395a63ed629fe67d149b97850fa1`,buildId:`72e54db75d264cd4992dcb7ae0fea5a0a482c1e8bb6faa2a6b63522a618f7176`};function Er(e){let t=new yr({origin:window.location.origin,...e?{project:e}:{},...Tr?{build:{kind:`browser`,...Tr}}:{},socket:e=>new WebSocket(e)});return{client:new Cr(t),transport:t}}async function Dr(e,t,n,r){let i=qn(e);if(i.context.status!==`available`||!i.context.version.task||!i.readablePlan?.editable||i.savedGraph.status===`unavailable`)throw new F(`unavailable`);let a=i.context.version,o=a.task;if(!o)throw new F(`stale`);let s=L(t,32768),c=ut({kind:`save-plan`,taskId:o.id,plan:s,graph:{schema:`cadence-graph/2`,taskId:o.id,taskKind:o.kind,taskRevision:o.revision+1,revision:(o.graphRevision??0)+1,planRevision:i.savedGraph.status===`saved`?i.savedGraph.planRevision+1:1,plan:{recordId:r.uuid(),version:i.savedGraph.status===`saved`?i.savedGraph.planRevision+1:1,field:`plan`,bytes:We(s),sha256:`0`.repeat(64)},assignments:n}});if(c.kind!==`save-plan`)throw new F(`invalid`);for(let e of c.graph.assignments){let t=i.roles.find(t=>t.role===rt(e.purpose));if(!t||J(t)!==J(e.role)||J(a.model)!==J(e.model))throw new F(`stale`)}c.graph.plan.sha256=await r.sha256(new TextEncoder().encode(s));let l=ut(c);if(l.kind!==`save-plan`)throw new F(`invalid`);return l}var Or=`Current plan metadata unavailable. Observe again; historical text is not action authority.`;function kr(e,t){let n=async n=>{let r=await e.current({storeId:t,taskId:n.task?.id??null});if(r.kind===`error`)throw new F(r.error.code);if(r.value.context.status!==`available`||J(r.value.context.version)!==J(n))throw new F(`stale`);return r.value},r=e=>({kind:`error`,error:Ue(e instanceof F?e.code:`unavailable`)});return{async read(t,i){try{let r=await n(t);if(!r.readablePlan||r.savedGraph.status===`unavailable`)throw new F(`unavailable`);let a=null;if(r.savedGraph.status===`saved`){let o=r.savedGraph.request;if(i&&(i.storeId!==o.storeId||J(i.graph)!==J(o.graph)||J(i.scope)!==J(o.scope)))throw new F(`stale`);let s=await e.graph(i??o);if(s.kind===`error`)return s;if(await n(t),`kind`in s.value)return{kind:`ok`,value:{...s.value,context:t}};a=s.value.graph}else if(i)throw new F(`stale`);return{kind:`ok`,value:{context:t,roles:r.roles,savedGraph:a,readablePlan:r.readablePlan.text,editable:r.readablePlan.editable}}}catch(e){return r(e)}},async saveAction(e,t){let i=structuredClone(t);try{let t=await Dr(await n(e),i.readablePlan,i.assignments,{uuid:()=>crypto.randomUUID(),sha256:async e=>Array.from(new Uint8Array(await crypto.subtle.digest(`SHA-256`,Uint8Array.from(e))),e=>e.toString(16).padStart(2,`0`)).join(``)});return await n(e),{kind:`ok`,value:t}}catch(e){return r(e)}}}}function Ar(e,t){if(e.commandId!==t.commandId)return e;let n=[e.receipt,e.lookup?.status===`found`?e.lookup.receipt:void 0,t.receipt,t.lookup?.status===`found`?t.lookup.receipt:void 0],r,i=!1;for(let t of n)t&&t.commandId===e.commandId&&(r&&(r.operationId!==t.operationId||r.runId!==t.runId||r.created!==null&&r.created.taskId!==t.created?.taskId)||r&&Ge(t.committedSeq,r.committedSeq)>0&&(r.created?.state===`published`&&t.created?.state!==`published`||r.admission===`accepted`&&t.admission!==`accepted`||r.execution!==null&&t.execution!==r.execution||r.settlement!==null&&J(t.settlement)!==J(r.settlement))?i=!0:(!r||Ge(t.committedSeq,r.committedSeq)>0||J(r)===J(t))&&(r=t));return{commandId:e.commandId,receipt:r,lookup:r?{status:`found`,receipt:r}:t.lookup??e.lookup,error:i?`Conflicting receipt observation refused; prior committed facts preserved.`:r?void 0:t.error??e.error}}function jr(e,t,n=0){let r=JSON.stringify(t),[i,a]=(0,f.useState)(0),[o,s]=(0,f.useState)({key:r});(0,f.useEffect)(()=>{if(r===`null`)return;let t=new AbortController,i,a=async()=>{let o=await e.workbenchRead(rr(JSON.parse(r)),t.signal);t.signal.aborted||(s(e=>o.kind===`ok`?{key:r,value:o.value}:{key:r,value:e.key===r?e.value:void 0,error:o.error.code}),n&&(i=setTimeout(()=>void a(),n)))};return a(),()=>{t.abort(),clearTimeout(i)}},[e,r,i,n]);let c=(0,f.useCallback)(()=>a(e=>e+1),[]);return{...o.key===r?o:{},refresh:c}}function Mr(e,t){let n=/^(?:\/cadence|cadence)(?:\s+|$)/.exec(e.trimStart());return n?{mode:`cadence`,text:e.trimStart().slice(n[0].length)}:{mode:t,text:e}}var Nr=e=>e===`unauthenticated`||e===`forbidden`,Pr=class{api;serial=Promise.resolve();version=0;stopCurrent;pollCurrent;constructor(e){this.api=e}refresh(e=!1){this.pollCurrent?.(e)}observe(e,t){this.stopCurrent?.();let n=++this.version,r=!1,i,a,o,s=new AbortController,c=new wr,l=0,u=0,d=!1,f=!1,p=0,m=!1,h=!1,g={actions:!1,transportStatus:`closed`,attachmentVersion:0},_=()=>!r&&n===this.version,v=()=>{_()&&t({...g,observation:c.state})},y=()=>{r||(r=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),n===this.version&&(this.pollCurrent=void 0))};this.stopCurrent=y;let b=e=>{this.serial=this.serial.then(e).catch(()=>{_()&&(m=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),g.error=`Observation unavailable or detach unconfirmed; explicit re-entry required.`,g.actions=!1,g.transportStatus=`closed`,g.workspace=void 0,c=new wr,v())})},x=async()=>{await this.api.transport.detach()},S=async(t=!1)=>{if(!_()||!f||d||m)return;d=!0,g.actions=!1;let n=!1;v(),p=Date.now();let r=s.signal;try{let i=async()=>{let e=await this.api.client.session(r);return!_()||r.aborted?!1:e.kind===`error`?(g.actions=!1,g.error=e.error.code,Nr(e.error.code)&&C(),!1):(w(e.value),!0)};if(t&&!await i())return;e||(g.transportStatus=`current`);let a=await this.api.client.activeRuns(r);if(!_()||r.aborted)return;if(a.kind===`ok`)g.activeRuns=a.value;else if(Nr(a.error.code)){C();return}else g.activeRuns=void 0;v();let o=await this.api.client.workspace(r);if(!_()||r.aborted)return;if(o.kind===`error`){g.error=o.error.code,Nr(o.error.code)&&C();return}if(!t&&J(g.workspace?.models??[])!==J(o.value.models)&&!await i())return;if(g.workspace=o.value,e){let t=c.beginSnapshot(),i=await this.api.client.snapshot(e,r);if(!_()||r.aborted)return;if(i.kind===`error`)g.error=i.error.code,Nr(i.error.code)&&C();else{let e=c.install(i.value,Date.now(),t);e!==void 0&&(l=e),g.error=void 0,n=!0}}else g.error=void 0,n=!0}catch{_()&&(g.error=`Observation unavailable.`,g.actions=!1,g.transportStatus=`stale`)}finally{d=!1,g.actions=n&&h,v()}},C=()=>{m=!0,g.actions=!1,g.transportStatus=`closed`,g.error=`Access revoked; explicit token re-entry required.`,g.workspace=void 0,g.activeRuns=void 0,c=new wr,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),b(x),v()},w=e=>{let t=Tr?{kind:`browser`,...Tr}:null;g.compatible=Gt(e.build,t),g.cancelCompatible=Gt(e.build,t,!0),h=e.capabilities.actions&&g.compatible},T=async()=>{if(f=!1,await x(),!_()||m)return;let t=await this.api.client.session();if(!_()||m){await x();return}if(t.kind===`error`){m=!0,g.error=`${t.error.code}; explicit re-entry required.`,g.workspace=void 0,c=new wr,g.actions=!1,v();return}if(f=!0,s=new AbortController,c=new wr,g={actions:t.value.capabilities.actions,transportStatus:`closed`,attachmentVersion:g.attachmentVersion+1},w(t.value),v(),await S(),!_()||m||!e)return;let n=++u;i=this.api.transport.subscribe(e,e=>{if(_()&&!m&&n===u){if(e.kind===`snapshot`){let t=c.install(e.snapshot,Date.now(),c.beginSnapshot());t!==void 0&&(l=t)}else e.kind===`event`?c.receive(e.event,l,Date.now())===`resync`&&S():S();v()}},e=>{_()&&!m&&n===u&&(g.transportStatus=e,e===`closed`&&(f=!1,g.actions=!1,g.attachmentVersion++,s.abort(),u++,o=setTimeout(()=>b(T),1e3)),v())})};return b(T),this.pollCurrent=e=>{S(e)},a=setInterval(()=>{_()&&!m&&(c.tick(Date.now()),v(),(Date.now()-p>=3e4||e&&c.needsPoll(Date.now()))&&S())},1e3),()=>{_()&&(y(),b(x))}}};function Fr(e,t,n){let r=(0,f.useMemo)(()=>new Pr(e),[e]),[i,a]=(0,f.useState)({actions:!1,transportStatus:`closed`,attachmentVersion:0}),o=t?.kind,s=t?.id;return(0,f.useEffect)(()=>{if(a({actions:!1,transportStatus:`closed`,attachmentVersion:0}),n)return r.observe(o&&s?{kind:o,id:s}:null,a)},[r,o,s,n]),{...i,refresh:(e=!1)=>r.refresh(e)}}var Ir=class{generation=0;identity=``;select(e){e!==this.identity&&(this.identity=e,this.depart())}depart(){this.generation++}ticket(){return this.generation}current(e){return e===this.generation}};function Lr({title:e,children:t,onClose:n}){let{t:r}=C(),i=(0,f.useRef)(null),a=(0,f.useId)(),o=(0,f.useRef)(n);return o.current=n,(0,f.useEffect)(()=>{let e=document.activeElement,t=i.current;return t?.showModal(),()=>{t?.close(),e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}},[]),(0,h.jsxs)(`dialog`,{ref:i,className:`action-dialog`,"aria-labelledby":a,onCancel:e=>{e.preventDefault(),o.current()},children:[(0,h.jsxs)(`header`,{children:[(0,h.jsx)(`h2`,{id:a,children:e}),(0,h.jsx)(`button`,{type:`button`,className:`dialog-close`,"aria-label":r(`Close dialog — no cancellation of accepted work`),title:r(`Close — accepted work is not cancelled`),onClick:n,children:(0,h.jsx)(ae,{"aria-hidden":`true`})})]}),t]})}function Rr(e){let t=e=>{if(typeof e==`string`||typeof e==`number`){let t=String(e);return t===``?[[]]:t.split(`
4
- `).map(e=>e===``?[]:[e])}if(Array.isArray(e)){let n=[];for(let r of e){let e=t(r);if(n.length===0)n=e;else{let t=e[0]??[];n[n.length-1].push(...t),n.push(...e.slice(1))}}return n}if(e&&typeof e==`object`&&`props`in e){let n=e,r=n.props?.children,i={...n.props,children:void 0},a=r==null?[]:t(r);return a.length===0?[[(0,f.createElement)(n.type,i)]]:a.map(e=>[(0,f.createElement)(n.type,i,...e)])}return[[e]]},n=t(e);return n.length>1&&n[n.length-1].length===0&&n.pop(),n}var zr=function(){let e=this.data();e.micromarkExtensions??=[],e.micromarkExtensions.push({flow:{92:Br(!0)},text:{92:Br(!1)}});let t={enter:{backslashMathInline:Vr,backslashMathDisplay:Vr,backslashMathBlock:Vr},exit:{backslashMathInline:Hr,backslashMathDisplay:Hr,backslashMathBlock:Hr}};e.fromMarkdownExtensions??=[],e.fromMarkdownExtensions.push(t)};function Br(e){return{tokenize:function(t,n,r){let i=this,a=93,o=e?`backslashMathBlock`:`backslashMathDisplay`,s;return c;function c(e){return e===92?(s=t.enter(o),t.consume(e),l):r(e)}function l(n){return n!==91&&(e||n!==40)?r(n):(a=n===91?93:41,!e&&n===40&&(o=`backslashMathInline`,s.type=o),t.consume(n),u)}function u(n){return n===null||e&&i.parser.lazy[i.now().line]?r(n):n===-5||n===-4||n===-3?(t.enter(`lineEnding`),t.consume(n),t.exit(`lineEnding`),u):(f(n),n===92?d:u)}function d(i){return i===a?(f(i),t.exit(o),e?p:n):i===null?r(i):i===-5||i===-4||i===-3?u(i):(f(i),u)}function f(e){t.enter(`backslashMathData`),t.consume(e),t.exit(`backslashMathData`)}function p(e){return e===null||e===-5||e===-4||e===-3?n(e):e===32||e===-2||e===-1?(t.enter(`whitespace`),t.consume(e),t.exit(`whitespace`),p):r(e)}},concrete:e,name:e?`backslashMathBlock`:`backslashMathText`}}var Vr=function(e){let t=e.type===`backslashMathBlock`,n=e.type!==`backslashMathInline`,r=this.sliceSerialize(e).slice(2,-2).trim(),i={type:`element`,tagName:`code`,properties:{className:[`language-math`,n?`math-display`:`math-inline`]},children:[{type:`text`,value:r}]},a=t?{type:`math`,meta:null,value:r,data:{hName:`pre`,hChildren:[i]}}:{type:`inlineMath`,value:r,data:{hName:`code`,hProperties:i.properties,hChildren:i.children}};this.enter(a,e)},Hr=function(e){this.exit(e)};function Ur(e){if(typeof document>`u`)return!1;let t=document.createElement(`textarea`),n=document.activeElement;try{return t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,t.setAttribute(`readonly`,``),document.body.appendChild(t),t.select(),document.execCommand(`copy`)}catch{return!1}finally{t.remove(),n instanceof HTMLElement&&n.isConnected&&n.focus()}}async function Wr(e){if(typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)try{return await navigator.clipboard.writeText(e),!0}catch{return Ur(e)}return Ur(e)}function Gr(e={}){let{duration:t=2e3,onSuccess:n,onError:r}=e,i=(0,f.useRef)(!0),[a,o]=(0,f.useState)(!1),s=(0,f.useRef)(null),c=(0,f.useCallback)(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},[]),l=(0,f.useCallback)(()=>{c(),o(!1)},[c]);return(0,f.useEffect)(()=>(i.current=!0,()=>{i.current=!1,c()}),[c]),{copied:a,copy:(0,f.useCallback)(async e=>{let a=!1;try{a=await Wr(e)}catch(e){a=!1,r&&r(e)}return i.current&&(a?(o(!0),c(),s.current=setTimeout(()=>{o(!1),s.current=null},t),n?.(e)):r&&!a&&r(Error(`Copy failed`))),a},[t,n,r,c]),reset:l}}var Kr=(0,f.memo)(function({text:e}){let{t}=C(),[n,r]=(0,f.useState)(!1),{copied:i,copy:a}=Gr();return(0,h.jsxs)(`button`,{type:`button`,className:`copy-btn`,title:t(`Copy displayed text`),"aria-label":t(`Copy displayed text`),onClick:()=>{r(!1),a(e).then(e=>r(!e))},children:[i?(0,h.jsx)(Fe,{}):(0,h.jsx)(Ae,{}),n&&t(`Copy unavailable`)]})}),qr=[s,d,zr],Jr=[s,l,d,zr],Yr=[[c,{strict:!1,throwOnError:!1,trust:!1,maxExpand:1e3}],[u,{detect:!1,ignoreMissing:!0}]];function Xr(e){if(e.startsWith(`#`)&&![...e].some(e=>e.charCodeAt(0)<=32))return e;try{let t=new URL(e);return![`https:`,`http:`].includes(t.protocol)||t.username||t.password||t.searchParams.has(`token`)?void 0:e}catch{return}}function Zr({text:e,rawHtml:t=!1,hardBreaks:n=!1}){return(0,h.jsx)(a,{remarkPlugins:n?Jr:qr,rehypePlugins:t?[i,o,...Yr]:Yr,skipHtml:!t,disallowedElements:[`iframe`,`object`,`embed`,`script`,`style`,`video`,`audio`,`source`,`form`,`input`],components:{pre:ei,a:$r,img:({alt:e})=>(0,h.jsxs)(`span`,{className:`omission`,children:[`[Image omitted: `,e||`external/media content`,`]`]})},children:e})}var Qr=(0,f.memo)(function(e){return(0,h.jsx)(`div`,{className:`md`,children:(0,h.jsx)(Zr,{...e})})});function $r({href:e,children:t}){let n=e&&Xr(e);return n?(0,h.jsx)(`a`,{href:n,target:n.startsWith(`#`)?void 0:`_blank`,rel:`noreferrer noopener`,referrerPolicy:`no-referrer`,children:t}):(0,h.jsxs)(`span`,{children:[t,` [link unavailable]`]})}function ei({children:e,node:t,...n}){let r=e&&typeof e==`object`&&`props`in e?e.props?.children:e,i=0,a=Rr(r).map(e=>{let t=`code-offset:${i}`;return i+=ti(e).length+1,{key:t,nodes:e}}),o=a.length>1,s=o?`${String(a.length).length+1}ch`:void 0;return(0,h.jsxs)(`div`,{className:`codeblock`,children:[(0,h.jsx)(Kr,{text:ti(e)}),(0,h.jsx)(`pre`,{...n,children:a.map(({nodes:e,key:t},n)=>(0,h.jsxs)(`div`,{className:`code-line`,children:[o&&(0,h.jsx)(`span`,{className:`code-num`,style:s?{width:s}:void 0,children:n+1}),(0,h.jsx)(`code`,{className:`code-line-body hljs`,children:e})]},t))})]})}function ti(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(ti).join(``);if(e&&typeof e==`object`&&`props`in e){let t=e.props;return ti(t?.children)}return``}function ni({prepared:e,client:t,current:n,onClose:r,onResult:i,attachmentVersion:a}){let{t:o,tx:s}=C(),[c,l]=(0,f.useState)(Date.now()),[u,d]=(0,f.useState)(!1);(0,f.useEffect)(()=>{let e=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(e)},[]);let p=e.preflight,m=p.preview,g=(0,f.useRef)(a),_=(0,f.useRef)(!1);(!n||J(n)!==J(m.version)||c>=Date.parse(p.expiresAt)||g.current!==a)&&(_.current=!0);let v=_.current,y=async()=>{if(!(v||e.submitted)){d(!0),i({commandId:e.commandId,error:o(`Admission pending/unknown — observe this exact receipt.`)});try{let n=await Sr(t,e);i(n.kind===`ok`?{commandId:e.commandId,receipt:n.value}:{commandId:e.commandId,error:o(`{code}; effect {effect}`,{code:n.error.code,effect:n.error.effect})})}catch{i({commandId:e.commandId,error:o(`Uncertain; do not repeat the action.`)})}r()}};return(0,h.jsxs)(Lr,{title:o(`Confirm {action}`,{action:s(m.action.kind)}),onClose:r,children:[(0,h.jsx)(`p`,{children:o(`Access is not consent. This confirmation applies only to the displayed context, once.`)}),(0,h.jsxs)(`dl`,{children:[(0,h.jsx)(`dt`,{children:o(`Checkout`)}),(0,h.jsx)(`dd`,{children:m.rootLabel}),(0,h.jsx)(`dt`,{children:o(`Working directory`)}),(0,h.jsx)(`dd`,{children:(0,h.jsx)(`code`,{children:m.cwdLabel})}),(0,h.jsx)(`dt`,{children:o(`Model / API / thinking`)}),(0,h.jsxs)(`dd`,{children:[m.version.model.provider,` / `,m.version.model.model,` /`,` `,m.version.model.api,` / `,m.version.model.thinking]}),(0,h.jsx)(`dt`,{children:o(`Check environment`)}),(0,h.jsx)(`dd`,{children:o(`Service launch environment policy, generation {generation}; no browser environment overlays.`,{generation:m.version.checkEnvGeneration})}),(0,h.jsx)(`dt`,{children:o(`Observation`)}),(0,h.jsx)(`dd`,{children:m.version.observation.complete?o(`Complete within bounded scope`):o(`Incomplete bounded coverage`)}),(0,h.jsx)(`dt`,{children:o(`Expires`)}),(0,h.jsx)(`dd`,{children:p.expiresAt})]}),(0,h.jsx)(ri,{preview:m}),m.action.kind===`check`&&(0,h.jsxs)(`section`,{children:[(0,h.jsx)(`h3`,{children:o(`Exact parent check`)}),(0,h.jsx)(`pre`,{children:m.action.check.command}),(0,h.jsx)(`p`,{children:o(`{name}; timeout {timeout} ms; cwd above.`,{name:m.action.check.name,timeout:m.action.check.timeoutMs})})]}),m.action.kind===`generate-plan`&&(0,h.jsx)(`p`,{children:o(`Readonly proposal only. It will not save itself or dispatch editing.`)}),m.issues.length>0&&(0,h.jsx)(`p`,{role:`alert`,children:o(`Issues: {issues}`,{issues:m.issues.map(s).join(`, `)})}),v&&(0,h.jsx)(`p`,{role:`alert`,children:o(`Context changed or confirmation expired. Close, observe again and request a new preview.`)}),(0,h.jsxs)(`footer`,{children:[(0,h.jsx)(`button`,{type:`button`,onClick:r,children:o(`Back — no new effect`)}),(0,h.jsx)(`button`,{type:`button`,className:`primary`,disabled:v||u||e.submitted,onClick:()=>void y(),children:o(`Confirm {action}`,{action:s(m.action.kind)})})]})]})}function ri({preview:e}){let{t,tx:n}=C(),r=e.action,i=r.kind===`save-plan`?r.graph:e.graph;return(0,h.jsxs)(h.Fragment,{children:[r.kind===`create`&&(0,h.jsxs)(`section`,{children:[(0,h.jsx)(`h3`,{children:t(`Create {kind} task`,{kind:n(r.taskKind)})}),(0,h.jsx)(`pre`,{children:r.goal}),(0,h.jsx)(`p`,{children:t(`No Start is included.`)})]}),r.kind!==`create`&&(0,h.jsx)(Qr,{text:r.kind===`save-plan`?r.plan:e.readablePlan}),i?.assignments.map(e=>(0,h.jsxs)(`section`,{children:[(0,h.jsxs)(`h3`,{children:[e.id,` · `,e.purpose]}),(0,h.jsxs)(`p`,{children:[e.role.role,` / `,e.role.sha256]}),(0,h.jsx)(`pre`,{children:JSON.stringify(e.model,null,2)}),(0,h.jsx)(Qr,{text:e.instructions}),(0,h.jsx)(`p`,{children:t(`Expected: {output}`,{output:e.expectedOutput})}),(0,h.jsx)(`pre`,{children:JSON.stringify(e.dependencies,null,2)})]},e.id)),r.kind===`save-plan`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`h3`,{children:t(`Exact proposed graph and identities (not yet committed)`)}),(0,h.jsx)(`pre`,{children:JSON.stringify(r.graph,null,2)})]}),r.kind===`review`&&(0,h.jsxs)(`section`,{children:[(0,h.jsx)(`h3`,{children:t(`Exact human review targets`)}),(0,h.jsx)(`pre`,{children:JSON.stringify(r,null,2)}),(0,h.jsx)(`p`,{children:t(`Human review only; failures, native exit, stale and not-run checks remain unchanged. Issues acknowledgment: {accepted}.`,{accepted:String(r.acceptIssues)})})]})]})}function ii({client:e,compatible:t,onClose:n,onChanged:r}){let{t:i,tx:a}=C(),[o,s]=(0,f.useState)(),[c,l]=(0,f.useState)(``),[u,d]=(0,f.useState)(``),[p,m]=(0,f.useState)(``),[g,_]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let t=new AbortController;return e.models(t.signal).then(e=>{t.signal.aborted||(e.kind===`ok`?s(e.value):d(e.error.code))}).catch(()=>{t.signal.aborted||d(`unavailable`)}),()=>t.abort()},[e]),(0,h.jsxs)(Lr,{title:i(`Choose owner model`),onClose:n,children:[(0,h.jsx)(`p`,{children:i(`Explicit owner-wide choice, only while quiescent. This does not resolve credentials, probe a provider, save a plan or Start work.`)}),(0,h.jsx)(`p`,{children:i(`Current: {model}`,{model:o?.selected?`${o.selected.provider}/${o.selected.model} · ${o.selected.thinking}`:i(`No model selected`)})}),(0,h.jsxs)(`label`,{children:[i(`Exact model / API / thinking`),(0,h.jsxs)(`select`,{value:c,disabled:!o,onChange:e=>l(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:i(`Select explicitly`)}),o?.entries.flatMap(e=>e.thinking.filter(e=>e.selectable).map(t=>{let n=JSON.stringify({provider:e.provider,model:e.model,api:e.api,thinking:t.level});return(0,h.jsxs)(`option`,{value:n,children:[e.provider,`/`,e.model,` · `,e.api,` · `,t.level]},n)}))]})]}),o?.status===`capacity`&&(0,h.jsx)(`p`,{children:i(`Catalog capacity exceeded; no partial model list is selectable.`)}),!!o?.withheld&&(0,h.jsx)(`p`,{role:`alert`,children:i(o.withheld===1?`{count} model withheld: its provider or model ID contains a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.`:`{count} models withheld: their provider or model IDs contain a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.`,{count:o.withheld})}),u&&(0,h.jsx)(`p`,{role:`alert`,children:i(`Model catalog unavailable ({code}); no model is selectable. No automatic retry.`,{code:a(u)})}),p&&(0,h.jsx)(`p`,{role:`alert`,children:i(`{error}. No automatic replacement or retry.`,{error:a(p)})}),(0,h.jsx)(`button`,{type:`button`,disabled:!t||!o||!c||g,onClick:()=>{o&&(_(!0),e.chooseModel({expected:o.version,choice:et(JSON.parse(c))}).then(e=>{e.kind===`error`?m(e.error.code):(r(),n())}).catch(()=>m(`Choice response unconfirmed; observe catalog before another explicit choice.`)).finally(()=>_(!1)))},children:i(`Confirm owner model choice`)})]})}function ai({client:e,value:t,onChange:n}){let{t:r,tx:i}=C(),a=(0,f.useRef)(!0),o=(0,f.useRef)(null);(0,f.useEffect)(()=>(a.current=!0,()=>{a.current=!1,o.current?.abort()}),[]);let[s,c]=(0,f.useState)(!1),l=t.receipt??(t.lookup?.status===`found`?t.lookup.receipt:void 0);return(0,h.jsxs)(`section`,{className:`receipt`,"aria-label":r(`Command receipt`),children:[(0,h.jsx)(`h3`,{children:r(`Command receipt`)}),(0,h.jsx)(`code`,{children:t.commandId}),t.error&&(0,h.jsx)(`p`,{role:`alert`,children:i(t.error)}),l&&(0,h.jsxs)(`dl`,{children:[(0,h.jsx)(`dt`,{children:r(`Admission`)}),(0,h.jsx)(`dd`,{children:i(l.admission)}),(0,h.jsx)(`dt`,{children:r(`Execution`)}),(0,h.jsx)(`dd`,{children:l.execution?i(l.execution):r(`not settled`)}),(0,h.jsx)(`dt`,{children:r(`Publication`)}),(0,h.jsx)(`dd`,{children:i(l.publication)}),(0,h.jsx)(`dt`,{children:r(`Run`)}),(0,h.jsx)(`dd`,{children:l.runId??r(`metadata action`)})]}),t.lookup&&t.lookup.status!==`found`&&(0,h.jsx)(`p`,{children:r(`{status}. This observation does not authorize replay.`,{status:i(t.lookup.status)})}),(0,h.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>{c(!0),o.current=new AbortController,e.receipt(t.commandId,o.current.signal).then(e=>{a.current&&(n({commandId:t.commandId,lookup:e}),c(!1))})},children:r(`Observe exact receipt`)})]})}function oi(e,t){let n=e??{content:t.content,chunks:[],offset:0},r=n.content,i=t.content;if(r.recordId!==i.recordId||r.version!==i.version||r.field!==i.field||r.sha256!==i.sha256||r.bytes!==i.bytes||n.offset!==(t.range?.start??0))throw Error(`Noncontiguous immutable field`);return{...n,chunks:[...n.chunks,t.text],offset:t.range?.end??0}}function si(e,t,n){switch(t.reader){case`tasks`:return e.tasks(t,n);case`runs`:return e.runs(t,n);case`messages`:return e.messages(t,n);case`tools`:return e.tools(t,n);case`contents`:return e.contents(t,n);case`events`:return e.events(t,n);case`checks`:return e.checks(t,n);case`changes`:return e.changes(t,n);case`reviews`:return e.reviews(t,n)}}function ci(e,t,n,r){return{storeId:e,scope:t,snapshotSeq:n,query:null,recordId:r.recordId,recordVersion:r.version,field:r.field,offset:0}}async function li(e,t,n){let r={...t,offset:0};delete r.navigation;let i=null,a=!0;for(;r;){if(n.aborted)throw Error(`canceled`);let t=await e.detail(r,n);if(n.aborted)throw Error(`canceled`);if(t.kind===`error`)throw Error(t.error.code);let o=t.value;r=o.next,`kind`in o||(a&&=o.coverage.observed===`complete`,i=oi(i,o)),await new Promise(e=>setTimeout(e,0))}if(!i||i.offset!==i.content.bytes)throw Error(`incomplete-content`);return{text:i.chunks.join(``),recordingComplete:a}}function ui(e,t){let n=t?J({reader:t.reader,storeId:t.storeId,scope:t.scope,limit:t.limit}):`absent`,[r,i]=(0,f.useState)(),[a,o]=(0,f.useState)(!1),[s,c]=(0,f.useState)(),[l,u]=(0,f.useState)(t),[d,p]=(0,f.useState)([]),m=(0,f.useRef)(0),[h,g]=(0,f.useState)(n);return h!==n&&(m.current++,g(n),i(void 0),c(void 0),u(t),p([])),(0,f.useEffect)(()=>{let t=++m.current;if(!l){o(!1);return}let n=new AbortController;return o(!0),c(void 0),si(e,l,n.signal).then(e=>{t===m.current&&(o(!1),e.kind===`error`?c(e.error.code):i(e.value))}).catch(()=>{t===m.current&&(c(`Read unavailable.`),o(!1))}),()=>{n.abort(),m.current++}},[e,l]),{page:r,busy:a,error:s,more:()=>{!a&&r?.next&&(l&&p(e=>[...e,l]),u(r.next))},previous:()=>{!a&&d.length&&(u(d[d.length-1]),p(e=>e.slice(0,-1)))},canPrevious:d.length>0,refresh:()=>{i(void 0),p([]),u(t?{...t}:null)}}}function di({value:e,compact:t=!1}){let{t:n,tx:r}=C();return t&&e.observed===`complete`&&e.source===`complete`&&!e.redacted&&e.omissions.length===0?(0,h.jsxs)(`details`,{className:`coverage-details`,children:[(0,h.jsx)(`summary`,{children:n(`Recording details`)}),(0,h.jsx)(di,{value:e})]}):(0,h.jsxs)(`p`,{className:`coverage${e.observed===`complete`&&e.source===`complete`&&!e.redacted&&e.omissions.length===0?``:` partial`}`,children:[n(`Recording: {observed}; source: {source};`,{observed:r(e.observed),source:r(e.source)}),` `,e.redacted?n(`redacted`):n(`no reported redaction`),e.omissions.length>0&&n(`; omitted: {omissions}`,{omissions:e.omissions.map(r).join(`, `)}),n(`. Not a guarantee of complete original source or universal secret detection.`)]})}function fi(e,t){let n=[],r=t;if(!r)return n;let i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){let t=e.parentElement;return!t||t.closest(`.search-bar`)||t.closest(`.msg-collapsed`)?NodeFilter.FILTER_REJECT:(e.textContent??``).includes(r)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(let e=i.nextNode();e;e=i.nextNode()){let t=e.textContent??``;if(!e.parentElement?.closest(`[data-retained-field]`))continue;let i=t.indexOf(r);for(;i!==-1;){let a=document.createRange();if(a.setStart(e,i),a.setEnd(e,i+r.length),n.push(a),n.length===1e3)return n;i=t.indexOf(r,i+r.length)}}return n}var pi=new Map;function mi(e,t){t.length?pi.set(e,t):pi.delete(e);let n=e.endsWith(`-active`);e=n?`cadence-page-active`:`cadence-page`,t=[...pi].filter(([e])=>e.endsWith(`-active`)===n).flatMap(([,e])=>e);let r=CSS;if(!r.highlights)return;if(t.length===0){r.highlights.delete(e);return}let i=window.Highlight;i&&r.highlights.set(e,new i(...t))}function hi(e,t){let n=[],r=e;for(;r&&r!==t;){let e=getComputedStyle(r);/(auto|scroll|hidden)/.test(e.overflowY+e.overflowX)&&(r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth)&&n.push(r),r=r.parentElement}return n}function gi(e,t){let n=t.startContainer.parentElement;for(let r of hi(n,e)){let e=t.getBoundingClientRect(),n=r.getBoundingClientRect();if(e.height<=0||e.width<=0)return;e.top>=n.top+4&&e.bottom<=n.bottom-4||(r.scrollTop+=e.top-n.top-(r.clientHeight-e.height)/2),e.left>=n.left+4&&e.right<=n.right-4||(r.scrollLeft+=e.left-n.left-(r.clientWidth-e.width)/2)}let r=t.getBoundingClientRect(),i=e.getBoundingClientRect();if(r.height<=0||r.width<=0)return;let a=r.top>=i.top+6&&r.bottom<=i.bottom-6,o=r.left>=i.left+6&&r.right<=i.right-6;a&&o||(a||(e.scrollTop+=r.top-i.top-(i.height-r.height)/2),o||(e.scrollLeft+=r.left-i.left-(i.width-r.width)/2))}function _i({container:e,version:t}){let{t:n}=C(),[r,i]=(0,f.useState)(``),[a,o]=(0,f.useState)(0),[s,c]=(0,f.useState)(0),l=(0,f.useRef)([]),u=`cadence-page-${(0,f.useId)().replace(/[^a-z0-9]/gi,``)}`;(0,f.useEffect)(()=>{if(!t)return;let n=e.current,i=n&&r?fi(n,r):[];return l.current=i,c(i.length),o(0),mi(u,i),()=>mi(u,[])},[r,e,t,u]);let d=t=>{let n=s?(a+t+s)%s:0;o(n),e.current&&l.current[n]&&(gi(e.current,l.current[n]),mi(`${u}-active`,[l.current[n]]))};return(0,f.useEffect)(()=>()=>mi(`${u}-active`,[]),[u]),(0,h.jsxs)(`div`,{className:`search-bar toolbar`,children:[(0,h.jsxs)(`label`,{children:[n(`Find on displayed field page`),(0,h.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d(e.shiftKey?-1:1))}})]}),(0,h.jsxs)(`span`,{children:[s?a+1:0,`/`,s,s>=1e3?n(` (first 1000 visual highlights)`):``,n(`; not whole-history search`)]}),(0,h.jsx)(`button`,{type:`button`,disabled:!s,onClick:()=>d(-1),children:n(`Previous match`)}),(0,h.jsx)(`button`,{type:`button`,disabled:!s,onClick:()=>d(1),children:n(`Next match`)})]})}function vi({client:e,cursor:t,highlight:n,render:r,compact:i=!1}){let{t:a,tx:o}=C(),s=J(t),c=(0,f.useMemo)(()=>xt(JSON.parse(s)),[s]),[l,u]=(0,f.useState)(t),[d,p]=(0,f.useState)(),[m,g]=(0,f.useState)([]),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(),[x,S]=(0,f.useState)(i?`markdown`:`raw`),[w,T]=(0,f.useState)(``),E=(0,f.useRef)(null),D=(0,f.useRef)(null);(0,f.useEffect)(()=>(u(c),g([]),p(void 0),b(void 0),()=>E.current?.abort()),[c]),(0,f.useEffect)(()=>{let t=!0,n=new AbortController;return v(!0),b(void 0),e.detail(l,n.signal).then(e=>{t&&(v(!1),e.kind===`error`?b(e.error.code):p(e.value))}).catch(()=>{t&&(b(`Read unavailable.`),v(!1))}),()=>{t=!1,n.abort()}},[e,l]);let ee=async()=>{if(E.current)return;let n=new AbortController;E.current=n,T(a(`Reading all retained field pages…`));try{let r=await li(e,t,n.signal);if(n.signal.aborted)return;let i=await Wr(r.text);if(n.signal.aborted)return;T(i?r.recordingComplete?a(`Copied all retained field bytes (source omissions still apply).`):a(`Copied retained field bytes; recording is incomplete. No complete-source claim.`):a(`Clipboard unavailable.`))}catch{n.signal.aborted||T(a(`Full-field copy refused/incomplete.`))}finally{E.current===n&&(E.current=null)}},O=d&&!(`kind`in d)?d:void 0;return(0,h.jsxs)(`section`,{className:`detail-pane${i?` message-field`:``}`,"aria-label":a(`Retained field`),children:[(0,h.jsxs)(`details`,{className:`field-details`,open:!i||void 0,children:[(0,h.jsx)(`summary`,{children:a(`Field details`)}),(0,h.jsxs)(`div`,{className:`detail-identity`,children:[(0,h.jsx)(`code`,{children:t.recordId}),` v`,t.recordVersion,` /`,` `,t.field&&o(t.field),` /`,` `,a(`snapshot {seq}`,{seq:t.snapshotSeq})]}),n&&(0,h.jsx)(`p`,{children:a(`Exact hit bytes [{start}, {end}); only this immutable field is highlighted.`,{start:n.start,end:n.end})}),(0,h.jsxs)(`div`,{className:`toolbar`,children:[(0,h.jsx)(`button`,{type:`button`,onClick:()=>S(e=>e===`raw`?`markdown`:`raw`),children:a(x===`raw`?`Markdown page`:`Raw page`)}),(0,h.jsx)(`button`,{type:`button`,disabled:!!E.current,onClick:()=>void ee(),children:a(`Copy full retained field`)}),!!E.current&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>{E.current?.abort(),E.current=null,T(a(`Copy canceled; execution unchanged.`))},children:a(`Cancel copy`)})]})]}),w&&(0,h.jsx)(`p`,{role:`status`,children:w}),y&&(0,h.jsx)(`p`,{role:`alert`,children:a(`Detail refused: {error}`,{error:o(y)})}),_&&(0,h.jsx)(`p`,{role:`status`,children:a(`Reading…`)}),d&&(0,h.jsx)(di,{value:d.coverage,compact:i}),d&&`kind`in d&&(0,h.jsx)(`p`,{children:a(`Validation in progress. The retained field is not empty.`)}),O&&(0,h.jsxs)(h.Fragment,{children:[(!i||O.next)&&(0,h.jsxs)(`p`,{children:[a(`Bytes {start}–{end} of {total}.`,{start:O.range?.start??0,end:O.range?.end??0,total:O.content.bytes}),` `,O.next?a(`More retained data available.`):a(`End of field.`)]}),!i&&(0,h.jsx)(_i,{container:D,version:`${O.content.recordId}:${O.content.version}:${O.range?.start??0}:${x}`}),(0,h.jsx)(`div`,{ref:D,"data-retained-field":!0,children:r?r(O.text):x===`markdown`?(0,h.jsx)(Qr,{text:O.text}):(0,h.jsx)(`pre`,{className:`detail-text`,children:(()=>{if(!O||!n||!O.range)return O?.text;let e=Math.max(n.start,O.range.start)-O.range.start,t=Math.min(n.end,O.range.end)-O.range.start;if(t<=e)return O.text;let r=new TextEncoder().encode(O.text),i=(e,t)=>new TextDecoder(`utf-8`,{fatal:!0}).decode(r.subarray(e,t));return(0,h.jsxs)(h.Fragment,{children:[i(0,e),(0,h.jsx)(`mark`,{children:i(e,t)}),i(t,r.length)]})})()})})]}),(!i||m.length>0||d?.next)&&(0,h.jsxs)(`div`,{className:`toolbar`,children:[(0,h.jsx)(`button`,{type:`button`,disabled:_||!m.length,onClick:()=>{u(m[m.length-1]),g(e=>e.slice(0,-1))},children:a(`Previous`)}),(0,h.jsx)(`button`,{type:`button`,disabled:_||!d?.next,onClick:()=>{d?.next&&(g(e=>[...e,l]),u(d.next))},children:d&&`kind`in d?a(`Continue validation`):a(`Next field page`)})]})]})}function yi({pager:e,compact:t=!1}){let{t:n,tx:r}=C(),{page:i,busy:a,error:o}=e;return(0,h.jsxs)(`div`,{className:`page-controls${t?` compact`:``}`,children:[o&&(0,h.jsx)(`p`,{role:`alert`,children:n(`Read refused: {error}. Retained state has not been repaired.`,{error:r(o)})}),a&&(0,h.jsx)(`p`,{role:`status`,children:n(`Reading bounded history page…`)}),i&&`kind`in i&&(0,h.jsxs)(`p`,{role:`status`,children:[i.kind===`snapshot`?n(`Snapshot selected`):n(`Validating retained history`),n(`; continue this exact read. No data page yet.`)]}),i&&(0,h.jsx)(di,{value:i.coverage,compact:t}),(!t||e.canPrevious)&&(0,h.jsx)(`button`,{type:`button`,disabled:a||!e.canPrevious,onClick:e.previous,children:n(`Previous page`)}),(!t||i?.next)&&(0,h.jsx)(`button`,{type:`button`,disabled:a||!i?.next,onClick:e.more,children:i&&`kind`in i?n(`Continue validation`):n(`Next page`)}),(0,h.jsx)(`button`,{type:`button`,disabled:a,onClick:e.refresh,"aria-label":n(`Observe a new snapshot`),title:n(`Observe a new snapshot`),children:t?(0,h.jsx)(fe,{"aria-hidden":`true`}):n(`Observe a new snapshot`)}),!t&&i&&!(`kind`in i)&&!i.next&&(0,h.jsx)(`span`,{className:`page-end`,children:i.coverage.observed===`incomplete`?n(`End of this retained snapshot (incomplete).`):n(`End of this retained snapshot.`)})]})}function bi({client:e,seed:t,entityId:n}){let{t:r,tx:i}=C(),a=ui(e,{...t,reader:`contents`}),[o,s]=(0,f.useState)(),c=a.page;return(0,h.jsxs)(`section`,{"aria-label":r(`Retained content fields`),children:[(0,h.jsx)(yi,{pager:a}),n&&(0,h.jsx)(`p`,{children:(0,h.jsx)(y,{text:r(`Showing matches for entity {entity} on this page only. Continue paging for other fields/versions.`),slots:{entity:(0,h.jsx)(`code`,{children:n})}})}),c&&!(`kind`in c)&&c.records.map(e=>e.kind!==`content`&&e.kind!==`omitted`||n&&e.owner.entity.id!==n?null:e.kind===`omitted`?(0,h.jsxs)(`p`,{className:`omission`,children:[r(`Omitted source block:`),` `,(0,h.jsx)(`code`,{children:JSON.stringify(e.block)})]},`${e.owner.entity.id}:${e.version}:${JSON.stringify(e.block.owner)}`):(0,h.jsxs)(`article`,{children:[(0,h.jsxs)(`p`,{children:[i(e.owner.entity.kind),` `,(0,h.jsx)(`code`,{children:e.owner.entity.id}),` ·`,` `,i(e.content.field),` ·`,` `,r(`{bytes} retained bytes`,{bytes:e.content.bytes})]}),(0,h.jsx)(`pre`,{children:JSON.stringify(e.descriptor.owner)}),(0,h.jsx)(di,{value:e.coverage}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{c.request.scope.kind!==`workspace`&&c.request.snapshotSeq!==null&&s(ci(c.request.storeId,c.request.scope,c.request.snapshotSeq,e.content))},children:r(`Inspect complete retained field`)})]},`${e.content.recordId}:${e.content.version}`)),o&&(0,h.jsx)(vi,{client:e,cursor:o},`${o.recordId}:${o.recordVersion}`)]})}function xi({client:e,seed:t}){return(0,h.jsx)(Si,{client:e,seed:t},J(t))}function Si({client:e,seed:t}){let{t:n,tx:r}=C(),[i,a]=(0,f.useState)(t),[o,s]=(0,f.useState)(),[c,l]=(0,f.useState)(),[u,d]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let t=!0,n=new AbortController;return d(!0),(i.kind===`message`?e.message(i,n.signal):i.kind===`tool`?e.tool(i,n.signal):e.task(i,n.signal)).then(e=>{t&&(d(!1),e.kind===`error`?l(e.error.code):(s(e.value),l(void 0)))}).catch(()=>{t&&(l(`Read unavailable.`),d(!1))}),()=>{t=!1,n.abort()}},[e,i]),(0,h.jsxs)(`section`,{"aria-label":n(`Exact entity metadata`),children:[u&&(0,h.jsx)(`p`,{children:n(`Reading exact entity version…`)}),c&&(0,h.jsx)(`p`,{role:`alert`,children:n(`Entity refused: {error}`,{error:r(c)})}),o&&`kind`in o&&(0,h.jsx)(di,{value:o.coverage}),o&&(`kind`in o?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:n(`Entity validation in progress, not missing.`)}),(0,h.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>a(o.next),children:n(`Continue exact entity validation`)})]}):(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:n(`Exact stored owner and associations`)}),(0,h.jsx)(`pre`,{children:JSON.stringify(o.record,null,2)})]}))]})}function Ci(e=typeof window>`u`?``:window.location.search){let t=new URLSearchParams(e).get(`project`);return t&&/^[a-f0-9]{64}$/.test(t)?t:null}function wi(){let e=Ci();return e?`/projects/${e}`:``}function Ti(e){let t=_r(`download`,jn(e));if(t.method!==`GET`)throw Error(`Native download needs the named GET attachment route.`);let n=document.createElement(`a`);n.href=wi()+t.path,n.download=`cadence-${e.scope.kind}-${e.scope.id}.${e.format===`markdown`?`md`:`ndjson`}`,n.referrerPolicy=`no-referrer`,document.body.appendChild(n),n.click(),n.remove()}function Ei({request:e,onClose:t}){let{t:n,tx:r}=C(),[i]=(0,f.useState)(e),[a,o]=(0,f.useState)(e.format),[s,c]=(0,f.useState)(``);return(0,h.jsxs)(Lr,{title:n(`Export retained history`),onClose:t,children:[(0,h.jsx)(`p`,{children:n(`Selected {kind}: {id} · snapshot {seq}`,{kind:r(i.scope.kind),id:i.scope.id,seq:i.snapshotSeq})}),(0,h.jsxs)(`label`,{children:[n(`Format`),(0,h.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value===`markdown`?`markdown`:`ndjson`),children:[(0,h.jsx)(`option`,{value:`ndjson`,children:n(`NDJSON public archive`)}),(0,h.jsx)(`option`,{value:`markdown`,children:n(`Readable Markdown with footer metadata`)})]})]}),(0,h.jsx)(`p`,{children:n(`Includes retained context, messages/tools, graph, lifecycle, changes, checks, human review and coverage beyond loaded pages. Redactions and source omissions remain.`)}),(0,h.jsx)(`p`,{children:n(`A native browser download request cannot establish completion. Inspect the original EOF and completion trailer/counts/digest in the downloaded artifact; missing footer means incomplete. Revoked access may terminate without a trailer.`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{try{Ti({...i,format:a}),c(n(`Download requested — completion not verified by this browser UI.`))}catch{c(n(`Download unavailable; no archive claimed complete.`))}},children:n(`Request selected-scope download`)}),(0,h.jsx)(`p`,{role:`status`,children:s})]})}function Di(e,t){if(!t||We(t)>P.queryBytes)throw Error(`Query must be 1–${P.queryBytes} UTF-8 bytes; it was not clipped.`);let{navigation:n,...r}=e;return xt({...r,query:t,recordId:null,recordVersion:null,field:null,offset:0})}function Oi(e){return e.next?`No hits in this bounded window; search is not finished.`:`No hits in the final retained window. Coverage limits above still apply.`}function ki({client:e,seed:t,onClose:n,onHit:r}){let{t:i,tx:a}=C(),[o]=(0,f.useState)(t),s=(0,f.useRef)(null),c=(0,f.useRef)(0),[l,u]=(0,f.useState)(``),[d,p]=(0,f.useState)(0),[m,g]=(0,f.useState)(),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(),x=(0,f.useRef)(null),S=(0,f.useCallback)(async(t,n)=>{x.current?.abort();let r=new AbortController;x.current=r,v(!0),b(void 0);try{let i=await e.search(t,r.signal);if(c.current!==n||r.signal.aborted)return;i.kind===`error`?b(i.error.code):(g(i.value),p(0))}catch{c.current===n&&!r.signal.aborted&&b(`Search unavailable or invalid; no automatic retry.`)}finally{c.current===n&&!r.signal.aborted&&v(!1)}},[e]);return(0,f.useEffect)(()=>(s.current?.focus(),()=>{c.current++,x.current?.abort()}),[]),(0,f.useEffect)(()=>{let e=++c.current;if(x.current?.abort(),v(!1),g(void 0),p(0),b(void 0),!l)return;let t;try{t=Di(o,l)}catch{b(`Query must be 1–1024 UTF-8 bytes; it was not clipped.`);return}let n=setTimeout(()=>void S(t,e),300);return()=>{clearTimeout(n),c.current++,x.current?.abort()}},[l,o,S]),(0,h.jsx)(Lr,{title:i(`Search retained history`),onClose:n,children:(0,h.jsxs)(`div`,{className:`gs-modal`,children:[(0,h.jsxs)(`div`,{className:`gs-input-row`,children:[(0,h.jsx)(de,{}),(0,h.jsx)(`input`,{ref:s,"aria-label":i(`Case-sensitive literal query`),value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),p(e=>Math.max(0,Math.min(e+1,(m?.hits.length??0)-1)))),e.key===`ArrowUp`&&(e.preventDefault(),p(e=>Math.max(e-1,0))),e.key===`Enter`&&m?.hits[d]&&(e.preventDefault(),r(m.hits[d]),n())}})]}),(0,h.jsx)(`p`,{children:i(`Case-sensitive literal UTF-8 search. Scope {kind} {id}; snapshot {seq}. No regex, provider request or history repair.`,{kind:a(o.scope.kind),id:o.scope.id,seq:o.snapshotSeq})}),(0,h.jsxs)(`div`,{className:`gs-results`,children:[_&&(0,h.jsx)(`p`,{role:`status`,children:i(`Searching bounded retained range…`)}),y&&(0,h.jsx)(`p`,{role:`alert`,children:i(`Search refused: {error}`,{error:a(y)})}),!l&&(0,h.jsx)(`p`,{children:i(`Enter a query to search this selected scope.`)}),m&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(di,{value:m.coverage}),(0,h.jsxs)(`div`,{className:`gs-section`,children:[(0,h.jsx)(`div`,{className:`gs-section-head`,children:i(`Matches on this page: {count}`,{count:m.hits.length})}),m.hits.map((e,t)=>(0,h.jsxs)(`button`,{type:`button`,className:`gs-item ${d===t?`active`:``}`,onMouseEnter:()=>p(t),onClick:()=>{r(e),n()},children:[(0,h.jsxs)(`span`,{className:`gs-item-title`,children:[a(e.owner.entity.kind),` · `,a(e.content.field),` · v`,e.content.version]}),(0,h.jsx)(`span`,{className:`gs-item-sub`,children:e.preview}),(0,h.jsxs)(`code`,{children:[e.owner.childRunId??e.owner.runId??e.owner.taskId,` `,`/ `,e.content.recordId,` /`,` `,i(`bytes {start}–{end}`,{start:e.range.start,end:e.range.end})]})]},`${e.content.recordId}:${e.content.version}:${e.range.start}`)),m.hits.length===0&&(0,h.jsx)(`p`,{children:a(Oi(m))})]}),(0,h.jsx)(`button`,{type:`button`,disabled:_||!m.next,onClick:()=>{m.next&&S(m.next,++c.current)},children:i(`Continue same snapshot search`)})]})]}),(0,h.jsx)(`footer`,{className:`gs-foot`,children:i(`↑↓ Navigate · Enter Open exact hit · Escape Close. Reopening never resumes execution.`)})]})})}function Ai({run:e,historical:t=!1}){let{t:n,tx:r}=C();return(0,h.jsxs)(`article`,{className:`run-summary`,children:[(0,h.jsxs)(`h3`,{children:[e.assignmentId??e.admission.kind,` ·`,` `,n(t?`historical projection`:`owner projection`)]}),(0,h.jsx)(`p`,{children:(0,h.jsx)(`code`,{children:e.childRunId??e.runId})}),(0,h.jsxs)(`dl`,{children:[(0,h.jsx)(`dt`,{children:n(`Lifecycle`)}),(0,h.jsx)(`dd`,{children:r(e.lifecycle)}),(0,h.jsx)(`dt`,{children:n(`Execution`)}),(0,h.jsx)(`dd`,{children:e.outcome?r(e.outcome):n(`unsettled`)}),(0,h.jsx)(`dt`,{children:n(`Wait/block reason`)}),(0,h.jsx)(`dd`,{children:e.reason?r(e.reason):n(`none reported`)}),(0,h.jsx)(`dt`,{children:n(`Summary publication`)}),(0,h.jsx)(`dd`,{children:r(e.publication)})]}),(0,h.jsx)(di,{value:e.coverage}),(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:n(`Native / recording / parent settlement facts (independent of human review)`)}),(0,h.jsx)(`pre`,{children:e.settlement?JSON.stringify(e.settlement,null,2):n(`No settlement recorded`)})]})]})}function ji({client:e,seed:t}){return(0,h.jsx)(Mi,{client:e,seed:t},J(t))}function Mi({client:e,seed:t}){let{t:n,tx:r}=C(),[i,a]=(0,f.useState)(t),[o,s]=(0,f.useState)(),[c,l]=(0,f.useState)(),[u,d]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let t=!0,n=new AbortController;return d(!0),e.graph(i,n.signal).then(e=>{t&&(d(!1),e.kind===`error`?l(e.error.code):(s(e.value),l(void 0)))}).catch(()=>{t&&(l(`Read unavailable.`),d(!1))}),()=>{t=!1,n.abort()}},[e,i]),(0,h.jsxs)(`section`,{children:[(0,h.jsx)(`h3`,{children:n(`Immutable admitted graph`)}),c&&(0,h.jsx)(`p`,{role:`alert`,children:n(`Graph refused: {error}`,{error:r(c)})}),u&&(0,h.jsx)(`p`,{children:n(`Reading graph…`)}),o&&`kind`in o&&(0,h.jsx)(di,{value:o.coverage}),o&&(`kind`in o?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:n(`Graph validation in progress; not an empty graph.`)}),(0,h.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>a(o.next),children:n(`Continue graph validation`)})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(vi,{client:e,cursor:ci(o.request.storeId,o.request.scope,o.request.snapshotSeq,o.graph.plan)}),o.graph.assignments.map(e=>(0,h.jsxs)(`article`,{children:[(0,h.jsxs)(`h4`,{children:[e.id,` / `,e.purpose]}),(0,h.jsx)(Qr,{text:e.instructions}),(0,h.jsx)(`p`,{children:n(`Expected: {output}`,{output:e.expectedOutput})}),(0,h.jsx)(`pre`,{children:JSON.stringify({model:e.model,role:e.role,dependencies:e.dependencies},null,2)})]},e.id))]}))]})}function Ni({client:e,seed:t,onScope:n}){let{t:r}=C(),i=ui(e,{...t,reader:`runs`}),a=i.page,[o,s]=(0,f.useState)();return(0,h.jsxs)(`section`,{children:[(0,h.jsx)(yi,{pager:i}),a&&!(`kind`in a)&&a.records.map(e=>e.kind===`run`?(0,h.jsxs)(`article`,{children:[(0,h.jsx)(Ai,{run:e.projection,historical:!0}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>n({kind:e.projection.childRunId?`child`:`run`,id:e.projection.childRunId??e.projection.runId}),children:r(`Open retained episode/child details`)}),e.projection.admission.graph&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>{a.request.scope.kind!==`workspace`&&a.request.snapshotSeq!==null&&e.projection.admission.graph&&s({storeId:a.request.storeId,scope:a.request.scope,snapshotSeq:a.request.snapshotSeq,graph:e.projection.admission.graph})},children:r(`Inspect admitted graph and plan`)})]},e.projection.childRunId??e.projection.runId):null),o&&(0,h.jsx)(ji,{client:e,seed:o},o.graph.recordId)]})}function Pi({onOpen:e,disabled:t}){let{t:n}=C();return(0,h.jsx)(`button`,{type:`button`,className:`chip search-toggle`,"aria-label":n(`Search all retained pages in selected scope`),"data-tip":n(`Search all retained pages in selected scope`),disabled:t,onClick:e,children:(0,h.jsx)(de,{"aria-hidden":`true`})})}function Fi(e,t,n,r,i){let a=i??t,o=[],s=[],c=0;for(let i of e)n.has(i.id)||(r.has(i.id)?i.top<t.bottom&&i.bottom>t.top&&o.push(i.id):i.top<a.bottom&&i.bottom>a.top||(s.push(i.id),i.bottom<=a.top&&(c+=i.bottom-i.top)));return{show:o,hide:s,shrinkAbove:c}}function Ii(e,t){if(t.show.length===0&&t.hide.length===0)return e;let n=new Set(e);for(let e of t.show)n.delete(e);for(let e of t.hide)n.add(e);return n}function Li(e,t,n){let r=new Set,i=0;for(let a=e.length-1;a>=0&&!(a<e.length-1&&i>=n);a--){let n=e[a];r.add(n.id),i+=t.get(n.id)??Ri(n.role,n.customType)}return r}function Ri(e,t){switch(e){case`user`:return 72;case`assistant`:return 280;case`tool-result`:return 120;case`custom`:return t===`file`?96:72;default:return 60}}function zi(e,t,n,r){let i=n.get(e);return i&&i.len===t?i.h:r}var Bi=(0,f.memo)(function({id:e,show:t,height:n,containerRef:r,onMeasured:i,lazyRef:a,children:o}){let s=(0,f.useRef)(null);return(0,f.useLayoutEffect)(()=>{if(!t)return;let n=s.current;if(!n)return;let r=n.offsetHeight;r>0&&i?.(e,r)},[t,e,i]),t?(0,h.jsx)(`div`,{ref:a,"data-lazy-id":e,children:(0,h.jsx)(`div`,{ref:s,children:o})}):(0,h.jsx)(`div`,{ref:a,className:`msg-lazy-ph`,"data-msg-id":e,"data-lazy-id":e,style:{height:n},"aria-hidden":`true`})}),Vi=(0,f.memo)(function({message:e,client:t,seed:n}){let{t:r,tx:i}=C(),[a,o]=(0,f.useState)(!1);return(0,h.jsxs)(`article`,{className:`msg msg-${e.role}`,"data-msg-id":e.owner.entity.id,children:[(0,h.jsxs)(`header`,{className:`msg-meta`,children:[(0,h.jsx)(`strong`,{className:`msg-role`,children:i(e.role)}),e.state!==`final`&&(0,h.jsx)(`span`,{className:`msg-state`,children:i(e.state)}),(0,h.jsxs)(`button`,{type:`button`,className:`msg-inspect`,"aria-expanded":a,onClick:()=>o(e=>!e),children:[a?(0,h.jsx)(Me,{"aria-hidden":`true`}):(0,h.jsx)(Ee,{"aria-hidden":`true`}),r(a?`Collapse`:`Inspect message`)]})]}),(0,h.jsxs)(`div`,{className:`msg-body`,children:[e.role===`tool-result`&&(0,h.jsx)(`p`,{className:`msg-note`,children:r(`Result call: {call}. Kept visible independently of the tool card.`,{call:e.resultCallId??r(`unassociated / orphan`)})}),(0,h.jsx)(`div`,{className:`msg-text`,children:(0,h.jsxs)(`div`,{className:`msg-text-main`,children:[e.finalText&&n.scope.kind!==`workspace`&&n.snapshotSeq!==null?(0,h.jsx)(vi,{compact:!0,client:t,cursor:ci(n.storeId,n.scope,n.snapshotSeq,e.finalText)}):(0,h.jsx)(`p`,{children:r(`No finalized text field in this snapshot. Inspect retained partial/final blocks and omission metadata below.`)}),a&&(0,h.jsxs)(`div`,{className:`message-inspection`,children:[(0,h.jsx)(`p`,{className:`msg-ident`,children:r(`Child {child} · message {message} · version {version}`,{child:e.owner.childRunId??``,message:e.owner.entity.id,version:e.version})}),(0,h.jsx)(`p`,{className:`msg-note`,children:r(`{state} message record, not execution outcome`,{state:i(e.state)})}),(0,h.jsxs)(`details`,{open:!0,children:[(0,h.jsx)(`summary`,{children:r(`All message blocks, source limits and tool associations`)}),(0,h.jsx)(bi,{client:t,seed:n,entityId:e.owner.entity.id})]})]})]})})]})]})});function Hi({messages:e,client:t,seed:n}){let{t:r}=C(),i=(0,f.useRef)(null),a=(0,f.useRef)(!0),[o,s]=(0,f.useState)(()=>new Set),c=(0,f.useRef)(o);c.current=o;let l=(0,f.useRef)(new Map),u=(0,f.useRef)(new Map),d=(0,f.useRef)(new Map),p=(0,f.useRef)(0),m=(0,f.useMemo)(()=>e.map(e=>({id:e.owner.entity.id,role:e.role,message:e})),[e]),g=(0,f.useRef)(new Map);g.current=new Map(m.map(e=>[e.id,e.message.version]));let _=(0,f.useRef)(new Set);_.current=Li(m,l.current,1800);let v=(0,f.useCallback)((e,t)=>{let n=g.current.get(e);n!==void 0&&(u.current.set(e,{h:t,len:n}),l.current.set(e,t))},[]),y=(0,f.useCallback)(()=>{let e=i.current;if(!e)return;let t=e.getBoundingClientRect(),n=[];for(let[e,t]of d.current){let r=t.getBoundingClientRect();n.push({id:e,top:r.top,bottom:r.bottom}),c.current.has(e)||v(e,r.height)}let r=Fi(n,{top:t.top-1200,bottom:t.bottom+1200},_.current,c.current,{top:t.top-2400,bottom:t.bottom+2400});for(let e of r.hide){let t=d.current.get(e);t&&v(e,t.offsetHeight)}s(e=>Ii(e,r))},[v]),b=(0,f.useCallback)(()=>{p.current||=requestAnimationFrame(()=>{p.current=0,y()})},[y]);return(0,f.useLayoutEffect)(()=>{m.length?y():s(new Set)},[y,m]),(0,f.useEffect)(()=>{let e=new ResizeObserver(b);return i.current&&e.observe(i.current),()=>{e.disconnect(),cancelAnimationFrame(p.current)}},[b]),(0,h.jsxs)(`div`,{className:`messages-wrap`,children:[(0,h.jsx)(`div`,{className:`messages`,ref:i,onScroll:e=>{let t=e.currentTarget;a.current=t.scrollHeight-t.scrollTop-t.clientHeight<80,b()},children:m.map(({id:e,role:r,message:a})=>(0,h.jsx)(Bi,{id:e,show:!o.has(e),height:zi(e,a.version,u.current,r===`user`?100:280),containerRef:i,onMeasured:v,lazyRef:t=>{t?d.current.set(e,t):d.current.delete(e)},children:(0,h.jsx)(Vi,{message:a,client:t,seed:n})},e))}),(0,h.jsxs)(`button`,{type:`button`,className:`scroll-bottom`,onClick:()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight,a.current=!0)},children:[(0,h.jsx)(ze,{"aria-hidden":`true`}),r(`Latest on loaded page`)]})]})}function Ui({client:e,seed:t}){let{t:n}=C(),r=ui(e,{...t,reader:`messages`}),i=r.page;return(0,h.jsxs)(`section`,{className:`transcript`,children:[(0,h.jsx)(yi,{pager:r,compact:!0}),i&&!(`kind`in i)&&t.snapshotSeq!==null&&i.request.snapshotSeq!==t.snapshotSeq&&(0,h.jsx)(`button`,{type:`button`,className:`conversation-update`,disabled:r.busy,onClick:r.refresh,children:n(`New activity — update conversation`)}),i&&!(`kind`in i)&&(0,h.jsxs)(h.Fragment,{children:[i.records.length===0&&(0,h.jsx)(`p`,{className:`empty-note panel-empty`,children:i.next?n(`No message records on this page; more history remains.`):n(`No message records on this page.`)}),(0,h.jsx)(Hi,{messages:i.records.filter(e=>e.kind===`message`),client:e,seed:i.request},`${i.request.snapshotSeq}:${i.request.after?.recordId??`first`}`)]})]})}function Wi({open:e,onToggle:t,headClassName:n,titleText:r,icon:i,iconClassName:a,titleClassName:o,toggleClassName:s,toggle:c,onHeadContextMenu:l,children:u,after:d}){return(0,h.jsxs)(`div`,{className:`chead ${n}`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`chead-main`,"aria-expanded":e,title:r,onClick:t,onContextMenu:l,children:[c===void 0?(0,h.jsx)(`span`,{className:s?`chead-toggle ${s}`:`chead-toggle`,children:e?(0,h.jsx)(Pe,{}):(0,h.jsx)(Ne,{})}):c,(0,h.jsx)(`span`,{className:a?`chead-icon ${a}`:`chead-icon`,children:i}),(0,h.jsx)(`span`,{className:o?`chead-title ${o}`:`chead-title`,children:u})]}),d]})}var Gi=(0,f.memo)(function({record:e,client:t,seed:n}){let{t:r,tx:i}=C(),[a,o]=(0,f.useState)(!1),s=e.result?e.result.isError?r(`SDK tool error observed`):r(`SDK tool end observed`):e.startObserved?r(`Start observed; end not observed in this snapshot`):r(`No start observed`),c=e.result?e.result.isError?`err`:`ok`:e.startObserved?`pending`:``;return(0,h.jsxs)(`div`,{className:`toolcall${c===`err`?` err`:``}`,children:[(0,h.jsx)(Wi,{open:a,onToggle:()=>o(e=>!e),headClassName:`toolcall-head`,titleText:r(`Inspect recorded tool call`),icon:(0,h.jsx)(ce,{}),iconClassName:`toolcall-icon`,titleClassName:`toolcall-name`,after:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`span`,{className:`toolcall-path`,children:r(`Child {child} · call {call} · v{version}`,{child:e.owner.childRunId??``,call:e.owner.entity.id,version:e.version})}),(0,h.jsx)(`span`,{className:`toolcall-badge ${c}`,children:s})]}),children:e.name}),a&&(0,h.jsxs)(`div`,{className:`toolcall-body`,children:[(0,h.jsx)(`p`,{children:r(`SDK tool observations are not native process launch/close or passing parent checks.`)}),(0,h.jsxs)(`dl`,{children:[(0,h.jsx)(`dt`,{children:r(`Source ID`)}),(0,h.jsxs)(`dd`,{children:[i(e.source.disposition),`:`,` `,e.source.value??r(`unavailable`)]}),(0,h.jsx)(`dt`,{children:r(`Declaration`)}),(0,h.jsx)(`dd`,{children:e.declaration?`${e.declaration.messageId} / ${e.declaration.blockId} (${i(String(e.declarationStage))})`:r(`No declaration recorded; orphan result remains accessible`)})]}),(0,h.jsxs)(`div`,{className:`toolcall-output`,children:[(0,h.jsx)(`div`,{className:`toolcall-output-label`,children:r(`Recorded tool end (not parsed from output)`)}),(0,h.jsx)(`pre`,{children:e.result?JSON.stringify(e.result,null,2):r(`No end fact in this snapshot.`)})]}),(0,h.jsx)(`div`,{className:`toolcall-args`,children:(0,h.jsx)(bi,{client:t,seed:n,entityId:e.owner.entity.id})})]})]})});function Ki({client:e,active:t,taskId:n,runs:r,snapshot:i,onOpen:a}){let{t:o,tx:s}=C(),[c,l]=(0,f.useState)(!0),[u,d]=(0,f.useState)([]),[p,m]=(0,f.useState)(!1),g=JSON.stringify(t?.status===`complete`?[...new Set(t.runs.map(e=>e.taskId))]:[]);(0,f.useEffect)(()=>{let t=new AbortController,n,r=async()=>{let i=[],a=!1;for(let n of JSON.parse(g)){let r=await e.snapshot({kind:`task`,id:n},t.signal);if(t.signal.aborted)return;if(r.kind===`ok`)for(let e of r.value.runs)e.childRunId&&i.push({taskId:n,run:e,snapshot:r.value.committedSeq});else a=!0}t.signal.aborted||(d(i),m(a),n=setTimeout(()=>void r(),3e3))};return r(),()=>{t.abort(),clearTimeout(n)}},[e,g]);let _=n&&i?r.filter(e=>e.childRunId).map(e=>({taskId:n,run:e,snapshot:i})):[],v=[...u,..._.filter(e=>!u.some(t=>t.run.childRunId===e.run.childRunId))].sort((e,t)=>Number(e.run.lifecycle===`settled`)-Number(t.run.lifecycle===`settled`));return(0,h.jsxs)(`section`,{className:`agent-dock${c?``:` collapsed`}`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`agent-dock-heading`,"aria-expanded":c,onClick:()=>l(e=>!e),children:[(0,h.jsx)(Pe,{}),(0,h.jsx)(ke,{}),(0,h.jsx)(`span`,{children:o(`Subagents`)}),(0,h.jsx)(`span`,{className:`lp-count`,children:v.length})]}),c&&(0,h.jsxs)(`div`,{className:`agent-dock-body`,children:[(p||t?.status!==`complete`)&&(0,h.jsx)(`p`,{className:`panel-hint`,children:o(`Subagent roster unavailable`)}),v.length===0&&!p&&t?.status===`complete`&&(0,h.jsx)(`p`,{className:`panel-hint`,children:o(`Cadence subagents appear here when a task runs.`)}),v.map(e=>(0,h.jsxs)(`button`,{type:`button`,className:`agent-dock-row`,onClick:()=>a(e.taskId,e.run.childRunId,e.snapshot,e.run.assignmentId??o(`Subagent`)),children:[(0,h.jsx)(`span`,{className:`agent-dot ${e.run.outcome??e.run.lifecycle}`}),(0,h.jsxs)(`span`,{className:`agent-dock-label`,children:[(0,h.jsx)(`strong`,{children:e.run.assignmentId??o(`Subagent`)}),(0,h.jsx)(`small`,{children:o(`Task {id}`,{id:e.taskId.slice(0,8)})})]}),(0,h.jsx)(`span`,{className:`ep-state ${e.run.outcome??e.run.lifecycle}`,children:s(e.run.outcome??e.run.lifecycle)})]},e.run.childRunId))]})]})}var qi=/^\s{0,3}(`{3,}|~{3,})/,Ji=/^\s{0,3}(?:[-*+]|\d{1,9}[.)])\s/;function Yi(e){return e.trim()===``}function Xi(e){let t=qi.exec(e);return t?t[1]:null}function Zi(e){let t=e.split(`
1
+ import{r as e}from"./rolldown-runtime.js";import{n as t,r as n,t as r}from"./react.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./markdown.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var f=e(n(),1),p=t(),m={"The shared registry lock is blocking projects. On the service host, run cadence recover inspect --workspace <project> with the same --state-home, then use recover resolve in a local terminal if eligible. Do not delete lock files manually.":`共享注册表锁正在阻止项目打开。请在服务所在主机运行 cadence recover inspect --workspace <project>,使用相同的 --state-home;符合恢复条件时,在本机终端运行 recover resolve。请勿手动删除锁文件。`,"Start a conversation from the sidebar.":`从左侧开启一段新对话。`,"No conversations yet.":`还没有对话。`,"Choose a working folder at the bottom right to start chatting.":`在右下角选择工作文件夹,即可开始对话。`,"Files appear here after you open a working folder.":`打开工作文件夹后,在这里浏览文件。`,"No working folder selected":`未选择工作文件夹`,"Task created, but its conversation link was not confirmed.":`任务已创建,但与普通对话的关联尚未确认。`,"Workbench projects":`工作台项目`,"Your workbench, your projects":`你的工作台,你的项目`,"No default workspace is created. Open an existing folder to use ordinary conversations and Cadence tasks.":`不会创建默认工作区。打开已有文件夹,即可使用普通对话和 Cadence 任务。`,"Opening a project never starts a task. Switching projects keeps admitted work running in its original directory.":`打开项目不会启动任务。切换项目后,已接纳的工作仍在原目录中继续。`,"Selected project is unavailable. Choose a project explicitly; no directory was reconstructed.":`所选项目不可用,请明确选择项目;未重建任何目录。`,"No projects associated yet.":`尚未关联任何项目。`,"Chat ready":`可以开始对话`,"Conversation capture limit exceeded.":`对话记录已达到容量上限。`,"Start a new conversation; incomplete context is not replayed.":`请新建对话;不会重放不完整的上下文。`,"Current metadata unavailable; showing the active turn only. No state was reconstructed.":`当前对话元数据不可用,仅显示仍在运行的轮次,未重建任何状态。`,"Send unavailable. Check the message limit (16 KiB); observe any pending command before sending again.":`暂时无法发送。请检查消息是否超过 16 KiB;如有待确认的命令,请先观察其结果,不要重复发送。`,Files:`文件`,"File list":`文件列表`,"Workspace panels":`工作区面板`,"Task details":`任务详情`,"Switch working folder":`切换工作文件夹`,"Open working folder":`打开工作文件夹`,"Open this project":`打开此项目`,"Opening project…":`正在打开项目…`,"Folder path":`文件夹路径`,Browse:`浏览`,"Parent folder":`上级文件夹`,"Choose a folder on the service host. Opening reuses or starts that project's independent service; current work keeps running.":`选择服务所在主机上的文件夹。打开时将复用或启动该项目的独立服务,当前工作会继续运行。`,"New conversation":`新对话`,Ordinary:`普通对话`,"Ordinary conversation":`普通对话`,"Cadence task":`Cadence 任务`,"Conversation mode":`对话模式`,"Back to ordinary conversation":`返回普通对话`,"What would you like to work on?":`今天想做些什么?`,"Chat normally, or start with /cadence to prepare a task. Nothing starts until you send.":`直接聊天,或以 /cadence 开头准备任务。发送前不会启动任何工作。`,"Message, or /cadence followed by a task…":`输入消息,或使用 /cadence 描述任务…`,Message:`消息`,Send:`发送`,"Stop response":`停止回复`,"Prepare task":`准备任务`,"Prepare a plan first; Start requires confirmation.":`先准备计划,执行需另行确认 Start。`,"Direct host tools · no Cadence task":`直接使用主机工具 · 不创建 Cadence 任务`,"Conversation turn":`对话轮次`,You:`你`,Tool:`工具`,"Earlier messages":`较早的消息`,"Latest messages":`最新消息`,"Send outcome not yet observed:":`尚未观察到此次发送的结果:`,"Observe this send before sending again. No automatic retry.":`请先观察此次发送的结果,不会自动重试。`,"This turn has no complete continuation context. Start a new conversation; retained messages are preserved.":`此轮没有完整的续聊上下文。请新建对话,已记录的消息会保留。`,Subagents:`子代理`,"Subagent roster unavailable":`暂时无法观察子代理列表`,"Cadence subagents appear here when a task runs.":`Cadence 任务运行时,子代理会显示在这里。`,"Refresh files":`刷新文件`,"Reference {path}":`引用 {path}`,"Copy path {path}":`复制路径 {path}`,"No visible files":`没有可显示的文件`,"Close preview":`关闭预览`,"Bounded listing; narrow the directory to see more.":`列表已达到显示上限,请进入更具体的目录查看。`,"File preview is limited; this is not the complete file.":`文件预览已截断,并非完整内容。`,"Readonly preview · references send paths, not file contents":`只读预览 · 引用只发送路径,不自动注入文件内容`,"Hidden thinking, signatures and media are not retained.":`隐藏思考、签名和媒体内容不予保留。`,"Cadence task workspace":`Cadence 任务工作区`,"Presentation unavailable":`界面无法显示`,"No execution result is inferred. Reconnect to observe the owner; accepted work continues.":`不会推断任何执行结果。重新连接以观察所有者服务;已接受的工作会继续进行。`,"Reload observation":`重新加载观察`,"Build information":`构建信息`,Conversation:`对话`,Details:`详情`,"Back to task":`返回任务`,"Task {id}":`任务 {id}`,"{kind} {id}":`{kind} {id}`,Subagent:`子代理`,"Recorded conversation":`已记录对话`,"Recording details":`记录信息`,"Field details":`原文与复制`,"New activity — update conversation":`有新动态 · 更新对话`,"No retained conversations on this page.":`本页没有已保留的对话。`,"Recent projects":`最近项目`,"This service exposes one project. Opening it never starts work.":`当前服务连接一个项目,打开项目不会启动执行。`,"Running conversations":`运行的对话`,"Conversation history":`历史对话`,"Task conversations":`任务对话与子代理`,Tasks:`任务`,"Recorded views":`已记录视图`,messages:`消息`,tools:`工具`,context:`上下文`,timeline:`时间线`,runs:`运行`,outcomes:`结果`,"Export selected scope":`导出所选范围`,"Copy token-free link":`复制不含令牌的链接`,"Link copy unavailable.":`无法复制链接。`,"Observe current state":`重新观察当前状态`,"Choose owner model":`选择所有者模型`,Model:`模型`,"Return — work continues":`返回——工作继续`,"Return — accepted work continues":`返回——已接受的工作会继续`,Return:`返回`,"Plan / review":`计划 / 审阅`,Plan:`计划`,"Execution and cancellation":`执行与取消`,"Open active task":`打开活动任务`,"Cancel run — request stop":`取消运行——请求停止`,"{message}.":`{message}。`,"Context changed. Observe again and request a fresh confirmation.":`上下文已变化。请重新观察并请求新的确认。`,"Explicit service guidance: {status} / {start}. No service is started by this page.":`显式服务操作:{status} / {start}。本页面不会启动任何服务。`,"Close drawer":`关闭抽屉`,"Task navigation drawer":`任务导航抽屉`,"Plan and review drawer":`计划与审阅抽屉`,"Selected {kind}:":`已选{kind}:`,"· snapshot {seq}.":`· 快照 {seq}。`,"Pages and old outcomes are historical observations, not renewed consent.":`分页内容和旧结果是历史观察,不代表重新授权。`,"Open a task or create one explicitly":`打开一个任务,或显式创建一个`,"Plans, children, checks and human review share one service owner. No chat or discovery activates execution.":`计划、子运行、检查和人工审阅共用一个服务所有者。聊天或浏览不会触发执行。`,"Create task":`创建任务`,"No owner run projection in this snapshot.":`此快照中没有所有者运行视图。`,"No snapshot observed yet; absence is not proof of settlement.":`尚未观察到快照;没有记录不代表已结束。`,"Connection freshness is not execution outcome.":`连接是否最新不代表执行结果。`," · transport {status}":` · 传输:{status}`,"{count} active run":`{count} 个活动运行`,"{count} active runs":`{count} 个活动运行`,"No active runs":`没有活动运行`,"Active roster unavailable; absence is not proof of settlement.":`活动运行列表不可用;没有记录不代表已结束。`,"unbuilt source":`未构建的源码`,"Local browser build: {build}.":`本地浏览器构建:{build}。`,"Shared compatibility: {state}.":`共享兼容性:{state}。`,compatible:`兼容`,"unavailable / mismatch — reload built assets; normal actions disabled":`不可用 / 不匹配——请重新加载构建产物;常规操作已禁用`,"Service unavailable":`服务不可用`,"Task snapshot not observed yet":`尚未观察到任务快照`,"No task selected":`未选择任务`,"Resize left pane":`调整左侧面板宽度`,"Resize right pane":`调整右侧面板宽度`,Detached:`已断开`,"Accepted service work continues. No Cancel was requested.":`已接受的服务工作会继续进行。没有请求取消。`,"Observe command after reconnect:":`重新连接后观察命令:`,"Reconnect as a viewer":`以查看者身份重新连接`,"Current action context unavailable; observe again.":`当前操作上下文不可用;请重新观察。`,"Preflight refused: {code}":`预检被拒绝:{code}`,"Preflight unavailable. No automatic retry.":`预检不可用。不会自动重试。`,"Stop requested; settlement is not yet confirmed.":`已请求停止;尚未确认结束。`,"{code}; cancellation effect {effect}. Observe exact receipt.":`{code};取消效果 {effect}。请观察确切回执。`,"Cancellation effect uncertain. Observe exact receipt.":`取消效果不确定。请观察确切回执。`,"Observation unavailable or detach unconfirmed; explicit re-entry required.":`观察不可用或断开未确认;需要显式重新进入。`,"Observation unavailable.":`观察不可用。`,"Access revoked; explicit token re-entry required.":`访问已被撤销;需要显式重新输入令牌。`,Kind:`类型`,Code:`代码`,"Readonly research":`只读调研`,"Readonly diagnosis":`只读诊断`,Goal:`目标`,"Preview Create (does not Start)":`预览创建(不会启动)`,"Close dialog — no cancellation of accepted work":`关闭对话框——不会取消已接受的工作`,"Close — accepted work is not cancelled":`关闭——不会取消已接受的工作`,"Admission pending/unknown — observe this exact receipt.":`准入待定/未知——请观察这个确切回执。`,"{code}; effect {effect}":`{code};效果 {effect}`,"Uncertain; do not repeat the action.":`结果不确定;请勿重复此操作。`,"Confirm {action}":`确认{action}`,"Access is not consent. This confirmation applies only to the displayed context, once.":`访问权限不等于同意。此确认仅对所显示的上下文生效一次。`,Checkout:`工作副本`,"Working directory":`工作目录`,"Model / API / thinking":`模型 / API / 思考`,"Check environment":`检查环境`,"Service launch environment policy, generation {generation}; no browser environment overlays.":`服务启动环境策略,第 {generation} 代;不叠加浏览器环境。`,Observation:`观察`,"Complete within bounded scope":`在限定范围内完整`,"Incomplete bounded coverage":`限定范围覆盖不完整`,Expires:`过期时间`,"Exact parent check":`确切的父级检查`,"{name}; timeout {timeout} ms; cwd above.":`{name};超时 {timeout} 毫秒;工作目录见上。`,"Readonly proposal only. It will not save itself or dispatch editing.":`仅为只读提案。它不会自行保存,也不会分派编辑。`,"Issues: {issues}":`问题:{issues}`,"Context changed or confirmation expired. Close, observe again and request a new preview.":`上下文已变化或确认已过期。请关闭、重新观察并请求新的预览。`,"Back — no new effect":`返回——不产生新效果`,"Create {kind} task":`创建{kind}任务`,"No Start is included.":`不包含启动。`,"Expected: {output}":`预期产出:{output}`,"Exact proposed graph and identities (not yet committed)":`确切的提议任务图与标识(尚未提交)`,"Exact human review targets":`确切的人工审阅对象`,"Human review only; failures, native exit, stale and not-run checks remain unchanged. Issues acknowledgment: {accepted}.":`仅为人工审阅;失败、原生退出、过期和未运行的检查保持不变。问题确认:{accepted}。`,"Explicit owner-wide choice, only while quiescent. This does not resolve credentials, probe a provider, save a plan or Start work.":`显式的所有者级选择,仅在空闲时可用。它不会解析凭据、探测提供方、保存计划或启动工作。`,"Current: {model}":`当前:{model}`,"No model selected":`未选择模型`,"Exact model / API / thinking":`确切的模型 / API / 思考级别`,"Select explicitly":`请显式选择`,"Catalog capacity exceeded; no partial model list is selectable.":`模型目录超出容量;不能从不完整的列表中选择。`,"{error}. No automatic replacement or retry.":`{error}。不会自动替换或重试。`,"{count} model withheld: its provider or model ID contains a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.":`{count} 个模型未列出:其提供方或模型 ID 包含某个凭据值(例如与提供方名称相同的 apiKey)或控制字符。请让每个凭据值都不与任何提供方或模型 ID 重合;修改 models.json 后需重启服务。`,"{count} models withheld: their provider or model IDs contain a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.":`{count} 个模型未列出:其提供方或模型 ID 包含某个凭据值(例如与提供方名称相同的 apiKey)或控制字符。请让每个凭据值都不与任何提供方或模型 ID 重合;修改 models.json 后需重启服务。`,"Model catalog unavailable ({code}); no model is selectable. No automatic retry.":`模型目录不可用({code});无法选择任何模型。不会自动重试。`,"Choice response unconfirmed; observe catalog before another explicit choice.":`选择的响应未确认;请先观察目录再进行下一次显式选择。`,"Confirm owner model choice":`确认所有者模型选择`,"Command receipt":`命令回执`,Admission:`准入`,Execution:`执行`,"not settled":`未结束`,Publication:`发布`,Run:`运行`,"metadata action":`元数据操作`,"{status}. This observation does not authorize replay.":`{status}。此观察不授权重放。`,"Observe exact receipt":`观察确切回执`,"Conflicting receipt observation refused; prior committed facts preserved.":`冲突的回执观察已被拒绝;之前提交的事实已保留。`,"Retained content fields":`保留的内容字段`,"Showing matches for entity {entity} on this page only. Continue paging for other fields/versions.":`仅显示本页中实体 {entity} 的匹配项。继续翻页可查看其他字段/版本。`,"Omitted source block:":`已省略的源块:`,"{bytes} retained bytes":`保留 {bytes} 字节`,"Inspect complete retained field":`查看完整的保留字段`,"Recording: {observed}; source: {source};":`记录:{observed};来源:{source};`,redacted:`已脱敏`,"no reported redaction":`未报告脱敏`,"; omitted: {omissions}":`;已省略:{omissions}`,". Not a guarantee of complete original source or universal secret detection.":`。不保证原始来源完整,也不保证能检测出所有机密。`,"Reading all retained field pages…":`正在读取所有保留字段页…`,"Copied all retained field bytes (source omissions still apply).":`已复制全部保留字段字节(来源省略仍然适用)。`,"Copied retained field bytes; recording is incomplete. No complete-source claim.":`已复制保留字段字节;记录不完整。不声称来源完整。`,"Clipboard unavailable.":`剪贴板不可用。`,"Full-field copy refused/incomplete.":`完整字段复制被拒绝/不完整。`,"Retained field":`保留字段`,"snapshot {seq}":`快照 {seq}`,"Exact hit bytes [{start}, {end}); only this immutable field is highlighted.":`确切命中字节 [{start}, {end});仅高亮这个不可变字段。`,"Markdown page":`Markdown 页`,"Raw page":`原始页`,"Copy full retained field":`复制完整保留字段`,"Copy canceled; execution unchanged.":`复制已取消;执行不受影响。`,"Cancel copy":`取消复制`,"Detail refused: {error}":`详情被拒绝:{error}`,"Reading…":`读取中…`,"Validation in progress. The retained field is not empty.":`正在验证。该保留字段并非为空。`,"Bytes {start}–{end} of {total}.":`第 {start}–{end} 字节,共 {total} 字节。`,"More retained data available.":`还有更多保留数据。`,"End of field.":`字段结束。`,Previous:`上一页`,"Continue validation":`继续验证`,"Next field page":`下一字段页`,"Read unavailable.":`读取不可用。`,"Exact entity metadata":`确切的实体元数据`,"Reading exact entity version…":`正在读取确切的实体版本…`,"Entity refused: {error}":`实体被拒绝:{error}`,"Entity validation in progress, not missing.":`实体正在验证,并非缺失。`,"Continue exact entity validation":`继续确切的实体验证`,"Exact stored owner and associations":`确切存储的所有者与关联`,"Export retained history":`导出保留历史`,"Selected {kind}: {id} · snapshot {seq}":`已选{kind}:{id} · 快照 {seq}`,Format:`格式`,"NDJSON public archive":`NDJSON 公开归档`,"Readable Markdown with footer metadata":`带页脚元数据的可读 Markdown`,"Includes retained context, messages/tools, graph, lifecycle, changes, checks, human review and coverage beyond loaded pages. Redactions and source omissions remain.":`包括已加载页之外的保留上下文、消息/工具、任务图、生命周期、变更、检查、人工审阅和覆盖范围。脱敏和来源省略仍然保留。`,"A native browser download request cannot establish completion. Inspect the original EOF and completion trailer/counts/digest in the downloaded artifact; missing footer means incomplete. Revoked access may terminate without a trailer.":`浏览器原生下载请求无法证明下载完成。请检查下载文件中的原始 EOF 以及完成尾部/计数/摘要;缺少页脚即表示不完整。访问被撤销时可能在没有尾部的情况下终止。`,"Download requested — completion not verified by this browser UI.":`已请求下载——此浏览器界面未验证是否完成。`,"Download unavailable; no archive claimed complete.":`下载不可用;不声称任何归档完整。`,"Request selected-scope download":`请求下载所选范围`,"Search retained history":`搜索保留历史`,"Case-sensitive literal query":`区分大小写的字面查询`,"Case-sensitive literal UTF-8 search. Scope {kind} {id}; snapshot {seq}. No regex, provider request or history repair.":`区分大小写的 UTF-8 字面搜索。范围:{kind} {id};快照 {seq}。不使用正则,不请求提供方,也不修复历史。`,"Searching bounded retained range…":`正在搜索限定的保留范围…`,"Search refused: {error}":`搜索被拒绝:{error}`,"Enter a query to search this selected scope.":`输入查询以搜索所选范围。`,"Matches on this page: {count}":`本页匹配:{count}`,"bytes {start}–{end}":`字节 {start}–{end}`,"Continue same snapshot search":`在同一快照中继续搜索`,"↑↓ Navigate · Enter Open exact hit · Escape Close. Reopening never resumes execution.":`↑↓ 移动 · Enter 打开确切命中 · Escape 关闭。重新打开不会恢复执行。`,"Search unavailable or invalid; no automatic retry.":`搜索不可用或无效;不会自动重试。`,"Query must be 1–1024 UTF-8 bytes; it was not clipped.":`查询必须为 1–1024 个 UTF-8 字节;未做截断。`,"No hits in this bounded window; search is not finished.":`此限定窗口中没有命中;搜索尚未完成。`,"No hits in the final retained window. Coverage limits above still apply.":`最后的保留窗口中没有命中。上方的覆盖范围限制仍然适用。`,"Immutable admitted graph":`不可变的已准入任务图`,"Graph refused: {error}":`任务图被拒绝:{error}`,"Reading graph…":`正在读取任务图…`,"Graph validation in progress; not an empty graph.":`任务图正在验证;并非空图。`,"Continue graph validation":`继续验证任务图`,"Find on displayed field page":`在当前字段页中查找`," (first 1000 visual highlights)":`(前 1000 处可视高亮)`,"; not whole-history search":`;不是全历史搜索`,"Previous match":`上一个匹配`,"Next match":`下一个匹配`,"Read refused: {error}. Retained state has not been repaired.":`读取被拒绝:{error}。保留状态未被修复。`,"Reading bounded history page…":`正在读取限定的历史页…`,"Snapshot selected":`已选择快照`,"Validating retained history":`正在验证保留历史`,"; continue this exact read. No data page yet.":`;请继续这次确切读取。尚无数据页。`,"Previous page":`上一页`,"Next page":`下一页`,"Observe a new snapshot":`观察新快照`,"End of this retained snapshot (incomplete).":`此保留快照已结束(不完整)。`,"End of this retained snapshot.":`此保留快照已结束。`,"Open retained episode/child details":`打开保留的执行轮次/子运行详情`,"Inspect admitted graph and plan":`查看已准入的任务图与计划`,"Search all retained pages in selected scope":`搜索所选范围内的所有保留页`,"Select a task to inspect plans, checks, changes and review.":`选择一个任务以查看计划、检查、变更和审阅。`,Inspector:`检查器`,plan:`计划`,checks:`检查`,changes:`变更`,review:`审阅`,"Owner metadata is stale.":`所有者元数据已过期。`,"Owner metadata unavailable.":`所有者元数据不可用。`,"Plan proposal unavailable.":`计划提案不可用。`,"Current plan metadata unavailable. Observe again; historical text is not action authority.":`当前计划元数据不可用。请重新观察;历史文本不能作为操作依据。`,"Saved graph proof in progress.":`已保存任务图的证明正在进行。`,"Continue saved graph read":`继续读取已保存的任务图`,"Load observed saved plan into local draft":`将观察到的已保存计划载入本地草稿`,"Current control context unavailable. Historical data is not action authority.":`当前控制上下文不可用。历史数据不能作为操作依据。`,"Captured historical observations":`已捕获的历史观察`,"Human review":`人工审阅`,"Done records human acknowledgment, not execution success or certification. It cannot restart a blocked episode.":`“完成”记录的是人工确认,而非执行成功或认证。它不能重新启动被阻塞的执行轮次。`,"Episode to review":`要审阅的执行轮次`,"Select an observed episode":`选择一个已观察的执行轮次`,"I acknowledge current unresolved issues if present; original results will not be rewritten.":`我确认当前存在的未解决问题;原始结果不会被改写。`,"Preview human review / Done":`预览人工审阅 / 完成`,"Observe current obligations in Checks before requesting review.":`请求审阅前,请先在“检查”中观察当前检查项。`,"Readable plan & decomposition":`可读计划与分解`,"{count} required assignments":`{count} 个必需子任务`,"Preview readonly Generate proposal":`预览只读生成提案`,"Preview Save plan":`预览保存计划`,"Preview Start saved graph":`预览启动已保存的任务图`,"Draft changes never execute. Start uses the saved graph shown in its fresh preview, not unsaved text. Generated proposals never save or start themselves.":`草稿修改永远不会执行。启动使用其最新预览中显示的已保存任务图,而不是未保存的文本。生成的提案不会自行保存或启动。`,"Saved assignments name an old model selection. Reading does not rebind them.":`已保存的子任务指定了旧的模型选择。读取不会重新绑定它们。`,"Explicitly rebind draft to current model (requires new Save)":`将草稿显式重新绑定到当前模型(需要重新保存)`,"Readable plan":`可读计划`,"Read rendered plan":`阅读渲染后的计划`,"checkout writer":`工作副本写入者`,readonly:`只读`,Edit:`编辑`,"Remove draft assignment":`移除草稿子任务`,Purpose:`用途`,Instructions:`指令`,"Expected output":`预期产出`,"Current-episode dependencies (whole final text by default)":`本轮依赖(默认使用完整最终文本)`,"Require complete observation":`要求完整观察`,"Selection: {range}":`选择范围:{range}`,"reviewed UTF-8 bytes {start}–{end}":`已审阅的 UTF-8 字节 {start}–{end}`,"whole final text; no silent clipping":`完整最终文本;不会静默截断`,"Reviewed edge JSON (range/null and exact historical identity)":`已审阅的依赖边 JSON(范围/null 与确切历史标识)`,"Remove edge":`移除依赖边`,"Explicit historical/advisory edge JSON":`显式的历史/参考依赖边 JSON`,"Exact committed run/child/result/version plus range and coverage requirement":`确切的已提交运行/子运行/结果/版本,以及范围和覆盖要求`,"Add reviewed historical edge":`添加已审阅的历史依赖边`,"Discard inline edits":`放弃行内编辑`,"Apply to local draft":`应用到本地草稿`,"Role {role}":`角色 {role}`,"Add assignment":`添加子任务`,"Remove dependent edges explicitly before deleting this assignment.":`删除此子任务前,请先显式移除依赖它的边。`,"Invalid dependency. Original edge retained; review before Save.":`依赖无效。已保留原依赖边;请在保存前审阅。`,"Historical edge requires actual committed identity; no guessed result reference.":`历史依赖边需要真实的已提交标识;不接受猜测的结果引用。`,View:`视图`,"Raw text / lines":`原始文本 / 行`,"Safe Markdown":`安全 Markdown`,"Observed diff":`观察到的 diff`,"Wrap: on":`换行:开`,"Wrap: off":`换行:关`,"Zoom +":`放大 +`,"Zoom −":`缩小 −`,"Captured page only, not a current filesystem read. Line numbers are page-local. Full retained paging and copy are available above.":`仅为捕获的页面,不是对当前文件系统的读取。行号仅在本页内有效。上方提供完整的保留分页和复制。`,"Page headings":`页面标题`,"Select page line {line}":`选择页内第 {line} 行`,"Selected page lines {start}–{end}":`已选页内第 {start}–{end} 行`,"Clear selection":`清除选择`,"Current configured obligations":`当前已配置的检查项`,"Observe obligations":`观察检查项`,"Obligations unavailable: {error}":`检查项不可用:{error}`,"Obligations unavailable.":`检查项不可用。`,"No configured obligations. This is not passing check coverage.":`没有已配置的检查项。这不代表检查已通过。`,"Timeout {timeout} ms. Native outcome and freshness remain separate.":`超时 {timeout} 毫秒。原生结果与是否最新分别记录。`,"Preview exact configured check":`预览确切的已配置检查`,"Browser checks are configured selections only. Native-local manual commands are not a browser shell endpoint.":`浏览器中只能运行已配置的检查。本地原生手动命令不是浏览器 shell 端点。`,"Current checkout changes":`当前工作副本变更`,"Current checkout changes (not a captured historical diff)":`当前工作副本变更(不是捕获的历史 diff)`,"Observe current changes":`观察当前变更`,"Current observation unavailable":`当前观察不可用`,"Fingerprint {identity} · {coverage} · includes pre-existing dirt; not attribution.":`指纹 {identity} · {coverage} · 包含既有的未提交修改;不代表归属。`,"complete within bounded scope":`在限定范围内完整`,"incomplete coverage":`覆盖不完整`,"Captured observations include pre-existing dirt. They do not attribute every change to Cadence; bounded fingerprints are not filesystem snapshots.":`捕获的观察包含既有的未提交修改。它们不会把每处变更都归于 Cadence;限定指纹不是文件系统快照。`,"committed #{seq}":`已提交 #{seq}`,"Inspect full retained {field}":`查看完整保留的{field}`,"Copy displayed text":`复制显示的文本`,"Copy unavailable":`无法复制`,"{state} message record, not execution outcome":`{state}消息记录,不代表执行结果`,Collapse:`收起`,"Inspect message":`查看消息`,"Child {child} · message {message} · version {version}":`子运行 {child} · 消息 {message} · 版本 {version}`,"Result call: {call}. Kept visible independently of the tool card.":`结果对应调用:{call}。独立于工具卡片保持可见。`,"unassociated / orphan":`未关联 / 孤立`,"No finalized text field in this snapshot. Inspect retained partial/final blocks and omission metadata below.":`此快照中没有最终文本字段。请在下方查看保留的部分/最终块以及省略元数据。`,"All message blocks, source limits and tool associations":`全部消息块、来源限制与工具关联`,"Latest on loaded page":`跳到已加载页的最新处`,"No message records on this page; more history remains.":`本页没有消息记录;还有更多历史。`,"No message records on this page.":`本页没有消息记录。`,"SDK tool error observed":`观察到 SDK 工具错误`,"SDK tool end observed":`观察到 SDK 工具结束`,"Start observed; end not observed in this snapshot":`已观察到开始;此快照中未观察到结束`,"No start observed":`未观察到开始`,"Inspect recorded tool call":`查看已记录的工具调用`,"Child {child} · call {call} · v{version}":`子运行 {child} · 调用 {call} · v{version}`,"SDK tool observations are not native process launch/close or passing parent checks.":`SDK 工具观察不代表原生进程的启动/关闭,也不代表父级检查已通过。`,"Source ID":`来源 ID`,unavailable:`不可用`,Declaration:`声明`,"No declaration recorded; orphan result remains accessible":`未记录声明;孤立结果仍可访问`,"Recorded tool end (not parsed from output)":`已记录的工具结束(非从输出解析)`,"No end fact in this snapshot.":`此快照中没有结束事实。`,"historical projection":`历史视图`,"owner projection":`所有者视图`,Lifecycle:`生命周期`,unsettled:`未结束`,"Wait/block reason":`等待/阻塞原因`,"none reported":`未报告`,"Summary publication":`摘要发布`,"Native / recording / parent settlement facts (independent of human review)":`原生 / 记录 / 父级结束事实(独立于人工审阅)`,"No settlement recorded":`未记录结束信息`,"New task":`新建任务`,"No retained task on this page.":`本页没有保留的任务。`,"One checkout owner. Open/history never executes.":`每个工作副本一个所有者。打开或查看历史永远不会执行。`,"Active and recent episodes":`活动与近期执行轮次`,"Runs and assignments":`运行与子任务`,"Toggle assignments":`展开/收起子任务`,"{count} descendants":`{count} 个后代`," / failed child":` / 有失败的子运行`," / unknown child":` / 有未知的子运行`,"No active or recent episode observed.":`未观察到活动或近期的执行轮次。`,"All retained episodes for task":`此任务的全部保留执行轮次`,"Committed order, not wall time. Replay advances visualization only. Raw observations retain clock/sequence provenance; unknown timing is not reconstructed.":`按提交顺序排列,而非真实时间。回放只推进可视化。原始观察保留时钟/序号来源;未知的时间不会被重建。`,"Bundled timeline unavailable; retained events remain accessible, no CDN fallback.":`内置时间线不可用;保留的事件仍可访问,不会回退到 CDN。`,Owner:`所有者`,owner:`所有者`,input:`输入`,model:`模型`,"Committed #{seq}; {who}":`已提交 #{seq};{who}`,"recorded fact":`已记录事实`,"Worker-local monotonic observations ({child}): {first}–{last} ms; not aligned to other workers.":`工作进程本地单调时钟观察({child}):{first}–{last} 毫秒;未与其他工作进程对齐。`,"Owner observation ({epoch}): {ms} ms; clock origin not established by this reader.":`所有者观察({epoch}):{ms} 毫秒;此读取器未确定时钟起点。`,"{scope} — loaded committed page":`{scope}——已加载的提交页`,"Committed sequence {seq}; page ordinal {ordinal}. Timing shown in raw facts only; clocks may not be comparable.":`提交序号 {seq};页内序数 {ordinal}。时间只在原始事实中显示;各时钟可能无法比较。`,task:`任务`,run:`运行`,child:`子运行`,workspace:`工作区`,message:`消息`,tool:`工具`,"final-text":`最终文本`,"tool-args":`工具参数`,"tool-update":`工具更新`,"tool-result":`工具结果`,check:`检查`,user:`用户`,assistant:`助手`,partial:`部分`,final:`最终`,observed:`已观察`,create:`创建`,"generate-plan":`生成计划`,"save-plan":`保存计划`,start:`启动`,research:`调研`,diagnosis:`诊断`,edit:`编辑`,current:`最新`,stale:`已过期`,resync:`重新同步中`,closed:`已关闭`,"accepted-unallocated":`已接受未分配`,active:`活动中`,draining:`排空中`,queued:`排队中`,preparing:`准备中`,running:`运行中`,closing:`收尾中`,settled:`已结束`,completed:`已完成`,failed:`失败`,canceled:`已取消`,timeout:`超时`,unknown:`未知`,blocked:`已阻塞`,pending:`待定`,published:`已发布`,conflict:`冲突`,uncertain:`不确定`,accepted:`已接受`,refused:`已拒绝`,absent:`不存在`,inconclusive:`无定论`,"not-run":`未运行`,passed:`已通过`,complete:`完整`,incomplete:`不完整`,limited:`受限`,binary:`二进制`,"hidden-thinking":`隐藏的思考`,"source-limit":`来源限制`,"capture-limit":`捕获限制`,gap:`缺口`,unsupported:`不支持`,capacity:`容量`,dependency:`依赖`,writer:`写入者`,"parent-stopped":`父级已停止`,"wait-expired":`等待超时`,"handoff-overflow":`交接溢出`,"stale-dependency":`依赖已过期`,quarantine:`隔离`,"incomplete-observation":`观察不完整`,"unrun-checks":`有未运行的检查`,"stale-checks":`有过期的检查`,"failed-checks":`有失败的检查`,"partial-results":`结果不完整`,"recording-incomplete":`记录不完整`,"legacy-context":`旧版上下文`},h=r(),g=`cadence-locale`,_=new Map(Object.entries(m));function v(e,t,n){let r=e===`zh`?_.get(t)??t:t;return n?r.replace(/\{(\w+)\}/g,(e,t)=>Object.hasOwn(n,t)?String(n[t]):e):r}function y({text:e,slots:t}){return e.split(/\{(\w+)\}/).map((e,n)=>n%2==0?e:(0,h.jsx)(f.Fragment,{children:Object.hasOwn(t,e)?t[e]:`{${e}}`},e))}function b(){try{let e=localStorage.getItem(g);if(e===`en`||e===`zh`)return e}catch{}return(typeof navigator>`u`?void 0:navigator.languages?.[0]??navigator.language)?.toLowerCase().startsWith(`zh`)?`zh`:`en`}function x(e,t){return{locale:e,t:(t,n)=>v(e,t,n),tx:t=>v(e,t),setLocale:t}}var S=(0,f.createContext)(x(`en`,()=>{}));function C(){return(0,f.useContext)(S)}function w({initial:e,children:t}){let[n,r]=(0,f.useState)(()=>e??b()),i=(0,f.useMemo)(()=>x(n,e=>{try{localStorage.setItem(g,e)}catch{}r(e)}),[n]);return(0,f.useEffect)(()=>{document.documentElement.lang=n===`zh`?`zh-CN`:`en`,document.title=v(n,`Cadence task workspace`)},[n]),(0,h.jsx)(S.Provider,{value:i,children:t})}var T=`cadence-graph/2`,E=`cadence-public-export/2`,D=Object.freeze({controlBytes:1048576,admissionCount:16,admissionBytes:33554432,cancelBytes:65536,headerBytes:8192,wsClientFrameBytes:16384,startWaitMs:1e4,stopWaitMs:6e4,authWaitMs:3e4,authValidityMarginMs:12e4,browserLifetimeMs:432e5,terminateGraceMs:1e3,unconfirmedStopMs:3e3,graphBytes:524288,grantMs:12e4,assignments:16,instructionsBytes:16384,expectedOutputBytes:2048,workerRequestBytes:131072,publicRequestBytes:98304,predecessorBytes:16384,handoffBytes:32768,frameBytes:65536,chunkBytes:8192,detailBytes:33554432,childProtocolBytes:134217728,dataFrames:1e5,controlFrames:256,sdkEvents:1e6,workerQueueBytes:4194304,workerQueueFrames:1024,ownerQueueBytes:8388608,ownerQueueFrames:2048,ownerControlBytes:1048576,ownerControlFrames:256,recordingStallMs:5e3,episodes:8,queuedAssignments:128,childReservations:2,episodeMs:216e5,readyWaitMs:6e5,workerMs:12e5,artifactPartBytes:262144,progressBatchMs:100,progressBatchBytes:262144,segmentBytes:8388608,segmentRecords:4096,checkoutQuotaBytes:10737418240,episodeReservationBytes:536870912,freeSpaceFloorBytes:268435456,episodeControlBytes:1048576,searchReaders:2,exportReaders:2,downloadIdleMs:12e4,pageEntries:50,maxPageEntries:200,pageBytes:524288,detailPageBytes:262144,previewBytes:4096,searchBytes:8388608,searchMs:100,queryBytes:1024,navigationBytes:8192,ringEvents:1024,ringBytes:2097152,viewers:16,viewerMessages:256,viewerBytes:1048576,heartbeatMs:5e3,staleMs:15e3,reconcileMs:3e4}),O=[`invalid`,`oversize`,`unauthenticated`,`forbidden`,`stale`,`conflict`,`corrupt-selected`,`expired-grant`,`consumed-grant`,`unsupported-context`,`quarantine`,`capacity`,`unavailable`,`registry-locked`,`auth-unavailable`,`recording-exhausted`,`receipt-inconclusive`],k=class extends Error{code;constructor(e=`invalid`){super(e),this.code=e}};function A(e,t=`none`){return{code:e,effect:t,recovery:t!==`none`||e===`receipt-inconclusive`?`observe`:[`stale`,`expired-grant`,`consumed-grant`].includes(e)?`fresh-confirmation`:`operator`}}function j(){throw new k}function M(e,t,n=!1){if((typeof e!=`string`||e.includes(`\0`)||/[\uD800-\uDFFF]/u.test(e)||n&&!e.trim())&&j(),N(e)>t)throw new k(`oversize`);return e}function N(e){return new TextEncoder().encode(e).length}function P(e,t=0,n=2**53-1){return(typeof e!=`number`||!Number.isSafeInteger(e)||e<t||e>n)&&j(),e}function F(e){return typeof e!=`boolean`&&j(),e}function I(e,t){return(typeof e!=`string`||!t.includes(e))&&j(),e}function L(e,t){return e!==t&&j(),t}function R(e,t){return e===null?null:t(e)}function z(e,t){(typeof e!=`object`||!e||Array.isArray(e)||![null,Object.prototype].includes(Object.getPrototypeOf(e)))&&j();let n=Reflect.ownKeys(e);(n.length!==t.length||n.some(e=>typeof e!=`string`||!t.includes(e)))&&j();let r=Object.create(null);for(let n of t){let t=Object.getOwnPropertyDescriptor(e,n);(!t||!(`value`in t)||!t.enumerable)&&j(),r[n]=t.value}return r}function B(e,t,n){(!Array.isArray(e)||e.length>t||Reflect.ownKeys(e).length!==e.length+1)&&j();let r=[];for(let t=0;t<e.length;t++){let i=Object.getOwnPropertyDescriptor(e,String(t));(!i||!(`value`in i))&&j(),r.push(n(i.value))}return r}function V(e){let t=M(e,36);return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(t)||j(),t}function H(e){let t=M(e,64);return/^[0-9a-f]{64}$/.test(t)||j(),t}function U(e){let t=M(e,D.controlBytes);return/^(0|[1-9][0-9]*)$/.test(t)||j(),t}function ee(e,t){return U(e),U(t),e.length===t.length?e===t?0:e<t?-1:1:e.length<t.length?-1:1}function te(e){let t=M(e,48);return/^[a-z][a-z0-9-]{0,47}$/.test(t)||j(),t}function W(e,t=D.controlBytes){let n=t,r=e=>{if(n-=N(e),n<0)throw new k(`oversize`);return e};function i(e,n){if(n>64&&j(),e===null||typeof e==`boolean`)return r(String(e));if(typeof e==`string`)return M(e,t),r(JSON.stringify(e));if(typeof e==`number`)return Number.isFinite(e)||j(),r(JSON.stringify(e));if(Array.isArray(e)){let a=B(e,t,e=>e);return r(`[]${`,`.repeat(Math.max(0,a.length-1))}`),`[${a.map(e=>i(e,n+1)).join(`,`)}]`}if(e&&typeof e==`object`){let t=Reflect.ownKeys(e);t.some(e=>typeof e!=`string`)&&j();let a=t.sort(),o=z(e,a);return r(`{}${`,`.repeat(Math.max(0,a.length-1))}`),`{${a.map(e=>`${r(`${JSON.stringify(e)}:`)}${i(o[e],n+1)}`).join(`,`)}}`}return j()}return i(e,0)}function ne(e,t=D.controlBytes){M(e,t);let n=0,r=()=>{for(;/[\x20\t\r\n]/.test(e[n]??`!`);)n++};function i(){let r=n++,i=!1;for(;n<e.length;){let a=e[n++];if(!i&&a===`"`)try{return M(JSON.parse(e.slice(r,n)),t)}catch{return j()}i=!i&&a===`\\`}return j()}function a(t){if(t>64&&j(),r(),e[n]===`"`)return i();if(e[n]===`{`||e[n]===`[`){let o=e[n++]===`{`,s=o?`}`:`]`,c=Object.create(null),l=[],u=new Set;if(r(),e[n]===s)return n++,o?c:l;for(;;){r();let d=``;o&&(e[n]!==`"`&&j(),d=i(),u.has(d)&&j(),u.add(d),r(),e[n++]!==`:`&&j());let f=a(t+1);o?c[d]=f:l.push(f),r();let p=e[n++];if(p===s)break;p!==`,`&&j()}return o?c:l}let o=/^(?:true|false|null|-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?)/.exec(e.slice(n))?.[0];o||j(),n+=o.length;let s=JSON.parse(o);return typeof s==`number`&&!Number.isFinite(s)&&j(),s}let o=a(0);return r(),n!==e.length&&j(),o}function re(e){let t=z(e,[`code`,`effect`,`recovery`]);return{code:I(t.code,O),effect:I(t.effect,[`none`,`accepted`,`uncertain`]),recovery:I(t.recovery,[`observe`,`fresh-confirmation`,`operator`])}}var ie=[`plan`,`context`,`message`,`final-text`,`tool-args`,`tool-update`,`tool-result`,`check`,`changes`,`review`],ae=[`completed`,`failed`,`canceled`,`timeout`,`unknown`,`blocked`],oe=[`not-launched`,`direct-child-closed`,`unconfirmed`],se=[`openai-completions`,`openai-responses`,`openai-codex-responses`,`anthropic-messages`,`google-generative-ai`,`mistral-conversations`,`azure-openai-responses`],ce=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`];function le(e){let t=z(e,[`provider`,`model`,`api`,`thinking`]);return{provider:M(t.provider,128,!0),model:M(t.model,256,!0),api:I(t.api,se),thinking:I(t.thinking,ce)}}function ue(e){let{sourceSelectionId:t,...n}=z(e,[`sourceSelectionId`,`provider`,`model`,`api`,`thinking`]);return{sourceSelectionId:V(t),...le(n)}}function de(e){let t=z(e,[`role`,`sha256`]);return{role:I(t.role,[`design-explorer`,`implementation-worker`,`diagnosis-worker`]),sha256:H(t.sha256)}}function fe(e){return e===`edit`?`implementation-worker`:e===`diagnosis`?`diagnosis-worker`:`design-explorer`}function G(e){let t=z(e,[`recordId`,`version`,`field`,`bytes`,`sha256`]);return{recordId:V(t.recordId),version:P(t.version,1),field:I(t.field,ie),bytes:P(t.bytes,0,D.detailBytes),sha256:H(t.sha256)}}function pe(e){let t=z(e,[`start`,`end`]),n=P(t.start);return{start:n,end:P(t.end,n+1,D.detailBytes)}}function me(e){let t=z(e,[`source`,`range`,`requireCompleteObservation`]),n=K(t.source),r;if(n===`current`)r={kind:n,assignmentId:te(z(t.source,[`kind`,`assignmentId`]).assignmentId)};else{let e=z(t.source,[`kind`,`runId`,`childRunId`,`result`]);L(n,`historical`);let i=G(e.result);L(i.field,`final-text`),r={kind:`historical`,runId:V(e.runId),childRunId:V(e.childRunId),result:i}}let i=R(t.range,pe);return r.kind===`historical`&&i&&i.end>r.result.bytes&&j(),{source:r,range:i,requireCompleteObservation:F(t.requireCompleteObservation)}}function K(e,t=`kind`){(typeof e!=`object`||!e)&&j();let n=Object.getOwnPropertyDescriptor(e,t);return(!n||!(`value`in n))&&j(),M(n.value,64,!0)}function he(e){W(e,D.graphBytes);let t=z(e,[`schema`,`taskId`,`taskKind`,`taskRevision`,`revision`,`planRevision`,`plan`,`assignments`]),n=G(t.plan);L(n.field,`plan`);let r=P(t.planRevision,1);n.version!==r&&j();let i={schema:L(t.schema,T),taskId:V(t.taskId),taskKind:I(t.taskKind,[`code`,`research`,`diagnosis`]),taskRevision:P(t.taskRevision,1),revision:P(t.revision,1),planRevision:r,plan:n,assignments:B(t.assignments,D.assignments,e=>{let t=z(e,[`id`,`purpose`,`instructions`,`expectedOutput`,`role`,`model`,`dependencies`]);return{id:te(t.id),purpose:I(t.purpose,[`research`,`diagnosis`,`review`,`edit`]),instructions:M(t.instructions,D.instructionsBytes,!0),expectedOutput:M(t.expectedOutput,D.expectedOutputBytes,!0),role:de(t.role),model:ue(t.model),dependencies:B(t.dependencies,D.assignments,me)}})};i.assignments.length||j();let a=new Map(i.assignments.map(e=>[e.id,e]));a.size!==i.assignments.length&&j();let o=new Set,s=new Set;function c(e){if(o.has(e.id)&&j(),s.has(e.id))return;o.add(e.id);let t=new Set;for(let n of e.dependencies){let e=W(n.source);if(t.has(e)&&j(),t.add(e),n.source.kind===`current`){let e=a.get(n.source.assignmentId);e||j(),c(e)}}o.delete(e.id),s.add(e.id)}for(let e of i.assignments){if(i.taskKind!==`code`&&e.purpose===`edit`||e.role.role!==fe(e.purpose))throw new k(`forbidden`);c(e)}return i}function ge(e){let t=z(e,[`id`,`kind`,`revision`,`identity`,`graphRevision`,`graphIdentity`]),n=R(t.graphRevision,e=>P(e,1)),r=R(t.graphIdentity,H);return n===null!=(r===null)&&j(),{id:V(t.id),kind:I(t.kind,[`code`,`research`,`diagnosis`]),revision:P(t.revision,1),identity:H(t.identity),graphRevision:n,graphIdentity:r}}function _e(e){let t=z(e,[`epoch`,`accessGeneration`,`configRev`,`controlRev`,`workspaceId`,`cwdId`,`model`,`checkEnvGeneration`,`checkoutGeneration`,`observation`,`task`]),n=z(t.observation,[`identity`,`complete`]);return{epoch:V(t.epoch),accessGeneration:P(t.accessGeneration,1),configRev:P(t.configRev,1),controlRev:P(t.controlRev,1),workspaceId:V(t.workspaceId),cwdId:V(t.cwdId),model:ue(t.model),checkEnvGeneration:P(t.checkEnvGeneration,1),checkoutGeneration:P(t.checkoutGeneration),observation:{identity:H(n.identity),complete:F(n.complete)},task:R(t.task,ge)}}function ve(e){let t=z(e,[`kind`,`name`,`command`,`timeoutMs`]),n={kind:I(t.kind,[`configured`,`manual`]),name:M(t.name,128,!0),command:M(t.command,4096,!0),timeoutMs:P(t.timeoutMs,100,D.workerMs)},r=/[\x00-\x08\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/u;return(r.test(n.name)||r.test(n.command)||/[\n\t]/.test(n.name)||n.name===`Manual command`)&&j(),n.kind===`manual`&&(n.name!==`Manual`||n.timeoutMs!==12e4)&&j(),n}function ye(e){switch(W(e),K(e)){case`create`:{let t=z(e,[`kind`,`taskKind`,`goal`]);return{kind:`create`,taskKind:I(t.taskKind,[`code`,`research`,`diagnosis`]),goal:M(t.goal,8192,!0)}}case`save-plan`:{let t=z(e,[`kind`,`taskId`,`plan`,`graph`]),n=he(t.graph),r=V(t.taskId);return n.taskId!==r&&j(),{kind:`save-plan`,taskId:r,plan:M(t.plan,32768),graph:n}}case`generate-plan`:case`start`:return{kind:K(e),taskId:V(z(e,[`kind`,`taskId`]).taskId)};case`check`:{let t=z(e,[`kind`,`taskId`,`check`]);return{kind:`check`,taskId:V(t.taskId),check:ve(t.check)}}case`review`:{let t=z(e,[`kind`,`taskId`,`runId`,`changesIdentity`,`checksRevision`,`acceptIssues`]);return{kind:`review`,taskId:V(t.taskId),runId:V(t.runId),changesIdentity:H(t.changesIdentity),checksRevision:P(t.checksRevision),acceptIssues:F(t.acceptIssues)}}default:return j()}}function be(e){W(e);let t=z(e,[`expected`,`action`]);return{expected:_e(t.expected),action:ye(t.action)}}function xe(e){W(e);let t=z(e,[`commandId`,`grant`,`expected`,`action`]);return{commandId:V(t.commandId),grant:V(t.grant),expected:_e(t.expected),action:ye(t.action)}}function Se(e){if(W(e),K(e)===`action`){let t=z(e,[`kind`,`expected`,`action`]);return{kind:`action`,expected:_e(t.expected),action:ye(t.action)}}let t=z(e,[`kind`,`epoch`,`runId`]);return L(t.kind,`cancel`),{kind:`cancel`,epoch:V(t.epoch),runId:V(t.runId)}}function Ce(e){let t=z(e,[`commandId`,`epoch`,`runId`]);return{commandId:V(t.commandId),epoch:V(t.epoch),runId:V(t.runId)}}function we(e){W(e);let t=typeof e==`object`&&!!e&&Object.hasOwn(e,`checkEnvironmentPolicy`),n=z(e,[`version`,`action`,`rootLabel`,`cwdLabel`,`readablePlan`,`graph`,`activeRunId`,`issues`,`configuredChecks`,`checksRevision`,`reviewRunId`,...t?[`checkEnvironmentPolicy`]:[]]),r=B(n.configuredChecks,32,ve);return(r.some(e=>e.kind!==`configured`)||new Set(r.map(e=>e.name)).size!==r.length)&&j(),{...t?{checkEnvironmentPolicy:L(n.checkEnvironmentPolicy,`service-launch-ordinary/1`)}:{},configuredChecks:r,checksRevision:P(n.checksRevision),reviewRunId:R(n.reviewRunId,V),version:_e(n.version),action:ye(n.action),rootLabel:M(n.rootLabel,4096,!0),cwdLabel:M(n.cwdLabel,4096,!0),readablePlan:M(n.readablePlan,32768),graph:R(n.graph,he),activeRunId:R(n.activeRunId,V),issues:B(n.issues,7,e=>I(e,[`incomplete-observation`,`unrun-checks`,`stale-checks`,`failed-checks`,`partial-results`,`recording-incomplete`,`legacy-context`]))}}function Te(e){W(e);let t=z(e,[`grant`,`expiresAt`,`preview`]),n=M(t.expiresAt,24);return(!/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/.test(n)||!Number.isFinite(Date.parse(n))||new Date(n).toISOString()!==n)&&j(),{grant:V(t.grant),expiresAt:n,preview:we(t.preview)}}function q(e){let t=z(e,[`observed`,`source`,`redacted`,`omissions`]),n={observed:I(t.observed,[`complete`,`incomplete`]),source:I(t.source,[`complete`,`limited`,`unavailable`]),redacted:F(t.redacted),omissions:B(t.omissions,6,e=>I(e,[`binary`,`hidden-thinking`,`source-limit`,`capture-limit`,`gap`,`unsupported`]))};return(new Set(n.omissions).size!==n.omissions.length||n.observed===`complete`&&n.omissions.some(e=>e===`capture-limit`||e===`gap`))&&j(),n}function Ee(e){let t=z(e,[`graphRevision`,`inputs`]),n=0,r=new Set;return{graphRevision:P(t.graphRevision,1),inputs:B(t.inputs,D.assignments,e=>{let t=z(e,[`assignmentId`,`dependencyIndex`,`runId`,`childRunId`,`result`,`range`,`text`,`coverage`]),i=G(t.result);L(i.field,`final-text`);let a=R(t.range,pe);a&&a.end>i.bytes&&j();let o=M(t.text,D.predecessorBytes);if(n+=N(o),n>D.handoffBytes)throw new k(`oversize`);let s=P(t.dependencyIndex,0,D.assignments-1);return r.has(s)&&j(),r.add(s),N(o)!==(a?a.end-a.start:i.bytes)&&j(),{assignmentId:te(t.assignmentId),dependencyIndex:s,runId:V(t.runId),childRunId:V(t.childRunId),result:i,range:a,text:o,coverage:q(t.coverage)}})}}function De(e){let t=z(e,[`outcome`,`closure`,`exitCode`,`signal`,`durationMs`,`stdin`,`final`,`cleanup`,`capture`]),n={outcome:I(t.outcome,[`completed`,`failed`,`canceled`,`timeout`,`unknown`]),closure:I(t.closure,oe),exitCode:R(t.exitCode,e=>P(e,-2147483648,4294967295)),signal:R(t.signal,e=>M(e,32,!0)),durationMs:P(t.durationMs),stdin:I(t.stdin,[`delivered`,`failed`,`not-required`]),final:I(t.final,[`valid`,`missing`,`invalid`]),cleanup:I(t.cleanup,[`settled`,`failed`,`unconfirmed`]),capture:q(t.capture)};return n.closure===`not-launched`&&(n.exitCode!==null||n.signal!==null)&&j(),n.outcome===`completed`&&(n.closure!==`direct-child-closed`||n.exitCode!==0||n.signal!==null||n.stdin!==`delivered`||n.final!==`valid`||n.cleanup!==`settled`||n.capture.observed!==`complete`)&&j(),n}function J(e){let t=z(e,[`kind`,`id`]);return{kind:I(t.kind,[`task`,`run`,`child`]),id:V(t.id)}}function Oe(e){let t=M(e,D.navigationBytes,!0);return/^[\x21-\x7e]+$/.test(t)||j(),t}function Y(e){W(e);let t=z(e,[`storeId`,`scope`,`query`,`snapshotSeq`,`recordId`,`recordVersion`,`field`,`offset`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]),n={storeId:V(t.storeId),scope:J(t.scope),query:R(t.query,e=>{let t=M(e,D.queryBytes);return t.length||j(),t}),snapshotSeq:U(t.snapshotSeq),recordId:R(t.recordId,V),recordVersion:R(t.recordVersion,e=>P(e,1)),field:R(t.field,e=>I(e,ie)),offset:P(t.offset),...Object.hasOwn(t,`navigation`)?{navigation:Oe(t.navigation)}:{}};return(n.recordId===null!=(n.recordVersion===null)||n.recordId===null!=(n.field===null))&&j(),n}function ke(e){let t=z(e,[`disposition`,`value`]),n=I(t.disposition,[`observed`,`unavailable`,`redacted`]),r=Pe(t.value);return n===`observed`!=(r!==null)&&j(),{disposition:n,value:r}}function Ae(e){let t=z(e,[`messageId`,`blockId`]);return{messageId:V(t.messageId),blockId:V(t.blockId)}}function je(e){let t=K(e);if(t===`message-final`)return{kind:t,messageId:V(z(e,[`kind`,`messageId`]).messageId)};if(t===`context`)return{kind:t,component:I(z(e,[`kind`,`component`]).component,[`request-context`,`request-prompt`,`request-instructions`,`role`,`effective-system`])};if(t===`handoff`){let n=z(e,[`kind`,`dependencyIndex`,`source`]),r=G(n.source);return L(r.field,`final-text`),{kind:t,dependencyIndex:P(n.dependencyIndex,0,D.assignments-1),source:r}}if(t===`message`){let n=z(e,[`kind`,`messageId`,`blockId`,`index`,`stage`]);return{kind:t,messageId:V(n.messageId),blockId:V(n.blockId),index:P(n.index,0,D.dataFrames),stage:I(n.stage,[`stream`,`final`])}}let n=z(e,[`kind`,`callId`,`blockId`,`index`,`stage`]);return L(t,`tool`),{kind:`tool`,callId:V(n.callId),blockId:V(n.blockId),index:P(n.index,0,D.dataFrames),stage:I(n.stage,[`arguments-partial`,`arguments-final`,`execution-arguments`,`update-snapshot`,`result`])}}function Me(e){let t=z(e,[`owner`,`field`,`encoding`]),n=je(t.owner),r=I(t.field,[`context`,`message`,`final-text`,`tool-args`,`tool-update`,`tool-result`]),i=I(t.encoding,[`utf8`,`canonical-json`]);return(r!==(n.kind===`context`||n.kind===`handoff`?`context`:n.kind===`message-final`?`final-text`:n.kind===`message`?`message`:n.stage===`result`?`tool-result`:n.stage===`update-snapshot`?`tool-update`:`tool-args`)||n.kind!==`tool`&&i!==`utf8`||r===`tool-args`&&i!==`canonical-json`&&(n.kind!==`tool`||n.stage!==`arguments-partial`))&&j(),{owner:n,field:r,encoding:i}}function Ne(e){let t=z(e,[`owner`,`sourceType`,`mimeType`,`reason`]),n=I(t.sourceType,[`image`,`audio`,`binary`,`hidden-thinking`,`unsupported`]),r=I(t.reason,[`binary`,`hidden-thinking`,`unsupported`]),i=R(t.mimeType,e=>M(e,128,!0));return(r!==(n===`hidden-thinking`?`hidden-thinking`:n===`unsupported`?`unsupported`:`binary`)||i!==null&&(n===`hidden-thinking`||!/^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(i)))&&j(),{owner:je(t.owner),sourceType:n,mimeType:i,reason:r}}function Pe(e){if(e===null)return null;let t=M(e,128,!0);return/^[a-zA-Z0-9_-]+$/.test(t)||j(),t}function Fe(e){let t=K(e);switch(t){case`ready`:return{kind:t,requestProtocol:L(z(e,[`kind`,`requestProtocol`]).requestProtocol,2)};case`message-start`:{let n=z(e,[`kind`,`messageId`,`role`,`source`,`resultCallId`]),r=I(n.role,[`user`,`assistant`,`tool-result`]),i=R(n.resultCallId,V);return r!==`tool-result`&&i!==null&&j(),{kind:t,messageId:V(n.messageId),role:r,source:ke(n.source),resultCallId:i}}case`message-text`:{let n=z(e,[`kind`,`messageId`,`blockId`,`detailId`]);return{kind:t,...Ae({messageId:n.messageId,blockId:n.blockId}),detailId:V(n.detailId)}}case`message-end`:{let n=z(e,[`kind`,`messageId`,`finalDetailId`,`finalBlockCount`,`stopReason`]);return{kind:t,messageId:V(n.messageId),finalDetailId:R(n.finalDetailId,V),finalBlockCount:P(n.finalBlockCount,0,D.dataFrames),stopReason:I(n.stopReason,[`stop`,`length`,`toolUse`,`error`,`aborted`,`unknown`])}}case`call-declaration`:{let n=z(e,[`kind`,`callId`,`declaration`,`index`,`source`,`name`,`argsDetailId`,`stage`]);return{kind:t,callId:V(n.callId),declaration:Ae(n.declaration),index:P(n.index,0,D.dataFrames),source:ke(n.source),name:M(n.name,128,!0),argsDetailId:R(n.argsDetailId,V),stage:I(n.stage,[`partial`,`final`])}}case`tool-start`:{let n=z(e,[`kind`,`callId`,`declaration`,`source`,`name`,`argsDetailId`]);return{kind:t,callId:V(n.callId),declaration:R(n.declaration,Ae),source:ke(n.source),name:M(n.name,128,!0),argsDetailId:R(n.argsDetailId,V)}}case`tool-update`:{let n=z(e,[`kind`,`callId`,`detailId`,`semantics`]);return{kind:t,callId:V(n.callId),detailId:V(n.detailId),semantics:L(n.semantics,`snapshot`)}}case`tool-end`:{let n=z(e,[`kind`,`callId`,`declaration`,`source`,`name`,`resultDetailId`,`isError`,`association`,`startObserved`]),r=I(n.association,[`declared`,`execution-only`,`orphan`,`ambiguous`]),i=R(n.declaration,Ae),a=F(n.startObserved);return(r===`declared`!=(i!==null)||r===`execution-only`&&!a||(r===`orphan`||r===`ambiguous`)&&a)&&j(),{kind:t,callId:V(n.callId),declaration:i,source:ke(n.source),name:M(n.name,128,!0),resultDetailId:V(n.resultDetailId),isError:F(n.isError),association:r,startObserved:a}}case`omitted-block`:return{kind:t,block:Ne(z(e,[`kind`,`block`]).block)};case`detail-begin`:{let n=z(e,[`kind`,`detailId`,`descriptor`]);return{kind:t,detailId:V(n.detailId),descriptor:Me(n.descriptor)}}case`detail-chunk`:{let n=z(e,[`kind`,`detailId`,`offset`,`text`]),r=M(n.text,D.chunkBytes),i=P(n.offset,0,D.detailBytes);return i+N(r)>D.detailBytes&&j(),{kind:t,detailId:V(n.detailId),offset:i,text:r}}case`detail-end`:{let n=z(e,[`kind`,`detailId`,`bytes`,`sha256`,`coverage`]);return{kind:t,detailId:V(n.detailId),bytes:P(n.bytes,0,D.detailBytes),sha256:H(n.sha256),coverage:q(n.coverage)}}case`capture-status`:return{kind:t,coverage:q(z(e,[`kind`,`coverage`]).coverage)};case`worker-failure`:return{kind:t,code:I(z(e,[`kind`,`code`]).code,[`protocol`,`capture`,`model`,`auth`,`network`,`cleanup`,`prompt`])};case`final`:{let n=z(e,[`kind`,`messageId`,`detailId`,`stopReason`]);return{kind:t,messageId:V(n.messageId),detailId:V(n.detailId),stopReason:L(n.stopReason,`stop`)}}default:return j()}}function Ie(e){let t=z(e,[`outcome`,`closure`,`exitCode`,`signal`,`durationMs`,`stdin`]),n={outcome:I(t.outcome,[`completed`,`failed`,`canceled`,`timeout`,`unknown`]),closure:I(t.closure,oe),exitCode:R(t.exitCode,e=>P(e,-2147483648,4294967295)),signal:R(t.signal,e=>M(e,32,!0)),durationMs:P(t.durationMs),stdin:L(t.stdin,`not-required`)};return(n.closure===`not-launched`&&(n.exitCode!==null||n.signal!==null)||n.outcome===`completed`&&(n.closure!==`direct-child-closed`||n.exitCode!==0||n.signal!==null))&&j(),n}function Le(e){let t=z(e,[`messageId`,`detailId`]);return{messageId:V(t.messageId),detailId:V(t.detailId)}}function Re(e){let t=z(e,[`childRunId`,`detailId`,`content`,`committedSeq`]),n=U(t.committedSeq);return n===`0`&&j(),{childRunId:V(t.childRunId),detailId:V(t.detailId),content:G(t.content),committedSeq:n}}function ze(e){let t=K(e,`status`);if(t===`committed`){let n=z(e,[`status`,`selected`,`detail`]),r=Le(n.selected),i=Re(n.detail);return(r.detailId!==i.detailId||i.content.field!==`final-text`)&&j(),{status:t,selected:r,detail:i}}if(t===`refused`){let n=z(e,[`status`,`selected`,`error`]);return{status:t,selected:R(n.selected,Le),error:re(n.error)}}let n=z(e,[`status`,`selected`]);return{status:I(t,[`pending`,`uncertain`]),selected:R(n.selected,Le)}}function Be(e,t){let n=R(e,U);return(n===`0`||n!==null&&t.status===`committed`&&ee(n,t.detail.committedSeq)<0)&&j(),n}function Ve(e){return e.native?.outcome===`completed`&&e.recording.status===`committed`&&e.settlementSeq!==null}function He(e){return e.kind===`parent`?e.outcome:e.native.outcome===`completed`?e.kind===`sdk`?Ve(e)?`completed`:`failed`:e.capture.observed===`complete`&&e.settlementSeq!==null?`completed`:`failed`:e.native.outcome}function Ue(e){let t=K(e);if(t===`sdk`){let n=z(e,[`kind`,`native`,`recording`,`settlementSeq`]),r=ze(n.recording),i=Be(n.settlementSeq,r);return{kind:t,native:De(n.native),recording:r,settlementSeq:i}}if(t===`check`){let n=z(e,[`kind`,`native`,`capture`,`settlementSeq`]),r=R(n.settlementSeq,U);return r===`0`&&j(),{kind:t,native:Ie(n.native),capture:q(n.capture),settlementSeq:r}}let n=z(e,[`kind`,`outcome`,`required`]);L(t,`parent`);let r=B(n.required,D.assignments,e=>{let t=z(e,[`assignmentId`,`childRunId`,`native`,`recording`,`settlementSeq`]),n=V(t.childRunId),r=ze(t.recording);return r.status===`committed`&&r.detail.childRunId!==n&&j(),{assignmentId:te(t.assignmentId),childRunId:n,native:R(t.native,De),recording:r,settlementSeq:Be(t.settlementSeq,r)}}),i=I(n.outcome,ae);return(!r.length||new Set(r.map(e=>e.assignmentId)).size!==r.length||new Set(r.map(e=>e.childRunId)).size!==r.length||i===`completed`&&!r.every(Ve))&&j(),{kind:`parent`,outcome:i,required:r}}function We(e){let t=z(e,[`first`,`last`,`firstObservedMs`,`lastObservedMs`]),n=P(t.first,1,D.dataFrames+D.controlFrames),r=P(t.last,n,D.dataFrames+D.controlFrames),i=P(t.firstObservedMs),a=P(t.lastObservedMs,i);return n===r&&i!==a&&j(),{first:n,last:r,firstObservedMs:i,lastObservedMs:a}}function Ge(e){let t=z(e,[`source`,`event`]),n=We(t.source),r=K(t.event);if(r===`stored-chunk`){let e=z(t.event,[`kind`,`detailId`,`text`]);return{source:n,event:{kind:r,detailId:V(e.detailId),text:M(e.text,D.chunkBytes)}}}if(r===`stored-end`){let e=z(t.event,[`kind`,`detailId`,`coverage`]);return{source:n,event:{kind:r,detailId:V(e.detailId),coverage:q(e.coverage)}}}let i=Fe(t.event);return(i.kind===`detail-chunk`||i.kind===`detail-end`)&&j(),{source:n,event:i}}function X(e){let t=z(e,[`epoch`,`taskId`,`runId`,`childRunId`]);return{epoch:V(t.epoch),taskId:V(t.taskId),runId:V(t.runId),childRunId:V(t.childRunId)}}function Ke(e){W({kind:`ok`,value:e},D.pageBytes);let t=Object.getOwnPropertyDescriptor(e??{},`status`)?.value===`complete`,n=z(e,[`storeId`,`workspaceId`,`epoch`,`status`,t?`runs`:`error`]),r={storeId:V(n.storeId),workspaceId:V(n.workspaceId),epoch:V(n.epoch)};if(!t)return L(n.status,`unavailable`),{...r,status:`unavailable`,error:qe(n.error)};let i=B(n.runs,D.episodes,e=>{let t=z(e,[`taskId`,`runId`,`operationId`,`epoch`,`kind`,`stage`]);return{taskId:V(t.taskId),runId:V(t.runId),operationId:V(t.operationId),epoch:V(t.epoch),kind:I(t.kind,[`start`,`generate-plan`,`check`]),stage:I(t.stage,[`accepted-unallocated`,`active`,`draining`])}});return(i.some(e=>e.epoch!==r.epoch)||new Set(i.map(e=>e.runId)).size!==i.length||new Set(i.map(e=>e.taskId)).size!==i.length||new Set(i.map(e=>e.operationId)).size!==i.length)&&j(),{...r,status:`complete`,runs:i}}function qe(e){let t=re(e);return L(t.effect,`none`),t}function Je(e){let t=z(e,[`sourceHash`,`contractHash`,`buildId`]);return{sourceHash:H(t.sourceHash),contractHash:H(t.contractHash),buildId:H(t.buildId)}}function Ye(e){let t=I(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value,[`native`,`browser`]),n=z(e,t===`native`?[`kind`,`contractHash`]:[`kind`,`contractHash`,`sourceHash`,`buildId`]);return t===`native`?{kind:t,contractHash:H(n.contractHash)}:{kind:t,...Je({contractHash:n.contractHash,sourceHash:n.sourceHash,buildId:n.buildId})}}function Xe(e){let t=z(e,[`contractHash`,`assets`]);return{contractHash:H(t.contractHash),assets:Je(t.assets)}}function Ze(e,t,n=!1){return!!e&&!!t&&t.contractHash===e.contractHash&&(n||e.assets.contractHash===e.contractHash&&(t.kind===`native`||t.buildId===e.assets.buildId&&t.sourceHash===e.assets.sourceHash))}function Qe(e){W(e);let t=z(e,[`commandId`,`operationId`,`runId`,`admission`,`committedSeq`,`execution`,`settlement`,`created`,`publication`]),n={commandId:V(t.commandId),operationId:V(t.operationId),runId:R(t.runId,V),admission:I(t.admission,[`accepted`,`refused`,`uncertain`]),committedSeq:U(t.committedSeq),execution:R(t.execution,e=>I(e,ae)),settlement:R(t.settlement,Ue),created:R(t.created,e=>{let t=z(e,[`kind`,`taskId`,`state`]);return{kind:L(t.kind,`task`),taskId:V(t.taskId),state:I(t.state,[`reserved`,`published`])}}),publication:I(t.publication,[`pending`,`published`,`conflict`,`uncertain`])};return(n.committedSeq===`0`||n.settlement?.kind===`sdk`||n.execution===`completed`&&!n.settlement||n.execution!==null&&n.settlement!==null&&He(n.settlement)!==n.execution||n.created?.state===`published`&&n.publication!==`published`)&&j(),n}function $e(e){W(e);let t=z(e,[`identity`,`receipt`]),n=Se(t.identity),r=Qe(t.receipt);n.kind===`cancel`&&r.runId!==n.runId&&j();let i=n.kind===`action`&&n.action.kind===`create`;if((!i&&r.created!==null||i&&r.admission===`accepted`&&r.created===null)&&j(),n.kind===`action`){let e=[`start`,`generate-plan`,`check`].includes(n.action.kind);(r.admission===`accepted`&&e!==(r.runId!==null)||!e&&(r.execution!==null||r.settlement!==null)||r.settlement!==null&&r.settlement.kind!==(n.action.kind===`check`?`check`:`parent`))&&j()}return{identity:n,receipt:r}}function Z(e,t){if(K(e)===`ok`)return{kind:`ok`,value:t(z(e,[`kind`,`value`]).value)};let n=z(e,[`kind`,`error`]);return L(n.kind,`error`),{kind:`error`,error:re(n.error)}}function et(e){switch(W(e),K(e,`status`)){case`found`:return{status:`found`,receipt:Qe(z(e,[`status`,`receipt`]).receipt)};case`absent`:return{status:`absent`,committedSeq:U(z(e,[`status`,`committedSeq`]).committedSeq)};case`inconclusive`:return{status:`inconclusive`,error:re(z(e,[`status`,`error`]).error)};default:return j()}}function tt(e){let t=z(e,[`runId`,`taskId`,`childRunId`,`assignmentId`,`admission`,`lifecycle`,`outcome`,`settlement`,`reason`,`publication`,`coverage`,`result`]),n={runId:V(t.runId),taskId:V(t.taskId),childRunId:R(t.childRunId,V),assignmentId:R(t.assignmentId,te),admission:dt(t.admission),lifecycle:I(t.lifecycle,[`queued`,`preparing`,`running`,`closing`,`settled`]),outcome:R(t.outcome,e=>I(e,ae)),settlement:R(t.settlement,Ue),reason:R(t.reason,e=>I(e,[`capacity`,`dependency`,`writer`,`parent-stopped`,`wait-expired`,`handoff-overflow`,`stale-dependency`,`quarantine`])),publication:I(t.publication,[`pending`,`published`,`conflict`,`uncertain`]),coverage:q(t.coverage),result:R(t.result,G)};return(n.admission.context.task?.id!==n.taskId||n.childRunId!==null&&!n.admission.assignments.some(e=>e.childRunId===n.childRunId&&e.assignmentId===n.assignmentId)||n.settlement?.kind===`parent`&&W(n.settlement.required.map(({assignmentId:e,childRunId:t})=>({assignmentId:e,childRunId:t})))!==W(n.admission.assignments)||n.settlement?.kind===`sdk`&&n.settlement.recording.status===`committed`&&(n.settlement.recording.detail.childRunId!==n.childRunId||n.result!==null&&W(n.result)!==W(n.settlement.recording.detail.content))||n.settlement!==null&&(n.childRunId!==null&&n.settlement.kind!==`sdk`||n.childRunId===null&&n.settlement.kind!==(n.admission.kind===`check`?`check`:`parent`)||n.outcome!==null&&He(n.settlement)!==n.outcome)||n.childRunId===null!=(n.assignmentId===null)||n.lifecycle===`settled`!=(n.outcome!==null)||n.outcome===`completed`&&(!n.settlement||He(n.settlement)!==`completed`||n.coverage.observed!==`complete`))&&j(),n}function nt(e,t){return t.kind===`task`?e.taskId===t.id:t.kind===`run`?e.runId===t.id:e.childRunId===t.id}function rt(e,t,n){return nt(e,t)&&e.taskId===mt(n)&&e.admission.context.workspaceId===pt(n)}function it(e){W(e,D.pageBytes);let t=z(e,[`protocol`,`storeId`,`epoch`,`scope`,`committedSeq`,`context`,`runs`,`horizon`]),n={protocol:L(t.protocol,1),storeId:V(t.storeId),epoch:V(t.epoch),scope:J(t.scope),committedSeq:U(t.committedSeq),context:ft(t.context),runs:B(t.runs,D.maxPageEntries,tt),horizon:Et(t.horizon)};return(!ht(n.context,n.epoch,n.scope)||W(n.horizon.historicalRuns.scope)!==W(n.scope)||n.horizon.historicalRuns.snapshotSeq!==n.committedSeq||n.horizon.historicalRuns.storeId!==n.storeId||n.runs.some(e=>!rt(e,n.scope,n.context))||new Set(n.runs.map(e=>e.childRunId??e.runId)).size!==n.runs.length)&&j(),n}function at(e){W(e,D.pageBytes);let t=K(e),n=z(e,t===`update`?[`kind`,`storeId`,`epoch`,`scope`,`previousSeq`,`committedSeq`,`runs`,`removed`,`context`]:[`kind`,`storeId`,`epoch`,`scope`,`committedSeq`]),r={storeId:V(n.storeId),epoch:V(n.epoch),scope:J(n.scope),committedSeq:U(n.committedSeq)};if(t===`update`){let e=U(n.previousSeq);ee(r.committedSeq,e)<=0&&j();let i=ft(n.context);ht(i,r.epoch,r.scope)||j();let a=B(n.runs,D.maxPageEntries,tt),o=B(n.removed,D.maxPageEntries,V),s=a.map(e=>e.childRunId??e.runId);return(a.some(e=>!rt(e,r.scope,i))||new Set(s).size!==s.length||new Set(o).size!==o.length||o.some(e=>s.includes(e)))&&j(),{kind:t,...r,previousSeq:e,runs:a,removed:o,context:i}}return L(t,`heartbeat`),{kind:`heartbeat`,...r}}function ot(e){let{navigation:t,...n}=e;return n}function st(e,t){(!t.navigation||t.navigation===e.navigation||W(ot(e))!==W(ot(t)))&&j()}function ct(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return lt(e);W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`kind`,`cursor`,`next`,`coverage`]),n=Y(t.cursor),r=Y(t.next);return st(n,r),{kind:`progress`,cursor:n,next:r,coverage:q(t.coverage)}}function lt(e){W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`cursor`,`content`,`range`,`text`,`next`,`coverage`]),n={cursor:Y(t.cursor),content:G(t.content),range:R(t.range,pe),text:M(t.text,D.detailPageBytes),next:R(t.next,Y),coverage:q(t.coverage)};return(n.cursor.recordId!==n.content.recordId||n.cursor.recordVersion!==n.content.version||n.cursor.field!==n.content.field||(n.range?n.range.start!==n.cursor.offset||n.range.end>n.content.bytes||n.range.end-n.range.start!==N(n.text):n.content.bytes!==0||n.cursor.offset!==0||n.text!==``))&&j(),n.coverage.observed===`complete`&&n.next!==null!=(n.range?.end??0)<n.content.bytes&&j(),n.next&&(n.next.offset!==n.range?.end||W(ot({...n.next,offset:n.cursor.offset}))!==W(ot(n.cursor)))&&j(),n}function ut(e){W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`cursor`,`hits`,`next`,`coverage`]),n=Y(t.cursor);n.query||j();let r=N(n.query),i=B(t.hits,D.maxPageEntries,e=>{let t=z(e,[`content`,`range`,`preview`,`cursor`,`owner`]),i=G(t.content),a=vt(t.owner);yt(a,n.scope)||j();let o=pe(t.range),s=Y(t.cursor);return(o.end>i.bytes||o.end-o.start!==r||s.recordId!==i.recordId||s.recordVersion!==i.version||s.field!==i.field||s.offset!==o.start||s.storeId!==n.storeId||W(s.scope)!==W(n.scope)||s.snapshotSeq!==n.snapshotSeq||s.query!==n.query||s.navigation!==void 0)&&j(),{content:i,owner:a,range:o,preview:M(t.preview,D.previewBytes),cursor:s}}),a=R(t.next,Y);return a&&(a.storeId!==n.storeId||W(a.scope)!==W(n.scope)||a.query!==n.query||a.snapshotSeq!==n.snapshotSeq||a.recordId===n.recordId&&a.recordVersion===n.recordVersion&&a.field===n.field&&(a.offset<n.offset||a.offset===n.offset&&(!a.navigation||a.navigation===n.navigation)))&&j(),{cursor:n,hits:i,next:a,coverage:q(t.coverage)}}function dt(e){let t=z(e,[`operationId`,`commandId`,`kind`,`context`,`assignments`,`graph`]),n=_e(t.context),r=R(t.graph,e=>{let t=z(e,[`recordId`,`revision`,`sha256`]);return{recordId:V(t.recordId),revision:P(t.revision,1),sha256:H(t.sha256)}}),i=I(t.kind,[`start`,`generate-plan`,`check`]),a=B(t.assignments,D.assignments,e=>{let t=z(e,[`assignmentId`,`childRunId`]);return{assignmentId:te(t.assignmentId),childRunId:V(t.childRunId)}});return(i===`check`!=(a.length===0)||new Set(a.map(e=>e.assignmentId)).size!==a.length||new Set(a.map(e=>e.childRunId)).size!==a.length)&&j(),(!n.task||i===`start`&&(!r||r.revision!==n.task.graphRevision||r.sha256!==n.task.graphIdentity)||i!==`start`&&r!==null)&&j(),{operationId:V(t.operationId),commandId:V(t.commandId),kind:i,context:n,assignments:a,graph:r}}function ft(e){if(K(e,`status`)===`available`)return{status:`available`,version:_e(z(e,[`status`,`version`]).version)};let t=z(e,[`status`,`workspaceId`,`taskId`,`error`]);L(t.status,`unavailable`);let n=re(t.error);return L(n.effect,`none`),{status:`unavailable`,workspaceId:V(t.workspaceId),taskId:R(t.taskId,V),error:n}}function pt(e){return e.status===`available`?e.version.workspaceId:e.workspaceId}function mt(e){return e.status===`available`?e.version.task?.id??null:e.taskId}function ht(e,t,n){return(e.status!==`available`||e.version.epoch===t)&&(n.kind!==`task`||mt(e)===n.id)}function gt(e){let t=z(e,[`protocol`,`storeId`,`epoch`,`accessGeneration`,`authority`,`csrf`,`capabilities`,...Object.getOwnPropertyDescriptor(e??{},`build`)?[`build`]:[]]),n=z(t.capabilities,[`actions`,`manualChecks`,`history`]),r=I(t.authority,[`browser`,`local`]),i=R(t.csrf,V),a={actions:F(n.actions),manualChecks:F(n.manualChecks),history:F(n.history)};return(r===`browser`&&(i===null||a.manualChecks)||r===`local`&&i!==null)&&j(),{...t.build===void 0?{}:{build:Xe(t.build)},protocol:L(t.protocol,1),storeId:V(t.storeId),epoch:V(t.epoch),accessGeneration:P(t.accessGeneration,1),authority:r,csrf:i,capabilities:a}}function _t(e){W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`workspaceId`,`storeId`,`epoch`,`committedSeq`,`rootLabel`,`context`,`models`,...Object.hasOwn(e??{},`activeRuns`)?[`activeRuns`]:[]]),n={...t.activeRuns===void 0?{}:{activeRuns:Ke(t.activeRuns)},workspaceId:V(t.workspaceId),storeId:V(t.storeId),epoch:V(t.epoch),committedSeq:U(t.committedSeq),rootLabel:M(t.rootLabel,4096,!0),context:ft(t.context),models:B(t.models,D.maxPageEntries,ue)};return n.activeRuns&&(n.activeRuns.storeId!==n.storeId||n.activeRuns.workspaceId!==n.workspaceId||n.activeRuns.epoch!==n.epoch)&&j(),(pt(n.context)!==n.workspaceId||mt(n.context)!==null||n.context.status===`available`&&n.context.version.epoch!==n.epoch)&&j(),n}function vt(e){let t=z(e,[`taskId`,`runId`,`childRunId`,`entity`]),n=z(t.entity,[`kind`,`id`,`version`]),r={taskId:V(t.taskId),runId:R(t.runId,V),childRunId:R(t.childRunId,V),entity:{kind:I(n.kind,[`task`,`run`,`child`,`message`,`tool`,`check`,`changes`,`review`]),id:V(n.id),version:P(n.version,1)}};return(r.childRunId!==null&&r.runId===null||r.entity.kind===`task`&&(r.entity.id!==r.taskId||r.runId!==null)||r.entity.kind===`run`&&(r.entity.id!==r.runId||r.childRunId!==null)||r.entity.kind===`child`&&r.entity.id!==r.childRunId||[`message`,`tool`].includes(r.entity.kind)&&r.childRunId===null||[`check`,`changes`,`review`].includes(r.entity.kind)&&r.childRunId!==null)&&j(),r}function yt(e,t){return t.kind===`task`?e.taskId===t.id:t.kind===`run`?e.runId===t.id:e.childRunId===t.id}function bt(e){let t=z(e,[`identity`,`complete`,`checkoutGeneration`]);return{identity:H(t.identity),complete:F(t.complete),checkoutGeneration:P(t.checkoutGeneration)}}function xt(e){W(e,D.controlBytes);let t=K(e);switch(t){case`assignment-state`:{let n=z(e,[`kind`,`childRunId`,`state`,`reason`]),r=I(n.state,[`waiting`,`ready`,`preparing`,`closing`,`unstarted`]),i=R(n.reason,e=>I(e,[`capacity`,`dependency`,`writer`,`parent-stopped`,`wait-expired`,`handoff-overflow`,`stale-dependency`,`quarantine`]));return(r===`waiting`||r===`unstarted`)&&i===null&&j(),(r===`ready`||r===`preparing`)&&i!==null&&j(),{kind:t,childRunId:V(n.childRunId),state:r,reason:i}}case`admission-closed`:return{kind:t,reason:I(z(e,[`kind`,`reason`]).reason,[`failed`,`canceled`,`timeout`,`wait-expired`,`handoff-overflow`,`stale-dependency`,`quarantine`])};case`parent-admitted`:{let n=z(e,[`kind`,`runId`,`identity`]);return{kind:t,runId:V(n.runId),identity:dt(n.identity)}}case`parent-settled`:{let n=z(e,[`kind`,`runId`,`settlement`]),r=Ue(n.settlement);return r.kind!==`parent`&&j(),{kind:t,runId:V(n.runId),settlement:r}}case`gate`:{let n=typeof e==`object`&&!!e&&Object.hasOwn(e,`reservationId`),r=z(e,[`kind`,`lane`,`state`,`checkoutGeneration`,...n?[`reservationId`]:[]]);return{kind:t,...n?{reservationId:V(r.reservationId)}:{},lane:I(r.lane,[`reader`,`writer`,`check`]),state:I(r.state,[`waiting`,`held`,`released`,`unknown`]),checkoutGeneration:P(r.checkoutGeneration)}}case`handoff`:{let n=z(e,[`kind`,`childRunId`,`handoff`,`observation`]);return{kind:t,childRunId:V(n.childRunId),handoff:Ee(n.handoff),observation:bt(n.observation)}}case`changes`:{let n=z(e,[`kind`,`observationId`,`stage`,`observation`,`content`]),r=G(n.content);return L(r.field,`changes`),{kind:t,observationId:V(n.observationId),stage:I(n.stage,[`before`,`after`,`review`]),observation:bt(n.observation),content:r}}case`check-start`:{let n=z(e,[`kind`,`checkId`,`selection`,`cwdId`,`cwdLabel`,`checkEnvGeneration`,`before`]);return{kind:t,checkId:V(n.checkId),selection:ve(n.selection),cwdId:V(n.cwdId),cwdLabel:M(n.cwdLabel,4096,!0),checkEnvGeneration:P(n.checkEnvGeneration,1),before:bt(n.before)}}case`check-settled`:{let n=typeof e==`object`&&!!e&&Object.hasOwn(e,`ownAdvance`),r=z(e,[`kind`,`checkId`,`native`,`status`,`before`,`after`,`output`,`coverage`,...n?[`ownAdvance`]:[]]),i;if(n){let e=z(r.ownAdvance,[`operationId`,`reservationId`,`from`,`to`]);i={operationId:V(e.operationId),reservationId:V(e.reservationId),from:P(e.from),to:P(e.to)},(i.to!==i.from+1||i.reservationId!==r.checkId)&&j()}let a=Ie(r.native),o=I(r.status,[`passed`,`failed`,`canceled`,`stale`]),s=bt(r.before),c=bt(r.after),l=R(r.output,G),u=q(r.coverage);return l&&l.field!==`check`&&j(),o===`passed`&&(a.outcome!==`completed`||W({...s,checkoutGeneration:c.checkoutGeneration})!==W(c)||(i?s.checkoutGeneration!==i.from||c.checkoutGeneration!==i.to||l===null:s.checkoutGeneration!==c.checkoutGeneration)||u.observed!==`complete`)&&j(),o===`canceled`&&![`canceled`,`timeout`].includes(a.outcome)&&j(),{kind:t,...i?{ownAdvance:i}:{},checkId:V(r.checkId),native:a,status:o,before:s,after:c,output:l,coverage:u}}case`review`:{let n=z(e,[`kind`,`reviewId`,`runId`,`checksRevision`,`changesIdentity`,`acceptIssues`,`outcome`,`content`]),r=F(n.acceptIssues),i=I(n.outcome,[`reviewed`,`reviewed-with-issues`]),a=G(n.content);return L(a.field,`review`),i===`reviewed-with-issues`&&!r&&j(),{kind:t,reviewId:V(n.reviewId),runId:V(n.runId),checksRevision:P(n.checksRevision),changesIdentity:H(n.changesIdentity),acceptIssues:r,outcome:i,content:a}}case`publication-intent`:{let n=z(e,[`kind`,`publicationId`,`expectedRevision`,`expectedIdentity`,`nextRevision`,`nextIdentity`]),r=P(n.expectedRevision),i=R(n.expectedIdentity,H),a=P(n.nextRevision,1);return(r===0!=(i===null)||a!==r+1)&&j(),{kind:t,publicationId:V(n.publicationId),expectedRevision:r,expectedIdentity:i,nextRevision:a,nextIdentity:H(n.nextIdentity)}}case`publication-settled`:{let n=z(e,[`kind`,`publicationId`,`status`,`observed`]),r=I(n.status,[`published`,`conflict`,`uncertain`]),i=R(n.observed,e=>{let t=z(e,[`revision`,`identity`]);return{revision:P(t.revision,1),identity:H(t.identity)}});return r===`published`&&i===null&&j(),{kind:t,publicationId:V(n.publicationId),status:r,observed:i}}default:return j()}}function St(e){let t=z(e,[`epoch`,`operationId`,`taskId`,`runId`]);return{epoch:V(t.epoch),operationId:V(t.operationId),taskId:V(t.taskId),runId:R(t.runId,V)}}function Ct(e){W(e,D.ownerQueueBytes);let t=z(e,[`observedMs`,`link`,`events`]),n=St(t.link),r=B(t.events,D.ownerQueueFrames,e=>{let t=K(e);if(t===`fact`){let r=xt(z(e,[`kind`,`fact`]).fact);return(`runId`in r&&r.runId!==n.runId||r.kind===`parent-admitted`&&(r.identity.context.task?.id!==n.taskId||r.identity.operationId!==n.operationId)||[`gate`,`assignment-state`,`admission-closed`,`handoff`,`check-start`,`check-settled`].includes(r.kind)&&n.runId===null)&&j(),{kind:t,fact:r}}if(t===`content-begin`){let r=z(e,[`kind`,`detailId`,`owner`,`field`,`encoding`]),i=vt(r.owner),a=I(r.field,[`plan`,`check`,`changes`,`review`]);return(i.taskId!==n.taskId||i.runId!==n.runId||i.childRunId!==null||i.entity.kind!==(a===`plan`?`task`:a))&&j(),{kind:t,detailId:V(r.detailId),owner:i,field:a,encoding:L(r.encoding,`utf8`)}}if(t===`content-chunk`){let n=z(e,[`kind`,`detailId`,`text`]);return{kind:t,detailId:V(n.detailId),text:M(n.text,D.chunkBytes)}}let r=z(e,[`kind`,`detailId`,`coverage`]);return L(t,`content-end`),{kind:`content-end`,detailId:V(r.detailId),coverage:q(r.coverage)}});return{observedMs:P(t.observedMs),link:n,events:r}}var wt=[`tasks`,`runs`,`messages`,`tools`,`contents`,`events`,`checks`,`changes`,`reviews`];function Tt(e){let t=z(e,[`reader`,`storeId`,`scope`,`snapshotSeq`,`after`,`limit`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]),n=I(t.reader,wt),r=z(t.scope,[`kind`,`id`]),i={kind:I(r.kind,[`workspace`,`task`,`run`,`child`]),id:V(r.id)},a=R(t.snapshotSeq,U),o=R(t.after,e=>{let t=z(e,[`recordId`,`version`,`offset`]);return{recordId:V(t.recordId),version:P(t.version,1),offset:P(t.offset)}});return(o&&a===null||n===`tasks`!=(i.kind===`workspace`))&&j(),{reader:n,...Object.hasOwn(t,`navigation`)?{navigation:Oe(t.navigation)}:{},storeId:V(t.storeId),scope:i,snapshotSeq:a,after:o,limit:P(t.limit,1,D.maxPageEntries)}}function Et(e){let t=z(e,[`policy`,`historicalRuns`]),n=Tt(t.historicalRuns);return(n.reader!==`runs`||n.after!==null||n.snapshotSeq===null)&&j(),{policy:L(t.policy,`active-and-recent`),historicalRuns:n}}function Dt(e){let t=K(e);if(t===`run`)return{kind:t,projection:tt(z(e,[`kind`,`projection`]).projection)};if(t===`capture-fact`){let n=z(e,[`kind`,`recordId`,`committedSeq`,`link`,`capture`]),r=U(n.committedSeq);return r===`0`&&j(),{kind:t,recordId:V(n.recordId),committedSeq:r,link:X(n.link),capture:Ge(n.capture)}}if(t===`owner-fact`){let n=z(e,[`kind`,`recordId`,`committedSeq`,`observedMs`,`link`,`fact`]),r=Ct({observedMs:n.observedMs,link:n.link,events:[{kind:`fact`,fact:n.fact}]}),i=r.events[0];i.kind!==`fact`&&j();let a=U(n.committedSeq);return a===`0`&&j(),{kind:t,recordId:V(n.recordId),committedSeq:a,link:r.link,observedMs:r.observedMs,fact:i.fact}}let n=[`kind`,`owner`,`version`],r=t===`task`?[`goal`,`plan`]:t===`message`?[`role`,`source`,`resultCallId`,`state`,`finalBlockCount`,`finalText`]:t===`tool`?[`source`,`name`,`declaration`,`declarationStage`,`startObserved`,`result`]:t===`content`?[`detailId`,`descriptor`,`content`,`coverage`]:[`block`],i=z(e,[...n,...r]),a=vt(i.owner),o=P(i.version,1);if([`task`,`message`,`tool`].includes(t)&&(a.entity.kind!==t||a.entity.version!==o)&&j(),t===`task`){let e=R(i.plan,G);return e&&e.field!==`plan`&&j(),{kind:t,owner:a,version:o,goal:M(i.goal,8192,!0),plan:e}}if(t===`message`){let e=I(i.role,[`user`,`assistant`,`tool-result`]),n=I(i.state,[`partial`,`final`]),r=R(i.finalBlockCount,e=>P(e,0,D.dataFrames)),s=R(i.finalText,G),c=R(i.resultCallId,V);return(n===`final`!=(r!==null)||n===`partial`&&s!==null||s&&s.field!==`final-text`||e!==`tool-result`&&c!==null)&&j(),{kind:t,owner:a,version:o,role:e,state:n,finalBlockCount:r,finalText:s,resultCallId:c,source:ke(i.source)}}if(t===`tool`){let e=R(i.declaration,Ae),n=R(i.declarationStage,e=>I(e,[`partial`,`final`])),r=F(i.startObserved),s=R(i.result,e=>{let t=Fe(e);return t.kind!==`tool-end`&&j(),t});return(e===null!=(n===null)||s&&(s.callId!==a.entity.id||s.startObserved!==r||W(s.declaration)!==W(e)))&&j(),{kind:t,owner:a,version:o,declaration:e,declarationStage:n,startObserved:r,result:s,source:ke(i.source),name:M(i.name,128,!0)}}if(t===`content`){let e=Me(i.descriptor),n=G(i.content);return(e.field!==n.field||!Ot(e.owner,a))&&j(),{kind:t,owner:a,version:o,detailId:V(i.detailId),descriptor:e,content:n,coverage:q(i.coverage)}}L(t,`omitted`);let s=Ne(i.block);return Ot(s.owner,a)||j(),{kind:`omitted`,owner:a,version:o,block:s}}function Ot(e,t){return e.kind===`message`||e.kind===`message-final`?t.entity.kind===`message`&&e.messageId===t.entity.id:e.kind===`tool`?t.entity.kind===`tool`&&e.callId===t.entity.id:t.entity.kind===`child`}function kt(e,t){let{scope:n,reader:r}=t,i=e.kind===`run`?{taskId:e.projection.taskId,runId:e.projection.runId,childRunId:e.projection.childRunId}:e.kind===`owner-fact`?{...e.link,childRunId:null}:e.kind===`capture-fact`?e.link:e.owner;return n.kind!==`workspace`&&!(n.kind===`task`?i.taskId===n.id:n.kind===`run`?i.runId===n.id:i.childRunId===n.id)?!1:r===`tasks`?e.kind===`task`:r===`runs`?e.kind===`run`:r===`messages`?e.kind===`message`:r===`tools`?e.kind===`tool`:r===`contents`?e.kind===`content`||e.kind===`omitted`:e.kind===`capture-fact`?r===`events`:e.kind===`owner-fact`?r===`events`||r===`checks`&&[`check-start`,`check-settled`].includes(e.fact.kind)||r===`changes`&&e.fact.kind===`changes`||r===`reviews`&&e.fact.kind===`review`:!1}function At(e){W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`request`,`records`,`next`,`coverage`]),n=Tt(t.request);n.snapshotSeq===null&&j();let r=B(t.records,n.limit,Dt),i=R(t.next,Tt);return(r.some(e=>!kt(e,n))||i&&(i.after===null||W(ot({...i,after:n.after}))!==W(ot(n))||W(i.after)===W(n.after)))&&j(),{request:n,records:r,next:i,coverage:q(t.coverage)}}function jt(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value===`snapshot`){W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`kind`,`request`,`next`,`coverage`]),n=Tt(t.request),r=Tt(t.next);return(n.snapshotSeq!==null||n.after!==null||r.snapshotSeq===null||!r.navigation||W(ot({...r,snapshotSeq:null}))!==W(ot(n)))&&j(),{kind:`snapshot`,request:n,next:r,coverage:q(t.coverage)}}if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return At(e);W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`kind`,`request`,`next`,`coverage`]),n=Tt(t.request),r=Tt(t.next);return st(n,r),{kind:`progress`,request:n,next:r,coverage:q(t.coverage)}}function Mt(e,t){return W({...t.request,snapshotSeq:e.snapshotSeq})===W(e)&&(e.snapshotSeq===null||e.snapshotSeq===t.request.snapshotSeq)}function Nt(e){let t=z(e,[`storeId`,`scope`,`snapshotSeq`,`graph`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]),n=z(t.graph,[`recordId`,`revision`,`sha256`]);return{...Object.hasOwn(t,`navigation`)?{navigation:Oe(t.navigation)}:{},storeId:V(t.storeId),scope:J(t.scope),snapshotSeq:U(t.snapshotSeq),graph:{recordId:V(n.recordId),revision:P(n.revision,1),sha256:H(n.sha256)}}}function Pt(e){W({kind:`ok`,value:e});let t=z(e,[`request`,`graph`]),n=Nt(t.request),r=he(t.graph);return(r.revision!==n.graph.revision||n.scope.kind===`task`&&n.scope.id!==r.taskId)&&j(),{request:n,graph:r}}function Ft(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return Pt(e);W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`kind`,`request`,`next`,`coverage`]),n=Nt(t.request),r=Nt(t.next);return st(n,r),{kind:`progress`,request:n,next:r,coverage:q(t.coverage)}}function It(e){let t=z(e,[`storeId`,`scope`,`snapshotSeq`,`format`]);return{storeId:V(t.storeId),scope:J(t.scope),snapshotSeq:U(t.snapshotSeq),format:I(t.format,[`ndjson`,`markdown`])}}function Lt(e){W(e,D.controlBytes);let t=z(e,[`exportId`,`ordinal`,`event`]),n=K(t.event),r;switch(n){case`manifest`:{let e=z(t.event,[`kind`,`schema`,`request`,`coverage`,`serviceProtocol`,`workerProtocol`,`provenance`]),i=z(e.provenance,[`exporterBuildSha256`,`capturePolicy`]);r={kind:n,provenance:{exporterBuildSha256:H(i.exporterBuildSha256),capturePolicy:L(i.capturePolicy,`public-text-tools/2`)},schema:L(e.schema,E),request:It(e.request),coverage:q(e.coverage),serviceProtocol:L(e.serviceProtocol,1),workerProtocol:L(e.workerProtocol,2)};break}case`record`:r={kind:n,record:Dt(z(t.event,[`kind`,`record`]).record)};break;case`graph`:r={kind:n,graph:Pt(z(t.event,[`kind`,`graph`]).graph)};break;case`detail`:{let e=z(t.event,[`kind`,`owner`,`content`,`range`,`text`,`coverage`]),i=G(e.content),a=R(e.range,pe),o=M(e.text,D.detailPageBytes);(a?a.end>i.bytes||a.end-a.start!==N(o):i.bytes!==0||o!==``)&&j(),r={kind:n,owner:vt(e.owner),content:i,range:a,text:o,coverage:q(e.coverage)};break}case`markdown`:r={kind:n,text:M(z(t.event,[`kind`,`text`]).text,D.detailPageBytes)};break;case`trailer`:{let e=z(t.event,[`kind`,`complete`,`frames`,`encodedBytes`,`sha256`,`committedSeq`,`coverage`]),i=q(e.coverage),a=F(e.complete);a&&i.observed!==`complete`&&j(),r={kind:n,complete:a,frames:P(e.frames,1),encodedBytes:P(e.encodedBytes),sha256:H(e.sha256),committedSeq:U(e.committedSeq),coverage:i};break}default:return j()}return{exportId:V(t.exportId),ordinal:P(t.ordinal,1),event:r}}function Rt(e,t){let n=Lt(e);return t===`ndjson`?`${W(n)}\n`:n.event.kind===`markdown`?n.event.text:(n.event.kind!==`manifest`&&n.event.kind!==`trailer`&&j(),`\n\n\`\`\`json\n${W(n)}\n\`\`\`\n`)}var zt=class{exportId=null;ordinal=0;bytes=0;ended=!1;complete=!1;request;constructor(e){this.request=It(e)}receive(e){let t=Lt(e),n=t.event;return(this.ended||t.ordinal!==this.ordinal+1||this.exportId!==null&&this.exportId!==t.exportId)&&j(),this.ordinal===0?(n.kind!==`manifest`||W(n.request)!==W(this.request))&&j():n.kind===`manifest`&&j(),n.kind===`trailer`?((n.frames!==this.ordinal||n.encodedBytes!==this.bytes||n.committedSeq!==this.request.snapshotSeq)&&j(),this.ended=!0,this.complete=n.complete):(this.request.format===`markdown`&&n.kind!==`manifest`&&n.kind!==`markdown`&&j(),this.request.format===`ndjson`&&n.kind===`markdown`&&j(),n.kind===`detail`&&!yt(n.owner,this.request.scope)&&j(),n.kind===`graph`&&(W(n.graph.request.scope)!==W(this.request.scope)||n.graph.request.snapshotSeq!==this.request.snapshotSeq||n.graph.request.storeId!==this.request.storeId)&&j(),n.kind===`record`&&!Bt(n.record,this.request.scope)&&j(),this.bytes+=N(Rt(t,this.request.format))),this.exportId=t.exportId,this.ordinal=t.ordinal,t}get completion(){return this.ended?this.complete?`complete-unverified-digest`:`incomplete`:`missing-trailer`}};function Bt(e,t){return e.kind===`run`?nt(e.projection,t):e.kind===`owner-fact`?t.kind===`task`?e.link.taskId===t.id:t.kind===`run`&&e.link.runId===t.id:e.kind===`capture-fact`?t.kind===`task`?e.link.taskId===t.id:t.kind===`run`?e.link.runId===t.id:e.link.childRunId===t.id:yt(e.owner,t)}function Vt(e){let t=z(e,[`taskId`,`revision`,`definitions`]),n=B(t.definitions,32,e=>{let t=z(e,[`selection`,`status`,`checkId`]),n=ve(t.selection),r=I(t.status,[`not-run`,`passed`,`failed`,`canceled`,`stale`]),i=R(t.checkId,V);return(n.kind!==`configured`||r===`not-run`!=(i===null))&&j(),{selection:n,status:r,checkId:i}});return new Set(n.map(e=>e.selection.name)).size!==n.length&&j(),{taskId:V(t.taskId),revision:P(t.revision),definitions:n}}function Ht(e){let t=z(e,[`storeId`,`scope`,`snapshotSeq`,`kind`,`id`,`version`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]);return{...Object.hasOwn(t,`navigation`)?{navigation:Oe(t.navigation)}:{},storeId:V(t.storeId),scope:J(t.scope),snapshotSeq:U(t.snapshotSeq),kind:I(t.kind,[`task`,`message`,`tool`]),id:V(t.id),version:P(t.version,1)}}function Ut(e){W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`request`,`record`]),n=Ht(t.request),r=Dt(t.record);return(r.kind!==`task`&&r.kind!==`message`&&r.kind!==`tool`||r.kind!==n.kind||r.owner.entity.id!==n.id||r.version!==n.version||!yt(r.owner,n.scope))&&j(),{request:n,record:r}}function Wt(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return Ut(e);W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`kind`,`request`,`next`,`coverage`]),n=Ht(t.request),r=Ht(t.next);return st(n,r),{kind:`progress`,request:n,next:r,coverage:q(t.coverage)}}var Gt=e=>{let t=re(e);return L(t.effect,`none`),t};function Kt(e){let t=z(e,[`storeId`,`taskId`]);return{storeId:V(t.storeId),taskId:R(t.taskId,V)}}function qt(e){let t=Kt(e);return t.taskId===null&&j(),t}function Jt(e){let t=z(e,[`id`,`kind`,`revision`,`identity`]);return{id:V(t.id),kind:I(t.kind,[`code`,`research`,`diagnosis`]),revision:P(t.revision,1),identity:H(t.identity)}}function Yt(e){let t=B(e,3,de);return(t.length!==3||new Set(t.map(e=>e.role)).size!==3)&&j(),t}function Xt(e){let t=Object.getOwnPropertyDescriptor(e??{},`status`)?.value;if(t===`none`)return z(e,[`status`]),{status:t};if(t===`saved`){let n=z(e,[`status`,`request`,`planRevision`]);return{status:t,request:Nt(n.request),planRevision:P(n.planRevision,1)}}let n=z(e,[`status`,`error`]);return L(n.status,`unavailable`),{status:`unavailable`,error:Gt(n.error)}}function Zt(e){if((!(e.task?e.task.id===e.request.taskId:e.request.taskId===null||e.context.status===`unavailable`)||pt(e.context)!==e.workspaceId||mt(e.context)!==e.request.taskId)&&j(),e.context.status===`available`){let t=e.context.version;(t.epoch!==e.epoch||!!t.task!=!!e.task||e.task&&(t.task?.revision!==e.task.revision||t.task.identity!==e.task.identity||t.task.kind!==e.task.kind))&&j()}}function Qt(e){W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`request`,`workspaceId`,`epoch`,`committedSeq`,`context`,`task`,`roles`,`readablePlan`,`savedGraph`]),n={request:Kt(t.request),workspaceId:V(t.workspaceId),epoch:V(t.epoch),committedSeq:U(t.committedSeq),context:ft(t.context),task:R(t.task,Jt),roles:Yt(t.roles),savedGraph:Xt(t.savedGraph),readablePlan:R(t.readablePlan,e=>{let t=z(e,[`source`,`text`,`editable`,`coverage`]),n=q(t.coverage),r=F(t.editable);return r&&(n.redacted||n.observed!==`complete`||n.source!==`complete`||n.omissions.length)&&j(),{source:L(t.source,`current-v1`),text:M(t.text,32768),editable:r,coverage:n}})};Zt(n),!!n.task!=!!n.readablePlan&&j();let r=n.savedGraph;return r.status===`saved`&&(r.request.storeId!==n.request.storeId||r.request.scope.kind!==`task`||r.request.scope.id!==n.task?.id||r.request.snapshotSeq!==n.committedSeq||n.context.status===`available`&&(r.request.graph.sha256!==n.context.version.task?.graphIdentity||r.request.graph.revision!==n.context.version.task?.graphRevision))&&j(),r.status===`unavailable`&&n.context.status===`available`&&j(),n}function $t(e){W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`request`,`workspaceId`,`epoch`,`committedSeq`,`context`,`task`,`observation`,`text`,`git`,`coverage`]),n=z(t.observation,[`identity`,`complete`,`checkoutGeneration`]),r={request:qt(t.request),workspaceId:V(t.workspaceId),epoch:V(t.epoch),committedSeq:U(t.committedSeq),context:ft(t.context),task:Jt(t.task),observation:{identity:H(n.identity),complete:F(n.complete),checkoutGeneration:P(n.checkoutGeneration,0)},text:M(t.text,131072),git:F(t.git),coverage:q(t.coverage)};if(Zt(r),r.context.status===`available`){let e=r.context.version;(e.observation.identity!==r.observation.identity||e.observation.complete!==r.observation.complete||e.checkoutGeneration!==r.observation.checkoutGeneration)&&j()}return r}function en(e){let t=z(e,[`epoch`,`accessGeneration`,`configRev`,`catalogId`]);return{epoch:V(t.epoch),accessGeneration:P(t.accessGeneration,1),configRev:P(t.configRev,1),catalogId:V(t.catalogId)}}function tn(e){W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`version`,`selected`]);return{version:en(t.version),selected:R(t.selected,ue)}}function nn(e){W(e);let t=z(e,[`expected`,`choice`]);return{expected:en(t.expected),choice:le(t.choice)}}function rn(e){let t=z(e,[`provider`,`model`,`api`,`thinking`,`eligibility`]),n={provider:M(t.provider,128,!0),model:M(t.model,256,!0),api:R(t.api,e=>I(e,se)),thinking:B(t.thinking,7,e=>{let t=z(e,[`level`,`selectable`]);return{level:I(t.level,ce),selectable:F(t.selectable)}}),eligibility:I(t.eligibility,[`candidate`,`unsupported`,`auth-unavailable`])};return(new Set(n.thinking.map(e=>e.level)).size!==n.thinking.length||n.thinking.some(e=>e.selectable&&(n.api===null||n.eligibility!==`candidate`))||n.eligibility===`candidate`&&!n.thinking.some(e=>e.selectable))&&j(),n}function an(e){W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`version`,`selected`,`status`,`entries`,`withheld`]),n=B(t.entries,D.maxPageEntries,rn),r=I(t.status,[`complete`,`capacity`]),i=P(t.withheld,0,D.maxPageEntries);return(r===`capacity`&&(n.length||i)||n.length+i>D.maxPageEntries||new Set(n.map(e=>W([e.provider,e.model]))).size!==n.length)&&j(),{version:en(t.version),selected:R(t.selected,ue),status:r,entries:n,withheld:i}}function on(e){let t=z(e,[`id`,`path`,`cwd`,`epoch`]);return{id:H(t.id),path:M(t.path,4096,!0),cwd:M(t.cwd,4096,!0),epoch:V(t.epoch)}}function sn(e){let t=z(e,[`kind`,`epoch`,`csrf`,`home`,`projects`,`build`]);return{kind:L(t.kind,`workbench`),epoch:V(t.epoch),csrf:V(t.csrf),home:M(t.home,4096,!0),projects:B(t.projects,128,on),build:Xe(t.build)}}var cn=[`queued`,`running`,`completed`,`failed`,`canceled`,`timeout`,`unknown`];function ln(e){let t=Object.getOwnPropertyDescriptor(e??{},`kind`)?.value;switch(t){case`conversations`:case`projects`:return z(e,[`kind`]),{kind:t};case`task-origin`:return{kind:t,taskId:V(z(e,[`kind`,`taskId`]).taskId)};case`conversation`:{let n=z(e,[`kind`,`id`,`before`]);return{kind:t,id:V(n.id),before:R(n.before,V)}}default:{let t=z(e,[`kind`,`path`]);return{kind:I(t.kind,[`files`,`file`,`directories`]),path:M(t.path,4096)}}}}function un(e){let t=Object.getOwnPropertyDescriptor(e??{},`kind`)?.value;if(t===`link-task`){let n=z(e,[`kind`,`commandId`,`epoch`,`taskId`,`conversationId`]);return{kind:t,commandId:V(n.commandId),epoch:V(n.epoch),taskId:V(n.taskId),conversationId:V(n.conversationId)}}if(t===`send`){let n=z(e,[`kind`,`commandId`,`conversationId`,`head`,`text`,`model`]);return{kind:t,commandId:V(n.commandId),conversationId:V(n.conversationId),head:R(n.head,V),text:M(n.text,16384,!0),model:en(n.model)}}if(t===`interrupt`){let n=z(e,[`kind`,`commandId`,`conversationId`,`turnId`,`epoch`]);return{kind:t,commandId:V(n.commandId),conversationId:V(n.conversationId),turnId:V(n.turnId),epoch:V(n.epoch)}}let n=z(e,[`kind`,`commandId`,`path`,`epoch`]);return{kind:I(n.kind,[`open-project`]),commandId:V(n.commandId),path:M(n.path,4096,!0),epoch:V(n.epoch)}}function dn(e){let t=z(e,[`id`,`epoch`,`status`,`items`,`notice`]);return{id:V(t.id),epoch:V(t.epoch),status:I(t.status,cn),notice:M(t.notice,1024),items:B(t.items,256,e=>{let t=z(e,[`id`,`role`,`text`,`name`,`args`,`error`]);return{id:M(t.id,160,!0),role:I(t.role,[`user`,`assistant`,`tool`]),text:M(t.text,262144),name:M(t.name,128),args:M(t.args,65536),error:F(t.error)}})}}function fn(e){let t=z(e,[`id`,`title`,`head`,`status`,`updatedAt`]);return{id:V(t.id),title:M(t.title,512,!0),head:V(t.head),status:I(t.status,cn),updatedAt:P(t.updatedAt,0)}}function pn(e){W(e,524288);let t=Object.getOwnPropertyDescriptor(e??{},`kind`)?.value;if(t===`task-origin`){let n=z(e,[`kind`,`taskId`,`conversationId`]);return{kind:t,taskId:V(n.taskId),conversationId:R(n.conversationId,V)}}if(t===`conversations`)return{kind:t,entries:B(z(e,[`kind`,`entries`]).entries,200,fn)};if(t===`conversation`){let n=z(e,[`kind`,`summary`,`turns`,`before`]);return{kind:t,summary:R(n.summary,fn),turns:B(n.turns,20,dn),before:R(n.before,V)}}if(t===`files`||t===`directories`){let n=z(e,[`kind`,`path`,`parent`,`entries`,`limited`]);return{kind:t,path:M(n.path,4096),parent:R(n.parent,e=>M(e,4096)),limited:F(n.limited),entries:B(n.entries,200,e=>{let t=z(e,[`name`,`path`,`directory`]);return{name:M(t.name,1024,!0),path:M(t.path,4096,!0),directory:F(t.directory)}})}}if(t===`file`){let n=z(e,[`kind`,`path`,`text`,`limited`]);return{kind:t,path:M(n.path,4096),text:M(n.text,262144),limited:F(n.limited)}}if(t===`projects`)return{kind:t,entries:B(z(e,[`kind`,`entries`]).entries,128,e=>{let t=z(e,[`path`,`current`]);return{path:M(t.path,4096,!0),current:F(t.current)}})};if(t===`accepted`)return{kind:t,commandId:V(z(e,[`kind`,`commandId`]).commandId)};let n=z(e,[`kind`,`commandId`,`path`,`link`]);return{kind:I(n.kind,[`project`]),commandId:V(n.commandId),path:M(n.path,4096,!0),link:M(n.link,8192,!0)}}var mn={session:`/api/v1/session`,workbenchRead:`/api/v1/workbench/read`,workbenchCommand:`/api/v1/workbench/command`,current:`/api/v1/current`,currentChanges:`/api/v1/current-changes`,activeRuns:`/api/v1/active-runs`,models:`/api/v1/models`,chooseModel:`/api/v1/model-choice`,workspace:`/api/v1/workspace`,tasks:`/api/v1/tasks`,runs:`/api/v1/runs`,messages:`/api/v1/messages`,tools:`/api/v1/tools`,contents:`/api/v1/contents`,events:`/api/v1/history-events`,checks:`/api/v1/checks`,changes:`/api/v1/changes`,reviews:`/api/v1/reviews`,checkObligations:`/api/v1/check-obligations`,entity:`/api/v1/entity`,graph:`/api/v1/graph`,snapshot:`/api/v1/snapshot`,detail:`/api/v1/details`,search:`/api/v1/search`,export:`/api/v1/export`,download:`/api/v1/download`,preflight:`/api/v1/preflight`,command:`/api/v1/commands`,cancel:`/api/v1/cancel`,receipt:`/api/v1/receipt`,detach:`/api/v1/detach`},hn=`/api/v1/events`,gn=[`tasks`,`runs`,`messages`,`tools`,`contents`,`events`,`checks`,`changes`,`reviews`];function _n(e,t){if(gn.includes(e)||e===`detail`||e===`search`||e===`entity`||e===`current`||e===`currentChanges`||e===`activeRuns`||e===`workspace`||e===`models`||e===`chooseModel`||e===`workbenchRead`||e===`workbenchCommand`)return D.pageBytes;if(e===`graph`){let e=Object.getOwnPropertyDescriptor(t??{},`kind`)?.value,n=Object.getOwnPropertyDescriptor(t??{},`value`)?.value;if(e===`ok`&&Object.getOwnPropertyDescriptor(n??{},`kind`)?.value===`progress`)return D.pageBytes}return D.controlBytes}function vn(e){return[`preflight`,`command`,`cancel`,`detach`,`chooseModel`,`workbenchCommand`].includes(e)}function yn(e,t){switch(e){case`workbenchRead`:return ln(t);case`workbenchCommand`:return un(t);case`session`:case`models`:case`activeRuns`:case`workspace`:case`detach`:if(t!==null)throw new k(`invalid`);return null;case`tasks`:case`runs`:case`messages`:case`tools`:case`contents`:case`events`:case`checks`:case`changes`:case`reviews`:{let n=Tt(t);if(n.reader!==e)throw new k(`invalid`);return n}case`current`:return Kt(t);case`currentChanges`:return qt(t);case`checkObligations`:case`receipt`:return V(t);case`entity`:return Ht(t);case`graph`:return Nt(t);case`snapshot`:return J(t);case`detail`:case`search`:return Y(t);case`export`:case`download`:return It(t);case`chooseModel`:return nn(t);case`preflight`:return be(t);case`command`:return xe(t);case`cancel`:return Ce(t)}}function bn(e,t){if(gn.includes(e))return Z(t,jt);switch(e){case`workbenchRead`:case`workbenchCommand`:return Z(t,pn);case`current`:return Z(t,Qt);case`currentChanges`:return Z(t,$t);case`activeRuns`:return Z(t,Ke);case`models`:return Z(t,an);case`chooseModel`:return Z(t,tn);case`session`:return Z(t,gt);case`workspace`:return Z(t,_t);case`checkObligations`:return Z(t,Vt);case`entity`:return Z(t,Wt);case`graph`:return Z(t,Ft);case`snapshot`:return Z(t,it);case`detail`:return Z(t,ct);case`search`:return Z(t,ut);case`preflight`:return Z(t,Te);case`command`:case`cancel`:return Z(t,Qe);case`receipt`:return et(t);case`detach`:return Z(t,e=>{if(e!==null)throw new k(`invalid`);return null});default:throw new k(`invalid`)}}function xn(e){return[...gn,`workbenchRead`,`current`,`currentChanges`,`checkObligations`,`entity`,`graph`,`snapshot`,`detail`,`search`,`export`,`download`,`receipt`].includes(e)}function Sn(e,t){let n=mn[e];return t===null||vn(e)?n:`${n}?request=${encodeURIComponent(W(t))}`}function Cn(e,t){let n=yn(e,t),r=typeof n==`object`&&!!n&&Object.hasOwn(n,`navigation`),i=r?mn[e]:Sn(e,n);return vn(e)||xn(e)&&(r||N(i)>D.headerBytes/4)?{path:mn[e],method:`POST`,body:W(n)}:{path:i,method:`GET`}}function wn(e){W(e,D.viewerBytes);let t=I(Object.getOwnPropertyDescriptor(e,`kind`)?.value,[`snapshot`,`event`,`resync`]);return t===`snapshot`?{kind:t,snapshot:it(z(e,[`kind`,`snapshot`]).snapshot)}:t===`event`?{kind:t,event:at(z(e,[`kind`,`event`]).event)}:(z(e,[`kind`]),{kind:t})}var Tn=class{options;attachment;csrf=null;fetcher;origin;constructor(e){this.options=e;let t=new URL(e.origin);if(t.origin!==e.origin||t.protocol!==`https:`&&!/^http:\/\/(?:127\.0\.0\.1|\[::1\]):[1-9][0-9]*$/.test(e.origin)||e.project!==void 0&&!/^[a-f0-9]{64}$/.test(e.project))throw new k(`invalid`);this.origin=e.origin,e.build&&=Ye(e.build),this.fetcher=e.fetch??globalThis.fetch.bind(globalThis)}workbenchRead(e,t){return this.request(`workbenchRead`,e,t)}workbenchCommand(e){return this.request(`workbenchCommand`,e)}headers(e){let t={"Cache-Control":`no-store`};if(this.options.build&&(t[`X-Cadence-Build`]=W(this.options.build)),this.attachment&&(t[`X-Cadence-Attachment`]=this.attachment),this.options.localCapability&&(t[`X-Cadence-Local`]=this.options.localCapability),e){if(!this.attachment||!this.options.localCapability&&!this.csrf)throw new k(`stale`);t[`Content-Type`]=`application/json`,this.csrf&&(t[`X-Cadence-CSRF`]=this.csrf)}return t}async request(e,t,n){let r=Cn(e,yn(e,t)),i=r.method===`POST`,a=await this.fetcher(`${this.origin}${this.options.project?`/projects/${this.options.project}`:``}${r.path}`,{method:r.method,headers:this.headers(i),credentials:`same-origin`,redirect:`error`,signal:this.options.requestTimeoutMs===void 0?n:AbortSignal.any([...n?[n]:[],AbortSignal.timeout(this.options.requestTimeoutMs)]),...i?{body:r.body}:{}}),o;try{e===`session`&&a.ok&&(o=V(a.headers.get(`x-cadence-attachment`)),this.attachment=o)}catch(e){throw await a.body?.cancel().catch(()=>{}),e}let s=await En(a,_n(e)),c=ne(s);if(N(s)>_n(e,c))throw new k(`oversize`);let l=bn(e,c);if(e===`session`){let e=Z(l,gt);if(e.kind===`ok`){if(e.value.authority===`local`!=!!this.options.localCapability)throw new k(`forbidden`);this.attachment=o??V(a.headers.get(`x-cadence-attachment`)),this.csrf=e.value.csrf}}return l}session(e){return this.request(`session`,null,e)}current(e,t){return this.request(`current`,e,t)}currentChanges(e,t){return this.request(`currentChanges`,e,t)}activeRuns(e){return this.request(`activeRuns`,null,e)}models(e){return this.request(`models`,null,e)}chooseModel(e){return this.request(`chooseModel`,nn(e))}workspace(e){return this.request(`workspace`,null,e)}checkObligations(e,t){return this.request(`checkObligations`,V(e),t)}entity(e,t){return this.request(`entity`,Ht(e),t)}tasks(e,t){return this.request(`tasks`,Tt(e),t)}runs(e,t){return this.request(`runs`,Tt(e),t)}messages(e,t){return this.request(`messages`,Tt(e),t)}tools(e,t){return this.request(`tools`,Tt(e),t)}contents(e,t){return this.request(`contents`,Tt(e),t)}events(e,t){return this.request(`events`,Tt(e),t)}checks(e,t){return this.request(`checks`,Tt(e),t)}changes(e,t){return this.request(`changes`,Tt(e),t)}reviews(e,t){return this.request(`reviews`,Tt(e),t)}graph(e,t){return this.request(`graph`,Nt(e),t)}preflight(e){return this.request(`preflight`,be(e))}command(e){return this.request(`command`,xe(e))}cancel(e){return this.request(`cancel`,Ce(e))}receipt(e,t){return this.request(`receipt`,V(e),t)}snapshot(e,t){return this.request(`snapshot`,e,t)}detail(e,t){return this.request(`detail`,e,t)}search(e,t){return this.request(`search`,e,t)}async detach(){let e=this.attachment;if(!e)return;let t=Z(await this.request(`detach`,null),e=>{if(e!==null)throw new k(`invalid`);return null});if(t.kind===`error`&&t.error.code!==`stale`&&t.error.code!==`unauthenticated`)throw new k(t.error.code);return this.attachment===e&&(this.attachment=void 0,this.csrf=null),t}async*export(e,t){let n=Cn(`export`,It(e)),r=await this.fetcher(`${this.origin}${this.options.project?`/projects/${this.options.project}`:``}${n.path}`,{method:n.method,headers:this.headers(n.method===`POST`),...n.body===void 0?{}:{body:n.body},credentials:`same-origin`,redirect:`error`,signal:t});if(!r.ok||!r.body)throw await r.body?.cancel(),new k(`unavailable`);let i=r.body.getReader(),a=new TextDecoder(`utf-8`,{fatal:!0}),o=``;try{for(;;){let{value:e,done:n}=await i.read();if(t.aborted)throw new k(`unavailable`);for(let t=0;t<(n?1:e.byteLength);t+=D.chunkBytes){o+=n?a.decode():a.decode(e.subarray(t,t+D.chunkBytes),{stream:!0});let r=o.indexOf(`
2
+ `);for(;r!==-1;){let e=o.slice(0,r);o=o.slice(r+1),yield Lt(ne(e,D.controlBytes)),r=o.indexOf(`
3
+ `)}if(new TextEncoder().encode(o).length>D.controlBytes)throw new k(`oversize`)}if(n){if(o)throw new k(`invalid`);break}}}finally{await i.cancel().catch(()=>{}),i.releaseLock()}}subscribe(e,t,n){let r=J(e);if(!this.attachment||!this.options.socket)throw new k(`unavailable`);let i=this.options.socket(`${this.origin.replace(/^http/,`ws`)}${this.options.project?`/projects/${this.options.project}`:``}${hn}?attachment=${this.attachment}`),a=!1,o=!1,s=Date.now(),c=Date.now(),l=()=>{if(!o){o=!0,a=!1,clearInterval(d);try{i.close()}catch{}u(`closed`)}},u=e=>{try{n(e)}catch{}},d=setInterval(()=>{if(a){Date.now()-s>=D.staleMs&&u(`stale`);try{Date.now()-c>=D.reconcileMs?(i.send(W({kind:`resync`,scope:r})),c=Date.now()):i.send(`{"kind":"ping"}`)}catch{l()}}},D.heartbeatMs);return i.addEventListener(`open`,()=>{if(!o){a=!0;try{i.send(W({kind:`subscribe`,scope:r}))}catch{l()}}}),i.addEventListener(`message`,e=>{if(!o)try{if(typeof e.data!=`string`)throw new k(`invalid`);let n=wn(ne(e.data,D.viewerBytes));s=Date.now(),u(`current`),t(n)}catch{l()}}),i.addEventListener(`error`,l),i.addEventListener(`close`,l),l}};async function En(e,t){if(!e.body)throw new k(`invalid`);let n=e.body.getReader(),r=new TextDecoder(`utf-8`,{fatal:!0}),i=0,a=``;try{for(;;){let{value:e,done:o}=await n.read();if(o)return a+r.decode();if(i+=e.byteLength,i>t)throw new k(`oversize`);a+=r.decode(e,{stream:!0})}}finally{await n.cancel().catch(()=>{}),n.releaseLock()}}var Dn={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},On=f.createContext&&f.createContext(Dn),kn=[`attr`,`size`,`title`];function An(e,t){if(e==null)return{};var n,r,i=jn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function jn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Mn(){return Mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Mn.apply(null,arguments)}function Nn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Pn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Nn(Object(n),!0).forEach(function(t){Fn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fn(e,t,n){return(t=In(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function In(e){var t=Ln(e,`string`);return typeof t==`symbol`?t:t+``}function Ln(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Rn(e){return e&&e.map((e,t)=>f.createElement(e.tag,Pn({key:t},e.attr),Rn(e.child)))}function Q(e){return t=>f.createElement(zn,Mn({attr:Pn({},e.attr)},t),Rn(e.child))}function zn(e){var t=t=>{var n=e.attr,r=e.size,i=e.title,a=An(e,kn),o=r||t.size||`1em`,s;return t.className&&(s=t.className),e.className&&(s=(s?s+` `:``)+e.className),f.createElement(`svg`,Mn({stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`},t.attr,n,a,{className:s,style:Pn(Pn({color:e.color||t.color},t.style),e.style),height:o,width:o,xmlns:`http://www.w3.org/2000/svg`}),i&&f.createElement(`title`,null,i),e.children)};return On===void 0?t(Dn):f.createElement(On.Consumer,null,e=>t(e))}function Bn(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`18`,y1:`6`,x2:`6`,y2:`18`},child:[]},{tag:`line`,attr:{x1:`6`,y1:`6`,x2:`18`,y2:`18`},child:[]}]})(e)}function Vn(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2`},child:[]},{tag:`circle`,attr:{cx:`8.5`,cy:`7`,r:`4`},child:[]},{tag:`polyline`,attr:{points:`17 11 19 13 23 9`},child:[]}]})(e)}function Hn(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`3 6 5 6 21 6`},child:[]},{tag:`path`,attr:{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`},child:[]},{tag:`line`,attr:{x1:`10`,y1:`11`,x2:`10`,y2:`17`},child:[]},{tag:`line`,attr:{x1:`14`,y1:`11`,x2:`14`,y2:`17`},child:[]}]})(e)}function Un(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`},child:[]}]})(e)}function Wn(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`},child:[]}]})(e)}function Gn(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`3`,x2:`9`,y2:`21`},child:[]}]})(e)}function Kn(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`11`,cy:`11`,r:`8`},child:[]},{tag:`line`,attr:{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`},child:[]}]})(e)}function qn(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`23 4 23 10 17 10`},child:[]},{tag:`polyline`,attr:{points:`1 20 1 14 7 14`},child:[]},{tag:`path`,attr:{d:`M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15`},child:[]}]})(e)}function Jn(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`12`,y1:`5`,x2:`12`,y2:`19`},child:[]},{tag:`line`,attr:{x1:`5`,y1:`12`,x2:`19`,y2:`12`},child:[]}]})(e)}function Yn(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`},child:[]}]})(e)}function Xn(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`3`,y1:`12`,x2:`21`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`6`,x2:`21`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`18`,x2:`21`,y2:`18`},child:[]}]})(e)}function Zn(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`},child:[]},{tag:`polyline`,attr:{points:`16 17 21 12 16 7`},child:[]},{tag:`line`,attr:{x1:`21`,y1:`12`,x2:`9`,y2:`12`},child:[]}]})(e)}function Qn(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`8`,y1:`6`,x2:`21`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`8`,y1:`12`,x2:`21`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`8`,y1:`18`,x2:`21`,y2:`18`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`6`,x2:`3.01`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`12`,x2:`3.01`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`18`,x2:`3.01`,y2:`18`},child:[]}]})(e)}function $n(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`},child:[]},{tag:`path`,attr:{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`},child:[]}]})(e)}function er(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polygon`,attr:{points:`12 2 2 7 12 12 22 7 12 2`},child:[]},{tag:`polyline`,attr:{points:`2 17 12 22 22 17`},child:[]},{tag:`polyline`,attr:{points:`2 12 12 17 22 12`},child:[]}]})(e)}function tr(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`line`,attr:{x1:`2`,y1:`12`,x2:`22`,y2:`12`},child:[]},{tag:`path`,attr:{d:`M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z`},child:[]}]})(e)}function nr(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`18`,cy:`18`,r:`3`},child:[]},{tag:`circle`,attr:{cx:`6`,cy:`6`,r:`3`},child:[]},{tag:`path`,attr:{d:`M13 6h3a2 2 0 0 1 2 2v7`},child:[]},{tag:`line`,attr:{x1:`6`,y1:`9`,x2:`6`,y2:`21`},child:[]}]})(e)}function rr(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`6`,y1:`3`,x2:`6`,y2:`15`},child:[]},{tag:`circle`,attr:{cx:`18`,cy:`6`,r:`3`},child:[]},{tag:`circle`,attr:{cx:`6`,cy:`18`,r:`3`},child:[]},{tag:`path`,attr:{d:`M18 9a9 9 0 0 1-9 9`},child:[]}]})(e)}function ir(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},child:[]}]})(e)}function ar(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z`},child:[]},{tag:`polyline`,attr:{points:`13 2 13 9 20 9`},child:[]}]})(e)}function or(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`},child:[]},{tag:`polyline`,attr:{points:`14 2 14 8 20 8`},child:[]},{tag:`line`,attr:{x1:`16`,y1:`13`,x2:`8`,y2:`13`},child:[]},{tag:`line`,attr:{x1:`16`,y1:`17`,x2:`8`,y2:`17`},child:[]},{tag:`polyline`,attr:{points:`10 9 9 9 8 9`},child:[]}]})(e)}function sr(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`},child:[]},{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`3`},child:[]}]})(e)}function cr(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z`},child:[]}]})(e)}function lr(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`},child:[]},{tag:`polyline`,attr:{points:`7 10 12 15 17 10`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`15`,x2:`12`,y2:`3`},child:[]}]})(e)}function ur(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,ry:`2`},child:[]},{tag:`rect`,attr:{x:`9`,y:`9`,width:`6`,height:`6`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`1`,x2:`9`,y2:`4`},child:[]},{tag:`line`,attr:{x1:`15`,y1:`1`,x2:`15`,y2:`4`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`20`,x2:`9`,y2:`23`},child:[]},{tag:`line`,attr:{x1:`15`,y1:`20`,x2:`15`,y2:`23`},child:[]},{tag:`line`,attr:{x1:`20`,y1:`9`,x2:`23`,y2:`9`},child:[]},{tag:`line`,attr:{x1:`20`,y1:`14`,x2:`23`,y2:`14`},child:[]},{tag:`line`,attr:{x1:`1`,y1:`9`,x2:`4`,y2:`9`},child:[]},{tag:`line`,attr:{x1:`1`,y1:`14`,x2:`4`,y2:`14`},child:[]}]})(e)}function dr(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`},child:[]},{tag:`path`,attr:{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`},child:[]}]})(e)}function fr(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`polyline`,attr:{points:`12 6 12 12 16 14`},child:[]}]})(e)}function pr(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`18 15 12 9 6 15`},child:[]}]})(e)}function mr(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`9 18 15 12 9 6`},child:[]}]})(e)}function hr(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`6 9 12 15 18 9`},child:[]}]})(e)}function gr(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`20 6 9 17 4 12`},child:[]}]})(e)}function _r(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`9 11 12 14 22 4`},child:[]},{tag:`path`,attr:{d:`M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11`},child:[]}]})(e)}function vr(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M22 11.08V12a10 10 0 1 1-5.93-9.14`},child:[]},{tag:`polyline`,attr:{points:`22 4 12 14.01 9 11.01`},child:[]}]})(e)}function yr(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`12`,y1:`19`,x2:`12`,y2:`5`},child:[]},{tag:`polyline`,attr:{points:`5 12 12 5 19 12`},child:[]}]})(e)}function br(e){return Q({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`12`,y1:`5`,x2:`12`,y2:`19`},child:[]},{tag:`polyline`,attr:{points:`19 12 12 19 5 12`},child:[]}]})(e)}async function xr(e,t,n){let r=await e.preflight(t,n);return r.kind===`error`?r:{kind:`ok`,value:{preflight:r.value,commandId:crypto.randomUUID(),submitted:!1}}}function Sr(e,t){if(t.submitted)throw Error(`Already submitted; observe the same receipt.`);t.submitted=!0;let n=t.preflight,r={commandId:t.commandId,expected:n.preview.version,grant:n.grant},i=n.preview.action;switch(i.kind){case`create`:return e.create({...r,action:i});case`save-plan`:return e.savePlan({...r,action:i});case`generate-plan`:return e.generatePlan({...r,action:i});case`start`:return e.start({...r,action:i});case`check`:return e.check({...r,action:i});case`review`:return e.review({...r,action:i})}}var $=e=>({kind:`error`,error:A(`unavailable`,e?`uncertain`:`none`)}),Cr=class{transport;constructor(e){this.transport=e}async workbenchRead(e,t){let n=ln(e);try{return this.transport.workbenchRead?Z(await this.transport.workbenchRead(n,t),pn):$(!1)}catch{return $(!1)}}async workbenchCommand(e){let t=un(e);try{if(!this.transport.workbenchCommand)return $(!0);let e=Z(await this.transport.workbenchCommand(t),pn);return e.kind===`ok`&&(!(`commandId`in e.value)||e.value.commandId!==t.commandId)?$(!0):e}catch{return $(!0)}}async current(e,t){let n=Kt(e);try{if(!this.transport.current)return $(!1);let e=Z(await this.transport.current(n,t),Qt);return e.kind===`ok`&&W(e.value.request)!==W(n)?$(!1):e}catch{return $(!1)}}async currentChanges(e,t){let n=qt(e);try{if(!this.transport.currentChanges)return $(!1);let e=Z(await this.transport.currentChanges(n,t),$t);return e.kind===`ok`&&W(e.value.request)!==W(n)?$(!1):e}catch{return $(!1)}}async activeRuns(e){try{return this.transport.activeRuns?Z(await this.transport.activeRuns(e),Ke):$(!1)}catch{return $(!1)}}async models(e){try{return this.transport.models?Z(await this.transport.models(e),an):$(!1)}catch{return $(!1)}}async chooseModel(e){let t=nn(e);try{if(!this.transport.chooseModel)return $(!1);let e=Z(await this.transport.chooseModel(t),tn);if(e.kind===`ok`){let{sourceSelectionId:n,...r}=e.value.selected??{};if(W(r)!==W(t.choice)||e.value.version.epoch!==t.expected.epoch||e.value.version.accessGeneration!==t.expected.accessGeneration||![t.expected.configRev,t.expected.configRev+1].includes(e.value.version.configRev)||e.value.version.configRev===t.expected.configRev!=(e.value.version.catalogId===t.expected.catalogId))return $(!0)}return e}catch{return $(!0)}}async checkObligations(e,t){V(e);try{let n=Z(await this.transport.checkObligations(e,t),Vt);return n.kind===`ok`&&n.value.taskId!==e?$(!1):n}catch{return $(!1)}}task(e,t){return this.entity(`task`,e,t)}message(e,t){return this.entity(`message`,e,t)}tool(e,t){return this.entity(`tool`,e,t)}async entity(e,t,n){let r=Ht({...t,kind:e});try{let e=Z(await this.transport.entity(r,n),Wt);return e.kind===`ok`&&W(e.value.request)!==W(r)?$(!1):e}catch{return $(!1)}}async session(e){try{return Z(await this.transport.session(e),gt)}catch{return $(!1)}}async workspace(e){try{return Z(await this.transport.workspace(e),_t)}catch{return $(!1)}}tasks(e,t){return this.page(`tasks`,e,t)}runs(e,t){return this.page(`runs`,e,t)}messages(e,t){return this.page(`messages`,e,t)}tools(e,t){return this.page(`tools`,e,t)}contents(e,t){return this.page(`contents`,e,t)}events(e,t){return this.page(`events`,e,t)}checks(e,t){return this.page(`checks`,e,t)}changes(e,t){return this.page(`changes`,e,t)}reviews(e,t){return this.page(`reviews`,e,t)}async page(e,t,n){let r=Tt({...t,reader:e});try{let t=Z(await this.transport[e](r,n),jt);return t.kind===`ok`&&!Mt(r,t.value)?$(!1):t}catch{return $(!1)}}async graph(e,t){let n=Nt(e);try{let e=Z(await this.transport.graph(n,t),Ft);return e.kind===`ok`&&W(e.value.request)!==W(n)?$(!1):e}catch{return $(!1)}}async*export(e,t){let n=It(e),r=new zt(n),i;try{if(t.aborted)throw new k(`unavailable`);for await(let e of this.transport.export(n,t)){if(t.aborted)throw new k(`unavailable`);let n=r.receive(e);n.event.kind===`trailer`?i=n:yield n}if(t.aborted||!i)throw new k(`unavailable`);yield i}catch{throw new k(`unavailable`)}}async preflight(e,t){let n=be({expected:e,action:t});try{let e=Z(await this.transport.preflight(n),Te);return e.kind===`ok`&&(W(e.value.preview.version)!==W(n.expected)||W(e.value.preview.action)!==W(n.action))?$(!1):e}catch{return $(!1)}}create(e){return this.execute(`create`,e)}savePlan(e){return this.execute(`save-plan`,e)}generatePlan(e){return this.execute(`generate-plan`,e)}start(e){return this.execute(`start`,e)}check(e){return this.execute(`check`,e)}review(e){return this.execute(`review`,e)}async execute(e,t){let n=xe(t);if(n.action.kind!==e)return{kind:`error`,error:A(`invalid`)};try{let e=Z(await this.transport.command(n),Qe);if(e.kind===`ok`){if(e.value.commandId!==n.commandId)return $(!0);$e({identity:{kind:`action`,expected:n.expected,action:n.action},receipt:e.value})}return e}catch{return $(!0)}}async cancel(e){let t=Ce(e);try{let e=Z(await this.transport.cancel(t),Qe);if(e.kind===`ok`){if(e.value.commandId!==t.commandId)return $(!0);$e({identity:{kind:`cancel`,epoch:t.epoch,runId:t.runId},receipt:e.value})}return e}catch{return $(!0)}}async receipt(e,t){V(e);try{let n=et(await this.transport.receipt(e,t));if(n.status===`found`&&n.receipt.commandId!==e)throw Error(`invalid`);return n}catch{return{status:`inconclusive`,error:A(`receipt-inconclusive`,`uncertain`)}}}async snapshot(e,t){let n=J(e);try{let e=Z(await this.transport.snapshot(n,t),it);return e.kind===`ok`&&W(e.value.scope)!==W(n)?$(!1):e}catch{return $(!1)}}async detail(e,t){let n=Y(e);try{let e=Z(await this.transport.detail(n,t),ct);return e.kind===`ok`&&W(e.value.cursor)!==W(n)?$(!1):e}catch{return $(!1)}}async search(e,t){let n=Y(e);try{let e=Z(await this.transport.search(n,t),ut);return e.kind===`ok`&&W(e.value.cursor)!==W(n)?$(!1):e}catch{return $(!1)}}},wr=class{generation=0;snapshotRequest=0;observation;lastSnapshotMs=0;beginSnapshot(){return++this.snapshotRequest}install(e,t,n){if(n!==this.snapshotRequest)return;let r=it(e),i=this.observation?.snapshot;if(i&&i.storeId===r.storeId&&W(i.scope)===W(r.scope)&&ee(r.committedSeq,i.committedSeq)<0)this.resync();else return this.observation={snapshot:r,connection:`current`,lastObservedMs:t},this.lastSnapshotMs=t,++this.generation}resync(){return this.observation&&(this.observation.connection=`resync`),this.snapshotRequest++,`resync`}get state(){return this.observation&&structuredClone(this.observation)}needsPoll(e){return!this.observation||this.observation.connection===`resync`||e<this.lastSnapshotMs||e-this.lastSnapshotMs>=D.reconcileMs}tick(e){let t=this.observation;t&&t.connection!==`resync`&&(e<t.lastObservedMs||e-t.lastObservedMs>=D.staleMs)&&(t.connection=`stale`)}receive(e,t,n){let r=this.observation;if(!r||t!==this.generation)return`ignored`;if(r.connection===`resync`)return`resync`;let i;try{i=at(e)}catch{return this.resync()}let a=r.snapshot;if(i.storeId!==a.storeId||i.epoch!==a.epoch||W(i.scope)!==W(a.scope))return this.resync();let o=ee(i.committedSeq,a.committedSeq);if(o<0)return`duplicate`;if(i.kind===`heartbeat`)return o>0?this.resync():(r.lastObservedMs=n,r.connection=`current`,`applied`);if(o===0)return`duplicate`;if(i.previousSeq!==a.committedSeq||pt(i.context)!==pt(a.context)||mt(i.context)!==mt(a.context)||i.context.status===`available`&&a.context.status===`available`&&i.context.version.controlRev<a.context.version.controlRev)return this.resync();let s=[...a.runs];for(let e of i.removed){let t=s.findIndex(t=>(t.childRunId??t.runId)===e);if(t===-1||s[t].lifecycle!==`settled`)return this.resync();s.splice(t,1)}for(let e of i.runs){let t=e.childRunId??e.runId,n=s.findIndex(e=>(e.childRunId??e.runId)===t);if(n===-1)s.push(e);else{let t=s[n];if(t.runId!==e.runId||t.childRunId!==e.childRunId||t.assignmentId!==e.assignmentId||W(t.admission)!==W(e.admission))return this.resync();s[n]=e}}if(s.length>D.maxPageEntries)return this.resync();let c={...a,runs:s,context:i.context,committedSeq:i.committedSeq,horizon:{...a.horizon,historicalRuns:{...a.horizon.historicalRuns,snapshotSeq:i.committedSeq}}};try{it(c)}catch{return this.resync()}return a.runs=s,a.horizon=c.horizon,a.context=i.context,a.committedSeq=i.committedSeq,r.lastObservedMs=n,r.connection=`current`,`applied`}},Tr={sourceHash:`79ea189f234e9fa37c4ce1aca9dd934edc18e0a5060e30fcf762a1fe26d94528`,contractHash:`944f3b53bd5b7f1d3f30868e0947d900e356ae9a2bcfb9f591edd988b3d5eb3a`,buildId:`8d8fee8c1f429be605e65ea16a7249085096b560387e73024ff9db3fbd4c0c8e`};function Er(e){let t=new Tn({origin:window.location.origin,...e?{project:e}:{},...Tr?{build:{kind:`browser`,...Tr}}:{},socket:e=>new WebSocket(e)});return{client:new Cr(t),transport:t}}async function Dr(e,t,n,r){let i=Qt(e);if(i.context.status!==`available`||!i.context.version.task||!i.readablePlan?.editable||i.savedGraph.status===`unavailable`)throw new k(`unavailable`);let a=i.context.version,o=a.task;if(!o)throw new k(`stale`);let s=M(t,32768),c=ye({kind:`save-plan`,taskId:o.id,plan:s,graph:{schema:`cadence-graph/2`,taskId:o.id,taskKind:o.kind,taskRevision:o.revision+1,revision:(o.graphRevision??0)+1,planRevision:i.savedGraph.status===`saved`?i.savedGraph.planRevision+1:1,plan:{recordId:r.uuid(),version:i.savedGraph.status===`saved`?i.savedGraph.planRevision+1:1,field:`plan`,bytes:N(s),sha256:`0`.repeat(64)},assignments:n}});if(c.kind!==`save-plan`)throw new k(`invalid`);for(let e of c.graph.assignments){let t=i.roles.find(t=>t.role===fe(e.purpose));if(!t||W(t)!==W(e.role)||W(a.model)!==W(e.model))throw new k(`stale`)}c.graph.plan.sha256=await r.sha256(new TextEncoder().encode(s));let l=ye(c);if(l.kind!==`save-plan`)throw new k(`invalid`);return l}var Or=`Current plan metadata unavailable. Observe again; historical text is not action authority.`;function kr(e,t){let n=async n=>{let r=await e.current({storeId:t,taskId:n.task?.id??null});if(r.kind===`error`)throw new k(r.error.code);if(r.value.context.status!==`available`||W(r.value.context.version)!==W(n))throw new k(`stale`);return r.value},r=e=>({kind:`error`,error:A(e instanceof k?e.code:`unavailable`)});return{async read(t,i){try{let r=await n(t);if(!r.readablePlan||r.savedGraph.status===`unavailable`)throw new k(`unavailable`);let a=null;if(r.savedGraph.status===`saved`){let o=r.savedGraph.request;if(i&&(i.storeId!==o.storeId||W(i.graph)!==W(o.graph)||W(i.scope)!==W(o.scope)))throw new k(`stale`);let s=await e.graph(i??o);if(s.kind===`error`)return s;if(await n(t),`kind`in s.value)return{kind:`ok`,value:{...s.value,context:t}};a=s.value.graph}else if(i)throw new k(`stale`);return{kind:`ok`,value:{context:t,roles:r.roles,savedGraph:a,readablePlan:r.readablePlan.text,editable:r.readablePlan.editable}}}catch(e){return r(e)}},async saveAction(e,t){let i=structuredClone(t);try{let t=await Dr(await n(e),i.readablePlan,i.assignments,{uuid:()=>crypto.randomUUID(),sha256:async e=>Array.from(new Uint8Array(await crypto.subtle.digest(`SHA-256`,Uint8Array.from(e))),e=>e.toString(16).padStart(2,`0`)).join(``)});return await n(e),{kind:`ok`,value:t}}catch(e){return r(e)}}}}function Ar(e,t){if(e.commandId!==t.commandId)return e;let n=[e.receipt,e.lookup?.status===`found`?e.lookup.receipt:void 0,t.receipt,t.lookup?.status===`found`?t.lookup.receipt:void 0],r,i=!1;for(let t of n)t&&t.commandId===e.commandId&&(r&&(r.operationId!==t.operationId||r.runId!==t.runId||r.created!==null&&r.created.taskId!==t.created?.taskId)||r&&ee(t.committedSeq,r.committedSeq)>0&&(r.created?.state===`published`&&t.created?.state!==`published`||r.admission===`accepted`&&t.admission!==`accepted`||r.execution!==null&&t.execution!==r.execution||r.settlement!==null&&W(t.settlement)!==W(r.settlement))?i=!0:(!r||ee(t.committedSeq,r.committedSeq)>0||W(r)===W(t))&&(r=t));return{commandId:e.commandId,receipt:r,lookup:r?{status:`found`,receipt:r}:t.lookup??e.lookup,error:i?`Conflicting receipt observation refused; prior committed facts preserved.`:r?void 0:t.error??e.error}}function jr(e,t,n=0){let r=JSON.stringify(t),[i,a]=(0,f.useState)(0),[o,s]=(0,f.useState)({key:r,revision:-1});(0,f.useEffect)(()=>{if(r===`null`)return;let t=new AbortController,a,o=async()=>{let c=await e.workbenchRead(ln(JSON.parse(r)),t.signal);t.signal.aborted||(s(e=>c.kind===`ok`?{key:r,revision:i,value:c.value}:{key:r,revision:i,value:e.key===r?e.value:void 0,error:c.error.code}),n&&(a=setTimeout(()=>void o(),n)))};return o(),()=>{t.abort(),clearTimeout(a)}},[e,r,i,n]);let c=(0,f.useCallback)(()=>a(e=>e+1),[]);return{...o.key===r?o:{},loading:r!==`null`&&(o.key!==r||o.revision!==i),refresh:c}}function Mr(e,t){let n=/^(?:\/cadence|cadence)(?:\s+|$)/.exec(e.trimStart());return n?{mode:`cadence`,text:e.trimStart().slice(n[0].length)}:{mode:t,text:e}}var Nr=e=>e===`unauthenticated`||e===`forbidden`,Pr=class{api;serial=Promise.resolve();version=0;stopCurrent;pollCurrent;constructor(e){this.api=e}refresh(e=!1){this.pollCurrent?.(e)}observe(e,t){this.stopCurrent?.();let n=++this.version,r=!1,i,a,o,s=new AbortController,c=new wr,l=0,u=0,d=!1,f=!1,p=0,m=!1,h=!1,g={actions:!1,transportStatus:`closed`,attachmentVersion:0},_=()=>!r&&n===this.version,v=()=>{_()&&t({...g,observation:c.state})},y=()=>{r||(r=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),n===this.version&&(this.pollCurrent=void 0))};this.stopCurrent=y;let b=e=>{this.serial=this.serial.then(e).catch(()=>{_()&&(m=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),g.error=`Observation unavailable or detach unconfirmed; explicit re-entry required.`,g.actions=!1,g.transportStatus=`closed`,g.workspace=void 0,c=new wr,v())})},x=async()=>{await this.api.transport.detach()},S=async(t=!1)=>{if(!_()||!f||d||m)return;d=!0,g.actions=!1;let n=!1;v(),p=Date.now();let r=s.signal;try{let i=async()=>{let e=await this.api.client.session(r);return!_()||r.aborted?!1:e.kind===`error`?(g.actions=!1,g.error=e.error.code,Nr(e.error.code)&&C(),!1):(w(e.value),!0)};if(t&&!await i())return;e||(g.transportStatus=`current`);let a=await this.api.client.activeRuns(r);if(!_()||r.aborted)return;if(a.kind===`ok`)g.activeRuns=a.value;else if(Nr(a.error.code)){C();return}else g.activeRuns=void 0;v();let o=await this.api.client.workspace(r);if(!_()||r.aborted)return;if(o.kind===`error`){g.error=o.error.code,Nr(o.error.code)&&C();return}if(!t&&W(g.workspace?.models??[])!==W(o.value.models)&&!await i())return;if(g.workspace=o.value,e){let t=c.beginSnapshot(),i=await this.api.client.snapshot(e,r);if(!_()||r.aborted)return;if(i.kind===`error`)g.error=i.error.code,Nr(i.error.code)&&C();else{let e=c.install(i.value,Date.now(),t);e!==void 0&&(l=e),g.error=void 0,n=!0}}else g.error=void 0,n=!0}catch{_()&&(g.error=`Observation unavailable.`,g.actions=!1,g.transportStatus=`stale`)}finally{d=!1,g.actions=n&&h,v()}},C=()=>{m=!0,g.actions=!1,g.transportStatus=`closed`,g.error=`Access revoked; explicit token re-entry required.`,g.workspace=void 0,g.activeRuns=void 0,c=new wr,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),b(x),v()},w=e=>{let t=Tr?{kind:`browser`,...Tr}:null;g.compatible=Ze(e.build,t),g.cancelCompatible=Ze(e.build,t,!0),h=e.capabilities.actions&&g.compatible},T=async()=>{if(f=!1,await x(),!_()||m)return;let t=await this.api.client.session();if(!_()||m){await x();return}if(t.kind===`error`){m=!0,g.error=`${t.error.code}; explicit re-entry required.`,g.workspace=void 0,c=new wr,g.actions=!1,v();return}if(f=!0,s=new AbortController,c=new wr,g={actions:t.value.capabilities.actions,transportStatus:`closed`,attachmentVersion:g.attachmentVersion+1},w(t.value),v(),await S(),!_()||m||!e)return;let n=++u;i=this.api.transport.subscribe(e,e=>{if(_()&&!m&&n===u){if(e.kind===`snapshot`){let t=c.install(e.snapshot,Date.now(),c.beginSnapshot());t!==void 0&&(l=t)}else e.kind===`event`?c.receive(e.event,l,Date.now())===`resync`&&S():S();v()}},e=>{_()&&!m&&n===u&&(g.transportStatus=e,e===`closed`&&(f=!1,g.actions=!1,g.attachmentVersion++,s.abort(),u++,o=setTimeout(()=>b(T),1e3)),v())})};return b(T),this.pollCurrent=e=>{S(e)},a=setInterval(()=>{_()&&!m&&(c.tick(Date.now()),v(),(Date.now()-p>=3e4||e&&c.needsPoll(Date.now()))&&S())},1e3),()=>{_()&&(y(),b(x))}}};function Fr(e,t,n){let r=(0,f.useMemo)(()=>new Pr(e),[e]),[i,a]=(0,f.useState)({actions:!1,transportStatus:`closed`,attachmentVersion:0}),o=t?.kind,s=t?.id;return(0,f.useEffect)(()=>{if(a({actions:!1,transportStatus:`closed`,attachmentVersion:0}),n)return r.observe(o&&s?{kind:o,id:s}:null,a)},[r,o,s,n]),{...i,refresh:(e=!1)=>r.refresh(e)}}var Ir=class{generation=0;identity=``;select(e){e!==this.identity&&(this.identity=e,this.depart())}depart(){this.generation++}ticket(){return this.generation}current(e){return e===this.generation}};function Lr({title:e,children:t,onClose:n}){let{t:r}=C(),i=(0,f.useRef)(null),a=(0,f.useId)(),o=(0,f.useRef)(n);return o.current=n,(0,f.useEffect)(()=>{let e=document.activeElement,t=i.current;return t?.showModal(),()=>{t?.close(),e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}},[]),(0,h.jsxs)(`dialog`,{ref:i,className:`action-dialog`,"aria-labelledby":a,onCancel:e=>{e.preventDefault(),o.current()},children:[(0,h.jsxs)(`header`,{children:[(0,h.jsx)(`h2`,{id:a,children:e}),(0,h.jsx)(`button`,{type:`button`,className:`dialog-close`,"aria-label":r(`Close dialog — no cancellation of accepted work`),title:r(`Close — accepted work is not cancelled`),onClick:n,children:(0,h.jsx)(Bn,{"aria-hidden":`true`})})]}),t]})}function Rr(e){let t=e=>{if(typeof e==`string`||typeof e==`number`){let t=String(e);return t===``?[[]]:t.split(`
4
+ `).map(e=>e===``?[]:[e])}if(Array.isArray(e)){let n=[];for(let r of e){let e=t(r);if(n.length===0)n=e;else{let t=e[0]??[];n[n.length-1].push(...t),n.push(...e.slice(1))}}return n}if(e&&typeof e==`object`&&`props`in e){let n=e,r=n.props?.children,i={...n.props,children:void 0},a=r==null?[]:t(r);return a.length===0?[[(0,f.createElement)(n.type,i)]]:a.map(e=>[(0,f.createElement)(n.type,i,...e)])}return[[e]]},n=t(e);return n.length>1&&n[n.length-1].length===0&&n.pop(),n}var zr=function(){let e=this.data();e.micromarkExtensions??=[],e.micromarkExtensions.push({flow:{92:Br(!0)},text:{92:Br(!1)}});let t={enter:{backslashMathInline:Vr,backslashMathDisplay:Vr,backslashMathBlock:Vr},exit:{backslashMathInline:Hr,backslashMathDisplay:Hr,backslashMathBlock:Hr}};e.fromMarkdownExtensions??=[],e.fromMarkdownExtensions.push(t)};function Br(e){return{tokenize:function(t,n,r){let i=this,a=93,o=e?`backslashMathBlock`:`backslashMathDisplay`,s;return c;function c(e){return e===92?(s=t.enter(o),t.consume(e),l):r(e)}function l(n){return n!==91&&(e||n!==40)?r(n):(a=n===91?93:41,!e&&n===40&&(o=`backslashMathInline`,s.type=o),t.consume(n),u)}function u(n){return n===null||e&&i.parser.lazy[i.now().line]?r(n):n===-5||n===-4||n===-3?(t.enter(`lineEnding`),t.consume(n),t.exit(`lineEnding`),u):(f(n),n===92?d:u)}function d(i){return i===a?(f(i),t.exit(o),e?p:n):i===null?r(i):i===-5||i===-4||i===-3?u(i):(f(i),u)}function f(e){t.enter(`backslashMathData`),t.consume(e),t.exit(`backslashMathData`)}function p(e){return e===null||e===-5||e===-4||e===-3?n(e):e===32||e===-2||e===-1?(t.enter(`whitespace`),t.consume(e),t.exit(`whitespace`),p):r(e)}},concrete:e,name:e?`backslashMathBlock`:`backslashMathText`}}var Vr=function(e){let t=e.type===`backslashMathBlock`,n=e.type!==`backslashMathInline`,r=this.sliceSerialize(e).slice(2,-2).trim(),i={type:`element`,tagName:`code`,properties:{className:[`language-math`,n?`math-display`:`math-inline`]},children:[{type:`text`,value:r}]},a=t?{type:`math`,meta:null,value:r,data:{hName:`pre`,hChildren:[i]}}:{type:`inlineMath`,value:r,data:{hName:`code`,hProperties:i.properties,hChildren:i.children}};this.enter(a,e)},Hr=function(e){this.exit(e)};function Ur(e){if(typeof document>`u`)return!1;let t=document.createElement(`textarea`),n=document.activeElement;try{return t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,t.setAttribute(`readonly`,``),document.body.appendChild(t),t.select(),document.execCommand(`copy`)}catch{return!1}finally{t.remove(),n instanceof HTMLElement&&n.isConnected&&n.focus()}}async function Wr(e){if(typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)try{return await navigator.clipboard.writeText(e),!0}catch{return Ur(e)}return Ur(e)}function Gr(e={}){let{duration:t=2e3,onSuccess:n,onError:r}=e,i=(0,f.useRef)(!0),[a,o]=(0,f.useState)(!1),s=(0,f.useRef)(null),c=(0,f.useCallback)(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},[]),l=(0,f.useCallback)(()=>{c(),o(!1)},[c]);return(0,f.useEffect)(()=>(i.current=!0,()=>{i.current=!1,c()}),[c]),{copied:a,copy:(0,f.useCallback)(async e=>{let a=!1;try{a=await Wr(e)}catch(e){a=!1,r&&r(e)}return i.current&&(a?(o(!0),c(),s.current=setTimeout(()=>{o(!1),s.current=null},t),n?.(e)):r&&!a&&r(Error(`Copy failed`))),a},[t,n,r,c]),reset:l}}var Kr=(0,f.memo)(function({text:e}){let{t}=C(),[n,r]=(0,f.useState)(!1),{copied:i,copy:a}=Gr();return(0,h.jsxs)(`button`,{type:`button`,className:`copy-btn`,title:t(`Copy displayed text`),"aria-label":t(`Copy displayed text`),onClick:()=>{r(!1),a(e).then(e=>r(!e))},children:[i?(0,h.jsx)(gr,{}):(0,h.jsx)(dr,{}),n&&t(`Copy unavailable`)]})}),qr=[s,d,zr],Jr=[s,l,d,zr],Yr=[[c,{strict:!1,throwOnError:!1,trust:!1,maxExpand:1e3}],[u,{detect:!1,ignoreMissing:!0}]];function Xr(e){if(e.startsWith(`#`)&&![...e].some(e=>e.charCodeAt(0)<=32))return e;try{let t=new URL(e);return![`https:`,`http:`].includes(t.protocol)||t.username||t.password||t.searchParams.has(`token`)?void 0:e}catch{return}}function Zr({text:e,rawHtml:t=!1,hardBreaks:n=!1}){return(0,h.jsx)(a,{remarkPlugins:n?Jr:qr,rehypePlugins:t?[i,o,...Yr]:Yr,skipHtml:!t,disallowedElements:[`iframe`,`object`,`embed`,`script`,`style`,`video`,`audio`,`source`,`form`,`input`],components:{pre:ei,a:$r,img:({alt:e})=>(0,h.jsxs)(`span`,{className:`omission`,children:[`[Image omitted: `,e||`external/media content`,`]`]})},children:e})}var Qr=(0,f.memo)(function(e){return(0,h.jsx)(`div`,{className:`md`,children:(0,h.jsx)(Zr,{...e})})});function $r({href:e,children:t}){let n=e&&Xr(e);return n?(0,h.jsx)(`a`,{href:n,target:n.startsWith(`#`)?void 0:`_blank`,rel:`noreferrer noopener`,referrerPolicy:`no-referrer`,children:t}):(0,h.jsxs)(`span`,{children:[t,` [link unavailable]`]})}function ei({children:e,node:t,...n}){let r=e&&typeof e==`object`&&`props`in e?e.props?.children:e,i=0,a=Rr(r).map(e=>{let t=`code-offset:${i}`;return i+=ti(e).length+1,{key:t,nodes:e}}),o=a.length>1,s=o?`${String(a.length).length+1}ch`:void 0;return(0,h.jsxs)(`div`,{className:`codeblock`,children:[(0,h.jsx)(Kr,{text:ti(e)}),(0,h.jsx)(`pre`,{...n,children:a.map(({nodes:e,key:t},n)=>(0,h.jsxs)(`div`,{className:`code-line`,children:[o&&(0,h.jsx)(`span`,{className:`code-num`,style:s?{width:s}:void 0,children:n+1}),(0,h.jsx)(`code`,{className:`code-line-body hljs`,children:e})]},t))})]})}function ti(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(ti).join(``);if(e&&typeof e==`object`&&`props`in e){let t=e.props;return ti(t?.children)}return``}function ni({prepared:e,client:t,current:n,onClose:r,onResult:i,attachmentVersion:a}){let{t:o,tx:s}=C(),[c,l]=(0,f.useState)(Date.now()),[u,d]=(0,f.useState)(!1);(0,f.useEffect)(()=>{let e=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(e)},[]);let p=e.preflight,m=p.preview,g=(0,f.useRef)(a),_=(0,f.useRef)(!1);(!n||W(n)!==W(m.version)||c>=Date.parse(p.expiresAt)||g.current!==a)&&(_.current=!0);let v=_.current,y=async()=>{if(!(v||e.submitted)){d(!0),i({commandId:e.commandId,error:o(`Admission pending/unknown — observe this exact receipt.`)});try{let n=await Sr(t,e);i(n.kind===`ok`?{commandId:e.commandId,receipt:n.value}:{commandId:e.commandId,error:o(`{code}; effect {effect}`,{code:n.error.code,effect:n.error.effect})})}catch{i({commandId:e.commandId,error:o(`Uncertain; do not repeat the action.`)})}r()}};return(0,h.jsxs)(Lr,{title:o(`Confirm {action}`,{action:s(m.action.kind)}),onClose:r,children:[(0,h.jsx)(`p`,{children:o(`Access is not consent. This confirmation applies only to the displayed context, once.`)}),(0,h.jsxs)(`dl`,{children:[(0,h.jsx)(`dt`,{children:o(`Checkout`)}),(0,h.jsx)(`dd`,{children:m.rootLabel}),(0,h.jsx)(`dt`,{children:o(`Working directory`)}),(0,h.jsx)(`dd`,{children:(0,h.jsx)(`code`,{children:m.cwdLabel})}),(0,h.jsx)(`dt`,{children:o(`Model / API / thinking`)}),(0,h.jsxs)(`dd`,{children:[m.version.model.provider,` / `,m.version.model.model,` /`,` `,m.version.model.api,` / `,m.version.model.thinking]}),(0,h.jsx)(`dt`,{children:o(`Check environment`)}),(0,h.jsx)(`dd`,{children:o(`Service launch environment policy, generation {generation}; no browser environment overlays.`,{generation:m.version.checkEnvGeneration})}),(0,h.jsx)(`dt`,{children:o(`Observation`)}),(0,h.jsx)(`dd`,{children:m.version.observation.complete?o(`Complete within bounded scope`):o(`Incomplete bounded coverage`)}),(0,h.jsx)(`dt`,{children:o(`Expires`)}),(0,h.jsx)(`dd`,{children:p.expiresAt})]}),(0,h.jsx)(ri,{preview:m}),m.action.kind===`check`&&(0,h.jsxs)(`section`,{children:[(0,h.jsx)(`h3`,{children:o(`Exact parent check`)}),(0,h.jsx)(`pre`,{children:m.action.check.command}),(0,h.jsx)(`p`,{children:o(`{name}; timeout {timeout} ms; cwd above.`,{name:m.action.check.name,timeout:m.action.check.timeoutMs})})]}),m.action.kind===`generate-plan`&&(0,h.jsx)(`p`,{children:o(`Readonly proposal only. It will not save itself or dispatch editing.`)}),m.issues.length>0&&(0,h.jsx)(`p`,{role:`alert`,children:o(`Issues: {issues}`,{issues:m.issues.map(s).join(`, `)})}),v&&(0,h.jsx)(`p`,{role:`alert`,children:o(`Context changed or confirmation expired. Close, observe again and request a new preview.`)}),(0,h.jsxs)(`footer`,{children:[(0,h.jsx)(`button`,{type:`button`,onClick:r,children:o(`Back — no new effect`)}),(0,h.jsx)(`button`,{type:`button`,className:`primary`,disabled:v||u||e.submitted,onClick:()=>void y(),children:o(`Confirm {action}`,{action:s(m.action.kind)})})]})]})}function ri({preview:e}){let{t,tx:n}=C(),r=e.action,i=r.kind===`save-plan`?r.graph:e.graph;return(0,h.jsxs)(h.Fragment,{children:[r.kind===`create`&&(0,h.jsxs)(`section`,{children:[(0,h.jsx)(`h3`,{children:t(`Create {kind} task`,{kind:n(r.taskKind)})}),(0,h.jsx)(`pre`,{children:r.goal}),(0,h.jsx)(`p`,{children:t(`No Start is included.`)})]}),r.kind!==`create`&&(0,h.jsx)(Qr,{text:r.kind===`save-plan`?r.plan:e.readablePlan}),i?.assignments.map(e=>(0,h.jsxs)(`section`,{children:[(0,h.jsxs)(`h3`,{children:[e.id,` · `,e.purpose]}),(0,h.jsxs)(`p`,{children:[e.role.role,` / `,e.role.sha256]}),(0,h.jsx)(`pre`,{children:JSON.stringify(e.model,null,2)}),(0,h.jsx)(Qr,{text:e.instructions}),(0,h.jsx)(`p`,{children:t(`Expected: {output}`,{output:e.expectedOutput})}),(0,h.jsx)(`pre`,{children:JSON.stringify(e.dependencies,null,2)})]},e.id)),r.kind===`save-plan`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`h3`,{children:t(`Exact proposed graph and identities (not yet committed)`)}),(0,h.jsx)(`pre`,{children:JSON.stringify(r.graph,null,2)})]}),r.kind===`review`&&(0,h.jsxs)(`section`,{children:[(0,h.jsx)(`h3`,{children:t(`Exact human review targets`)}),(0,h.jsx)(`pre`,{children:JSON.stringify(r,null,2)}),(0,h.jsx)(`p`,{children:t(`Human review only; failures, native exit, stale and not-run checks remain unchanged. Issues acknowledgment: {accepted}.`,{accepted:String(r.acceptIssues)})})]})]})}function ii({client:e,compatible:t,onClose:n,onChanged:r}){let{t:i,tx:a}=C(),[o,s]=(0,f.useState)(),[c,l]=(0,f.useState)(``),[u,d]=(0,f.useState)(``),[p,m]=(0,f.useState)(``),[g,_]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let t=new AbortController;return e.models(t.signal).then(e=>{t.signal.aborted||(e.kind===`ok`?s(e.value):d(e.error.code))}).catch(()=>{t.signal.aborted||d(`unavailable`)}),()=>t.abort()},[e]),(0,h.jsxs)(Lr,{title:i(`Choose owner model`),onClose:n,children:[(0,h.jsx)(`p`,{children:i(`Explicit owner-wide choice, only while quiescent. This does not resolve credentials, probe a provider, save a plan or Start work.`)}),(0,h.jsx)(`p`,{children:i(`Current: {model}`,{model:o?.selected?`${o.selected.provider}/${o.selected.model} · ${o.selected.thinking}`:i(`No model selected`)})}),(0,h.jsxs)(`label`,{children:[i(`Exact model / API / thinking`),(0,h.jsxs)(`select`,{value:c,disabled:!o,onChange:e=>l(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:i(`Select explicitly`)}),o?.entries.flatMap(e=>e.thinking.filter(e=>e.selectable).map(t=>{let n=JSON.stringify({provider:e.provider,model:e.model,api:e.api,thinking:t.level});return(0,h.jsxs)(`option`,{value:n,children:[e.provider,`/`,e.model,` · `,e.api,` · `,t.level]},n)}))]})]}),o?.status===`capacity`&&(0,h.jsx)(`p`,{children:i(`Catalog capacity exceeded; no partial model list is selectable.`)}),!!o?.withheld&&(0,h.jsx)(`p`,{role:`alert`,children:i(o.withheld===1?`{count} model withheld: its provider or model ID contains a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.`:`{count} models withheld: their provider or model IDs contain a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.`,{count:o.withheld})}),u&&(0,h.jsx)(`p`,{role:`alert`,children:i(`Model catalog unavailable ({code}); no model is selectable. No automatic retry.`,{code:a(u)})}),p&&(0,h.jsx)(`p`,{role:`alert`,children:i(`{error}. No automatic replacement or retry.`,{error:a(p)})}),(0,h.jsx)(`button`,{type:`button`,disabled:!t||!o||!c||g,onClick:()=>{o&&(_(!0),e.chooseModel({expected:o.version,choice:le(JSON.parse(c))}).then(e=>{e.kind===`error`?m(e.error.code):(r(),n())}).catch(()=>m(`Choice response unconfirmed; observe catalog before another explicit choice.`)).finally(()=>_(!1)))},children:i(`Confirm owner model choice`)})]})}function ai({client:e,value:t,onChange:n}){let{t:r,tx:i}=C(),a=(0,f.useRef)(!0),o=(0,f.useRef)(null);(0,f.useEffect)(()=>(a.current=!0,()=>{a.current=!1,o.current?.abort()}),[]);let[s,c]=(0,f.useState)(!1),l=t.receipt??(t.lookup?.status===`found`?t.lookup.receipt:void 0);return(0,h.jsxs)(`section`,{className:`receipt`,"aria-label":r(`Command receipt`),children:[(0,h.jsx)(`h3`,{children:r(`Command receipt`)}),(0,h.jsx)(`code`,{children:t.commandId}),t.error&&(0,h.jsx)(`p`,{role:`alert`,children:i(t.error)}),l&&(0,h.jsxs)(`dl`,{children:[(0,h.jsx)(`dt`,{children:r(`Admission`)}),(0,h.jsx)(`dd`,{children:i(l.admission)}),(0,h.jsx)(`dt`,{children:r(`Execution`)}),(0,h.jsx)(`dd`,{children:l.execution?i(l.execution):r(`not settled`)}),(0,h.jsx)(`dt`,{children:r(`Publication`)}),(0,h.jsx)(`dd`,{children:i(l.publication)}),(0,h.jsx)(`dt`,{children:r(`Run`)}),(0,h.jsx)(`dd`,{children:l.runId??r(`metadata action`)})]}),t.lookup&&t.lookup.status!==`found`&&(0,h.jsx)(`p`,{children:r(`{status}. This observation does not authorize replay.`,{status:i(t.lookup.status)})}),(0,h.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>{c(!0),o.current=new AbortController,e.receipt(t.commandId,o.current.signal).then(e=>{a.current&&(n({commandId:t.commandId,lookup:e}),c(!1))})},children:r(`Observe exact receipt`)})]})}function oi(e,t){let n=e??{content:t.content,chunks:[],offset:0},r=n.content,i=t.content;if(r.recordId!==i.recordId||r.version!==i.version||r.field!==i.field||r.sha256!==i.sha256||r.bytes!==i.bytes||n.offset!==(t.range?.start??0))throw Error(`Noncontiguous immutable field`);return{...n,chunks:[...n.chunks,t.text],offset:t.range?.end??0}}function si(e,t,n){switch(t.reader){case`tasks`:return e.tasks(t,n);case`runs`:return e.runs(t,n);case`messages`:return e.messages(t,n);case`tools`:return e.tools(t,n);case`contents`:return e.contents(t,n);case`events`:return e.events(t,n);case`checks`:return e.checks(t,n);case`changes`:return e.changes(t,n);case`reviews`:return e.reviews(t,n)}}function ci(e,t,n,r){return{storeId:e,scope:t,snapshotSeq:n,query:null,recordId:r.recordId,recordVersion:r.version,field:r.field,offset:0}}async function li(e,t,n){let r={...t,offset:0};delete r.navigation;let i=null,a=!0;for(;r;){if(n.aborted)throw Error(`canceled`);let t=await e.detail(r,n);if(n.aborted)throw Error(`canceled`);if(t.kind===`error`)throw Error(t.error.code);let o=t.value;r=o.next,`kind`in o||(a&&=o.coverage.observed===`complete`,i=oi(i,o)),await new Promise(e=>setTimeout(e,0))}if(!i||i.offset!==i.content.bytes)throw Error(`incomplete-content`);return{text:i.chunks.join(``),recordingComplete:a}}function ui(e,t){let n=t?W({reader:t.reader,storeId:t.storeId,scope:t.scope,limit:t.limit}):`absent`,[r,i]=(0,f.useState)(),[a,o]=(0,f.useState)(!1),[s,c]=(0,f.useState)(),[l,u]=(0,f.useState)(t),[d,p]=(0,f.useState)([]),m=(0,f.useRef)(0),[h,g]=(0,f.useState)(n);return h!==n&&(m.current++,g(n),i(void 0),c(void 0),u(t),p([])),(0,f.useEffect)(()=>{let t=++m.current;if(!l){o(!1);return}let n=new AbortController;return o(!0),c(void 0),si(e,l,n.signal).then(e=>{t===m.current&&(o(!1),e.kind===`error`?c(e.error.code):i(e.value))}).catch(()=>{t===m.current&&(c(`Read unavailable.`),o(!1))}),()=>{n.abort(),m.current++}},[e,l]),{page:r,busy:a,error:s,more:()=>{!a&&r?.next&&(l&&p(e=>[...e,l]),u(r.next))},previous:()=>{!a&&d.length&&(u(d[d.length-1]),p(e=>e.slice(0,-1)))},canPrevious:d.length>0,refresh:()=>{i(void 0),p([]),u(t?{...t}:null)}}}function di({value:e,compact:t=!1}){let{t:n,tx:r}=C();return t&&e.observed===`complete`&&e.source===`complete`&&!e.redacted&&e.omissions.length===0?(0,h.jsxs)(`details`,{className:`coverage-details`,children:[(0,h.jsx)(`summary`,{children:n(`Recording details`)}),(0,h.jsx)(di,{value:e})]}):(0,h.jsxs)(`p`,{className:`coverage${e.observed===`complete`&&e.source===`complete`&&!e.redacted&&e.omissions.length===0?``:` partial`}`,children:[n(`Recording: {observed}; source: {source};`,{observed:r(e.observed),source:r(e.source)}),` `,e.redacted?n(`redacted`):n(`no reported redaction`),e.omissions.length>0&&n(`; omitted: {omissions}`,{omissions:e.omissions.map(r).join(`, `)}),n(`. Not a guarantee of complete original source or universal secret detection.`)]})}function fi(e,t){let n=[],r=t;if(!r)return n;let i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){let t=e.parentElement;return!t||t.closest(`.search-bar`)||t.closest(`.msg-collapsed`)?NodeFilter.FILTER_REJECT:(e.textContent??``).includes(r)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(let e=i.nextNode();e;e=i.nextNode()){let t=e.textContent??``;if(!e.parentElement?.closest(`[data-retained-field]`))continue;let i=t.indexOf(r);for(;i!==-1;){let a=document.createRange();if(a.setStart(e,i),a.setEnd(e,i+r.length),n.push(a),n.length===1e3)return n;i=t.indexOf(r,i+r.length)}}return n}var pi=new Map;function mi(e,t){t.length?pi.set(e,t):pi.delete(e);let n=e.endsWith(`-active`);e=n?`cadence-page-active`:`cadence-page`,t=[...pi].filter(([e])=>e.endsWith(`-active`)===n).flatMap(([,e])=>e);let r=CSS;if(!r.highlights)return;if(t.length===0){r.highlights.delete(e);return}let i=window.Highlight;i&&r.highlights.set(e,new i(...t))}function hi(e,t){let n=[],r=e;for(;r&&r!==t;){let e=getComputedStyle(r);/(auto|scroll|hidden)/.test(e.overflowY+e.overflowX)&&(r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth)&&n.push(r),r=r.parentElement}return n}function gi(e,t){let n=t.startContainer.parentElement;for(let r of hi(n,e)){let e=t.getBoundingClientRect(),n=r.getBoundingClientRect();if(e.height<=0||e.width<=0)return;e.top>=n.top+4&&e.bottom<=n.bottom-4||(r.scrollTop+=e.top-n.top-(r.clientHeight-e.height)/2),e.left>=n.left+4&&e.right<=n.right-4||(r.scrollLeft+=e.left-n.left-(r.clientWidth-e.width)/2)}let r=t.getBoundingClientRect(),i=e.getBoundingClientRect();if(r.height<=0||r.width<=0)return;let a=r.top>=i.top+6&&r.bottom<=i.bottom-6,o=r.left>=i.left+6&&r.right<=i.right-6;a&&o||(a||(e.scrollTop+=r.top-i.top-(i.height-r.height)/2),o||(e.scrollLeft+=r.left-i.left-(i.width-r.width)/2))}function _i({container:e,version:t}){let{t:n}=C(),[r,i]=(0,f.useState)(``),[a,o]=(0,f.useState)(0),[s,c]=(0,f.useState)(0),l=(0,f.useRef)([]),u=`cadence-page-${(0,f.useId)().replace(/[^a-z0-9]/gi,``)}`;(0,f.useEffect)(()=>{if(!t)return;let n=e.current,i=n&&r?fi(n,r):[];return l.current=i,c(i.length),o(0),mi(u,i),()=>mi(u,[])},[r,e,t,u]);let d=t=>{let n=s?(a+t+s)%s:0;o(n),e.current&&l.current[n]&&(gi(e.current,l.current[n]),mi(`${u}-active`,[l.current[n]]))};return(0,f.useEffect)(()=>()=>mi(`${u}-active`,[]),[u]),(0,h.jsxs)(`div`,{className:`search-bar toolbar`,children:[(0,h.jsxs)(`label`,{children:[n(`Find on displayed field page`),(0,h.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d(e.shiftKey?-1:1))}})]}),(0,h.jsxs)(`span`,{children:[s?a+1:0,`/`,s,s>=1e3?n(` (first 1000 visual highlights)`):``,n(`; not whole-history search`)]}),(0,h.jsx)(`button`,{type:`button`,disabled:!s,onClick:()=>d(-1),children:n(`Previous match`)}),(0,h.jsx)(`button`,{type:`button`,disabled:!s,onClick:()=>d(1),children:n(`Next match`)})]})}function vi({client:e,cursor:t,highlight:n,render:r,compact:i=!1}){let{t:a,tx:o}=C(),s=W(t),c=(0,f.useMemo)(()=>Y(JSON.parse(s)),[s]),[l,u]=(0,f.useState)(t),[d,p]=(0,f.useState)(),[m,g]=(0,f.useState)([]),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(),[x,S]=(0,f.useState)(i?`markdown`:`raw`),[w,T]=(0,f.useState)(``),E=(0,f.useRef)(null),D=(0,f.useRef)(null);(0,f.useEffect)(()=>(u(c),g([]),p(void 0),b(void 0),()=>E.current?.abort()),[c]),(0,f.useEffect)(()=>{let t=!0,n=new AbortController;return v(!0),b(void 0),e.detail(l,n.signal).then(e=>{t&&(v(!1),e.kind===`error`?b(e.error.code):p(e.value))}).catch(()=>{t&&(b(`Read unavailable.`),v(!1))}),()=>{t=!1,n.abort()}},[e,l]);let O=async()=>{if(E.current)return;let n=new AbortController;E.current=n,T(a(`Reading all retained field pages…`));try{let r=await li(e,t,n.signal);if(n.signal.aborted)return;let i=await Wr(r.text);if(n.signal.aborted)return;T(i?r.recordingComplete?a(`Copied all retained field bytes (source omissions still apply).`):a(`Copied retained field bytes; recording is incomplete. No complete-source claim.`):a(`Clipboard unavailable.`))}catch{n.signal.aborted||T(a(`Full-field copy refused/incomplete.`))}finally{E.current===n&&(E.current=null)}},k=d&&!(`kind`in d)?d:void 0;return(0,h.jsxs)(`section`,{className:`detail-pane${i?` message-field`:``}`,"aria-label":a(`Retained field`),children:[(0,h.jsxs)(`details`,{className:`field-details`,open:!i||void 0,children:[(0,h.jsx)(`summary`,{children:a(`Field details`)}),(0,h.jsxs)(`div`,{className:`detail-identity`,children:[(0,h.jsx)(`code`,{children:t.recordId}),` v`,t.recordVersion,` /`,` `,t.field&&o(t.field),` /`,` `,a(`snapshot {seq}`,{seq:t.snapshotSeq})]}),n&&(0,h.jsx)(`p`,{children:a(`Exact hit bytes [{start}, {end}); only this immutable field is highlighted.`,{start:n.start,end:n.end})}),(0,h.jsxs)(`div`,{className:`toolbar`,children:[(0,h.jsx)(`button`,{type:`button`,onClick:()=>S(e=>e===`raw`?`markdown`:`raw`),children:a(x===`raw`?`Markdown page`:`Raw page`)}),(0,h.jsx)(`button`,{type:`button`,disabled:!!E.current,onClick:()=>void O(),children:a(`Copy full retained field`)}),!!E.current&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>{E.current?.abort(),E.current=null,T(a(`Copy canceled; execution unchanged.`))},children:a(`Cancel copy`)})]})]}),w&&(0,h.jsx)(`p`,{role:`status`,children:w}),y&&(0,h.jsx)(`p`,{role:`alert`,children:a(`Detail refused: {error}`,{error:o(y)})}),_&&(0,h.jsx)(`p`,{role:`status`,children:a(`Reading…`)}),d&&(0,h.jsx)(di,{value:d.coverage,compact:i}),d&&`kind`in d&&(0,h.jsx)(`p`,{children:a(`Validation in progress. The retained field is not empty.`)}),k&&(0,h.jsxs)(h.Fragment,{children:[(!i||k.next)&&(0,h.jsxs)(`p`,{children:[a(`Bytes {start}–{end} of {total}.`,{start:k.range?.start??0,end:k.range?.end??0,total:k.content.bytes}),` `,k.next?a(`More retained data available.`):a(`End of field.`)]}),!i&&(0,h.jsx)(_i,{container:D,version:`${k.content.recordId}:${k.content.version}:${k.range?.start??0}:${x}`}),(0,h.jsx)(`div`,{ref:D,"data-retained-field":!0,children:r?r(k.text):x===`markdown`?(0,h.jsx)(Qr,{text:k.text}):(0,h.jsx)(`pre`,{className:`detail-text`,children:(()=>{if(!k||!n||!k.range)return k?.text;let e=Math.max(n.start,k.range.start)-k.range.start,t=Math.min(n.end,k.range.end)-k.range.start;if(t<=e)return k.text;let r=new TextEncoder().encode(k.text),i=(e,t)=>new TextDecoder(`utf-8`,{fatal:!0}).decode(r.subarray(e,t));return(0,h.jsxs)(h.Fragment,{children:[i(0,e),(0,h.jsx)(`mark`,{children:i(e,t)}),i(t,r.length)]})})()})})]}),(!i||m.length>0||d?.next)&&(0,h.jsxs)(`div`,{className:`toolbar`,children:[(0,h.jsx)(`button`,{type:`button`,disabled:_||!m.length,onClick:()=>{u(m[m.length-1]),g(e=>e.slice(0,-1))},children:a(`Previous`)}),(0,h.jsx)(`button`,{type:`button`,disabled:_||!d?.next,onClick:()=>{d?.next&&(g(e=>[...e,l]),u(d.next))},children:d&&`kind`in d?a(`Continue validation`):a(`Next field page`)})]})]})}function yi({pager:e,compact:t=!1}){let{t:n,tx:r}=C(),{page:i,busy:a,error:o}=e;return(0,h.jsxs)(`div`,{className:`page-controls${t?` compact`:``}`,children:[o&&(0,h.jsx)(`p`,{role:`alert`,children:n(`Read refused: {error}. Retained state has not been repaired.`,{error:r(o)})}),a&&(0,h.jsx)(`p`,{role:`status`,children:n(`Reading bounded history page…`)}),i&&`kind`in i&&(0,h.jsxs)(`p`,{role:`status`,children:[i.kind===`snapshot`?n(`Snapshot selected`):n(`Validating retained history`),n(`; continue this exact read. No data page yet.`)]}),i&&(0,h.jsx)(di,{value:i.coverage,compact:t}),(!t||e.canPrevious)&&(0,h.jsx)(`button`,{type:`button`,disabled:a||!e.canPrevious,onClick:e.previous,children:n(`Previous page`)}),(!t||i?.next)&&(0,h.jsx)(`button`,{type:`button`,disabled:a||!i?.next,onClick:e.more,children:i&&`kind`in i?n(`Continue validation`):n(`Next page`)}),(0,h.jsx)(`button`,{type:`button`,disabled:a,onClick:e.refresh,"aria-label":n(`Observe a new snapshot`),title:n(`Observe a new snapshot`),children:t?(0,h.jsx)(qn,{"aria-hidden":`true`}):n(`Observe a new snapshot`)}),!t&&i&&!(`kind`in i)&&!i.next&&(0,h.jsx)(`span`,{className:`page-end`,children:i.coverage.observed===`incomplete`?n(`End of this retained snapshot (incomplete).`):n(`End of this retained snapshot.`)})]})}function bi({client:e,seed:t,entityId:n}){let{t:r,tx:i}=C(),a=ui(e,{...t,reader:`contents`}),[o,s]=(0,f.useState)(),c=a.page;return(0,h.jsxs)(`section`,{"aria-label":r(`Retained content fields`),children:[(0,h.jsx)(yi,{pager:a}),n&&(0,h.jsx)(`p`,{children:(0,h.jsx)(y,{text:r(`Showing matches for entity {entity} on this page only. Continue paging for other fields/versions.`),slots:{entity:(0,h.jsx)(`code`,{children:n})}})}),c&&!(`kind`in c)&&c.records.map(e=>e.kind!==`content`&&e.kind!==`omitted`||n&&e.owner.entity.id!==n?null:e.kind===`omitted`?(0,h.jsxs)(`p`,{className:`omission`,children:[r(`Omitted source block:`),` `,(0,h.jsx)(`code`,{children:JSON.stringify(e.block)})]},`${e.owner.entity.id}:${e.version}:${JSON.stringify(e.block.owner)}`):(0,h.jsxs)(`article`,{children:[(0,h.jsxs)(`p`,{children:[i(e.owner.entity.kind),` `,(0,h.jsx)(`code`,{children:e.owner.entity.id}),` ·`,` `,i(e.content.field),` ·`,` `,r(`{bytes} retained bytes`,{bytes:e.content.bytes})]}),(0,h.jsx)(`pre`,{children:JSON.stringify(e.descriptor.owner)}),(0,h.jsx)(di,{value:e.coverage}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{c.request.scope.kind!==`workspace`&&c.request.snapshotSeq!==null&&s(ci(c.request.storeId,c.request.scope,c.request.snapshotSeq,e.content))},children:r(`Inspect complete retained field`)})]},`${e.content.recordId}:${e.content.version}`)),o&&(0,h.jsx)(vi,{client:e,cursor:o},`${o.recordId}:${o.recordVersion}`)]})}function xi({client:e,seed:t}){return(0,h.jsx)(Si,{client:e,seed:t},W(t))}function Si({client:e,seed:t}){let{t:n,tx:r}=C(),[i,a]=(0,f.useState)(t),[o,s]=(0,f.useState)(),[c,l]=(0,f.useState)(),[u,d]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let t=!0,n=new AbortController;return d(!0),(i.kind===`message`?e.message(i,n.signal):i.kind===`tool`?e.tool(i,n.signal):e.task(i,n.signal)).then(e=>{t&&(d(!1),e.kind===`error`?l(e.error.code):(s(e.value),l(void 0)))}).catch(()=>{t&&(l(`Read unavailable.`),d(!1))}),()=>{t=!1,n.abort()}},[e,i]),(0,h.jsxs)(`section`,{"aria-label":n(`Exact entity metadata`),children:[u&&(0,h.jsx)(`p`,{children:n(`Reading exact entity version…`)}),c&&(0,h.jsx)(`p`,{role:`alert`,children:n(`Entity refused: {error}`,{error:r(c)})}),o&&`kind`in o&&(0,h.jsx)(di,{value:o.coverage}),o&&(`kind`in o?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:n(`Entity validation in progress, not missing.`)}),(0,h.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>a(o.next),children:n(`Continue exact entity validation`)})]}):(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:n(`Exact stored owner and associations`)}),(0,h.jsx)(`pre`,{children:JSON.stringify(o.record,null,2)})]}))]})}function Ci(e=typeof window>`u`?``:window.location.search){let t=new URLSearchParams(e).get(`project`);return t&&/^[a-f0-9]{64}$/.test(t)?t:null}function wi(){let e=Ci();return e?`/projects/${e}`:``}function Ti(e){let t=Cn(`download`,It(e));if(t.method!==`GET`)throw Error(`Native download needs the named GET attachment route.`);let n=document.createElement(`a`);n.href=wi()+t.path,n.download=`cadence-${e.scope.kind}-${e.scope.id}.${e.format===`markdown`?`md`:`ndjson`}`,n.referrerPolicy=`no-referrer`,document.body.appendChild(n),n.click(),n.remove()}function Ei({request:e,onClose:t}){let{t:n,tx:r}=C(),[i]=(0,f.useState)(e),[a,o]=(0,f.useState)(e.format),[s,c]=(0,f.useState)(``);return(0,h.jsxs)(Lr,{title:n(`Export retained history`),onClose:t,children:[(0,h.jsx)(`p`,{children:n(`Selected {kind}: {id} · snapshot {seq}`,{kind:r(i.scope.kind),id:i.scope.id,seq:i.snapshotSeq})}),(0,h.jsxs)(`label`,{children:[n(`Format`),(0,h.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value===`markdown`?`markdown`:`ndjson`),children:[(0,h.jsx)(`option`,{value:`ndjson`,children:n(`NDJSON public archive`)}),(0,h.jsx)(`option`,{value:`markdown`,children:n(`Readable Markdown with footer metadata`)})]})]}),(0,h.jsx)(`p`,{children:n(`Includes retained context, messages/tools, graph, lifecycle, changes, checks, human review and coverage beyond loaded pages. Redactions and source omissions remain.`)}),(0,h.jsx)(`p`,{children:n(`A native browser download request cannot establish completion. Inspect the original EOF and completion trailer/counts/digest in the downloaded artifact; missing footer means incomplete. Revoked access may terminate without a trailer.`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{try{Ti({...i,format:a}),c(n(`Download requested — completion not verified by this browser UI.`))}catch{c(n(`Download unavailable; no archive claimed complete.`))}},children:n(`Request selected-scope download`)}),(0,h.jsx)(`p`,{role:`status`,children:s})]})}function Di(e,t){if(!t||N(t)>D.queryBytes)throw Error(`Query must be 1–${D.queryBytes} UTF-8 bytes; it was not clipped.`);let{navigation:n,...r}=e;return Y({...r,query:t,recordId:null,recordVersion:null,field:null,offset:0})}function Oi(e){return e.next?`No hits in this bounded window; search is not finished.`:`No hits in the final retained window. Coverage limits above still apply.`}function ki({client:e,seed:t,onClose:n,onHit:r}){let{t:i,tx:a}=C(),[o]=(0,f.useState)(t),s=(0,f.useRef)(null),c=(0,f.useRef)(0),[l,u]=(0,f.useState)(``),[d,p]=(0,f.useState)(0),[m,g]=(0,f.useState)(),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(),x=(0,f.useRef)(null),S=(0,f.useCallback)(async(t,n)=>{x.current?.abort();let r=new AbortController;x.current=r,v(!0),b(void 0);try{let i=await e.search(t,r.signal);if(c.current!==n||r.signal.aborted)return;i.kind===`error`?b(i.error.code):(g(i.value),p(0))}catch{c.current===n&&!r.signal.aborted&&b(`Search unavailable or invalid; no automatic retry.`)}finally{c.current===n&&!r.signal.aborted&&v(!1)}},[e]);return(0,f.useEffect)(()=>(s.current?.focus(),()=>{c.current++,x.current?.abort()}),[]),(0,f.useEffect)(()=>{let e=++c.current;if(x.current?.abort(),v(!1),g(void 0),p(0),b(void 0),!l)return;let t;try{t=Di(o,l)}catch{b(`Query must be 1–1024 UTF-8 bytes; it was not clipped.`);return}let n=setTimeout(()=>void S(t,e),300);return()=>{clearTimeout(n),c.current++,x.current?.abort()}},[l,o,S]),(0,h.jsx)(Lr,{title:i(`Search retained history`),onClose:n,children:(0,h.jsxs)(`div`,{className:`gs-modal`,children:[(0,h.jsxs)(`div`,{className:`gs-input-row`,children:[(0,h.jsx)(Kn,{}),(0,h.jsx)(`input`,{ref:s,"aria-label":i(`Case-sensitive literal query`),value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),p(e=>Math.max(0,Math.min(e+1,(m?.hits.length??0)-1)))),e.key===`ArrowUp`&&(e.preventDefault(),p(e=>Math.max(e-1,0))),e.key===`Enter`&&m?.hits[d]&&(e.preventDefault(),r(m.hits[d]),n())}})]}),(0,h.jsx)(`p`,{children:i(`Case-sensitive literal UTF-8 search. Scope {kind} {id}; snapshot {seq}. No regex, provider request or history repair.`,{kind:a(o.scope.kind),id:o.scope.id,seq:o.snapshotSeq})}),(0,h.jsxs)(`div`,{className:`gs-results`,children:[_&&(0,h.jsx)(`p`,{role:`status`,children:i(`Searching bounded retained range…`)}),y&&(0,h.jsx)(`p`,{role:`alert`,children:i(`Search refused: {error}`,{error:a(y)})}),!l&&(0,h.jsx)(`p`,{children:i(`Enter a query to search this selected scope.`)}),m&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(di,{value:m.coverage}),(0,h.jsxs)(`div`,{className:`gs-section`,children:[(0,h.jsx)(`div`,{className:`gs-section-head`,children:i(`Matches on this page: {count}`,{count:m.hits.length})}),m.hits.map((e,t)=>(0,h.jsxs)(`button`,{type:`button`,className:`gs-item ${d===t?`active`:``}`,onMouseEnter:()=>p(t),onClick:()=>{r(e),n()},children:[(0,h.jsxs)(`span`,{className:`gs-item-title`,children:[a(e.owner.entity.kind),` · `,a(e.content.field),` · v`,e.content.version]}),(0,h.jsx)(`span`,{className:`gs-item-sub`,children:e.preview}),(0,h.jsxs)(`code`,{children:[e.owner.childRunId??e.owner.runId??e.owner.taskId,` `,`/ `,e.content.recordId,` /`,` `,i(`bytes {start}–{end}`,{start:e.range.start,end:e.range.end})]})]},`${e.content.recordId}:${e.content.version}:${e.range.start}`)),m.hits.length===0&&(0,h.jsx)(`p`,{children:a(Oi(m))})]}),(0,h.jsx)(`button`,{type:`button`,disabled:_||!m.next,onClick:()=>{m.next&&S(m.next,++c.current)},children:i(`Continue same snapshot search`)})]})]}),(0,h.jsx)(`footer`,{className:`gs-foot`,children:i(`↑↓ Navigate · Enter Open exact hit · Escape Close. Reopening never resumes execution.`)})]})})}function Ai({run:e,historical:t=!1}){let{t:n,tx:r}=C();return(0,h.jsxs)(`article`,{className:`run-summary`,children:[(0,h.jsxs)(`h3`,{children:[e.assignmentId??e.admission.kind,` ·`,` `,n(t?`historical projection`:`owner projection`)]}),(0,h.jsx)(`p`,{children:(0,h.jsx)(`code`,{children:e.childRunId??e.runId})}),(0,h.jsxs)(`dl`,{children:[(0,h.jsx)(`dt`,{children:n(`Lifecycle`)}),(0,h.jsx)(`dd`,{children:r(e.lifecycle)}),(0,h.jsx)(`dt`,{children:n(`Execution`)}),(0,h.jsx)(`dd`,{children:e.outcome?r(e.outcome):n(`unsettled`)}),(0,h.jsx)(`dt`,{children:n(`Wait/block reason`)}),(0,h.jsx)(`dd`,{children:e.reason?r(e.reason):n(`none reported`)}),(0,h.jsx)(`dt`,{children:n(`Summary publication`)}),(0,h.jsx)(`dd`,{children:r(e.publication)})]}),(0,h.jsx)(di,{value:e.coverage}),(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:n(`Native / recording / parent settlement facts (independent of human review)`)}),(0,h.jsx)(`pre`,{children:e.settlement?JSON.stringify(e.settlement,null,2):n(`No settlement recorded`)})]})]})}function ji({client:e,seed:t}){return(0,h.jsx)(Mi,{client:e,seed:t},W(t))}function Mi({client:e,seed:t}){let{t:n,tx:r}=C(),[i,a]=(0,f.useState)(t),[o,s]=(0,f.useState)(),[c,l]=(0,f.useState)(),[u,d]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let t=!0,n=new AbortController;return d(!0),e.graph(i,n.signal).then(e=>{t&&(d(!1),e.kind===`error`?l(e.error.code):(s(e.value),l(void 0)))}).catch(()=>{t&&(l(`Read unavailable.`),d(!1))}),()=>{t=!1,n.abort()}},[e,i]),(0,h.jsxs)(`section`,{children:[(0,h.jsx)(`h3`,{children:n(`Immutable admitted graph`)}),c&&(0,h.jsx)(`p`,{role:`alert`,children:n(`Graph refused: {error}`,{error:r(c)})}),u&&(0,h.jsx)(`p`,{children:n(`Reading graph…`)}),o&&`kind`in o&&(0,h.jsx)(di,{value:o.coverage}),o&&(`kind`in o?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:n(`Graph validation in progress; not an empty graph.`)}),(0,h.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>a(o.next),children:n(`Continue graph validation`)})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(vi,{client:e,cursor:ci(o.request.storeId,o.request.scope,o.request.snapshotSeq,o.graph.plan)}),o.graph.assignments.map(e=>(0,h.jsxs)(`article`,{children:[(0,h.jsxs)(`h4`,{children:[e.id,` / `,e.purpose]}),(0,h.jsx)(Qr,{text:e.instructions}),(0,h.jsx)(`p`,{children:n(`Expected: {output}`,{output:e.expectedOutput})}),(0,h.jsx)(`pre`,{children:JSON.stringify({model:e.model,role:e.role,dependencies:e.dependencies},null,2)})]},e.id))]}))]})}function Ni({client:e,seed:t,onScope:n}){let{t:r}=C(),i=ui(e,{...t,reader:`runs`}),a=i.page,[o,s]=(0,f.useState)();return(0,h.jsxs)(`section`,{children:[(0,h.jsx)(yi,{pager:i}),a&&!(`kind`in a)&&a.records.map(e=>e.kind===`run`?(0,h.jsxs)(`article`,{children:[(0,h.jsx)(Ai,{run:e.projection,historical:!0}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>n({kind:e.projection.childRunId?`child`:`run`,id:e.projection.childRunId??e.projection.runId}),children:r(`Open retained episode/child details`)}),e.projection.admission.graph&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>{a.request.scope.kind!==`workspace`&&a.request.snapshotSeq!==null&&e.projection.admission.graph&&s({storeId:a.request.storeId,scope:a.request.scope,snapshotSeq:a.request.snapshotSeq,graph:e.projection.admission.graph})},children:r(`Inspect admitted graph and plan`)})]},e.projection.childRunId??e.projection.runId):null),o&&(0,h.jsx)(ji,{client:e,seed:o},o.graph.recordId)]})}function Pi({onOpen:e,disabled:t}){let{t:n}=C();return(0,h.jsx)(`button`,{type:`button`,className:`chip search-toggle`,"aria-label":n(`Search all retained pages in selected scope`),"data-tip":n(`Search all retained pages in selected scope`),disabled:t,onClick:e,children:(0,h.jsx)(Kn,{"aria-hidden":`true`})})}function Fi(e,t,n,r,i){let a=i??t,o=[],s=[],c=0;for(let i of e)n.has(i.id)||(r.has(i.id)?i.top<t.bottom&&i.bottom>t.top&&o.push(i.id):i.top<a.bottom&&i.bottom>a.top||(s.push(i.id),i.bottom<=a.top&&(c+=i.bottom-i.top)));return{show:o,hide:s,shrinkAbove:c}}function Ii(e,t){if(t.show.length===0&&t.hide.length===0)return e;let n=new Set(e);for(let e of t.show)n.delete(e);for(let e of t.hide)n.add(e);return n}function Li(e,t,n){let r=new Set,i=0;for(let a=e.length-1;a>=0&&!(a<e.length-1&&i>=n);a--){let n=e[a];r.add(n.id),i+=t.get(n.id)??Ri(n.role,n.customType)}return r}function Ri(e,t){switch(e){case`user`:return 72;case`assistant`:return 280;case`tool-result`:return 120;case`custom`:return t===`file`?96:72;default:return 60}}function zi(e,t,n,r){let i=n.get(e);return i&&i.len===t?i.h:r}var Bi=(0,f.memo)(function({id:e,show:t,height:n,containerRef:r,onMeasured:i,lazyRef:a,children:o}){let s=(0,f.useRef)(null);return(0,f.useLayoutEffect)(()=>{if(!t)return;let n=s.current;if(!n)return;let r=n.offsetHeight;r>0&&i?.(e,r)},[t,e,i]),t?(0,h.jsx)(`div`,{ref:a,"data-lazy-id":e,children:(0,h.jsx)(`div`,{ref:s,children:o})}):(0,h.jsx)(`div`,{ref:a,className:`msg-lazy-ph`,"data-msg-id":e,"data-lazy-id":e,style:{height:n},"aria-hidden":`true`})}),Vi=(0,f.memo)(function({message:e,client:t,seed:n}){let{t:r,tx:i}=C(),[a,o]=(0,f.useState)(!1);return(0,h.jsxs)(`article`,{className:`msg msg-${e.role}`,"data-msg-id":e.owner.entity.id,children:[(0,h.jsxs)(`header`,{className:`msg-meta`,children:[(0,h.jsx)(`strong`,{className:`msg-role`,children:i(e.role)}),e.state!==`final`&&(0,h.jsx)(`span`,{className:`msg-state`,children:i(e.state)}),(0,h.jsxs)(`button`,{type:`button`,className:`msg-inspect`,"aria-expanded":a,onClick:()=>o(e=>!e),children:[a?(0,h.jsx)(pr,{"aria-hidden":`true`}):(0,h.jsx)(sr,{"aria-hidden":`true`}),r(a?`Collapse`:`Inspect message`)]})]}),(0,h.jsxs)(`div`,{className:`msg-body`,children:[e.role===`tool-result`&&(0,h.jsx)(`p`,{className:`msg-note`,children:r(`Result call: {call}. Kept visible independently of the tool card.`,{call:e.resultCallId??r(`unassociated / orphan`)})}),(0,h.jsx)(`div`,{className:`msg-text`,children:(0,h.jsxs)(`div`,{className:`msg-text-main`,children:[e.finalText&&n.scope.kind!==`workspace`&&n.snapshotSeq!==null?(0,h.jsx)(vi,{compact:!0,client:t,cursor:ci(n.storeId,n.scope,n.snapshotSeq,e.finalText)}):(0,h.jsx)(`p`,{children:r(`No finalized text field in this snapshot. Inspect retained partial/final blocks and omission metadata below.`)}),a&&(0,h.jsxs)(`div`,{className:`message-inspection`,children:[(0,h.jsx)(`p`,{className:`msg-ident`,children:r(`Child {child} · message {message} · version {version}`,{child:e.owner.childRunId??``,message:e.owner.entity.id,version:e.version})}),(0,h.jsx)(`p`,{className:`msg-note`,children:r(`{state} message record, not execution outcome`,{state:i(e.state)})}),(0,h.jsxs)(`details`,{open:!0,children:[(0,h.jsx)(`summary`,{children:r(`All message blocks, source limits and tool associations`)}),(0,h.jsx)(bi,{client:t,seed:n,entityId:e.owner.entity.id})]})]})]})})]})]})});function Hi({messages:e,client:t,seed:n}){let{t:r}=C(),i=(0,f.useRef)(null),a=(0,f.useRef)(!0),[o,s]=(0,f.useState)(()=>new Set),c=(0,f.useRef)(o);c.current=o;let l=(0,f.useRef)(new Map),u=(0,f.useRef)(new Map),d=(0,f.useRef)(new Map),p=(0,f.useRef)(0),m=(0,f.useMemo)(()=>e.map(e=>({id:e.owner.entity.id,role:e.role,message:e})),[e]),g=(0,f.useRef)(new Map);g.current=new Map(m.map(e=>[e.id,e.message.version]));let _=(0,f.useRef)(new Set);_.current=Li(m,l.current,1800);let v=(0,f.useCallback)((e,t)=>{let n=g.current.get(e);n!==void 0&&(u.current.set(e,{h:t,len:n}),l.current.set(e,t))},[]),y=(0,f.useCallback)(()=>{let e=i.current;if(!e)return;let t=e.getBoundingClientRect(),n=[];for(let[e,t]of d.current){let r=t.getBoundingClientRect();n.push({id:e,top:r.top,bottom:r.bottom}),c.current.has(e)||v(e,r.height)}let r=Fi(n,{top:t.top-1200,bottom:t.bottom+1200},_.current,c.current,{top:t.top-2400,bottom:t.bottom+2400});for(let e of r.hide){let t=d.current.get(e);t&&v(e,t.offsetHeight)}s(e=>Ii(e,r))},[v]),b=(0,f.useCallback)(()=>{p.current||=requestAnimationFrame(()=>{p.current=0,y()})},[y]);return(0,f.useLayoutEffect)(()=>{m.length?y():s(new Set)},[y,m]),(0,f.useEffect)(()=>{let e=new ResizeObserver(b);return i.current&&e.observe(i.current),()=>{e.disconnect(),cancelAnimationFrame(p.current)}},[b]),(0,h.jsxs)(`div`,{className:`messages-wrap`,children:[(0,h.jsx)(`div`,{className:`messages`,ref:i,onScroll:e=>{let t=e.currentTarget;a.current=t.scrollHeight-t.scrollTop-t.clientHeight<80,b()},children:m.map(({id:e,role:r,message:a})=>(0,h.jsx)(Bi,{id:e,show:!o.has(e),height:zi(e,a.version,u.current,r===`user`?100:280),containerRef:i,onMeasured:v,lazyRef:t=>{t?d.current.set(e,t):d.current.delete(e)},children:(0,h.jsx)(Vi,{message:a,client:t,seed:n})},e))}),(0,h.jsxs)(`button`,{type:`button`,className:`scroll-bottom`,onClick:()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight,a.current=!0)},children:[(0,h.jsx)(br,{"aria-hidden":`true`}),r(`Latest on loaded page`)]})]})}function Ui({client:e,seed:t}){let{t:n}=C(),r=ui(e,{...t,reader:`messages`}),i=r.page;return(0,h.jsxs)(`section`,{className:`transcript`,children:[(0,h.jsx)(yi,{pager:r,compact:!0}),i&&!(`kind`in i)&&t.snapshotSeq!==null&&i.request.snapshotSeq!==t.snapshotSeq&&(0,h.jsx)(`button`,{type:`button`,className:`conversation-update`,disabled:r.busy,onClick:r.refresh,children:n(`New activity — update conversation`)}),i&&!(`kind`in i)&&(0,h.jsxs)(h.Fragment,{children:[i.records.length===0&&(0,h.jsx)(`p`,{className:`empty-note panel-empty`,children:i.next?n(`No message records on this page; more history remains.`):n(`No message records on this page.`)}),(0,h.jsx)(Hi,{messages:i.records.filter(e=>e.kind===`message`),client:e,seed:i.request},`${i.request.snapshotSeq}:${i.request.after?.recordId??`first`}`)]})]})}function Wi({open:e,onToggle:t,headClassName:n,titleText:r,icon:i,iconClassName:a,titleClassName:o,toggleClassName:s,toggle:c,onHeadContextMenu:l,children:u,after:d}){return(0,h.jsxs)(`div`,{className:`chead ${n}`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`chead-main`,"aria-expanded":e,title:r,onClick:t,onContextMenu:l,children:[c===void 0?(0,h.jsx)(`span`,{className:s?`chead-toggle ${s}`:`chead-toggle`,children:e?(0,h.jsx)(hr,{}):(0,h.jsx)(mr,{})}):c,(0,h.jsx)(`span`,{className:a?`chead-icon ${a}`:`chead-icon`,children:i}),(0,h.jsx)(`span`,{className:o?`chead-title ${o}`:`chead-title`,children:u})]}),d]})}var Gi=(0,f.memo)(function({record:e,client:t,seed:n}){let{t:r,tx:i}=C(),[a,o]=(0,f.useState)(!1),s=e.result?e.result.isError?r(`SDK tool error observed`):r(`SDK tool end observed`):e.startObserved?r(`Start observed; end not observed in this snapshot`):r(`No start observed`),c=e.result?e.result.isError?`err`:`ok`:e.startObserved?`pending`:``;return(0,h.jsxs)(`div`,{className:`toolcall${c===`err`?` err`:``}`,children:[(0,h.jsx)(Wi,{open:a,onToggle:()=>o(e=>!e),headClassName:`toolcall-head`,titleText:r(`Inspect recorded tool call`),icon:(0,h.jsx)(Un,{}),iconClassName:`toolcall-icon`,titleClassName:`toolcall-name`,after:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`span`,{className:`toolcall-path`,children:r(`Child {child} · call {call} · v{version}`,{child:e.owner.childRunId??``,call:e.owner.entity.id,version:e.version})}),(0,h.jsx)(`span`,{className:`toolcall-badge ${c}`,children:s})]}),children:e.name}),a&&(0,h.jsxs)(`div`,{className:`toolcall-body`,children:[(0,h.jsx)(`p`,{children:r(`SDK tool observations are not native process launch/close or passing parent checks.`)}),(0,h.jsxs)(`dl`,{children:[(0,h.jsx)(`dt`,{children:r(`Source ID`)}),(0,h.jsxs)(`dd`,{children:[i(e.source.disposition),`:`,` `,e.source.value??r(`unavailable`)]}),(0,h.jsx)(`dt`,{children:r(`Declaration`)}),(0,h.jsx)(`dd`,{children:e.declaration?`${e.declaration.messageId} / ${e.declaration.blockId} (${i(String(e.declarationStage))})`:r(`No declaration recorded; orphan result remains accessible`)})]}),(0,h.jsxs)(`div`,{className:`toolcall-output`,children:[(0,h.jsx)(`div`,{className:`toolcall-output-label`,children:r(`Recorded tool end (not parsed from output)`)}),(0,h.jsx)(`pre`,{children:e.result?JSON.stringify(e.result,null,2):r(`No end fact in this snapshot.`)})]}),(0,h.jsx)(`div`,{className:`toolcall-args`,children:(0,h.jsx)(bi,{client:t,seed:n,entityId:e.owner.entity.id})})]})]})});function Ki({client:e,active:t,taskId:n,runs:r,snapshot:i,onOpen:a}){let{t:o,tx:s}=C(),[c,l]=(0,f.useState)(!0),[u,d]=(0,f.useState)([]),[p,m]=(0,f.useState)(!1),g=JSON.stringify(t?.status===`complete`?[...new Set(t.runs.map(e=>e.taskId))]:[]);(0,f.useEffect)(()=>{let t=new AbortController,n,r=async()=>{let i=[],a=!1;for(let n of JSON.parse(g)){let r=await e.snapshot({kind:`task`,id:n},t.signal);if(t.signal.aborted)return;if(r.kind===`ok`)for(let e of r.value.runs)e.childRunId&&i.push({taskId:n,run:e,snapshot:r.value.committedSeq});else a=!0}t.signal.aborted||(d(i),m(a),n=setTimeout(()=>void r(),3e3))};return r(),()=>{t.abort(),clearTimeout(n)}},[e,g]);let _=n&&i?r.filter(e=>e.childRunId).map(e=>({taskId:n,run:e,snapshot:i})):[],v=[...u,..._.filter(e=>!u.some(t=>t.run.childRunId===e.run.childRunId))].sort((e,t)=>Number(e.run.lifecycle===`settled`)-Number(t.run.lifecycle===`settled`));return(0,h.jsxs)(`section`,{className:`agent-dock${c?``:` collapsed`}`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`agent-dock-heading`,"aria-expanded":c,onClick:()=>l(e=>!e),children:[(0,h.jsx)(hr,{}),(0,h.jsx)(ur,{}),(0,h.jsx)(`span`,{children:o(`Subagents`)}),(0,h.jsx)(`span`,{className:`lp-count`,children:v.length})]}),c&&(0,h.jsxs)(`div`,{className:`agent-dock-body`,children:[(p||t?.status!==`complete`)&&(0,h.jsx)(`p`,{className:`panel-hint`,children:o(`Subagent roster unavailable`)}),v.length===0&&!p&&t?.status===`complete`&&(0,h.jsx)(`p`,{className:`panel-hint`,children:o(`Cadence subagents appear here when a task runs.`)}),v.map(e=>(0,h.jsxs)(`button`,{type:`button`,className:`agent-dock-row`,onClick:()=>a(e.taskId,e.run.childRunId,e.snapshot,e.run.assignmentId??o(`Subagent`)),children:[(0,h.jsx)(`span`,{className:`agent-dot ${e.run.outcome??e.run.lifecycle}`}),(0,h.jsxs)(`span`,{className:`agent-dock-label`,children:[(0,h.jsx)(`strong`,{children:e.run.assignmentId??o(`Subagent`)}),(0,h.jsx)(`small`,{children:o(`Task {id}`,{id:e.taskId.slice(0,8)})})]}),(0,h.jsx)(`span`,{className:`ep-state ${e.run.outcome??e.run.lifecycle}`,children:s(e.run.outcome??e.run.lifecycle)})]},e.run.childRunId))]})]})}var qi=/^\s{0,3}(`{3,}|~{3,})/,Ji=/^\s{0,3}(?:[-*+]|\d{1,9}[.)])\s/;function Yi(e){return e.trim()===``}function Xi(e){let t=qi.exec(e);return t?t[1]:null}function Zi(e){let t=e.split(`
5
5
  `),n=[],r=[],i=null;for(let e=0;e<t.length;e++){let a=t[e];if(i!==null){let e=Xi(a);e&&e[0]===i[0]&&e.length>=i.length&&(i=null),r.push(a);continue}let o=Xi(a);if(o&&!Yi(a))i=o,r.push(a);else if(Yi(a)){let i=e;for(;i<t.length&&Yi(t[i]);)i++;if(!(i<t.length&&Ji.test(t[i]))&&r.length>0){n.push(r.join(`
6
6
  `)),r=[];continue}r.push(a)}else r.push(a)}return{frozen:n,active:r.join(`
7
- `),inFence:i!==null}}function Qi(e,t,n=!1){let r=e.length;if(t>=r)return r;t<0&&(t=0);let i=r-t,a;a=n?i<=16?Math.max(2,Math.ceil(i/6)):Math.ceil(i/8):i<=32?1:i<=90?2:Math.ceil(i<=240?i/28:i/18);let o=Math.min(r,t+a);if(o<r){let t=e.charCodeAt(o-1);t>=55296&&t<=56319&&(o=Math.min(r,o+1))}return o}var $i=(0,f.memo)(function({text:e}){return(0,h.jsx)(Zr,{text:e})}),ea=22,ta=14,na=()=>typeof document<`u`&&document.hidden;function ra(e,t=!0,n=!1,r){let[i,a]=(0,f.useState)(()=>!t||na()||e.length>1500?e.length:0),o=(0,f.useRef)(e);o.current=e;let s=(0,f.useRef)(i);s.current=i;let c=(0,f.useRef)(n);c.current=n;let l=(0,f.useRef)(r);return l.current=r,(0,f.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{document.hidden,s.current=o.current.length,a(o.current.length),(c.current||!t)&&l.current?.()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[t]),(0,f.useEffect)(()=>{if(!t){s.current!==e.length&&(s.current=e.length,a(e.length));return}if(na()){s.current!==e.length&&(s.current=e.length,a(e.length)),(n||s.current>=e.length)&&l.current?.();return}if(e.length<s.current){s.current=e.length,a(e.length);return}if(s.current>=e.length){l.current?.();return}let r=0,i=0,u=e=>{let t=c.current?ta:ea;if(i>0&&e-i<t){r=requestAnimationFrame(u);return}i=e;let n=o.current,d=Qi(n,s.current,c.current);d!==s.current&&(s.current=d,a(d)),d<n.length?r=requestAnimationFrame(u):l.current?.()};return r=requestAnimationFrame(u),()=>cancelAnimationFrame(r)},[e,t,n]),!t||i>=e.length?e:e.slice(0,i)}var ia=600,aa=32;function oa({text:e,inFence:t}){let n=!t&&e.length>=ia,[r,i]=(0,f.useState)(e),a=(0,f.useRef)(0),o=(0,f.useRef)(null);return(0,f.useEffect)(()=>{if(!n)return;let t=Date.now()-a.current,r=()=>{a.current=Date.now(),i(e)};if(t>=aa)r();else return o.current=setTimeout(r,aa-t),()=>{o.current&&clearTimeout(o.current)}},[e,n]),t?(0,h.jsx)(`div`,{className:`codeblock`,children:(0,h.jsx)(`pre`,{children:(0,h.jsx)(`code`,{children:e})})}):(0,h.jsx)(Zr,{text:n?r:e})}var sa=(0,f.memo)(function({text:e,finishing:t=!1,onSettled:n}){let r=ra(e,!0,t,n),{frozen:i,active:a,inFence:o}=(0,f.useMemo)(()=>Zi(r),[r]),s=0,c=i.map(e=>{let t=`stream-offset:${s}`;return s+=e.length,{key:t,text:e}});return(0,h.jsxs)(`div`,{className:`md`,children:[c.map(({text:e,key:t})=>(0,h.jsx)($i,{text:e},t)),a.length>0&&(0,h.jsx)(oa,{text:a,inFence:o},i.length)]})});function ca(e){try{return sessionStorage.getItem(e)??``}catch{return``}}function la({client:e,id:t,workspaceId:n,enabled:r,available:i=r,canInterrupt:a=r,onCadence:o,onModel:s,onChanged:c,reference:l,onReferenceUsed:u}){let{t:d,tx:p}=C(),m=`cadence:draft:${n}:${t}`,[g,_]=(0,f.useState)(()=>ca(m)),[v,y]=(0,f.useState)(()=>ca(`${m}:mode`)===`cadence`?`cadence`:`chat`),[b,x]=(0,f.useState)(null),[S,w]=(0,f.useState)(!1),[T,E]=(0,f.useState)(``),[D,ee]=(0,f.useState)(()=>ca(`${m}:pending`)),O=jr(e,i?{kind:`conversation`,id:t,before:b}:null,1e3),k=O.value?.kind===`conversation`?O.value:void 0,A=Mr(g,v),j=k?.summary,te=j&&(j.status===`queued`||j.status===`running`),M=!!j&&j.status!==`completed`&&!te,ne=(0,f.useRef)(null),re=(0,f.useRef)(null),N=(0,f.useRef)(!0),[ie,ae]=(0,f.useState)(!1),oe=(0,f.useRef)(!0),se=(0,f.useRef)(``),ce=(0,f.useRef)(g);(0,f.useEffect)(()=>(oe.current=!0,()=>{oe.current=!1}),[]),(0,f.useEffect)(()=>{try{sessionStorage.setItem(`${m}:mode`,v)}catch{}},[m,v]),(0,f.useEffect)(()=>{try{sessionStorage.setItem(m,g)}catch{}},[g,m]),(0,f.useEffect)(()=>{try{D?sessionStorage.setItem(`${m}:pending`,D):sessionStorage.removeItem(`${m}:pending`)}catch{}},[m,D]),(0,f.useEffect)(()=>{l&&(_(e=>`${e}${e?`
8
- `:``}@${l}`),u(),ne.current?.focus())},[l,u]),(0,f.useEffect)(()=>{let e=k?.summary?`${k.summary.head}:${k.summary.status}`:``;e&&se.current!==e&&(se.current=e,c()),D&&k?.turns.some(e=>e.id===D)&&(ee(``),_(e=>e===ce.current?``:e),c()),N.current&&re.current&&(re.current.scrollTop=re.current.scrollHeight)},[k,D,c]);let ue=async()=>{if(!(S||te||D||!r||!k||O.error||!A.text.trim())){if(A.mode===`cadence`)o(A.text.trim());else if(!(M||b!==null)){w(!0),E(``);try{let n=await e.models();if(!oe.current)return;if(n.kind!==`ok`||!n.value.selected){s();return}let r={kind:`send`,commandId:crypto.randomUUID(),conversationId:t,head:j?.head??null,text:A.text,model:n.value.version};ir(r),ce.current=g,ee(r.commandId);let i=await e.workbenchCommand(r);if(!oe.current)return;i.kind===`error`?E(`${i.error.code}. ${d(`Observe this send before sending again. No automatic retry.`)}`):(_(e=>e===ce.current?``:e),ee(``)),O.refresh(),c()}catch{oe.current&&E(d(`Send unavailable. Check the message limit (16 KiB); observe any pending command before sending again.`))}finally{oe.current&&w(!1)}}}},de=async()=>{let n=k?.turns.find(e=>e.id===j?.head);if(!n||S)return;w(!0);let r=await e.workbenchCommand({kind:`interrupt`,commandId:crypto.randomUUID(),conversationId:t,turnId:n.id,epoch:n.epoch});oe.current&&(r.kind===`error`&&E(r.error.code),w(!1),O.refresh())};return(0,h.jsxs)(`section`,{className:`chat-workspace`,"aria-label":d(`Ordinary conversation`),children:[(0,h.jsxs)(`header`,{className:`conversation-header`,children:[(0,h.jsxs)(`div`,{className:`conversation-heading`,children:[(0,h.jsx)(me,{"aria-hidden":`true`}),(0,h.jsx)(`h2`,{children:j?.title??d(`New conversation`)}),(0,h.jsx)(`span`,{className:`conversation-badge`,children:d(`Ordinary`)})]}),j&&(0,h.jsx)(`span`,{className:`ep-state ${j.status}`,children:p(j.status)})]}),(0,h.jsxs)(`div`,{className:`chat-messages`,ref:re,onScroll:()=>{let e=re.current;e&&(N.current=e.scrollHeight-e.scrollTop-e.clientHeight<80,ae(!N.current))},children:[!j&&(0,h.jsxs)(`div`,{className:`empty-state`,children:[(0,h.jsx)(`span`,{className:`empty-logo`,"aria-hidden":`true`,children:`C`}),(0,h.jsx)(`h2`,{children:d(`What would you like to work on?`)}),(0,h.jsx)(`p`,{children:d(`Chat normally, or start with /cadence to prepare a task. Nothing starts until you send.`)}),(0,h.jsx)(`button`,{type:`button`,className:`ghost`,disabled:!r,onClick:()=>o(``),children:d(`Create task`)})]}),k?.before&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>{N.current=!1,x(k.before)},children:d(`Earlier messages`)}),b&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>{N.current=!0,x(null)},children:d(`Latest messages`)}),k?.turns.map(e=>(0,h.jsx)(ua,{turn:e},e.id)),(T||O.error)&&(0,h.jsx)(`p`,{role:`alert`,className:`banner-notice`,children:T||O.error}),D&&(0,h.jsxs)(`p`,{className:`inspector-note`,children:[d(`Send outcome not yet observed:`),` `,(0,h.jsx)(`code`,{children:D}),` `,(0,h.jsx)(`button`,{type:`button`,onClick:O.refresh,children:d(`Observe current state`)})]}),M&&(0,h.jsx)(`p`,{className:`inspector-note`,children:d(`This turn has no complete continuation context. Start a new conversation; retained messages are preserved.`)})]}),ie&&(0,h.jsx)(`button`,{type:`button`,className:`chat-scroll-bottom`,"aria-label":d(`Latest messages`),onClick:()=>{re.current&&(re.current.scrollTop=re.current.scrollHeight),N.current=!0},children:(0,h.jsx)(ze,{})}),(0,h.jsxs)(`form`,{className:`chat-composer`,onSubmit:e=>{e.preventDefault(),ue()},children:[(0,h.jsx)(`textarea`,{ref:ne,disabled:!r||S||!!D,"aria-label":d(`Message`),value:g,placeholder:d(`Message, or /cadence followed by a task…`),rows:3,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),ue())}}),(0,h.jsxs)(`div`,{className:`composer-toolbar`,children:[(0,h.jsxs)(`select`,{"aria-label":d(`Conversation mode`),value:A.mode,onChange:e=>{let t=e.target.value===`cadence`?`cadence`:`chat`;y(t),t===`chat`&&Mr(g,`chat`).mode===`cadence`&&_(A.text)},children:[(0,h.jsx)(`option`,{value:`chat`,children:d(`Ordinary conversation`)}),(0,h.jsx)(`option`,{value:`cadence`,children:d(`Cadence task`)})]}),(0,h.jsxs)(`button`,{type:`button`,className:`ghost`,onClick:s,children:[(0,h.jsx)(ke,{}),d(`Model`)]}),(0,h.jsx)(`span`,{className:`composer-hint`,children:A.mode===`cadence`?d(`Prepare a plan first; Start requires confirmation.`):d(`Direct host tools · no Cadence task`)}),te?(0,h.jsxs)(`button`,{type:`button`,className:`danger`,disabled:S||!a,onClick:()=>void de(),children:[(0,h.jsx)(le,{}),d(`Stop response`)]}):(0,h.jsxs)(`button`,{type:`submit`,className:`primary`,disabled:!r||!k||!!O.error||S||!!D||!A.text.trim()||A.mode===`chat`&&(M||b!==null),children:[(0,h.jsx)(Re,{}),A.mode===`cadence`?d(`Prepare task`):d(`Send`)]})]})]})]})}function ua({turn:e}){let{t,tx:n}=C();return(0,h.jsxs)(`section`,{className:`chat-turn`,"aria-label":t(`Conversation turn`),children:[e.items.map(n=>n.role===`tool`?(0,h.jsxs)(`details`,{className:`chat-tool`,children:[(0,h.jsxs)(`summary`,{children:[(0,h.jsx)(`span`,{children:n.name||t(`Tool`)}),n.error&&(0,h.jsx)(`span`,{className:`ep-state failed`,children:t(`failed`)})]}),n.args&&(0,h.jsx)(`pre`,{children:n.args}),n.text&&(0,h.jsx)(`pre`,{children:n.text})]},n.id):(0,h.jsxs)(`article`,{className:`chat-message ${n.role}`,children:[(0,h.jsx)(`div`,{className:`chat-message-role`,children:n.role===`user`?t(`You`):`Cadence`}),n.role===`assistant`&&e.status===`running`?(0,h.jsx)(sa,{text:n.text}):(0,h.jsx)(Qr,{text:n.text})]},n.id)),e.notice&&(0,h.jsx)(`p`,{className:`inspector-note`,children:e.notice.split(`
7
+ `),inFence:i!==null}}function Qi(e,t,n=!1){let r=e.length;if(t>=r)return r;t<0&&(t=0);let i=r-t,a;a=n?i<=16?Math.max(2,Math.ceil(i/6)):Math.ceil(i/8):i<=32?1:i<=90?2:Math.ceil(i<=240?i/28:i/18);let o=Math.min(r,t+a);if(o<r){let t=e.charCodeAt(o-1);t>=55296&&t<=56319&&(o=Math.min(r,o+1))}return o}var $i=(0,f.memo)(function({text:e}){return(0,h.jsx)(Zr,{text:e})}),ea=22,ta=14,na=()=>typeof document<`u`&&document.hidden;function ra(e,t=!0,n=!1,r){let[i,a]=(0,f.useState)(()=>!t||na()||e.length>1500?e.length:0),o=(0,f.useRef)(e);o.current=e;let s=(0,f.useRef)(i);s.current=i;let c=(0,f.useRef)(n);c.current=n;let l=(0,f.useRef)(r);return l.current=r,(0,f.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{document.hidden,s.current=o.current.length,a(o.current.length),(c.current||!t)&&l.current?.()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[t]),(0,f.useEffect)(()=>{if(!t){s.current!==e.length&&(s.current=e.length,a(e.length));return}if(na()){s.current!==e.length&&(s.current=e.length,a(e.length)),(n||s.current>=e.length)&&l.current?.();return}if(e.length<s.current){s.current=e.length,a(e.length);return}if(s.current>=e.length){l.current?.();return}let r=0,i=0,u=e=>{let t=c.current?ta:ea;if(i>0&&e-i<t){r=requestAnimationFrame(u);return}i=e;let n=o.current,d=Qi(n,s.current,c.current);d!==s.current&&(s.current=d,a(d)),d<n.length?r=requestAnimationFrame(u):l.current?.()};return r=requestAnimationFrame(u),()=>cancelAnimationFrame(r)},[e,t,n]),!t||i>=e.length?e:e.slice(0,i)}var ia=600,aa=32;function oa({text:e,inFence:t}){let n=!t&&e.length>=ia,[r,i]=(0,f.useState)(e),a=(0,f.useRef)(0),o=(0,f.useRef)(null);return(0,f.useEffect)(()=>{if(!n)return;let t=Date.now()-a.current,r=()=>{a.current=Date.now(),i(e)};if(t>=aa)r();else return o.current=setTimeout(r,aa-t),()=>{o.current&&clearTimeout(o.current)}},[e,n]),t?(0,h.jsx)(`div`,{className:`codeblock`,children:(0,h.jsx)(`pre`,{children:(0,h.jsx)(`code`,{children:e})})}):(0,h.jsx)(Zr,{text:n?r:e})}var sa=(0,f.memo)(function({text:e,finishing:t=!1,onSettled:n}){let r=ra(e,!0,t,n),{frozen:i,active:a,inFence:o}=(0,f.useMemo)(()=>Zi(r),[r]),s=0,c=i.map(e=>{let t=`stream-offset:${s}`;return s+=e.length,{key:t,text:e}});return(0,h.jsxs)(`div`,{className:`md`,children:[c.map(({text:e,key:t})=>(0,h.jsx)($i,{text:e},t)),a.length>0&&(0,h.jsx)(oa,{text:a,inFence:o},i.length)]})});function ca(){let{t:e}=C();return(0,h.jsxs)(`div`,{className:`empty-state chat-welcome`,children:[(0,h.jsx)(`span`,{className:`empty-logo`,"aria-hidden":`true`,children:`C`}),(0,h.jsx)(`h2`,{children:e(`What would you like to work on?`)}),(0,h.jsx)(`p`,{children:e(`Start a conversation from the sidebar.`)})]})}function la(e){try{return sessionStorage.getItem(e)??``}catch{return``}}function ua({client:e,id:t,workspaceId:n,enabled:r,available:i=r,canInterrupt:a=r,onCadence:o,onModel:s,onChanged:c,reference:l,onReferenceUsed:u}){let{t:d,tx:p}=C(),m=`cadence:draft:${n}:${t}`,[g,_]=(0,f.useState)(()=>la(m)),[v,y]=(0,f.useState)(()=>la(`${m}:mode`)===`cadence`?`cadence`:`chat`),[b,x]=(0,f.useState)(null),[S,w]=(0,f.useState)(!1),[T,E]=(0,f.useState)(``),[D,O]=(0,f.useState)(()=>la(`${m}:pending`)),k=jr(e,i?{kind:`conversation`,id:t,before:b}:null,1e3),A=k.value?.kind===`conversation`?k.value:void 0,j=Mr(g,v),M=A?.summary,N=M&&(M.status===`queued`||M.status===`running`),P=!!M&&M.status!==`completed`&&!N,F=(0,f.useRef)(null),I=(0,f.useRef)(null),L=(0,f.useRef)(!0),[R,z]=(0,f.useState)(!1),B=(0,f.useRef)(!0),V=(0,f.useRef)(``),H=(0,f.useRef)(g);(0,f.useEffect)(()=>(B.current=!0,()=>{B.current=!1}),[]),(0,f.useEffect)(()=>{try{sessionStorage.setItem(`${m}:mode`,v)}catch{}},[m,v]),(0,f.useEffect)(()=>{try{sessionStorage.setItem(m,g)}catch{}},[g,m]),(0,f.useEffect)(()=>{try{D?sessionStorage.setItem(`${m}:pending`,D):sessionStorage.removeItem(`${m}:pending`)}catch{}},[m,D]),(0,f.useEffect)(()=>{l&&(_(e=>`${e}${e?`
8
+ `:``}@${l}`),u(),F.current?.focus())},[l,u]),(0,f.useEffect)(()=>{let e=A?.summary?`${A.summary.head}:${A.summary.status}`:``;e&&V.current!==e&&(V.current=e,c()),D&&A?.turns.some(e=>e.id===D)&&(O(``),_(e=>e===H.current?``:e),c()),L.current&&I.current&&(I.current.scrollTop=I.current.scrollHeight)},[A,D,c]);let U=async()=>{if(!(S||N||D||!r||!A||k.error||!j.text.trim())){if(j.mode===`cadence`)o(j.text.trim());else if(!(P||b!==null)){w(!0),E(``);try{let n=await e.models();if(!B.current)return;if(n.kind!==`ok`||!n.value.selected){s();return}let r={kind:`send`,commandId:crypto.randomUUID(),conversationId:t,head:M?.head??null,text:j.text,model:n.value.version};un(r),H.current=g,O(r.commandId);let i=await e.workbenchCommand(r);if(!B.current)return;i.kind===`error`?E(`${i.error.code}. ${d(`Observe this send before sending again. No automatic retry.`)}`):(_(e=>e===H.current?``:e),O(``)),k.refresh(),c()}catch{B.current&&E(d(`Send unavailable. Check the message limit (16 KiB); observe any pending command before sending again.`))}finally{B.current&&w(!1)}}}},ee=async()=>{let n=A?.turns.find(e=>e.id===M?.head);if(!n||S)return;w(!0);let r=await e.workbenchCommand({kind:`interrupt`,commandId:crypto.randomUUID(),conversationId:t,turnId:n.id,epoch:n.epoch});B.current&&(r.kind===`error`&&E(r.error.code),w(!1),k.refresh())};return(0,h.jsxs)(`section`,{className:`chat-workspace`,"aria-label":d(`Ordinary conversation`),children:[(0,h.jsxs)(`header`,{className:`conversation-header`,children:[(0,h.jsxs)(`div`,{className:`conversation-heading`,children:[(0,h.jsx)(Yn,{"aria-hidden":`true`}),(0,h.jsx)(`h2`,{children:M?.title??d(`New conversation`)}),(0,h.jsx)(`span`,{className:`conversation-badge`,children:d(`Ordinary`)})]}),M&&(0,h.jsx)(`span`,{className:`ep-state ${M.status}`,children:p(M.status)})]}),(0,h.jsxs)(`div`,{className:`chat-messages`,ref:I,onScroll:()=>{let e=I.current;e&&(L.current=e.scrollHeight-e.scrollTop-e.clientHeight<80,z(!L.current))},children:[!M&&(0,h.jsx)(ca,{}),A?.before&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>{L.current=!1,x(A.before)},children:d(`Earlier messages`)}),b&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>{L.current=!0,x(null)},children:d(`Latest messages`)}),A?.turns.map(e=>(0,h.jsx)(da,{turn:e},e.id)),(T||k.error)&&(0,h.jsx)(`p`,{role:`alert`,className:`banner-notice`,children:T||k.error}),D&&(0,h.jsxs)(`p`,{className:`inspector-note`,children:[d(`Send outcome not yet observed:`),` `,(0,h.jsx)(`code`,{children:D}),` `,(0,h.jsx)(`button`,{type:`button`,onClick:k.refresh,children:d(`Observe current state`)})]}),P&&(0,h.jsx)(`p`,{className:`inspector-note`,children:d(`This turn has no complete continuation context. Start a new conversation; retained messages are preserved.`)})]}),R&&(0,h.jsx)(`button`,{type:`button`,className:`chat-scroll-bottom`,"aria-label":d(`Latest messages`),onClick:()=>{I.current&&(I.current.scrollTop=I.current.scrollHeight),L.current=!0},children:(0,h.jsx)(br,{})}),(0,h.jsxs)(`form`,{className:`chat-composer`,onSubmit:e=>{e.preventDefault(),U()},children:[(0,h.jsx)(`textarea`,{ref:F,disabled:!r||S||!!D,"aria-label":d(`Message`),value:g,placeholder:d(`Message, or /cadence followed by a task…`),rows:3,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),U())}}),(0,h.jsxs)(`div`,{className:`composer-toolbar`,children:[(0,h.jsxs)(`select`,{"aria-label":d(`Conversation mode`),value:j.mode,onChange:e=>{let t=e.target.value===`cadence`?`cadence`:`chat`;y(t),t===`chat`&&Mr(g,`chat`).mode===`cadence`&&_(j.text)},children:[(0,h.jsx)(`option`,{value:`chat`,children:d(`Ordinary conversation`)}),(0,h.jsx)(`option`,{value:`cadence`,children:d(`Cadence task`)})]}),(0,h.jsxs)(`button`,{type:`button`,className:`ghost`,onClick:s,children:[(0,h.jsx)(ur,{}),d(`Model`)]}),(0,h.jsx)(`span`,{className:`composer-hint`,children:j.mode===`cadence`?d(`Prepare a plan first; Start requires confirmation.`):d(`Direct host tools · no Cadence task`)}),N?(0,h.jsxs)(`button`,{type:`button`,className:`danger`,disabled:S||!a,onClick:()=>void ee(),children:[(0,h.jsx)(Wn,{}),d(`Stop response`)]}):(0,h.jsxs)(`button`,{type:`submit`,className:`primary`,disabled:!r||!A||!!k.error||S||!!D||!j.text.trim()||j.mode===`chat`&&(P||b!==null),children:[(0,h.jsx)(yr,{}),j.mode===`cadence`?d(`Prepare task`):d(`Send`)]})]})]})]})}function da({turn:e}){let{t,tx:n}=C();return(0,h.jsxs)(`section`,{className:`chat-turn`,"aria-label":t(`Conversation turn`),children:[e.items.map(n=>n.role===`tool`?(0,h.jsxs)(`details`,{className:`chat-tool`,children:[(0,h.jsxs)(`summary`,{children:[(0,h.jsx)(`span`,{children:n.name||t(`Tool`)}),n.error&&(0,h.jsx)(`span`,{className:`ep-state failed`,children:t(`failed`)})]}),n.args&&(0,h.jsx)(`pre`,{children:n.args}),n.text&&(0,h.jsx)(`pre`,{children:n.text})]},n.id):(0,h.jsxs)(`article`,{className:`chat-message ${n.role}`,children:[(0,h.jsx)(`div`,{className:`chat-message-role`,children:n.role===`user`?t(`You`):`Cadence`}),n.role===`assistant`&&e.status===`running`?(0,h.jsx)(sa,{text:n.text}):(0,h.jsx)(Qr,{text:n.text})]},n.id)),e.notice&&(0,h.jsx)(`p`,{className:`inspector-note`,children:e.notice.split(`
9
9
  `).map(e=>n(e)).join(`
10
- `)}),![`completed`,`running`,`queued`].includes(e.status)&&(0,h.jsx)(`p`,{className:`ep-state ${e.status}`,children:n(e.status)})]})}function da({client:e,enabled:t,onReference:n}){let{t:r}=C(),[i,a]=(0,f.useState)(``),[o,s]=(0,f.useState)(null),[c,l]=(0,f.useState)(``),u=jr(e,t?{kind:`files`,path:i}:null),d=jr(e,t&&o?{kind:`file`,path:o}:null),p=u.value?.kind===`files`?u.value:void 0,m=d.value?.kind===`file`?d.value:void 0;return(0,h.jsxs)(`div`,{className:`files-panel`,children:[(0,h.jsxs)(`header`,{className:`files-toolbar`,children:[(0,h.jsx)(`button`,{type:`button`,className:`ghost`,"aria-label":r(`Parent folder`),disabled:p?.parent==null,onClick:()=>{p?.parent!=null&&a(p.parent)},children:(0,h.jsx)(Re,{})}),(0,h.jsx)(`span`,{className:`files-path`,title:i,children:i||`/`}),(0,h.jsx)(`button`,{type:`button`,className:`ghost`,"aria-label":r(`Refresh files`),onClick:()=>{u.refresh(),d.refresh()},children:(0,h.jsx)(fe,{})})]}),u.error&&(0,h.jsx)(`p`,{className:`inspector-note`,role:`alert`,children:u.error}),(0,h.jsxs)(`section`,{className:`file-list`,"aria-label":r(`File list`),children:[p?.entries.map(e=>(0,h.jsxs)(`div`,{className:`file-row`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`file-name${o===e.path?` selected`:``}`,title:e.path,onClick:()=>e.directory?a(e.path):s(e.path),children:[e.directory?(0,h.jsx)(Ce,{}):(0,h.jsx)(we,{}),(0,h.jsx)(`span`,{children:e.name})]}),(0,h.jsx)(`button`,{type:`button`,className:`file-action`,"aria-label":r(`Reference {path}`,{path:e.name}),onClick:()=>n(e.path),children:(0,h.jsx)(pe,{})}),(0,h.jsx)(`button`,{type:`button`,className:`file-action`,"aria-label":r(`Copy path {path}`,{path:e.name}),onClick:()=>void Wr(e.path).then(e=>l(e?``:r(`Link copy unavailable.`))),children:(0,h.jsx)(Ae,{})})]},e.path)),p?.entries.length===0&&(0,h.jsx)(`p`,{className:`panel-empty`,children:r(`No visible files`)}),p?.limited&&(0,h.jsx)(`p`,{className:`inspector-note`,children:r(`Bounded listing; narrow the directory to see more.`)})]}),o&&(0,h.jsxs)(`section`,{className:`file-preview`,children:[(0,h.jsxs)(`header`,{children:[(0,h.jsx)(`span`,{title:o,children:o}),(0,h.jsx)(`button`,{type:`button`,className:`ghost`,"aria-label":r(`Close preview`),onClick:()=>s(null),children:(0,h.jsx)(ae,{})})]}),d.error&&(0,h.jsx)(`p`,{role:`alert`,children:d.error}),m&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`pre`,{children:m.text}),m.limited&&(0,h.jsx)(`p`,{className:`inspector-note`,children:r(`File preview is limited; this is not the complete file.`)})]})]}),c&&(0,h.jsx)(`p`,{role:`alert`,children:c}),(0,h.jsx)(`p`,{className:`files-policy`,children:r(`Readonly preview · references send paths, not file contents`)})]})}function fa({draft:e,onChange:t,context:n,roles:r,onSave:i,onGenerate:a,onStart:o,canSave:s,canAct:c}){let{t:l,tx:u}=C(),[d,p]=(0,f.useState)(!0),[m,g]=(0,f.useState)(null),[_,v]=(0,f.useState)(``),[y,b]=(0,f.useState)(``),[x,S]=(0,f.useState)(`research`),[w,T]=(0,f.useState)([]),[E,D]=(0,f.useState)(``),[ee,O]=(0,f.useState)(``),k=e.assignments,A=e=>{g(e.id),v(e.instructions),b(e.expectedOutput),S(e.purpose),T(e.dependencies),O(``)},j=()=>{g(null),v(``),b(``),O(``)},te=n=>{let i=r?.find(e=>e.role===rt(x));i?(t({...e,assignments:k.map(e=>e.id===n?{...e,purpose:x,instructions:_,expectedOutput:y,dependencies:w,role:i}:e)}),j()):O(Or)},M=()=>{let i=r?.find(e=>e.role===rt(`research`));if(!i){O(Or);return}let a=1;for(;k.some(e=>e.id===`assignment-${a}`);)a++;let o={id:`assignment-${a}`,purpose:`research`,instructions:``,expectedOutput:``,dependencies:[],role:i,model:n.model};t({...e,assignments:[...k,o]}),A(o)},ne=n=>{k.some(e=>e.dependencies.some(e=>e.source.kind===`current`&&e.source.assignmentId===n))?O(`Remove dependent edges explicitly before deleting this assignment.`):t({...e,assignments:k.filter(e=>e.id!==n)})};return(0,h.jsxs)(`section`,{className:`plan-board ${d?``:`plan-board-collapsed`}`,children:[(0,h.jsx)(`div`,{className:`plan-board-head`,children:(0,h.jsxs)(`button`,{type:`button`,className:`plan-board-head-main`,"aria-expanded":d,onClick:()=>p(!d),children:[(0,h.jsx)(_e,{}),(0,h.jsx)(`span`,{children:l(`Readable plan & decomposition`)}),(0,h.jsx)(`span`,{children:l(`{count} required assignments`,{count:k.length})}),d?(0,h.jsx)(Me,{}):(0,h.jsx)(Pe,{})]})}),(0,h.jsxs)(`div`,{className:`toolbar`,children:[(0,h.jsx)(`button`,{type:`button`,disabled:!c||n.task?.kind!==`code`,onClick:a,children:l(`Preview readonly Generate proposal`)}),(0,h.jsx)(`button`,{type:`button`,disabled:!s,onClick:i,children:l(`Preview Save plan`)}),(0,h.jsx)(`button`,{type:`button`,className:`primary`,disabled:!c,onClick:o,children:l(`Preview Start saved graph`)})]}),(0,h.jsx)(`p`,{children:l(`Draft changes never execute. Start uses the saved graph shown in its fresh preview, not unsaved text. Generated proposals never save or start themselves.`)}),k.some(e=>J(e.model)!==J(n.model))&&(0,h.jsxs)(`section`,{children:[(0,h.jsx)(`p`,{children:l(`Saved assignments name an old model selection. Reading does not rebind them.`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>t({...e,assignments:k.map(e=>({...e,model:n.model}))}),children:l(`Explicitly rebind draft to current model (requires new Save)`)})]}),!r&&(0,h.jsx)(`p`,{role:`status`,children:u(`Current plan metadata unavailable. Observe again; historical text is not action authority.`)}),ee&&(0,h.jsx)(`p`,{role:`alert`,children:u(ee)}),d&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`label`,{children:[l(`Readable plan`),(0,h.jsx)(`textarea`,{"aria-label":l(`Readable plan`),value:e.readablePlan,onChange:n=>t({...e,readablePlan:n.target.value}),rows:8})]}),(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:l(`Read rendered plan`)}),(0,h.jsx)(Qr,{text:e.readablePlan})]}),(0,h.jsx)(Kr,{text:e.readablePlan}),(0,h.jsx)(`ol`,{className:`plan-board-steps`,children:k.map(e=>(0,h.jsxs)(`li`,{className:`plan-board-step`,children:[(0,h.jsxs)(`div`,{className:`plan-step-head`,children:[(0,h.jsx)(`strong`,{children:e.id}),(0,h.jsxs)(`span`,{children:[u(e.purpose),` —`,` `,e.purpose===`edit`?l(`checkout writer`):l(`readonly`)]}),(0,h.jsxs)(`button`,{type:`button`,onClick:()=>A(e),children:[(0,h.jsx)(De,{}),` `,l(`Edit`)]}),(0,h.jsxs)(`button`,{type:`button`,onClick:()=>ne(e.id),children:[(0,h.jsx)(se,{}),` `,l(`Remove draft assignment`)]})]}),m===e.id?(0,h.jsxs)(`div`,{className:`plan-step-edit`,children:[(0,h.jsxs)(`label`,{children:[l(`Purpose`),(0,h.jsx)(`select`,{value:x,onChange:e=>{let t=e.target.value;(t===`research`||t===`diagnosis`||t===`review`||t===`edit`&&n.task?.kind===`code`)&&S(t)},children:[`research`,`diagnosis`,`review`,`edit`].filter(e=>e!==`edit`||n.task?.kind===`code`).map(e=>(0,h.jsx)(`option`,{value:e,children:u(e)},e))})]}),(0,h.jsxs)(`label`,{children:[l(`Instructions`),(0,h.jsx)(`textarea`,{"aria-label":l(`Instructions`),value:_,onChange:e=>v(e.target.value),rows:5})]}),(0,h.jsxs)(`label`,{children:[l(`Expected output`),(0,h.jsx)(`textarea`,{"aria-label":l(`Expected output`),value:y,onChange:e=>b(e.target.value),rows:3})]}),(0,h.jsxs)(`fieldset`,{children:[(0,h.jsx)(`legend`,{children:l(`Current-episode dependencies (whole final text by default)`)}),k.filter(t=>t.id!==e.id).map(e=>{let t=w.findIndex(t=>t.source.kind===`current`&&t.source.assignmentId===e.id);return(0,h.jsxs)(`label`,{children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:t>=0,onChange:t=>T(n=>t.target.checked?[...n,{source:{kind:`current`,assignmentId:e.id},range:null,requireCompleteObservation:!1}]:n.filter(t=>t.source.kind!==`current`||t.source.assignmentId!==e.id))}),e.id]},e.id)})]}),w.map((e,t)=>(0,h.jsxs)(`div`,{className:`dependency-editor`,children:[(0,h.jsx)(`code`,{children:JSON.stringify(e.source)}),(0,h.jsxs)(`label`,{children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:e.requireCompleteObservation,onChange:e=>T(n=>n.map((n,r)=>t===r?{...n,requireCompleteObservation:e.target.checked}:n))}),l(`Require complete observation`)]}),(0,h.jsx)(`p`,{children:l(`Selection: {range}`,{range:e.range?l(`reviewed UTF-8 bytes {start}–{end}`,{start:e.range.start,end:e.range.end}):l(`whole final text; no silent clipping`)})}),(0,h.jsxs)(`label`,{children:[l(`Reviewed edge JSON (range/null and exact historical identity)`),(0,h.jsx)(`textarea`,{defaultValue:JSON.stringify(e),onBlur:e=>{try{let n=at(qe(e.target.value));T(e=>e.map((e,r)=>t===r?n:e)),O(``)}catch{O(`Invalid dependency. Original edge retained; review before Save.`)}}})]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>T(e=>e.filter((e,n)=>t!==n)),children:l(`Remove edge`)})]},e.source.kind===`current`?e.source.assignmentId:e.source.childRunId)),(0,h.jsxs)(`label`,{children:[l(`Explicit historical/advisory edge JSON`),(0,h.jsx)(`textarea`,{value:E,onChange:e=>D(e.target.value),placeholder:l(`Exact committed run/child/result/version plus range and coverage requirement`)})]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{try{let e=at(qe(E));if(e.source.kind!==`historical`)throw Error();T(t=>[...t,e]),D(``),O(``)}catch{O(`Historical edge requires actual committed identity; no guessed result reference.`)}},children:l(`Add reviewed historical edge`)}),(0,h.jsx)(`button`,{type:`button`,onClick:j,children:l(`Discard inline edits`)}),(0,h.jsx)(`button`,{type:`button`,disabled:!!ee,onClick:()=>te(e.id),children:l(`Apply to local draft`)})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Qr,{text:e.instructions}),(0,h.jsx)(`p`,{children:l(`Expected: {output}`,{output:e.expectedOutput})}),(0,h.jsxs)(`p`,{children:[l(`Role {role}`,{role:e.role.role}),` /`,` `,(0,h.jsx)(`code`,{children:e.role.sha256})]}),(0,h.jsxs)(`p`,{children:[e.model.provider,`/`,e.model.model,` ·`,` `,e.model.thinking]}),(0,h.jsx)(`pre`,{children:JSON.stringify(e.dependencies,null,2)})]})]},e.id))}),(0,h.jsxs)(`button`,{type:`button`,disabled:!r||k.length>=16,onClick:M,children:[(0,h.jsx)(pe,{}),` `,l(`Add assignment`)]})]})]})}var pa=`未命名章节`;function ma(e){return String(e??``).trim().replace(/[\s\u3000]+/g,`-`).replace(/[^\p{L}\p{N}_-]+/gu,`-`).replace(/-{2,}/g,`-`).replace(/^-+|-+$/g,``).slice(0,80)||`section`}function ha(e){let t=new Map;return e.map(({level:e,label:n})=>{let r=String(n??``).replace(/\s+/g,` `).trim(),i=ma(r||pa),a=(t.get(i)??0)+1;return t.set(i,a),{level:e,id:a===1?i:`${i}-${a}`,label:r||pa}})}function ga(e){return e.length>=2}function _a(e){let t=0,n=0;return e.split(`
11
- `).map(e=>{let r={key:`text-offset:${t}`,number:++n,text:e};return t+=e.length+1,r})}function va({text:e}){return(0,h.jsx)(`pre`,{className:`scm-diff-pre`,children:_a(e).map(({text:e,key:t})=>{let n=``;return[`diff --git`,`index `,`new file`,`deleted file`,`old mode`,`new mode`,`similarity index`,`rename `,`copy `,`Binary files`,`---`,`+++`].some(t=>e.startsWith(t))?n=`hdr`:e.startsWith(`@@`)?n=`hunk`:e.startsWith(`+`)?n=`add`:e.startsWith(`-`)&&(n=`del`),(0,h.jsx)(`div`,{className:`scm-diff-line ${n}`,children:e||` `},t)})})}function ya({text:e}){let{t}=C(),[n,r]=(0,f.useState)(`raw`),[i,a]=(0,f.useState)(!0),[o,s]=(0,f.useState)(1),[c,l]=(0,f.useState)([]),[u,d]=(0,f.useState)(null),p=(0,f.useRef)(1),m=(0,f.useRef)(null),g=e.split(`
12
- `);return(0,f.useLayoutEffect)(()=>{if(n!==`markdown`)return;if(!e){l([]);return}let t=Array.from(m.current?.querySelectorAll(`h1,h2,h3,h4,h5,h6`)??[]),r=ha(t.map(e=>({level:Number(e.tagName[1]),label:e.textContent??``})));r.forEach((e,n)=>{t[n].id=`preview-${e.id}`}),l(r)},[e,n]),(0,h.jsxs)(`div`,{className:`fp-preview`,children:[(0,h.jsxs)(`div`,{className:`fp-head toolbar`,children:[(0,h.jsxs)(`label`,{children:[t(`View`),(0,h.jsxs)(`select`,{value:n,onChange:e=>r(e.target.value===`markdown`?`markdown`:e.target.value===`diff`?`diff`:`raw`),children:[(0,h.jsx)(`option`,{value:`raw`,children:t(`Raw text / lines`)}),(0,h.jsx)(`option`,{value:`markdown`,children:t(`Safe Markdown`)}),(0,h.jsx)(`option`,{value:`diff`,children:t(`Observed diff`)})]})]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),children:t(i?`Wrap: on`:`Wrap: off`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>s(e=>Math.min(2,e+.1)),children:t(`Zoom +`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>s(e=>Math.max(.8,e-.1)),children:t(`Zoom −`)}),(0,h.jsx)(Kr,{text:u?g.slice(u.start-1,u.end).join(`
13
- `):e})]}),(0,h.jsx)(`p`,{className:`fp-notice`,children:t(`Captured page only, not a current filesystem read. Line numbers are page-local. Full retained paging and copy are available above.`)}),(0,h.jsx)(`div`,{style:{fontSize:`${o}em`},children:n===`markdown`?(0,h.jsxs)(`div`,{className:`fp-toc-layout`,children:[ga(c)&&(0,h.jsx)(`nav`,{className:`fp-toc`,"aria-label":t(`Page headings`),children:c.map(e=>(0,h.jsx)(`button`,{type:`button`,className:`l${e.level}`,onClick:()=>m.current?.querySelector(`#${CSS.escape(`preview-${e.id}`)}`)?.scrollIntoView({block:`nearest`}),children:e.label},e.id))}),(0,h.jsx)(`div`,{className:`fp-markdown-zoom`,ref:m,children:(0,h.jsx)(Qr,{text:e})})]}):n===`diff`?(0,h.jsx)(va,{text:e}):(0,h.jsx)(`div`,{className:`fp-code ${i?``:`no-wrap`}`,children:_a(e).map(({text:e,number:n,key:r})=>(0,h.jsxs)(`div`,{className:`fp-line ${u&&n>=u.start&&n<=u.end?`sel`:``}`,children:[(0,h.jsx)(`button`,{type:`button`,className:`fp-num`,"aria-label":t(`Select page line {line}`,{line:n}),onClick:e=>{e.shiftKey||(p.current=n),d({start:Math.min(p.current,n),end:Math.max(p.current,n)})},children:n}),(0,h.jsx)(`span`,{className:`fp-code-text`,children:e||` `})]},r))})}),u&&(0,h.jsxs)(`footer`,{className:`fp-foot`,children:[t(`Selected page lines {start}–{end}`,{start:u.start,end:u.end}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>d(null),children:t(`Clear selection`)})]})]})}function ba({client:e,seed:t}){let{t:n,tx:r}=C(),i=ui(e,t),[a,o]=(0,f.useState)(),s=i.page;return(0,h.jsxs)(`section`,{className:`scm-body`,children:[(0,h.jsx)(yi,{pager:i}),(0,h.jsx)(`p`,{children:n(`Captured observations include pre-existing dirt. They do not attribute every change to Cadence; bounded fingerprints are not filesystem snapshots.`)}),(0,h.jsx)(`div`,{className:`scm-files-list`,children:s&&!(`kind`in s)&&s.records.map(e=>{if(e.kind!==`owner-fact`)return null;let t=e.fact,i=t.kind===`changes`||t.kind===`review`?t.content:t.kind===`check-settled`?t.output:null;return(0,h.jsxs)(`article`,{className:`scm-file`,children:[(0,h.jsxs)(`h3`,{children:[t.kind,` · `,n(`committed #{seq}`,{seq:e.committedSeq})]}),(0,h.jsx)(`pre`,{children:JSON.stringify(t,null,2)}),i&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>{s.request.scope.kind!==`workspace`&&s.request.snapshotSeq!==null&&o(ci(s.request.storeId,s.request.scope,s.request.snapshotSeq,i))},children:n(`Inspect full retained {field}`,{field:r(i.field)})})]},e.recordId)})}),a&&(0,h.jsx)(vi,{client:e,cursor:a,render:e=>(0,h.jsx)(ya,{text:e})},`${a.recordId}:${a.recordVersion}`)]})}function xa({client:e,taskId:t,seed:n,canAct:r,onAction:i,onObligations:a}){let{t:o,tx:s}=C(),[c,l]=(0,f.useState)(),[u,d]=(0,f.useState)(),[p,m]=(0,f.useState)(0),g=(0,f.useRef)(p);return g.current=p,(0,f.useEffect)(()=>{let n=p,r=new AbortController,i=!0;return l(void 0),e.checkObligations(t,r.signal).then(e=>{i&&g.current===n&&(e.kind===`error`?d(e.error.code):(d(void 0),l(e.value),a(e.value)))}).catch(()=>{i&&d(`Obligations unavailable.`)}),()=>{r.abort(),i=!1}},[e,t,p,a]),(0,h.jsxs)(`section`,{children:[(0,h.jsx)(`h3`,{children:o(`Current configured obligations`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>m(e=>e+1),children:o(`Observe obligations`)}),u&&(0,h.jsx)(`p`,{role:`alert`,children:o(`Obligations unavailable: {error}`,{error:s(u)})}),c?.definitions.length===0&&(0,h.jsx)(`p`,{children:o(`No configured obligations. This is not passing check coverage.`)}),c?.definitions.map(e=>(0,h.jsxs)(`article`,{children:[(0,h.jsxs)(`h4`,{children:[e.selection.name,`: `,s(e.status)]}),(0,h.jsx)(`pre`,{children:e.selection.command}),(0,h.jsx)(`p`,{children:o(`Timeout {timeout} ms. Native outcome and freshness remain separate.`,{timeout:e.selection.timeoutMs})}),(0,h.jsx)(`button`,{type:`button`,disabled:!r,onClick:()=>i({kind:`check`,taskId:t,check:e.selection}),children:o(`Preview exact configured check`)})]},e.selection.name)),(0,h.jsx)(`p`,{children:o(`Browser checks are configured selections only. Native-local manual commands are not a browser shell endpoint.`)}),(0,h.jsx)(ba,{client:e,seed:{...n,reader:`checks`}})]})}function Sa({client:e,storeId:t,taskId:n}){let{t:r,tx:i}=C(),[a,o]=(0,f.useState)(),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(0);return(0,f.useEffect)(()=>{if(l<0)return;let r=new AbortController;return o(void 0),c(``),e.currentChanges({storeId:t,taskId:n},r.signal).then(e=>{r.signal.aborted||(e.kind===`ok`?o(e.value):c(e.error.code))}).catch(()=>{r.signal.aborted||c(`Current observation unavailable`)}),()=>r.abort()},[e,t,n,l]),(0,h.jsxs)(`section`,{"aria-label":r(`Current checkout changes`),children:[(0,h.jsx)(`h3`,{children:r(`Current checkout changes (not a captured historical diff)`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>u(e=>e+1),children:r(`Observe current changes`)}),s&&(0,h.jsx)(`p`,{role:`alert`,children:i(s)}),a&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:(0,h.jsx)(y,{text:r(`Fingerprint {identity} · {coverage} · includes pre-existing dirt; not attribution.`),slots:{identity:(0,h.jsx)(`code`,{children:a.observation.identity}),coverage:a.observation.complete?r(`complete within bounded scope`):r(`incomplete coverage`)}})}),(0,h.jsx)(`pre`,{children:JSON.stringify(a.coverage)}),(0,h.jsx)(ya,{text:a.text})]})]})}var Ca=[[`plan`,Te],[`checks`,Ie],[`changes`,xe],[`review`,oe]];function wa(){let{t:e}=C();return(0,h.jsx)(`aside`,{className:`panel panel-right`,children:(0,h.jsx)(`p`,{className:`panel-empty`,children:e(`Select a task to inspect plans, checks, changes and review.`)})})}function Ta({client:e,context:t,seed:n,runs:r,canAct:i,onAction:a,planMetadata:o}){let{t:s,tx:c}=C(),l=t?J(t):`unavailable`,u=(0,f.useMemo)(()=>l===`unavailable`?null:ct(qe(l)),[l]),[d,p]=(0,f.useState)(`plan`),[m,g]=(0,f.useState)({readablePlan:``,assignments:[]}),[_,v]=(0,f.useState)(),[y,b]=(0,f.useState)(),[x,S]=(0,f.useState)(),[w,T]=(0,f.useState)(),[E,D]=(0,f.useState)(``),[ee,O]=(0,f.useState)(!1),k=u?.task?.id??(n.scope.kind===`task`?n.scope.id:null),A=(0,f.useRef)(new Ir);A.current.select(J({context:u,tab:d,draft:m,canAct:i})),(0,f.useEffect)(()=>()=>A.current.depart(),[]),(0,f.useEffect)(()=>{let e=!0;if(b(void 0),v(void 0),!o||!u)S(Or);else return o.read(u).then(t=>{e&&(t.kind===`error`?S(t.error.code):J(t.value.context)===l?(`kind`in t.value?v(t.value):b(t.value),S(void 0)):S(`Owner metadata is stale.`))}).catch(()=>{e&&S(`Owner metadata unavailable.`)}),()=>{e=!1}},[o,u,l]);let j=(0,f.useCallback)(e=>T(e),[]);if(!k)return(0,h.jsx)(wa,{});let te={...n,scope:{kind:`task`,id:k}};return(0,h.jsxs)(`aside`,{className:`panel panel-right`,children:[(0,h.jsx)(`nav`,{className:`rp-tabs`,"aria-label":s(`Inspector`),children:Ca.map(([e,t])=>(0,h.jsxs)(`button`,{type:`button`,className:`rp-tab`,"aria-label":c(e),"aria-pressed":d===e,onClick:()=>p(e),children:[(0,h.jsx)(t,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:c(e)})]},e))}),(0,h.jsxs)(`div`,{className:`inspector-body`,children:[d===`plan`&&(0,h.jsxs)(h.Fragment,{children:[x&&(0,h.jsx)(`p`,{className:`inspector-note`,role:`status`,children:c(x)}),_&&(0,h.jsxs)(`section`,{children:[(0,h.jsxs)(`p`,{children:[s(`Saved graph proof in progress.`),` `,JSON.stringify(_.coverage)]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{if(!o||!u)return;let e=A.current.ticket();o.read(u,_.next).then(t=>{A.current.current(e)&&(t.kind===`error`?S(t.error.code):`kind`in t.value?v(t.value):(v(void 0),b(t.value)))})},children:s(`Continue saved graph read`)})]}),y&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>g({readablePlan:y.readablePlan,assignments:y.savedGraph?.assignments??[]}),children:s(`Load observed saved plan into local draft`)}),u?(0,h.jsx)(fa,{draft:m,onChange:g,context:u,roles:y?.roles??null,canAct:i,canSave:i&&!!y&&y.editable!==!1&&!!o,onGenerate:()=>a({kind:`generate-plan`,taskId:k}),onStart:()=>a({kind:`start`,taskId:k}),onSave:()=>{if(!o)return;let e=A.current.ticket();o.saveAction(u,structuredClone(m)).then(t=>{A.current.current(e)&&(t.kind===`error`?S(t.error.code):a(t.value))}).catch(()=>{A.current.current(e)&&S(`Plan proposal unavailable.`)})}}):(0,h.jsx)(`p`,{children:s(`Current control context unavailable. Historical data is not action authority.`)})]}),d===`checks`&&(0,h.jsx)(xa,{client:e,taskId:k,seed:te,canAct:i,onAction:a,onObligations:j}),d===`changes`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Sa,{client:e,storeId:n.storeId,taskId:k}),(0,h.jsx)(`h3`,{children:s(`Captured historical observations`)}),(0,h.jsx)(ba,{client:e,seed:{...te,reader:`changes`}})]}),d===`review`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`h3`,{children:s(`Human review`)}),(0,h.jsx)(`p`,{children:s(`Done records human acknowledgment, not execution success or certification. It cannot restart a blocked episode.`)}),(0,h.jsxs)(`label`,{children:[s(`Episode to review`),(0,h.jsxs)(`select`,{value:E,onChange:e=>D(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:s(`Select an observed episode`)}),r.filter(e=>e.childRunId===null&&e.admission.kind!==`check`).map(e=>(0,h.jsxs)(`option`,{value:e.runId,children:[e.runId,` · `,c(e.outcome??e.lifecycle)]},e.runId))]})]}),(0,h.jsxs)(`label`,{children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:ee,onChange:e=>O(e.target.checked)}),s(`I acknowledge current unresolved issues if present; original results will not be rewritten.`)]}),(0,h.jsx)(`button`,{type:`button`,disabled:!i||!u||!w||w.taskId!==k||!E,onClick:()=>{u&&w&&a({kind:`review`,taskId:k,runId:E,changesIdentity:u.observation.identity,checksRevision:w.revision,acceptIssues:ee})},children:s(`Preview human review / Done`)}),!w&&(0,h.jsx)(`p`,{children:s(`Observe current obligations in Checks before requesting review.`)}),(0,h.jsx)(ba,{client:e,seed:{...te,reader:`reviews`}})]})]})]})}function Ea({client:e,current:t,initial:n,epoch:r,onClose:i,onOpen:a}){let{t:o}=C(),[s,c]=(0,f.useState)(n??t),[l,u]=(0,f.useState)(n??t),[d,p]=(0,f.useState)(!1),[m,g]=(0,f.useState)(``),_=(0,f.useRef)(!0);(0,f.useEffect)(()=>()=>{_.current=!1},[]);let v=jr(e,{kind:`directories`,path:s}),y=v.value?.kind===`directories`?v.value:void 0,b=e=>{c(e),u(e)},x=async()=>{if(d||!y||v.error)return;if(!a&&y.path===t){i();return}if(p(!0),g(``),a){try{await a(y.path),_.current&&i()}catch(e){_.current&&(g(e instanceof Error?e.message:`unavailable`),p(!1))}return}if(!e.workbenchCommand){g(`unavailable`),p(!1);return}let n=await e.workbenchCommand({kind:`open-project`,commandId:crypto.randomUUID(),path:y.path,epoch:r});if(_.current){if(n.kind===`ok`&&n.value.kind===`project`){let e=new URL(n.value.link);e.protocol===`http:`&&[`127.0.0.1`,`[::1]`].includes(e.hostname)||e.protocol===`https:`?window.location.assign(e.href):(g(`unsupported-context`),p(!1))}else g(n.kind===`error`?n.error.code:`unavailable`),p(!1)}};return(0,h.jsxs)(Lr,{title:o(`Open working folder`),onClose:i,children:[(0,h.jsx)(`p`,{children:o(`Choose a folder on the service host. Opening reuses or starts that project's independent service; current work keeps running.`)}),(0,h.jsxs)(`form`,{className:`cwd-input`,onSubmit:e=>{e.preventDefault(),b(l)},children:[(0,h.jsx)(`input`,{"aria-label":o(`Folder path`),value:l,onChange:e=>u(e.target.value)}),(0,h.jsx)(`button`,{type:`submit`,children:o(`Browse`)})]}),(0,h.jsxs)(`div`,{className:`cwd-picker-list`,children:[y?.parent&&(0,h.jsxs)(`button`,{type:`button`,onClick:()=>b(y.parent),children:[(0,h.jsx)(Re,{}),o(`Parent folder`)]}),y?.entries.map(e=>(0,h.jsxs)(`button`,{type:`button`,onClick:()=>b(e.path),children:[(0,h.jsx)(Ce,{}),(0,h.jsx)(`span`,{children:e.name})]},e.path))]}),y?.limited&&(0,h.jsx)(`p`,{className:`inspector-note`,children:o(`Bounded listing; narrow the directory to see more.`)}),(m||v.error)&&(0,h.jsx)(`p`,{role:`alert`,children:m||v.error}),(0,h.jsx)(`footer`,{children:(0,h.jsx)(`button`,{type:`button`,className:`primary`,disabled:d||!y||!!v.error,onClick:()=>void x(),children:o(d?`Opening project…`:`Open this project`)})})]})}function Da(e,t=new Set){let n=new Map(e.map(e=>[e.id,e])),r=new Map,i=[];for(let t of e)if(t.parentId&&n.has(t.parentId)){let e=r.get(t.parentId)??[];e.push(t),r.set(t.parentId,e)}else i.push(t);let a=e=>{let t=[],n=[...r.get(e)??[]],i=new Set;for(;n.length>0;){let e=n.shift();if(!e)break;if(i.has(e.id))continue;i.add(e.id),t.push(e);let a=r.get(e.id);a&&n.push(...a)}return t},o=[],s=new Set,c=new Set,l=(e,n)=>{if(s.has(e.id)||c.has(e.id))return;s.add(e.id);let i=r.get(e.id)??[],u=i.length>0,d=u&&t.has(e.id),f=0,p=!1,m=!1,h=!1;if(u){let t=a(e.id);if(f=t.length,p=t.some(e=>e.active),m=t.some(e=>e.failed),h=t.some(e=>e.unknown),d)for(let e of t)c.add(e.id)}if(o.push({c:e,depth:n,hasKids:u,isCollapsed:d,descendantCount:f,hasActive:p,hasFailure:m,hasUnknown:h}),!d)for(let e of i)l(e,n+1)};for(let e of i)l(e,0);for(let t of e)l(t,0);return o}function Oa({title:e,children:t,className:n=``,count:r}){let[i,a]=(0,f.useState)(!0);return(0,h.jsxs)(`section`,{className:`lp-section ${n}${i?``:` collapsed`}`,children:[(0,h.jsx)(`header`,{className:`lp-section-header`,children:(0,h.jsxs)(`button`,{type:`button`,className:`lp-section-heading`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[i?(0,h.jsx)(Pe,{"aria-hidden":`true`}):(0,h.jsx)(Ne,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`lp-section-title`,children:e}),r&&(0,h.jsx)(`span`,{className:`lp-count`,children:r})]})}),(0,h.jsx)(`div`,{className:`lp-section-body`,hidden:!i,children:t})]})}function ka({runs:e,scope:t,snapshot:n,onScope:r}){let{t:i,tx:a}=C(),[o,s]=(0,f.useState)(new Set),c=Da(e.map(e=>({id:e.childRunId??e.runId,parentId:e.childRunId?e.runId:null,label:e.childRunId?e.assignmentId??i(`Subagent`):a(e.admission.kind),active:e.lifecycle!==`settled`,failed:e.outcome===`failed`,unknown:e.outcome===`unknown`})),o);return(0,h.jsx)(`nav`,{className:`conversation-tree`,"aria-label":i(`Runs and assignments`),children:c.map(o=>{let c=e.find(e=>(e.childRunId??e.runId)===o.c.id),l=c?.childRunId?`child`:`run`,u=c?.outcome??c?.lifecycle??`unknown`,d=t?.kind===l&&t.id===o.c.id;return(0,h.jsxs)(`div`,{className:`ep-row`,style:{paddingInlineStart:`${o.depth*14}px`},children:[o.hasKids?(0,h.jsx)(`button`,{type:`button`,className:`ep-toggle`,"aria-label":i(`Toggle assignments`),"aria-expanded":!o.isCollapsed,onClick:()=>s(e=>{let t=new Set(e);return t.has(o.c.id)?t.delete(o.c.id):t.add(o.c.id),t}),children:o.isCollapsed?(0,h.jsx)(Ne,{"aria-hidden":`true`}):(0,h.jsx)(Pe,{"aria-hidden":`true`})}):(0,h.jsx)(`span`,{className:`ep-toggle-spacer`,"aria-hidden":`true`}),(0,h.jsxs)(`button`,{type:`button`,className:`session-item${d?` active`:``}`,"aria-current":d?`true`:void 0,title:`${o.c.label} · ${o.c.id}`,onClick:()=>r({kind:l,id:o.c.id},n,o.c.label),children:[(0,h.jsx)(`span`,{className:`session-icon`,children:l===`child`?(0,h.jsx)(ke,{"aria-hidden":`true`}):(0,h.jsx)(me,{"aria-hidden":`true`})}),(0,h.jsxs)(`span`,{className:`session-info`,children:[(0,h.jsx)(`span`,{className:`session-title`,children:o.c.label}),l===`child`&&(0,h.jsx)(`span`,{className:`session-sub`,children:i(`Subagent`)}),o.isCollapsed&&(0,h.jsx)(`span`,{className:`session-sub session-outcome`,children:`${i(`{count} descendants`,{count:o.descendantCount})}${o.hasFailure?i(` / failed child`):``}${o.hasUnknown?i(` / unknown child`):``}`})]}),(0,h.jsx)(`span`,{className:`ep-state ${u}`,children:a(u)})]})]},o.c.id)})})}function Aa({pager:e,scope:t,onScope:n,exclude:r}){let{t:i}=C(),a=e.page;return(0,h.jsxs)(`div`,{className:`retained-conversations`,children:[a&&!(`kind`in a)&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ka,{runs:a.records.flatMap(e=>e.kind===`run`&&!r.includes(e.projection.runId)?[e.projection]:[]),scope:t,snapshot:a.request.snapshotSeq??void 0,onScope:n}),a.records.length===0&&(0,h.jsx)(`p`,{className:`panel-hint`,children:i(`No retained conversations on this page.`)})]}),(0,h.jsx)(yi,{pager:e,compact:!0})]})}function ja({client:e,workspace:t,taskId:n,scope:r,runs:i,snapshot:a,activeRuns:o,cancelCompatible:s,canceling:c,onCancel:l,onTask:u,onScope:d,onNew:f,onProject:p,chats:m=[],conversationId:g,projects:_,onConversation:v,onNewConversation:y,onOpenProject:b}){let{t:x,tx:S}=C(),w={reader:`tasks`,storeId:t.storeId,scope:{kind:`workspace`,id:t.workspaceId},snapshotSeq:null,after:null,limit:50},T=ui(e,w),E=ui(e,n?{...w,reader:`runs`,scope:{kind:`task`,id:n},snapshotSeq:a??t.committedSeq}:null),D=T.page&&!(`kind`in T.page)?T.page.records.flatMap(e=>e.kind===`task`?[e]:[]):[],ee=o?.status===`complete`?o.runs:[],O=D.filter(e=>!ee.some(t=>t.taskId===e.owner.taskId)),k=n&&(0,h.jsxs)(`section`,{className:`task-conversations`,"aria-label":x(`Task conversations`),children:[(0,h.jsx)(`h3`,{children:x(`Task conversations`)}),(0,h.jsx)(Aa,{pager:E,scope:r,onScope:d,exclude:ee.map(e=>e.runId)},n)]}),A=t.rootLabel.split(/[\\/]/).filter(Boolean).at(-1)??t.rootLabel,j=m.filter(e=>e.status===`running`||e.status===`queued`||e.id===g),te=e=>(0,h.jsxs)(`button`,{type:`button`,className:`session-item${e.id===g?` active`:``}`,onClick:()=>v?.(e.id),title:e.title,children:[(0,h.jsx)(`span`,{className:`session-icon`,children:(0,h.jsx)(me,{})}),(0,h.jsxs)(`span`,{className:`session-info`,children:[(0,h.jsx)(`span`,{className:`session-title`,children:e.title}),(0,h.jsxs)(`span`,{className:`session-sub`,children:[x(`Ordinary`),` · `,S(e.status)]})]})]},e.id);return(0,h.jsxs)(`aside`,{className:`panel panel-left lp-panel`,children:[(0,h.jsxs)(`div`,{className:`lp-new`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`new-conversation`,onClick:y??f,children:[(0,h.jsx)(pe,{"aria-hidden":`true`}),x(y?`New conversation`:`New task`)]}),y&&(0,h.jsx)(`button`,{type:`button`,className:`new-task-shortcut`,"aria-label":x(`New task`),title:x(`New task`),onClick:f,children:(0,h.jsx)(ke,{})})]}),(0,h.jsx)(Oa,{title:x(`Recent projects`),className:`projects`,children:_?(0,h.jsxs)(h.Fragment,{children:[_.map(e=>(0,h.jsxs)(`button`,{type:`button`,className:`session-item project-item${e.current?` active`:``}`,title:e.path,onClick:()=>e.current?p():b?.(e.path),children:[(0,h.jsx)(`span`,{className:`session-icon`,children:(0,h.jsx)(Ce,{})}),(0,h.jsxs)(`span`,{className:`session-info`,children:[(0,h.jsx)(`span`,{className:`session-title`,children:e.path.split(/[\\/]/).filter(Boolean).at(-1)??e.path}),(0,h.jsx)(`span`,{className:`session-sub`,children:e.path})]})]},e.path)),(0,h.jsxs)(`button`,{type:`button`,className:`project-open`,onClick:()=>b?.(),children:[(0,h.jsx)(pe,{}),x(`Open working folder`)]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`button`,{type:`button`,className:`session-item project-item active`,title:t.rootLabel,onClick:p,children:[(0,h.jsx)(`span`,{className:`session-icon`,children:(0,h.jsx)(Ce,{"aria-hidden":`true`})}),(0,h.jsxs)(`span`,{className:`session-info`,children:[(0,h.jsx)(`span`,{className:`session-title`,children:A}),(0,h.jsx)(`span`,{className:`session-sub`,children:t.rootLabel})]})]}),(0,h.jsx)(`p`,{className:`panel-hint`,children:x(`This service exposes one project. Opening it never starts work.`)})]})}),(0,h.jsxs)(Oa,{title:x(`Running conversations`),count:o?.status===`complete`?String(ee.length+j.length):`?`,className:`running-conversations`,children:[o?.status!==`complete`&&(0,h.jsx)(`p`,{className:`panel-hint`,children:x(`Active roster unavailable; absence is not proof of settlement.`)}),j.map(te),o?.status===`complete`&&ee.length===0&&j.length===0&&(0,h.jsx)(`p`,{className:`panel-hint`,children:x(`No active runs`)}),ee.map(e=>{let t=D.find(t=>t.owner.taskId===e.taskId)?.goal;return(0,h.jsxs)(`div`,{className:`conversation-group`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`session-item${n===e.taskId&&r?.kind===`task`?` active`:``}`,onClick:()=>u(e.taskId,t),title:e.runId,children:[(0,h.jsx)(`span`,{className:`status-dot busy`,"aria-hidden":`true`}),(0,h.jsxs)(`span`,{className:`session-info`,children:[(0,h.jsx)(`span`,{className:`session-title`,children:t??x(`Task {id}`,{id:e.taskId.slice(0,8)})}),(0,h.jsxs)(`span`,{className:`session-sub`,children:[S(e.kind),` · `,S(e.stage)]})]})]}),(0,h.jsxs)(`button`,{type:`button`,className:`conversation-stop`,disabled:!s||c.has(e.runId),onClick:()=>l(e.runId),children:[(0,h.jsx)(le,{"aria-hidden":`true`}),x(`Cancel run — request stop`)]}),n===e.taskId&&(0,h.jsx)(ka,{runs:i.filter(t=>t.runId===e.runId),scope:r,onScope:d})]},e.runId)})]}),(0,h.jsxs)(Oa,{title:x(`Conversation history`),count:T.page&&!(`kind`in T.page)?`${O.length}${T.page.next||T.canPrevious?`+`:``}`:`?`,className:`grow`,children:[(0,h.jsxs)(`nav`,{"aria-label":x(`Tasks`),className:`task-list`,children:[m.filter(e=>!j.includes(e)).map(te),O.map(e=>(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`button`,{type:`button`,className:`session-item${e.owner.taskId===n&&r?.kind===`task`?` active`:``}`,"aria-current":e.owner.taskId===n&&r?.kind===`task`?`true`:void 0,title:e.goal,onClick:()=>u(e.owner.taskId,e.goal),children:[(0,h.jsx)(`span`,{className:`session-icon`,children:(0,h.jsx)(me,{"aria-hidden":`true`})}),(0,h.jsxs)(`span`,{className:`session-info`,children:[(0,h.jsx)(`span`,{className:`session-title`,children:e.goal}),(0,h.jsx)(`span`,{className:`session-sub`,children:x(`Task {id}`,{id:e.owner.taskId.slice(0,8)})})]})]}),e.owner.taskId===n&&k]},e.owner.taskId)),T.page&&!(`kind`in T.page)&&O.length===0&&(0,h.jsx)(`p`,{className:`panel-hint`,children:x(`No retained task on this page.`)}),(0,h.jsx)(yi,{pager:T,compact:!0})]}),!O.some(e=>e.owner.taskId===n)&&k]})]})}function Ma(e,t,n){let r=new URL(window.location.origin+window.location.pathname),i=Ci();i&&r.searchParams.set(`project`,i);let a=new URLSearchParams({task:G(e)});if(n&&(a.set(`scope`,JSON.stringify(yt(n.scope))),n.snapshotSeq&&a.set(`snapshot`,q(n.snapshotSeq))),t){let{navigation:e,...n}=t;a.set(`detail`,JSON.stringify(n))}return r.hash=a.toString(),r.href}function Na(){try{let e=new URLSearchParams(window.location.hash.slice(1)),t=G(e.get(`task`)),n=e.get(`detail`),r=e.get(`scope`),i=e.get(`snapshot`),a=r?yt(qe(r)):void 0,o=i?q(i):void 0;if(a?.kind===`task`&&a.id!==t||o&&!a)return null;if(!n)return{taskId:t,scope:a,snapshotSeq:o};let s=xt(qe(n));return s.navigation?null:{taskId:t,cursor:s,scope:a,snapshotSeq:o}}catch{return null}}function Pa(e){let t=e.start.above+e.start.below,n=Math.max(1,e.availablePx)/(e.totalWeight>0?e.totalWeight:1),r=e.minAbovePx/n,i=e.minBelowPx/n;if(r+i>=t){let n=e.minAbovePx+e.minBelowPx||1,r=t*e.minAbovePx/n;return{above:r,below:t-r}}let a=Math.min(t-i,Math.max(r,e.start.above+e.deltaPx/n));return{above:a,below:t-a}}function Fa({side:e,width:t,onResize:n}){let{t:r}=C(),i=(0,f.useRef)(void 0);return(0,f.useEffect)(()=>()=>i.current?.(),[]),(0,h.jsx)(`input`,{type:`range`,min:220,max:600,step:20,value:t,onChange:e=>n(Number(e.target.value)),className:`resize-handle`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":r(e===`left`?`Resize left pane`:`Resize right pane`),"aria-valuemin":220,"aria-valuemax":600,"aria-valuenow":t,onDoubleClick:()=>n(e===`left`?260:360),onPointerDown:r=>{r.preventDefault(),i.current?.();let a=r.clientX,o=window.innerWidth,s=r=>{let i=Pa({start:{above:t,below:Math.max(1,o-t)},deltaPx:(r.clientX-a)*(e===`left`?1:-1),availablePx:o,totalWeight:o,minAbovePx:220,minBelowPx:320});n(Math.min(600,i.above))},c=()=>{window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),i.current=void 0};i.current=c,window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c,{once:!0}),window.addEventListener(`pointercancel`,c,{once:!0})}})}function Ia(e,t,n,r){(0,f.useEffect)(()=>{if(!n||!t)return;let i=e.current?.querySelector(`.drawer-${t}`),a=document.activeElement,o=()=>Array.from(i?.querySelectorAll(`button:not(:disabled),input,textarea,select,a[href],[tabindex="0"]`)??[]).filter(e=>e.getClientRects().length>0);(o()[0]??i)?.focus({preventScroll:!0});let s=e=>{if(e.key===`Escape`&&(e.preventDefault(),r()),e.key===`Tab`){let t=o(),n=t[0],r=t[t.length-1];if(!n){e.preventDefault();return}e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus({preventScroll:!0})):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus({preventScroll:!0}))}};return i?.addEventListener(`keydown`,s),()=>{i?.removeEventListener(`keydown`,s),a instanceof HTMLElement&&a.isConnected&&a.focus({preventScroll:!0})}},[e,t,n,r])}var La=.4,Ra=1.05;function za(e){return Math.min(300,e*.86)}function Ba(e,t,n){return n||(t<=144?null:e<=72?`left`:t-e<=72?`right`:null)}function Va(e,t){let n=Math.abs(e),r=Math.abs(t);return n<12&&r<12?`none`:n>r*1.2?`horizontal`:`vertical`}function Ha(e,t){return e===`left`?t:-t}function Ua(e,t){return Math.max(-e,Math.min(0,-e+t))}function Wa(e,t,n){let r=n?e+t:t;return Math.max(0,Math.min(1,r/e))}function Ga(e){let{wasOpen:t,pull:n,width:r,durationMs:i}=e;return i<=320&&Math.abs(n)>=48?n>0:Wa(r*Ra,n,t)>=La}var Ka=new Set([`auto`,`scroll`,`overlay`]);function qa(e,t){let n=e instanceof Element?e:null;for(;n;){if(n instanceof HTMLElement&&n.scrollWidth>n.clientWidth+4&&Ka.has(getComputedStyle(n).overflowX))return!0;if(n===t)break;n=n.parentElement}return!1}function Ja(){let e=e=>{e.stopPropagation(),e.preventDefault()};window.addEventListener(`click`,e,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener(`click`,e,{capture:!0}),400)}function Ya(e){let{enabled:t,open:n,onOpenChange:r,container:i}=e,{panelSelector:a,backdropSelector:o}=e;(0,f.useEffect)(()=>{let e=i.current;if(!t||!e)return;let s=null,c=`none`,l=0,u=0,d=0,f=0,p=!1,m=0,h=0,g=null,_=null,v=()=>{g&&(g.classList.remove(`drawer-dragging`),g.style.transform=``),_&&(_.style.opacity=``),s=null,c=`none`,g=null,_=null,f=0,p=!1},y=t=>{if(v(),t.touches.length!==1)return;let r=t.touches[0];if(!r)return;let i=Ba(r.clientX,window.innerWidth,n);i&&!qa(t.target,e)&&(s=i,l=r.clientX,u=r.clientY,d=Date.now())},b=t=>{let r=s;if(!r||t.touches.length!==1)return;let i=t.touches[0];if(!i)return;let d=i.clientX-l,v=i.clientY-u;if(c===`none`){let t=Va(d,v);if(t===`none`)return;if(t===`vertical`){s=null;return}c=`horizontal`,p=n===r,m=za(window.innerWidth),h=m*Ra;let i=e.querySelector(a?a(r):`.panel-drawer.drawer-${r}`);if(!i){s=null;return}g=i,_=o===null?null:e.querySelector(o??`.drawer-backdrop`),i.classList.add(`drawer-dragging`)}let y=g;if(!y)return;f=Ha(r,d);let b=Ua(h,p?h+f:f);y.style.transform=`translateX(${r===`left`?b:-b}px)`,_&&(_.style.opacity=String(Wa(h,f,p))),t.preventDefault()},x=()=>{let e=s,t=c===`horizontal`&&e!==null&&g!==null,i=f,a=Date.now()-d,o=t?Ga({wasOpen:p,pull:i,width:m,durationMs:a}):!1;v(),t&&e&&o!==(n===e)&&(Ja(),r(o?e:null))},S=()=>v();return e.addEventListener(`touchstart`,y,{passive:!0}),e.addEventListener(`touchmove`,b,{passive:!1}),e.addEventListener(`touchend`,x),e.addEventListener(`touchcancel`,S),()=>{v(),e.removeEventListener(`touchstart`,y),e.removeEventListener(`touchmove`,b),e.removeEventListener(`touchend`,x),e.removeEventListener(`touchcancel`,S)}},[t,n,r,i,a,o])}function Xa(e,t,n,r,i=`en`){let a=(e,t)=>v(i,e,t),o=t.filter(e=>e.kind===`owner-fact`||e.kind===`capture-fact`),s=o.map((e,t)=>{let n=e.kind===`owner-fact`?e.fact.kind:e.capture.event.kind,r=e.kind===`capture-fact`?e.link.childRunId:null,o=n.startsWith(`tool`)?`tools`:n.startsWith(`message`)?`model`:`input`;return{key:e.recordId,lane:o,group:`${r??`owner`}:${o}`,groupLabel:`${r??a(`Owner`)} · ${v(i,o)}`,kind:o===`tools`?`tool`:o===`model`?`text`:`system`,title:`#${e.committedSeq} ${n}`,summary:n,source:a(`Committed #{seq}; {who}`,{seq:e.committedSeq,who:r??a(`owner`)}),status:a(`recorded fact`),clock:e.kind===`capture-fact`?a(`Worker-local monotonic observations ({child}): {first}–{last} ms; not aligned to other workers.`,{child:e.link.childRunId,first:e.capture.source.firstObservedMs,last:e.capture.source.lastObservedMs}):a(`Owner observation ({epoch}): {ms} ms; clock origin not established by this reader.`,{epoch:e.link.epoch,ms:e.observedMs}),...e.kind===`owner-fact`&&e.fact.kind===`check-settled`?{dur:e.fact.native.durationMs}:{},t:t*1e3,end:t*1e3}}),c;return{lang:i,onData(e){return c=e,()=>{c=void 0}},readState(){c?.({kind:`state`,conversations:[{id:e,title:a(`{scope} — loaded committed page`,{scope:e}),isStreaming:!1,segCount:s.length}],activeId:e})},readSegments(t){t===e&&c?.({kind:`segs`,convId:t,segs:s,reset:!0})},readSegment(t,n){let r=s.findIndex(e=>e.key===n);t!==e||r<0||c?.({kind:`seg_detail`,convId:t,key:n,seg:s[r],detail:JSON.stringify(o[r],null,2),analysis:{position:a(`Committed sequence {seq}; page ordinal {ordinal}. Timing shown in raw facts only; clocks may not be comparable.`,{seq:o[r].committedSeq,ordinal:r+1})}})},openDetail(t,r){let i=o.find(e=>e.recordId===r);t===e&&i&&n(i)},searchHistory:r}}var Za=`modulepreload`,Qa=function(e){return`/`+e},$a={},eo=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Qa(t,n),t=s(t),t in $a)return;$a[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Za,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function to({client:e,seed:t,onSearch:n}){let{t:r}=C(),i=ui(e,{...t,reader:`events`}),a=i.page;return(0,h.jsxs)(`section`,{className:`timeline-view`,children:[(0,h.jsx)(`p`,{children:r(`Committed order, not wall time. Replay advances visualization only. Raw observations retain clock/sequence provenance; unknown timing is not reconstructed.`)}),(0,h.jsx)(yi,{pager:i}),a&&!(`kind`in a)&&(0,h.jsx)(no,{client:e,seed:a.request,records:a.records,onSearch:n},`${a.request.snapshotSeq}:${a.request.after?.recordId??`first`}`)]})}function no({client:e,seed:t,records:n,onSearch:r}){let{t:i,locale:a}=C(),o=(0,f.useRef)(null),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(!1),d=(0,f.useRef)(r);return d.current=r,(0,f.useEffect)(()=>{let e=!1,r;return eo(()=>import(`./timeline-client.js`).then(i=>{!e&&o.current&&(r=i.default.mount(o.current,Xa(t.scope.id,n,()=>c(!0),()=>d.current(),a)))}),[]).catch(()=>{e||u(!0)}),()=>{e=!0,r?.()}},[n,t.scope.id,a]),(0,h.jsxs)(h.Fragment,{children:[l&&(0,h.jsx)(`p`,{role:`alert`,children:i(`Bundled timeline unavailable; retained events remain accessible, no CDN fallback.`)}),(0,h.jsx)(`div`,{className:`timeline-mount`,ref:o}),s&&(0,h.jsx)(bi,{client:e,seed:t})]})}function ro(){let e=new URLSearchParams(window.location.hash?.slice(1)).get(`chat`);return e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(e)?e:null}var io=[[`tools`,ce],[`context`,ye],[`timeline`,je],[`runs`,Se],[`outcomes`,Le]];function ao({error:e,observationError:t}){let{t:n,tx:r}=C();return!e&&!t?null:(0,h.jsxs)(`p`,{className:`banner-notice`,role:`alert`,children:[e&&(0,h.jsxs)(h.Fragment,{children:[e,` `]}),t&&(0,h.jsxs)(h.Fragment,{children:[n(`{message}.`,{message:r(t)}),` `,t===`stale`?n(`Context changed. Observe again and request a fresh confirmation.`):(0,h.jsx)(y,{text:n(`Explicit service guidance: {status} / {start}. No service is started by this page.`),slots:{status:(0,h.jsx)(`code`,{children:`cadence-service status`}),start:(0,h.jsx)(`code`,{children:`cadence-service start --workspace <path>`})}})]})]})}function oo({api:e,planMetadata:t,onOpenProject:n,onWorkbenchHome:r,projectEntries:i}){let{t:a,tx:o,locale:s,setLocale:c}=C(),[l]=(0,f.useState)(()=>e??Er()),[u,d]=(0,f.useState)(!1),[p,m]=(0,f.useState)(!1),[g]=(0,f.useState)(Na),[_,v]=(0,f.useState)(g?.taskId??null),[b,x]=(0,f.useState)(()=>g?null:ro()??crypto.randomUUID()),[S,w]=(0,f.useState)(null),[T,E]=(0,f.useState)(null),[D,ee]=(0,f.useState)(g?`task`:`files`),[O,k]=(0,f.useState)(),A=(0,f.useCallback)(()=>k(void 0),[]),[j,te]=(0,f.useState)(g?g.scope??{kind:`task`,id:g.taskId}:null),M=Fr(l,_?{kind:`task`,id:_}:null,!p),ne=(0,f.useRef)(null);M.workspace&&(ne.current=M.workspace.workspaceId);let re=jr(l.client,M.workspace&&!p?{kind:`conversations`}:null,2e3),N=jr(l.client,M.workspace&&!p?{kind:`projects`}:null),ie=(N.value?.kind===`projects`?N.value.entries.find(e=>e.current)?.path:void 0)??M.workspace?.rootLabel,ae=jr(l.client,_&&M.workspace&&!p?{kind:`task-origin`,taskId:_}:null),oe=ae.value?.kind===`task-origin`?ae.value.conversationId:null,se={state:M.observation,transportStatus:M.transportStatus,error:M.error,refresh:M.refresh},ce=M.workspace?.storeId,de=(0,f.useMemo)(()=>t??(ce?kr(l.client,ce):void 0),[t,l,ce]),_e=se.state?.snapshot.scope.kind===`task`&&se.state.snapshot.scope.id===_?se.state.snapshot.context:void 0,xe=_e?.status===`available`?_e.version:null,Se=M.actions&&se.state?.connection===`current`&&se.transportStatus===`current`&&!!xe&&xe.epoch===M.workspace?.epoch,[we,Te]=(0,f.useState)(null),[Ee,De]=(0,f.useState)(!1),Ae=(0,f.useRef)(null),[je,Me]=(0,f.useState)(260),[Ne,Fe]=(0,f.useState)(360),Ie=(0,f.useCallback)(()=>Te(null),[]);(0,f.useEffect)(()=>{let e=matchMedia(`(max-width: 900px)`),t=()=>De(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),Ya({enabled:Ee&&!p,open:we,onOpenChange:Te,container:Ae}),Ia(Ae,we,Ee&&!p,Ie);let[Le,Re]=(0,f.useState)(g?.snapshotSeq),[ze,Be]=(0,f.useState)(``),[Ve,P]=(0,f.useState)(``),[He,F]=(0,f.useState)(!0),Ue=(0,f.useRef)(null),[I,L]=(0,f.useState)(`messages`),[We,R]=(0,f.useState)(!1),[z,B]=(0,f.useState)(!1),[V,H]=(0,f.useState)(),[U,W]=(0,f.useState)(g?.cursor),[G,K]=(0,f.useState)(!1),[q,Ge]=(0,f.useState)(``),[Ke,qe]=(0,f.useState)(`code`),[Je,Ye]=(0,f.useState)(),[Xe,Ze]=(0,f.useState)(!1),[Qe,$e]=(0,f.useState)(``),[et,tt]=(0,f.useState)([]),[nt,rt]=(0,f.useState)(new Set),Y=(0,f.useRef)(!0),it=(0,f.useRef)(null),at=e=>{Y.current&&tt(t=>{let n=t.findIndex(t=>t.commandId===e.commandId);return n<0?[...t,e]:t.map((t,r)=>r===n?Ar(t,e):t)})},X=(0,f.useRef)(new Ir),ot=J({taskId:_,scope:j,selectedSnapshot:Le??null,detached:p,context:xe,attachment:M.attachmentVersion,workspaceContext:M.workspace?.context??null,observationError:M.error??null});X.current.select(ot);let[st,ct]=(0,f.useState)(ot);st!==ot&&(ct(ot),Ze(!1),Ye(void 0)),(0,f.useEffect)(()=>(Y.current=!0,()=>{Y.current=!1,it.current?.abort(),X.current.depart()}),[]);let lt=Je?.preflight.preview.action.kind===`create`?M.workspace?.context.status===`available`?M.workspace.context.version:null:xe,ut=async e=>{let t=e.kind===`create`?M.workspace?.context.status===`available`?M.workspace.context.version:null:xe;if(!M.actions||!t||Xe||p){$e(a(`Current action context unavailable; observe again.`));return}X.current.depart();let n=X.current.ticket();Ze(!0),$e(``);try{let r=await xr(l.client,t,e);if(!X.current.current(n))return;r.kind===`error`?$e(a(`Preflight refused: {code}`,{code:r.error.code})):Ye(r.value)}catch{X.current.current(n)&&$e(a(`Preflight unavailable. No automatic retry.`))}finally{X.current.current(n)&&Ze(!1)}},dt=(e=crypto.randomUUID())=>{it.current?.abort(),X.current.depart(),Ye(void 0),Ze(!1),x(e),v(null),te(null),Be(``),P(``),H(void 0),W(void 0),Re(void 0),L(`messages`),ee(`files`),Ie(),history.replaceState(null,``,`${location.pathname}${location.search}#chat=${e}`)};(0,f.useEffect)(()=>{b&&!window.location.hash&&history.replaceState(null,``,`${location.pathname}${location.search}#chat=${b}`)},[b]);let ft=(e,t)=>{it.current?.abort(),w(null),x(null),ee(`task`),Be(t??``),P(``),Re(void 0),X.current.depart(),Ye(void 0),Ze(!1),v(e),te({kind:`task`,id:e}),H(void 0),W(void 0),L(`messages`),Ie(),history.replaceState(null,``,Ma(e))};(0,f.useEffect)(()=>{let e=()=>{it.current?.abort();let e=Na();if(e)x(null),ee(`task`),X.current.depart(),Ye(void 0),Ze(!1),Re(e.snapshotSeq),Be(``),P(``),v(e.taskId),te(e.scope??{kind:`task`,id:e.taskId}),H(void 0),W(e.cursor),L(`messages`),Ie();else{let e=ro();e&&(x(e),v(null),te(null),ee(`files`),Ye(void 0),X.current.depart(),Ie())}};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[Ie]);let pt=(e,t,n)=>{Re(t),P(n??``),X.current.depart(),Ye(void 0),Ze(!1),te(e),H(void 0),W(void 0),L(`messages`),Ie(),_&&history.replaceState(null,``,Ma(_,void 0,{scope:e,snapshotSeq:t}))},mt=Le??se.state?.snapshot.committedSeq??M.workspace?.committedSeq,ht=M.workspace?.storeId,gt=j&&ht&&mt?{storeId:ht,scope:j,snapshotSeq:mt,reader:`messages`,after:null,limit:50}:null,Z=j&&ht&&mt?{storeId:ht,scope:j,snapshotSeq:mt,query:null,recordId:null,recordVersion:null,field:null,offset:0}:null,_t=_e?se.state?.snapshot.runs??[]:[],vt=X.current.ticket(),yt=e=>{if(at(e),e.receipt&&X.current.current(vt)&&(M.refresh(),e.receipt.created)){it.current?.abort();let t=new AbortController;it.current=t;let n=S&&re.value?.kind===`conversations`&&re.value.entries.some(e=>e.id===S)?S:null,r=M.workspace?.epoch;(async()=>{for(;Y.current&&!t.signal.aborted;){let i=await l.client.receipt(e.commandId,t.signal);if(!Y.current||t.signal.aborted)return;if(at({commandId:e.commandId,lookup:i}),i.status===`found`&&i.receipt.created?.state===`published`){let o=i.receipt.created.taskId;if(n&&r){let i=await l.client.workbenchCommand({kind:`link-task`,commandId:e.commandId,epoch:r,taskId:o,conversationId:n});if(!Y.current||t.signal.aborted)return;i.kind!==`ok`&&$e(a(`Task created, but its conversation link was not confirmed.`))}ft(o);return}if(i.status!==`found`||i.receipt.publication!==`pending`)return;await new Promise(e=>setTimeout(e,500))}})()}},bt=e=>{if(nt.has(e)||!M.cancelCompatible||!M.activeRuns)return;let t=crypto.randomUUID(),n=M.activeRuns.epoch;rt(t=>new Set(t).add(e)),at({commandId:t,error:a(`Stop requested; settlement is not yet confirmed.`)}),l.client.cancel({commandId:t,epoch:n,runId:e}).then(e=>{yt(e.kind===`ok`?{commandId:t,receipt:e.value}:{commandId:t,error:a(`{code}; cancellation effect {effect}. Observe exact receipt.`,{code:e.error.code,effect:e.error.effect})})}).catch(()=>at({commandId:t,error:a(`Cancellation effect uncertain. Observe exact receipt.`)})).finally(()=>{Y.current&&rt(t=>{let n=new Set(t);return n.delete(e),n})})};if(p)return(0,h.jsxs)(`main`,{className:`entry`,children:[(0,h.jsx)(`span`,{className:`empty-logo`,"aria-hidden":`true`,children:`C`}),(0,h.jsx)(`h1`,{children:a(`Detached`)}),(0,h.jsx)(`p`,{children:a(`Accepted service work continues. No Cancel was requested.`)}),et.map(e=>(0,h.jsxs)(`p`,{children:[a(`Observe command after reconnect:`),` `,(0,h.jsx)(`code`,{children:e.commandId})]},e.commandId)),(0,h.jsx)(`button`,{type:`button`,className:`primary`,onClick:()=>m(!1),children:a(`Reconnect as a viewer`)})]});let xt=M.activeRuns,St=xt?.status===`complete`?xt.runs:[],Ct=se.state?.connection??(M.workspace?_?`Task snapshot not observed yet`:`Chat ready`:`Service unavailable`);return(0,h.jsxs)(`div`,{className:`app${He?``:` inspector-hidden`}`,children:[(0,h.jsxs)(`header`,{className:`topbar`,children:[(0,h.jsx)(`button`,{type:`button`,className:`panel-toggle`,"aria-label":a(`Tasks`),onClick:()=>Te(e=>e===`left`?null:`left`),children:(0,h.jsx)(he,{"aria-hidden":`true`})}),(0,h.jsxs)(`div`,{className:`topbar-flow`,children:[r&&(0,h.jsx)(`button`,{type:`button`,className:`icon-btn`,"aria-label":a(`Workbench projects`),title:a(`Workbench projects`),onClick:r,children:(0,h.jsx)(Ce,{})}),(0,h.jsxs)(`span`,{className:`brand`,children:[(0,h.jsx)(`span`,{className:`brand-logo`,"aria-hidden":`true`,children:`C`}),(0,h.jsx)(`h1`,{className:`brand-name`,children:`Cadence`})]}),M.workspace&&(0,h.jsxs)(`span`,{className:`chip static chip-root`,title:M.workspace.rootLabel,children:[(0,h.jsx)(Ce,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:M.workspace.rootLabel})]}),(0,h.jsx)(`span`,{className:`tb-spacer`,"aria-hidden":`true`}),(0,h.jsxs)(`nav`,{className:`tb-tabs`,"aria-label":a(`Recorded views`),children:[(0,h.jsxs)(`button`,{type:`button`,className:`tb-tab`,"aria-pressed":I===`messages`&&!U,onClick:()=>{W(void 0),H(void 0),L(`messages`)},children:[(0,h.jsx)(me,{"aria-hidden":`true`}),a(`Conversation`)]}),(0,h.jsxs)(`details`,{className:`view-menu`,ref:Ue,onKeyDown:e=>{e.key===`Escape`&&Ue.current&&(Ue.current.open=!1,Ue.current.querySelector(`summary`)?.focus())},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(e.currentTarget.open=!1)},children:[(0,h.jsxs)(`summary`,{className:`chip`,children:[I===`messages`?a(`Details`):o(I),(0,h.jsx)(Pe,{"aria-hidden":`true`})]}),(0,h.jsxs)(`div`,{className:`view-menu-items`,children:[io.map(([e,t])=>(0,h.jsxs)(`button`,{type:`button`,"aria-pressed":I===e,onClick:()=>{W(void 0),H(void 0),L(e),Ue.current&&(Ue.current.open=!1,Ue.current.querySelector(`summary`)?.focus())},children:[(0,h.jsx)(t,{"aria-hidden":`true`}),o(e)]},e)),(0,h.jsxs)(`div`,{className:`view-menu-actions`,children:[(0,h.jsxs)(`button`,{type:`button`,"aria-label":a(`Export selected scope`),disabled:!gt,onClick:()=>{Ue.current&&(Ue.current.open=!1,Ue.current.querySelector(`summary`)?.focus()),B(!0)},children:[(0,h.jsx)(Oe,{"aria-hidden":`true`}),a(`Export selected scope`)]}),(0,h.jsxs)(`button`,{type:`button`,"aria-label":a(`Copy token-free link`),disabled:!_,onClick:()=>{_&&Wr(Ma(_,U,j?{scope:j,snapshotSeq:Le}:void 0)).then(e=>$e(e?``:a(`Link copy unavailable.`)))},children:[(0,h.jsx)(ve,{"aria-hidden":`true`}),a(`Copy token-free link`)]})]})]})]})]}),(0,h.jsx)(`span`,{className:`tb-spacer`,"aria-hidden":`true`}),(0,h.jsxs)(`div`,{className:`tb-actions`,children:[(0,h.jsx)(Pi,{disabled:!Z,onOpen:()=>R(!0)}),(0,h.jsx)(`button`,{type:`button`,className:`chip`,"aria-label":a(`Observe current state`),"data-tip":a(`Observe current state`),onClick:()=>{M.refresh(),se.refresh()},children:(0,h.jsx)(fe,{"aria-hidden":`true`})}),(0,h.jsxs)(`button`,{type:`button`,className:`chip`,"aria-label":a(`Choose owner model`),"data-tip":a(`Choose owner model`),onClick:()=>d(!0),children:[(0,h.jsx)(ke,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`chip-label`,children:a(`Model`)})]}),(0,h.jsxs)(`button`,{type:`button`,className:`chip`,"aria-label":a(`Return — work continues`),"data-tip":a(`Return — accepted work continues`),onClick:()=>{Ye(void 0),Te(null),R(!1),B(!1),X.current.depart(),Ze(!1),it.current?.abort(),m(!0)},children:[(0,h.jsx)(ge,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`chip-label`,children:a(`Return`)})]}),(0,h.jsxs)(`button`,{type:`button`,className:`chip chip-lang`,lang:s===`zh`?`en`:`zh-CN`,"aria-label":s===`zh`?`Switch to English`:`切换到中文`,"data-tip":s===`zh`?`Switch to English`:`切换到中文`,onClick:()=>c(s===`zh`?`en`:`zh`),children:[(0,h.jsx)(be,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:s===`zh`?`EN`:`中文`})]})]})]}),(0,h.jsxs)(`button`,{type:`button`,className:`panel-toggle has-label inspector-toggle`,"aria-label":a(`Plan / review`),"aria-expanded":Ee?we===`right`:He,onClick:()=>Ee?Te(e=>e===`right`?null:`right`):F(e=>!e),children:[(0,h.jsx)(ue,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:a(b?`Files`:`Plan`)})]})]}),!M.workspace&&St.length>0&&(0,h.jsx)(`section`,{className:`run-strip`,"aria-label":a(`Execution and cancellation`),children:St.map(e=>(0,h.jsxs)(`div`,{className:`run-strip-row`,children:[(0,h.jsx)(`span`,{className:`status-dot busy`,"aria-hidden":`true`}),(0,h.jsxs)(`span`,{className:`run-strip-label`,children:[o(e.kind),` `,e.runId,` · `,o(e.stage)]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>ft(e.taskId),children:a(`Open active task`)}),(0,h.jsxs)(`button`,{type:`button`,className:`danger`,disabled:!M.cancelCompatible||nt.has(e.runId),onClick:()=>bt(e.runId),children:[(0,h.jsx)(le,{"aria-hidden":`true`}),a(`Cancel run — request stop`)]})]},e.runId))}),(0,h.jsx)(ao,{error:Qe,observationError:M.error}),(0,h.jsxs)(`div`,{ref:Ae,className:`layout`,style:{"--left-w":`${je}px`,"--right-w":`${Ne}px`},children:[(0,h.jsx)(`button`,{type:`button`,"aria-label":a(`Close drawer`),tabIndex:-1,className:`drawer-backdrop persistent${we?` on`:``}`,onClick:Ie}),(0,h.jsxs)(`section`,{className:`panel-drawer drawer-left${we===`left`?` open`:``}`,"aria-label":a(`Task navigation drawer`),tabIndex:-1,inert:Ee&&we!==`left`,children:[M.workspace&&(0,h.jsx)(ja,{client:l.client,workspace:M.workspace,taskId:_,scope:j,runs:_t,snapshot:se.state?.snapshot.committedSeq,activeRuns:M.activeRuns,cancelCompatible:!!M.cancelCompatible,canceling:nt,onCancel:bt,onProject:()=>dt(),chats:re.value?.kind===`conversations`?re.value.entries:[],conversationId:b,projects:i??(N.value?.kind===`projects`?N.value.entries:[{path:M.workspace.rootLabel,current:!0}]),onConversation:dt,onNewConversation:()=>dt(),onOpenProject:e=>E(e??``),onTask:ft,onScope:pt,onNew:()=>{Ie(),w(null),K(!0)}}),M.workspace&&(0,h.jsx)(Ki,{client:l.client,active:M.activeRuns,taskId:_,runs:_t,snapshot:mt,onOpen:(e,t,n,r)=>{ft(e),te({kind:`child`,id:t}),P(r),Re(n),history.replaceState(null,``,Ma(e,void 0,{scope:{kind:`child`,id:t},snapshotSeq:n}))}})]}),(0,h.jsx)(Fa,{side:`left`,width:je,onResize:Me}),(0,h.jsxs)(`main`,{className:`main`,inert:Ee&&we!==null,children:[b&&(0,h.jsx)(la,{client:l.client,id:b,workspaceId:ne.current??`connecting`,available:!!M.workspace,canInterrupt:!!M.cancelCompatible,enabled:!!M.workspace&&!!M.compatible&&!M.error,onModel:()=>d(!0),onChanged:()=>{re.refresh(),M.refresh()},reference:O,onReferenceUsed:A,onCadence:e=>{Ge(e),w(b),K(!0)}},`${ne.current??`connecting`}:${b}`),j&&(0,h.jsxs)(`header`,{className:`conversation-header`,children:[(0,h.jsxs)(`div`,{className:`conversation-heading`,children:[j.kind!==`task`&&_&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>ft(_,ze),children:a(`Back to task`)}),oe&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>dt(oe),children:a(`Back to ordinary conversation`)}),(0,h.jsx)(`h2`,{title:ze||j.id,children:j.kind===`task`?ze||a(`Task {id}`,{id:j.id.slice(0,8)}):Ve||a(`{kind} {id}`,{kind:o(j.kind),id:j.id.slice(0,8)})}),j.kind===`child`&&(0,h.jsx)(`span`,{className:`conversation-badge`,children:a(`Subagent`)})]}),(0,h.jsxs)(`details`,{className:`conversation-info`,children:[(0,h.jsxs)(`summary`,{children:[a(`Recorded conversation`),` ·`,` `,a(`snapshot {seq}`,{seq:mt??``})]}),(0,h.jsx)(`code`,{children:j.id}),(0,h.jsx)(`p`,{children:a(`Pages and old outcomes are historical observations, not renewed consent.`)})]})]}),(0,h.jsxs)(`div`,{className:`workspace-content`,hidden:!!b,children:[!gt&&(0,h.jsxs)(`section`,{className:`empty-state`,children:[(0,h.jsx)(`span`,{className:`empty-logo`,"aria-hidden":`true`,children:`C`}),(0,h.jsx)(`h2`,{children:a(`Open a task or create one explicitly`)}),(0,h.jsx)(`p`,{children:a(`Plans, children, checks and human review share one service owner. No chat or discovery activates execution.`)}),(0,h.jsxs)(`button`,{type:`button`,className:`primary`,disabled:!M.workspace,onClick:()=>K(!0),children:[(0,h.jsx)(pe,{"aria-hidden":`true`}),a(`Create task`)]})]}),gt&&U?(0,h.jsxs)(`div`,{className:`tab-body`,children:[V&&(V.owner.entity.kind===`task`||V.owner.entity.kind===`message`||V.owner.entity.kind===`tool`)&&(0,h.jsx)(xi,{client:l.client,seed:{storeId:U.storeId,scope:U.scope,snapshotSeq:U.snapshotSeq,kind:V.owner.entity.kind,id:V.owner.entity.id,version:V.owner.entity.version}},`${V.owner.entity.id}:${V.owner.entity.version}`),(0,h.jsx)(vi,{client:l.client,cursor:U,highlight:V?.range},`${U.recordId}:${U.recordVersion}`)]}):gt&&(0,h.jsxs)(`div`,{className:I===`messages`||I===`tools`?`tab-body transcript-body`:`tab-body`,children:[I===`messages`&&(0,h.jsx)(Ui,{client:l.client,seed:gt}),I===`tools`&&(0,h.jsx)(so,{client:l.client,seed:gt}),I===`context`&&(0,h.jsx)(bi,{client:l.client,seed:gt}),I===`timeline`&&(0,h.jsx)(to,{client:l.client,seed:gt,onSearch:()=>R(!0)}),I===`runs`&&(0,h.jsx)(Ni,{client:l.client,seed:{...gt,scope:{kind:`task`,id:_??gt.scope.id}},onScope:pt},_),I===`outcomes`&&(_t.length>0?_t.map(e=>(0,h.jsx)(Ai,{run:e},e.childRunId??e.runId)):(0,h.jsx)(`p`,{className:`panel-empty`,children:_e&&se.state?a(`No owner run projection in this snapshot.`):a(`No snapshot observed yet; absence is not proof of settlement.`)}))]},`${j?.kind}:${j?.id}:${Le??`current`}`)]}),M.workspace&&et.length>0&&(0,h.jsx)(`div`,{className:`receipt-dock`,children:et.map(e=>(0,h.jsx)(ai,{client:l.client,value:e,onChange:at},e.commandId))})]}),(0,h.jsx)(Fa,{side:`right`,width:Ne,onResize:Fe}),(0,h.jsx)(`section`,{className:`panel-drawer drawer-right${we===`right`?` open`:``}`,"aria-label":a(`Plan and review drawer`),tabIndex:-1,inert:Ee&&we!==`right`,children:(0,h.jsxs)(`div`,{className:`workbench-right`,children:[(0,h.jsxs)(`nav`,{className:`rp-tabs`,"aria-label":a(`Workspace panels`),children:[(0,h.jsxs)(`button`,{type:`button`,className:`rp-tab`,"aria-pressed":D===`files`,onClick:()=>ee(`files`),children:[(0,h.jsx)(Ce,{}),a(`Files`)]}),(0,h.jsxs)(`button`,{type:`button`,className:`rp-tab`,"aria-pressed":D===`task`,disabled:!gt,onClick:()=>ee(`task`),children:[(0,h.jsx)(ye,{}),a(`Task details`)]})]}),D===`files`?(0,h.jsx)(da,{client:l.client,enabled:!!M.workspace,onReference:e=>{b||dt(oe??void 0),k(e),Ie()}}):gt?(0,h.jsx)(Ta,{client:l.client,context:xe,seed:{...gt,scope:{kind:`task`,id:_??gt.scope.id}},runs:_t,canAct:Se&&!Xe,onAction:e=>void ut(e),planMetadata:de},_):(0,h.jsx)(wa,{})]})})]}),(0,h.jsxs)(`footer`,{className:`statusbar`,children:[(0,h.jsxs)(`div`,{className:`statusbar-left`,children:[(0,h.jsxs)(`span`,{className:`status-item`,role:`status`,title:a(`Connection freshness is not execution outcome.`),children:[(0,h.jsx)(`span`,{className:`status-dot ${se.error||!M.workspace?`error`:se.transportStatus===`current`?se.state?se.state.connection===`current`?`ok`:`busy`:``:`busy`}`,"aria-hidden":`true`}),o(Ct),a(` · transport {status}`,{status:o(se.transportStatus)}),se.error?` · ${o(se.error)}`:``]}),(0,h.jsx)(`span`,{className:`status-item${xt?.status===`complete`?St.length>0?` warn`:``:` faint`}`,children:xt?.status===`complete`?St.length>0?a(St.length===1?`{count} active run`:`{count} active runs`,{count:St.length}):a(`No active runs`):a(`Active roster unavailable; absence is not proof of settlement.`)})]}),(0,h.jsxs)(`div`,{className:`statusbar-right`,children:[M.workspace&&(0,h.jsxs)(`button`,{type:`button`,className:`status-cwd`,title:ie,"aria-label":a(`Switch working folder`),onClick:()=>E(``),children:[(0,h.jsx)(Ce,{}),(0,h.jsx)(`span`,{children:ie}),(0,h.jsx)(Pe,{})]}),(0,h.jsxs)(`div`,{className:`status-item${M.compatible?` faint`:` warn`}`,title:Tr?.buildId??a(`unbuilt source`),children:[(0,h.jsxs)(`details`,{className:`build-part`,children:[(0,h.jsx)(`summary`,{children:a(`Build information`)}),(0,h.jsx)(y,{text:a(`Local browser build: {build}.`),slots:{build:(0,h.jsx)(`code`,{children:Tr?.buildId??a(`unbuilt source`)})}}),` `]}),(0,h.jsx)(`span`,{children:a(`Shared compatibility: {state}.`,{state:M.compatible?a(`compatible`):a(`unavailable / mismatch — reload built assets; normal actions disabled`)})})]})]})]}),T!==null&&M.workspace&&(0,h.jsx)(Ea,{onOpen:n,client:l.client,current:ie??M.workspace.rootLabel,initial:T||void 0,epoch:M.workspace.epoch,onClose:()=>E(null)}),u&&(0,h.jsx)(ii,{client:l.client,compatible:!!M.compatible&&M.transportStatus===`current`&&!M.error,onClose:()=>d(!1),onChanged:()=>{Ye(void 0),X.current.depart(),M.refresh(!0)}}),G&&(0,h.jsxs)(Lr,{title:a(`Create task`),onClose:()=>K(!1),children:[(0,h.jsxs)(`label`,{children:[a(`Kind`),(0,h.jsxs)(`select`,{"aria-label":a(`Kind`),value:Ke,onChange:e=>qe(e.target.value===`research`?`research`:e.target.value===`diagnosis`?`diagnosis`:`code`),children:[(0,h.jsx)(`option`,{value:`code`,children:a(`Code`)}),(0,h.jsx)(`option`,{value:`research`,children:a(`Readonly research`)}),(0,h.jsx)(`option`,{value:`diagnosis`,children:a(`Readonly diagnosis`)})]})]}),(0,h.jsxs)(`label`,{children:[a(`Goal`),(0,h.jsx)(`textarea`,{"aria-label":a(`Goal`),value:q,onChange:e=>Ge(e.target.value),rows:6})]}),(0,h.jsx)(`footer`,{children:(0,h.jsx)(`button`,{type:`button`,className:`primary`,disabled:!M.actions||M.workspace?.context.status!==`available`||Xe||!q.trim(),onClick:()=>{K(!1),ut({kind:`create`,taskKind:Ke,goal:q})},children:a(`Preview Create (does not Start)`)})})]}),Je&&(0,h.jsx)(ni,{prepared:Je,client:l.client,current:M.actions&&(Se||Je.preflight.preview.action.kind===`create`)?lt:null,attachmentVersion:M.attachmentVersion,onClose:()=>{X.current.current(vt)&&(X.current.depart(),Ye(e=>e===Je?void 0:e))},onResult:yt},Je.commandId),We&&Z&&(0,h.jsx)(ki,{client:l.client,seed:Z,onClose:()=>R(!1),onHit:e=>{H(e),W(e.cursor),_&&history.replaceState(null,``,Ma(_,e.cursor,j?{scope:j,snapshotSeq:Le}:void 0))}}),z&&Z&&(0,h.jsx)(Ei,{request:{storeId:Z.storeId,scope:Z.scope,snapshotSeq:Z.snapshotSeq,format:`ndjson`},onClose:()=>B(!1)})]})}function so({client:e,seed:t}){let n=ui(e,{...t,reader:`tools`}),r=n.page;return(0,h.jsxs)(`section`,{className:`tools-list`,children:[(0,h.jsx)(yi,{pager:n}),(0,h.jsx)(`div`,{className:`tools-body`,children:r&&!(`kind`in r)&&r.records.map(t=>t.kind===`tool`?(0,h.jsx)(Gi,{record:t,client:e,seed:r.request},`${t.owner.entity.id}:${t.version}`):null)})]})}async function co(e){return qe(await br(e,1048576),1048576)}function lo(e){return e&&typeof e==`object`&&`kind`in e&&e.kind===`error`&&`error`in e&&e.error&&typeof e.error==`object`&&`code`in e.error?String(e.error.code):`unavailable`}function uo(){let{t:e,locale:t,setLocale:n}=C(),[r,i]=(0,f.useState)(),[a,o]=(0,f.useState)(Ci),[s,c]=(0,f.useState)(null),[l,u]=(0,f.useState)(``),[d,p]=(0,f.useState)(0),m=(0,f.useRef)(new Map);(0,f.useEffect)(()=>{let e=new AbortController;return(async()=>{try{let t=await fetch(`/workbench/v1`,{credentials:`same-origin`,redirect:`error`,cache:`no-store`,signal:e.signal}),n=await co(t);t.status===400&&lo(n)===`invalid`?i(null):t.ok?(i(tr(n)),u(``)):u(lo(n))}catch{e.signal.aborted||u(`unavailable`)}})(),()=>e.abort()},[d]),(0,f.useEffect)(()=>{let e=()=>o(Ci());return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);let g=(0,f.useCallback)(e=>{a&&m.current.set(a,window.location.hash),history.pushState(null,``,e?`/app?project=${e.id}${m.current.get(e.id)??``}`:`/app`),o(e?.id??null),c(null)},[a]),_=(0,f.useCallback)(async e=>{if(!r||!Tr)throw Error(`unavailable`);let t=crypto.randomUUID(),n=await fetch(`/workbench/v1/open`,{method:`POST`,credentials:`same-origin`,redirect:`error`,headers:{"Content-Type":`application/json`,"X-Cadence-CSRF":r.csrf,"X-Cadence-Build":JSON.stringify({kind:`browser`,...Tr})},body:JSON.stringify({commandId:t,path:e,epoch:r.epoch})}),a=await co(n);if(!n.ok||!a||typeof a!=`object`||!(`kind`in a)||a.kind!==`project`||!(`project`in a))throw Error(lo(a));let o=er(a.project);i(e=>e&&{...e,projects:[...e.projects.filter(e=>e.id!==o.id),o]}),g(o)},[r,g]),v=(0,f.useMemo)(()=>({async workbenchRead(e,t){try{if(e.kind!==`directories`)throw new F(`invalid`);let n=await fetch(`/workbench/v1/directories?path=${encodeURIComponent(e.path)}`,{credentials:`same-origin`,redirect:`error`,signal:t}),r=await co(n);if(!n.ok)throw new F(`unavailable`);return{kind:`ok`,value:sr(r)}}catch{return{kind:`error`,error:Ue(`unavailable`)}}}}),[]),y=(0,f.useMemo)(()=>a?Er(a):void 0,[a]);if(r===null)return(0,h.jsx)(oo,{});let b=r?.projects.find(e=>e.id===a);return r&&b&&y?(0,h.jsx)(oo,{api:y,onOpenProject:_,onWorkbenchHome:()=>g(null),projectEntries:r.projects.map(e=>({path:e.cwd,current:e.id===a}))},`${b.id}:${b.epoch}`):(0,h.jsxs)(`div`,{className:`app workbench-entry`,children:[(0,h.jsxs)(`header`,{className:`topbar`,children:[(0,h.jsxs)(`span`,{className:`brand`,children:[(0,h.jsx)(`span`,{className:`brand-logo`,children:`C`}),(0,h.jsx)(`h1`,{className:`brand-name`,children:`Cadence`})]}),(0,h.jsx)(`span`,{className:`tb-spacer`}),(0,h.jsxs)(`button`,{type:`button`,className:`icon-btn`,onClick:()=>n(t===`zh`?`en`:`zh`),"aria-label":t===`zh`?`Switch to English`:`切换到中文`,children:[(0,h.jsx)(be,{}),t===`zh`?`EN`:`中文`]})]}),(0,h.jsxs)(`main`,{className:`workbench-landing`,children:[(0,h.jsxs)(`section`,{children:[(0,h.jsx)(`h2`,{children:e(`Your workbench, your projects`)}),(0,h.jsx)(`p`,{children:e(`No default workspace is created. Open an existing folder to use ordinary conversations and Cadence tasks.`)}),(0,h.jsx)(`p`,{className:`inspector-note`,children:e(`Opening a project never starts a task. Switching projects keeps admitted work running in its original directory.`)}),(0,h.jsxs)(`button`,{type:`button`,className:`primary`,disabled:!r,onClick:()=>c(r?.home??``),children:[(0,h.jsx)(pe,{}),e(`Open working folder`)]}),l&&(0,h.jsxs)(`p`,{role:`alert`,children:[l,` `,(0,h.jsx)(`button`,{type:`button`,onClick:()=>p(e=>e+1),children:e(`Reload observation`)})]}),a&&!b&&r&&(0,h.jsx)(`p`,{role:`alert`,children:e(`Selected project is unavailable. Choose a project explicitly; no directory was reconstructed.`)})]}),(0,h.jsxs)(`section`,{className:`workbench-projects`,children:[(0,h.jsx)(`h3`,{children:e(`Recent projects`)}),r?.projects.map(e=>(0,h.jsxs)(`button`,{type:`button`,onClick:()=>c(e.cwd),children:[(0,h.jsx)(Ce,{}),(0,h.jsx)(`span`,{children:e.cwd})]},e.id)),r?.projects.length===0&&(0,h.jsx)(`p`,{className:`inspector-note`,children:e(`No projects associated yet.`)})]})]}),r&&s!==null&&(0,h.jsx)(Ea,{client:v,current:``,initial:s,epoch:r.epoch,onClose:()=>c(null),onOpen:_})]})}function fo(){let{t:e}=C();return(0,h.jsxs)(`main`,{className:`entry`,children:[(0,h.jsx)(`h1`,{children:e(`Presentation unavailable`)}),(0,h.jsx)(`p`,{children:e(`No execution result is inferred. Reconnect to observe the owner; accepted work continues.`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:e(`Reload observation`)})]})}var po=class extends f.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,h.jsx)(fo,{}):this.props.children}},mo=document.getElementById(`root`);if(!mo)throw Error(`Application root unavailable`);(0,p.createRoot)(mo).render((0,h.jsx)(w,{children:(0,h.jsx)(po,{children:(0,h.jsx)(uo,{})})}));export{eo as t};
10
+ `)}),![`completed`,`running`,`queued`].includes(e.status)&&(0,h.jsx)(`p`,{className:`ep-state ${e.status}`,children:n(e.status)})]})}function fa({client:e,enabled:t,onReference:n}){let{t:r}=C(),[i,a]=(0,f.useState)(``),[o,s]=(0,f.useState)(null),[c,l]=(0,f.useState)(``),u=jr(e,t?{kind:`files`,path:i}:null),d=jr(e,t&&o?{kind:`file`,path:o}:null),p=u.value?.kind===`files`?u.value:void 0,m=d.value?.kind===`file`?d.value:void 0;return(0,h.jsxs)(`div`,{className:`files-panel`,children:[(0,h.jsxs)(`header`,{className:`files-toolbar`,children:[(0,h.jsx)(`button`,{type:`button`,className:`ghost`,"aria-label":r(`Parent folder`),disabled:p?.parent==null,onClick:()=>{p?.parent!=null&&a(p.parent)},children:(0,h.jsx)(yr,{})}),(0,h.jsx)(`span`,{className:`files-path`,title:i,children:i||`/`}),(0,h.jsx)(`button`,{type:`button`,className:`ghost`,"aria-label":r(`Refresh files`),onClick:()=>{u.refresh(),d.refresh()},children:(0,h.jsx)(qn,{})})]}),u.error&&(0,h.jsx)(`p`,{className:`inspector-note`,role:`alert`,children:u.error}),(0,h.jsxs)(`section`,{className:`file-list`,"aria-label":r(`File list`),children:[p?.entries.map(e=>(0,h.jsxs)(`div`,{className:`file-row`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`file-name${o===e.path?` selected`:``}`,title:e.path,onClick:()=>e.directory?a(e.path):s(e.path),children:[e.directory?(0,h.jsx)(ir,{}):(0,h.jsx)(ar,{}),(0,h.jsx)(`span`,{children:e.name})]}),(0,h.jsx)(`button`,{type:`button`,className:`file-action`,"aria-label":r(`Reference {path}`,{path:e.name}),onClick:()=>n(e.path),children:(0,h.jsx)(Jn,{})}),(0,h.jsx)(`button`,{type:`button`,className:`file-action`,"aria-label":r(`Copy path {path}`,{path:e.name}),onClick:()=>void Wr(e.path).then(e=>l(e?``:r(`Link copy unavailable.`))),children:(0,h.jsx)(dr,{})})]},e.path)),p?.entries.length===0&&(0,h.jsx)(`p`,{className:`panel-empty`,children:r(`No visible files`)}),p?.limited&&(0,h.jsx)(`p`,{className:`inspector-note`,children:r(`Bounded listing; narrow the directory to see more.`)})]}),o&&(0,h.jsxs)(`section`,{className:`file-preview`,children:[(0,h.jsxs)(`header`,{children:[(0,h.jsx)(`span`,{title:o,children:o}),(0,h.jsx)(`button`,{type:`button`,className:`ghost`,"aria-label":r(`Close preview`),onClick:()=>s(null),children:(0,h.jsx)(Bn,{})})]}),d.error&&(0,h.jsx)(`p`,{role:`alert`,children:d.error}),m&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`pre`,{children:m.text}),m.limited&&(0,h.jsx)(`p`,{className:`inspector-note`,children:r(`File preview is limited; this is not the complete file.`)})]})]}),c&&(0,h.jsx)(`p`,{role:`alert`,children:c}),(0,h.jsx)(`p`,{className:`files-policy`,children:r(`Readonly preview · references send paths, not file contents`)})]})}function pa({draft:e,onChange:t,context:n,roles:r,onSave:i,onGenerate:a,onStart:o,canSave:s,canAct:c}){let{t:l,tx:u}=C(),[d,p]=(0,f.useState)(!0),[m,g]=(0,f.useState)(null),[_,v]=(0,f.useState)(``),[y,b]=(0,f.useState)(``),[x,S]=(0,f.useState)(`research`),[w,T]=(0,f.useState)([]),[E,D]=(0,f.useState)(``),[O,k]=(0,f.useState)(``),A=e.assignments,j=e=>{g(e.id),v(e.instructions),b(e.expectedOutput),S(e.purpose),T(e.dependencies),k(``)},M=()=>{g(null),v(``),b(``),k(``)},N=n=>{let i=r?.find(e=>e.role===fe(x));i?(t({...e,assignments:A.map(e=>e.id===n?{...e,purpose:x,instructions:_,expectedOutput:y,dependencies:w,role:i}:e)}),M()):k(Or)},P=()=>{let i=r?.find(e=>e.role===fe(`research`));if(!i){k(Or);return}let a=1;for(;A.some(e=>e.id===`assignment-${a}`);)a++;let o={id:`assignment-${a}`,purpose:`research`,instructions:``,expectedOutput:``,dependencies:[],role:i,model:n.model};t({...e,assignments:[...A,o]}),j(o)},F=n=>{A.some(e=>e.dependencies.some(e=>e.source.kind===`current`&&e.source.assignmentId===n))?k(`Remove dependent edges explicitly before deleting this assignment.`):t({...e,assignments:A.filter(e=>e.id!==n)})};return(0,h.jsxs)(`section`,{className:`plan-board ${d?``:`plan-board-collapsed`}`,children:[(0,h.jsx)(`div`,{className:`plan-board-head`,children:(0,h.jsxs)(`button`,{type:`button`,className:`plan-board-head-main`,"aria-expanded":d,onClick:()=>p(!d),children:[(0,h.jsx)(Qn,{}),(0,h.jsx)(`span`,{children:l(`Readable plan & decomposition`)}),(0,h.jsx)(`span`,{children:l(`{count} required assignments`,{count:A.length})}),d?(0,h.jsx)(pr,{}):(0,h.jsx)(hr,{})]})}),(0,h.jsxs)(`div`,{className:`toolbar`,children:[(0,h.jsx)(`button`,{type:`button`,disabled:!c||n.task?.kind!==`code`,onClick:a,children:l(`Preview readonly Generate proposal`)}),(0,h.jsx)(`button`,{type:`button`,disabled:!s,onClick:i,children:l(`Preview Save plan`)}),(0,h.jsx)(`button`,{type:`button`,className:`primary`,disabled:!c,onClick:o,children:l(`Preview Start saved graph`)})]}),(0,h.jsx)(`p`,{children:l(`Draft changes never execute. Start uses the saved graph shown in its fresh preview, not unsaved text. Generated proposals never save or start themselves.`)}),A.some(e=>W(e.model)!==W(n.model))&&(0,h.jsxs)(`section`,{children:[(0,h.jsx)(`p`,{children:l(`Saved assignments name an old model selection. Reading does not rebind them.`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>t({...e,assignments:A.map(e=>({...e,model:n.model}))}),children:l(`Explicitly rebind draft to current model (requires new Save)`)})]}),!r&&(0,h.jsx)(`p`,{role:`status`,children:u(`Current plan metadata unavailable. Observe again; historical text is not action authority.`)}),O&&(0,h.jsx)(`p`,{role:`alert`,children:u(O)}),d&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`label`,{children:[l(`Readable plan`),(0,h.jsx)(`textarea`,{"aria-label":l(`Readable plan`),value:e.readablePlan,onChange:n=>t({...e,readablePlan:n.target.value}),rows:8})]}),(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:l(`Read rendered plan`)}),(0,h.jsx)(Qr,{text:e.readablePlan})]}),(0,h.jsx)(Kr,{text:e.readablePlan}),(0,h.jsx)(`ol`,{className:`plan-board-steps`,children:A.map(e=>(0,h.jsxs)(`li`,{className:`plan-board-step`,children:[(0,h.jsxs)(`div`,{className:`plan-step-head`,children:[(0,h.jsx)(`strong`,{children:e.id}),(0,h.jsxs)(`span`,{children:[u(e.purpose),` —`,` `,e.purpose===`edit`?l(`checkout writer`):l(`readonly`)]}),(0,h.jsxs)(`button`,{type:`button`,onClick:()=>j(e),children:[(0,h.jsx)(cr,{}),` `,l(`Edit`)]}),(0,h.jsxs)(`button`,{type:`button`,onClick:()=>F(e.id),children:[(0,h.jsx)(Hn,{}),` `,l(`Remove draft assignment`)]})]}),m===e.id?(0,h.jsxs)(`div`,{className:`plan-step-edit`,children:[(0,h.jsxs)(`label`,{children:[l(`Purpose`),(0,h.jsx)(`select`,{value:x,onChange:e=>{let t=e.target.value;(t===`research`||t===`diagnosis`||t===`review`||t===`edit`&&n.task?.kind===`code`)&&S(t)},children:[`research`,`diagnosis`,`review`,`edit`].filter(e=>e!==`edit`||n.task?.kind===`code`).map(e=>(0,h.jsx)(`option`,{value:e,children:u(e)},e))})]}),(0,h.jsxs)(`label`,{children:[l(`Instructions`),(0,h.jsx)(`textarea`,{"aria-label":l(`Instructions`),value:_,onChange:e=>v(e.target.value),rows:5})]}),(0,h.jsxs)(`label`,{children:[l(`Expected output`),(0,h.jsx)(`textarea`,{"aria-label":l(`Expected output`),value:y,onChange:e=>b(e.target.value),rows:3})]}),(0,h.jsxs)(`fieldset`,{children:[(0,h.jsx)(`legend`,{children:l(`Current-episode dependencies (whole final text by default)`)}),A.filter(t=>t.id!==e.id).map(e=>{let t=w.findIndex(t=>t.source.kind===`current`&&t.source.assignmentId===e.id);return(0,h.jsxs)(`label`,{children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:t>=0,onChange:t=>T(n=>t.target.checked?[...n,{source:{kind:`current`,assignmentId:e.id},range:null,requireCompleteObservation:!1}]:n.filter(t=>t.source.kind!==`current`||t.source.assignmentId!==e.id))}),e.id]},e.id)})]}),w.map((e,t)=>(0,h.jsxs)(`div`,{className:`dependency-editor`,children:[(0,h.jsx)(`code`,{children:JSON.stringify(e.source)}),(0,h.jsxs)(`label`,{children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:e.requireCompleteObservation,onChange:e=>T(n=>n.map((n,r)=>t===r?{...n,requireCompleteObservation:e.target.checked}:n))}),l(`Require complete observation`)]}),(0,h.jsx)(`p`,{children:l(`Selection: {range}`,{range:e.range?l(`reviewed UTF-8 bytes {start}–{end}`,{start:e.range.start,end:e.range.end}):l(`whole final text; no silent clipping`)})}),(0,h.jsxs)(`label`,{children:[l(`Reviewed edge JSON (range/null and exact historical identity)`),(0,h.jsx)(`textarea`,{defaultValue:JSON.stringify(e),onBlur:e=>{try{let n=me(ne(e.target.value));T(e=>e.map((e,r)=>t===r?n:e)),k(``)}catch{k(`Invalid dependency. Original edge retained; review before Save.`)}}})]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>T(e=>e.filter((e,n)=>t!==n)),children:l(`Remove edge`)})]},e.source.kind===`current`?e.source.assignmentId:e.source.childRunId)),(0,h.jsxs)(`label`,{children:[l(`Explicit historical/advisory edge JSON`),(0,h.jsx)(`textarea`,{value:E,onChange:e=>D(e.target.value),placeholder:l(`Exact committed run/child/result/version plus range and coverage requirement`)})]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{try{let e=me(ne(E));if(e.source.kind!==`historical`)throw Error();T(t=>[...t,e]),D(``),k(``)}catch{k(`Historical edge requires actual committed identity; no guessed result reference.`)}},children:l(`Add reviewed historical edge`)}),(0,h.jsx)(`button`,{type:`button`,onClick:M,children:l(`Discard inline edits`)}),(0,h.jsx)(`button`,{type:`button`,disabled:!!O,onClick:()=>N(e.id),children:l(`Apply to local draft`)})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Qr,{text:e.instructions}),(0,h.jsx)(`p`,{children:l(`Expected: {output}`,{output:e.expectedOutput})}),(0,h.jsxs)(`p`,{children:[l(`Role {role}`,{role:e.role.role}),` /`,` `,(0,h.jsx)(`code`,{children:e.role.sha256})]}),(0,h.jsxs)(`p`,{children:[e.model.provider,`/`,e.model.model,` ·`,` `,e.model.thinking]}),(0,h.jsx)(`pre`,{children:JSON.stringify(e.dependencies,null,2)})]})]},e.id))}),(0,h.jsxs)(`button`,{type:`button`,disabled:!r||A.length>=16,onClick:P,children:[(0,h.jsx)(Jn,{}),` `,l(`Add assignment`)]})]})]})}var ma=`未命名章节`;function ha(e){return String(e??``).trim().replace(/[\s\u3000]+/g,`-`).replace(/[^\p{L}\p{N}_-]+/gu,`-`).replace(/-{2,}/g,`-`).replace(/^-+|-+$/g,``).slice(0,80)||`section`}function ga(e){let t=new Map;return e.map(({level:e,label:n})=>{let r=String(n??``).replace(/\s+/g,` `).trim(),i=ha(r||ma),a=(t.get(i)??0)+1;return t.set(i,a),{level:e,id:a===1?i:`${i}-${a}`,label:r||ma}})}function _a(e){return e.length>=2}function va(e){let t=0,n=0;return e.split(`
11
+ `).map(e=>{let r={key:`text-offset:${t}`,number:++n,text:e};return t+=e.length+1,r})}function ya({text:e}){return(0,h.jsx)(`pre`,{className:`scm-diff-pre`,children:va(e).map(({text:e,key:t})=>{let n=``;return[`diff --git`,`index `,`new file`,`deleted file`,`old mode`,`new mode`,`similarity index`,`rename `,`copy `,`Binary files`,`---`,`+++`].some(t=>e.startsWith(t))?n=`hdr`:e.startsWith(`@@`)?n=`hunk`:e.startsWith(`+`)?n=`add`:e.startsWith(`-`)&&(n=`del`),(0,h.jsx)(`div`,{className:`scm-diff-line ${n}`,children:e||` `},t)})})}function ba({text:e}){let{t}=C(),[n,r]=(0,f.useState)(`raw`),[i,a]=(0,f.useState)(!0),[o,s]=(0,f.useState)(1),[c,l]=(0,f.useState)([]),[u,d]=(0,f.useState)(null),p=(0,f.useRef)(1),m=(0,f.useRef)(null),g=e.split(`
12
+ `);return(0,f.useLayoutEffect)(()=>{if(n!==`markdown`)return;if(!e){l([]);return}let t=Array.from(m.current?.querySelectorAll(`h1,h2,h3,h4,h5,h6`)??[]),r=ga(t.map(e=>({level:Number(e.tagName[1]),label:e.textContent??``})));r.forEach((e,n)=>{t[n].id=`preview-${e.id}`}),l(r)},[e,n]),(0,h.jsxs)(`div`,{className:`fp-preview`,children:[(0,h.jsxs)(`div`,{className:`fp-head toolbar`,children:[(0,h.jsxs)(`label`,{children:[t(`View`),(0,h.jsxs)(`select`,{value:n,onChange:e=>r(e.target.value===`markdown`?`markdown`:e.target.value===`diff`?`diff`:`raw`),children:[(0,h.jsx)(`option`,{value:`raw`,children:t(`Raw text / lines`)}),(0,h.jsx)(`option`,{value:`markdown`,children:t(`Safe Markdown`)}),(0,h.jsx)(`option`,{value:`diff`,children:t(`Observed diff`)})]})]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),children:t(i?`Wrap: on`:`Wrap: off`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>s(e=>Math.min(2,e+.1)),children:t(`Zoom +`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>s(e=>Math.max(.8,e-.1)),children:t(`Zoom −`)}),(0,h.jsx)(Kr,{text:u?g.slice(u.start-1,u.end).join(`
13
+ `):e})]}),(0,h.jsx)(`p`,{className:`fp-notice`,children:t(`Captured page only, not a current filesystem read. Line numbers are page-local. Full retained paging and copy are available above.`)}),(0,h.jsx)(`div`,{style:{fontSize:`${o}em`},children:n===`markdown`?(0,h.jsxs)(`div`,{className:`fp-toc-layout`,children:[_a(c)&&(0,h.jsx)(`nav`,{className:`fp-toc`,"aria-label":t(`Page headings`),children:c.map(e=>(0,h.jsx)(`button`,{type:`button`,className:`l${e.level}`,onClick:()=>m.current?.querySelector(`#${CSS.escape(`preview-${e.id}`)}`)?.scrollIntoView({block:`nearest`}),children:e.label},e.id))}),(0,h.jsx)(`div`,{className:`fp-markdown-zoom`,ref:m,children:(0,h.jsx)(Qr,{text:e})})]}):n===`diff`?(0,h.jsx)(ya,{text:e}):(0,h.jsx)(`div`,{className:`fp-code ${i?``:`no-wrap`}`,children:va(e).map(({text:e,number:n,key:r})=>(0,h.jsxs)(`div`,{className:`fp-line ${u&&n>=u.start&&n<=u.end?`sel`:``}`,children:[(0,h.jsx)(`button`,{type:`button`,className:`fp-num`,"aria-label":t(`Select page line {line}`,{line:n}),onClick:e=>{e.shiftKey||(p.current=n),d({start:Math.min(p.current,n),end:Math.max(p.current,n)})},children:n}),(0,h.jsx)(`span`,{className:`fp-code-text`,children:e||` `})]},r))})}),u&&(0,h.jsxs)(`footer`,{className:`fp-foot`,children:[t(`Selected page lines {start}–{end}`,{start:u.start,end:u.end}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>d(null),children:t(`Clear selection`)})]})]})}function xa({client:e,seed:t}){let{t:n,tx:r}=C(),i=ui(e,t),[a,o]=(0,f.useState)(),s=i.page;return(0,h.jsxs)(`section`,{className:`scm-body`,children:[(0,h.jsx)(yi,{pager:i}),(0,h.jsx)(`p`,{children:n(`Captured observations include pre-existing dirt. They do not attribute every change to Cadence; bounded fingerprints are not filesystem snapshots.`)}),(0,h.jsx)(`div`,{className:`scm-files-list`,children:s&&!(`kind`in s)&&s.records.map(e=>{if(e.kind!==`owner-fact`)return null;let t=e.fact,i=t.kind===`changes`||t.kind===`review`?t.content:t.kind===`check-settled`?t.output:null;return(0,h.jsxs)(`article`,{className:`scm-file`,children:[(0,h.jsxs)(`h3`,{children:[t.kind,` · `,n(`committed #{seq}`,{seq:e.committedSeq})]}),(0,h.jsx)(`pre`,{children:JSON.stringify(t,null,2)}),i&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>{s.request.scope.kind!==`workspace`&&s.request.snapshotSeq!==null&&o(ci(s.request.storeId,s.request.scope,s.request.snapshotSeq,i))},children:n(`Inspect full retained {field}`,{field:r(i.field)})})]},e.recordId)})}),a&&(0,h.jsx)(vi,{client:e,cursor:a,render:e=>(0,h.jsx)(ba,{text:e})},`${a.recordId}:${a.recordVersion}`)]})}function Sa({client:e,taskId:t,seed:n,canAct:r,onAction:i,onObligations:a}){let{t:o,tx:s}=C(),[c,l]=(0,f.useState)(),[u,d]=(0,f.useState)(),[p,m]=(0,f.useState)(0),g=(0,f.useRef)(p);return g.current=p,(0,f.useEffect)(()=>{let n=p,r=new AbortController,i=!0;return l(void 0),e.checkObligations(t,r.signal).then(e=>{i&&g.current===n&&(e.kind===`error`?d(e.error.code):(d(void 0),l(e.value),a(e.value)))}).catch(()=>{i&&d(`Obligations unavailable.`)}),()=>{r.abort(),i=!1}},[e,t,p,a]),(0,h.jsxs)(`section`,{children:[(0,h.jsx)(`h3`,{children:o(`Current configured obligations`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>m(e=>e+1),children:o(`Observe obligations`)}),u&&(0,h.jsx)(`p`,{role:`alert`,children:o(`Obligations unavailable: {error}`,{error:s(u)})}),c?.definitions.length===0&&(0,h.jsx)(`p`,{children:o(`No configured obligations. This is not passing check coverage.`)}),c?.definitions.map(e=>(0,h.jsxs)(`article`,{children:[(0,h.jsxs)(`h4`,{children:[e.selection.name,`: `,s(e.status)]}),(0,h.jsx)(`pre`,{children:e.selection.command}),(0,h.jsx)(`p`,{children:o(`Timeout {timeout} ms. Native outcome and freshness remain separate.`,{timeout:e.selection.timeoutMs})}),(0,h.jsx)(`button`,{type:`button`,disabled:!r,onClick:()=>i({kind:`check`,taskId:t,check:e.selection}),children:o(`Preview exact configured check`)})]},e.selection.name)),(0,h.jsx)(`p`,{children:o(`Browser checks are configured selections only. Native-local manual commands are not a browser shell endpoint.`)}),(0,h.jsx)(xa,{client:e,seed:{...n,reader:`checks`}})]})}function Ca({client:e,storeId:t,taskId:n}){let{t:r,tx:i}=C(),[a,o]=(0,f.useState)(),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(0);return(0,f.useEffect)(()=>{if(l<0)return;let r=new AbortController;return o(void 0),c(``),e.currentChanges({storeId:t,taskId:n},r.signal).then(e=>{r.signal.aborted||(e.kind===`ok`?o(e.value):c(e.error.code))}).catch(()=>{r.signal.aborted||c(`Current observation unavailable`)}),()=>r.abort()},[e,t,n,l]),(0,h.jsxs)(`section`,{"aria-label":r(`Current checkout changes`),children:[(0,h.jsx)(`h3`,{children:r(`Current checkout changes (not a captured historical diff)`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>u(e=>e+1),children:r(`Observe current changes`)}),s&&(0,h.jsx)(`p`,{role:`alert`,children:i(s)}),a&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:(0,h.jsx)(y,{text:r(`Fingerprint {identity} · {coverage} · includes pre-existing dirt; not attribution.`),slots:{identity:(0,h.jsx)(`code`,{children:a.observation.identity}),coverage:a.observation.complete?r(`complete within bounded scope`):r(`incomplete coverage`)}})}),(0,h.jsx)(`pre`,{children:JSON.stringify(a.coverage)}),(0,h.jsx)(ba,{text:a.text})]})]})}var wa=[[`plan`,or],[`checks`,_r],[`changes`,nr],[`review`,Vn]];function Ta(){let{t:e}=C();return(0,h.jsx)(`aside`,{className:`panel panel-right`,children:(0,h.jsx)(`p`,{className:`panel-empty`,children:e(`Select a task to inspect plans, checks, changes and review.`)})})}function Ea({client:e,context:t,seed:n,runs:r,canAct:i,onAction:a,planMetadata:o}){let{t:s,tx:c}=C(),l=t?W(t):`unavailable`,u=(0,f.useMemo)(()=>l===`unavailable`?null:_e(ne(l)),[l]),[d,p]=(0,f.useState)(`plan`),[m,g]=(0,f.useState)({readablePlan:``,assignments:[]}),[_,v]=(0,f.useState)(),[y,b]=(0,f.useState)(),[x,S]=(0,f.useState)(),[w,T]=(0,f.useState)(),[E,D]=(0,f.useState)(``),[O,k]=(0,f.useState)(!1),A=u?.task?.id??(n.scope.kind===`task`?n.scope.id:null),j=(0,f.useRef)(new Ir);j.current.select(W({context:u,tab:d,draft:m,canAct:i})),(0,f.useEffect)(()=>()=>j.current.depart(),[]),(0,f.useEffect)(()=>{let e=!0;if(b(void 0),v(void 0),!o||!u)S(Or);else return o.read(u).then(t=>{e&&(t.kind===`error`?S(t.error.code):W(t.value.context)===l?(`kind`in t.value?v(t.value):b(t.value),S(void 0)):S(`Owner metadata is stale.`))}).catch(()=>{e&&S(`Owner metadata unavailable.`)}),()=>{e=!1}},[o,u,l]);let M=(0,f.useCallback)(e=>T(e),[]);if(!A)return(0,h.jsx)(Ta,{});let N={...n,scope:{kind:`task`,id:A}};return(0,h.jsxs)(`aside`,{className:`panel panel-right`,children:[(0,h.jsx)(`nav`,{className:`rp-tabs`,"aria-label":s(`Inspector`),children:wa.map(([e,t])=>(0,h.jsxs)(`button`,{type:`button`,className:`rp-tab`,"aria-label":c(e),"aria-pressed":d===e,onClick:()=>p(e),children:[(0,h.jsx)(t,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:c(e)})]},e))}),(0,h.jsxs)(`div`,{className:`inspector-body`,children:[d===`plan`&&(0,h.jsxs)(h.Fragment,{children:[x&&(0,h.jsx)(`p`,{className:`inspector-note`,role:`status`,children:c(x)}),_&&(0,h.jsxs)(`section`,{children:[(0,h.jsxs)(`p`,{children:[s(`Saved graph proof in progress.`),` `,JSON.stringify(_.coverage)]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{if(!o||!u)return;let e=j.current.ticket();o.read(u,_.next).then(t=>{j.current.current(e)&&(t.kind===`error`?S(t.error.code):`kind`in t.value?v(t.value):(v(void 0),b(t.value)))})},children:s(`Continue saved graph read`)})]}),y&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>g({readablePlan:y.readablePlan,assignments:y.savedGraph?.assignments??[]}),children:s(`Load observed saved plan into local draft`)}),u?(0,h.jsx)(pa,{draft:m,onChange:g,context:u,roles:y?.roles??null,canAct:i,canSave:i&&!!y&&y.editable!==!1&&!!o,onGenerate:()=>a({kind:`generate-plan`,taskId:A}),onStart:()=>a({kind:`start`,taskId:A}),onSave:()=>{if(!o)return;let e=j.current.ticket();o.saveAction(u,structuredClone(m)).then(t=>{j.current.current(e)&&(t.kind===`error`?S(t.error.code):a(t.value))}).catch(()=>{j.current.current(e)&&S(`Plan proposal unavailable.`)})}}):(0,h.jsx)(`p`,{children:s(`Current control context unavailable. Historical data is not action authority.`)})]}),d===`checks`&&(0,h.jsx)(Sa,{client:e,taskId:A,seed:N,canAct:i,onAction:a,onObligations:M}),d===`changes`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Ca,{client:e,storeId:n.storeId,taskId:A}),(0,h.jsx)(`h3`,{children:s(`Captured historical observations`)}),(0,h.jsx)(xa,{client:e,seed:{...N,reader:`changes`}})]}),d===`review`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`h3`,{children:s(`Human review`)}),(0,h.jsx)(`p`,{children:s(`Done records human acknowledgment, not execution success or certification. It cannot restart a blocked episode.`)}),(0,h.jsxs)(`label`,{children:[s(`Episode to review`),(0,h.jsxs)(`select`,{value:E,onChange:e=>D(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:s(`Select an observed episode`)}),r.filter(e=>e.childRunId===null&&e.admission.kind!==`check`).map(e=>(0,h.jsxs)(`option`,{value:e.runId,children:[e.runId,` · `,c(e.outcome??e.lifecycle)]},e.runId))]})]}),(0,h.jsxs)(`label`,{children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>k(e.target.checked)}),s(`I acknowledge current unresolved issues if present; original results will not be rewritten.`)]}),(0,h.jsx)(`button`,{type:`button`,disabled:!i||!u||!w||w.taskId!==A||!E,onClick:()=>{u&&w&&a({kind:`review`,taskId:A,runId:E,changesIdentity:u.observation.identity,checksRevision:w.revision,acceptIssues:O})},children:s(`Preview human review / Done`)}),!w&&(0,h.jsx)(`p`,{children:s(`Observe current obligations in Checks before requesting review.`)}),(0,h.jsx)(xa,{client:e,seed:{...N,reader:`reviews`}})]})]})]})}function Da({client:e,current:t,initial:n,epoch:r,onClose:i,onOpen:a,projects:o=[]}){let{t:s}=C(),[c,l]=(0,f.useState)(n??t),[u,d]=(0,f.useState)(n??t),[p,m]=(0,f.useState)(!1),[g,_]=(0,f.useState)(``),v=(0,f.useRef)(!0);(0,f.useEffect)(()=>()=>{v.current=!1},[]);let y=jr(e,{kind:`directories`,path:c}),b=y.value?.kind===`directories`?y.value:void 0,x=e=>{p||(l(e),d(e),_(``),y.refresh())},S=!p&&!!b&&!y.error&&!y.loading&&u===c,w=async()=>{if(!S||!b)return;if(!a&&b.path===t){i();return}if(m(!0),_(``),a){try{await a(b.path),v.current&&i()}catch(e){v.current&&(_(e instanceof Error?e.message:`unavailable`),m(!1))}return}if(!e.workbenchCommand){_(`unavailable`),m(!1);return}let n=await e.workbenchCommand({kind:`open-project`,commandId:crypto.randomUUID(),path:b.path,epoch:r});if(v.current){if(n.kind===`ok`&&n.value.kind===`project`){let e=new URL(n.value.link);e.protocol===`http:`&&[`127.0.0.1`,`[::1]`].includes(e.hostname)||e.protocol===`https:`?window.location.assign(e.href):(_(`unsupported-context`),m(!1))}else _(n.kind===`error`?n.error.code:`unavailable`),m(!1)}};return(0,h.jsxs)(Lr,{title:s(`Open working folder`),onClose:i,children:[(0,h.jsx)(`p`,{children:s(`Choose a folder on the service host. Opening reuses or starts that project's independent service; current work keeps running.`)}),o.length>0&&(0,h.jsxs)(`section`,{className:`cwd-recent`,"aria-label":s(`Recent projects`),children:[(0,h.jsx)(`h3`,{children:s(`Recent projects`)}),(0,h.jsx)(`div`,{className:`cwd-recent-list`,children:o.map(e=>(0,h.jsxs)(`button`,{type:`button`,title:e.path,"aria-current":e.current?`true`:void 0,disabled:p,onClick:()=>x(e.path),children:[(0,h.jsx)(ir,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:e.path})]},e.path))})]}),(0,h.jsxs)(`form`,{className:`cwd-input`,onSubmit:e=>{e.preventDefault(),x(u)},children:[(0,h.jsx)(`input`,{"aria-label":s(`Folder path`),value:u,disabled:p,onChange:e=>d(e.target.value)}),(0,h.jsx)(`button`,{type:`submit`,disabled:p,children:s(`Browse`)})]}),(0,h.jsxs)(`div`,{className:`cwd-picker-list`,children:[b?.parent&&(0,h.jsxs)(`button`,{type:`button`,disabled:p,onClick:()=>x(b.parent),children:[(0,h.jsx)(yr,{}),s(`Parent folder`)]}),b?.entries.map(e=>(0,h.jsxs)(`button`,{type:`button`,disabled:p,onClick:()=>x(e.path),children:[(0,h.jsx)(ir,{}),(0,h.jsx)(`span`,{children:e.name})]},e.path))]}),b?.limited&&(0,h.jsx)(`p`,{className:`inspector-note`,children:s(`Bounded listing; narrow the directory to see more.`)}),(g||y.error)&&(0,h.jsxs)(`p`,{role:`alert`,children:[g||y.error,g===`registry-locked`&&(0,h.jsxs)(h.Fragment,{children:[` `,`—`,` `,s(`The shared registry lock is blocking projects. On the service host, run cadence recover inspect --workspace <project> with the same --state-home, then use recover resolve in a local terminal if eligible. Do not delete lock files manually.`)]})]}),(0,h.jsx)(`footer`,{children:(0,h.jsx)(`button`,{type:`button`,className:`primary`,disabled:!S,onClick:()=>void w(),children:s(p?`Opening project…`:`Open this project`)})})]})}function Oa(e,t=new Set){let n=new Map(e.map(e=>[e.id,e])),r=new Map,i=[];for(let t of e)if(t.parentId&&n.has(t.parentId)){let e=r.get(t.parentId)??[];e.push(t),r.set(t.parentId,e)}else i.push(t);let a=e=>{let t=[],n=[...r.get(e)??[]],i=new Set;for(;n.length>0;){let e=n.shift();if(!e)break;if(i.has(e.id))continue;i.add(e.id),t.push(e);let a=r.get(e.id);a&&n.push(...a)}return t},o=[],s=new Set,c=new Set,l=(e,n)=>{if(s.has(e.id)||c.has(e.id))return;s.add(e.id);let i=r.get(e.id)??[],u=i.length>0,d=u&&t.has(e.id),f=0,p=!1,m=!1,h=!1;if(u){let t=a(e.id);if(f=t.length,p=t.some(e=>e.active),m=t.some(e=>e.failed),h=t.some(e=>e.unknown),d)for(let e of t)c.add(e.id)}if(o.push({c:e,depth:n,hasKids:u,isCollapsed:d,descendantCount:f,hasActive:p,hasFailure:m,hasUnknown:h}),!d)for(let e of i)l(e,n+1)};for(let e of i)l(e,0);for(let t of e)l(t,0);return o}function ka({onConversation:e,onTask:t,disabled:n=!1}){let{t:r}=C();return(0,h.jsxs)(`div`,{className:`lp-new`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`new-conversation`,disabled:n,onClick:e??t,children:[(0,h.jsx)(Jn,{"aria-hidden":`true`}),r(e?`New conversation`:`New task`)]}),e&&t&&(0,h.jsx)(`button`,{type:`button`,className:`new-task-shortcut`,"aria-label":r(`New task`),title:r(`New task`),disabled:n,onClick:t,children:(0,h.jsx)(ur,{"aria-hidden":`true`})})]})}function Aa({title:e,children:t,className:n=``,count:r}){let[i,a]=(0,f.useState)(!0);return(0,h.jsxs)(`section`,{className:`lp-section ${n}${i?``:` collapsed`}`,children:[(0,h.jsx)(`header`,{className:`lp-section-header`,children:(0,h.jsxs)(`button`,{type:`button`,className:`lp-section-heading`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[i?(0,h.jsx)(hr,{"aria-hidden":`true`}):(0,h.jsx)(mr,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`lp-section-title`,children:e}),r&&(0,h.jsx)(`span`,{className:`lp-count`,children:r})]})}),(0,h.jsx)(`div`,{className:`lp-section-body`,hidden:!i,children:t})]})}function ja({runs:e,scope:t,snapshot:n,onScope:r}){let{t:i,tx:a}=C(),[o,s]=(0,f.useState)(new Set),c=Oa(e.map(e=>({id:e.childRunId??e.runId,parentId:e.childRunId?e.runId:null,label:e.childRunId?e.assignmentId??i(`Subagent`):a(e.admission.kind),active:e.lifecycle!==`settled`,failed:e.outcome===`failed`,unknown:e.outcome===`unknown`})),o);return(0,h.jsx)(`nav`,{className:`conversation-tree`,"aria-label":i(`Runs and assignments`),children:c.map(o=>{let c=e.find(e=>(e.childRunId??e.runId)===o.c.id),l=c?.childRunId?`child`:`run`,u=c?.outcome??c?.lifecycle??`unknown`,d=t?.kind===l&&t.id===o.c.id;return(0,h.jsxs)(`div`,{className:`ep-row`,style:{paddingInlineStart:`${o.depth*14}px`},children:[o.hasKids?(0,h.jsx)(`button`,{type:`button`,className:`ep-toggle`,"aria-label":i(`Toggle assignments`),"aria-expanded":!o.isCollapsed,onClick:()=>s(e=>{let t=new Set(e);return t.has(o.c.id)?t.delete(o.c.id):t.add(o.c.id),t}),children:o.isCollapsed?(0,h.jsx)(mr,{"aria-hidden":`true`}):(0,h.jsx)(hr,{"aria-hidden":`true`})}):(0,h.jsx)(`span`,{className:`ep-toggle-spacer`,"aria-hidden":`true`}),(0,h.jsxs)(`button`,{type:`button`,className:`session-item${d?` active`:``}`,"aria-current":d?`true`:void 0,title:`${o.c.label} · ${o.c.id}`,onClick:()=>r({kind:l,id:o.c.id},n,o.c.label),children:[(0,h.jsx)(`span`,{className:`session-icon`,children:l===`child`?(0,h.jsx)(ur,{"aria-hidden":`true`}):(0,h.jsx)(Yn,{"aria-hidden":`true`})}),(0,h.jsxs)(`span`,{className:`session-info`,children:[(0,h.jsx)(`span`,{className:`session-title`,children:o.c.label}),l===`child`&&(0,h.jsx)(`span`,{className:`session-sub`,children:i(`Subagent`)}),o.isCollapsed&&(0,h.jsx)(`span`,{className:`session-sub session-outcome`,children:`${i(`{count} descendants`,{count:o.descendantCount})}${o.hasFailure?i(` / failed child`):``}${o.hasUnknown?i(` / unknown child`):``}`})]}),(0,h.jsx)(`span`,{className:`ep-state ${u}`,children:a(u)})]})]},o.c.id)})})}function Ma({pager:e,scope:t,onScope:n,exclude:r}){let{t:i}=C(),a=e.page;return(0,h.jsxs)(`div`,{className:`retained-conversations`,children:[a&&!(`kind`in a)&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ja,{runs:a.records.flatMap(e=>e.kind===`run`&&!r.includes(e.projection.runId)?[e.projection]:[]),scope:t,snapshot:a.request.snapshotSeq??void 0,onScope:n}),a.records.length===0&&(0,h.jsx)(`p`,{className:`panel-hint`,children:i(`No retained conversations on this page.`)})]}),(0,h.jsx)(yi,{pager:e,compact:!0})]})}function Na({client:e,workspace:t,taskId:n,scope:r,runs:i,snapshot:a,activeRuns:o,cancelCompatible:s,canceling:c,onCancel:l,onTask:u,onScope:d,onNew:f,chats:p=[],conversationId:m,onConversation:g,onNewConversation:_}){let{t:v,tx:y}=C(),b={reader:`tasks`,storeId:t.storeId,scope:{kind:`workspace`,id:t.workspaceId},snapshotSeq:null,after:null,limit:50},x=ui(e,b),S=ui(e,n?{...b,reader:`runs`,scope:{kind:`task`,id:n},snapshotSeq:a??t.committedSeq}:null),w=x.page&&!(`kind`in x.page)?x.page.records.flatMap(e=>e.kind===`task`?[e]:[]):[],T=o?.status===`complete`?o.runs:[],E=w.filter(e=>!T.some(t=>t.taskId===e.owner.taskId)),D=n&&(0,h.jsxs)(`section`,{className:`task-conversations`,"aria-label":v(`Task conversations`),children:[(0,h.jsx)(`h3`,{children:v(`Task conversations`)}),(0,h.jsx)(Ma,{pager:S,scope:r,onScope:d,exclude:T.map(e=>e.runId)},n)]}),O=p.filter(e=>e.status===`running`||e.status===`queued`||e.id===m),k=e=>(0,h.jsxs)(`button`,{type:`button`,className:`session-item${e.id===m?` active`:``}`,onClick:()=>g?.(e.id),title:e.title,children:[(0,h.jsx)(`span`,{className:`session-icon`,children:(0,h.jsx)(Yn,{})}),(0,h.jsxs)(`span`,{className:`session-info`,children:[(0,h.jsx)(`span`,{className:`session-title`,children:e.title}),(0,h.jsxs)(`span`,{className:`session-sub`,children:[v(`Ordinary`),` · `,y(e.status)]})]})]},e.id);return(0,h.jsxs)(`aside`,{className:`panel panel-left lp-panel`,children:[(0,h.jsx)(ka,{onConversation:_,onTask:f}),(0,h.jsxs)(Aa,{title:v(`Running conversations`),count:o?.status===`complete`?String(T.length+O.length):`?`,className:`running-conversations`,children:[o?.status!==`complete`&&(0,h.jsx)(`p`,{className:`panel-hint`,children:v(`Active roster unavailable; absence is not proof of settlement.`)}),O.map(k),o?.status===`complete`&&T.length===0&&O.length===0&&(0,h.jsx)(`p`,{className:`panel-hint`,children:v(`No active runs`)}),T.map(e=>{let t=w.find(t=>t.owner.taskId===e.taskId)?.goal;return(0,h.jsxs)(`div`,{className:`conversation-group`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`session-item${n===e.taskId&&r?.kind===`task`?` active`:``}`,onClick:()=>u(e.taskId,t),title:e.runId,children:[(0,h.jsx)(`span`,{className:`status-dot busy`,"aria-hidden":`true`}),(0,h.jsxs)(`span`,{className:`session-info`,children:[(0,h.jsx)(`span`,{className:`session-title`,children:t??v(`Task {id}`,{id:e.taskId.slice(0,8)})}),(0,h.jsxs)(`span`,{className:`session-sub`,children:[y(e.kind),` · `,y(e.stage)]})]})]}),(0,h.jsxs)(`button`,{type:`button`,className:`conversation-stop`,disabled:!s||c.has(e.runId),onClick:()=>l(e.runId),children:[(0,h.jsx)(Wn,{"aria-hidden":`true`}),v(`Cancel run — request stop`)]}),n===e.taskId&&(0,h.jsx)(ja,{runs:i.filter(t=>t.runId===e.runId),scope:r,onScope:d})]},e.runId)})]}),(0,h.jsxs)(Aa,{title:v(`Conversation history`),count:x.page&&!(`kind`in x.page)?`${E.length}${x.page.next||x.canPrevious?`+`:``}`:`?`,className:`grow`,children:[(0,h.jsxs)(`nav`,{"aria-label":v(`Tasks`),className:`task-list`,children:[p.filter(e=>!O.includes(e)).map(k),E.map(e=>(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`button`,{type:`button`,className:`session-item${e.owner.taskId===n&&r?.kind===`task`?` active`:``}`,"aria-current":e.owner.taskId===n&&r?.kind===`task`?`true`:void 0,title:e.goal,onClick:()=>u(e.owner.taskId,e.goal),children:[(0,h.jsx)(`span`,{className:`session-icon`,children:(0,h.jsx)(Yn,{"aria-hidden":`true`})}),(0,h.jsxs)(`span`,{className:`session-info`,children:[(0,h.jsx)(`span`,{className:`session-title`,children:e.goal}),(0,h.jsx)(`span`,{className:`session-sub`,children:v(`Task {id}`,{id:e.owner.taskId.slice(0,8)})})]})]}),e.owner.taskId===n&&D]},e.owner.taskId)),x.page&&!(`kind`in x.page)&&E.length===0&&(0,h.jsx)(`p`,{className:`panel-hint`,children:v(`No retained task on this page.`)}),(0,h.jsx)(yi,{pager:x,compact:!0})]}),!E.some(e=>e.owner.taskId===n)&&D]})]})}function Pa({path:e,disabled:t=!1,onClick:n}){let{t:r}=C();return(0,h.jsxs)(`button`,{type:`button`,className:`status-cwd`,title:e||r(`Open working folder`),"aria-label":r(`Switch working folder`),disabled:t,onClick:n,children:[(0,h.jsx)(ir,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:e||r(`Open working folder`)}),(0,h.jsx)(hr,{"aria-hidden":`true`})]})}function Fa(e,t,n){let r=new URL(window.location.origin+window.location.pathname),i=Ci();i&&r.searchParams.set(`project`,i);let a=new URLSearchParams({task:V(e)});if(n&&(a.set(`scope`,JSON.stringify(J(n.scope))),n.snapshotSeq&&a.set(`snapshot`,U(n.snapshotSeq))),t){let{navigation:e,...n}=t;a.set(`detail`,JSON.stringify(n))}return r.hash=a.toString(),r.href}function Ia(){try{let e=new URLSearchParams(window.location.hash.slice(1)),t=V(e.get(`task`)),n=e.get(`detail`),r=e.get(`scope`),i=e.get(`snapshot`),a=r?J(ne(r)):void 0,o=i?U(i):void 0;if(a?.kind===`task`&&a.id!==t||o&&!a)return null;if(!n)return{taskId:t,scope:a,snapshotSeq:o};let s=Y(ne(n));return s.navigation?null:{taskId:t,cursor:s,scope:a,snapshotSeq:o}}catch{return null}}function La(e){let t=e.start.above+e.start.below,n=Math.max(1,e.availablePx)/(e.totalWeight>0?e.totalWeight:1),r=e.minAbovePx/n,i=e.minBelowPx/n;if(r+i>=t){let n=e.minAbovePx+e.minBelowPx||1,r=t*e.minAbovePx/n;return{above:r,below:t-r}}let a=Math.min(t-i,Math.max(r,e.start.above+e.deltaPx/n));return{above:a,below:t-a}}function Ra({side:e,width:t,onResize:n}){let{t:r}=C(),i=(0,f.useRef)(void 0);return(0,f.useEffect)(()=>()=>i.current?.(),[]),(0,h.jsx)(`input`,{type:`range`,min:220,max:600,step:20,value:t,onChange:e=>n(Number(e.target.value)),className:`resize-handle`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":r(e===`left`?`Resize left pane`:`Resize right pane`),"aria-valuemin":220,"aria-valuemax":600,"aria-valuenow":t,onDoubleClick:()=>n(e===`left`?260:360),onPointerDown:r=>{r.preventDefault(),i.current?.();let a=r.clientX,o=window.innerWidth,s=r=>{let i=La({start:{above:t,below:Math.max(1,o-t)},deltaPx:(r.clientX-a)*(e===`left`?1:-1),availablePx:o,totalWeight:o,minAbovePx:220,minBelowPx:320});n(Math.min(600,i.above))},c=()=>{window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),i.current=void 0};i.current=c,window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c,{once:!0}),window.addEventListener(`pointercancel`,c,{once:!0})}})}function za(e,t,n,r){(0,f.useEffect)(()=>{if(!n||!t)return;let i=e.current?.querySelector(`.drawer-${t}`),a=document.activeElement,o=()=>Array.from(i?.querySelectorAll(`button:not(:disabled),input,textarea,select,a[href],[tabindex="0"]`)??[]).filter(e=>e.getClientRects().length>0);(o()[0]??i)?.focus({preventScroll:!0});let s=e=>{if(e.key===`Escape`&&(e.preventDefault(),r()),e.key===`Tab`){let t=o(),n=t[0],r=t[t.length-1];if(!n){e.preventDefault();return}e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus({preventScroll:!0})):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus({preventScroll:!0}))}};return i?.addEventListener(`keydown`,s),()=>{i?.removeEventListener(`keydown`,s),a instanceof HTMLElement&&a.isConnected&&a.focus({preventScroll:!0})}},[e,t,n,r])}var Ba=.4,Va=1.05;function Ha(e){return Math.min(300,e*.86)}function Ua(e,t,n){return n||(t<=144?null:e<=72?`left`:t-e<=72?`right`:null)}function Wa(e,t){let n=Math.abs(e),r=Math.abs(t);return n<12&&r<12?`none`:n>r*1.2?`horizontal`:`vertical`}function Ga(e,t){return e===`left`?t:-t}function Ka(e,t){return Math.max(-e,Math.min(0,-e+t))}function qa(e,t,n){let r=n?e+t:t;return Math.max(0,Math.min(1,r/e))}function Ja(e){let{wasOpen:t,pull:n,width:r,durationMs:i}=e;return i<=320&&Math.abs(n)>=48?n>0:qa(r*Va,n,t)>=Ba}var Ya=new Set([`auto`,`scroll`,`overlay`]);function Xa(e,t){let n=e instanceof Element?e:null;for(;n;){if(n instanceof HTMLElement&&n.scrollWidth>n.clientWidth+4&&Ya.has(getComputedStyle(n).overflowX))return!0;if(n===t)break;n=n.parentElement}return!1}function Za(){let e=e=>{e.stopPropagation(),e.preventDefault()};window.addEventListener(`click`,e,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener(`click`,e,{capture:!0}),400)}function Qa(e){let{enabled:t,open:n,onOpenChange:r,container:i}=e,{panelSelector:a,backdropSelector:o}=e;(0,f.useEffect)(()=>{let e=i.current;if(!t||!e)return;let s=null,c=`none`,l=0,u=0,d=0,f=0,p=!1,m=0,h=0,g=null,_=null,v=()=>{g&&(g.classList.remove(`drawer-dragging`),g.style.transform=``),_&&(_.style.opacity=``),s=null,c=`none`,g=null,_=null,f=0,p=!1},y=t=>{if(v(),t.touches.length!==1)return;let r=t.touches[0];if(!r)return;let i=Ua(r.clientX,window.innerWidth,n);i&&!Xa(t.target,e)&&(s=i,l=r.clientX,u=r.clientY,d=Date.now())},b=t=>{let r=s;if(!r||t.touches.length!==1)return;let i=t.touches[0];if(!i)return;let d=i.clientX-l,v=i.clientY-u;if(c===`none`){let t=Wa(d,v);if(t===`none`)return;if(t===`vertical`){s=null;return}c=`horizontal`,p=n===r,m=Ha(window.innerWidth),h=m*Va;let i=e.querySelector(a?a(r):`.panel-drawer.drawer-${r}`);if(!i){s=null;return}g=i,_=o===null?null:e.querySelector(o??`.drawer-backdrop`),i.classList.add(`drawer-dragging`)}let y=g;if(!y)return;f=Ga(r,d);let b=Ka(h,p?h+f:f);y.style.transform=`translateX(${r===`left`?b:-b}px)`,_&&(_.style.opacity=String(qa(h,f,p))),t.preventDefault()},x=()=>{let e=s,t=c===`horizontal`&&e!==null&&g!==null,i=f,a=Date.now()-d,o=t?Ja({wasOpen:p,pull:i,width:m,durationMs:a}):!1;v(),t&&e&&o!==(n===e)&&(Za(),r(o?e:null))},S=()=>v();return e.addEventListener(`touchstart`,y,{passive:!0}),e.addEventListener(`touchmove`,b,{passive:!1}),e.addEventListener(`touchend`,x),e.addEventListener(`touchcancel`,S),()=>{v(),e.removeEventListener(`touchstart`,y),e.removeEventListener(`touchmove`,b),e.removeEventListener(`touchend`,x),e.removeEventListener(`touchcancel`,S)}},[t,n,r,i,a,o])}function $a(e,t,n,r,i=`en`){let a=(e,t)=>v(i,e,t),o=t.filter(e=>e.kind===`owner-fact`||e.kind===`capture-fact`),s=o.map((e,t)=>{let n=e.kind===`owner-fact`?e.fact.kind:e.capture.event.kind,r=e.kind===`capture-fact`?e.link.childRunId:null,o=n.startsWith(`tool`)?`tools`:n.startsWith(`message`)?`model`:`input`;return{key:e.recordId,lane:o,group:`${r??`owner`}:${o}`,groupLabel:`${r??a(`Owner`)} · ${v(i,o)}`,kind:o===`tools`?`tool`:o===`model`?`text`:`system`,title:`#${e.committedSeq} ${n}`,summary:n,source:a(`Committed #{seq}; {who}`,{seq:e.committedSeq,who:r??a(`owner`)}),status:a(`recorded fact`),clock:e.kind===`capture-fact`?a(`Worker-local monotonic observations ({child}): {first}–{last} ms; not aligned to other workers.`,{child:e.link.childRunId,first:e.capture.source.firstObservedMs,last:e.capture.source.lastObservedMs}):a(`Owner observation ({epoch}): {ms} ms; clock origin not established by this reader.`,{epoch:e.link.epoch,ms:e.observedMs}),...e.kind===`owner-fact`&&e.fact.kind===`check-settled`?{dur:e.fact.native.durationMs}:{},t:t*1e3,end:t*1e3}}),c;return{lang:i,onData(e){return c=e,()=>{c=void 0}},readState(){c?.({kind:`state`,conversations:[{id:e,title:a(`{scope} — loaded committed page`,{scope:e}),isStreaming:!1,segCount:s.length}],activeId:e})},readSegments(t){t===e&&c?.({kind:`segs`,convId:t,segs:s,reset:!0})},readSegment(t,n){let r=s.findIndex(e=>e.key===n);t!==e||r<0||c?.({kind:`seg_detail`,convId:t,key:n,seg:s[r],detail:JSON.stringify(o[r],null,2),analysis:{position:a(`Committed sequence {seq}; page ordinal {ordinal}. Timing shown in raw facts only; clocks may not be comparable.`,{seq:o[r].committedSeq,ordinal:r+1})}})},openDetail(t,r){let i=o.find(e=>e.recordId===r);t===e&&i&&n(i)},searchHistory:r}}var eo=`modulepreload`,to=function(e){return`/`+e},no={},ro=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=to(t,n),t=s(t),t in no)return;no[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:eo,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function io({client:e,seed:t,onSearch:n}){let{t:r}=C(),i=ui(e,{...t,reader:`events`}),a=i.page;return(0,h.jsxs)(`section`,{className:`timeline-view`,children:[(0,h.jsx)(`p`,{children:r(`Committed order, not wall time. Replay advances visualization only. Raw observations retain clock/sequence provenance; unknown timing is not reconstructed.`)}),(0,h.jsx)(yi,{pager:i}),a&&!(`kind`in a)&&(0,h.jsx)(ao,{client:e,seed:a.request,records:a.records,onSearch:n},`${a.request.snapshotSeq}:${a.request.after?.recordId??`first`}`)]})}function ao({client:e,seed:t,records:n,onSearch:r}){let{t:i,locale:a}=C(),o=(0,f.useRef)(null),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(!1),d=(0,f.useRef)(r);return d.current=r,(0,f.useEffect)(()=>{let e=!1,r;return ro(()=>import(`./timeline-client.js`).then(i=>{!e&&o.current&&(r=i.default.mount(o.current,$a(t.scope.id,n,()=>c(!0),()=>d.current(),a)))}),[]).catch(()=>{e||u(!0)}),()=>{e=!0,r?.()}},[n,t.scope.id,a]),(0,h.jsxs)(h.Fragment,{children:[l&&(0,h.jsx)(`p`,{role:`alert`,children:i(`Bundled timeline unavailable; retained events remain accessible, no CDN fallback.`)}),(0,h.jsx)(`div`,{className:`timeline-mount`,ref:o}),s&&(0,h.jsx)(bi,{client:e,seed:t})]})}function oo(){let e=new URLSearchParams(window.location.hash?.slice(1)).get(`chat`);return e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(e)?e:null}var so=[[`tools`,Un],[`context`,er],[`timeline`,fr],[`runs`,rr],[`outcomes`,vr]];function co({error:e,observationError:t}){let{t:n,tx:r}=C();return!e&&!t?null:(0,h.jsxs)(`p`,{className:`banner-notice`,role:`alert`,children:[e&&(0,h.jsxs)(h.Fragment,{children:[e,` `]}),t&&(0,h.jsxs)(h.Fragment,{children:[n(`{message}.`,{message:r(t)}),` `,t===`stale`?n(`Context changed. Observe again and request a fresh confirmation.`):(0,h.jsx)(y,{text:n(`Explicit service guidance: {status} / {start}. No service is started by this page.`),slots:{status:(0,h.jsx)(`code`,{children:`cadence-service status`}),start:(0,h.jsx)(`code`,{children:`cadence-service start --workspace <path>`})}})]})]})}function lo({api:e,planMetadata:t,onOpenProject:n,onWorkbenchHome:r,projectEntries:i}){let{t:a,tx:o,locale:s,setLocale:c}=C(),[l]=(0,f.useState)(()=>e??Er()),[u,d]=(0,f.useState)(!1),[p,m]=(0,f.useState)(!1),[g]=(0,f.useState)(Ia),[_,v]=(0,f.useState)(g?.taskId??null),[b,x]=(0,f.useState)(()=>g?null:oo()??crypto.randomUUID()),[S,w]=(0,f.useState)(null),[T,E]=(0,f.useState)(null),[D,O]=(0,f.useState)(g?`task`:`files`),[k,A]=(0,f.useState)(),j=(0,f.useCallback)(()=>A(void 0),[]),[M,N]=(0,f.useState)(g?g.scope??{kind:`task`,id:g.taskId}:null),P=Fr(l,_?{kind:`task`,id:_}:null,!p),F=(0,f.useRef)(null);P.workspace&&(F.current=P.workspace.workspaceId);let I=jr(l.client,P.workspace&&!p?{kind:`conversations`}:null,2e3),L=jr(l.client,P.workspace&&!p?{kind:`projects`}:null),R=(L.value?.kind===`projects`?L.value.entries.find(e=>e.current)?.path:void 0)??P.workspace?.rootLabel,z=jr(l.client,_&&P.workspace&&!p?{kind:`task-origin`,taskId:_}:null),B=z.value?.kind===`task-origin`?z.value.conversationId:null,V={state:P.observation,transportStatus:P.transportStatus,error:P.error,refresh:P.refresh},H=P.workspace?.storeId,U=(0,f.useMemo)(()=>t??(H?kr(l.client,H):void 0),[t,l,H]),ee=V.state?.snapshot.scope.kind===`task`&&V.state.snapshot.scope.id===_?V.state.snapshot.context:void 0,te=ee?.status===`available`?ee.version:null,ne=P.actions&&V.state?.connection===`current`&&V.transportStatus===`current`&&!!te&&te.epoch===P.workspace?.epoch,[re,ie]=(0,f.useState)(null),[ae,oe]=(0,f.useState)(!1),se=(0,f.useRef)(null),[ce,le]=(0,f.useState)(260),[ue,de]=(0,f.useState)(360),fe=(0,f.useCallback)(()=>ie(null),[]);(0,f.useEffect)(()=>{let e=matchMedia(`(max-width: 900px)`),t=()=>oe(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),Qa({enabled:ae&&!p,open:re,onOpenChange:ie,container:se}),za(se,re,ae&&!p,fe);let[G,pe]=(0,f.useState)(g?.snapshotSeq),[me,K]=(0,f.useState)(``),[he,ge]=(0,f.useState)(``),[_e,ve]=(0,f.useState)(!0),ye=(0,f.useRef)(null),[be,xe]=(0,f.useState)(`messages`),[Se,Ce]=(0,f.useState)(!1),[we,Te]=(0,f.useState)(!1),[q,Ee]=(0,f.useState)(),[De,J]=(0,f.useState)(g?.cursor),[Oe,Y]=(0,f.useState)(!1),[ke,Ae]=(0,f.useState)(``),[je,Me]=(0,f.useState)(`code`),[Ne,Pe]=(0,f.useState)(),[Fe,Ie]=(0,f.useState)(!1),[Le,Re]=(0,f.useState)(``),[ze,Be]=(0,f.useState)([]),[Ve,He]=(0,f.useState)(new Set),Ue=(0,f.useRef)(!0),We=(0,f.useRef)(null),Ge=e=>{Ue.current&&Be(t=>{let n=t.findIndex(t=>t.commandId===e.commandId);return n<0?[...t,e]:t.map((t,r)=>r===n?Ar(t,e):t)})},X=(0,f.useRef)(new Ir),Ke=W({taskId:_,scope:M,selectedSnapshot:G??null,detached:p,context:te,attachment:P.attachmentVersion,workspaceContext:P.workspace?.context??null,observationError:P.error??null});X.current.select(Ke);let[qe,Je]=(0,f.useState)(Ke);qe!==Ke&&(Je(Ke),Ie(!1),Pe(void 0)),(0,f.useEffect)(()=>(Ue.current=!0,()=>{Ue.current=!1,We.current?.abort(),X.current.depart()}),[]);let Ye=Ne?.preflight.preview.action.kind===`create`?P.workspace?.context.status===`available`?P.workspace.context.version:null:te,Xe=async e=>{let t=e.kind===`create`?P.workspace?.context.status===`available`?P.workspace.context.version:null:te;if(!P.actions||!t||Fe||p){Re(a(`Current action context unavailable; observe again.`));return}X.current.depart();let n=X.current.ticket();Ie(!0),Re(``);try{let r=await xr(l.client,t,e);if(!X.current.current(n))return;r.kind===`error`?Re(a(`Preflight refused: {code}`,{code:r.error.code})):Pe(r.value)}catch{X.current.current(n)&&Re(a(`Preflight unavailable. No automatic retry.`))}finally{X.current.current(n)&&Ie(!1)}},Ze=(e=crypto.randomUUID())=>{We.current?.abort(),X.current.depart(),Pe(void 0),Ie(!1),x(e),v(null),N(null),K(``),ge(``),Ee(void 0),J(void 0),pe(void 0),xe(`messages`),O(`files`),fe(),history.replaceState(null,``,`${location.pathname}${location.search}#chat=${e}`)};(0,f.useEffect)(()=>{b&&!window.location.hash&&history.replaceState(null,``,`${location.pathname}${location.search}#chat=${b}`)},[b]);let Qe=(e,t)=>{We.current?.abort(),w(null),x(null),O(`task`),K(t??``),ge(``),pe(void 0),X.current.depart(),Pe(void 0),Ie(!1),v(e),N({kind:`task`,id:e}),Ee(void 0),J(void 0),xe(`messages`),fe(),history.replaceState(null,``,Fa(e))};(0,f.useEffect)(()=>{let e=()=>{We.current?.abort();let e=Ia();if(e)x(null),O(`task`),X.current.depart(),Pe(void 0),Ie(!1),pe(e.snapshotSeq),K(``),ge(``),v(e.taskId),N(e.scope??{kind:`task`,id:e.taskId}),Ee(void 0),J(e.cursor),xe(`messages`),fe();else{let e=oo();e&&(x(e),v(null),N(null),O(`files`),Pe(void 0),X.current.depart(),fe())}};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[fe]);let $e=(e,t,n)=>{pe(t),ge(n??``),X.current.depart(),Pe(void 0),Ie(!1),N(e),Ee(void 0),J(void 0),xe(`messages`),fe(),_&&history.replaceState(null,``,Fa(_,void 0,{scope:e,snapshotSeq:t}))},Z=G??V.state?.snapshot.committedSeq??P.workspace?.committedSeq,et=P.workspace?.storeId,tt=M&&et&&Z?{storeId:et,scope:M,snapshotSeq:Z,reader:`messages`,after:null,limit:50}:null,nt=M&&et&&Z?{storeId:et,scope:M,snapshotSeq:Z,query:null,recordId:null,recordVersion:null,field:null,offset:0}:null,rt=ee?V.state?.snapshot.runs??[]:[],it=X.current.ticket(),at=e=>{if(Ge(e),e.receipt&&X.current.current(it)&&(P.refresh(),e.receipt.created)){We.current?.abort();let t=new AbortController;We.current=t;let n=S&&I.value?.kind===`conversations`&&I.value.entries.some(e=>e.id===S)?S:null,r=P.workspace?.epoch;(async()=>{for(;Ue.current&&!t.signal.aborted;){let i=await l.client.receipt(e.commandId,t.signal);if(!Ue.current||t.signal.aborted)return;if(Ge({commandId:e.commandId,lookup:i}),i.status===`found`&&i.receipt.created?.state===`published`){let o=i.receipt.created.taskId;if(n&&r){let i=await l.client.workbenchCommand({kind:`link-task`,commandId:e.commandId,epoch:r,taskId:o,conversationId:n});if(!Ue.current||t.signal.aborted)return;i.kind!==`ok`&&Re(a(`Task created, but its conversation link was not confirmed.`))}Qe(o);return}if(i.status!==`found`||i.receipt.publication!==`pending`)return;await new Promise(e=>setTimeout(e,500))}})()}},ot=e=>{if(Ve.has(e)||!P.cancelCompatible||!P.activeRuns)return;let t=crypto.randomUUID(),n=P.activeRuns.epoch;He(t=>new Set(t).add(e)),Ge({commandId:t,error:a(`Stop requested; settlement is not yet confirmed.`)}),l.client.cancel({commandId:t,epoch:n,runId:e}).then(e=>{at(e.kind===`ok`?{commandId:t,receipt:e.value}:{commandId:t,error:a(`{code}; cancellation effect {effect}. Observe exact receipt.`,{code:e.error.code,effect:e.error.effect})})}).catch(()=>Ge({commandId:t,error:a(`Cancellation effect uncertain. Observe exact receipt.`)})).finally(()=>{Ue.current&&He(t=>{let n=new Set(t);return n.delete(e),n})})};if(p)return(0,h.jsxs)(`main`,{className:`entry`,children:[(0,h.jsx)(`span`,{className:`empty-logo`,"aria-hidden":`true`,children:`C`}),(0,h.jsx)(`h1`,{children:a(`Detached`)}),(0,h.jsx)(`p`,{children:a(`Accepted service work continues. No Cancel was requested.`)}),ze.map(e=>(0,h.jsxs)(`p`,{children:[a(`Observe command after reconnect:`),` `,(0,h.jsx)(`code`,{children:e.commandId})]},e.commandId)),(0,h.jsx)(`button`,{type:`button`,className:`primary`,onClick:()=>m(!1),children:a(`Reconnect as a viewer`)})]});let st=P.activeRuns,ct=st?.status===`complete`?st.runs:[],lt=V.state?.connection??(P.workspace?_?`Task snapshot not observed yet`:`Chat ready`:`Service unavailable`);return(0,h.jsxs)(`div`,{className:`app${_e?``:` inspector-hidden`}`,children:[(0,h.jsxs)(`header`,{className:`topbar`,children:[(0,h.jsx)(`button`,{type:`button`,className:`panel-toggle`,"aria-label":a(`Tasks`),onClick:()=>ie(e=>e===`left`?null:`left`),children:(0,h.jsx)(Xn,{"aria-hidden":`true`})}),(0,h.jsxs)(`div`,{className:`topbar-flow`,children:[r&&(0,h.jsx)(`button`,{type:`button`,className:`icon-btn`,"aria-label":a(`Workbench projects`),title:a(`Workbench projects`),onClick:r,children:(0,h.jsx)(ir,{})}),(0,h.jsxs)(`span`,{className:`brand`,children:[(0,h.jsx)(`span`,{className:`brand-logo`,"aria-hidden":`true`,children:`C`}),(0,h.jsx)(`h1`,{className:`brand-name`,children:`Cadence`})]}),P.workspace&&(0,h.jsxs)(`span`,{className:`chip static chip-root`,title:P.workspace.rootLabel,children:[(0,h.jsx)(ir,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:P.workspace.rootLabel})]}),(0,h.jsx)(`span`,{className:`tb-spacer`,"aria-hidden":`true`}),(0,h.jsxs)(`nav`,{className:`tb-tabs`,"aria-label":a(`Recorded views`),children:[(0,h.jsxs)(`button`,{type:`button`,className:`tb-tab`,"aria-pressed":be===`messages`&&!De,onClick:()=>{J(void 0),Ee(void 0),xe(`messages`)},children:[(0,h.jsx)(Yn,{"aria-hidden":`true`}),a(`Conversation`)]}),(0,h.jsxs)(`details`,{className:`view-menu`,ref:ye,onKeyDown:e=>{e.key===`Escape`&&ye.current&&(ye.current.open=!1,ye.current.querySelector(`summary`)?.focus())},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(e.currentTarget.open=!1)},children:[(0,h.jsxs)(`summary`,{className:`chip`,children:[be===`messages`?a(`Details`):o(be),(0,h.jsx)(hr,{"aria-hidden":`true`})]}),(0,h.jsxs)(`div`,{className:`view-menu-items`,children:[so.map(([e,t])=>(0,h.jsxs)(`button`,{type:`button`,"aria-pressed":be===e,onClick:()=>{J(void 0),Ee(void 0),xe(e),ye.current&&(ye.current.open=!1,ye.current.querySelector(`summary`)?.focus())},children:[(0,h.jsx)(t,{"aria-hidden":`true`}),o(e)]},e)),(0,h.jsxs)(`div`,{className:`view-menu-actions`,children:[(0,h.jsxs)(`button`,{type:`button`,"aria-label":a(`Export selected scope`),disabled:!tt,onClick:()=>{ye.current&&(ye.current.open=!1,ye.current.querySelector(`summary`)?.focus()),Te(!0)},children:[(0,h.jsx)(lr,{"aria-hidden":`true`}),a(`Export selected scope`)]}),(0,h.jsxs)(`button`,{type:`button`,"aria-label":a(`Copy token-free link`),disabled:!_,onClick:()=>{_&&Wr(Fa(_,De,M?{scope:M,snapshotSeq:G}:void 0)).then(e=>Re(e?``:a(`Link copy unavailable.`)))},children:[(0,h.jsx)($n,{"aria-hidden":`true`}),a(`Copy token-free link`)]})]})]})]})]}),(0,h.jsx)(`span`,{className:`tb-spacer`,"aria-hidden":`true`}),(0,h.jsxs)(`div`,{className:`tb-actions`,children:[(0,h.jsx)(Pi,{disabled:!nt,onOpen:()=>Ce(!0)}),(0,h.jsx)(`button`,{type:`button`,className:`chip`,"aria-label":a(`Observe current state`),"data-tip":a(`Observe current state`),onClick:()=>{P.refresh(),V.refresh()},children:(0,h.jsx)(qn,{"aria-hidden":`true`})}),(0,h.jsxs)(`button`,{type:`button`,className:`chip`,"aria-label":a(`Choose owner model`),"data-tip":a(`Choose owner model`),onClick:()=>d(!0),children:[(0,h.jsx)(ur,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`chip-label`,children:a(`Model`)})]}),(0,h.jsxs)(`button`,{type:`button`,className:`chip`,"aria-label":a(`Return — work continues`),"data-tip":a(`Return — accepted work continues`),onClick:()=>{Pe(void 0),ie(null),Ce(!1),Te(!1),X.current.depart(),Ie(!1),We.current?.abort(),m(!0)},children:[(0,h.jsx)(Zn,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`chip-label`,children:a(`Return`)})]}),(0,h.jsxs)(`button`,{type:`button`,className:`chip chip-lang`,lang:s===`zh`?`en`:`zh-CN`,"aria-label":s===`zh`?`Switch to English`:`切换到中文`,"data-tip":s===`zh`?`Switch to English`:`切换到中文`,onClick:()=>c(s===`zh`?`en`:`zh`),children:[(0,h.jsx)(tr,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:s===`zh`?`EN`:`中文`})]})]})]}),(0,h.jsxs)(`button`,{type:`button`,className:`panel-toggle has-label inspector-toggle`,"aria-label":a(`Plan / review`),"aria-expanded":ae?re===`right`:_e,onClick:()=>ae?ie(e=>e===`right`?null:`right`):ve(e=>!e),children:[(0,h.jsx)(Gn,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:a(b?`Files`:`Plan`)})]})]}),!P.workspace&&ct.length>0&&(0,h.jsx)(`section`,{className:`run-strip`,"aria-label":a(`Execution and cancellation`),children:ct.map(e=>(0,h.jsxs)(`div`,{className:`run-strip-row`,children:[(0,h.jsx)(`span`,{className:`status-dot busy`,"aria-hidden":`true`}),(0,h.jsxs)(`span`,{className:`run-strip-label`,children:[o(e.kind),` `,e.runId,` · `,o(e.stage)]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>Qe(e.taskId),children:a(`Open active task`)}),(0,h.jsxs)(`button`,{type:`button`,className:`danger`,disabled:!P.cancelCompatible||Ve.has(e.runId),onClick:()=>ot(e.runId),children:[(0,h.jsx)(Wn,{"aria-hidden":`true`}),a(`Cancel run — request stop`)]})]},e.runId))}),(0,h.jsx)(co,{error:Le,observationError:P.error}),(0,h.jsxs)(`div`,{ref:se,className:`layout`,style:{"--left-w":`${ce}px`,"--right-w":`${ue}px`},children:[(0,h.jsx)(`button`,{type:`button`,"aria-label":a(`Close drawer`),tabIndex:-1,className:`drawer-backdrop persistent${re?` on`:``}`,onClick:fe}),(0,h.jsxs)(`section`,{className:`panel-drawer drawer-left${re===`left`?` open`:``}`,"aria-label":a(`Task navigation drawer`),tabIndex:-1,inert:ae&&re!==`left`,children:[P.workspace&&(0,h.jsx)(Na,{client:l.client,workspace:P.workspace,taskId:_,scope:M,runs:rt,snapshot:V.state?.snapshot.committedSeq,activeRuns:P.activeRuns,cancelCompatible:!!P.cancelCompatible,canceling:Ve,onCancel:ot,chats:I.value?.kind===`conversations`?I.value.entries:[],conversationId:b,onConversation:Ze,onNewConversation:()=>Ze(),onTask:Qe,onScope:$e,onNew:()=>{fe(),w(null),Y(!0)}}),P.workspace&&(0,h.jsx)(Ki,{client:l.client,active:P.activeRuns,taskId:_,runs:rt,snapshot:Z,onOpen:(e,t,n,r)=>{Qe(e),N({kind:`child`,id:t}),ge(r),pe(n),history.replaceState(null,``,Fa(e,void 0,{scope:{kind:`child`,id:t},snapshotSeq:n}))}})]}),(0,h.jsx)(Ra,{side:`left`,width:ce,onResize:le}),(0,h.jsxs)(`main`,{className:`main`,inert:ae&&re!==null,children:[b&&(0,h.jsx)(ua,{client:l.client,id:b,workspaceId:F.current??`connecting`,available:!!P.workspace,canInterrupt:!!P.cancelCompatible,enabled:!!P.workspace&&!!P.compatible&&!P.error,onModel:()=>d(!0),onChanged:()=>{I.refresh(),P.refresh()},reference:k,onReferenceUsed:j,onCadence:e=>{Ae(e),w(b),Y(!0)}},`${F.current??`connecting`}:${b}`),M&&(0,h.jsxs)(`header`,{className:`conversation-header`,children:[(0,h.jsxs)(`div`,{className:`conversation-heading`,children:[M.kind!==`task`&&_&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>Qe(_,me),children:a(`Back to task`)}),B&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>Ze(B),children:a(`Back to ordinary conversation`)}),(0,h.jsx)(`h2`,{title:me||M.id,children:M.kind===`task`?me||a(`Task {id}`,{id:M.id.slice(0,8)}):he||a(`{kind} {id}`,{kind:o(M.kind),id:M.id.slice(0,8)})}),M.kind===`child`&&(0,h.jsx)(`span`,{className:`conversation-badge`,children:a(`Subagent`)})]}),(0,h.jsxs)(`details`,{className:`conversation-info`,children:[(0,h.jsxs)(`summary`,{children:[a(`Recorded conversation`),` ·`,` `,a(`snapshot {seq}`,{seq:Z??``})]}),(0,h.jsx)(`code`,{children:M.id}),(0,h.jsx)(`p`,{children:a(`Pages and old outcomes are historical observations, not renewed consent.`)})]})]}),(0,h.jsxs)(`div`,{className:`workspace-content`,hidden:!!b,children:[!tt&&(0,h.jsxs)(`section`,{className:`empty-state`,children:[(0,h.jsx)(`span`,{className:`empty-logo`,"aria-hidden":`true`,children:`C`}),(0,h.jsx)(`h2`,{children:a(`Open a task or create one explicitly`)}),(0,h.jsx)(`p`,{children:a(`Plans, children, checks and human review share one service owner. No chat or discovery activates execution.`)}),(0,h.jsxs)(`button`,{type:`button`,className:`primary`,disabled:!P.workspace,onClick:()=>Y(!0),children:[(0,h.jsx)(Jn,{"aria-hidden":`true`}),a(`Create task`)]})]}),tt&&De?(0,h.jsxs)(`div`,{className:`tab-body`,children:[q&&(q.owner.entity.kind===`task`||q.owner.entity.kind===`message`||q.owner.entity.kind===`tool`)&&(0,h.jsx)(xi,{client:l.client,seed:{storeId:De.storeId,scope:De.scope,snapshotSeq:De.snapshotSeq,kind:q.owner.entity.kind,id:q.owner.entity.id,version:q.owner.entity.version}},`${q.owner.entity.id}:${q.owner.entity.version}`),(0,h.jsx)(vi,{client:l.client,cursor:De,highlight:q?.range},`${De.recordId}:${De.recordVersion}`)]}):tt&&(0,h.jsxs)(`div`,{className:be===`messages`||be===`tools`?`tab-body transcript-body`:`tab-body`,children:[be===`messages`&&(0,h.jsx)(Ui,{client:l.client,seed:tt}),be===`tools`&&(0,h.jsx)(uo,{client:l.client,seed:tt}),be===`context`&&(0,h.jsx)(bi,{client:l.client,seed:tt}),be===`timeline`&&(0,h.jsx)(io,{client:l.client,seed:tt,onSearch:()=>Ce(!0)}),be===`runs`&&(0,h.jsx)(Ni,{client:l.client,seed:{...tt,scope:{kind:`task`,id:_??tt.scope.id}},onScope:$e},_),be===`outcomes`&&(rt.length>0?rt.map(e=>(0,h.jsx)(Ai,{run:e},e.childRunId??e.runId)):(0,h.jsx)(`p`,{className:`panel-empty`,children:ee&&V.state?a(`No owner run projection in this snapshot.`):a(`No snapshot observed yet; absence is not proof of settlement.`)}))]},`${M?.kind}:${M?.id}:${G??`current`}`)]}),P.workspace&&ze.length>0&&(0,h.jsx)(`div`,{className:`receipt-dock`,children:ze.map(e=>(0,h.jsx)(ai,{client:l.client,value:e,onChange:Ge},e.commandId))})]}),(0,h.jsx)(Ra,{side:`right`,width:ue,onResize:de}),(0,h.jsx)(`section`,{className:`panel-drawer drawer-right${re===`right`?` open`:``}`,"aria-label":a(`Plan and review drawer`),tabIndex:-1,inert:ae&&re!==`right`,children:(0,h.jsxs)(`div`,{className:`workbench-right`,children:[(0,h.jsxs)(`nav`,{className:`rp-tabs`,"aria-label":a(`Workspace panels`),children:[(0,h.jsxs)(`button`,{type:`button`,className:`rp-tab`,"aria-pressed":D===`files`,onClick:()=>O(`files`),children:[(0,h.jsx)(ir,{}),a(`Files`)]}),(0,h.jsxs)(`button`,{type:`button`,className:`rp-tab`,"aria-pressed":D===`task`,disabled:!tt,onClick:()=>O(`task`),children:[(0,h.jsx)(er,{}),a(`Task details`)]})]}),D===`files`?(0,h.jsx)(fa,{client:l.client,enabled:!!P.workspace,onReference:e=>{b||Ze(B??void 0),A(e),fe()}}):tt?(0,h.jsx)(Ea,{client:l.client,context:te,seed:{...tt,scope:{kind:`task`,id:_??tt.scope.id}},runs:rt,canAct:ne&&!Fe,onAction:e=>void Xe(e),planMetadata:U},_):(0,h.jsx)(Ta,{})]})})]}),(0,h.jsxs)(`footer`,{className:`statusbar`,children:[(0,h.jsxs)(`div`,{className:`statusbar-left`,children:[(0,h.jsxs)(`span`,{className:`status-item`,role:`status`,title:a(`Connection freshness is not execution outcome.`),children:[(0,h.jsx)(`span`,{className:`status-dot ${V.error||!P.workspace?`error`:V.transportStatus===`current`?V.state?V.state.connection===`current`?`ok`:`busy`:``:`busy`}`,"aria-hidden":`true`}),o(lt),a(` · transport {status}`,{status:o(V.transportStatus)}),V.error?` · ${o(V.error)}`:``]}),(0,h.jsx)(`span`,{className:`status-item${st?.status===`complete`?ct.length>0?` warn`:``:` faint`}`,children:st?.status===`complete`?ct.length>0?a(ct.length===1?`{count} active run`:`{count} active runs`,{count:ct.length}):a(`No active runs`):a(`Active roster unavailable; absence is not proof of settlement.`)})]}),(0,h.jsxs)(`div`,{className:`statusbar-right`,children:[P.workspace&&(0,h.jsx)(Pa,{path:R,onClick:()=>E(``)}),(0,h.jsxs)(`div`,{className:`status-item${P.compatible?` faint`:` warn`}`,title:Tr?.buildId??a(`unbuilt source`),children:[(0,h.jsxs)(`details`,{className:`build-part`,children:[(0,h.jsx)(`summary`,{children:a(`Build information`)}),(0,h.jsx)(y,{text:a(`Local browser build: {build}.`),slots:{build:(0,h.jsx)(`code`,{children:Tr?.buildId??a(`unbuilt source`)})}}),` `]}),(0,h.jsx)(`span`,{children:a(`Shared compatibility: {state}.`,{state:P.compatible?a(`compatible`):a(`unavailable / mismatch — reload built assets; normal actions disabled`)})})]})]})]}),T!==null&&P.workspace&&(0,h.jsx)(Da,{onOpen:n,projects:i??(L.value?.kind===`projects`?L.value.entries:[]),client:l.client,current:R??P.workspace.rootLabel,initial:T||void 0,epoch:P.workspace.epoch,onClose:()=>E(null)}),u&&(0,h.jsx)(ii,{client:l.client,compatible:!!P.compatible&&P.transportStatus===`current`&&!P.error,onClose:()=>d(!1),onChanged:()=>{Pe(void 0),X.current.depart(),P.refresh(!0)}}),Oe&&(0,h.jsxs)(Lr,{title:a(`Create task`),onClose:()=>Y(!1),children:[(0,h.jsxs)(`label`,{children:[a(`Kind`),(0,h.jsxs)(`select`,{"aria-label":a(`Kind`),value:je,onChange:e=>Me(e.target.value===`research`?`research`:e.target.value===`diagnosis`?`diagnosis`:`code`),children:[(0,h.jsx)(`option`,{value:`code`,children:a(`Code`)}),(0,h.jsx)(`option`,{value:`research`,children:a(`Readonly research`)}),(0,h.jsx)(`option`,{value:`diagnosis`,children:a(`Readonly diagnosis`)})]})]}),(0,h.jsxs)(`label`,{children:[a(`Goal`),(0,h.jsx)(`textarea`,{"aria-label":a(`Goal`),value:ke,onChange:e=>Ae(e.target.value),rows:6})]}),(0,h.jsx)(`footer`,{children:(0,h.jsx)(`button`,{type:`button`,className:`primary`,disabled:!P.actions||P.workspace?.context.status!==`available`||Fe||!ke.trim(),onClick:()=>{Y(!1),Xe({kind:`create`,taskKind:je,goal:ke})},children:a(`Preview Create (does not Start)`)})})]}),Ne&&(0,h.jsx)(ni,{prepared:Ne,client:l.client,current:P.actions&&(ne||Ne.preflight.preview.action.kind===`create`)?Ye:null,attachmentVersion:P.attachmentVersion,onClose:()=>{X.current.current(it)&&(X.current.depart(),Pe(e=>e===Ne?void 0:e))},onResult:at},Ne.commandId),Se&&nt&&(0,h.jsx)(ki,{client:l.client,seed:nt,onClose:()=>Ce(!1),onHit:e=>{Ee(e),J(e.cursor),_&&history.replaceState(null,``,Fa(_,e.cursor,M?{scope:M,snapshotSeq:G}:void 0))}}),we&&nt&&(0,h.jsx)(Ei,{request:{storeId:nt.storeId,scope:nt.scope,snapshotSeq:nt.snapshotSeq,format:`ndjson`},onClose:()=>Te(!1)})]})}function uo({client:e,seed:t}){let n=ui(e,{...t,reader:`tools`}),r=n.page;return(0,h.jsxs)(`section`,{className:`tools-list`,children:[(0,h.jsx)(yi,{pager:n}),(0,h.jsx)(`div`,{className:`tools-body`,children:r&&!(`kind`in r)&&r.records.map(t=>t.kind===`tool`?(0,h.jsx)(Gi,{record:t,client:e,seed:r.request},`${t.owner.entity.id}:${t.version}`):null)})]})}function fo({ready:e,onOpenFolder:t,children:n}){let{t:r,locale:i,setLocale:a}=C(),[o,s]=(0,f.useState)(null),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(!0),p=(0,f.useRef)(null),m=(0,f.useCallback)(()=>s(null),[]);(0,f.useEffect)(()=>{let e=matchMedia(`(max-width: 900px)`),t=()=>l(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),Qa({enabled:c,open:o,onOpenChange:s,container:p}),za(p,o,c,m);let g=()=>{m(),t()};return(0,h.jsxs)(`div`,{className:`app workbench-entry${u?``:` inspector-hidden`}`,children:[(0,h.jsxs)(`header`,{className:`topbar`,children:[(0,h.jsx)(`button`,{type:`button`,className:`panel-toggle`,"aria-label":r(`Tasks`),onClick:()=>s(e=>e===`left`?null:`left`),children:(0,h.jsx)(Xn,{"aria-hidden":`true`})}),(0,h.jsxs)(`div`,{className:`topbar-flow`,children:[(0,h.jsxs)(`span`,{className:`brand`,children:[(0,h.jsx)(`span`,{className:`brand-logo`,"aria-hidden":`true`,children:`C`}),(0,h.jsx)(`h1`,{className:`brand-name`,children:`Cadence`})]}),(0,h.jsx)(`span`,{className:`tb-spacer`}),(0,h.jsx)(`div`,{className:`tb-actions`,children:(0,h.jsxs)(`button`,{type:`button`,className:`chip chip-lang`,lang:i===`zh`?`en`:`zh-CN`,onClick:()=>a(i===`zh`?`en`:`zh`),"aria-label":i===`zh`?`Switch to English`:`切换到中文`,children:[(0,h.jsx)(tr,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:i===`zh`?`EN`:`中文`})]})})]}),(0,h.jsxs)(`button`,{type:`button`,className:`panel-toggle has-label inspector-toggle`,"aria-label":r(`Files`),"aria-expanded":c?o===`right`:u,onClick:()=>c?s(e=>e===`right`?null:`right`):d(e=>!e),children:[(0,h.jsx)(Gn,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:r(`Files`)})]})]}),n,(0,h.jsxs)(`div`,{className:`layout`,ref:p,children:[(0,h.jsx)(`button`,{type:`button`,"aria-label":r(`Close drawer`),tabIndex:-1,className:`drawer-backdrop persistent${o?` on`:``}`,onClick:m}),(0,h.jsx)(`section`,{className:`panel-drawer drawer-left${o===`left`?` open`:``}`,"aria-label":r(`Task navigation drawer`),tabIndex:-1,inert:c&&o!==`left`,children:(0,h.jsxs)(`aside`,{className:`panel panel-left lp-panel`,children:[(0,h.jsx)(ka,{onConversation:g,disabled:!e}),(0,h.jsxs)(`section`,{className:`lp-section`,children:[(0,h.jsx)(`header`,{className:`lp-section-header`,children:(0,h.jsx)(`span`,{className:`lp-section-title`,children:r(`Conversation history`)})}),(0,h.jsx)(`p`,{className:`panel-hint`,children:r(`No conversations yet.`)})]})]})}),(0,h.jsx)(`main`,{className:`main`,inert:c&&o!==null,children:(0,h.jsxs)(`section`,{className:`chat-workspace`,"aria-label":r(`Ordinary conversation`),children:[(0,h.jsx)(`div`,{className:`chat-messages`,children:(0,h.jsx)(ca,{})}),(0,h.jsxs)(`div`,{className:`chat-composer`,children:[(0,h.jsx)(`textarea`,{disabled:!0,"aria-label":r(`Message`),rows:3,placeholder:r(`Choose a working folder at the bottom right to start chatting.`)}),(0,h.jsxs)(`div`,{className:`composer-toolbar`,children:[(0,h.jsx)(`span`,{className:`composer-hint`,children:r(`Ordinary conversation`)}),(0,h.jsxs)(`button`,{type:`button`,className:`primary`,disabled:!0,children:[(0,h.jsx)(yr,{"aria-hidden":`true`}),r(`Send`)]})]})]})]})}),(0,h.jsx)(`section`,{className:`panel-drawer drawer-right${o===`right`?` open`:``}`,"aria-label":r(`Files`),tabIndex:-1,inert:c&&o!==`right`,children:(0,h.jsxs)(`aside`,{className:`panel files-panel`,children:[(0,h.jsxs)(`header`,{className:`files-toolbar`,children:[(0,h.jsx)(ir,{"aria-hidden":`true`}),r(`Files`)]}),(0,h.jsx)(`p`,{className:`panel-hint`,children:r(`Files appear here after you open a working folder.`)})]})})]}),(0,h.jsxs)(`footer`,{className:`statusbar`,children:[(0,h.jsx)(`div`,{className:`statusbar-left`,children:(0,h.jsx)(`span`,{className:`status-item faint`,children:r(`No working folder selected`)})}),(0,h.jsx)(`div`,{className:`statusbar-right`,children:(0,h.jsx)(Pa,{disabled:!e,onClick:g})})]})]})}async function po(e){return ne(await En(e,1048576),1048576)}function mo(e){return e&&typeof e==`object`&&`kind`in e&&e.kind===`error`&&`error`in e&&e.error&&typeof e.error==`object`&&`code`in e.error?String(e.error.code):`unavailable`}function ho(){let{t:e}=C(),[t,n]=(0,f.useState)(),[r,i]=(0,f.useState)(Ci),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(0),d=(0,f.useRef)(new Map);(0,f.useEffect)(()=>{let e=new AbortController;return(async()=>{try{let t=await fetch(`/workbench/v1`,{credentials:`same-origin`,redirect:`error`,cache:`no-store`,signal:e.signal}),r=await po(t);t.status===400&&mo(r)===`invalid`?n(null):t.ok?(n(sn(r)),c(``)):c(mo(r))}catch{e.signal.aborted||c(`unavailable`)}})(),()=>e.abort()},[l]),(0,f.useEffect)(()=>{let e=()=>i(Ci());return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);let p=(0,f.useCallback)(e=>{r&&d.current.set(r,window.location.hash),history.pushState(null,``,e?`/app?project=${e.id}${d.current.get(e.id)??``}`:`/app`),i(e?.id??null),o(null)},[r]),m=(0,f.useCallback)(async e=>{if(!t||!Tr)throw Error(`unavailable`);let r=crypto.randomUUID(),i=await fetch(`/workbench/v1/open`,{method:`POST`,credentials:`same-origin`,redirect:`error`,headers:{"Content-Type":`application/json`,"X-Cadence-CSRF":t.csrf,"X-Cadence-Build":JSON.stringify({kind:`browser`,...Tr})},body:JSON.stringify({commandId:r,path:e,epoch:t.epoch})}),a=await po(i);if(!i.ok||!a||typeof a!=`object`||!(`kind`in a)||a.kind!==`project`||!(`project`in a))throw Error(mo(a));let o=on(a.project);n(e=>e&&{...e,projects:[...e.projects.filter(e=>e.id!==o.id),o]}),p(o)},[t,p]),g=(0,f.useMemo)(()=>({async workbenchRead(e,t){try{if(e.kind!==`directories`)throw new k(`invalid`);let n=await fetch(`/workbench/v1/directories?path=${encodeURIComponent(e.path)}`,{credentials:`same-origin`,redirect:`error`,signal:t}),r=await po(n);if(!n.ok)throw new k(`unavailable`);return{kind:`ok`,value:pn(r)}}catch{return{kind:`error`,error:A(`unavailable`)}}}}),[]),_=(0,f.useMemo)(()=>r?Er(r):void 0,[r]);if(t===null)return(0,h.jsx)(lo,{});let v=t?.projects.find(e=>e.id===r);return t&&v&&_?(0,h.jsx)(lo,{api:_,onOpenProject:m,onWorkbenchHome:()=>p(null),projectEntries:t.projects.map(e=>({path:e.cwd,current:e.id===r}))},`${v.id}:${v.epoch}`):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(fo,{ready:!!t,onOpenFolder:()=>o(t?.home??``),children:[s&&(0,h.jsxs)(`p`,{role:`alert`,className:`banner-notice`,children:[s,` `,(0,h.jsx)(`button`,{type:`button`,onClick:()=>u(e=>e+1),children:e(`Reload observation`)})]}),r&&!v&&t&&(0,h.jsx)(`p`,{role:`alert`,className:`banner-notice`,children:e(`Selected project is unavailable. Choose a project explicitly; no directory was reconstructed.`)})]}),t&&a!==null&&(0,h.jsx)(Da,{client:g,current:``,projects:t.projects.map(e=>({path:e.cwd,current:!1})),initial:a,epoch:t.epoch,onClose:()=>o(null),onOpen:m})]})}function go(){let{t:e}=C();return(0,h.jsxs)(`main`,{className:`entry`,children:[(0,h.jsx)(`h1`,{children:e(`Presentation unavailable`)}),(0,h.jsx)(`p`,{children:e(`No execution result is inferred. Reconnect to observe the owner; accepted work continues.`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:e(`Reload observation`)})]})}var _o=class extends f.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,h.jsx)(go,{}):this.props.children}},vo=document.getElementById(`root`);if(!vo)throw Error(`Application root unavailable`);(0,p.createRoot)(vo).render((0,h.jsx)(w,{children:(0,h.jsx)(_o,{children:(0,h.jsx)(ho,{})})}));export{ro as t};