@orion-agents/orion-code 0.3.14 → 0.3.15

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/CHANGELOG.md CHANGED
@@ -22,6 +22,73 @@ which is **not** a pass.
22
22
 
23
23
  ## [Unreleased]
24
24
 
25
+ ## [0.3.15] — CANDIDATE
26
+
27
+ > **Status: candidate.** Web Workbench visual & interaction convergence
28
+ > (`docs/plan/v0.3.15-plan.md`): copy thinning, unified confirm modal, busy
29
+ > affordances and resource-panel visual tightening. No protocol, API or
30
+ > dependency changes. Not merged, tagged or published.
31
+
32
+ ### Added
33
+
34
+ - **Pixel brand identity:** the Workbench brand is now true pixel art. A
35
+ dot-matrix `orion-code` wordmark (`PixelWordmark`, 5×7 grid, run-merged hard
36
+ rects, integer `scale`) sits in the expanded rail header, and an SVG page
37
+ icon (`web/public/favicon.svg`) gives the browser tab a real favicon (there
38
+ was none). `OrionBrandMark` gained an optional `pixel` prop that renders
39
+ solid two-tone bars with a 1px base shadow; the default gradient glyph used
40
+ by the boot screen and the collapsed rail is unchanged.
41
+
42
+ ### Fixed
43
+
44
+ - Restored the keyboard-shortcut reference trigger (now a rail icon), which was
45
+ lost when the conversation header was removed.
46
+
47
+ - The eager archived-sessions loader no longer refetches in a loop after a
48
+ rejected request: `archived_sessions_failed` now claims the workspace
49
+ (`ownerWorkspaceId`), so the App effect's guard skips settled workspaces, and
50
+ the fire-and-forget call no longer surfaces the workspace-switch Context race
51
+ (`The active Context changed before the operation was admitted`) as hundreds
52
+ of unhandled promise rejections / 409 console errors.
53
+
54
+ ### Changed
55
+
56
+ - **Copy thinning (T1):** removed or compressed eight explanatory paragraphs in
57
+ Files / Git / Review / ProjectNavigator / Inspector; details moved to
58
+ `title` / `aria` attributes (search scope, binary metadata, sensitive-content
59
+ fence, Git read-model detail, hunk-to-composer hint, diagnostics redaction).
60
+ Empty states follow icon + one short line.
61
+ - **Transient notices (T1):** Files/Git/Review recovery and success notices now
62
+ fade out automatically after 4s; error notices persist until replaced
63
+ (`useAutoNotice`).
64
+ - **Unified confirm modal (T2/D3):** the two remaining `window.confirm` guards
65
+ — Files discard-unsaved-changes and Inspector clear-Goal — use a shared
66
+ `ConfirmDialog` (native `<dialog>`: Esc cancel, focus trap, cancel-focused
67
+ Enter, danger action styling).
68
+ - **Busy affordances (T2):** Files/Git/Review refresh buttons report
69
+ `aria-busy` with a rotating icon (box size unchanged, reduced-motion aware);
70
+ the Files save button holds a fixed minimum width so 保存/保存中… no longer
71
+ shifts the row, and reports `aria-busy` while saving.
72
+ - **Visual convergence (T3):** resource-panel icons unified on the 12/16/20
73
+ tiers (16px inside panels), search fields and change-list rows reuse the
74
+ existing radius tokens, and Git group/history headings step back to muted
75
+ 11px type. No new theme tokens.
76
+ - **Banner-free chrome:** the conversation header, the left-rail brand row and
77
+ the right-rail `PROJECT WORKSPACE` header are removed — conversation content
78
+ now starts at the top of the column. The theme-cycle and inspector-toggle
79
+ controls moved to the bottom of the right rail, and the left rail exposes a
80
+ collapse control in its toolbar. Project and session rows keep the plain
81
+ folder icon; the `orion-code` mark is used only in the rail header, the
82
+ collapsed rail and the favicon.
83
+
84
+ ### Tests
85
+
86
+ - New SSR contracts (`tests/web-ui-resource-copy-v0315.test.tsx`): thinned copy
87
+ never returns to first paint, busy buttons idle on first paint, confirm-modal
88
+ markup (focused cancel, danger action, closed shell), goal-clear wiring.
89
+ - E2E locators were unaffected: the only referenced copy (`二进制文件`,
90
+ `刷新文件树`, `选择文件预览`) is unchanged.
91
+
25
92
  ## [0.3.14] — CANDIDATE
26
93
 
