@abelxiaoxing/cadence 2.0.17 → 2.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.de.md +106 -0
- package/README.es.md +106 -0
- package/README.fr.md +106 -0
- package/README.ja.md +127 -0
- package/README.ko.md +124 -0
- package/README.md +64 -709
- package/README.pt-BR.md +106 -0
- package/README.ru.md +107 -0
- package/README.zh-CN.md +106 -0
- package/THIRD_PARTY_NOTICES.md +0 -8
- package/docs/reuse-and-distribution.md +1 -24
- package/docs/service-management.md +8 -0
- package/package.json +9 -1
- package/src/service-host.mjs +34 -27
- package/web/dist/assets/cadence.js +9 -9
- package/web/dist/manifest.json +4 -4
- package/licenses/pi-web-ui-reuse.md +0 -24
|
@@ -1,13 +1,13 @@
|
|
|
1
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.":`从左侧开启一段新对话。`,"Conversations are kept with each project. Open a working folder to see its history.":`历史对话按项目保存。打开工作文件夹后,即可查看它的历史对话。`,"Conversations are kept with each project. Choose a project below and open it to see its history.":`历史对话按项目保存。在下方选择项目并打开,即可查看它的历史对话。`,"Returning to your last project {name}…":`正在回到上次的项目 {name}…`,"Your last project {name} is not running. Choose it below and open it again to see its conversations.":`上次的项目 {name} 当前未运行。在下方选择它并重新打开,即可查看它的对话。`,"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 folder":`打开此文件夹`,"Opening folder…":`正在打开文件夹…`,"Will open:":`将打开:`,"Open {path}":`打开 {path}`,"Folder path":`文件夹路径`,"Type or paste a path, then press Enter":`输入或粘贴路径,按回车前往`,"Edit path":`输入路径`,"Current location":`当前位置`,"Home folder":`主目录`,"Home folder (~)":`主目录(~)`,"Filter folders":`筛选文件夹`,"Filter this folder…":`筛选当前文件夹…`,"Reading folder…":`正在读取文件夹…`,"No matching folders.":`没有匹配的文件夹。`,"No subfolders.":`没有子文件夹。`,"Enter a full path, for example ~/project.":`请输入完整路径,例如 ~/project。`,"This folder does not exist. Check the path.":`找不到这个文件夹,请检查路径。`,"This location cannot be browsed: it belongs to another account, is protected, or is not a plain folder (for example a link).":`无法浏览这个位置:它属于其他账户、受保护,或不是普通文件夹(例如符号链接)。`,"This folder could not be read right now; it may lack read permission. Try again.":`暂时无法读取这个文件夹,可能没有读取权限,请重试。`,"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":`准备任务`,"Analyzing task…":`正在分析任务…`,"Send to begin analysis. You will confirm the plan before any edits.":`发送后开始分析,修改代码前会请你确认计划。`,"Task preparation unavailable. Observe the original receipt before sending again.":`任务准备不可用,请先查看原始请求结果,不要重复发送。`,"Task preparation stopped: {reason}. Observe the original receipt; no automatic retry.":`任务准备已停止:{reason}。请查看原始请求结果,不会自动重试。`,"Plan approval":`计划确认`,"Plan metadata read in progress. Try again after observation completes.":`计划信息仍在读取,请等状态更新后再试。`,"This task already has a plan. Review it in Task details instead.":`此任务已有计划,请在任务详情中查看,避免覆盖现有计划。`,"Analysis complete. Review the plan before making changes.":`分析完成,请在修改代码前确认计划。`,"Analysis and progress appear below. No edits start before plan approval.":`分析过程与进度显示在下方,确认计划前不会修改代码。`,"Review implementation plan":`查看实施计划`,"Confirm plan and execute":`确认计划并执行`,"Approving saves this exact plan and starts it. No separate Start confirmation is needed.":`确认后将保存并执行当前计划,无需再次点击启动。`,"Context changed. Close and review the plan again.":`任务上下文已变化,请关闭后重新查看计划。`,"Plan confirmation expired. Review the plan again.":`计划确认已过期,请重新查看计划。`,"Plan execution stopped: {reason}. Observe the original receipt; no automatic retry.":`计划执行流程已停止:{reason}。请查看原始请求结果,不会自动重试。`,"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:`运行`,"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":`创建任务`,"Runs in the current snapshot":`当前快照中的运行`,"Retained runs":`已保留的运行记录`,"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 ke(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 Ae(e){let t=z(e,[`disposition`,`value`]),n=I(t.disposition,[`observed`,`unavailable`,`redacted`]),r=Fe(t.value);return n===`observed`!=(r!==null)&&j(),{disposition:n,value:r}}function je(e){let t=z(e,[`messageId`,`blockId`]);return{messageId:V(t.messageId),blockId:V(t.blockId)}}function Me(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 Ne(e){let t=z(e,[`owner`,`field`,`encoding`]),n=Me(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 Pe(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:Me(t.owner),sourceType:n,mimeType:i,reason:r}}function Fe(e){if(e===null)return null;let t=M(e,128,!0);return/^[a-zA-Z0-9_-]+$/.test(t)||j(),t}function Ie(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:Ae(n.source),resultCallId:i}}case`message-text`:{let n=z(e,[`kind`,`messageId`,`blockId`,`detailId`]);return{kind:t,...je({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:je(n.declaration),index:P(n.index,0,D.dataFrames),source:Ae(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,je),source:Ae(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,je),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:Ae(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:Pe(z(e,[`kind`,`block`]).block)};case`detail-begin`:{let n=z(e,[`kind`,`detailId`,`descriptor`]);return{kind:t,detailId:V(n.detailId),descriptor:Ne(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 Le(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 Re(e){let t=z(e,[`messageId`,`detailId`]);return{messageId:V(t.messageId),detailId:V(t.detailId)}}function ze(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 Be(e){let t=K(e,`status`);if(t===`committed`){let n=z(e,[`status`,`selected`,`detail`]),r=Re(n.selected),i=ze(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,Re),error:re(n.error)}}let n=z(e,[`status`,`selected`]);return{status:I(t,[`pending`,`uncertain`]),selected:R(n.selected,Re)}}function Ve(e,t){let n=R(e,U);return(n===`0`||n!==null&&t.status===`committed`&&ee(n,t.detail.committedSeq)<0)&&j(),n}function He(e){return e.native?.outcome===`completed`&&e.recording.status===`committed`&&e.settlementSeq!==null}function Ue(e){return e.kind===`parent`?e.outcome:e.native.outcome===`completed`?e.kind===`sdk`?He(e)?`completed`:`failed`:e.capture.observed===`complete`&&e.settlementSeq!==null?`completed`:`failed`:e.native.outcome}function We(e){let t=K(e);if(t===`sdk`){let n=z(e,[`kind`,`native`,`recording`,`settlementSeq`]),r=Be(n.recording),i=Ve(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:Le(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=Be(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:Ve(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(He))&&j(),{kind:`parent`,outcome:i,required:r}}function Y(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=Y(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=Ie(t.event);return(i.kind===`detail-chunk`||i.kind===`detail-end`)&&j(),{source:n,event:i}}function Ke(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 qe(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:Je(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 Je(e){let t=re(e);return L(t.effect,`none`),t}function Ye(e){let t=z(e,[`sourceHash`,`contractHash`,`buildId`]);return{sourceHash:H(t.sourceHash),contractHash:H(t.contractHash),buildId:H(t.buildId)}}function Xe(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,...Ye({contractHash:n.contractHash,sourceHash:n.sourceHash,buildId:n.buildId})}}function Ze(e){let t=z(e,[`contractHash`,`assets`]);return{contractHash:H(t.contractHash),assets:Ye(t.assets)}}function Qe(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 $e(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,We),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&&Ue(n.settlement)!==n.execution||n.created?.state===`published`&&n.publication!==`published`)&&j(),n}function et(e){W(e);let t=z(e,[`identity`,`receipt`]),n=Se(t.identity),r=$e(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 X(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 tt(e){switch(W(e),K(e,`status`)){case`found`:return{status:`found`,receipt:$e(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 nt(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:ft(t.admission),lifecycle:I(t.lifecycle,[`queued`,`preparing`,`running`,`closing`,`settled`]),outcome:R(t.outcome,e=>I(e,ae)),settlement:R(t.settlement,We),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&&Ue(n.settlement)!==n.outcome)||n.childRunId===null!=(n.assignmentId===null)||n.lifecycle===`settled`!=(n.outcome!==null)||n.outcome===`completed`&&(!n.settlement||Ue(n.settlement)!==`completed`||n.coverage.observed!==`complete`))&&j(),n}function rt(e,t){return t.kind===`task`?e.taskId===t.id:t.kind===`run`?e.runId===t.id:e.childRunId===t.id}function it(e,t,n){return rt(e,t)&&e.taskId===ht(n)&&e.admission.context.workspaceId===mt(n)}function at(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:pt(t.context),runs:B(t.runs,D.maxPageEntries,nt),horizon:Et(t.horizon)};return(!gt(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=>!it(e,n.scope,n.context))||new Set(n.runs.map(e=>e.childRunId??e.runId)).size!==n.runs.length)&&j(),n}function ot(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=pt(n.context);gt(i,r.epoch,r.scope)||j();let a=B(n.runs,D.maxPageEntries,nt),o=B(n.removed,D.maxPageEntries,V),s=a.map(e=>e.childRunId??e.runId);return(a.some(e=>!it(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 st(e){let{navigation:t,...n}=e;return n}function ct(e,t){(!t.navigation||t.navigation===e.navigation||W(st(e))!==W(st(t)))&&j()}function lt(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return ut(e);W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`kind`,`cursor`,`next`,`coverage`]),n=ke(t.cursor),r=ke(t.next);return ct(n,r),{kind:`progress`,cursor:n,next:r,coverage:q(t.coverage)}}function ut(e){W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`cursor`,`content`,`range`,`text`,`next`,`coverage`]),n={cursor:ke(t.cursor),content:G(t.content),range:R(t.range,pe),text:M(t.text,D.detailPageBytes),next:R(t.next,ke),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(st({...n.next,offset:n.cursor.offset}))!==W(st(n.cursor)))&&j(),n}function dt(e){W({kind:`ok`,value:e},D.pageBytes);let t=z(e,[`cursor`,`hits`,`next`,`coverage`]),n=ke(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=yt(t.owner);bt(a,n.scope)||j();let o=pe(t.range),s=ke(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,ke);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 ft(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 pt(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 mt(e){return e.status===`available`?e.version.workspaceId:e.workspaceId}function ht(e){return e.status===`available`?e.version.task?.id??null:e.taskId}function gt(e,t,n){return(e.status!==`available`||e.version.epoch===t)&&(n.kind!==`task`||ht(e)===n.id)}function _t(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:Ze(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 vt(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:qe(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:pt(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(),(mt(n.context)!==n.workspaceId||ht(n.context)!==null||n.context.status===`available`&&n.context.version.epoch!==n.epoch)&&j(),n}function yt(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 bt(e,t){return t.kind===`task`?e.taskId===t.id:t.kind===`run`?e.runId===t.id:e.childRunId===t.id}function xt(e){let t=z(e,[`identity`,`complete`,`checkoutGeneration`]);return{identity:H(t.identity),complete:F(t.complete),checkoutGeneration:P(t.checkoutGeneration)}}function St(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:ft(n.identity)}}case`parent-settled`:{let n=z(e,[`kind`,`runId`,`settlement`]),r=We(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:xt(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:xt(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:xt(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=Le(r.native),o=I(r.status,[`passed`,`failed`,`canceled`,`stale`]),s=xt(r.before),c=xt(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 Ct(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 wt(e){W(e,D.ownerQueueBytes);let t=z(e,[`observedMs`,`link`,`events`]),n=Ct(t.link),r=B(t.events,D.ownerQueueFrames,e=>{let t=K(e);if(t===`fact`){let r=St(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=yt(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 Tt=[`tasks`,`runs`,`messages`,`tools`,`contents`,`events`,`checks`,`changes`,`reviews`];function Z(e){let t=z(e,[`reader`,`storeId`,`scope`,`snapshotSeq`,`after`,`limit`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]),n=I(t.reader,Tt),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=Z(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:nt(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:Ke(n.link),capture:Ge(n.capture)}}if(t===`owner-fact`){let n=z(e,[`kind`,`recordId`,`committedSeq`,`observedMs`,`link`,`fact`]),r=wt({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=yt(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:Ae(i.source)}}if(t===`tool`){let e=R(i.declaration,je),n=R(i.declarationStage,e=>I(e,[`partial`,`final`])),r=F(i.startObserved),s=R(i.result,e=>{let t=Ie(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:Ae(i.source),name:M(i.name,128,!0)}}if(t===`content`){let e=Ne(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=Pe(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=Z(t.request);n.snapshotSeq===null&&j();let r=B(t.records,n.limit,Dt),i=R(t.next,Z);return(r.some(e=>!kt(e,n))||i&&(i.after===null||W(st({...i,after:n.after}))!==W(st(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=Z(t.request),r=Z(t.next);return(n.snapshotSeq!==null||n.after!==null||r.snapshotSeq===null||!r.navigation||W(st({...r,snapshotSeq:null}))!==W(st(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=Z(t.request),r=Z(t.next);return ct(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 ct(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:yt(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`&&!bt(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`?rt(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:bt(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||!bt(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 ct(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`)||mt(e.context)!==e.workspaceId||ht(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:pt(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:pt(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:Ze(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=Z(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 ke(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 X(t,jt);switch(e){case`workbenchRead`:case`workbenchCommand`:return X(t,pn);case`current`:return X(t,Qt);case`currentChanges`:return X(t,$t);case`activeRuns`:return X(t,qe);case`models`:return X(t,an);case`chooseModel`:return X(t,tn);case`session`:return X(t,_t);case`workspace`:return X(t,vt);case`checkObligations`:return X(t,Vt);case`entity`:return X(t,Wt);case`graph`:return X(t,Ft);case`snapshot`:return X(t,at);case`detail`:return X(t,lt);case`search`:return X(t,dt);case`preflight`:return X(t,Te);case`command`:case`cancel`:return X(t,$e);case`receipt`:return tt(t);case`detach`:return X(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:at(z(e,[`kind`,`snapshot`]).snapshot)}:t===`event`?{kind:t,event:ot(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&&=Xe(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=X(l,_t);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`,Z(e),t)}runs(e,t){return this.request(`runs`,Z(e),t)}messages(e,t){return this.request(`messages`,Z(e),t)}tools(e,t){return this.request(`tools`,Z(e),t)}contents(e,t){return this.request(`contents`,Z(e),t)}events(e,t){return this.request(`events`,Z(e),t)}checks(e,t){return this.request(`checks`,Z(e),t)}changes(e,t){return this.request(`changes`,Z(e),t)}reviews(e,t){return this.request(`reviews`,Z(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=X(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
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:`path`,attr:{d:`M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`},child:[]},{tag:`polyline`,attr:{points:`9 22 9 12 15 12 15 22`},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:`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 rr(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 ir(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 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:`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 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:`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 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:`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 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:`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 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:`M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z`},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:`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 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:`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 fr(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 pr(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 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:`18 15 12 9 6 15`},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:`9 18 15 12 9 6`},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:`6 9 12 15 18 9`},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:`20 6 9 17 4 12`},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:`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 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?X(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=X(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=X(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=X(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?X(await this.transport.activeRuns(e),qe):$(!1)}catch{return $(!1)}}async models(e){try{return this.transport.models?X(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=X(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=X(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=X(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 X(await this.transport.session(e),_t)}catch{return $(!1)}}async workspace(e){try{return X(await this.transport.workspace(e),vt)}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=Z({...t,reader:e});try{let t=X(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=X(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=X(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=X(await this.transport.command(n),$e);if(e.kind===`ok`){if(e.value.commandId!==n.commandId)return $(!0);et({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=X(await this.transport.cancel(t),$e);if(e.kind===`ok`){if(e.value.commandId!==t.commandId)return $(!0);et({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=tt(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=X(await this.transport.snapshot(n,t),at);return e.kind===`ok`&&W(e.value.scope)!==W(n)?$(!1):e}catch{return $(!1)}}async detail(e,t){let n=ke(e);try{let e=X(await this.transport.detail(n,t),lt);return e.kind===`ok`&&W(e.value.cursor)!==W(n)?$(!1):e}catch{return $(!1)}}async search(e,t){let n=ke(e);try{let e=X(await this.transport.search(n,t),dt);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=at(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=ot(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||mt(i.context)!==mt(a.context)||ht(i.context)!==ht(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{at(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:`96fe35f155624d8a1c64cf04e44e08f54bb08ea6db1d919cfbdb7d04a09c22eb`,contractHash:`944f3b53bd5b7f1d3f30868e0947d900e356ae9a2bcfb9f591edd988b3d5eb3a`,buildId:`0a9208fcf8059448f183c66d2f1efd4382a8c75dbd69d519936a2c2249ae46d7`};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){if(e.aborted)throw Error(`canceled`)}function Mr(e,t){let n=({task:e,controlRev:t,...n})=>n;if(W(n(e))!==W(n(t)))throw Error(`stale`)}async function Nr(e,t){if(jr(e.signal),Date.now()>=Date.parse(t.preflight.expiresAt))throw Error(`expired`);e.observe({commandId:t.commandId,error:`Admission pending/unknown — observe this exact receipt.`});let n=await Sr(e.client,t);if(n.kind===`error`)throw e.observe({commandId:t.commandId,error:`${n.error.code}; effect ${n.error.effect}`}),Error(n.error.code);if(e.observe({commandId:t.commandId,receipt:n.value}),jr(e.signal),n.value.admission!==`accepted`)throw Error(n.value.admission);return n.value}async function Pr(e,t){let n=t,r=Date.now()+3e4;for(;n.publication===`pending`&&Date.now()<r;){jr(e.signal),await new Promise(e=>setTimeout(e,250)),jr(e.signal);let t=await e.client.receipt(n.commandId,e.signal);if(jr(e.signal),e.observe({commandId:n.commandId,lookup:t}),t.status===`absent`)throw Error(`receipt-inconclusive`);t.status===`found`&&(n=t.receipt)}if(n.admission!==`accepted`||n.publication!==`published`)throw Error(`Publication unconfirmed. Observe the original receipt; do not repeat the action.`);return n}async function Fr(e,t){jr(e.signal);let n=await e.client.current({storeId:e.storeId,taskId:t},e.signal);if(jr(e.signal),n.kind===`error`)throw Error(n.error.code);if(n.value.context.status!==`available`)throw Error(`unavailable`);let r=n.value.context.version;if(r.task?.id!==t)throw Error(`stale`);return r}async function Ir(e){jr(e.signal);let t=await xr(e.client,e.context,{kind:`create`,taskKind:`code`,goal:e.goal});if(t.kind===`error`)throw Error(t.error.code);let n=await Pr(e,await Nr(e,t.value));if(n.created?.state!==`published`)throw Error(`receipt-inconclusive`);let r=n.created.taskId,i=await Fr(e,r);Mr(e.context,i);let a=await xr(e.client,i,{kind:`generate-plan`,taskId:r});if(a.kind===`error`)throw Error(a.error.code);return await Nr(e,a.value),r}async function Lr(e){let{prepared:t}=e,n=t.preflight.preview;if(n.action.kind!==`save-plan`)throw Error(`invalid`);await Pr(e,await Nr(e,t));let r=await Fr(e,n.action.taskId);if(Mr(n.version,r),r.task?.kind!==n.version.task?.kind||r.task?.revision!==(n.version.task?.revision??0)+1)throw Error(`stale`);let i=await xr(e.client,r,{kind:`start`,taskId:n.action.taskId});if(i.kind===`error`)throw Error(i.error.code);if(i.value.preflight.preview.readablePlan!==n.action.plan||W(i.value.preflight.preview.graph)!==W(n.action.graph))throw Error(`stale`);await Nr(e,i.value)}function Rr(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 zr(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 Br=e=>e===`unauthenticated`||e===`forbidden`,Vr=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=!1,_={actions:!1,transportStatus:`closed`,attachmentVersion:0},v=()=>!r&&n===this.version,y=()=>{v()&&t({..._,observation:c.state})},b=()=>{r||(r=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),n===this.version&&(this.pollCurrent=void 0))};this.stopCurrent=b;let x=e=>{this.serial=this.serial.then(e).catch(()=>{v()&&(h=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),_.error=`Observation unavailable or detach unconfirmed; explicit re-entry required.`,_.actions=!1,_.transportStatus=`closed`,_.workspace=void 0,c=new wr,y())})},S=async()=>{await this.api.transport.detach()},C=async(t=!1)=>{if(!v()||!f||d||h)return;d=!0,_.actions=!1;let n=!1;y(),p=Date.now();let r=s.signal;try{let i=async()=>{let e=await this.api.client.session(r);return!v()||r.aborted?!1:e.kind===`error`?(_.actions=!1,_.error=e.error.code,Br(e.error.code)&&w(),!1):(T(e.value),!0)};if(t&&!await i())return;e||(_.transportStatus=`current`);let a=await this.api.client.activeRuns(r);if(!v()||r.aborted)return;if(a.kind===`ok`)_.activeRuns=a.value;else if(Br(a.error.code)){w();return}else _.activeRuns=void 0;y();let o=await this.api.client.workspace(r);if(!v()||r.aborted)return;if(o.kind===`error`){_.error=o.error.code,Br(o.error.code)&&w();return}if(!t&&W(_.workspace?.models??[])!==W(o.value.models)&&!await i())return;if(_.workspace=o.value,e){let t=c.beginSnapshot(),i=await this.api.client.snapshot(e,r);if(!v()||r.aborted)return;if(i.kind===`error`)_.error=i.error.code,Br(i.error.code)&&w();else{let e=c.install(i.value,Date.now(),t);e!==void 0&&(l=e),_.error=void 0,n=!0}}else _.error=void 0,n=!0}catch{v()&&(_.error=`Observation unavailable.`,_.actions=!1,_.transportStatus=`stale`)}finally{d=!1,m=!n,_.actions=n&&g,y()}},w=()=>{h=!0,_.actions=!1,_.transportStatus=`closed`,_.error=`Access revoked; explicit token re-entry required.`,_.workspace=void 0,_.activeRuns=void 0,c=new wr,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),x(S),y()},T=e=>{let t=Tr?{kind:`browser`,...Tr}:null;_.compatible=Qe(e.build,t),_.cancelCompatible=Qe(e.build,t,!0),g=e.capabilities.actions&&_.compatible},E=async()=>{if(f=!1,await S(),!v()||h)return;let t=await this.api.client.session();if(!v()||h){await S();return}if(t.kind===`error`){h=!0,_.error=`${t.error.code}; explicit re-entry required.`,_.workspace=void 0,c=new wr,_.actions=!1,y();return}if(f=!0,s=new AbortController,c=new wr,_={actions:t.value.capabilities.actions,transportStatus:`closed`,attachmentVersion:_.attachmentVersion+1},T(t.value),y(),await C(),!v()||h||!e)return;let n=++u;i=this.api.transport.subscribe(e,e=>{if(v()&&!h&&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`&&C():C();y()}},e=>{v()&&!h&&n===u&&(_.transportStatus=e,e===`closed`&&(f=!1,_.actions=!1,_.attachmentVersion++,s.abort(),u++,o=setTimeout(()=>x(E),1e3)),y())})};return x(E),this.pollCurrent=e=>{C(e)},a=setInterval(()=>{v()&&!h&&(c.tick(Date.now()),y(),(Date.now()-p>=(m?2e3:3e4)||e&&c.needsPoll(Date.now()))&&C())},1e3),()=>{v()&&(b(),x(S))}}};function Hr(e,t,n){let r=(0,f.useMemo)(()=>new Vr(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 Ur=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 Wr(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 Gr=function(){let e=this.data();e.micromarkExtensions??=[],e.micromarkExtensions.push({flow:{92:Kr(!0)},text:{92:Kr(!1)}});let t={enter:{backslashMathInline:qr,backslashMathDisplay:qr,backslashMathBlock:qr},exit:{backslashMathInline:Jr,backslashMathDisplay:Jr,backslashMathBlock:Jr}};e.fromMarkdownExtensions??=[],e.fromMarkdownExtensions.push(t)};function Kr(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 qr=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)},Jr=function(e){this.exit(e)};function Yr(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 Xr(e){if(typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)try{return await navigator.clipboard.writeText(e),!0}catch{return Yr(e)}return Yr(e)}function Zr(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 Xr(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 Qr=(0,f.memo)(function({text:e}){let{t}=C(),[n,r]=(0,f.useState)(!1),{copied:i,copy:a}=Zr();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)(_r,{}):(0,h.jsx)(fr,{}),n&&t(`Copy unavailable`)]})}),$r=[s,d,Gr],ei=[s,l,d,Gr],ti=[[c,{strict:!1,throwOnError:!1,trust:!1,maxExpand:1e3}],[u,{detect:!1,ignoreMissing:!0}]];function ni(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 ri({text:e,rawHtml:t=!1,hardBreaks:n=!1}){return(0,h.jsx)(a,{remarkPlugins:n?ei:$r,rehypePlugins:t?[i,o,...ti]:ti,skipHtml:!t,disallowedElements:[`iframe`,`object`,`embed`,`script`,`style`,`video`,`audio`,`source`,`form`,`input`],components:{pre:oi,a:ai,img:({alt:e})=>(0,h.jsxs)(`span`,{className:`omission`,children:[`[Image omitted: `,e||`external/media content`,`]`]})},children:e})}var ii=(0,f.memo)(function(e){return(0,h.jsx)(`div`,{className:`md`,children:(0,h.jsx)(ri,{...e})})});function ai({href:e,children:t}){let n=e&&ni(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 oi({children:e,node:t,...n}){let r=e&&typeof e==`object`&&`props`in e?e.props?.children:e,i=0,a=Wr(r).map(e=>{let t=`code-offset:${i}`;return i+=si(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)(Qr,{text:si(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 si(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(si).join(``);if(e&&typeof e==`object`&&`props`in e){let t=e.props;return si(t?.children)}return``}function ci({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 li({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)(ci,{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)(ui,{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 ui({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)(ii,{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)(ii,{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 di({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)(ci,{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 fi({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 pi(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 mi(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 hi(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 gi(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=pi(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 _i(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),mi(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 vi({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)(vi,{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 yi(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 bi=new Map;function xi(e,t){t.length?bi.set(e,t):bi.delete(e);let n=e.endsWith(`-active`);e=n?`cadence-page-active`:`cadence-page`,t=[...bi].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 Si(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 Ci(e,t){let n=t.startContainer.parentElement;for(let r of Si(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 wi({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?yi(n,r):[];return l.current=i,c(i.length),o(0),xi(u,i),()=>xi(u,[])},[r,e,t,u]);let d=t=>{let n=s?(a+t+s)%s:0;o(n),e.current&&l.current[n]&&(Ci(e.current,l.current[n]),xi(`${u}-active`,[l.current[n]]))};return(0,f.useEffect)(()=>()=>xi(`${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 Ti({client:e,cursor:t,highlight:n,render:r,compact:i=!1}){let{t:a,tx:o}=C(),s=W(t),c=(0,f.useMemo)(()=>ke(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 gi(e,t,n.signal);if(n.signal.aborted)return;let i=await Xr(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)(vi,{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)(wi,{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)(ii,{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 Ei({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)(vi,{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 Di({client:e,seed:t,entityId:n}){let{t:r,tx:i}=C(),a=_i(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)(Ei,{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)(vi,{value:e.coverage}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{c.request.scope.kind!==`workspace`&&c.request.snapshotSeq!==null&&s(hi(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)(Ti,{client:e,cursor:o},`${o.recordId}:${o.recordVersion}`)]})}function Oi({client:e,seed:t}){return(0,h.jsx)(ki,{client:e,seed:t},W(t))}function ki({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)(vi,{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 Ai(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 ji(){let e=Ai();return e?`/projects/${e}`:``}function Mi(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=ji()+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 Ni({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)(ci,{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{Mi({...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 Pi(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 ke({...r,query:t,recordId:null,recordVersion:null,field:null,offset:0})}function Fi(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 Ii({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=Pi(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)(ci,{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)(vi,{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(Fi(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 Li({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)(vi,{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 Ri({client:e,seed:t}){return(0,h.jsx)(zi,{client:e,seed:t},W(t))}function zi({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)(vi,{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)(Ti,{client:e,cursor:hi(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)(ii,{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 Bi({client:e,seed:t,onScope:n}){let{t:r}=C(),i=_i(e,{...t,reader:`runs`}),a=i.page,[o,s]=(0,f.useState)();return(0,h.jsxs)(`section`,{children:[(0,h.jsx)(Ei,{pager:i}),a&&!(`kind`in a)&&a.records.map(e=>e.kind===`run`?(0,h.jsxs)(`article`,{children:[(0,h.jsx)(Li,{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)(Ri,{client:e,seed:o},o.graph.recordId)]})}function Vi({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 Hi({client:e,storeId:t,context:n,runs:r,snapshotSeq:i,canAct:a,onResult:o}){let{t:s,tx:c}=C(),[l,u]=(0,f.useState)(),[d,p]=(0,f.useState)(!1),[m,g]=(0,f.useState)(``),_=(0,f.useRef)(null),v=(0,f.useRef)(!1),y=(0,f.useRef)({context:n,canAct:a});y.current={context:n,canAct:a},(0,f.useEffect)(()=>()=>_.current?.abort(),[]);let b=r.find(e=>e.childRunId&&e.admission.kind===`generate-plan`&&e.lifecycle===`settled`&&e.outcome===`completed`&&e.result&&e.coverage.observed===`complete`),x=b&&r.find(e=>!e.childRunId&&e.runId===b.runId),S=!!b&&x?.lifecycle===`settled`&&x.outcome===`completed`&&x.publication===`published`;l&&(!n||W(l.preflight.preview.version)!==W(n))&&(v.current=!0);let w=!!l&&v.current,T=async()=>{if(!a||!S||!b?.result||!b.childRunId||_.current||!t||!i||!n?.task)return;let r=new AbortController;_.current=r,p(!0),g(``);let o=()=>{if(r.signal.aborted||!y.current.canAct||W(y.current.context)!==W(n))throw Error(`stale`)};try{let a=await gi(e,hi(t,{kind:`child`,id:b.childRunId},i,b.result),r.signal);if(o(),!a.recordingComplete||!a.text.trim())throw Error(`incomplete-content`);let s=kr(e,t),c=await s.read(n);if(o(),c.kind===`error`)throw Error(c.error.code);if(`kind`in c.value)throw Error(`Plan metadata read in progress. Try again after observation completes.`);if(c.value.savedGraph||c.value.readablePlan.trim())throw Error(`This task already has a plan. Review it in Task details instead.`);let l=c.value.roles.find(e=>e.role===`implementation-worker`);if(!l)throw Error(`unavailable`);let d=await s.saveAction(n,{readablePlan:a.text,assignments:[{id:`implement`,purpose:`edit`,instructions:`Implement only the supplied human-approved plan. Stop and report any blocker or required scope change.`,expectedOutput:`Implement the approved plan and report changes, attempted checks and remaining issues.`,role:l,model:n.model,dependencies:[]}]});if(o(),d.kind===`error`)throw Error(d.error.code);let f=await xr(e,n,d.value);if(o(),f.kind===`error`)throw Error(f.error.code);v.current=!1,u(f.value)}catch(e){r.signal.aborted||g(e instanceof Error?e.message:`unavailable`)}finally{r.signal.aborted||p(!1),_.current===r&&(_.current=null)}},E=async()=>{if(!l||w||!a||!t||_.current||l.submitted)return;if(Date.now()>=Date.parse(l.preflight.expiresAt)){g(s(`Plan confirmation expired. Review the plan again.`)),u(void 0);return}let n=new AbortController;_.current=n,p(!0);try{await Lr({client:e,storeId:t,prepared:l,signal:n.signal,observe:o}),n.signal.aborted||u(void 0)}catch(e){n.signal.aborted||(u(void 0),g(s(`Plan execution stopped: {reason}. Observe the original receipt; no automatic retry.`,{reason:e instanceof Error?e.message:`unavailable`})))}finally{n.signal.aborted||p(!1),_.current===n&&(_.current=null)}};return n?.task?.kind!==`code`||!l&&!m&&r.some(e=>e.admission.kind===`start`)?null:(0,h.jsxs)(`section`,{className:`banner-notice`,"aria-label":s(`Plan approval`),children:[(0,h.jsx)(`p`,{children:s(S?`Analysis complete. Review the plan before making changes.`:`Analysis and progress appear below. No edits start before plan approval.`)}),(0,h.jsx)(`button`,{type:`button`,disabled:!a||!S||d,onClick:()=>void T(),children:s(`Review implementation plan`)}),m&&(0,h.jsx)(`p`,{role:`alert`,children:c(m)}),l&&(0,h.jsxs)(ci,{title:s(`Confirm plan and execute`),onClose:()=>{d||u(void 0)},children:[(0,h.jsx)(`p`,{children:s(`Approving saves this exact plan and starts it. No separate Start confirmation is needed.`)}),(0,h.jsxs)(`p`,{children:[(0,h.jsx)(`code`,{children:l.preflight.preview.cwdLabel}),` ·`,` `,n.model.provider,`/`,n.model.model,` ·`,` `,n.model.thinking]}),(0,h.jsx)(ui,{preview:l.preflight.preview}),l.preflight.preview.issues.length>0&&(0,h.jsx)(`p`,{role:`alert`,children:s(`Issues: {issues}`,{issues:l.preflight.preview.issues.map(c).join(`, `)})}),w&&!d&&(0,h.jsx)(`p`,{role:`alert`,children:s(`Context changed. Close and review the plan again.`)}),(0,h.jsxs)(`footer`,{children:[(0,h.jsx)(`button`,{type:`button`,disabled:d,onClick:()=>u(void 0),children:s(`Back — no new effect`)}),(0,h.jsx)(`button`,{type:`button`,className:`primary`,disabled:d||w||!a,onClick:()=>void E(),children:s(`Confirm plan and execute`)})]})]})]})}function Ui(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 Wi(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 Gi(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)??Ki(n.role,n.customType)}return r}function Ki(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 qi(e,t,n,r){let i=n.get(e);return i&&i.len===t?i.h:r}var Ji=(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`})}),Yi=(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)(mr,{"aria-hidden":`true`}):(0,h.jsx)(cr,{"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)(Ti,{compact:!0,client:t,cursor:hi(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)(Di,{client:t,seed:n,entityId:e.owner.entity.id})]})]})]})})]})]})});function Xi({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=Gi(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=Ui(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=>Wi(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)(Ji,{id:e,show:!o.has(e),height:qi(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)(Yi,{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 Zi({client:e,seed:t}){let{t:n}=C(),r=_i(e,{...t,reader:`messages`}),i=r.page;return(0,h.jsxs)(`section`,{className:`transcript`,children:[(0,h.jsx)(Ei,{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)(Xi,{messages:i.records.filter(e=>e.kind===`message`),client:e,seed:i.request},`${i.request.snapshotSeq}:${i.request.after?.recordId??`first`}`)]})]})}function Qi({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)(gr,{}):(0,h.jsx)(hr,{})}):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 $i=(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)(Qi,{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)(Di,{client:t,seed:n,entityId:e.owner.entity.id})})]})]})});function ea({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)(gr,{}),(0,h.jsx)(dr,{}),(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 ta=/^\s{0,3}(`{3,}|~{3,})/,na=/^\s{0,3}(?:[-*+]|\d{1,9}[.)])\s/;function ra(e){return e.trim()===``}function ia(e){let t=ta.exec(e);return t?t[1]:null}function aa(e){let t=e.split(`
|
|
5
|
-
`),n=[],r=[],i=null;for(let e=0;e<t.length;e++){let a=t[e];if(i!==null){let e=
|
|
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:`path`,attr:{d:`M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`},child:[]},{tag:`polyline`,attr:{points:`9 22 9 12 15 12 15 22`},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:`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 rr(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 ir(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 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:`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 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:`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 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:`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 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:`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 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:`M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z`},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:`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 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:`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 fr(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 pr(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 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:`18 15 12 9 6 15`},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:`9 18 15 12 9 6`},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:`6 9 12 15 18 9`},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:`20 6 9 17 4 12`},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:`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 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?X(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=X(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=X(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=X(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?X(await this.transport.activeRuns(e),qe):$(!1)}catch{return $(!1)}}async models(e){try{return this.transport.models?X(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=X(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=X(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=X(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 X(await this.transport.session(e),_t)}catch{return $(!1)}}async workspace(e){try{return X(await this.transport.workspace(e),vt)}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=Z({...t,reader:e});try{let t=X(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=X(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=X(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=X(await this.transport.command(n),$e);if(e.kind===`ok`){if(e.value.commandId!==n.commandId)return $(!0);et({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=X(await this.transport.cancel(t),$e);if(e.kind===`ok`){if(e.value.commandId!==t.commandId)return $(!0);et({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=tt(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=X(await this.transport.snapshot(n,t),at);return e.kind===`ok`&&W(e.value.scope)!==W(n)?$(!1):e}catch{return $(!1)}}async detail(e,t){let n=ke(e);try{let e=X(await this.transport.detail(n,t),lt);return e.kind===`ok`&&W(e.value.cursor)!==W(n)?$(!1):e}catch{return $(!1)}}async search(e,t){let n=ke(e);try{let e=X(await this.transport.search(n,t),dt);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=at(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=ot(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||mt(i.context)!==mt(a.context)||ht(i.context)!==ht(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{at(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:`52d16d2ceac7b5776440936aa91d397374c969aed4b746d256f3913309fab99e`,contractHash:`944f3b53bd5b7f1d3f30868e0947d900e356ae9a2bcfb9f591edd988b3d5eb3a`,buildId:`a66f48d170b7ce48b756b25f449e71c69db43eebb821058f6c7403a153f1282b`};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){if(e.aborted)throw Error(`canceled`)}function Mr(e,t){return[...new Set([...Object.keys(e),...Object.keys(t)])].filter(n=>W(e[n]??null)!==W(t[n]??null))}function Nr(e){return Error(e.length?`stale: ${e.join(`, `)}`:`stale`)}function Pr(e,t,n){let r=Mr(e,t).filter(e=>!n.includes(e));if(r.length)throw Nr(r)}var Fr=(e,t)=>Pr(e,t,[`task`,`controlRev`]),Ir=(e,t)=>Pr(e,t,[`task`,`controlRev`,`observation`,`checkoutGeneration`]);async function Lr(e){jr(e.signal);let t=await e.client.workspace(e.signal);if(jr(e.signal),t.kind===`error`)throw Error(t.error.code);if(t.value.context.status!==`available`)throw Error(`unavailable`);return t.value.context.version}async function Rr(e,t,n){if(n!==`stale`)return Error(n);try{return Nr(Mr(t,t.task?await Vr(e,t.task.id):await Lr(e)))}catch{return Error(`stale`)}}async function zr(e,t){if(jr(e.signal),Date.now()>=Date.parse(t.preflight.expiresAt))throw Error(`expired`);e.observe({commandId:t.commandId,error:`Admission pending/unknown — observe this exact receipt.`});let n=await Sr(e.client,t);if(n.kind===`error`)throw e.observe({commandId:t.commandId,error:`${n.error.code}; effect ${n.error.effect}`}),await Rr(e,t.preflight.preview.version,n.error.code);if(e.observe({commandId:t.commandId,receipt:n.value}),jr(e.signal),n.value.admission!==`accepted`)throw Error(n.value.admission);return n.value}async function Br(e,t){let n=t,r=Date.now()+3e4;for(;n.publication===`pending`&&Date.now()<r;){jr(e.signal),await new Promise(e=>setTimeout(e,250)),jr(e.signal);let t=await e.client.receipt(n.commandId,e.signal);if(jr(e.signal),e.observe({commandId:n.commandId,lookup:t}),t.status===`absent`)throw Error(`receipt-inconclusive`);t.status===`found`&&(n=t.receipt)}if(n.admission!==`accepted`||n.publication!==`published`)throw Error(`Publication unconfirmed. Observe the original receipt; do not repeat the action.`);return n}async function Vr(e,t){jr(e.signal);let n=await e.client.current({storeId:e.storeId,taskId:t},e.signal);if(jr(e.signal),n.kind===`error`)throw Error(n.error.code);if(n.value.context.status!==`available`)throw Error(`unavailable`);let r=n.value.context.version;if(r.task?.id!==t)throw Error(`stale`);return r}async function Hr(e){let t=await Lr(e);Ir(e.context,t);let n=await xr(e.client,t,{kind:`create`,taskKind:`code`,goal:e.goal});if(n.kind===`error`)throw await Rr(e,t,n.error.code);let r=await Br(e,await zr(e,n.value));if(r.created?.state!==`published`)throw Error(`receipt-inconclusive`);let i=r.created.taskId,a=await Vr(e,i);Ir(t,a);let o=await xr(e.client,a,{kind:`generate-plan`,taskId:i});if(o.kind===`error`)throw await Rr(e,a,o.error.code);return await zr(e,o.value),i}async function Ur(e){let{prepared:t}=e,n=t.preflight.preview;if(n.action.kind!==`save-plan`)throw Error(`invalid`);await Br(e,await zr(e,t));let r=await Vr(e,n.action.taskId);if(Fr(n.version,r),r.task?.kind!==n.version.task?.kind||r.task?.revision!==(n.version.task?.revision??0)+1)throw Error(`stale`);let i=await xr(e.client,r,{kind:`start`,taskId:n.action.taskId});if(i.kind===`error`)throw await Rr(e,r,i.error.code);if(i.value.preflight.preview.readablePlan!==n.action.plan||W(i.value.preflight.preview.graph)!==W(n.action.graph))throw Error(`stale`);await zr(e,i.value)}function Wr(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 Gr(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 Kr=e=>e===`unauthenticated`||e===`forbidden`,qr=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=!1,_={actions:!1,transportStatus:`closed`,attachmentVersion:0},v=()=>!r&&n===this.version,y=()=>{v()&&t({..._,observation:c.state})},b=()=>{r||(r=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),n===this.version&&(this.pollCurrent=void 0))};this.stopCurrent=b;let x=e=>{this.serial=this.serial.then(e).catch(()=>{v()&&(h=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),_.error=`Observation unavailable or detach unconfirmed; explicit re-entry required.`,_.actions=!1,_.transportStatus=`closed`,_.workspace=void 0,c=new wr,y())})},S=async()=>{await this.api.transport.detach()},C=async(t=!1)=>{if(!v()||!f||d||h)return;d=!0,_.actions=!1;let n=!1;y(),p=Date.now();let r=s.signal;try{let i=async()=>{let e=await this.api.client.session(r);return!v()||r.aborted?!1:e.kind===`error`?(_.actions=!1,_.error=e.error.code,Kr(e.error.code)&&w(),!1):(T(e.value),!0)};if(t&&!await i())return;e||(_.transportStatus=`current`);let a=await this.api.client.activeRuns(r);if(!v()||r.aborted)return;if(a.kind===`ok`)_.activeRuns=a.value;else if(Kr(a.error.code)){w();return}else _.activeRuns=void 0;y();let o=await this.api.client.workspace(r);if(!v()||r.aborted)return;if(o.kind===`error`){_.error=o.error.code,Kr(o.error.code)&&w();return}if(!t&&W(_.workspace?.models??[])!==W(o.value.models)&&!await i())return;if(_.workspace=o.value,e){let t=c.beginSnapshot(),i=await this.api.client.snapshot(e,r);if(!v()||r.aborted)return;if(i.kind===`error`)_.error=i.error.code,Kr(i.error.code)&&w();else{let e=c.install(i.value,Date.now(),t);e!==void 0&&(l=e),_.error=void 0,n=!0}}else _.error=void 0,n=!0}catch{v()&&(_.error=`Observation unavailable.`,_.actions=!1,_.transportStatus=`stale`)}finally{d=!1,m=!n,_.actions=n&&g,y()}},w=()=>{h=!0,_.actions=!1,_.transportStatus=`closed`,_.error=`Access revoked; explicit token re-entry required.`,_.workspace=void 0,_.activeRuns=void 0,c=new wr,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),x(S),y()},T=e=>{let t=Tr?{kind:`browser`,...Tr}:null;_.compatible=Qe(e.build,t),_.cancelCompatible=Qe(e.build,t,!0),g=e.capabilities.actions&&_.compatible},E=async()=>{if(f=!1,await S(),!v()||h)return;let t=await this.api.client.session();if(!v()||h){await S();return}if(t.kind===`error`){h=!0,_.error=`${t.error.code}; explicit re-entry required.`,_.workspace=void 0,c=new wr,_.actions=!1,y();return}if(f=!0,s=new AbortController,c=new wr,_={actions:t.value.capabilities.actions,transportStatus:`closed`,attachmentVersion:_.attachmentVersion+1},T(t.value),y(),await C(),!v()||h||!e)return;let n=++u;i=this.api.transport.subscribe(e,e=>{if(v()&&!h&&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`&&C():C();y()}},e=>{v()&&!h&&n===u&&(_.transportStatus=e,e===`closed`&&(f=!1,_.actions=!1,_.attachmentVersion++,s.abort(),u++,o=setTimeout(()=>x(E),1e3)),y())})};return x(E),this.pollCurrent=e=>{C(e)},a=setInterval(()=>{v()&&!h&&(c.tick(Date.now()),y(),(Date.now()-p>=(m?2e3:3e4)||e&&c.needsPoll(Date.now()))&&C())},1e3),()=>{v()&&(b(),x(S))}}};function Jr(e,t,n){let r=(0,f.useMemo)(()=>new qr(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 Yr=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 Xr(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:Qr(!0)},text:{92:Qr(!1)}});let t={enter:{backslashMathInline:$r,backslashMathDisplay:$r,backslashMathBlock:$r},exit:{backslashMathInline:ei,backslashMathDisplay:ei,backslashMathBlock:ei}};e.fromMarkdownExtensions??=[],e.fromMarkdownExtensions.push(t)};function Qr(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 $r=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)},ei=function(e){this.exit(e)};function ti(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 ni(e){if(typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)try{return await navigator.clipboard.writeText(e),!0}catch{return ti(e)}return ti(e)}function ri(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 ni(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 ii=(0,f.memo)(function({text:e}){let{t}=C(),[n,r]=(0,f.useState)(!1),{copied:i,copy:a}=ri();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)(_r,{}):(0,h.jsx)(fr,{}),n&&t(`Copy unavailable`)]})}),ai=[s,d,Zr],oi=[s,l,d,Zr],si=[[c,{strict:!1,throwOnError:!1,trust:!1,maxExpand:1e3}],[u,{detect:!1,ignoreMissing:!0}]];function ci(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 li({text:e,rawHtml:t=!1,hardBreaks:n=!1}){return(0,h.jsx)(a,{remarkPlugins:n?oi:ai,rehypePlugins:t?[i,o,...si]:si,skipHtml:!t,disallowedElements:[`iframe`,`object`,`embed`,`script`,`style`,`video`,`audio`,`source`,`form`,`input`],components:{pre:fi,a:di,img:({alt:e})=>(0,h.jsxs)(`span`,{className:`omission`,children:[`[Image omitted: `,e||`external/media content`,`]`]})},children:e})}var ui=(0,f.memo)(function(e){return(0,h.jsx)(`div`,{className:`md`,children:(0,h.jsx)(li,{...e})})});function di({href:e,children:t}){let n=e&&ci(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 fi({children:e,node:t,...n}){let r=e&&typeof e==`object`&&`props`in e?e.props?.children:e,i=0,a=Xr(r).map(e=>{let t=`code-offset:${i}`;return i+=pi(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)(ii,{text:pi(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 pi(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(pi).join(``);if(e&&typeof e==`object`&&`props`in e){let t=e.props;return pi(t?.children)}return``}function mi({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 hi({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)(mi,{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)(gi,{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 gi({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)(ui,{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)(ui,{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 _i({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)(mi,{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 vi({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 yi(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 bi(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 xi(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 Si(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=yi(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 Ci(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),bi(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 wi({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)(wi,{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 Ti(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 Ei=new Map;function Di(e,t){t.length?Ei.set(e,t):Ei.delete(e);let n=e.endsWith(`-active`);e=n?`cadence-page-active`:`cadence-page`,t=[...Ei].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 Oi(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 ki(e,t){let n=t.startContainer.parentElement;for(let r of Oi(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 Ai({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?Ti(n,r):[];return l.current=i,c(i.length),o(0),Di(u,i),()=>Di(u,[])},[r,e,t,u]);let d=t=>{let n=s?(a+t+s)%s:0;o(n),e.current&&l.current[n]&&(ki(e.current,l.current[n]),Di(`${u}-active`,[l.current[n]]))};return(0,f.useEffect)(()=>()=>Di(`${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 ji({client:e,cursor:t,highlight:n,render:r,compact:i=!1}){let{t:a,tx:o}=C(),s=W(t),c=(0,f.useMemo)(()=>ke(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 Si(e,t,n.signal);if(n.signal.aborted)return;let i=await ni(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)(wi,{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)(Ai,{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)(ui,{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 Mi({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)(wi,{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 Ni({client:e,seed:t,entityId:n}){let{t:r,tx:i}=C(),a=Ci(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)(Mi,{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)(wi,{value:e.coverage}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{c.request.scope.kind!==`workspace`&&c.request.snapshotSeq!==null&&s(xi(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)(ji,{client:e,cursor:o},`${o.recordId}:${o.recordVersion}`)]})}function Pi({client:e,seed:t}){return(0,h.jsx)(Fi,{client:e,seed:t},W(t))}function Fi({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)(wi,{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 Ii(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 Li(){let e=Ii();return e?`/projects/${e}`:``}function Ri(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=Li()+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 zi({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)(mi,{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{Ri({...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 Bi(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 ke({...r,query:t,recordId:null,recordVersion:null,field:null,offset:0})}function Vi(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 Hi({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=Bi(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)(mi,{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)(wi,{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(Vi(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 Ui({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)(wi,{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 Wi({client:e,seed:t}){return(0,h.jsx)(Gi,{client:e,seed:t},W(t))}function Gi({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)(wi,{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)(ji,{client:e,cursor:xi(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)(ui,{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 Ki({client:e,seed:t,onScope:n}){let{t:r}=C(),i=Ci(e,{...t,reader:`runs`}),a=i.page,[o,s]=(0,f.useState)();return(0,h.jsxs)(`section`,{children:[(0,h.jsx)(Mi,{pager:i}),a&&!(`kind`in a)&&a.records.map(e=>e.kind===`run`?(0,h.jsxs)(`article`,{children:[(0,h.jsx)(Ui,{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)(Wi,{client:e,seed:o},o.graph.recordId)]})}function qi({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 Ji({client:e,storeId:t,context:n,runs:r,snapshotSeq:i,canAct:a,onResult:o}){let{t:s,tx:c}=C(),[l,u]=(0,f.useState)(),[d,p]=(0,f.useState)(!1),[m,g]=(0,f.useState)(``),_=(0,f.useRef)(null),v=(0,f.useRef)(!1),y=(0,f.useRef)({context:n,canAct:a});y.current={context:n,canAct:a},(0,f.useEffect)(()=>()=>_.current?.abort(),[]);let b=r.find(e=>e.childRunId&&e.admission.kind===`generate-plan`&&e.lifecycle===`settled`&&e.outcome===`completed`&&e.result&&e.coverage.observed===`complete`),x=b&&r.find(e=>!e.childRunId&&e.runId===b.runId),S=!!b&&x?.lifecycle===`settled`&&x.outcome===`completed`&&x.publication===`published`;l&&(!n||W(l.preflight.preview.version)!==W(n))&&(v.current=!0);let w=!!l&&v.current,T=async()=>{if(!a||!S||!b?.result||!b.childRunId||_.current||!t||!i||!n?.task)return;let r=new AbortController;_.current=r,p(!0),g(``);let o=()=>{if(r.signal.aborted||!y.current.canAct||W(y.current.context)!==W(n))throw Error(`stale`)};try{let a=await Si(e,xi(t,{kind:`child`,id:b.childRunId},i,b.result),r.signal);if(o(),!a.recordingComplete||!a.text.trim())throw Error(`incomplete-content`);let s=kr(e,t),c=await s.read(n);if(o(),c.kind===`error`)throw Error(c.error.code);if(`kind`in c.value)throw Error(`Plan metadata read in progress. Try again after observation completes.`);if(c.value.savedGraph||c.value.readablePlan.trim())throw Error(`This task already has a plan. Review it in Task details instead.`);let l=c.value.roles.find(e=>e.role===`implementation-worker`);if(!l)throw Error(`unavailable`);let d=await s.saveAction(n,{readablePlan:a.text,assignments:[{id:`implement`,purpose:`edit`,instructions:`Implement only the supplied human-approved plan. Stop and report any blocker or required scope change.`,expectedOutput:`Implement the approved plan and report changes, attempted checks and remaining issues.`,role:l,model:n.model,dependencies:[]}]});if(o(),d.kind===`error`)throw Error(d.error.code);let f=await xr(e,n,d.value);if(o(),f.kind===`error`)throw Error(f.error.code);v.current=!1,u(f.value)}catch(e){r.signal.aborted||g(e instanceof Error?e.message:`unavailable`)}finally{r.signal.aborted||p(!1),_.current===r&&(_.current=null)}},E=async()=>{if(!l||w||!a||!t||_.current||l.submitted)return;if(Date.now()>=Date.parse(l.preflight.expiresAt)){g(s(`Plan confirmation expired. Review the plan again.`)),u(void 0);return}let n=new AbortController;_.current=n,p(!0);try{await Ur({client:e,storeId:t,prepared:l,signal:n.signal,observe:o}),n.signal.aborted||u(void 0)}catch(e){n.signal.aborted||(u(void 0),g(s(`Plan execution stopped: {reason}. Observe the original receipt; no automatic retry.`,{reason:e instanceof Error?e.message:`unavailable`})))}finally{n.signal.aborted||p(!1),_.current===n&&(_.current=null)}};return n?.task?.kind!==`code`||!l&&!m&&r.some(e=>e.admission.kind===`start`)?null:(0,h.jsxs)(`section`,{className:`banner-notice`,"aria-label":s(`Plan approval`),children:[(0,h.jsx)(`p`,{children:s(S?`Analysis complete. Review the plan before making changes.`:`Analysis and progress appear below. No edits start before plan approval.`)}),(0,h.jsx)(`button`,{type:`button`,disabled:!a||!S||d,onClick:()=>void T(),children:s(`Review implementation plan`)}),m&&(0,h.jsx)(`p`,{role:`alert`,children:c(m)}),l&&(0,h.jsxs)(mi,{title:s(`Confirm plan and execute`),onClose:()=>{d||u(void 0)},children:[(0,h.jsx)(`p`,{children:s(`Approving saves this exact plan and starts it. No separate Start confirmation is needed.`)}),(0,h.jsxs)(`p`,{children:[(0,h.jsx)(`code`,{children:l.preflight.preview.cwdLabel}),` ·`,` `,n.model.provider,`/`,n.model.model,` ·`,` `,n.model.thinking]}),(0,h.jsx)(gi,{preview:l.preflight.preview}),l.preflight.preview.issues.length>0&&(0,h.jsx)(`p`,{role:`alert`,children:s(`Issues: {issues}`,{issues:l.preflight.preview.issues.map(c).join(`, `)})}),w&&!d&&(0,h.jsx)(`p`,{role:`alert`,children:s(`Context changed. Close and review the plan again.`)}),(0,h.jsxs)(`footer`,{children:[(0,h.jsx)(`button`,{type:`button`,disabled:d,onClick:()=>u(void 0),children:s(`Back — no new effect`)}),(0,h.jsx)(`button`,{type:`button`,className:`primary`,disabled:d||w||!a,onClick:()=>void E(),children:s(`Confirm plan and execute`)})]})]})]})}function Yi(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 Xi(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 Zi(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)??Qi(n.role,n.customType)}return r}function Qi(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 $i(e,t,n,r){let i=n.get(e);return i&&i.len===t?i.h:r}var ea=(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`})}),ta=(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)(mr,{"aria-hidden":`true`}):(0,h.jsx)(cr,{"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)(ji,{compact:!0,client:t,cursor:xi(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)(Ni,{client:t,seed:n,entityId:e.owner.entity.id})]})]})]})})]})]})});function na({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=Zi(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=Yi(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=>Xi(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)(ea,{id:e,show:!o.has(e),height:$i(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)(ta,{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 ra({client:e,seed:t}){let{t:n}=C(),r=Ci(e,{...t,reader:`messages`}),i=r.page;return(0,h.jsxs)(`section`,{className:`transcript`,children:[(0,h.jsx)(Mi,{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)(na,{messages:i.records.filter(e=>e.kind===`message`),client:e,seed:i.request},`${i.request.snapshotSeq}:${i.request.after?.recordId??`first`}`)]})]})}function ia({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)(gr,{}):(0,h.jsx)(hr,{})}):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 aa=(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)(ia,{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)(Ni,{client:t,seed:n,entityId:e.owner.entity.id})})]})]})});function oa({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)(gr,{}),(0,h.jsx)(dr,{}),(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 sa=/^\s{0,3}(`{3,}|~{3,})/,ca=/^\s{0,3}(?:[-*+]|\d{1,9}[.)])\s/;function la(e){return e.trim()===``}function ua(e){let t=sa.exec(e);return t?t[1]:null}function da(e){let t=e.split(`
|
|
5
|
+
`),n=[],r=[],i=null;for(let e=0;e<t.length;e++){let a=t[e];if(i!==null){let e=ua(a);e&&e[0]===i[0]&&e.length>=i.length&&(i=null),r.push(a);continue}let o=ua(a);if(o&&!la(a))i=o,r.push(a);else if(la(a)){let i=e;for(;i<t.length&&la(t[i]);)i++;if(!(i<t.length&&ca.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
|
|
8
|
-
`:``}@${l}`),u(),L.current?.focus())},[l,u]),(0,f.useEffect)(()=>{let e=M?.summary?`${M.summary.head}:${M.summary.status}`:``;e&&ee.current!==e&&(ee.current=e,c()),k&&M?.turns.some(e=>e.id===k)&&(A(``),y(e=>e===te.current?``:e),c()),z.current&&R.current&&(R.current.scrollTop=R.current.scrollHeight)},[M,k,c]);let W=async()=>{if(!(T||p||U.current||F||k||!r||!M||j.error||!N.text.trim())){if(N.mode===`cadence`){U.current=!0,E(!0);try{if(await o(N.text.trim())){try{sessionStorage.removeItem(_)}catch{}H.current&&y(``)}}catch{H.current&&O(m(`Task preparation unavailable. Observe the original receipt before sending again.`))}finally{U.current=!1,H.current&&E(!1)}}else if(!(I||S!==null)){E(!0),O(``);try{let n=await e.models();if(!H.current)return;if(n.kind!==`ok`||!n.value.selected){s();return}let r={kind:`send`,commandId:crypto.randomUUID(),conversationId:t,head:P?.head??null,text:N.text,model:n.value.version};un(r),te.current=v,A(r.commandId);let i=await e.workbenchCommand(r);if(!H.current)return;i.kind===`error`?O(`${i.error.code}. ${m(`Observe this send before sending again. No automatic retry.`)}`):(y(e=>e===te.current?``:e),A(``)),j.refresh(),c()}catch{H.current&&O(m(`Send unavailable. Check the message limit (16 KiB); observe any pending command before sending again.`))}finally{H.current&&E(!1)}}}},ne=async()=>{let n=M?.turns.find(e=>e.id===P?.head);if(!n||T)return;E(!0);let r=await e.workbenchCommand({kind:`interrupt`,commandId:crypto.randomUUID(),conversationId:t,turnId:n.id,epoch:n.epoch});H.current&&(r.kind===`error`&&O(r.error.code),E(!1),j.refresh())};return(0,h.jsxs)(`section`,{className:`chat-workspace`,"aria-label":m(`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:P?.title??m(`New conversation`)}),(0,h.jsx)(`span`,{className:`conversation-badge`,children:m(`Ordinary`)})]}),P&&(0,h.jsx)(`span`,{className:`ep-state ${P.status}`,children:g(P.status)})]}),(0,h.jsxs)(`div`,{className:`chat-messages`,ref:R,onScroll:()=>{let e=R.current;e&&(z.current=e.scrollHeight-e.scrollTop-e.clientHeight<80,V(!z.current))},children:[!P&&(0,h.jsx)(
|
|
7
|
+
`),inFence:i!==null}}function fa(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 pa=(0,f.memo)(function({text:e}){return(0,h.jsx)(li,{text:e})}),ma=22,ha=14,ga=()=>typeof document<`u`&&document.hidden;function _a(e,t=!0,n=!1,r){let[i,a]=(0,f.useState)(()=>!t||ga()||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(ga()){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?ha:ma;if(i>0&&e-i<t){r=requestAnimationFrame(u);return}i=e;let n=o.current,d=fa(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 va=600,ya=32;function ba({text:e,inFence:t}){let n=!t&&e.length>=va,[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>=ya)r();else return o.current=setTimeout(r,ya-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)(li,{text:n?r:e})}var xa=(0,f.memo)(function({text:e,finishing:t=!1,onSettled:n}){let r=_a(e,!0,t,n),{frozen:i,active:a,inFence:o}=(0,f.useMemo)(()=>da(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)(pa,{text:e},t)),a.length>0&&(0,h.jsx)(ba,{text:a,inFence:o},i.length)]})});function Sa(){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 Ca(e){try{return sessionStorage.getItem(e)??``}catch{return``}}function wa({client:e,id:t,workspaceId:n,enabled:r,available:i=r,canInterrupt:a=r,onCadence:o,onModel:s,onChanged:c,reference:l,onReferenceUsed:u,initialMode:d=`chat`,taskPending:p=!1}){let{t:m,tx:g}=C(),_=`cadence:draft:${n}:${t}`,[v,y]=(0,f.useState)(()=>Ca(_)),[b,x]=(0,f.useState)(()=>Ca(`${_}:mode`)===`cadence`?`cadence`:d),[S,w]=(0,f.useState)(null),[T,E]=(0,f.useState)(!1),[D,O]=(0,f.useState)(``),[k,A]=(0,f.useState)(()=>Ca(`${_}:pending`)),j=Wr(e,i?{kind:`conversation`,id:t,before:S}:null,1e3),M=j.value?.kind===`conversation`?j.value:void 0,N=Gr(v,b),P=M?.summary,F=P&&(P.status===`queued`||P.status===`running`),I=!!P&&P.status!==`completed`&&!F,L=(0,f.useRef)(null),R=(0,f.useRef)(null),z=(0,f.useRef)(!0),[B,V]=(0,f.useState)(!1),H=(0,f.useRef)(!0),U=(0,f.useRef)(!1),ee=(0,f.useRef)(``),te=(0,f.useRef)(v);(0,f.useEffect)(()=>(H.current=!0,()=>{H.current=!1}),[]),(0,f.useEffect)(()=>{try{sessionStorage.setItem(`${_}:mode`,b)}catch{}},[_,b]),(0,f.useEffect)(()=>{try{sessionStorage.setItem(_,v)}catch{}},[v,_]),(0,f.useEffect)(()=>{try{k?sessionStorage.setItem(`${_}:pending`,k):sessionStorage.removeItem(`${_}:pending`)}catch{}},[_,k]),(0,f.useEffect)(()=>{l&&(y(e=>`${e}${e?`
|
|
8
|
+
`:``}@${l}`),u(),L.current?.focus())},[l,u]),(0,f.useEffect)(()=>{let e=M?.summary?`${M.summary.head}:${M.summary.status}`:``;e&&ee.current!==e&&(ee.current=e,c()),k&&M?.turns.some(e=>e.id===k)&&(A(``),y(e=>e===te.current?``:e),c()),z.current&&R.current&&(R.current.scrollTop=R.current.scrollHeight)},[M,k,c]);let W=async()=>{if(!(T||p||U.current||F||k||!r||!M||j.error||!N.text.trim())){if(N.mode===`cadence`){U.current=!0,E(!0);try{if(await o(N.text.trim())){try{sessionStorage.removeItem(_)}catch{}H.current&&y(``)}}catch{H.current&&O(m(`Task preparation unavailable. Observe the original receipt before sending again.`))}finally{U.current=!1,H.current&&E(!1)}}else if(!(I||S!==null)){E(!0),O(``);try{let n=await e.models();if(!H.current)return;if(n.kind!==`ok`||!n.value.selected){s();return}let r={kind:`send`,commandId:crypto.randomUUID(),conversationId:t,head:P?.head??null,text:N.text,model:n.value.version};un(r),te.current=v,A(r.commandId);let i=await e.workbenchCommand(r);if(!H.current)return;i.kind===`error`?O(`${i.error.code}. ${m(`Observe this send before sending again. No automatic retry.`)}`):(y(e=>e===te.current?``:e),A(``)),j.refresh(),c()}catch{H.current&&O(m(`Send unavailable. Check the message limit (16 KiB); observe any pending command before sending again.`))}finally{H.current&&E(!1)}}}},ne=async()=>{let n=M?.turns.find(e=>e.id===P?.head);if(!n||T)return;E(!0);let r=await e.workbenchCommand({kind:`interrupt`,commandId:crypto.randomUUID(),conversationId:t,turnId:n.id,epoch:n.epoch});H.current&&(r.kind===`error`&&O(r.error.code),E(!1),j.refresh())};return(0,h.jsxs)(`section`,{className:`chat-workspace`,"aria-label":m(`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:P?.title??m(`New conversation`)}),(0,h.jsx)(`span`,{className:`conversation-badge`,children:m(`Ordinary`)})]}),P&&(0,h.jsx)(`span`,{className:`ep-state ${P.status}`,children:g(P.status)})]}),(0,h.jsxs)(`div`,{className:`chat-messages`,ref:R,onScroll:()=>{let e=R.current;e&&(z.current=e.scrollHeight-e.scrollTop-e.clientHeight<80,V(!z.current))},children:[!P&&(0,h.jsx)(Sa,{}),M?.before&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>{z.current=!1,w(M.before)},children:m(`Earlier messages`)}),S&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>{z.current=!0,w(null)},children:m(`Latest messages`)}),M?.turns.map(e=>(0,h.jsx)(Ta,{turn:e},e.id)),(D||j.error)&&(0,h.jsx)(`p`,{role:`alert`,className:`banner-notice`,children:D||j.error}),k&&(0,h.jsxs)(`p`,{className:`inspector-note`,children:[m(`Send outcome not yet observed:`),` `,(0,h.jsx)(`code`,{children:k}),` `,(0,h.jsx)(`button`,{type:`button`,onClick:j.refresh,children:m(`Observe current state`)})]}),I&&(0,h.jsx)(`p`,{className:`inspector-note`,children:m(`This turn has no complete continuation context. Start a new conversation; retained messages are preserved.`)})]}),B&&(0,h.jsx)(`button`,{type:`button`,className:`chat-scroll-bottom`,"aria-label":m(`Latest messages`),onClick:()=>{R.current&&(R.current.scrollTop=R.current.scrollHeight),z.current=!0},children:(0,h.jsx)(br,{})}),(0,h.jsxs)(`form`,{className:`chat-composer`,onSubmit:e=>{e.preventDefault(),W()},children:[(0,h.jsx)(`textarea`,{ref:L,disabled:!r||T||p||!!k,"aria-label":m(`Message`),value:v,placeholder:m(`Message, or /cadence followed by a task…`),rows:3,onChange:e=>y(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),W())}}),(0,h.jsxs)(`div`,{className:`composer-toolbar`,children:[(0,h.jsxs)(`select`,{"aria-label":m(`Conversation mode`),value:N.mode,onChange:e=>{let t=e.target.value===`cadence`?`cadence`:`chat`;x(t),t===`chat`&&Gr(v,`chat`).mode===`cadence`&&y(N.text)},children:[(0,h.jsx)(`option`,{value:`chat`,children:m(`Ordinary conversation`)}),(0,h.jsx)(`option`,{value:`cadence`,children:m(`Cadence task`)})]}),(0,h.jsxs)(`button`,{type:`button`,className:`ghost`,onClick:s,children:[(0,h.jsx)(dr,{}),m(`Model`)]}),(0,h.jsx)(`span`,{className:`composer-hint`,children:N.mode===`cadence`?m(`Send to begin analysis. You will confirm the plan before any edits.`):m(`Direct host tools · no Cadence task`)}),F?(0,h.jsxs)(`button`,{type:`button`,className:`danger`,disabled:T||!a,onClick:()=>void ne(),children:[(0,h.jsx)(Wn,{}),m(`Stop response`)]}):(0,h.jsxs)(`button`,{type:`submit`,className:`primary`,disabled:!r||!M||!!j.error||T||p||!!k||!N.text.trim()||N.mode===`chat`&&(I||S!==null),children:[(0,h.jsx)(yr,{}),p?m(`Analyzing task…`):N.mode===`cadence`?m(`Prepare task`):m(`Send`)]})]})]})]})}function Ta({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)(xa,{text:n.text}):(0,h.jsx)(ui,{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 ba({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=Rr(e,t?{kind:`files`,path:i}:null),d=Rr(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)(ar,{}):(0,h.jsx)(or,{}),(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 Xr(e.path).then(e=>l(e?``:r(`Link copy unavailable.`))),children:(0,h.jsx)(fr,{})})]},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 xa({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)(mr,{}):(0,h.jsx)(gr,{})]})}),(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)(ii,{text:e.readablePlan})]}),(0,h.jsx)(Qr,{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)(lr,{}),` `,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)(ii,{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 Sa=`未命名章节`;function Ca(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 wa(e){let t=new Map;return e.map(({level:e,label:n})=>{let r=String(n??``).replace(/\s+/g,` `).trim(),i=Ca(r||Sa),a=(t.get(i)??0)+1;return t.set(i,a),{level:e,id:a===1?i:`${i}-${a}`,label:r||Sa}})}function Ta(e){return e.length>=2}function Ea(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
|
|
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=
|
|
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:[Ta(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)(ii,{text:e})})]}):n===`diff`?(0,h.jsx)(Da,{text:e}):(0,h.jsx)(`div`,{className:`fp-code ${i?``:`no-wrap`}`,children:Ea(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 ka({client:e,seed:t}){let{t:n,tx:r}=C(),i=_i(e,t),[a,o]=(0,f.useState)(),s=i.page;return(0,h.jsxs)(`section`,{className:`scm-body`,children:[(0,h.jsx)(Ei,{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(hi(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)(Ti,{client:e,cursor:a,render:e=>(0,h.jsx)(Oa,{text:e})},`${a.recordId}:${a.recordVersion}`)]})}function Aa({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)(ka,{client:e,seed:{...n,reader:`checks`}})]})}function ja({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)(Oa,{text:a.text})]})]})}var Ma=[[`plan`,sr],[`checks`,vr],[`changes`,rr],[`review`,Vn]];function Na(){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 Pa({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 Ur);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)(Na,{});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:Ma.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)(xa,{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)(Aa,{client:e,taskId:A,seed:N,canAct:i,onAction:a,onObligations:M}),d===`changes`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ja,{client:e,storeId:n.storeId,taskId:A}),(0,h.jsx)(`h3`,{children:s(`Captured historical observations`)}),(0,h.jsx)(ka,{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)(ka,{client:e,seed:{...N,reader:`reviews`}})]})]})]})}var Fa={relative:`Enter a full path, for example ~/project.`,invalid:`This folder does not exist. Check the path.`,forbidden:`This location cannot be browsed: it belongs to another account, is protected, or is not a plain folder (for example a link).`,unavailable:`This folder could not be read right now; it may lack read permission. Try again.`},Ia=e=>/^(?:~(?:[\\/]|$)|[\\/]|[A-Za-z]:[\\/])/.test(e);function La(e,t){let n=e.startsWith(`/`)?`/`:`\\`,r=(e,t)=>e.endsWith(n)?e+t:e+n+t,i=!!t&&(e===t||e.startsWith(r(t,``))),a=i?t:/^(?:\\\\[^\\]+\\[^\\]+|[A-Za-z]:\\|\/)/.exec(e)?.[0]??``;if(!a)return{inside:i,trail:[{name:e,path:e}]};let o=i?[]:[{name:a===`/`?`/`:a.replace(/\\$/,``),path:a}],s=a;for(let t of e.slice(a.length).split(/[\\/]/).filter(Boolean))s=r(s,t),o.push({name:t,path:s});return{inside:i,trail:o}}function Ra({client:e,current:t,initial:n,home:r,epoch:i,onClose:a,onOpen:o,projects:s=[]}){let{t:c,tx:l}=C(),[u,d]=(0,f.useState)(),[p,m]=(0,f.useState)(n??t),[g,_]=(0,f.useState)(!1),[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(!0),[S,w]=(0,f.useState)(!0),[T,E]=(0,f.useState)(!1),[D,O]=(0,f.useState)(null),k=(0,f.useRef)(!0),A=(0,f.useRef)(void 0),j=(0,f.useRef)(n??t),M=(0,f.useRef)(null),N=(0,f.useRef)(null),P=async t=>{A.current?.abort();let n=new AbortController;A.current=n,x(!0),O(null);let r=await e.workbenchRead({kind:`directories`,path:t},n.signal).catch(()=>void 0);if(!n.signal.aborted&&k.current){if(A.current=void 0,x(!1),r?.kind===`ok`&&r.value.kind===`directories`)return d(r.value),m(r.value.path),_(!1),y(``),r.value;O({step:`read`,code:r?.kind===`error`?r.error.code:`unavailable`})}},F=(0,f.useRef)(P);(0,f.useEffect)(()=>(k.current=!0,F.current(j.current).then(()=>{k.current&&w(!1)}),()=>{k.current=!1,A.current?.abort()}),[]),(0,f.useEffect)(()=>{g&&M.current?.select()},[g]),(0,f.useEffect)(()=>{N.current&&(N.current.scrollLeft=N.current.scrollWidth)});let I=e=>{T||P(e)},L=()=>{let e=p.trim();T||(Ia(e)?P(e):O({step:`read`,code:`relative`}))},R=(g||!u)&&p.trim()||u?.path||``,z=!T&&!b&&!!R,B=async n=>{if(T||!n||b&&n===u?.path)return;if(n!==u?.path&&!Ia(n)){O({step:`read`,code:`relative`});return}E(!0),O(null);let r=n===u?.path?u.path:(await P(n))?.path;if(!k.current)return;if(!r){E(!1);return}if(!o&&r===t){a();return}if(o){try{await o(r),k.current&&a()}catch(e){k.current&&(O({step:`open`,code:e instanceof Error?e.message:`unavailable`}),E(!1))}return}if(!e.workbenchCommand){O({step:`open`,code:`unavailable`}),E(!1);return}let s=await e.workbenchCommand({kind:`open-project`,commandId:crypto.randomUUID(),path:r,epoch:i});if(k.current){if(s.kind===`ok`&&s.value.kind===`project`){let e=new URL(s.value.link);e.protocol===`http:`&&[`127.0.0.1`,`[::1]`].includes(e.hostname)||e.protocol===`https:`?window.location.assign(e.href):(O({step:`open`,code:`unsupported-context`}),E(!1))}else O({step:`open`,code:s.kind===`error`?s.error.code:`unavailable`}),E(!1)}},V=u?La(u.path,r):void 0,H=v.trim().toLowerCase(),U=u?.entries.filter(e=>e.name.toLowerCase().includes(H))??[],ee=D&&(D.step===`read`&&Fa[D.code]?c(Fa[D.code]):l(D.code));return(0,h.jsxs)(ci,{title:c(`Open working folder`),onClose:a,children:[(0,h.jsx)(`p`,{children:c(`Choose a folder on the service host. Opening reuses or starts that project's independent service; current work keeps running.`)}),s.length>0&&(0,h.jsxs)(`section`,{className:`cwd-recent`,"aria-label":c(`Recent projects`),children:[(0,h.jsx)(`h3`,{children:c(`Recent projects`)}),(0,h.jsx)(`div`,{className:`cwd-recent-list`,children:s.map(e=>(0,h.jsxs)(`button`,{type:`button`,title:c(`Open {path}`,{path:e.path}),"aria-current":e.current?`true`:void 0,disabled:T,onClick:()=>e.current?a():void B(e.path),children:[(0,h.jsx)(ar,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:e.path})]},e.path))})]}),(0,h.jsxs)(`div`,{className:`cwd-location`,children:[V&&!g?(0,h.jsxs)(`nav`,{ref:N,className:`cwd-crumbs`,"aria-label":c(`Current location`),children:[(0,h.jsxs)(`button`,{type:`button`,"aria-label":c(`Home folder`),title:c(`Home folder (~)`),"aria-current":r&&u?.path===r?`location`:void 0,disabled:T,onClick:()=>I(`~`),children:[(0,h.jsx)(tr,{"aria-hidden":`true`}),V.inside&&(0,h.jsx)(`span`,{"aria-hidden":`true`,children:`~`})]}),V.trail.map((e,t)=>(0,h.jsxs)(f.Fragment,{children:[(t>0||V.inside)&&(0,h.jsx)(hr,{"aria-hidden":`true`,className:`cwd-crumb-sep`}),(0,h.jsx)(`button`,{type:`button`,"aria-current":e.path===u?.path?`location`:void 0,disabled:T,onClick:()=>I(e.path),children:e.name})]},e.path))]}):S?(0,h.jsx)(`div`,{className:`cwd-crumbs`}):(0,h.jsx)(`form`,{className:`cwd-input`,onSubmit:e=>{e.preventDefault(),L()},children:(0,h.jsx)(`input`,{ref:M,"aria-label":c(`Folder path`),placeholder:c(`Type or paste a path, then press Enter`),value:p,disabled:T,spellCheck:!1,autoComplete:`off`,enterKeyHint:`go`,onChange:e=>{m(e.target.value),D?.step===`read`&&O(null)},onKeyDown:e=>{e.key===`Escape`&&u&&(e.preventDefault(),_(!1),m(u.path),O(null))}})}),u&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,"aria-label":c(`Edit path`),title:c(`Edit path`),"aria-pressed":g,disabled:T,onClick:()=>{m(u.path),_(!g),O(null)},children:(0,h.jsx)(lr,{"aria-hidden":`true`})})]}),u&&(0,h.jsxs)(`label`,{className:`cwd-filter`,children:[(0,h.jsx)(Kn,{"aria-hidden":`true`}),(0,h.jsx)(`input`,{"aria-label":c(`Filter folders`),placeholder:c(`Filter this folder…`),value:v,disabled:T,spellCheck:!1,autoComplete:`off`,onChange:e=>y(e.target.value)})]}),(0,h.jsxs)(`div`,{className:`cwd-picker-list`,"aria-busy":b||void 0,children:[b&&(0,h.jsx)(`p`,{role:`status`,className:`cwd-picker-note`,children:c(`Reading folder…`)}),u?.parent&&(0,h.jsxs)(`button`,{type:`button`,disabled:T,onClick:()=>I(u.parent),children:[(0,h.jsx)(yr,{}),c(`Parent folder`)]}),U.map(e=>(0,h.jsxs)(`button`,{type:`button`,disabled:T,onClick:()=>I(e.path),children:[(0,h.jsx)(ar,{}),(0,h.jsx)(`span`,{children:e.name})]},e.path)),u&&!b&&U.length===0&&(0,h.jsx)(`p`,{className:`cwd-picker-note`,children:c(H?`No matching folders.`:`No subfolders.`)})]}),u?.limited&&(0,h.jsx)(`p`,{className:`inspector-note`,children:c(`Bounded listing; narrow the directory to see more.`)}),ee&&(0,h.jsxs)(`p`,{role:`alert`,children:[ee,D?.code===`registry-locked`&&(0,h.jsxs)(h.Fragment,{children:[` `,`—`,` `,c(`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.jsxs)(`footer`,{className:`cwd-footer`,children:[R&&(0,h.jsxs)(`p`,{className:`cwd-target`,children:[(0,h.jsx)(`span`,{children:c(`Will open:`)}),` `,(0,h.jsx)(`code`,{children:R})]}),(0,h.jsx)(`button`,{type:`button`,className:`primary`,disabled:!z,onClick:()=>void B(R),children:c(T?`Opening folder…`:`Open this folder`)})]})]})}function za(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 Ba({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)(dr,{"aria-hidden":`true`})})]})}function Va({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)(gr,{"aria-hidden":`true`}):(0,h.jsx)(hr,{"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 Ha({runs:e,scope:t,snapshot:n,onScope:r}){let{t:i,tx:a}=C(),[o,s]=(0,f.useState)(new Set),c=za(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)(hr,{"aria-hidden":`true`}):(0,h.jsx)(gr,{"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)(dr,{"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 Ua({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)(Ha,{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)(Ei,{pager:e,compact:!0})]})}function Wa({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=_i(e,b),S=_i(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)(Ua,{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)(Ba,{onConversation:_,onTask:f}),(0,h.jsxs)(Va,{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)(Ha,{runs:i.filter(t=>t.runId===e.runId),scope:r,onScope:d})]},e.runId)})]}),(0,h.jsxs)(Va,{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)(Ei,{pager:x,compact:!0})]}),!E.some(e=>e.owner.taskId===n)&&D]})]})}function Ga({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)(ar,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:e||r(`Open working folder`)}),(0,h.jsx)(gr,{"aria-hidden":`true`})]})}function Ka(e,t,n){let r=new URL(window.location.origin+window.location.pathname),i=Ai();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 qa(){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=ke(ne(n));return s.navigation?null:{taskId:t,cursor:s,scope:a,snapshotSeq:o}}catch{return null}}function Ja(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 Ya({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=Ja({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 Xa(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 Za=.4,Qa=1.05;function $a(e){return Math.min(300,e*.86)}function eo(e,t,n){return n||(t<=144?null:e<=72?`left`:t-e<=72?`right`:null)}function to(e,t){let n=Math.abs(e),r=Math.abs(t);return n<12&&r<12?`none`:n>r*1.2?`horizontal`:`vertical`}function no(e,t){return e===`left`?t:-t}function ro(e,t){return Math.max(-e,Math.min(0,-e+t))}function io(e,t,n){let r=n?e+t:t;return Math.max(0,Math.min(1,r/e))}function ao(e){let{wasOpen:t,pull:n,width:r,durationMs:i}=e;return i<=320&&Math.abs(n)>=48?n>0:io(r*Qa,n,t)>=Za}var oo=new Set([`auto`,`scroll`,`overlay`]);function so(e,t){let n=e instanceof Element?e:null;for(;n;){if(n instanceof HTMLElement&&n.scrollWidth>n.clientWidth+4&&oo.has(getComputedStyle(n).overflowX))return!0;if(n===t)break;n=n.parentElement}return!1}function co(){let e=e=>{e.stopPropagation(),e.preventDefault()};window.addEventListener(`click`,e,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener(`click`,e,{capture:!0}),400)}function lo(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=eo(r.clientX,window.innerWidth,n);i&&!so(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=to(d,v);if(t===`none`)return;if(t===`vertical`){s=null;return}c=`horizontal`,p=n===r,m=$a(window.innerWidth),h=m*Qa;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=no(r,d);let b=ro(h,p?h+f:f);y.style.transform=`translateX(${r===`left`?b:-b}px)`,_&&(_.style.opacity=String(io(h,f,p))),t.preventDefault()},x=()=>{let e=s,t=c===`horizontal`&&e!==null&&g!==null,i=f,a=Date.now()-d,o=t?ao({wasOpen:p,pull:i,width:m,durationMs:a}):!1;v(),t&&e&&o!==(n===e)&&(co(),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 uo(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 fo=`modulepreload`,po=function(e){return`/`+e},mo={},ho=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=po(t,n),t=s(t),t in mo)return;mo[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`:fo,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 go({client:e,seed:t,onSearch:n}){let{t:r}=C(),i=_i(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)(Ei,{pager:i}),a&&!(`kind`in a)&&(0,h.jsx)(_o,{client:e,seed:a.request,records:a.records,onSearch:n},`${a.request.snapshotSeq}:${a.request.after?.recordId??`first`}`)]})}function _o({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 ho(()=>import(`./timeline-client.js`).then(i=>{!e&&o.current&&(r=i.default.mount(o.current,uo(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)(Di,{client:e,seed:t})]})}function vo(){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 yo=[[`tools`,Un],[`context`,er],[`timeline`,pr],[`runs`,ir]];function bo({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 xo({api:e,planMetadata:t,onOpenProject:n,onWorkbenchHome:r,workbenchHome:i,projectEntries:a}){let{t:o,tx:s,locale:c,setLocale:l}=C(),[u]=(0,f.useState)(()=>e??Er()),[d,p]=(0,f.useState)(!1),[m,g]=(0,f.useState)(!1),[_]=(0,f.useState)(qa),[v,b]=(0,f.useState)(_?.taskId??null),[x,S]=(0,f.useState)(()=>_?null:vo()??crypto.randomUUID()),[w,T]=(0,f.useState)(!1),[E,D]=(0,f.useState)(null),[O,k]=(0,f.useState)(_?`task`:`files`),[A,j]=(0,f.useState)(),M=(0,f.useCallback)(()=>j(void 0),[]),[N,P]=(0,f.useState)(_?_.scope??{kind:`task`,id:_.taskId}:null),F=Hr(u,v?{kind:`task`,id:v}:null,!m),I=(0,f.useRef)(null);F.workspace&&(I.current=F.workspace.workspaceId);let L=Rr(u.client,F.workspace&&!m?{kind:`conversations`}:null,2e3),R=Rr(u.client,F.workspace&&!m?{kind:`projects`}:null),z=(R.value?.kind===`projects`?R.value.entries.find(e=>e.current)?.path:void 0)??F.workspace?.rootLabel,B=Rr(u.client,v&&F.workspace&&!m?{kind:`task-origin`,taskId:v}:null),V=B.value?.kind===`task-origin`?B.value.conversationId:null,H={state:F.observation,transportStatus:F.transportStatus,error:F.error,refresh:F.refresh},U=F.workspace?.storeId,ee=(0,f.useMemo)(()=>t??(U?kr(u.client,U):void 0),[t,u,U]),te=H.state?.snapshot.scope.kind===`task`&&H.state.snapshot.scope.id===v?H.state.snapshot.context:void 0,ne=te?.status===`available`?te.version:null,re=F.actions&&H.state?.connection===`current`&&H.transportStatus===`current`&&!!ne&&ne.epoch===F.workspace?.epoch,[ie,ae]=(0,f.useState)(null),[oe,se]=(0,f.useState)(!1),ce=(0,f.useRef)(null),[le,ue]=(0,f.useState)(260),[de,fe]=(0,f.useState)(360),G=(0,f.useCallback)(()=>ae(null),[]);(0,f.useEffect)(()=>{let e=matchMedia(`(max-width: 900px)`),t=()=>se(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),lo({enabled:oe&&!m,open:ie,onOpenChange:ae,container:ce}),Xa(ce,ie,oe&&!m,G);let[pe,me]=(0,f.useState)(_?.snapshotSeq),[K,he]=(0,f.useState)(``),[ge,_e]=(0,f.useState)(``),[ve,ye]=(0,f.useState)(!0),be=(0,f.useRef)(null),[xe,Se]=(0,f.useState)(`messages`),[Ce,we]=(0,f.useState)(!1),[Te,q]=(0,f.useState)(!1),[Ee,De]=(0,f.useState)(),[J,Oe]=(0,f.useState)(_?.cursor),[ke,Ae]=(0,f.useState)(!1),[je,Me]=(0,f.useState)(),[Ne,Pe]=(0,f.useState)(!1),[Fe,Ie]=(0,f.useState)(``),[Le,Re]=(0,f.useState)([]),[ze,Be]=(0,f.useState)(new Set),Ve=(0,f.useRef)(!0),He=(0,f.useRef)(null),Ue=(0,f.useRef)(!1),We=e=>{Ve.current&&Re(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)})},Y=(0,f.useRef)(new Ur),Ge=W({taskId:v,scope:N,selectedSnapshot:pe??null,detached:m,context:ne,attachment:F.attachmentVersion,workspaceContext:F.workspace?.context??null,observationError:F.error??null});Y.current.select(Ge);let[Ke,qe]=(0,f.useState)(Ge);Ke!==Ge&&(qe(Ge),Pe(!1),Me(void 0)),(0,f.useEffect)(()=>(Ve.current=!0,()=>{Ve.current=!1,He.current?.abort(),Y.current.depart()}),[]);let Je=je?.preflight.preview.action.kind===`create`?F.workspace?.context.status===`available`?F.workspace.context.version:null:ne,Ye=async e=>{let t=e.kind===`create`?F.workspace?.context.status===`available`?F.workspace.context.version:null:ne;if(!F.actions||!t||Ne||m){Ie(o(`Current action context unavailable; observe again.`));return}Y.current.depart();let n=Y.current.ticket();Pe(!0),Ie(``);try{let r=await xr(u.client,t,e);if(!Y.current.current(n))return;r.kind===`error`?Ie(o(`Preflight refused: {code}`,{code:r.error.code})):Me(r.value)}catch{Y.current.current(n)&&Ie(o(`Preflight unavailable. No automatic retry.`))}finally{Y.current.current(n)&&Pe(!1)}},Xe=(e=crypto.randomUUID(),t=!1)=>{T(t),He.current?.abort(),Y.current.depart(),Me(void 0),Pe(!1),S(e),b(null),P(null),he(``),_e(``),De(void 0),Oe(void 0),me(void 0),Se(`messages`),k(`files`),G(),history.replaceState(null,``,`${location.pathname}${location.search}#chat=${e}`)};(0,f.useEffect)(()=>{x&&!window.location.hash&&history.replaceState(null,``,`${location.pathname}${location.search}#chat=${x}`)},[x]);let Ze=(e,t)=>{He.current?.abort(),S(null),k(`task`),he(t??``),_e(``),me(void 0),Y.current.depart(),Me(void 0),Pe(!1),b(e),P({kind:`task`,id:e}),De(void 0),Oe(void 0),Se(`messages`),G(),history.replaceState(null,``,Ka(e))};(0,f.useEffect)(()=>{let e=()=>{He.current?.abort();let e=qa();if(e)S(null),k(`task`),Y.current.depart(),Me(void 0),Pe(!1),me(e.snapshotSeq),he(``),_e(``),b(e.taskId),P(e.scope??{kind:`task`,id:e.taskId}),De(void 0),Oe(e.cursor),Se(`messages`),G();else{let e=vo();e&&(S(e),b(null),P(null),k(`files`),Me(void 0),Y.current.depart(),G())}};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[G]);let Qe=(e,t,n)=>{me(t),_e(n??``),Y.current.depart(),Me(void 0),Pe(!1),P(e),De(void 0),Oe(void 0),Se(`messages`),G(),v&&history.replaceState(null,``,Ka(v,void 0,{scope:e,snapshotSeq:t}))},$e=pe??H.state?.snapshot.committedSeq??F.workspace?.committedSeq,et=F.workspace?.storeId,X=N&&et&&$e?{storeId:et,scope:N,snapshotSeq:$e,reader:`messages`,after:null,limit:50}:null,tt=N&&et&&$e?{storeId:et,scope:N,snapshotSeq:$e,query:null,recordId:null,recordVersion:null,field:null,offset:0}:null,nt=te?H.state?.snapshot.runs??[]:[],rt=Y.current.ticket(),it=e=>{We(e),e.receipt&&Y.current.current(rt)&&F.refresh()},at=async e=>{let t=F.workspace;if(Ue.current||!F.actions||!t||t.context.status!==`available`||m)return!1;let n=new AbortController;He.current?.abort(),He.current=n,Ue.current=!0,Ae(!0),Ie(``);let r={},i=L.value?.kind===`conversations`&&L.value.entries.some(e=>e.id===x)?x:null;try{let a=await Ir({client:u.client,storeId:t.storeId,context:t.context.version,goal:e,signal:n.signal,observe:e=>{We(e);let t=e.receipt??(e.lookup?.status===`found`?e.lookup.receipt:void 0);t?.created?.state===`published`&&(r.value={taskId:t.created.taskId,commandId:e.commandId})}});if(n.signal.aborted)return!1;if(i&&r.value){let e=await u.client.workbenchCommand({kind:`link-task`,commandId:r.value.commandId,epoch:t.epoch,taskId:a,conversationId:i});if(n.signal.aborted)return!1;e.kind!==`ok`&&Ie(o(`Task created, but its conversation link was not confirmed.`))}return Ze(a),F.refresh(),!0}catch(e){return!n.signal.aborted&&Ve.current&&(r.value&&Ze(r.value.taskId),Ie(o(`Task preparation stopped: {reason}. Observe the original receipt; no automatic retry.`,{reason:e instanceof Error?e.message:`unavailable`})),F.refresh()),!1}finally{Ue.current=!1,Ve.current&&Ae(!1)}},ot=e=>{if(ze.has(e)||!F.cancelCompatible||!F.activeRuns)return;let t=crypto.randomUUID(),n=F.activeRuns.epoch;Be(t=>new Set(t).add(e)),We({commandId:t,error:o(`Stop requested; settlement is not yet confirmed.`)}),u.client.cancel({commandId:t,epoch:n,runId:e}).then(e=>{it(e.kind===`ok`?{commandId:t,receipt:e.value}:{commandId:t,error:o(`{code}; cancellation effect {effect}. Observe exact receipt.`,{code:e.error.code,effect:e.error.effect})})}).catch(()=>We({commandId:t,error:o(`Cancellation effect uncertain. Observe exact receipt.`)})).finally(()=>{Ve.current&&Be(t=>{let n=new Set(t);return n.delete(e),n})})};if(m)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:o(`Detached`)}),(0,h.jsx)(`p`,{children:o(`Accepted service work continues. No Cancel was requested.`)}),Le.map(e=>(0,h.jsxs)(`p`,{children:[o(`Observe command after reconnect:`),` `,(0,h.jsx)(`code`,{children:e.commandId})]},e.commandId)),(0,h.jsx)(`button`,{type:`button`,className:`primary`,onClick:()=>g(!1),children:o(`Reconnect as a viewer`)})]});let st=F.activeRuns,ct=st?.status===`complete`?st.runs:[],lt=H.state?.connection??(F.workspace?v?`Task snapshot not observed yet`:`Chat ready`:`Service unavailable`);return(0,h.jsxs)(`div`,{className:`app${ve?``:` inspector-hidden`}`,children:[(0,h.jsxs)(`header`,{className:`topbar`,children:[(0,h.jsx)(`button`,{type:`button`,className:`panel-toggle`,"aria-label":o(`Tasks`),onClick:()=>ae(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":o(`Workbench projects`),title:o(`Workbench projects`),onClick:r,children:(0,h.jsx)(ar,{})}),(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`})]}),F.workspace&&(0,h.jsxs)(`span`,{className:`chip static chip-root`,title:F.workspace.rootLabel,children:[(0,h.jsx)(ar,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:F.workspace.rootLabel})]}),(0,h.jsx)(`span`,{className:`tb-spacer`,"aria-hidden":`true`}),N&&(0,h.jsxs)(`nav`,{className:`tb-tabs`,"aria-label":o(`Recorded views`),children:[(0,h.jsxs)(`button`,{type:`button`,className:`tb-tab`,"aria-pressed":xe===`messages`&&!J,onClick:()=>{Oe(void 0),De(void 0),Se(`messages`)},children:[(0,h.jsx)(Yn,{"aria-hidden":`true`}),o(`Conversation`)]}),(0,h.jsxs)(`details`,{className:`view-menu`,ref:be,onKeyDown:e=>{e.key===`Escape`&&be.current&&(be.current.open=!1,be.current.querySelector(`summary`)?.focus())},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(e.currentTarget.open=!1)},children:[(0,h.jsxs)(`summary`,{className:`chip`,children:[xe===`messages`?o(`Details`):s(xe),(0,h.jsx)(gr,{"aria-hidden":`true`})]}),(0,h.jsxs)(`div`,{className:`view-menu-items`,children:[yo.map(([e,t])=>(0,h.jsxs)(`button`,{type:`button`,"aria-pressed":xe===e,onClick:()=>{Oe(void 0),De(void 0),Se(e),be.current&&(be.current.open=!1,be.current.querySelector(`summary`)?.focus())},children:[(0,h.jsx)(t,{"aria-hidden":`true`}),s(e)]},e)),(0,h.jsxs)(`div`,{className:`view-menu-actions`,children:[(0,h.jsxs)(`button`,{type:`button`,"aria-label":o(`Export selected scope`),disabled:!X,onClick:()=>{be.current&&(be.current.open=!1,be.current.querySelector(`summary`)?.focus()),q(!0)},children:[(0,h.jsx)(ur,{"aria-hidden":`true`}),o(`Export selected scope`)]}),(0,h.jsxs)(`button`,{type:`button`,"aria-label":o(`Copy token-free link`),disabled:!v,onClick:()=>{v&&Xr(Ka(v,J,N?{scope:N,snapshotSeq:pe}:void 0)).then(e=>Ie(e?``:o(`Link copy unavailable.`)))},children:[(0,h.jsx)($n,{"aria-hidden":`true`}),o(`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)(Vi,{disabled:!tt,onOpen:()=>we(!0)}),(0,h.jsx)(`button`,{type:`button`,className:`chip`,"aria-label":o(`Observe current state`),"data-tip":o(`Observe current state`),onClick:()=>{F.refresh(),H.refresh()},children:(0,h.jsx)(qn,{"aria-hidden":`true`})}),(0,h.jsxs)(`button`,{type:`button`,className:`chip`,"aria-label":o(`Choose owner model`),"data-tip":o(`Choose owner model`),onClick:()=>p(!0),children:[(0,h.jsx)(dr,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`chip-label`,children:o(`Model`)})]}),(0,h.jsxs)(`button`,{type:`button`,className:`chip`,"aria-label":o(`Return — work continues`),"data-tip":o(`Return — accepted work continues`),onClick:()=>{Me(void 0),ae(null),we(!1),q(!1),Y.current.depart(),Pe(!1),He.current?.abort(),g(!0)},children:[(0,h.jsx)(Zn,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`chip-label`,children:o(`Return`)})]}),(0,h.jsxs)(`button`,{type:`button`,className:`chip chip-lang`,lang:c===`zh`?`en`:`zh-CN`,"aria-label":c===`zh`?`Switch to English`:`切换到中文`,"data-tip":c===`zh`?`Switch to English`:`切换到中文`,onClick:()=>l(c===`zh`?`en`:`zh`),children:[(0,h.jsx)(nr,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:c===`zh`?`EN`:`中文`})]})]})]}),(0,h.jsxs)(`button`,{type:`button`,className:`panel-toggle has-label inspector-toggle`,"aria-label":o(`Plan / review`),"aria-expanded":oe?ie===`right`:ve,onClick:()=>oe?ae(e=>e===`right`?null:`right`):ye(e=>!e),children:[(0,h.jsx)(Gn,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:o(x?`Files`:`Plan`)})]})]}),!F.workspace&&ct.length>0&&(0,h.jsx)(`section`,{className:`run-strip`,"aria-label":o(`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:[s(e.kind),` `,e.runId,` · `,s(e.stage)]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>Ze(e.taskId),children:o(`Open active task`)}),(0,h.jsxs)(`button`,{type:`button`,className:`danger`,disabled:!F.cancelCompatible||ze.has(e.runId),onClick:()=>ot(e.runId),children:[(0,h.jsx)(Wn,{"aria-hidden":`true`}),o(`Cancel run — request stop`)]})]},e.runId))}),(0,h.jsx)(bo,{error:Fe,observationError:F.error}),(0,h.jsxs)(`div`,{ref:ce,className:`layout`,style:{"--left-w":`${le}px`,"--right-w":`${de}px`},children:[(0,h.jsx)(`button`,{type:`button`,"aria-label":o(`Close drawer`),tabIndex:-1,className:`drawer-backdrop persistent${ie?` on`:``}`,onClick:G}),(0,h.jsxs)(`section`,{className:`panel-drawer drawer-left${ie===`left`?` open`:``}`,"aria-label":o(`Task navigation drawer`),tabIndex:-1,inert:oe&&ie!==`left`,children:[F.workspace&&(0,h.jsx)(Wa,{client:u.client,workspace:F.workspace,taskId:v,scope:N,runs:nt,snapshot:H.state?.snapshot.committedSeq,activeRuns:F.activeRuns,cancelCompatible:!!F.cancelCompatible,canceling:ze,onCancel:ot,chats:L.value?.kind===`conversations`?L.value.entries:[],conversationId:x,onConversation:Xe,onNewConversation:()=>Xe(),onTask:Ze,onScope:Qe,onNew:()=>Xe(void 0,!0)}),F.workspace&&(0,h.jsx)(ea,{client:u.client,active:F.activeRuns,taskId:v,runs:nt,snapshot:$e,onOpen:(e,t,n,r)=>{Ze(e),P({kind:`child`,id:t}),_e(r),me(n),history.replaceState(null,``,Ka(e,void 0,{scope:{kind:`child`,id:t},snapshotSeq:n}))}})]}),(0,h.jsx)(Ya,{side:`left`,width:le,onResize:ue}),(0,h.jsxs)(`main`,{className:`main`,inert:oe&&ie!==null,children:[x&&(0,h.jsx)(va,{client:u.client,id:x,workspaceId:I.current??`connecting`,available:!!F.workspace,canInterrupt:!!F.cancelCompatible,enabled:!!F.workspace&&!!F.compatible&&!F.error,onModel:()=>p(!0),onChanged:()=>{L.refresh(),F.refresh()},reference:A,onReferenceUsed:M,initialMode:w?`cadence`:`chat`,taskPending:ke,onCadence:at},`${I.current??`connecting`}:${x}`),N&&(0,h.jsxs)(`header`,{className:`conversation-header`,children:[(0,h.jsxs)(`div`,{className:`conversation-heading`,children:[N.kind!==`task`&&v&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>Ze(v,K),children:o(`Back to task`)}),V&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>Xe(V),children:o(`Back to ordinary conversation`)}),(0,h.jsx)(`h2`,{title:K||N.id,children:N.kind===`task`?K||o(`Task {id}`,{id:N.id.slice(0,8)}):ge||o(`{kind} {id}`,{kind:s(N.kind),id:N.id.slice(0,8)})}),N.kind===`child`&&(0,h.jsx)(`span`,{className:`conversation-badge`,children:o(`Subagent`)})]}),(0,h.jsxs)(`details`,{className:`conversation-info`,children:[(0,h.jsxs)(`summary`,{children:[o(`Recorded conversation`),` ·`,` `,o(`snapshot {seq}`,{seq:$e??``})]}),(0,h.jsx)(`code`,{children:N.id}),(0,h.jsx)(`p`,{children:o(`Pages and old outcomes are historical observations, not renewed consent.`)})]})]}),v&&(0,h.jsx)(Hi,{client:u.client,storeId:et,context:ne,runs:nt,snapshotSeq:$e,canAct:re&&!Ne,onResult:it},v),(0,h.jsxs)(`div`,{className:`workspace-content`,hidden:!!x,children:[!X&&(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:o(`Open a task or create one explicitly`)}),(0,h.jsx)(`p`,{children:o(`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:!F.workspace,onClick:()=>Xe(void 0,!0),children:[(0,h.jsx)(Jn,{"aria-hidden":`true`}),o(`New task`)]})]}),X&&J?(0,h.jsxs)(`div`,{className:`tab-body`,children:[Ee&&(Ee.owner.entity.kind===`task`||Ee.owner.entity.kind===`message`||Ee.owner.entity.kind===`tool`)&&(0,h.jsx)(Oi,{client:u.client,seed:{storeId:J.storeId,scope:J.scope,snapshotSeq:J.snapshotSeq,kind:Ee.owner.entity.kind,id:Ee.owner.entity.id,version:Ee.owner.entity.version}},`${Ee.owner.entity.id}:${Ee.owner.entity.version}`),(0,h.jsx)(Ti,{client:u.client,cursor:J,highlight:Ee?.range},`${J.recordId}:${J.recordVersion}`)]}):X&&(0,h.jsxs)(`div`,{className:xe===`messages`||xe===`tools`?`tab-body transcript-body`:`tab-body`,children:[xe===`messages`&&(0,h.jsx)(Zi,{client:u.client,seed:X}),xe===`tools`&&(0,h.jsx)(So,{client:u.client,seed:X}),xe===`context`&&(0,h.jsx)(Di,{client:u.client,seed:X}),xe===`timeline`&&(0,h.jsx)(go,{client:u.client,seed:X,onSearch:()=>we(!0)}),xe===`runs`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`section`,{className:`run-current`,children:[(0,h.jsx)(`h3`,{children:o(`Runs in the current snapshot`)}),nt.length>0?nt.map(e=>(0,h.jsx)(Li,{run:e},e.childRunId??e.runId)):(0,h.jsx)(`p`,{className:`panel-empty`,children:te&&H.state?o(`No owner run projection in this snapshot.`):o(`No snapshot observed yet; absence is not proof of settlement.`)})]}),(0,h.jsx)(`h3`,{children:o(`Retained runs`)}),(0,h.jsx)(Bi,{client:u.client,seed:{...X,scope:{kind:`task`,id:v??X.scope.id}},onScope:Qe},v)]})]},`${N?.kind}:${N?.id}:${pe??`current`}`)]}),F.workspace&&Le.length>0&&(0,h.jsx)(`div`,{className:`receipt-dock`,children:Le.map(e=>(0,h.jsx)(fi,{client:u.client,value:e,onChange:We},e.commandId))})]}),(0,h.jsx)(Ya,{side:`right`,width:de,onResize:fe}),(0,h.jsx)(`section`,{className:`panel-drawer drawer-right${ie===`right`?` open`:``}`,"aria-label":o(`Plan and review drawer`),tabIndex:-1,inert:oe&&ie!==`right`,children:(0,h.jsxs)(`div`,{className:`workbench-right`,children:[(0,h.jsxs)(`nav`,{className:`rp-tabs`,"aria-label":o(`Workspace panels`),children:[(0,h.jsxs)(`button`,{type:`button`,className:`rp-tab`,"aria-pressed":O===`files`,onClick:()=>k(`files`),children:[(0,h.jsx)(ar,{}),o(`Files`)]}),(0,h.jsxs)(`button`,{type:`button`,className:`rp-tab`,"aria-pressed":O===`task`,disabled:!X,onClick:()=>k(`task`),children:[(0,h.jsx)(er,{}),o(`Task details`)]})]}),O===`files`?(0,h.jsx)(ba,{client:u.client,enabled:!!F.workspace,onReference:e=>{x||Xe(V??void 0),j(e),G()}}):X?(0,h.jsx)(Pa,{client:u.client,context:ne,seed:{...X,scope:{kind:`task`,id:v??X.scope.id}},runs:nt,canAct:re&&!Ne,onAction:e=>void Ye(e),planMetadata:ee},v):(0,h.jsx)(Na,{})]})})]}),(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:o(`Connection freshness is not execution outcome.`),children:[(0,h.jsx)(`span`,{className:`status-dot ${H.error||!F.workspace?`error`:H.transportStatus===`current`?H.state?H.state.connection===`current`?`ok`:`busy`:``:`busy`}`,"aria-hidden":`true`}),s(lt),o(` · transport {status}`,{status:s(H.transportStatus)}),H.error?` · ${s(H.error)}`:``]}),(0,h.jsx)(`span`,{className:`status-item${st?.status===`complete`?ct.length>0?` warn`:``:` faint`}`,children:st?.status===`complete`?ct.length>0?o(ct.length===1?`{count} active run`:`{count} active runs`,{count:ct.length}):o(`No active runs`):o(`Active roster unavailable; absence is not proof of settlement.`)})]}),(0,h.jsxs)(`div`,{className:`statusbar-right`,children:[F.workspace&&(0,h.jsx)(Ga,{path:z,onClick:()=>D(``)}),(0,h.jsxs)(`div`,{className:`status-item${F.compatible?` faint`:` warn`}`,title:Tr?.buildId??o(`unbuilt source`),children:[(0,h.jsxs)(`details`,{className:`build-part`,children:[(0,h.jsx)(`summary`,{children:o(`Build information`)}),(0,h.jsx)(y,{text:o(`Local browser build: {build}.`),slots:{build:(0,h.jsx)(`code`,{children:Tr?.buildId??o(`unbuilt source`)})}}),` `]}),(0,h.jsx)(`span`,{children:o(`Shared compatibility: {state}.`,{state:F.compatible?o(`compatible`):o(`unavailable / mismatch — reload built assets; normal actions disabled`)})})]})]})]}),E!==null&&F.workspace&&(0,h.jsx)(Ra,{onOpen:n,projects:a??(R.value?.kind===`projects`?R.value.entries:[]),client:u.client,current:z??F.workspace.rootLabel,initial:E||void 0,home:i,epoch:F.workspace.epoch,onClose:()=>D(null)}),d&&(0,h.jsx)(di,{client:u.client,compatible:!!F.compatible&&F.transportStatus===`current`&&!F.error,onClose:()=>p(!1),onChanged:()=>{Me(void 0),Y.current.depart(),F.refresh(!0)}}),je&&(0,h.jsx)(li,{prepared:je,client:u.client,current:F.actions&&(re||je.preflight.preview.action.kind===`create`)?Je:null,attachmentVersion:F.attachmentVersion,onClose:()=>{Y.current.current(rt)&&(Y.current.depart(),Me(e=>e===je?void 0:e))},onResult:it},je.commandId),Ce&&tt&&(0,h.jsx)(Ii,{client:u.client,seed:tt,onClose:()=>we(!1),onHit:e=>{De(e),Oe(e.cursor),v&&history.replaceState(null,``,Ka(v,e.cursor,N?{scope:N,snapshotSeq:pe}:void 0))}}),Te&&tt&&(0,h.jsx)(Ni,{request:{storeId:tt.storeId,scope:tt.scope,snapshotSeq:tt.snapshotSeq,format:`ndjson`},onClose:()=>q(!1)})]})}function So({client:e,seed:t}){let n=_i(e,{...t,reader:`tools`}),r=n.page;return(0,h.jsxs)(`section`,{className:`tools-list`,children:[(0,h.jsx)(Ei,{pager:n}),(0,h.jsx)(`div`,{className:`tools-body`,children:r&&!(`kind`in r)&&r.records.map(t=>t.kind===`tool`?(0,h.jsx)($i,{record:t,client:e,seed:r.request},`${t.owner.entity.id}:${t.version}`):null)})]})}var Co=`cadence-last-project`;function wo(){try{let e=localStorage.getItem(Co);return e&&/^[a-f0-9]{64}$/.test(e)?e:null}catch{return null}}function To(e){try{localStorage.getItem(`cadence-last-project`)!==e&&localStorage.setItem(Co,e)}catch{}}function Eo(e){let t=wo();return t?e.projects.find(e=>e.id===t):void 0}async function Do(e,t){try{return(await Er(e).client.workbenchRead({kind:`conversations`},t)).kind===`ok`&&!t.aborted}catch{return!1}}function Oo({ready:e,projects:t=[],restore:n=null,onOpenFolder:r,children:i}){let{t:a,locale:o,setLocale:s}=C(),[c,l]=(0,f.useState)(null),[u,d]=(0,f.useState)(!1),[p,m]=(0,f.useState)(!0),g=(0,f.useRef)(null),_=(0,f.useCallback)(()=>l(null),[]);(0,f.useEffect)(()=>{let e=matchMedia(`(max-width: 900px)`),t=()=>d(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),lo({enabled:u,open:c,onOpenChange:l,container:g}),Xa(g,c,u,_);let v=e=>{_(),r(e)},y=e=>e.split(/[\\/]/).filter(Boolean).at(-1)??e;return(0,h.jsxs)(`div`,{className:`app workbench-entry${p?``:` inspector-hidden`}`,children:[(0,h.jsxs)(`header`,{className:`topbar`,children:[(0,h.jsx)(`button`,{type:`button`,className:`panel-toggle`,"aria-label":a(`Tasks`),onClick:()=>l(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:o===`zh`?`en`:`zh-CN`,onClick:()=>s(o===`zh`?`en`:`zh`),"aria-label":o===`zh`?`Switch to English`:`切换到中文`,children:[(0,h.jsx)(nr,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:o===`zh`?`EN`:`中文`})]})})]}),(0,h.jsxs)(`button`,{type:`button`,className:`panel-toggle has-label inspector-toggle`,"aria-label":a(`Files`),"aria-expanded":u?c===`right`:p,onClick:()=>u?l(e=>e===`right`?null:`right`):m(e=>!e),children:[(0,h.jsx)(Gn,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:a(`Files`)})]})]}),i,(0,h.jsxs)(`div`,{className:`layout`,ref:g,children:[(0,h.jsx)(`button`,{type:`button`,"aria-label":a(`Close drawer`),tabIndex:-1,className:`drawer-backdrop persistent${c?` on`:``}`,onClick:_}),(0,h.jsx)(`section`,{className:`panel-drawer drawer-left${c===`left`?` open`:``}`,"aria-label":a(`Task navigation drawer`),tabIndex:-1,inert:u&&c!==`left`,children:(0,h.jsxs)(`aside`,{className:`panel panel-left lp-panel`,children:[(0,h.jsx)(Ba,{onConversation:()=>v(),disabled:!e}),(0,h.jsxs)(`section`,{className:`lp-section grow`,children:[(0,h.jsx)(`header`,{className:`lp-section-header`,children:(0,h.jsx)(`span`,{className:`lp-section-title`,children:a(`Conversation history`)})}),(0,h.jsxs)(`div`,{className:`lp-section-body`,children:[(0,h.jsx)(`p`,{className:`panel-hint`,role:`status`,children:n?.status===`checking`?a(`Returning to your last project {name}…`,{name:y(n.path)}):n?.status===`stopped`?a(`Your last project {name} is not running. Choose it below and open it again to see its conversations.`,{name:y(n.path)}):t.length?a(`Conversations are kept with each project. Choose a project below and open it to see its history.`):a(`Conversations are kept with each project. Open a working folder to see its history.`)}),t.map(t=>(0,h.jsxs)(`button`,{type:`button`,className:`session-item project-item`,title:t,disabled:!e,onClick:()=>v(t),children:[(0,h.jsx)(`span`,{className:`session-icon`,children:(0,h.jsx)(ar,{"aria-hidden":`true`})}),(0,h.jsxs)(`span`,{className:`session-info`,children:[(0,h.jsx)(`span`,{className:`session-title`,children:y(t)}),(0,h.jsx)(`span`,{className:`session-sub`,children:t})]})]},t))]})]})]})}),(0,h.jsx)(`main`,{className:`main`,inert:u&&c!==null,children:(0,h.jsxs)(`section`,{className:`chat-workspace`,"aria-label":a(`Ordinary conversation`),children:[(0,h.jsx)(`div`,{className:`chat-messages`,children:(0,h.jsx)(ga,{})}),(0,h.jsxs)(`div`,{className:`chat-composer`,children:[(0,h.jsx)(`textarea`,{disabled:!0,"aria-label":a(`Message`),rows:3,placeholder:a(`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:a(`Ordinary conversation`)}),(0,h.jsxs)(`button`,{type:`button`,className:`primary`,disabled:!0,children:[(0,h.jsx)(yr,{"aria-hidden":`true`}),a(`Send`)]})]})]})]})}),(0,h.jsx)(`section`,{className:`panel-drawer drawer-right${c===`right`?` open`:``}`,"aria-label":a(`Files`),tabIndex:-1,inert:u&&c!==`right`,children:(0,h.jsxs)(`aside`,{className:`panel files-panel`,children:[(0,h.jsxs)(`header`,{className:`files-toolbar`,children:[(0,h.jsx)(ar,{"aria-hidden":`true`}),a(`Files`)]}),(0,h.jsx)(`p`,{className:`panel-hint`,children:a(`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:a(`No working folder selected`)})}),(0,h.jsx)(`div`,{className:`statusbar-right`,children:(0,h.jsx)(Ga,{disabled:!e,onClick:()=>v()})})]})]})}async function ko(e){return ne(await En(e,1048576),1048576)}function Ao(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 jo(){let{t:e}=C(),[t,n]=(0,f.useState)(),[r,i]=(0,f.useState)(Ai),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(0),[d,p]=(0,f.useState)(null),m=(0,f.useRef)(new Map),g=(0,f.useRef)(!r),_=(0,f.useRef)(null),v=(0,f.useCallback)(()=>{_.current&&(_.current.abort(),_.current=null,p(null))},[]);(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 ko(t);t.status===400&&Ao(r)===`invalid`?n(null):t.ok?(n(sn(r)),c(``)):c(Ao(r))}catch{e.signal.aborted||c(`unavailable`)}})(),()=>e.abort()},[l]),(0,f.useEffect)(()=>{let e=()=>{v(),p(null),i(Ai())};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[v]),(0,f.useEffect)(()=>{if(!t||!g.current)return;g.current=!1;let e=Eo(t);if(!e)return;let n=new AbortController;_.current=n,p({status:`checking`,path:e.cwd}),Do(e.id,n.signal).then(t=>{n.signal.aborted||(_.current=null,t?(history.replaceState(null,``,`/app?project=${e.id}`),p(null),i(e.id)):p({status:`stopped`,path:e.cwd}))})},[t]);let y=(0,f.useCallback)(e=>{v(),p(null),r&&m.current.set(r,window.location.hash),history.pushState(null,``,e?`/app?project=${e.id}${m.current.get(e.id)??``}`:`/app`),i(e?.id??null),o(null)},[r,v]),b=(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 ko(i);if(!i.ok||!a||typeof a!=`object`||!(`kind`in a)||a.kind!==`project`||!(`project`in a))throw Error(Ao(a));let o=on(a.project);n(e=>e&&{...e,projects:[...e.projects.filter(e=>e.id!==o.id),o]}),y(o)},[t,y]),x=(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 ko(n);if(!n.ok){let e=Ao(r);return{kind:`error`,error:A(O.find(t=>t===e)??`unavailable`)}}return{kind:`ok`,value:pn(r)}}catch{return{kind:`error`,error:A(`unavailable`)}}}}),[]),S=(0,f.useMemo)(()=>r?Er(r):void 0,[r]),w=t?.projects.find(e=>e.id===r);return(0,f.useEffect)(()=>{w&&To(w.id)},[w]),t===null?(0,h.jsx)(xo,{}):t&&w&&S?(0,h.jsx)(xo,{api:S,onOpenProject:b,onWorkbenchHome:()=>y(null),workbenchHome:t.home,projectEntries:t.projects.map(e=>({path:e.cwd,current:e.id===r}))},`${w.id}:${w.epoch}`):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(Oo,{ready:!!t,projects:t?.projects.map(e=>e.cwd)??[],restore:d,onOpenFolder:e=>{v(),o(e??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&&!w&&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)(Ra,{client:x,current:``,projects:t.projects.map(e=>({path:e.cwd,current:!1})),initial:a,home:t.home,epoch:t.epoch,onClose:()=>o(null),onOpen:b})]})}function Mo(){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 No=class extends f.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,h.jsx)(Mo,{}):this.props.children}},Po=document.getElementById(`root`);if(!Po)throw Error(`Application root unavailable`);(0,p.createRoot)(Po).render((0,h.jsx)(w,{children:(0,h.jsx)(No,{children:(0,h.jsx)(jo,{})})}));export{ho as t};
|
|
10
|
+
`)}),![`completed`,`running`,`queued`].includes(e.status)&&(0,h.jsx)(`p`,{className:`ep-state ${e.status}`,children:n(e.status)})]})}function Ea({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=Wr(e,t?{kind:`files`,path:i}:null),d=Wr(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)(ar,{}):(0,h.jsx)(or,{}),(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 ni(e.path).then(e=>l(e?``:r(`Link copy unavailable.`))),children:(0,h.jsx)(fr,{})})]},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 Da({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)(mr,{}):(0,h.jsx)(gr,{})]})}),(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)(ui,{text:e.readablePlan})]}),(0,h.jsx)(ii,{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)(lr,{}),` `,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)(ui,{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 Oa=`未命名章节`;function ka(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 Aa(e){let t=new Map;return e.map(({level:e,label:n})=>{let r=String(n??``).replace(/\s+/g,` `).trim(),i=ka(r||Oa),a=(t.get(i)??0)+1;return t.set(i,a),{level:e,id:a===1?i:`${i}-${a}`,label:r||Oa}})}function ja(e){return e.length>=2}function Ma(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 Na({text:e}){return(0,h.jsx)(`pre`,{className:`scm-diff-pre`,children:Ma(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 Pa({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=Aa(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)(ii,{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:[ja(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)(ui,{text:e})})]}):n===`diff`?(0,h.jsx)(Na,{text:e}):(0,h.jsx)(`div`,{className:`fp-code ${i?``:`no-wrap`}`,children:Ma(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 Fa({client:e,seed:t}){let{t:n,tx:r}=C(),i=Ci(e,t),[a,o]=(0,f.useState)(),s=i.page;return(0,h.jsxs)(`section`,{className:`scm-body`,children:[(0,h.jsx)(Mi,{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(xi(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)(ji,{client:e,cursor:a,render:e=>(0,h.jsx)(Pa,{text:e})},`${a.recordId}:${a.recordVersion}`)]})}function Ia({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)(Fa,{client:e,seed:{...n,reader:`checks`}})]})}function La({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)(Pa,{text:a.text})]})]})}var Ra=[[`plan`,sr],[`checks`,vr],[`changes`,rr],[`review`,Vn]];function za(){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 Ba({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 Yr);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)(za,{});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:Ra.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)(Da,{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)(Ia,{client:e,taskId:A,seed:N,canAct:i,onAction:a,onObligations:M}),d===`changes`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(La,{client:e,storeId:n.storeId,taskId:A}),(0,h.jsx)(`h3`,{children:s(`Captured historical observations`)}),(0,h.jsx)(Fa,{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)(Fa,{client:e,seed:{...N,reader:`reviews`}})]})]})]})}var Va={relative:`Enter a full path, for example ~/project.`,invalid:`This folder does not exist. Check the path.`,forbidden:`This location cannot be browsed: it belongs to another account, is protected, or is not a plain folder (for example a link).`,unavailable:`This folder could not be read right now; it may lack read permission. Try again.`},Ha=e=>/^(?:~(?:[\\/]|$)|[\\/]|[A-Za-z]:[\\/])/.test(e);function Ua(e,t){let n=e.startsWith(`/`)?`/`:`\\`,r=(e,t)=>e.endsWith(n)?e+t:e+n+t,i=!!t&&(e===t||e.startsWith(r(t,``))),a=i?t:/^(?:\\\\[^\\]+\\[^\\]+|[A-Za-z]:\\|\/)/.exec(e)?.[0]??``;if(!a)return{inside:i,trail:[{name:e,path:e}]};let o=i?[]:[{name:a===`/`?`/`:a.replace(/\\$/,``),path:a}],s=a;for(let t of e.slice(a.length).split(/[\\/]/).filter(Boolean))s=r(s,t),o.push({name:t,path:s});return{inside:i,trail:o}}function Wa({client:e,current:t,initial:n,home:r,epoch:i,onClose:a,onOpen:o,projects:s=[]}){let{t:c,tx:l}=C(),[u,d]=(0,f.useState)(),[p,m]=(0,f.useState)(n??t),[g,_]=(0,f.useState)(!1),[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(!0),[S,w]=(0,f.useState)(!0),[T,E]=(0,f.useState)(!1),[D,O]=(0,f.useState)(null),k=(0,f.useRef)(!0),A=(0,f.useRef)(void 0),j=(0,f.useRef)(n??t),M=(0,f.useRef)(null),N=(0,f.useRef)(null),P=async t=>{A.current?.abort();let n=new AbortController;A.current=n,x(!0),O(null);let r=await e.workbenchRead({kind:`directories`,path:t},n.signal).catch(()=>void 0);if(!n.signal.aborted&&k.current){if(A.current=void 0,x(!1),r?.kind===`ok`&&r.value.kind===`directories`)return d(r.value),m(r.value.path),_(!1),y(``),r.value;O({step:`read`,code:r?.kind===`error`?r.error.code:`unavailable`})}},F=(0,f.useRef)(P);(0,f.useEffect)(()=>(k.current=!0,F.current(j.current).then(()=>{k.current&&w(!1)}),()=>{k.current=!1,A.current?.abort()}),[]),(0,f.useEffect)(()=>{g&&M.current?.select()},[g]),(0,f.useEffect)(()=>{N.current&&(N.current.scrollLeft=N.current.scrollWidth)});let I=e=>{T||P(e)},L=()=>{let e=p.trim();T||(Ha(e)?P(e):O({step:`read`,code:`relative`}))},R=(g||!u)&&p.trim()||u?.path||``,z=!T&&!b&&!!R,B=async n=>{if(T||!n||b&&n===u?.path)return;if(n!==u?.path&&!Ha(n)){O({step:`read`,code:`relative`});return}E(!0),O(null);let r=n===u?.path?u.path:(await P(n))?.path;if(!k.current)return;if(!r){E(!1);return}if(!o&&r===t){a();return}if(o){try{await o(r),k.current&&a()}catch(e){k.current&&(O({step:`open`,code:e instanceof Error?e.message:`unavailable`}),E(!1))}return}if(!e.workbenchCommand){O({step:`open`,code:`unavailable`}),E(!1);return}let s=await e.workbenchCommand({kind:`open-project`,commandId:crypto.randomUUID(),path:r,epoch:i});if(k.current){if(s.kind===`ok`&&s.value.kind===`project`){let e=new URL(s.value.link);e.protocol===`http:`&&[`127.0.0.1`,`[::1]`].includes(e.hostname)||e.protocol===`https:`?window.location.assign(e.href):(O({step:`open`,code:`unsupported-context`}),E(!1))}else O({step:`open`,code:s.kind===`error`?s.error.code:`unavailable`}),E(!1)}},V=u?Ua(u.path,r):void 0,H=v.trim().toLowerCase(),U=u?.entries.filter(e=>e.name.toLowerCase().includes(H))??[],ee=D&&(D.step===`read`&&Va[D.code]?c(Va[D.code]):l(D.code));return(0,h.jsxs)(mi,{title:c(`Open working folder`),onClose:a,children:[(0,h.jsx)(`p`,{children:c(`Choose a folder on the service host. Opening reuses or starts that project's independent service; current work keeps running.`)}),s.length>0&&(0,h.jsxs)(`section`,{className:`cwd-recent`,"aria-label":c(`Recent projects`),children:[(0,h.jsx)(`h3`,{children:c(`Recent projects`)}),(0,h.jsx)(`div`,{className:`cwd-recent-list`,children:s.map(e=>(0,h.jsxs)(`button`,{type:`button`,title:c(`Open {path}`,{path:e.path}),"aria-current":e.current?`true`:void 0,disabled:T,onClick:()=>e.current?a():void B(e.path),children:[(0,h.jsx)(ar,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:e.path})]},e.path))})]}),(0,h.jsxs)(`div`,{className:`cwd-location`,children:[V&&!g?(0,h.jsxs)(`nav`,{ref:N,className:`cwd-crumbs`,"aria-label":c(`Current location`),children:[(0,h.jsxs)(`button`,{type:`button`,"aria-label":c(`Home folder`),title:c(`Home folder (~)`),"aria-current":r&&u?.path===r?`location`:void 0,disabled:T,onClick:()=>I(`~`),children:[(0,h.jsx)(tr,{"aria-hidden":`true`}),V.inside&&(0,h.jsx)(`span`,{"aria-hidden":`true`,children:`~`})]}),V.trail.map((e,t)=>(0,h.jsxs)(f.Fragment,{children:[(t>0||V.inside)&&(0,h.jsx)(hr,{"aria-hidden":`true`,className:`cwd-crumb-sep`}),(0,h.jsx)(`button`,{type:`button`,"aria-current":e.path===u?.path?`location`:void 0,disabled:T,onClick:()=>I(e.path),children:e.name})]},e.path))]}):S?(0,h.jsx)(`div`,{className:`cwd-crumbs`}):(0,h.jsx)(`form`,{className:`cwd-input`,onSubmit:e=>{e.preventDefault(),L()},children:(0,h.jsx)(`input`,{ref:M,"aria-label":c(`Folder path`),placeholder:c(`Type or paste a path, then press Enter`),value:p,disabled:T,spellCheck:!1,autoComplete:`off`,enterKeyHint:`go`,onChange:e=>{m(e.target.value),D?.step===`read`&&O(null)},onKeyDown:e=>{e.key===`Escape`&&u&&(e.preventDefault(),_(!1),m(u.path),O(null))}})}),u&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,"aria-label":c(`Edit path`),title:c(`Edit path`),"aria-pressed":g,disabled:T,onClick:()=>{m(u.path),_(!g),O(null)},children:(0,h.jsx)(lr,{"aria-hidden":`true`})})]}),u&&(0,h.jsxs)(`label`,{className:`cwd-filter`,children:[(0,h.jsx)(Kn,{"aria-hidden":`true`}),(0,h.jsx)(`input`,{"aria-label":c(`Filter folders`),placeholder:c(`Filter this folder…`),value:v,disabled:T,spellCheck:!1,autoComplete:`off`,onChange:e=>y(e.target.value)})]}),(0,h.jsxs)(`div`,{className:`cwd-picker-list`,"aria-busy":b||void 0,children:[b&&(0,h.jsx)(`p`,{role:`status`,className:`cwd-picker-note`,children:c(`Reading folder…`)}),u?.parent&&(0,h.jsxs)(`button`,{type:`button`,disabled:T,onClick:()=>I(u.parent),children:[(0,h.jsx)(yr,{}),c(`Parent folder`)]}),U.map(e=>(0,h.jsxs)(`button`,{type:`button`,disabled:T,onClick:()=>I(e.path),children:[(0,h.jsx)(ar,{}),(0,h.jsx)(`span`,{children:e.name})]},e.path)),u&&!b&&U.length===0&&(0,h.jsx)(`p`,{className:`cwd-picker-note`,children:c(H?`No matching folders.`:`No subfolders.`)})]}),u?.limited&&(0,h.jsx)(`p`,{className:`inspector-note`,children:c(`Bounded listing; narrow the directory to see more.`)}),ee&&(0,h.jsxs)(`p`,{role:`alert`,children:[ee,D?.code===`registry-locked`&&(0,h.jsxs)(h.Fragment,{children:[` `,`—`,` `,c(`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.jsxs)(`footer`,{className:`cwd-footer`,children:[R&&(0,h.jsxs)(`p`,{className:`cwd-target`,children:[(0,h.jsx)(`span`,{children:c(`Will open:`)}),` `,(0,h.jsx)(`code`,{children:R})]}),(0,h.jsx)(`button`,{type:`button`,className:`primary`,disabled:!z,onClick:()=>void B(R),children:c(T?`Opening folder…`:`Open this folder`)})]})]})}function Ga(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)(dr,{"aria-hidden":`true`})})]})}function qa({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)(gr,{"aria-hidden":`true`}):(0,h.jsx)(hr,{"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=Ga(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)(hr,{"aria-hidden":`true`}):(0,h.jsx)(gr,{"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)(dr,{"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 Ya({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)(Mi,{pager:e,compact:!0})]})}function Xa({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=Ci(e,b),S=Ci(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)(Ya,{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)(qa,{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)(qa,{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)(Mi,{pager:x,compact:!0})]}),!E.some(e=>e.owner.taskId===n)&&D]})]})}function Za({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)(ar,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:e||r(`Open working folder`)}),(0,h.jsx)(gr,{"aria-hidden":`true`})]})}function Qa(e,t,n){let r=new URL(window.location.origin+window.location.pathname),i=Ii();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 $a(){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=ke(ne(n));return s.navigation?null:{taskId:t,cursor:s,scope:a,snapshotSeq:o}}catch{return null}}function eo(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 to({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=eo({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 no(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 ro=.4,io=1.05;function ao(e){return Math.min(300,e*.86)}function oo(e,t,n){return n||(t<=144?null:e<=72?`left`:t-e<=72?`right`:null)}function so(e,t){let n=Math.abs(e),r=Math.abs(t);return n<12&&r<12?`none`:n>r*1.2?`horizontal`:`vertical`}function co(e,t){return e===`left`?t:-t}function lo(e,t){return Math.max(-e,Math.min(0,-e+t))}function uo(e,t,n){let r=n?e+t:t;return Math.max(0,Math.min(1,r/e))}function fo(e){let{wasOpen:t,pull:n,width:r,durationMs:i}=e;return i<=320&&Math.abs(n)>=48?n>0:uo(r*io,n,t)>=ro}var po=new Set([`auto`,`scroll`,`overlay`]);function mo(e,t){let n=e instanceof Element?e:null;for(;n;){if(n instanceof HTMLElement&&n.scrollWidth>n.clientWidth+4&&po.has(getComputedStyle(n).overflowX))return!0;if(n===t)break;n=n.parentElement}return!1}function ho(){let e=e=>{e.stopPropagation(),e.preventDefault()};window.addEventListener(`click`,e,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener(`click`,e,{capture:!0}),400)}function go(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=oo(r.clientX,window.innerWidth,n);i&&!mo(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=so(d,v);if(t===`none`)return;if(t===`vertical`){s=null;return}c=`horizontal`,p=n===r,m=ao(window.innerWidth),h=m*io;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=co(r,d);let b=lo(h,p?h+f:f);y.style.transform=`translateX(${r===`left`?b:-b}px)`,_&&(_.style.opacity=String(uo(h,f,p))),t.preventDefault()},x=()=>{let e=s,t=c===`horizontal`&&e!==null&&g!==null,i=f,a=Date.now()-d,o=t?fo({wasOpen:p,pull:i,width:m,durationMs:a}):!1;v(),t&&e&&o!==(n===e)&&(ho(),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 _o(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 vo=`modulepreload`,yo=function(e){return`/`+e},bo={},xo=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=yo(t,n),t=s(t),t in bo)return;bo[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`:vo,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 So({client:e,seed:t,onSearch:n}){let{t:r}=C(),i=Ci(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)(Mi,{pager:i}),a&&!(`kind`in a)&&(0,h.jsx)(Co,{client:e,seed:a.request,records:a.records,onSearch:n},`${a.request.snapshotSeq}:${a.request.after?.recordId??`first`}`)]})}function Co({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 xo(()=>import(`./timeline-client.js`).then(i=>{!e&&o.current&&(r=i.default.mount(o.current,_o(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)(Ni,{client:e,seed:t})]})}function wo(){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 To=[[`tools`,Un],[`context`,er],[`timeline`,pr],[`runs`,ir]];function Eo({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 Do({api:e,planMetadata:t,onOpenProject:n,onWorkbenchHome:r,workbenchHome:i,projectEntries:a}){let{t:o,tx:s,locale:c,setLocale:l}=C(),[u]=(0,f.useState)(()=>e??Er()),[d,p]=(0,f.useState)(!1),[m,g]=(0,f.useState)(!1),[_]=(0,f.useState)($a),[v,b]=(0,f.useState)(_?.taskId??null),[x,S]=(0,f.useState)(()=>_?null:wo()??crypto.randomUUID()),[w,T]=(0,f.useState)(!1),[E,D]=(0,f.useState)(null),[O,k]=(0,f.useState)(_?`task`:`files`),[A,j]=(0,f.useState)(),M=(0,f.useCallback)(()=>j(void 0),[]),[N,P]=(0,f.useState)(_?_.scope??{kind:`task`,id:_.taskId}:null),F=Jr(u,v?{kind:`task`,id:v}:null,!m),I=(0,f.useRef)(null);F.workspace&&(I.current=F.workspace.workspaceId);let L=Wr(u.client,F.workspace&&!m?{kind:`conversations`}:null,2e3),R=Wr(u.client,F.workspace&&!m?{kind:`projects`}:null),z=(R.value?.kind===`projects`?R.value.entries.find(e=>e.current)?.path:void 0)??F.workspace?.rootLabel,B=Wr(u.client,v&&F.workspace&&!m?{kind:`task-origin`,taskId:v}:null),V=B.value?.kind===`task-origin`?B.value.conversationId:null,H={state:F.observation,transportStatus:F.transportStatus,error:F.error,refresh:F.refresh},U=F.workspace?.storeId,ee=(0,f.useMemo)(()=>t??(U?kr(u.client,U):void 0),[t,u,U]),te=H.state?.snapshot.scope.kind===`task`&&H.state.snapshot.scope.id===v?H.state.snapshot.context:void 0,ne=te?.status===`available`?te.version:null,re=F.actions&&H.state?.connection===`current`&&H.transportStatus===`current`&&!!ne&&ne.epoch===F.workspace?.epoch,[ie,ae]=(0,f.useState)(null),[oe,se]=(0,f.useState)(!1),ce=(0,f.useRef)(null),[le,ue]=(0,f.useState)(260),[de,fe]=(0,f.useState)(360),G=(0,f.useCallback)(()=>ae(null),[]);(0,f.useEffect)(()=>{let e=matchMedia(`(max-width: 900px)`),t=()=>se(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),go({enabled:oe&&!m,open:ie,onOpenChange:ae,container:ce}),no(ce,ie,oe&&!m,G);let[pe,me]=(0,f.useState)(_?.snapshotSeq),[K,he]=(0,f.useState)(``),[ge,_e]=(0,f.useState)(``),[ve,ye]=(0,f.useState)(!0),be=(0,f.useRef)(null),[xe,Se]=(0,f.useState)(`messages`),[Ce,we]=(0,f.useState)(!1),[Te,q]=(0,f.useState)(!1),[Ee,De]=(0,f.useState)(),[J,Oe]=(0,f.useState)(_?.cursor),[ke,Ae]=(0,f.useState)(!1),[je,Me]=(0,f.useState)(),[Ne,Pe]=(0,f.useState)(!1),[Fe,Ie]=(0,f.useState)(``),[Le,Re]=(0,f.useState)([]),[ze,Be]=(0,f.useState)(new Set),Ve=(0,f.useRef)(!0),He=(0,f.useRef)(null),Ue=(0,f.useRef)(!1),We=e=>{Ve.current&&Re(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)})},Y=(0,f.useRef)(new Yr),Ge=W({taskId:v,scope:N,selectedSnapshot:pe??null,detached:m,context:ne,attachment:F.attachmentVersion,workspaceContext:F.workspace?.context??null,observationError:F.error??null});Y.current.select(Ge);let[Ke,qe]=(0,f.useState)(Ge);Ke!==Ge&&(qe(Ge),Pe(!1),Me(void 0)),(0,f.useEffect)(()=>(Ve.current=!0,()=>{Ve.current=!1,He.current?.abort(),Y.current.depart()}),[]);let Je=je?.preflight.preview.action.kind===`create`?F.workspace?.context.status===`available`?F.workspace.context.version:null:ne,Ye=async e=>{let t=e.kind===`create`?F.workspace?.context.status===`available`?F.workspace.context.version:null:ne;if(!F.actions||!t||Ne||m){Ie(o(`Current action context unavailable; observe again.`));return}Y.current.depart();let n=Y.current.ticket();Pe(!0),Ie(``);try{let r=await xr(u.client,t,e);if(!Y.current.current(n))return;r.kind===`error`?Ie(o(`Preflight refused: {code}`,{code:r.error.code})):Me(r.value)}catch{Y.current.current(n)&&Ie(o(`Preflight unavailable. No automatic retry.`))}finally{Y.current.current(n)&&Pe(!1)}},Xe=(e=crypto.randomUUID(),t=!1)=>{T(t),He.current?.abort(),Y.current.depart(),Me(void 0),Pe(!1),S(e),b(null),P(null),he(``),_e(``),De(void 0),Oe(void 0),me(void 0),Se(`messages`),k(`files`),G(),history.replaceState(null,``,`${location.pathname}${location.search}#chat=${e}`)};(0,f.useEffect)(()=>{x&&!window.location.hash&&history.replaceState(null,``,`${location.pathname}${location.search}#chat=${x}`)},[x]);let Ze=(e,t)=>{He.current?.abort(),S(null),k(`task`),he(t??``),_e(``),me(void 0),Y.current.depart(),Me(void 0),Pe(!1),b(e),P({kind:`task`,id:e}),De(void 0),Oe(void 0),Se(`messages`),G(),history.replaceState(null,``,Qa(e))};(0,f.useEffect)(()=>{let e=()=>{He.current?.abort();let e=$a();if(e)S(null),k(`task`),Y.current.depart(),Me(void 0),Pe(!1),me(e.snapshotSeq),he(``),_e(``),b(e.taskId),P(e.scope??{kind:`task`,id:e.taskId}),De(void 0),Oe(e.cursor),Se(`messages`),G();else{let e=wo();e&&(S(e),b(null),P(null),k(`files`),Me(void 0),Y.current.depart(),G())}};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[G]);let Qe=(e,t,n)=>{me(t),_e(n??``),Y.current.depart(),Me(void 0),Pe(!1),P(e),De(void 0),Oe(void 0),Se(`messages`),G(),v&&history.replaceState(null,``,Qa(v,void 0,{scope:e,snapshotSeq:t}))},$e=pe??H.state?.snapshot.committedSeq??F.workspace?.committedSeq,et=F.workspace?.storeId,X=N&&et&&$e?{storeId:et,scope:N,snapshotSeq:$e,reader:`messages`,after:null,limit:50}:null,tt=N&&et&&$e?{storeId:et,scope:N,snapshotSeq:$e,query:null,recordId:null,recordVersion:null,field:null,offset:0}:null,nt=te?H.state?.snapshot.runs??[]:[],rt=Y.current.ticket(),it=e=>{We(e),e.receipt&&Y.current.current(rt)&&F.refresh()},at=async e=>{let t=F.workspace;if(Ue.current||!F.actions||!t||t.context.status!==`available`||m)return!1;let n=new AbortController;He.current?.abort(),He.current=n,Ue.current=!0,Ae(!0),Ie(``);let r={},i=L.value?.kind===`conversations`&&L.value.entries.some(e=>e.id===x)?x:null;try{let a=await Hr({client:u.client,storeId:t.storeId,context:t.context.version,goal:e,signal:n.signal,observe:e=>{We(e);let t=e.receipt??(e.lookup?.status===`found`?e.lookup.receipt:void 0);t?.created?.state===`published`&&(r.value={taskId:t.created.taskId,commandId:e.commandId})}});if(n.signal.aborted)return!1;if(i&&r.value){let e=await u.client.workbenchCommand({kind:`link-task`,commandId:r.value.commandId,epoch:t.epoch,taskId:a,conversationId:i});if(n.signal.aborted)return!1;e.kind!==`ok`&&Ie(o(`Task created, but its conversation link was not confirmed.`))}return Ze(a),F.refresh(),!0}catch(e){return!n.signal.aborted&&Ve.current&&(r.value&&Ze(r.value.taskId),Ie(o(`Task preparation stopped: {reason}. Observe the original receipt; no automatic retry.`,{reason:e instanceof Error?e.message:`unavailable`})),F.refresh()),!1}finally{Ue.current=!1,Ve.current&&Ae(!1)}},ot=e=>{if(ze.has(e)||!F.cancelCompatible||!F.activeRuns)return;let t=crypto.randomUUID(),n=F.activeRuns.epoch;Be(t=>new Set(t).add(e)),We({commandId:t,error:o(`Stop requested; settlement is not yet confirmed.`)}),u.client.cancel({commandId:t,epoch:n,runId:e}).then(e=>{it(e.kind===`ok`?{commandId:t,receipt:e.value}:{commandId:t,error:o(`{code}; cancellation effect {effect}. Observe exact receipt.`,{code:e.error.code,effect:e.error.effect})})}).catch(()=>We({commandId:t,error:o(`Cancellation effect uncertain. Observe exact receipt.`)})).finally(()=>{Ve.current&&Be(t=>{let n=new Set(t);return n.delete(e),n})})};if(m)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:o(`Detached`)}),(0,h.jsx)(`p`,{children:o(`Accepted service work continues. No Cancel was requested.`)}),Le.map(e=>(0,h.jsxs)(`p`,{children:[o(`Observe command after reconnect:`),` `,(0,h.jsx)(`code`,{children:e.commandId})]},e.commandId)),(0,h.jsx)(`button`,{type:`button`,className:`primary`,onClick:()=>g(!1),children:o(`Reconnect as a viewer`)})]});let st=F.activeRuns,ct=st?.status===`complete`?st.runs:[],lt=H.state?.connection??(F.workspace?v?`Task snapshot not observed yet`:`Chat ready`:`Service unavailable`);return(0,h.jsxs)(`div`,{className:`app${ve?``:` inspector-hidden`}`,children:[(0,h.jsxs)(`header`,{className:`topbar`,children:[(0,h.jsx)(`button`,{type:`button`,className:`panel-toggle`,"aria-label":o(`Tasks`),onClick:()=>ae(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":o(`Workbench projects`),title:o(`Workbench projects`),onClick:r,children:(0,h.jsx)(ar,{})}),(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`})]}),F.workspace&&(0,h.jsxs)(`span`,{className:`chip static chip-root`,title:F.workspace.rootLabel,children:[(0,h.jsx)(ar,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:F.workspace.rootLabel})]}),(0,h.jsx)(`span`,{className:`tb-spacer`,"aria-hidden":`true`}),N&&(0,h.jsxs)(`nav`,{className:`tb-tabs`,"aria-label":o(`Recorded views`),children:[(0,h.jsxs)(`button`,{type:`button`,className:`tb-tab`,"aria-pressed":xe===`messages`&&!J,onClick:()=>{Oe(void 0),De(void 0),Se(`messages`)},children:[(0,h.jsx)(Yn,{"aria-hidden":`true`}),o(`Conversation`)]}),(0,h.jsxs)(`details`,{className:`view-menu`,ref:be,onKeyDown:e=>{e.key===`Escape`&&be.current&&(be.current.open=!1,be.current.querySelector(`summary`)?.focus())},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(e.currentTarget.open=!1)},children:[(0,h.jsxs)(`summary`,{className:`chip`,children:[xe===`messages`?o(`Details`):s(xe),(0,h.jsx)(gr,{"aria-hidden":`true`})]}),(0,h.jsxs)(`div`,{className:`view-menu-items`,children:[To.map(([e,t])=>(0,h.jsxs)(`button`,{type:`button`,"aria-pressed":xe===e,onClick:()=>{Oe(void 0),De(void 0),Se(e),be.current&&(be.current.open=!1,be.current.querySelector(`summary`)?.focus())},children:[(0,h.jsx)(t,{"aria-hidden":`true`}),s(e)]},e)),(0,h.jsxs)(`div`,{className:`view-menu-actions`,children:[(0,h.jsxs)(`button`,{type:`button`,"aria-label":o(`Export selected scope`),disabled:!X,onClick:()=>{be.current&&(be.current.open=!1,be.current.querySelector(`summary`)?.focus()),q(!0)},children:[(0,h.jsx)(ur,{"aria-hidden":`true`}),o(`Export selected scope`)]}),(0,h.jsxs)(`button`,{type:`button`,"aria-label":o(`Copy token-free link`),disabled:!v,onClick:()=>{v&&ni(Qa(v,J,N?{scope:N,snapshotSeq:pe}:void 0)).then(e=>Ie(e?``:o(`Link copy unavailable.`)))},children:[(0,h.jsx)($n,{"aria-hidden":`true`}),o(`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)(qi,{disabled:!tt,onOpen:()=>we(!0)}),(0,h.jsx)(`button`,{type:`button`,className:`chip`,"aria-label":o(`Observe current state`),"data-tip":o(`Observe current state`),onClick:()=>{F.refresh(),H.refresh()},children:(0,h.jsx)(qn,{"aria-hidden":`true`})}),(0,h.jsxs)(`button`,{type:`button`,className:`chip`,"aria-label":o(`Choose owner model`),"data-tip":o(`Choose owner model`),onClick:()=>p(!0),children:[(0,h.jsx)(dr,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`chip-label`,children:o(`Model`)})]}),(0,h.jsxs)(`button`,{type:`button`,className:`chip`,"aria-label":o(`Return — work continues`),"data-tip":o(`Return — accepted work continues`),onClick:()=>{Me(void 0),ae(null),we(!1),q(!1),Y.current.depart(),Pe(!1),He.current?.abort(),g(!0)},children:[(0,h.jsx)(Zn,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`chip-label`,children:o(`Return`)})]}),(0,h.jsxs)(`button`,{type:`button`,className:`chip chip-lang`,lang:c===`zh`?`en`:`zh-CN`,"aria-label":c===`zh`?`Switch to English`:`切换到中文`,"data-tip":c===`zh`?`Switch to English`:`切换到中文`,onClick:()=>l(c===`zh`?`en`:`zh`),children:[(0,h.jsx)(nr,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:c===`zh`?`EN`:`中文`})]})]})]}),(0,h.jsxs)(`button`,{type:`button`,className:`panel-toggle has-label inspector-toggle`,"aria-label":o(`Plan / review`),"aria-expanded":oe?ie===`right`:ve,onClick:()=>oe?ae(e=>e===`right`?null:`right`):ye(e=>!e),children:[(0,h.jsx)(Gn,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:o(x?`Files`:`Plan`)})]})]}),!F.workspace&&ct.length>0&&(0,h.jsx)(`section`,{className:`run-strip`,"aria-label":o(`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:[s(e.kind),` `,e.runId,` · `,s(e.stage)]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>Ze(e.taskId),children:o(`Open active task`)}),(0,h.jsxs)(`button`,{type:`button`,className:`danger`,disabled:!F.cancelCompatible||ze.has(e.runId),onClick:()=>ot(e.runId),children:[(0,h.jsx)(Wn,{"aria-hidden":`true`}),o(`Cancel run — request stop`)]})]},e.runId))}),(0,h.jsx)(Eo,{error:Fe,observationError:F.error}),(0,h.jsxs)(`div`,{ref:ce,className:`layout`,style:{"--left-w":`${le}px`,"--right-w":`${de}px`},children:[(0,h.jsx)(`button`,{type:`button`,"aria-label":o(`Close drawer`),tabIndex:-1,className:`drawer-backdrop persistent${ie?` on`:``}`,onClick:G}),(0,h.jsxs)(`section`,{className:`panel-drawer drawer-left${ie===`left`?` open`:``}`,"aria-label":o(`Task navigation drawer`),tabIndex:-1,inert:oe&&ie!==`left`,children:[F.workspace&&(0,h.jsx)(Xa,{client:u.client,workspace:F.workspace,taskId:v,scope:N,runs:nt,snapshot:H.state?.snapshot.committedSeq,activeRuns:F.activeRuns,cancelCompatible:!!F.cancelCompatible,canceling:ze,onCancel:ot,chats:L.value?.kind===`conversations`?L.value.entries:[],conversationId:x,onConversation:Xe,onNewConversation:()=>Xe(),onTask:Ze,onScope:Qe,onNew:()=>Xe(void 0,!0)}),F.workspace&&(0,h.jsx)(oa,{client:u.client,active:F.activeRuns,taskId:v,runs:nt,snapshot:$e,onOpen:(e,t,n,r)=>{Ze(e),P({kind:`child`,id:t}),_e(r),me(n),history.replaceState(null,``,Qa(e,void 0,{scope:{kind:`child`,id:t},snapshotSeq:n}))}})]}),(0,h.jsx)(to,{side:`left`,width:le,onResize:ue}),(0,h.jsxs)(`main`,{className:`main`,inert:oe&&ie!==null,children:[x&&(0,h.jsx)(wa,{client:u.client,id:x,workspaceId:I.current??`connecting`,available:!!F.workspace,canInterrupt:!!F.cancelCompatible,enabled:!!F.workspace&&!!F.compatible&&!F.error,onModel:()=>p(!0),onChanged:()=>{L.refresh(),F.refresh()},reference:A,onReferenceUsed:M,initialMode:w?`cadence`:`chat`,taskPending:ke,onCadence:at},`${I.current??`connecting`}:${x}`),N&&(0,h.jsxs)(`header`,{className:`conversation-header`,children:[(0,h.jsxs)(`div`,{className:`conversation-heading`,children:[N.kind!==`task`&&v&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>Ze(v,K),children:o(`Back to task`)}),V&&(0,h.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>Xe(V),children:o(`Back to ordinary conversation`)}),(0,h.jsx)(`h2`,{title:K||N.id,children:N.kind===`task`?K||o(`Task {id}`,{id:N.id.slice(0,8)}):ge||o(`{kind} {id}`,{kind:s(N.kind),id:N.id.slice(0,8)})}),N.kind===`child`&&(0,h.jsx)(`span`,{className:`conversation-badge`,children:o(`Subagent`)})]}),(0,h.jsxs)(`details`,{className:`conversation-info`,children:[(0,h.jsxs)(`summary`,{children:[o(`Recorded conversation`),` ·`,` `,o(`snapshot {seq}`,{seq:$e??``})]}),(0,h.jsx)(`code`,{children:N.id}),(0,h.jsx)(`p`,{children:o(`Pages and old outcomes are historical observations, not renewed consent.`)})]})]}),v&&(0,h.jsx)(Ji,{client:u.client,storeId:et,context:ne,runs:nt,snapshotSeq:$e,canAct:re&&!Ne,onResult:it},v),(0,h.jsxs)(`div`,{className:`workspace-content`,hidden:!!x,children:[!X&&(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:o(`Open a task or create one explicitly`)}),(0,h.jsx)(`p`,{children:o(`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:!F.workspace,onClick:()=>Xe(void 0,!0),children:[(0,h.jsx)(Jn,{"aria-hidden":`true`}),o(`New task`)]})]}),X&&J?(0,h.jsxs)(`div`,{className:`tab-body`,children:[Ee&&(Ee.owner.entity.kind===`task`||Ee.owner.entity.kind===`message`||Ee.owner.entity.kind===`tool`)&&(0,h.jsx)(Pi,{client:u.client,seed:{storeId:J.storeId,scope:J.scope,snapshotSeq:J.snapshotSeq,kind:Ee.owner.entity.kind,id:Ee.owner.entity.id,version:Ee.owner.entity.version}},`${Ee.owner.entity.id}:${Ee.owner.entity.version}`),(0,h.jsx)(ji,{client:u.client,cursor:J,highlight:Ee?.range},`${J.recordId}:${J.recordVersion}`)]}):X&&(0,h.jsxs)(`div`,{className:xe===`messages`||xe===`tools`?`tab-body transcript-body`:`tab-body`,children:[xe===`messages`&&(0,h.jsx)(ra,{client:u.client,seed:X}),xe===`tools`&&(0,h.jsx)(Oo,{client:u.client,seed:X}),xe===`context`&&(0,h.jsx)(Ni,{client:u.client,seed:X}),xe===`timeline`&&(0,h.jsx)(So,{client:u.client,seed:X,onSearch:()=>we(!0)}),xe===`runs`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`section`,{className:`run-current`,children:[(0,h.jsx)(`h3`,{children:o(`Runs in the current snapshot`)}),nt.length>0?nt.map(e=>(0,h.jsx)(Ui,{run:e},e.childRunId??e.runId)):(0,h.jsx)(`p`,{className:`panel-empty`,children:te&&H.state?o(`No owner run projection in this snapshot.`):o(`No snapshot observed yet; absence is not proof of settlement.`)})]}),(0,h.jsx)(`h3`,{children:o(`Retained runs`)}),(0,h.jsx)(Ki,{client:u.client,seed:{...X,scope:{kind:`task`,id:v??X.scope.id}},onScope:Qe},v)]})]},`${N?.kind}:${N?.id}:${pe??`current`}`)]}),F.workspace&&Le.length>0&&(0,h.jsx)(`div`,{className:`receipt-dock`,children:Le.map(e=>(0,h.jsx)(vi,{client:u.client,value:e,onChange:We},e.commandId))})]}),(0,h.jsx)(to,{side:`right`,width:de,onResize:fe}),(0,h.jsx)(`section`,{className:`panel-drawer drawer-right${ie===`right`?` open`:``}`,"aria-label":o(`Plan and review drawer`),tabIndex:-1,inert:oe&&ie!==`right`,children:(0,h.jsxs)(`div`,{className:`workbench-right`,children:[(0,h.jsxs)(`nav`,{className:`rp-tabs`,"aria-label":o(`Workspace panels`),children:[(0,h.jsxs)(`button`,{type:`button`,className:`rp-tab`,"aria-pressed":O===`files`,onClick:()=>k(`files`),children:[(0,h.jsx)(ar,{}),o(`Files`)]}),(0,h.jsxs)(`button`,{type:`button`,className:`rp-tab`,"aria-pressed":O===`task`,disabled:!X,onClick:()=>k(`task`),children:[(0,h.jsx)(er,{}),o(`Task details`)]})]}),O===`files`?(0,h.jsx)(Ea,{client:u.client,enabled:!!F.workspace,onReference:e=>{x||Xe(V??void 0),j(e),G()}}):X?(0,h.jsx)(Ba,{client:u.client,context:ne,seed:{...X,scope:{kind:`task`,id:v??X.scope.id}},runs:nt,canAct:re&&!Ne,onAction:e=>void Ye(e),planMetadata:ee},v):(0,h.jsx)(za,{})]})})]}),(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:o(`Connection freshness is not execution outcome.`),children:[(0,h.jsx)(`span`,{className:`status-dot ${H.error||!F.workspace?`error`:H.transportStatus===`current`?H.state?H.state.connection===`current`?`ok`:`busy`:``:`busy`}`,"aria-hidden":`true`}),s(lt),o(` · transport {status}`,{status:s(H.transportStatus)}),H.error?` · ${s(H.error)}`:``]}),(0,h.jsx)(`span`,{className:`status-item${st?.status===`complete`?ct.length>0?` warn`:``:` faint`}`,children:st?.status===`complete`?ct.length>0?o(ct.length===1?`{count} active run`:`{count} active runs`,{count:ct.length}):o(`No active runs`):o(`Active roster unavailable; absence is not proof of settlement.`)})]}),(0,h.jsxs)(`div`,{className:`statusbar-right`,children:[F.workspace&&(0,h.jsx)(Za,{path:z,onClick:()=>D(``)}),(0,h.jsxs)(`div`,{className:`status-item${F.compatible?` faint`:` warn`}`,title:Tr?.buildId??o(`unbuilt source`),children:[(0,h.jsxs)(`details`,{className:`build-part`,children:[(0,h.jsx)(`summary`,{children:o(`Build information`)}),(0,h.jsx)(y,{text:o(`Local browser build: {build}.`),slots:{build:(0,h.jsx)(`code`,{children:Tr?.buildId??o(`unbuilt source`)})}}),` `]}),(0,h.jsx)(`span`,{children:o(`Shared compatibility: {state}.`,{state:F.compatible?o(`compatible`):o(`unavailable / mismatch — reload built assets; normal actions disabled`)})})]})]})]}),E!==null&&F.workspace&&(0,h.jsx)(Wa,{onOpen:n,projects:a??(R.value?.kind===`projects`?R.value.entries:[]),client:u.client,current:z??F.workspace.rootLabel,initial:E||void 0,home:i,epoch:F.workspace.epoch,onClose:()=>D(null)}),d&&(0,h.jsx)(_i,{client:u.client,compatible:!!F.compatible&&F.transportStatus===`current`&&!F.error,onClose:()=>p(!1),onChanged:()=>{Me(void 0),Y.current.depart(),F.refresh(!0)}}),je&&(0,h.jsx)(hi,{prepared:je,client:u.client,current:F.actions&&(re||je.preflight.preview.action.kind===`create`)?Je:null,attachmentVersion:F.attachmentVersion,onClose:()=>{Y.current.current(rt)&&(Y.current.depart(),Me(e=>e===je?void 0:e))},onResult:it},je.commandId),Ce&&tt&&(0,h.jsx)(Hi,{client:u.client,seed:tt,onClose:()=>we(!1),onHit:e=>{De(e),Oe(e.cursor),v&&history.replaceState(null,``,Qa(v,e.cursor,N?{scope:N,snapshotSeq:pe}:void 0))}}),Te&&tt&&(0,h.jsx)(zi,{request:{storeId:tt.storeId,scope:tt.scope,snapshotSeq:tt.snapshotSeq,format:`ndjson`},onClose:()=>q(!1)})]})}function Oo({client:e,seed:t}){let n=Ci(e,{...t,reader:`tools`}),r=n.page;return(0,h.jsxs)(`section`,{className:`tools-list`,children:[(0,h.jsx)(Mi,{pager:n}),(0,h.jsx)(`div`,{className:`tools-body`,children:r&&!(`kind`in r)&&r.records.map(t=>t.kind===`tool`?(0,h.jsx)(aa,{record:t,client:e,seed:r.request},`${t.owner.entity.id}:${t.version}`):null)})]})}var ko=`cadence-last-project`;function Ao(){try{let e=localStorage.getItem(ko);return e&&/^[a-f0-9]{64}$/.test(e)?e:null}catch{return null}}function jo(e){try{localStorage.getItem(`cadence-last-project`)!==e&&localStorage.setItem(ko,e)}catch{}}function Mo(e){let t=Ao();return t?e.projects.find(e=>e.id===t):void 0}async function No(e,t){try{return(await Er(e).client.workbenchRead({kind:`conversations`},t)).kind===`ok`&&!t.aborted}catch{return!1}}function Po({ready:e,projects:t=[],restore:n=null,onOpenFolder:r,children:i}){let{t:a,locale:o,setLocale:s}=C(),[c,l]=(0,f.useState)(null),[u,d]=(0,f.useState)(!1),[p,m]=(0,f.useState)(!0),g=(0,f.useRef)(null),_=(0,f.useCallback)(()=>l(null),[]);(0,f.useEffect)(()=>{let e=matchMedia(`(max-width: 900px)`),t=()=>d(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),go({enabled:u,open:c,onOpenChange:l,container:g}),no(g,c,u,_);let v=e=>{_(),r(e)},y=e=>e.split(/[\\/]/).filter(Boolean).at(-1)??e;return(0,h.jsxs)(`div`,{className:`app workbench-entry${p?``:` inspector-hidden`}`,children:[(0,h.jsxs)(`header`,{className:`topbar`,children:[(0,h.jsx)(`button`,{type:`button`,className:`panel-toggle`,"aria-label":a(`Tasks`),onClick:()=>l(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:o===`zh`?`en`:`zh-CN`,onClick:()=>s(o===`zh`?`en`:`zh`),"aria-label":o===`zh`?`Switch to English`:`切换到中文`,children:[(0,h.jsx)(nr,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:o===`zh`?`EN`:`中文`})]})})]}),(0,h.jsxs)(`button`,{type:`button`,className:`panel-toggle has-label inspector-toggle`,"aria-label":a(`Files`),"aria-expanded":u?c===`right`:p,onClick:()=>u?l(e=>e===`right`?null:`right`):m(e=>!e),children:[(0,h.jsx)(Gn,{"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:a(`Files`)})]})]}),i,(0,h.jsxs)(`div`,{className:`layout`,ref:g,children:[(0,h.jsx)(`button`,{type:`button`,"aria-label":a(`Close drawer`),tabIndex:-1,className:`drawer-backdrop persistent${c?` on`:``}`,onClick:_}),(0,h.jsx)(`section`,{className:`panel-drawer drawer-left${c===`left`?` open`:``}`,"aria-label":a(`Task navigation drawer`),tabIndex:-1,inert:u&&c!==`left`,children:(0,h.jsxs)(`aside`,{className:`panel panel-left lp-panel`,children:[(0,h.jsx)(Ka,{onConversation:()=>v(),disabled:!e}),(0,h.jsxs)(`section`,{className:`lp-section grow`,children:[(0,h.jsx)(`header`,{className:`lp-section-header`,children:(0,h.jsx)(`span`,{className:`lp-section-title`,children:a(`Conversation history`)})}),(0,h.jsxs)(`div`,{className:`lp-section-body`,children:[(0,h.jsx)(`p`,{className:`panel-hint`,role:`status`,children:n?.status===`checking`?a(`Returning to your last project {name}…`,{name:y(n.path)}):n?.status===`stopped`?a(`Your last project {name} is not running. Choose it below and open it again to see its conversations.`,{name:y(n.path)}):t.length?a(`Conversations are kept with each project. Choose a project below and open it to see its history.`):a(`Conversations are kept with each project. Open a working folder to see its history.`)}),t.map(t=>(0,h.jsxs)(`button`,{type:`button`,className:`session-item project-item`,title:t,disabled:!e,onClick:()=>v(t),children:[(0,h.jsx)(`span`,{className:`session-icon`,children:(0,h.jsx)(ar,{"aria-hidden":`true`})}),(0,h.jsxs)(`span`,{className:`session-info`,children:[(0,h.jsx)(`span`,{className:`session-title`,children:y(t)}),(0,h.jsx)(`span`,{className:`session-sub`,children:t})]})]},t))]})]})]})}),(0,h.jsx)(`main`,{className:`main`,inert:u&&c!==null,children:(0,h.jsxs)(`section`,{className:`chat-workspace`,"aria-label":a(`Ordinary conversation`),children:[(0,h.jsx)(`div`,{className:`chat-messages`,children:(0,h.jsx)(Sa,{})}),(0,h.jsxs)(`div`,{className:`chat-composer`,children:[(0,h.jsx)(`textarea`,{disabled:!0,"aria-label":a(`Message`),rows:3,placeholder:a(`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:a(`Ordinary conversation`)}),(0,h.jsxs)(`button`,{type:`button`,className:`primary`,disabled:!0,children:[(0,h.jsx)(yr,{"aria-hidden":`true`}),a(`Send`)]})]})]})]})}),(0,h.jsx)(`section`,{className:`panel-drawer drawer-right${c===`right`?` open`:``}`,"aria-label":a(`Files`),tabIndex:-1,inert:u&&c!==`right`,children:(0,h.jsxs)(`aside`,{className:`panel files-panel`,children:[(0,h.jsxs)(`header`,{className:`files-toolbar`,children:[(0,h.jsx)(ar,{"aria-hidden":`true`}),a(`Files`)]}),(0,h.jsx)(`p`,{className:`panel-hint`,children:a(`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:a(`No working folder selected`)})}),(0,h.jsx)(`div`,{className:`statusbar-right`,children:(0,h.jsx)(Za,{disabled:!e,onClick:()=>v()})})]})]})}async function Fo(e){return ne(await En(e,1048576),1048576)}function Io(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 Lo(){let{t:e}=C(),[t,n]=(0,f.useState)(),[r,i]=(0,f.useState)(Ii),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(0),[d,p]=(0,f.useState)(null),m=(0,f.useRef)(new Map),g=(0,f.useRef)(!r),_=(0,f.useRef)(null),v=(0,f.useCallback)(()=>{_.current&&(_.current.abort(),_.current=null,p(null))},[]);(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 Fo(t);t.status===400&&Io(r)===`invalid`?n(null):t.ok?(n(sn(r)),c(``)):c(Io(r))}catch{e.signal.aborted||c(`unavailable`)}})(),()=>e.abort()},[l]),(0,f.useEffect)(()=>{let e=()=>{v(),p(null),i(Ii())};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[v]),(0,f.useEffect)(()=>{if(!t||!g.current)return;g.current=!1;let e=Mo(t);if(!e)return;let n=new AbortController;_.current=n,p({status:`checking`,path:e.cwd}),No(e.id,n.signal).then(t=>{n.signal.aborted||(_.current=null,t?(history.replaceState(null,``,`/app?project=${e.id}`),p(null),i(e.id)):p({status:`stopped`,path:e.cwd}))})},[t]);let y=(0,f.useCallback)(e=>{v(),p(null),r&&m.current.set(r,window.location.hash),history.pushState(null,``,e?`/app?project=${e.id}${m.current.get(e.id)??``}`:`/app`),i(e?.id??null),o(null)},[r,v]),b=(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 Fo(i);if(!i.ok||!a||typeof a!=`object`||!(`kind`in a)||a.kind!==`project`||!(`project`in a))throw Error(Io(a));let o=on(a.project);n(e=>e&&{...e,projects:[...e.projects.filter(e=>e.id!==o.id),o]}),y(o)},[t,y]),x=(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 Fo(n);if(!n.ok){let e=Io(r);return{kind:`error`,error:A(O.find(t=>t===e)??`unavailable`)}}return{kind:`ok`,value:pn(r)}}catch{return{kind:`error`,error:A(`unavailable`)}}}}),[]),S=(0,f.useMemo)(()=>r?Er(r):void 0,[r]),w=t?.projects.find(e=>e.id===r);return(0,f.useEffect)(()=>{w&&jo(w.id)},[w]),t===null?(0,h.jsx)(Do,{}):t&&w&&S?(0,h.jsx)(Do,{api:S,onOpenProject:b,onWorkbenchHome:()=>y(null),workbenchHome:t.home,projectEntries:t.projects.map(e=>({path:e.cwd,current:e.id===r}))},`${w.id}:${w.epoch}`):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(Po,{ready:!!t,projects:t?.projects.map(e=>e.cwd)??[],restore:d,onOpenFolder:e=>{v(),o(e??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&&!w&&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)(Wa,{client:x,current:``,projects:t.projects.map(e=>({path:e.cwd,current:!1})),initial:a,home:t.home,epoch:t.epoch,onClose:()=>o(null),onOpen:b})]})}function Ro(){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 zo=class extends f.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,h.jsx)(Ro,{}):this.props.children}},Bo=document.getElementById(`root`);if(!Bo)throw Error(`Application root unavailable`);(0,p.createRoot)(Bo).render((0,h.jsx)(w,{children:(0,h.jsx)(zo,{children:(0,h.jsx)(Lo,{})})}));export{xo as t};
|