@bd7pil/ocrc 0.21.0 → 0.22.1

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.
Files changed (31) hide show
  1. package/dist/core/agent/opencode-backend.js +38 -1
  2. package/dist/core/agent/opencode-backend.js.map +1 -1
  3. package/dist/core/relay.js +1 -1
  4. package/dist/core/relay.js.map +1 -1
  5. package/dist/transport/web/routes/vcs.js +26 -0
  6. package/dist/transport/web/routes/vcs.js.map +1 -1
  7. package/dist/transport/web/server.js +2 -1
  8. package/dist/transport/web/server.js.map +1 -1
  9. package/package.json +1 -1
  10. package/web/dist/_app/immutable/assets/3.BoovcwoG.css +1 -0
  11. package/web/dist/_app/immutable/assets/{Card.Cb4bHscp.css → Card.BnVisgSs.css} +1 -1
  12. package/web/dist/_app/immutable/chunks/C1FmrZbK.js +1 -0
  13. package/web/dist/_app/immutable/chunks/CtMqSQTR.js +1 -0
  14. package/web/dist/_app/immutable/chunks/CwM1DevG.js +65 -0
  15. package/web/dist/_app/immutable/chunks/DjHqq4wz.js +1 -0
  16. package/web/dist/_app/immutable/entry/app.Jw_oD82R.js +2 -0
  17. package/web/dist/_app/immutable/entry/start.DsnVdUit.js +1 -0
  18. package/web/dist/_app/immutable/nodes/{0.DQ-x5_0s.js → 0.BpE23c-a.js} +3 -3
  19. package/web/dist/_app/immutable/nodes/{1.Db23oP9D.js → 1.DivFzgMM.js} +1 -1
  20. package/web/dist/_app/immutable/nodes/{2.DMAW-kpW.js → 2.Cv47TVoL.js} +1 -1
  21. package/web/dist/_app/immutable/nodes/3.CS7I801I.js +2 -0
  22. package/web/dist/_app/version.json +1 -1
  23. package/web/dist/index.html +11 -10
  24. package/web/dist/service-worker.js +1 -1
  25. package/web/dist/_app/immutable/assets/3.DDMraXHe.css +0 -1
  26. package/web/dist/_app/immutable/chunks/DYlRL82y.js +0 -65
  27. package/web/dist/_app/immutable/chunks/Sw-i12Cs.js +0 -1
  28. package/web/dist/_app/immutable/chunks/kkthArL2.js +0 -1
  29. package/web/dist/_app/immutable/entry/app.Dx34wmfX.js +0 -2
  30. package/web/dist/_app/immutable/entry/start.DkXOd8Gf.js +0 -1
  31. package/web/dist/_app/immutable/nodes/3.Cn9knJ9_.js +0 -1
