@orion-agents/orion-code 0.3.28 → 0.3.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{r as t,j as l,P as _,R as M,b as N,c as $,d as j}from"./index-kQqA3li6.js";function y({panelId:i,navigatorWidthPx:o,onNavigatorWidthCommit:e,contentLabel:d,navigatorLabel:h,handleLabel:s,contentClassName:r="",navigatorClassName:n="",children:p}){const[x,W]=t.Children.toArray(p),u=t.useRef(null),[E,T]=t.useState(0),[A,m]=t.useState(null);t.useEffect(()=>{const c=u.current;if(!c)return;const w=new ResizeObserver(S=>{const v=S[0]?.contentRect.width;v&&T(v)});return w.observe(c),()=>w.disconnect()},[]);const a=j(E),f=Math.min($(A??o),a),b=c=>{m(null),e(Math.min(c,a))},g=`${i}-split-content`,R=`${i}-split-navigator`;return l.jsxs("div",{ref:u,className:"resource-split-layout",style:{"--resource-navigator-width":`${f}px`},children:[l.jsx("section",{id:g,className:`resource-split-content${r?` ${r}`:""}`,"aria-label":d,children:W}),l.jsx(_,{side:"right",className:"resource-split-handle",minWidth:N,maxWidth:Math.max(N,a),defaultWidth:M,label:s,width:f,controls:R,boundsRef:u,resizingScope:"resource-split",onPreview:m,onCommit:b}),l.jsx("section",{id:R,className:`resource-split-navigator${n?` ${n}`:""}`,"aria-label":h,children:x})]})}const I=4e3;function D(){const[i,o]=t.useState(null),e=t.useRef(null);return t.useEffect(()=>()=>{e.current!==null&&window.clearTimeout(e.current)},[]),{notice:i,showNotice:(s,r="info")=>{e.current!==null&&(window.clearTimeout(e.current),e.current=null),o({text:s,tone:r}),r!=="error"&&(e.current=window.setTimeout(()=>{e.current=null,o(n=>n?.text===s?null:n)},I))},clearNotice:()=>{e.current!==null&&(window.clearTimeout(e.current),e.current=null),o(null)}}}export{y as R,D as u};
1
+ import{r as t,j as l,P as _,R as M,b as N,c as $,d as j}from"./index-CqCgJ2ov.js";function y({panelId:i,navigatorWidthPx:o,onNavigatorWidthCommit:e,contentLabel:d,navigatorLabel:h,handleLabel:s,contentClassName:r="",navigatorClassName:n="",children:p}){const[x,W]=t.Children.toArray(p),u=t.useRef(null),[E,T]=t.useState(0),[A,m]=t.useState(null);t.useEffect(()=>{const c=u.current;if(!c)return;const w=new ResizeObserver(S=>{const v=S[0]?.contentRect.width;v&&T(v)});return w.observe(c),()=>w.disconnect()},[]);const a=j(E),f=Math.min($(A??o),a),b=c=>{m(null),e(Math.min(c,a))},g=`${i}-split-content`,R=`${i}-split-navigator`;return l.jsxs("div",{ref:u,className:"resource-split-layout",style:{"--resource-navigator-width":`${f}px`},children:[l.jsx("section",{id:g,className:`resource-split-content${r?` ${r}`:""}`,"aria-label":d,children:W}),l.jsx(_,{side:"right",className:"resource-split-handle",minWidth:N,maxWidth:Math.max(N,a),defaultWidth:M,label:s,width:f,controls:R,boundsRef:u,resizingScope:"resource-split",onPreview:m,onCommit:b}),l.jsx("section",{id:R,className:`resource-split-navigator${n?` ${n}`:""}`,"aria-label":h,children:x})]})}const I=4e3;function D(){const[i,o]=t.useState(null),e=t.useRef(null);return t.useEffect(()=>()=>{e.current!==null&&window.clearTimeout(e.current)},[]),{notice:i,showNotice:(s,r="info")=>{e.current!==null&&(window.clearTimeout(e.current),e.current=null),o({text:s,tone:r}),r!=="error"&&(e.current=window.setTimeout(()=>{e.current=null,o(n=>n?.text===s?null:n)},I))},clearNotice:()=>{e.current!==null&&(window.clearTimeout(e.current),e.current=null),o(null)}}}export{y as R,D as u};
@@ -8,8 +8,8 @@
8
8
  <meta name="description" content="Orion Code local Web Workbench" />
9
9
  <link rel="icon" href="/favicon.svg" type="image/svg+xml" />
10
10
  <title>Orion Code</title>
11
- <script type="module" crossorigin src="/assets/index-kQqA3li6.js"></script>
12
- <link rel="stylesheet" crossorigin href="/assets/index-DCYKIeOj.css">
11
+ <script type="module" crossorigin src="/assets/index-CqCgJ2ov.js"></script>
12
+ <link rel="stylesheet" crossorigin href="/assets/index-BaOxrwGB.css">
13
13
  </head>
14
14
  <body>
15
15
  <div id="root"></div>