27
94
  > **Status: candidate.** Editable Files panel (guarded `POST /files/write` with
package/README.md CHANGED
@@ -2,13 +2,11 @@
2
2
 
3
3
  Local-first, goal-driven coding agent for the terminal and browser.
4
4
 
5
- > v0.3.12 candidate — a Wide Right Workspace on top of the vertical rail: pure
6
- > dock/rail/drawer geometry (detail dockable to 80vw while the conversation
7
- > keeps a 320px minimum), per-workspace layout preferences, a shared repository
8
- > snapshot store, progressive Review verification, guarded Git stage/unstage/
9
- > commit, bounded workspace search and revision-bound file_range Context
10
- > references. Candidate source is not an npm publication, Git tag, or
11
- > merge-ready release.
5
+ > v0.3.15 candidate — Web Workbench visual & interaction convergence: thinned
6
+ > explanatory copy across the resource panels, one unified confirm modal
7
+ > replacing the last `window.confirm` guards, busy feedback for refresh/save
8
+ > actions, and Orion-style visual tightening of Files / Git / Review.
9
+ > Candidate source is not an npm publication, Git tag, or merge-ready release.
12
10
 
13
11
  [中文说明](README.zh-CN.md) ·
14
12
  [v0.3.7 plan](docs/plan/v0.3.7-left-rail-improvement-plan.md) ·
@@ -173,7 +171,7 @@ current development environments. Node 20 is upstream EOL and is no longer a v0.
173
171
  After the immutable `0.3.5` npm receipt exists:
174
172
 
175
173
  ```bash
176
- npm install -g @orion-agents/orion-code@0.3.12
174
+ npm install -g @orion-agents/orion-code@0.3.15
177
175
  orion --version
178
176
  orion doctor
179
177
  ```
package/README.zh-CN.md CHANGED
@@ -2,10 +2,9 @@
2
2
 
3
3
  面向终端与浏览器、本地优先的目标驱动 Coding Agent。
4
4
 
5
- > v0.3.12 候选版本:在竖状 rail 之上的**大尺寸右侧工作区**——纯 dock/rail/drawer 几何
6
- > (详情面可拉宽至 80vw,对话保留 320px 最小宽度)、按 workspace 的布局偏好、共享仓库快照
7
- > store、Review 验证证据渐进分页、受控 Git stage/unstage/commit、受限工作区搜索与带版本
8
- > 约束的 file_range Context 引用。Candidate 源码不代表已创建 npm 发布、Git tag 或达到可合并状态。
5
+ > v0.3.15 候选版本:Web Workbench 视觉与交互收敛——资源面板说明文案瘦身、统一确认模态
6
+ > 取代最后的 `window.confirm`、刷新/保存的进行中反馈,以及 Files / Git / Review 的
7
+ > Orion 风格视觉收敛。Candidate 源码不代表已创建 npm 发布、Git tag 或达到可合并状态。
9
8
 
10
9
  [English](README.md) ·
11
10
  [v0.3.7 方案](docs/plan/v0.3.7-left-rail-improvement-plan.md) ·
@@ -102,7 +101,7 @@ Current。Node 20 已结束上游维护,不再属于 v0.3 Runtime 合同。
102
101
  当 npm 已存在不可变的 `0.3.4` 发布凭据后:
103
102
 
104
103
  ```bash
105
- npm install -g @orion-agents/orion-code@0.3.12
104
+ npm install -g @orion-agents/orion-code@0.3.15
106
105
  orion --version
107
106
  orion doctor
108
107
  ```
@@ -1,4 +1,4 @@
1
- import{r as u,j as s,I as N}from"./index-DgVNIqmE.js";function v(t){const n=[];let i;for(const r of t)r.startsWith("@@")?(i&&n.push(i),i={title:r,lines:[r]}):i&&i.lines.push(r);return i&&n.push(i),n}function D(t,n){const i={schemaVersion:1,type:"review_context",repositoryRevision:t.repositoryRevision,path:t.path,hunk:n.title},r=n.lines.join(`
1
+ import{r as u,j as s,I as N}from"./index-C2M48tcK.js";function v(t){const n=[];let i;for(const r of t)r.startsWith("@@")?(i&&n.push(i),i={title:r,lines:[r]}):i&&i.lines.push(r);return i&&n.push(i),n}function D(t,n){const i={schemaVersion:1,type:"review_context",repositoryRevision:t.repositoryRevision,path:t.path,hunk:n.title},r=n.lines.join(`
2
2
  `).slice(0,12e3);return[`请审阅 ${t.path} 的这个 diff hunk,并指出正确性、安全性和测试风险:`,"","```review_context",JSON.stringify(i,null,2),"```","","```diff",r,"```"].join(`
3
3
  `)}function H({page:t,loading:n=!1,onLoadMore:i,onSendToComposer:r}){const a=u.useMemo(()=>v(t.lines),[t.lines]),[m,h]=u.useState(0),[f,p]=u.useState(!1),[x,k]=u.useState(!1),[b,y]=u.useState(""),d=Math.min(m,Math.max(0,a.length-1)),c=a[d];u.useEffect(()=>{h(0),p(!1),y("")},[t.fileId,t.repositoryRevision]);const j=(e,l)=>{let o=l;if(e.key==="ArrowRight"||e.key==="ArrowDown")o=(l+1)%a.length;else if(e.key==="ArrowLeft"||e.key==="ArrowUp")o=(l-1+a.length)%a.length;else if(e.key==="Home")o=0;else if(e.key==="End")o=a.length-1;else return;e.preventDefault(),h(o);const w=e.currentTarget.parentElement;window.requestAnimationFrame(()=>w?.querySelector(`[data-hunk-index="${o}"]`)?.focus())};return t.binary?s.jsxs("div",{className:"resource-empty compact",children:[s.jsx(N,{name:"code"}),s.jsx("strong",{children:"二进制差异"}),s.jsx("p",{children:"只展示变更事实,不返回 binary patch。"})]}):s.jsxs("div",{className:"diff-viewer",children:[s.jsxs("header",{children:[s.jsx("strong",{title:t.path,children:t.path}),s.jsx("span",{children:t.truncated?"受限预览":`${t.lines.length} 行`})]}),a.length>1?s.jsx("div",{className:"diff-hunk-nav",role:"tablist","aria-label":"Diff hunks",children:a.map((e,l)=>s.jsx("button",{type:"button",role:"tab","data-hunk-index":l,"aria-selected":d===l,tabIndex:d===l?0:-1,onClick:()=>h(l),onKeyDown:o=>j(o,l),children:e.title||`Hunk ${l+1}`},`${e.title}-${l}`))}):null,s.jsxs("div",{className:"diff-actions","aria-label":"Diff 显示选项",children:[c?s.jsx("button",{type:"button",className:"text-button","aria-expanded":!f,onClick:()=>p(e=>!e),children:f?"展开 Hunk":"折叠 Hunk"}):null,s.jsx("button",{type:"button",className:"text-button","aria-pressed":x,onClick:()=>k(e=>!e),children:"显示空白字符"}),c?s.jsx("button",{type:"button",className:"text-button",onClick:()=>{$(c.lines.join(`
4
4
  `),y)},children:"复制 Hunk"}):null]}),f?null:s.jsx("pre",{className:"diff-lines",tabIndex:0,"aria-label":`Diff ${t.path}`,children:(c?.lines??t.lines).map((e,l)=>s.jsxs("span",{className:e.startsWith("+")?"addition":e.startsWith("-")?"deletion":"",children:[S(e,x)||" ",`
@@ -0,0 +1 @@
1
+ import{r as o,j as e,I as R,s as ve,C as pe,W as be}from"./index-C2M48tcK.js";import{u as ye,R as ge}from"./useAutoNotice-BeSf9Dfq.js";function Fe({workspaceId:s,refreshEpoch:a,actions:l,navigatorWidthPx:r,onNavigatorWidthCommit:d}){const[u,h]=o.useState({}),[j,m]=o.useState(new Set(["workspace-root"])),[n,x]=o.useState(null),[b,z]=o.useState(""),[B,M]=o.useState(null),[X,G]=o.useState(!1),[Y,K]=o.useState(""),{notice:H,showNotice:D,clearNotice:J}=ye(),[T,le]=o.useState(""),[V,P]=o.useState({}),[Z,_]=o.useState(""),[A,F]=o.useState("view"),[$,w]=o.useState(""),[k,q]=o.useState(!1),[ce,S]=o.useState(!1),[ue,de]=o.useState(""),[fe,O]=o.useState(!1),f=o.useRef(0),N=o.useRef(0),I=o.useRef(null),E=async(t,i=!1,g=f.current)=>{if(g!==f.current)return;const v=u[t],C=i?v?.nextCursor:void 0;if(!(i&&!C)){h(c=>({...c,[t]:{items:v?.items??[],nextCursor:v?.nextCursor??null,revision:v?.revision??"",loading:!0}}));try{const c=await l.listFiles(t,C??void 0);if(g!==f.current)return;h(p=>({...p,[t]:{items:i?Ne(p[t]?.items??[],c.items):c.items,nextCursor:c.nextCursor,revision:c.revision,loading:!1}}))}catch(c){if(g!==f.current)return;if(i&&Q(c)){D("目录已变化,已重新载入第一页。"),E(t,!1,g);return}h(p=>({...p,[t]:{items:p[t]?.items??[],nextCursor:p[t]?.nextCursor??null,revision:p[t]?.revision??"",loading:!1,error:L(c)}}))}}},W=async(t=f.current)=>{try{const i=await l.gitStatus();if(t!==f.current)return;P(we(i)),_(i.nextCursor?"Git 装饰仅显示首批 200 个变更;在 Git 面板继续分页查看。":"")}catch(i){if(t!==f.current)return;P({}),_(`Git 状态装饰不可用:${L(i)}`)}},ee=o.useRef(s);o.useEffect(()=>{const t=f.current+1;f.current=t,N.current+=1;const i=ee.current===s?I.current:null;ee.current=s,h({}),m(new Set(["workspace-root"])),x(i),z(""),M(null),G(!1),K(""),J(),P({}),_(""),s&&(E("workspace-root",!1,t),W(t),i&&y(i,!1,!1,t))},[a,s]);const y=async(t,i=!1,g=!1,v=f.current,C=N.current+1)=>{if(v===f.current&&!(!t.readable||t.sensitive||U(t))){N.current=C,x(t),K(""),i||(z(""),M(null),G(!1),F("view"),w(""),S(!1)),g||J();try{const c=await l.readFileContent(t.id,i?B??void 0:void 0);if(v!==f.current||C!==N.current)return;G(c.binary),z(p=>i?`${p}${c.content??""}`:c.content??""),M(c.nextCursor),de(c.revision),g&&D("文件已变化,已从第一页重新载入。")}catch(c){if(v!==f.current||C!==N.current)return;if(i&&Q(c)){await y(t,!1,!0,v,C);return}K(L(c))}}},te=Se({selected:n,binary:X,hasMorePages:B!==null}),me=()=>{w(b),S(!1),F("edit")},se=()=>{if($!==b){O(!0);return}re()},re=()=>{F("view"),w(""),S(!1),O(!1)},xe=async()=>{if(!(!n||k)){q(!0),S(!1);try{await l.writeFileContent(n.id,$,ue),F("view"),w(""),await y(n,!1,!0,f.current,N.current+1),D("已保存文件。","success"),W()}catch(t){Q(t)?S(!0):D(L(t),"error")}finally{q(!1)}}},ne=t=>{const i=new Set(j);i.has(t)?i.delete(t):(i.add(t),u[t]||E(t)),m(i)};o.useEffect(()=>{I.current=n},[n]);const he=o.useMemo(()=>Object.values(u).flatMap(t=>t.items),[u]),ie=T.trim()?he.filter(t=>t.name.toLocaleLowerCase().includes(T.toLocaleLowerCase())):null,je=!!u["workspace-root"]?.loading;return e.jsxs("div",{className:"work-resource-panel files-panel",children:[e.jsxs("div",{className:"resource-toolbar",children:[e.jsxs("label",{className:"resource-search",children:[e.jsx("span",{className:"sr-only",children:"搜索已加载文件"}),e.jsx(R,{name:"search",size:16}),e.jsx("input",{type:"search",value:T,onChange:t=>le(t.target.value),placeholder:"搜索已加载文件",title:"搜索仅覆盖已加载的目录和文件"})]}),e.jsx("button",{type:"button",className:"icon-button","aria-label":"刷新文件树","aria-busy":je,onClick:()=>{E("workspace-root"),W()},children:e.jsx(R,{name:"refresh",size:16})})]}),e.jsxs(ge,{panelId:"files",navigatorWidthPx:r,onNavigatorWidthCommit:d,contentLabel:"文件预览",navigatorLabel:"工作区文件",handleLabel:"调整文件目录宽度",contentClassName:"file-preview",navigatorClassName:"file-tree",children:[e.jsxs(e.Fragment,{children:[Z?e.jsx("p",{className:"resource-hint",role:"status",children:Z}):null,ie?e.jsx(e.Fragment,{children:e.jsx("ul",{role:"list",className:"file-node-list search-results",children:ie.map(t=>e.jsx(ae,{node:t,depth:0,expanded:!1,selected:n?.id===t.id,gitLabels:V[t.displayPath]??[],onToggle:ne,onSelect:i=>{y(i)}},t.id))})}):e.jsx(oe,{parentId:"workspace-root",depth:0,directories:u,expanded:j,selectedId:n?.id,gitDecorations:V,onToggle:ne,onSelect:t=>{y(t)},onLoadMore:t=>{E(t,!0)}})]}),e.jsxs(e.Fragment,{children:[H?e.jsx("p",{className:"resource-notice",role:"status",children:H.text}):null,n?e.jsxs(e.Fragment,{children:[e.jsxs("header",{children:[e.jsx("strong",{children:n.name}),e.jsx("span",{children:Ee(n.sizeBytes??0)})]}),Y?e.jsx("p",{className:"resource-error",role:"alert",children:Y}):X?e.jsxs("div",{className:"resource-empty",children:[e.jsx(R,{name:"code",size:16}),e.jsx("strong",{title:"出于安全和性能考虑,只显示元数据。",children:"二进制文件"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"file-preview-actions",children:A==="view"?e.jsx("button",{type:"button",className:"text-button",disabled:!te,title:te?void 0:"仅支持编辑 512 KB 内的 UTF-8 文本文件",onClick:me,children:"编辑"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"primary-button",disabled:k||$===b,"aria-busy":k,onClick:()=>{xe()},children:k?"保存中…":"保存"}),e.jsx("button",{type:"button",className:"text-button",disabled:k,onClick:se,children:"取消"})]})}),ce?e.jsxs("p",{className:"resource-error",role:"alert",children:["文件已在别处变更,保存被拒绝。",e.jsx("button",{type:"button",className:"text-button",onClick:()=>{y(n,!1,!0)},children:"重新加载"})]}):null,A==="edit"?e.jsx("textarea",{className:"file-editor",value:$,spellCheck:!1,"aria-label":`编辑文件 ${n.name}`,onChange:t=>w(t.target.value),onKeyDown:t=>{t.key==="Escape"&&(t.preventDefault(),se())}}):e.jsx("pre",{tabIndex:0,className:"file-code-view","aria-label":`文件内容 ${n.name}`,children:ve(b)})]}),B&&A==="view"?e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{y(n,!0)},children:"加载更多内容"}):null]}):e.jsxs("div",{className:"resource-empty",children:[e.jsx(R,{name:"workspace",size:16}),e.jsx("strong",{children:"选择文件预览"}),e.jsx("p",{title:"敏感文件、工作区外链接和二进制正文不会返回浏览器。",children:"受限内容不会返回浏览器。"})]})]})]}),e.jsx(pe,{open:fe,onClose:()=>O(!1),title:"放弃未保存的修改?",body:"当前草稿尚未保存,放弃后将回到文件的最新内容。",confirmLabel:"放弃修改",danger:!0,onConfirm:re})]})}function oe({parentId:s,depth:a,directories:l,expanded:r,selectedId:d,gitDecorations:u,onToggle:h,onSelect:j,onLoadMore:m}){const n=l[s];return n?n.error?e.jsx("p",{className:"resource-error",role:"alert",children:n.error}):e.jsxs("ul",{role:"list",className:"file-node-list",children:[n.items.map(x=>{const b=r.has(x.id);return e.jsxs("li",{children:[e.jsx(ae,{node:x,depth:a,expanded:b,selected:d===x.id,gitLabels:u[x.displayPath]??[],onToggle:h,onSelect:j}),U(x)&&b?e.jsx(oe,{parentId:x.id,depth:a+1,directories:l,expanded:r,selectedId:d,gitDecorations:u,onToggle:h,onSelect:j,onLoadMore:m}):null]},x.id)}),n.loading?e.jsx("li",{className:"resource-loading",children:"正在读取…"}):null,n.nextCursor?e.jsx("li",{children:e.jsx("button",{type:"button",className:"text-button",onClick:()=>m(s),children:"加载更多"})}):null]}):e.jsx("p",{className:"resource-loading",children:"正在读取…"})}function ae({node:s,depth:a,expanded:l,selected:r,gitLabels:d,onToggle:u,onSelect:h}){const j=s.sensitive||!s.readable,m=U(s);return e.jsxs("button",{type:"button",className:`file-node ${r?"selected":""} ${j?"blocked":""}`,style:{paddingInlineStart:`${8+a*15}px`},"aria-expanded":m?l:void 0,"aria-label":`${Ce(s)} ${s.name}${j?",不可读取":""}${d.length?`,Git ${d.join("、")}`:""}`,onClick:()=>m?u(s.id):h(s),disabled:j,children:[e.jsx(R,{name:m?"workspace":"code",size:16}),e.jsx("span",{children:s.name}),s.kind==="symlink"?e.jsx("small",{children:"链接"}):null,s.sensitive?e.jsx("small",{children:"敏感"}):null,d.length?e.jsx("small",{className:"file-git-status",title:`Git ${d.join("、")}`,children:d.join(" · ")}):null]})}function Ce(s){return s.kind==="directory"?"目录":s.kind==="symlink"?s.targetKind==="directory"?"符号链接目录":"符号链接":"文件"}function U(s){return s.kind==="directory"||s.kind==="symlink"&&s.targetKind==="directory"}function Ne(s,a){const l=new Map(s.map(r=>[r.id,r]));for(const r of a)l.set(r.id,r);return[...l.values()]}function we(s){if(!s.isRepository)return{};const a=new Map,l=(r,d)=>{const u=r.replace(/\\/gu,"/").replace(/^\.\//u,"");if(!u)return;const h=a.get(u)??new Set;h.add(d),a.set(u,h);const j=u.split("/");for(let m=1;m<j.length;m+=1){const n=j.slice(0,m).join("/"),x=a.get(n)??new Set;x.add("含变更"),a.set(n,x)}};return s.conflicted.forEach(r=>l(r.path,"冲突")),s.staged.forEach(r=>l(r.path,"已暂存")),s.unstaged.forEach(r=>l(r.path,"未暂存")),s.untracked.forEach(r=>l(r.path,"未跟踪")),Object.fromEntries([...a].map(([r,d])=>[r,Object.freeze([...d])]))}const ke=512*1024;function Se(s){const{selected:a,binary:l,hasMorePages:r}=s;return!a||l||a.sensitive||!a.readable||r?!1:(a.sizeBytes??0)<=ke}function Ee(s){return s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1048576).toFixed(1)} MB`}function Q(s){return s instanceof be&&s.code==="file_revision_conflict"}function L(s){return s instanceof Error?s.message:"文件请求失败。"}export{ke as FILE_EDIT_MAX_BYTES,Fe as FilesPanel,Se as canEditFileContent};
@@ -0,0 +1 @@
1
+ import{r as f,j as e,I as g,W as F}from"./index-C2M48tcK.js";import{u as B,R as J}from"./useAutoNotice-BeSf9Dfq.js";import{D as K}from"./DiffViewer-C0A42Lma.js";function Y({workspaceId:c,refreshEpoch:m,actions:u,onSendToComposer:o,navigatorWidthPx:_,onNavigatorWidthCommit:P}){const[a,S]=f.useState(null),[p,I]=f.useState(null),[k,y]=f.useState(null),[v,N]=f.useState(null),[j,h]=f.useState(!1),[R,d]=f.useState(""),{notice:E,showNotice:L,clearNotice:$}=B(),n=f.useRef(0),x=f.useRef(0),b=async(t=n.current)=>{if(t===n.current){h(!0),d("");try{const[s,l]=await Promise.all([u.gitStatus(),u.gitLog()]);if(t!==n.current)return;S(s),I(l),y(null),N(null)}catch(s){if(t!==n.current)return;d(w(s))}finally{t===n.current&&h(!1)}}},z=()=>{const t=n.current+1;n.current=t,x.current+=1,$(),b(t)};f.useEffect(()=>{const t=n.current+1;n.current=t,x.current+=1,S(null),I(null),y(null),N(null),d(""),$(),c&&b(t)},[m,c]);const A=async(t,s,l=n.current,r=x.current+1)=>{if(l===n.current){x.current=r,s||(y(t),N(null)),h(!0),d("");try{const i=await u.gitDiff(t.fileId,s);if(l!==n.current||r!==x.current||i.fileId!==t.fileId)return;y(t),N(G=>s&&G&&G.fileId===i.fileId?{...i,lines:[...G.lines,...i.lines]}:i)}catch(i){if(l!==n.current||r!==x.current)return;if(D(i)){L("仓库已变化,已重新载入 Git 状态。"),await b(l);return}d(w(i))}finally{l===n.current&&r===x.current&&h(!1)}}},W=async()=>{const t=a?.nextCursor;if(!t||!a)return;const s=n.current,l=a.repositoryRevision;h(!0),d("");try{const r=await u.gitStatus(t);if(s!==n.current)return;if(r.repositoryRevision!==l)throw M();S(i=>!i||i.repositoryRevision!==l?i:{...r,conflicted:C(i.conflicted,r.conflicted),staged:C(i.staged,r.staged),unstaged:C(i.unstaged,r.unstaged),untracked:C(i.untracked,r.untracked)})}catch(r){if(s!==n.current)return;if(D(r)){L("仓库已变化,已重新载入 Git 状态。"),await b(s);return}d(w(r))}finally{s===n.current&&h(!1)}},H=async()=>{const t=p?.nextCursor;if(!t||!p)return;const s=n.current,l=p.repositoryRevision;h(!0),d("");try{const r=await u.gitLog(t);if(s!==n.current)return;if(r.repositoryRevision!==l)throw M();I(i=>!i||i.repositoryRevision!==l?i:{...r,items:Q(i.items,r.items)})}catch(r){if(s!==n.current)return;if(D(r)){L("提交历史已变化,已重新载入第一页。"),await b(s);return}d(w(r))}finally{s===n.current&&h(!1)}};if(R&&!a)return e.jsx(O,{message:R,onRetry:z});if(!a)return e.jsx("p",{className:"resource-loading",children:"正在读取 Git 状态…"});if(!a.isRepository)return e.jsxs("div",{className:"resource-empty",children:[e.jsx(g,{name:"branch",size:16}),e.jsx("strong",{children:"当前项目不是 Git 仓库"}),e.jsx("p",{children:"文件和 Agent 不受影响。"})]});const V=[{label:"冲突",tone:"conflict",items:a.conflicted},{label:"已暂存",tone:"staged",items:a.staged},{label:"未暂存",tone:"unstaged",items:a.unstaged},{label:"未跟踪",tone:"untracked",items:a.untracked}];return e.jsxs("div",{className:"work-resource-panel git-panel",children:[e.jsxs("div",{className:"git-summary",children:[e.jsxs("div",{children:[e.jsx(g,{name:"branch",size:16}),e.jsx("strong",{children:a.detached?`detached ${a.head??""}`:a.branch||"HEAD"})]}),e.jsxs("span",{children:[a.upstream||"无 upstream",a.ahead||a.behind?` · ↑${a.ahead} ↓${a.behind}`:""]}),e.jsx("button",{type:"button",className:"icon-button","aria-label":"刷新 Git 状态","aria-busy":j,onClick:z,disabled:j,children:e.jsx(g,{name:"refresh",size:16})})]}),E?e.jsx("p",{className:"resource-notice",role:"status",children:E.text}):null,R?e.jsx("p",{className:"resource-error",role:"alert",children:R}):null,e.jsxs(J,{panelId:"git",navigatorWidthPx:_,onNavigatorWidthCommit:P,contentLabel:"Git Diff",navigatorLabel:"Git 变更",handleLabel:"调整 Git 变更列表宽度",contentClassName:"git-diff",navigatorClassName:"git-changes",children:[e.jsxs(e.Fragment,{children:[a.clean?e.jsxs("div",{className:"resource-empty compact",children:[e.jsx(g,{name:"check"}),e.jsx("strong",{children:"工作区干净"})]}):V.map(t=>t.items.length?e.jsxs("div",{className:"git-group",children:[e.jsxs("h3",{children:[t.label," ",e.jsx("span",{children:t.items.length})]}),t.items.map(s=>e.jsxs("button",{type:"button",className:k?.fileId===s.fileId?"selected":"",onClick:()=>{A(s)},children:[e.jsx("span",{className:`git-status-code ${t.tone}`,children:s.indexStatus.trim()||s.worktreeStatus.trim()||"?"}),e.jsx("span",{title:s.path,children:s.path})]},`${t.label}:${s.fileId}`))]},t.label):null),a.nextCursor?e.jsx("button",{type:"button",className:"text-button resource-load-more",onClick:()=>{W()},disabled:j,children:"加载更多变更"}):null,e.jsxs("div",{className:"git-history",children:[e.jsx("h3",{children:"提交历史"}),p?.items.map(t=>e.jsxs("article",{children:[e.jsx("code",{children:t.shortId}),e.jsx("strong",{children:t.subject}),e.jsxs("span",{children:[t.authorName," · ",new Date(t.authoredAt).toLocaleDateString("zh-CN")]})]},t.id)),p?.nextCursor?e.jsx("button",{type:"button",className:"text-button resource-load-more",onClick:()=>{H()},disabled:j,children:"加载更多提交"}):null]})]}),e.jsx(e.Fragment,{children:v?e.jsx(K,{page:v,loading:j,onLoadMore:v.nextCursor&&k?()=>{A(k,v.nextCursor??void 0)}:void 0,onSendToComposer:o}):e.jsxs("div",{className:"resource-empty",children:[e.jsx(g,{name:"code",size:16}),e.jsx("strong",{children:"选择变更查看 Diff"})]})})]})]})}function O({message:c,onRetry:m}){return e.jsxs("div",{className:"resource-empty",role:"alert",children:[e.jsx(g,{name:"warning"}),e.jsx("strong",{children:"Git 状态读取失败"}),e.jsx("p",{children:c}),e.jsx("button",{type:"button",className:"secondary-button",onClick:m,children:"重试"})]})}function w(c){return c instanceof Error?c.message:"Git 请求失败。"}function D(c){return c instanceof F&&c.code==="git_revision_conflict"}function M(){return new F("仓库版本已变化。",409,"git_revision_conflict")}function C(c,m){const u=new Map(c.map(o=>[o.fileId,o]));for(const o of m)u.set(o.fileId,o);return[...u.values()]}function Q(c,m){const u=new Map(c.map(o=>[o.id,o]));for(const o of m)u.set(o.id,o);return[...u.values()]}export{Y as GitPanel};
@@ -0,0 +1 @@
1
+ import{r as a,j as e,I as d,W as A}from"./index-C2M48tcK.js";import{u as H,R as W}from"./useAutoNotice-BeSf9Dfq.js";import{D as _}from"./DiffViewer-C0A42Lma.js";function B({workspaceId:t,refreshEpoch:g,actions:C,onSendToComposer:D,navigatorWidthPx:E,onNavigatorWidthCommit:F}){const[s,I]=a.useState(null),[h,x]=a.useState(null),[m,j]=a.useState(null),[N,v]=a.useState(!1),[p,f]=a.useState(""),{notice:R,showNotice:L,clearNotice:S}=H(),r=a.useRef(0),o=a.useRef(0),b=async(n=r.current,u)=>{if(n===r.current){v(!0),f("");try{const c=await C.review();if(n!==r.current)return;I(c);const l=u?c.changedFiles.find(i=>i.fileId===u)??null:null;x(l),j(null),l&&w(l,void 0,n)}catch(c){if(n!==r.current)return;f(z(c))}finally{n===r.current&&v(!1)}}},$=()=>{const n=r.current+1;r.current=n,o.current+=1,S(),b(n,h?.fileId)};a.useEffect(()=>{const n=r.current+1;r.current=n,o.current+=1,I(null),x(null),j(null),f(""),S(),t&&b(n)},[g,t]);const w=async(n,u,c=r.current,l=o.current+1)=>{if(c===r.current){o.current=l,u||(x(n),j(null)),v(!0),f("");try{const i=await C.gitDiff(n.fileId,u);if(c!==r.current||l!==o.current||i.fileId!==n.fileId)return;x(n),j(y=>u&&y&&y.fileId===i.fileId?{...i,lines:[...y.lines,...i.lines]}:i)}catch(i){if(c!==r.current||l!==o.current)return;if(M(i)){L("仓库已变化,已重新建立审阅快照。"),await b(c,n.fileId);return}f(z(i))}finally{c===r.current&&l===o.current&&v(!1)}}};return!s&&!p?e.jsx("p",{className:"resource-loading",children:"正在建立审阅快照…"}):s?e.jsxs("div",{className:"work-resource-panel review-panel",children:[e.jsxs("div",{className:"review-summary",children:[e.jsxs("div",{children:[e.jsx("span",{className:`review-score ${s.clean?"clean":"changed"}`,children:s.clean?e.jsx(d,{name:"check",size:16}):e.jsx(d,{name:"edit",size:16})}),e.jsxs("div",{children:[e.jsx("strong",{children:k(s).headline}),e.jsx("span",{children:k(s).counters})]})]}),e.jsx("button",{type:"button",className:"icon-button","aria-label":"刷新审阅快照","aria-busy":N,disabled:N,onClick:$,children:e.jsx(d,{name:"refresh",size:16})})]}),s.truncated?e.jsxs("p",{className:"resource-notice",role:"status",children:["当前显示 ",s.changedFiles.length," / ",s.totalChangedFiles," ","个变更文件;分类计数仅覆盖当前显示范围。"]}):null,R?e.jsx("p",{className:"resource-notice",role:"status",children:R.text}):null,p?e.jsx("p",{className:"resource-error",role:"alert",children:p}):null,e.jsxs(W,{panelId:"review",navigatorWidthPx:E,onNavigatorWidthCommit:F,contentLabel:"审阅 Diff",navigatorLabel:"待审阅文件",handleLabel:"调整待审阅文件列表宽度",contentClassName:"review-diff",navigatorClassName:"review-files",children:[e.jsx(e.Fragment,{children:s.changedFiles.map(n=>e.jsxs("button",{type:"button",className:h?.fileId===n.fileId?"selected":"",onClick:()=>{w(n)},children:[e.jsx(d,{name:"code",size:14}),e.jsx("span",{title:n.path,children:n.path}),e.jsx("small",{children:`${n.indexStatus}${n.worktreeStatus}`.trim()||"?"})]},n.fileId))}),e.jsx(e.Fragment,{children:m?e.jsx(_,{page:m,loading:N,onLoadMore:m.nextCursor&&h?()=>{w(h,m.nextCursor??void 0)}:void 0,onSendToComposer:D}):e.jsxs("div",{className:"resource-empty",children:[e.jsx(d,{name:"edit",size:16}),e.jsx("strong",{children:"选择文件开始审阅"}),e.jsx("p",{title:"你可以把某个 Hunk 作为草稿送回对话,提交前仍由你确认。",children:"选中 Hunk 可送回对话。"})]})})]})]}):e.jsxs("div",{className:"resource-empty",role:"alert",children:[e.jsx(d,{name:"warning"}),e.jsx("strong",{children:"无法读取审阅快照"}),e.jsx("p",{children:p}),e.jsx("button",{type:"button",className:"secondary-button",onClick:$,children:"重试"})]})}function k(t){const g=[`${t.stagedCount} 已暂存`,`${t.unstagedCount} 未暂存`,`${t.untrackedCount} 未跟踪`,`${t.conflictCount} 冲突`].join(" · ");return Object.freeze({headline:t.clean?"没有待审阅变更":`${t.totalChangedFiles} 个变更文件`,counters:`${t.truncated?"当前显示 · ":""}${g}`})}function z(t){return t instanceof Error?t.message:"审阅请求失败。"}function M(t){return t instanceof A&&t.code==="git_revision_conflict"}export{B as ReviewPanel,k as reviewSummary};
@@ -1,4 +1,4 @@
1
- var An=Object.defineProperty;var On=(e,t,i)=>t in e?An(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var _e=(e,t,i)=>On(e,typeof t!="symbol"?t+"":t,i);import{r as I,j as w,I as xt}from"./index-DgVNIqmE.js";var Nn=2,In=1,Hn=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},a=o.top+o.bottom,h=o.right+o.left,l=s-a,c=r-h-t;return{cols:Math.max(Nn,Math.floor(c/e.css.cell.width)),rows:Math.max(In,Math.floor(l/e.css.cell.height))}}};var Or=Object.defineProperty,Fn=Object.getOwnPropertyDescriptor,Wn=(e,t)=>{for(var i in t)Or(e,i,{get:t[i],enumerable:!0})},Q=(e,t,i,s)=>{for(var r=s>1?void 0:s?Fn(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&Or(t,i,r),r},x=(e,t)=>(i,s)=>t(i,s,e),Ts="Terminal input",Li={get:()=>Ts,set:e=>Ts=e},Ps="Too much output to announce, navigate to rows manually to read",Ti={get:()=>Ps,set:e=>Ps=e};function zn(e){return e.replace(/\r?\n/g,"\r")}function $n(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Kn(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function Un(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");Nr(r,t,i,s)}}function Nr(e,t,i,s){e=zn(e),e=$n(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function Ir(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function As(e,t,i,s,r){Ir(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function st(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function _i(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let n=e[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var qn=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=e.charCodeAt(r++);56320<=n&&n<=57343?t[s++]=(this._interim-55296)*1024+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let n=r;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,s;let a=e.charCodeAt(n);56320<=a&&a<=57343?t[s++]=(o-55296)*1024+a-56320+65536:(t[s++]=o,t[s++]=a);continue}o!==65279&&(t[s++]=o)}return s}},Vn=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r,n,o,a,h=0,l=0;if(this.interim[0]){let _=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let u=0,g;for(;(g=this.interim[++u]&63)&&u<4;)f<<=6,f|=g;let b=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,D=b-u;for(;l<D;){if(l>=i)return 0;if(g=e[l++],(g&192)!==128){l--,_=!0;break}else this.interim[u++]=g,f<<=6,f|=g&63}_||(b===2?f<128?l--:t[s++]=f:b===3?f<2048||f>=55296&&f<=57343||f===65279||(t[s++]=f):f<65536||f>1114111||(t[s++]=f)),this.interim.fill(0)}let c=i-4,d=l;for(;d<i;){for(;d<c&&!((r=e[d])&128)&&!((n=e[d+1])&128)&&!((o=e[d+2])&128)&&!((a=e[d+3])&128);)t[s++]=r,t[s++]=n,t[s++]=o,t[s++]=a,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((r&224)===192){if(d>=i)return this.interim[0]=r,s;if(n=e[d++],(n&192)!==128){d--;continue}if(h=(r&31)<<6|n&63,h<128){d--;continue}t[s++]=h}else if((r&240)===224){if(d>=i)return this.interim[0]=r,s;if(n=e[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(h=(r&15)<<12|(n&63)<<6|o&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[s++]=h}else if((r&248)===240){if(d>=i)return this.interim[0]=r,s;if(n=e[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,s;if(a=e[d++],(a&192)!==128){d--;continue}if(h=(r&7)<<18|(n&63)<<12|(o&63)<<6|a&63,h<65536||h>1114111)continue;t[s++]=h}}return s}},Hr="",rt=" ",Kt=class Fr{constructor(){this.fg=0,this.bg=0,this.extended=new ai}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new Fr;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ai=class Wr{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Wr(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Oe=class zr extends Kt{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ai,this.combinedData=""}static fromCharData(t){let i=new zr;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?st(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Os="di$target",Pi="di$dependencies",mi=new Map;function jn(e){return e[Pi]||[]}function ue(e){if(mi.has(e))return mi.get(e);let t=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Yn(t,i,r)};return t._id=e,mi.set(e,t),t}function Yn(e,t,i){t[Os]===t?t[Pi].push({id:e,index:i}):(t[Pi]=[{id:e,index:i}],t[Os]=t)}var we=ue("BufferService"),$r=ue("CoreMouseService"),gt=ue("CoreService"),Xn=ue("CharsetService"),vs=ue("InstantiationService"),Kr=ue("LogService"),ye=ue("OptionsService"),Ur=ue("OscLinkService"),Gn=ue("UnicodeService"),Ut=ue("DecorationService"),Ai=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new Oe,o=i.getTrimmedLength(),a=-1,h=-1,l=!1;for(let c=0;c<o;c++)if(!(h===-1&&!i.hasContent(c))){if(i.loadCell(c,n),n.hasExtendedAttrs()&&n.extended.urlId)if(h===-1){h=c,a=n.extended.urlId;continue}else l=n.extended.urlId!==a;else h!==-1&&(l=!0);if(l||h!==-1&&c===o-1){let d=this._oscLinkService.getLinkData(a)?.uri;if(d){let _={start:{x:h+1,y:e},end:{x:c+(!l&&c===o-1?1:0),y:e}},f=!1;if(!r?.allowNonHttpProtocols)try{let u=new URL(d);["http:","https:"].includes(u.protocol)||(f=!0)}catch{f=!0}f||s.push({text:d,range:_,activate:(u,g)=>r?r.activate(u,g,_):Jn(u,g),hover:(u,g)=>r?.hover?.(u,g,_),leave:(u,g)=>r?.leave?.(u,g,_)})}l=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=c,a=n.extended.urlId):(h=-1,a=-1)}}t(s)}};Ai=Q([x(0,we),x(1,ye),x(2,Ur)],Ai);function Jn(e,t){if(confirm(`Do you want to navigate to ${t}?
1
+ var An=Object.defineProperty;var On=(e,t,i)=>t in e?An(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var _e=(e,t,i)=>On(e,typeof t!="symbol"?t+"":t,i);import{r as I,j as w,I as xt}from"./index-C2M48tcK.js";var Nn=2,In=1,Hn=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},a=o.top+o.bottom,h=o.right+o.left,l=s-a,c=r-h-t;return{cols:Math.max(Nn,Math.floor(c/e.css.cell.width)),rows:Math.max(In,Math.floor(l/e.css.cell.height))}}};var Or=Object.defineProperty,Fn=Object.getOwnPropertyDescriptor,Wn=(e,t)=>{for(var i in t)Or(e,i,{get:t[i],enumerable:!0})},Q=(e,t,i,s)=>{for(var r=s>1?void 0:s?Fn(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&Or(t,i,r),r},x=(e,t)=>(i,s)=>t(i,s,e),Ts="Terminal input",Li={get:()=>Ts,set:e=>Ts=e},Ps="Too much output to announce, navigate to rows manually to read",Ti={get:()=>Ps,set:e=>Ps=e};function zn(e){return e.replace(/\r?\n/g,"\r")}function $n(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Kn(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function Un(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");Nr(r,t,i,s)}}function Nr(e,t,i,s){e=zn(e),e=$n(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function Ir(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function As(e,t,i,s,r){Ir(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function st(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function _i(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let n=e[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var qn=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=e.charCodeAt(r++);56320<=n&&n<=57343?t[s++]=(this._interim-55296)*1024+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let n=r;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,s;let a=e.charCodeAt(n);56320<=a&&a<=57343?t[s++]=(o-55296)*1024+a-56320+65536:(t[s++]=o,t[s++]=a);continue}o!==65279&&(t[s++]=o)}return s}},Vn=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r,n,o,a,h=0,l=0;if(this.interim[0]){let _=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let u=0,g;for(;(g=this.interim[++u]&63)&&u<4;)f<<=6,f|=g;let b=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,D=b-u;for(;l<D;){if(l>=i)return 0;if(g=e[l++],(g&192)!==128){l--,_=!0;break}else this.interim[u++]=g,f<<=6,f|=g&63}_||(b===2?f<128?l--:t[s++]=f:b===3?f<2048||f>=55296&&f<=57343||f===65279||(t[s++]=f):f<65536||f>1114111||(t[s++]=f)),this.interim.fill(0)}let c=i-4,d=l;for(;d<i;){for(;d<c&&!((r=e[d])&128)&&!((n=e[d+1])&128)&&!((o=e[d+2])&128)&&!((a=e[d+3])&128);)t[s++]=r,t[s++]=n,t[s++]=o,t[s++]=a,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((r&224)===192){if(d>=i)return this.interim[0]=r,s;if(n=e[d++],(n&192)!==128){d--;continue}if(h=(r&31)<<6|n&63,h<128){d--;continue}t[s++]=h}else if((r&240)===224){if(d>=i)return this.interim[0]=r,s;if(n=e[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(h=(r&15)<<12|(n&63)<<6|o&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[s++]=h}else if((r&248)===240){if(d>=i)return this.interim[0]=r,s;if(n=e[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,s;if(a=e[d++],(a&192)!==128){d--;continue}if(h=(r&7)<<18|(n&63)<<12|(o&63)<<6|a&63,h<65536||h>1114111)continue;t[s++]=h}}return s}},Hr="",rt=" ",Kt=class Fr{constructor(){this.fg=0,this.bg=0,this.extended=new ai}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new Fr;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ai=class Wr{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Wr(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Oe=class zr extends Kt{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ai,this.combinedData=""}static fromCharData(t){let i=new zr;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?st(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Os="di$target",Pi="di$dependencies",mi=new Map;function jn(e){return e[Pi]||[]}function ue(e){if(mi.has(e))return mi.get(e);let t=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Yn(t,i,r)};return t._id=e,mi.set(e,t),t}function Yn(e,t,i){t[Os]===t?t[Pi].push({id:e,index:i}):(t[Pi]=[{id:e,index:i}],t[Os]=t)}var we=ue("BufferService"),$r=ue("CoreMouseService"),gt=ue("CoreService"),Xn=ue("CharsetService"),vs=ue("InstantiationService"),Kr=ue("LogService"),ye=ue("OptionsService"),Ur=ue("OscLinkService"),Gn=ue("UnicodeService"),Ut=ue("DecorationService"),Ai=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new Oe,o=i.getTrimmedLength(),a=-1,h=-1,l=!1;for(let c=0;c<o;c++)if(!(h===-1&&!i.hasContent(c))){if(i.loadCell(c,n),n.hasExtendedAttrs()&&n.extended.urlId)if(h===-1){h=c,a=n.extended.urlId;continue}else l=n.extended.urlId!==a;else h!==-1&&(l=!0);if(l||h!==-1&&c===o-1){let d=this._oscLinkService.getLinkData(a)?.uri;if(d){let _={start:{x:h+1,y:e},end:{x:c+(!l&&c===o-1?1:0),y:e}},f=!1;if(!r?.allowNonHttpProtocols)try{let u=new URL(d);["http:","https:"].includes(u.protocol)||(f=!0)}catch{f=!0}f||s.push({text:d,range:_,activate:(u,g)=>r?r.activate(u,g,_):Jn(u,g),hover:(u,g)=>r?.hover?.(u,g,_),leave:(u,g)=>r?.leave?.(u,g,_)})}l=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=c,a=n.extended.urlId):(h=-1,a=-1)}}t(s)}};Ai=Q([x(0,we),x(1,ye),x(2,Ur)],Ai);function Jn(e,t){if(confirm(`Do you want to navigate to ${t}?
2
2
 
3
3
  WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var fi=ue("CharSizeService"),Ge=ue("CoreBrowserService"),Ss=ue("MouseService"),Je=ue("RenderService"),Zn=ue("SelectionService"),qr=ue("CharacterJoinerService"),yt=ue("ThemeService"),Vr=ue("LinkProviderService"),Qn=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ns.isErrorNoTelemetry(e)?new Ns(e.message+`
4
4