@@ -0,0 +1 @@
1
+ import{O as Y,b7 as K,b6 as q,b4 as X,aM as V,aN as P,a8 as L,V as Z,X as ee,a2 as te,b8 as p,a9 as y,Y as m}from"./BjY4dxcB.js";function Ie(e=!1){const t=Y,n=t.l.u;if(!n)return;let s=()=>Z(t.s);if(e){let o=0,r={};const d=ee(()=>{let a=!1;const l=t.s;for(const u in l)l[u]!==r[u]&&(r[u]=l[u],a=!0);return a&&o++,o});s=()=>L(d)}n.b.length&&K(()=>{N(t,s),P(n.b)}),q(()=>{const o=X(()=>n.m.map(V));return()=>{for(const r of o)typeof r=="function"&&r()}}),n.a.length&&q(()=>{N(t,s),P(n.a)})}function N(e,t){if(e.l.s)for(const n of e.l.s)L(n);t()}te();const A="ocrc.token";function z(e){const t=e.startsWith("#")?e.slice(1):e;if(!t)return null;const n=new URLSearchParams(t).get("token");return n&&n.trim()?n.trim():null}function ne(e){const t=e.startsWith("#")?e.slice(1):e;if(!t)return null;const n=new URLSearchParams(t).get("pair");return n&&n.trim()?n.trim():null}function w(){try{const e=localStorage.getItem(A);return e&&e.trim()?e:null}catch{return null}}function S(e){try{localStorage.setItem(A,e)}catch{}}function B(){try{localStorage.removeItem(A)}catch{}}const I="ocrc.authReloaded";function se(e=window.location){if(w()){B();try{const{pathname:t,search:n}=window.location;window.history.replaceState(null,"",t+n)}catch{}e.reload();return}try{if(sessionStorage.getItem(I))return;sessionStorage.setItem(I,"1")}catch{}e.reload()}function E(){try{sessionStorage.removeItem(I)}catch{}}const f=p("booting"),$=p("");let b=null;if(typeof location<"u"&&typeof window<"u"){const e=z(location.hash);e&&S(e),b=ne(location.hash),b&&history.replaceState(null,"",location.pathname+location.search)}b?(f.set("booting"),(async()=>{try{const e=await fetch("/api/pair/exchange",{method:"POST",headers:{"content-type":"application/json"},credentials:"include",body:JSON.stringify({pending:b})});if(!e.ok)throw new Error(String(e.status));const t=await e.json();if(!t.token)throw new Error("no token");S(t.token),$.set(""),f.set("ready")}catch{$.set("配对链接已失效(1 分钟过期或已被使用)——请在主机上刷新二维码后重试。"),f.set("pairing")}})()):f.set(w()?"ready":"pairing");async function $e(e){const t=e.trim().match(/[?#]pair=([^&#\s]+)/),n=t?decodeURIComponent(t[1]):e.trim();if(!n)return"这看起来不是有效的配对链接。";try{const s=await fetch("/api/pair/exchange",{method:"POST",headers:{"content-type":"application/json"},credentials:"include",body:JSON.stringify({pending:n})});if(!s.ok)throw new Error(String(s.status));const o=await s.json();return!o.token||!oe(o.token)?"这看起来不是有效的配对链接。":($.set(""),"")}catch{return"配对链接已失效(1 分钟过期或已被使用)——请刷新二维码后重试。"}}function T(){const e=w();if(!e){y(f)==="ready"&&se();return}const t=typeof location<"u"?z(location.hash):null;if(t&&t!==e){S(t),f.set("ready");return}if(t){f.set("rejected");return}B(),f.set("pairing")}function oe(e){const t=e.trim();return!t||t.length<16?!1:(S(t),f.set("ready"),!0)}let O="";function _(e){const t={...e??{}},n=w();return n&&(t.authorization=`Bearer ${n}`),t}async function i(e){const t=await fetch(`${O}${e}`,{credentials:"include",headers:_()});if(t.status===401)throw T(),new Error(`GET ${e} 401`);if(!t.ok)throw new Error(`GET ${e} ${t.status}`);return E(),t.json()}async function c(e,t){const n=await fetch(`${O}${e}`,{method:"POST",headers:_({"content-type":"application/json"}),credentials:"include",body:JSON.stringify(t)});if(n.status===401)throw T(),new Error(`POST ${e} 401`);if(!n.ok)throw new Error(`POST ${e} ${n.status}`);return E(),n.json()}async function D(e,t,n){const s=await fetch(`${O}${t}`,{method:e,headers:_(n===void 0?void 0:{"content-type":"application/json"}),credentials:"include",body:n===void 0?void 0:JSON.stringify(n)});if(s.status===401)throw T(),new Error(`${e} ${t} 401`);if(!s.ok)throw new Error(`${e} ${t} ${s.status}`);return E(),s.json()}async function x(e,t){return D("PATCH",e,t)}async function F(e){return D("DELETE",e)}const R={me:()=>i("/api/me"),capabilities:()=>i("/api/capabilities"),backends:()=>i("/api/backends"),setActiveBackend:e=>c("/api/backends/active",{backendId:e}),sessions:()=>i("/api/sessions"),cleanupSubagents:()=>c("/api/sessions/cleanup-subagents",{}),revertSession:(e,t)=>c(`/api/session/${e}/revert?messageID=${encodeURIComponent(t)}`,{}),unrevertSession:e=>c(`/api/session/${e}/unrevert`,{}),revertState:e=>i(`/api/session/${e}/revert-state`),deleteSession:e=>c(`/api/sessions/${e}/delete`,{}),renameSession:(e,t)=>c(`/api/sessions/${e}/rename`,{title:t}),history:(e,t)=>{const n=new URLSearchParams;(t==null?void 0:t.limit)!=null&&n.set("limit",String(t.limit)),(t==null?void 0:t.offset)!=null&&n.set("offset",String(t.offset));const s=n.toString();return i(`/api/session/${e}${s?`?${s}`:""}`)},todo:e=>i(`/api/session/${e}/todo`),context:e=>i(`/api/session/${e}/context`),workspaces:()=>i("/api/workspaces"),createSession:e=>c("/api/session",e),mcp:()=>i("/api/mcp"),commands:e=>i(`/api/commands${e?`?backend=${encodeURIComponent(e)}`:""}`),runCommand:e=>c("/api/command",e),agents:()=>i("/api/agents"),models:()=>i("/api/models"),getOverrides:()=>i("/api/overrides"),setOverrides:e=>c("/api/overrides",e),sendMessage:e=>c("/api/message",e),abort:e=>c("/api/abort",{sessionId:e}),suggestions:e=>i(`/api/session/${e}/suggestions`),approve:(e,t,n)=>c("/api/approval",{sessionId:e,requestId:t,decision:n}),answerQuestion:(e,t,n)=>c("/api/question/reply",{sessionId:e,requestId:t,answers:n}),rejectQuestion:(e,t)=>c("/api/question/reject",{sessionId:e,requestId:t}),controls:e=>i(`/api/session/${e}/controls`),setMode:(e,t)=>c(`/api/session/${e}/mode`,{modeId:t}),setModel:(e,t)=>c(`/api/session/${e}/model`,{modelId:t}),files:(e,t)=>i(`/api/session/${e}/files?q=${encodeURIComponent(t)}`),schedules:()=>i("/api/schedules"),subagents:e=>i(`/api/session/${e}/subagents`),messageRaw:(e,t)=>i(`/api/session/${e}/message/${encodeURIComponent(t)}`),vcs:e=>i(`/api/vcs${e?`?sessionId=${encodeURIComponent(e)}`:""}`),vcsDiff:(e,t)=>i(`/api/vcs/diff?file=${encodeURIComponent(t)}${e?`&sessionId=${encodeURIComponent(e)}`:""}`),version:()=>i("/api/version"),skills:e=>i(`/api/skills${e?`?directory=${encodeURIComponent(e)}`:""}`),browse:(e,t)=>i(`/api/browse?directory=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`),fileContent:(e,t)=>i(`/api/file-content?directory=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`),worktrees:e=>i(`/api/worktrees${e?`?directory=${encodeURIComponent(e)}`:""}`),createWorktree:(e,t)=>c("/api/worktrees",{directory:e,name:t}),removeWorktree:(e,t)=>F(`/api/worktrees?directory=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`),channels:()=>i("/api/channels"),updateChannel:(e,t)=>x(`/api/channels/${e}`,t),resetChannel:e=>c(`/api/channels/${e}/reset`,{}),pairQr:()=>i("/api/pair/qr"),pairOnboarding:()=>i("/api/pair/onboarding"),exchangePair:e=>c("/api/pair/exchange",{pending:e}),addSchedule:e=>c("/api/schedules",e),setScheduleEnabled:(e,t)=>x(`/api/schedules/${e}`,{enabled:t}),deleteSchedule:e=>F(`/api/schedules/${e}`)},j=p([]),U=()=>({order:[],byId:{},lastSeq:0}),g=p({});function M(e,t){return e.id??`${e.kind}:${e.seq??t}`}function ie(e){return e==="thinking"||e==="think-stream"}function re(e){return e?e.order.map(t=>e.byId[t]).filter(Boolean):[]}function ae(e,t){return typeof t.seq=="number"&&e>0&&t.seq>e+1}function ce(e){if(!("sessionId"in e)||!e.sessionId)return;const t=e.sessionId,n=M(e,0);g.update(s=>{const o=s[t]??U();if(e.seq!=null&&e.seq<=o.lastSeq&&!(n in o.byId))return s;e.seq!=null&&(o.lastSeq=Math.max(o.lastSeq,e.seq));const r=e.id?e:{...e,id:n};if(n in o.byId)o.byId={...o.byId,[n]:r};else{let d=o.order,a=o.byId;(e.kind==="streaming"||e.kind==="assistant"||e.kind==="error")&&(a={...a},d=d.filter(l=>{var u;return ie((u=a[l])==null?void 0:u.kind)?(delete a[l],!1):!0})),o.order=[...d,n],o.byId={...a,[n]:r}}return{...s,[t]:o}})}function de(e){g.update(t=>{for(const n of Object.keys(t)){const s=t[n];if(!(e in s.byId))continue;const o={...s.byId};return delete o[e],{...t,[n]:{...s,order:s.order.filter(r=>r!==e),byId:o}}}return t})}function le(e,t,n=0){g.update(s=>{const o=U();return o.lastSeq=n,t.forEach((r,d)=>{const a=M(r,d);o.order.push(a),o.byId[a]=r.id?r:{...r,id:a}}),{...s,[e]:o}})}let G=0;function ue(e,t){if(t.length===0)return;G+=1;const n=G;g.update(s=>{const o=s[e]??U(),r={...o.byId},d=[];for(let a=t.length-1;a>=0;a--){const l=t[a],u=l.id??`${l.kind}:h${n}:${a}`;u in r||(d.push(u),r[u]=l.id?l:{...l,id:u})}return d.length===0?s:{...s,[e]:{order:[...d.reverse(),...o.order],byId:r,lastSeq:o.lastSeq}}})}function fe(e){const t=new Set(Array.isArray(e)?e:e?[e]:[]);g.update(n=>{const s={};for(const o of Object.keys(n))t.has(o)&&(s[o]=n[o]);return s})}const Ce=Object.freeze(Object.defineProperty({__proto__:null,cardsOf:re,feeds:g,isSeqGap:ae,prependHistory:ue,pruneFeeds:fe,removeCard:de,sessionList:j,setHistory:le,upsertCard:ce},Symbol.toStringTag,{value:"Module"})),k=p(null),h=p(null),J=p(void 0),pe=m([h,J,j,k],([e,t,n,s])=>{if(e){const o=t?n.find(a=>a.id===t):void 0,r=(o==null?void 0:o.backendId)??e.activeId,d=e.backends.find(a=>a.id===r);if(d)return d.capabilities}return(s==null?void 0:s.capabilities)??null}),he=m([h,J,j,k],([e,t,n,s])=>{if(e){const o=t?n.find(r=>r.id===t):void 0;return(o==null?void 0:o.backendId)??e.activeId}return(s==null?void 0:s.id)??null}),Ae=m(pe,e=>t=>e?e[t]!==!1:!0),me=m([h,k],([e,t])=>{var n;return e?((n=e.backends.find(s=>s.id===e.activeId))==null?void 0:n.capabilities)??null:(t==null?void 0:t.capabilities)??null});m(me,e=>t=>e?e[t]!==!1:!0);const Ee=m(he,e=>{const t=e??"opencode";return t.includes(":")?t.split(":").pop():t}),v=["emerald","azure","amber","violet"],Te={emerald:"#54d398",azure:"#5b9eff",amber:"#ffc34d",violet:"#b48cf0"},Oe={emerald:"#0f261b",azure:"#101f33",amber:"#2a2110",violet:"#1d1733"},_e={emerald:"#236b49",azure:"#2c5891",amber:"#8a6a26",violet:"#5a4790"},W="ocrc.agentAccents",H={opencode:"emerald","acp:kimi":"azure"};function ge(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return t}function ye(e){return H[e]?H[e]:v[ge(e)%v.length]}function be(){if(typeof localStorage>"u")return{};try{const e=localStorage.getItem(W),t=e?JSON.parse(e):{};return typeof t=="object"&&t!==null?t:{}}catch{return{}}}function ve(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(W,JSON.stringify(e))}catch{}}const C=p(be());function we(e){const t=y(C);return v.includes(t[e])?t[e]:ye(e)}function Re(e,t){var s;const n={...y(C)};t&&v.includes(t)?n[e]=t:delete n[e],C.set(n),ve(n),((s=y(h))==null?void 0:s.activeId)===e&&Q(e)}function Q(e){typeof document>"u"||document.documentElement.setAttribute("data-accent",we(e))}async function je(){try{k.set(await R.capabilities())}catch(e){console.warn("[capabilities] failed to load",e)}}async function Se(){try{h.set(await R.backends())}catch(e){console.warn("[backends] failed to load",e)}}async function Ue(e){const t=y(h);t&&h.set({...t,activeId:e});try{await R.setActiveBackend(e)}catch(n){console.warn("[backends] setActive failed",n)}await Se(),Q(e)}export{v as A,Ce as B,Ue as C,Re as D,le as E,oe as F,ce as G,J as H,Oe as a,Te as b,_e as c,C as d,we as e,R as f,Q as g,f as h,Ee as i,h as j,Ae as k,re as l,he as m,ye as n,$e as o,g as p,w as q,Ie as r,ae as s,Se as t,je as u,$ as v,ue as w,fe as x,de as y,j as z};