package/docs/readme.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  - [`architecture/`](architecture/repository-layout.md) — current component ownership, dependency
6
6
  direction, and product/runtime contracts.
7
+ - [`architecture/code-review-loop.md`](architecture/code-review-loop.md) — usage and semantics of
8
+ the shared professional code review loop (selectors, budgets, receipts, staleness, CLI and Web).
7
9
  - [`goals/`](goals/orion-code-项目级目标.md) — durable product goals and Goal evidence/recovery
8
10
  guidance.
9
11
  - [`plan/`](plan/v0.3.0-web-workbench-plan.md) — active execution plans, current release
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@orion-agents/orion-code",
3
- "version": "0.3.28",
3
+ "version": "0.3.30",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@orion-agents/orion-code",
9
- "version": "0.3.28",
9
+ "version": "0.3.30",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@clack/prompts": "^0.7.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-agents/orion-code",
3
- "version": "0.3.28",
3
+ "version": "0.3.30",
4
4
  "description": "Orion Code - local-first goal-driven coding agent for terminal and Web.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,5 +0,0 @@
1
- import{r as o,j as e,I as w,W as F}from"./index-kQqA3li6.js";import{u as W,R as z}from"./useAutoNotice-DPXFWIwK.js";function _(t){const r=[];let i;for(const u of t)u.startsWith("@@")?(i&&r.push(i),i={title:u,lines:[u]}):i&&i.lines.push(u);return i&&r.push(i),r}function M(t,r){const i={schemaVersion:1,type:"review_context",repositoryRevision:t.repositoryRevision,path:t.path,hunk:r.title},u=r.lines.join(`
2
- `).slice(0,12e3);return[`请审阅 ${t.path} 的这个 diff hunk,并指出正确性、安全性和测试风险:`,"","```review_context",JSON.stringify(i,null,2),"```","","```diff",u,"```"].join(`
3
- `)}function O({page:t,loading:r=!1,onLoadMore:i,onSendToComposer:u}){const h=o.useMemo(()=>_(t.lines),[t.lines]),[R,a]=o.useState(0),[g,b]=o.useState(!1),[y,C]=o.useState(!1),[v,S]=o.useState(""),j=Math.min(R,Math.max(0,h.length-1)),d=h[j];o.useEffect(()=>{a(0),b(!1),S("")},[t.fileId,t.repositoryRevision]);const k=(s,c)=>{let f=c;if(s.key==="ArrowRight"||s.key==="ArrowDown")f=(c+1)%h.length;else if(s.key==="ArrowLeft"||s.key==="ArrowUp")f=(c-1+h.length)%h.length;else if(s.key==="Home")f=0;else if(s.key==="End")f=h.length-1;else return;s.preventDefault(),a(f);const l=s.currentTarget.parentElement;window.requestAnimationFrame(()=>l?.querySelector(`[data-hunk-index="${f}"]`)?.focus())};return t.binary?e.jsxs("div",{className:"resource-empty compact",children:[e.jsx(w,{name:"code"}),e.jsx("strong",{children:"二进制差异"}),e.jsx("p",{children:"只展示变更事实,不返回 binary patch。"})]}):e.jsxs("div",{className:"diff-viewer",children:[e.jsxs("header",{children:[e.jsx("strong",{title:t.path,children:t.path}),e.jsx("span",{className:"diff-source",children:J(t.source)}),e.jsx("span",{children:t.truncated?"受限预览":`${t.lines.length} 行`})]}),h.length>1?e.jsx("div",{className:"diff-hunk-nav",role:"tablist","aria-label":"Diff hunks",children:h.map((s,c)=>e.jsx("button",{type:"button",role:"tab","data-hunk-index":c,"aria-selected":j===c,tabIndex:j===c?0:-1,onClick:()=>a(c),onKeyDown:f=>k(f,c),children:s.title||`Hunk ${c+1}`},`${s.title}-${c}`))}):null,e.jsxs("div",{className:"diff-actions","aria-label":"Diff 显示选项",children:[d?e.jsx("button",{type:"button",className:"text-button","aria-expanded":!g,onClick:()=>b(s=>!s),children:g?"展开 Hunk":"折叠 Hunk"}):null,e.jsx("button",{type:"button",className:"text-button","aria-pressed":y,onClick:()=>C(s=>!s),children:"显示空白字符"}),d?e.jsx("button",{type:"button",className:"text-button",onClick:()=>{K(d.lines.join(`
4
- `),S)},children:"复制 Hunk"}):null]}),g?null:e.jsx("pre",{className:"diff-lines",tabIndex:0,"aria-label":`Diff ${t.path}`,children:(d?.lines??t.lines).map((s,c)=>e.jsxs("span",{className:s.startsWith("+")?"addition":s.startsWith("-")?"deletion":"",children:[V(s,y)||" ",`
5
- `]},`${c}:${s}`))}),v?e.jsx("p",{className:"resource-notice",role:"status",children:v}):null,e.jsxs("footer",{children:[u&&d?e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>u(M(t,d)),children:"发送此 Hunk 到对话"}):null,t.nextCursor&&i?e.jsx("button",{type:"button",className:"text-button",onClick:i,disabled:r,children:r?"加载中…":"加载更多 Diff"}):null]})]})}function V(t,r){return r?t.replace(/\t/gu,"→ ").replace(/ +$/gu,i=>"·".repeat(i.length)):t}function J(t){return t==="staged"?"HEAD → 索引":t==="unstaged"?"索引 → 工作区":t==="untracked"?"空 → 未跟踪文件":t==="conflict"?"冲突版本":"改动"}async function K(t,r){try{await navigator.clipboard.writeText(t),r("已复制当前 Hunk。")}catch{r("浏览器未允许复制,请手动选择 Diff。")}}function q({workspaceId:t,refreshEpoch:r,actions:i,onSendToComposer:u,navigatorWidthPx:h,onNavigatorWidthCommit:R}){const[a,g]=o.useState(null),[b,y]=o.useState(null),[C,v]=o.useState(null),[S,j]=o.useState(!1),[d,k]=o.useState(""),{notice:s,showNotice:c,clearNotice:f}=W(),l=o.useRef(0),N=o.useRef(0),I=async(n=l.current,$)=>{if(n===l.current){j(!0),k("");try{const x=await i.review();if(n!==l.current)return;g(x);const p=$?x.changedFiles.find(m=>m.fileId===$)??null:null;y(p),v(null),p&&D(p,void 0,n)}catch(x){if(n!==l.current)return;k(L(x))}finally{n===l.current&&j(!1)}}},E=()=>{const n=l.current+1;l.current=n,N.current+=1,f(),I(n,b?.fileId)};o.useEffect(()=>{const n=l.current+1;l.current=n,N.current+=1,g(null),y(null),v(null),k(""),f(),t&&I(n)},[r,t]);const D=async(n,$,x=l.current,p=N.current+1)=>{if(x===l.current){N.current=p,$||(y(n),v(null)),j(!0),k("");try{const m=await i.gitDiff(n.fileId,$);if(x!==l.current||p!==N.current||m.fileId!==n.fileId)return;y(n),v(H=>$&&H&&H.fileId===m.fileId?{...m,lines:[...H.lines,...m.lines]}:m)}catch(m){if(x!==l.current||p!==N.current)return;if(P(m)){c("仓库已变化,已重新建立审阅快照。"),await I(x,n.fileId);return}k(L(m))}finally{x===l.current&&p===N.current&&j(!1)}}};return!a&&!d?e.jsx("p",{className:"resource-loading",children:"正在建立审阅快照…"}):a?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 ${a.clean?"clean":"changed"}`,children:a.clean?e.jsx(w,{name:"check",size:16}):e.jsx(w,{name:"edit",size:16})}),e.jsxs("div",{children:[e.jsx("strong",{children:A(a).headline}),e.jsx("span",{children:A(a).counters})]})]}),e.jsx("button",{type:"button",className:"icon-button","aria-label":"刷新审阅快照","aria-busy":S,disabled:S,onClick:E,children:e.jsx(w,{name:"refresh",size:16})})]}),a.truncated?e.jsxs("p",{className:"resource-notice",role:"status",children:["当前显示 ",a.changedFiles.length," / ",a.totalChangedFiles," ","个变更文件;分类计数仅覆盖当前显示范围。"]}):null,s?e.jsx("p",{className:"resource-notice",role:"status",children:s.text}):null,d?e.jsx("p",{className:"resource-error",role:"alert",children:d}):null,e.jsxs(z,{panelId:"review",navigatorWidthPx:h,onNavigatorWidthCommit:R,contentLabel:"审阅 Diff",navigatorLabel:"待审阅文件",handleLabel:"调整待审阅文件列表宽度",contentClassName:"review-diff",navigatorClassName:"review-files",children:[e.jsx(e.Fragment,{children:a.changedFiles.map(n=>e.jsxs("button",{type:"button",className:b?.fileId===n.fileId?"selected":"",onClick:()=>{D(n)},children:[e.jsx(w,{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:C?e.jsx(O,{page:C,loading:S,onLoadMore:C.nextCursor&&b?()=>{D(b,C.nextCursor??void 0)}:void 0,onSendToComposer:u}):e.jsxs("div",{className:"resource-empty",children:[e.jsx(w,{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(w,{name:"warning"}),e.jsx("strong",{children:"无法读取审阅快照"}),e.jsx("p",{children:d}),e.jsx("button",{type:"button",className:"secondary-button",onClick:E,children:"重试"})]})}function A(t){const r=[`${t.stagedCount} 已暂存`,`${t.unstagedCount} 未暂存`,`${t.untrackedCount} 未跟踪`,`${t.conflictCount} 冲突`].join(" · ");return Object.freeze({headline:t.clean?"没有待审阅变更":`${t.totalChangedFiles} 个变更文件`,counters:`${t.truncated?"当前显示 · ":""}${r}`})}function L(t){return t instanceof Error?t.message:"审阅请求失败。"}function P(t){return t instanceof F&&t.code==="git_revision_conflict"}export{q as ReviewPanel,A as reviewSummary};