wherdr 1.3.3 → 2.0.0
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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/BDNMzG2s.js +1 -0
- package/.output/public/_nuxt/BETID3_E.js +1 -0
- package/.output/public/_nuxt/BHenDMeH.js +1 -0
- package/.output/public/_nuxt/BYZVrreW.js +1 -0
- package/.output/public/_nuxt/BhgehRdJ.js +1 -0
- package/.output/public/_nuxt/{yzABg5xl.js → Bpoxvzh6.js} +1 -1
- package/.output/public/_nuxt/BtH82ZuZ.js +9 -0
- package/.output/public/_nuxt/C25ROUa9.js +3 -0
- package/.output/public/_nuxt/C3Bkn4ac.js +62 -0
- package/.output/public/_nuxt/CDWjMk9C.js +2 -0
- package/.output/public/_nuxt/{Ci8N4mWR.js → CXJnLmWv.js} +1 -1
- package/.output/public/_nuxt/CuUQ4mEf.js +1 -0
- package/.output/public/_nuxt/DFGEl0v2.js +23 -0
- package/.output/public/_nuxt/{CKhgznq4.js → DFmgQVme.js} +42 -39
- package/.output/public/_nuxt/DZGKxROq.js +6 -0
- package/.output/public/_nuxt/DmkWvmnE.js +2 -0
- package/.output/public/_nuxt/DrKKeFFE.js +31 -0
- package/.output/public/_nuxt/DyfFwwGq.js +1 -0
- package/.output/public/_nuxt/FaNto0ga.js +105 -0
- package/.output/public/_nuxt/NIF0VwHk.js +25 -0
- package/.output/public/_nuxt/R0Y4VoeX.js +1 -0
- package/.output/public/_nuxt/board.CEEcFc6M.css +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/0b28b3e9-664e-4347-a35b-afb0a711d5c5.json +1 -0
- package/.output/public/_nuxt/entry.CKoXcwRa.css +2 -0
- package/.output/public/_nuxt/pdf.min.t82Z80JU.mjs +28 -0
- package/.output/public/_nuxt/pdf.worker.min.wgc6bjNh.mjs +28 -0
- package/.output/public/_nuxt/settings.Cdb21nNw.css +1 -0
- package/.output/public/sw.js +1 -1
- package/.output/server/chunks/_/branding.mjs +1 -1
- package/.output/server/chunks/_/changes.mjs +4 -4
- package/.output/server/chunks/_/fileDownload.mjs +278 -0
- package/.output/server/chunks/_/files.mjs +60 -20
- package/.output/server/chunks/_/machineOrder.mjs +1 -1
- package/.output/server/chunks/_/onboarding.mjs +1 -1
- package/.output/server/chunks/_/package.mjs +11 -3
- package/.output/server/chunks/_/plugins.mjs +92 -122
- package/.output/server/chunks/_/restart.mjs +1 -1
- package/.output/server/chunks/_/selfupdate.mjs +1 -1
- package/.output/server/chunks/_/settingstabs.mjs +36 -0
- package/.output/server/chunks/_/updates.mjs +1 -1
- package/.output/server/chunks/_/worktrees.mjs +1 -1
- package/.output/server/chunks/_/ws.mjs +43 -6
- package/.output/server/chunks/nitro/nitro.mjs +14126 -10238
- package/.output/server/chunks/raw/check-doc-links.mjs +5 -0
- package/.output/server/chunks/raw/check-leaks.mjs +1 -1
- package/.output/server/chunks/raw/check-release-notes.mjs +5 -0
- package/.output/server/chunks/raw/herdr-plugin.mjs +1 -1
- package/.output/server/chunks/raw/install-claude-statusline.mjs +1 -1
- package/.output/server/chunks/raw/prerelease-summary.mjs +5 -0
- package/.output/server/chunks/raw/prerelease.mjs +7 -0
- package/.output/server/chunks/raw/reveal.mjs +1 -1
- package/.output/server/chunks/raw/test-affected.mjs +5 -0
- package/.output/server/chunks/routes/api/_..._.mjs +6 -5
- package/.output/server/chunks/routes/api/agents.post.mjs +6 -5
- package/.output/server/chunks/routes/api/ask-tab.post.mjs +6 -5
- package/.output/server/chunks/routes/api/attach.post.mjs +6 -5
- package/.output/server/chunks/routes/api/auth/disable.post.mjs +6 -5
- package/.output/server/chunks/routes/api/auth/lock-all.post.mjs +6 -5
- package/.output/server/chunks/routes/api/auth/lock.post.mjs +6 -5
- package/.output/server/chunks/routes/api/auth/login/options.post.mjs +6 -5
- package/.output/server/chunks/routes/api/auth/login/verify.post.mjs +6 -5
- package/.output/server/chunks/routes/api/auth/max-session.post.mjs +6 -5
- package/.output/server/chunks/routes/api/auth/register/options.post.mjs +6 -5
- package/.output/server/chunks/routes/api/auth/register/verify.post.mjs +6 -5
- package/.output/server/chunks/routes/api/auth/status.get.mjs +6 -5
- package/.output/server/chunks/routes/api/changes.get.mjs +7 -6
- package/.output/server/chunks/routes/api/chat/image.get.mjs +7 -6
- package/.output/server/chunks/routes/api/chat.get.mjs +44 -11
- package/.output/server/chunks/routes/api/choose.post.mjs +44 -30
- package/.output/server/chunks/routes/api/claude-setup.post.mjs +42 -0
- package/.output/server/chunks/routes/api/claude-statusline.post.mjs +7 -6
- package/.output/server/chunks/routes/api/clear-queued-input.post.mjs +42 -0
- package/.output/server/chunks/routes/api/close/status.get.mjs +7 -6
- package/.output/server/chunks/routes/api/close.post.mjs +6 -5
- package/.output/server/chunks/routes/api/codex-update.post.mjs +7 -6
- package/.output/server/chunks/routes/api/commands.get.mjs +9 -7
- package/.output/server/chunks/routes/api/config.get.mjs +10 -13
- package/.output/server/chunks/routes/api/dirs.get.mjs +7 -6
- package/.output/server/chunks/routes/api/dismiss-stopped.post.mjs +7 -6
- package/.output/server/chunks/routes/api/dismiss.post.mjs +7 -6
- package/.output/server/chunks/routes/api/effort.post.mjs +7 -6
- package/.output/server/chunks/routes/api/efforts.get.mjs +7 -6
- package/.output/server/chunks/routes/api/file.post.mjs +7 -6
- package/.output/server/chunks/routes/api/files/download.get.mjs +12 -24
- package/.output/server/chunks/routes/api/files/download.head.mjs +41 -0
- package/.output/server/chunks/routes/api/files/read.get.mjs +8 -7
- package/.output/server/chunks/routes/api/files.get.mjs +7 -6
- package/.output/server/chunks/routes/api/health.get.mjs +6 -5
- package/.output/server/chunks/routes/api/input.post.mjs +33 -15
- package/.output/server/chunks/routes/api/interrupt.post.mjs +24 -21
- package/.output/server/chunks/routes/api/isgit.get.mjs +8 -8
- package/.output/server/chunks/routes/api/machine/awake.get.mjs +7 -6
- package/.output/server/chunks/routes/api/machine/awake.post.mjs +7 -6
- package/.output/server/chunks/routes/api/machine/order.get.mjs +6 -5
- package/.output/server/chunks/routes/api/machine/order.post.mjs +6 -5
- package/.output/server/chunks/routes/api/machine/reconnect.post.mjs +40 -0
- package/.output/server/chunks/routes/api/machine/rename.post.mjs +7 -6
- package/.output/server/chunks/routes/api/machine/status.post.mjs +39 -0
- package/.output/server/chunks/routes/api/menu-left.post.mjs +40 -0
- package/.output/server/chunks/routes/api/menu.post.mjs +10 -6
- package/.output/server/chunks/routes/api/model.post.mjs +7 -6
- package/.output/server/chunks/routes/api/models.get.mjs +7 -6
- package/.output/server/chunks/routes/api/nav.post.mjs +40 -26
- package/.output/server/chunks/routes/api/onboarding.get.mjs +6 -5
- package/.output/server/chunks/routes/api/onboarding.post.mjs +6 -5
- package/.output/server/chunks/routes/api/phone.get.mjs +8 -10
- package/.output/server/chunks/routes/api/phone.post.mjs +8 -10
- package/.output/server/chunks/routes/api/plugins/actions.get.mjs +6 -8
- package/.output/server/chunks/routes/api/plugins/invoke.post.mjs +6 -8
- package/.output/server/chunks/routes/api/plugins/projects.get.mjs +10 -8
- package/.output/server/chunks/routes/api/plugins/projects.post.mjs +11 -7
- package/.output/server/chunks/routes/api/prompt.post.mjs +22 -13
- package/.output/server/chunks/routes/api/push/quiet.post.mjs +7 -6
- package/.output/server/chunks/routes/api/push/subscribe.post.mjs +7 -7
- package/.output/server/chunks/routes/api/push/test.post.mjs +7 -6
- package/.output/server/chunks/routes/api/push/unsubscribe.post.mjs +7 -6
- package/.output/server/chunks/routes/api/quotas.get.mjs +7 -6
- package/.output/server/chunks/routes/api/rename.post.mjs +6 -5
- package/.output/server/chunks/routes/api/requeue.post.mjs +7 -6
- package/.output/server/chunks/routes/api/restart.get.mjs +6 -5
- package/.output/server/chunks/routes/api/restart.post.mjs +6 -5
- package/.output/server/chunks/routes/api/reveal.post.mjs +91 -8
- package/.output/server/chunks/routes/api/screen-key.post.mjs +19 -15
- package/.output/server/chunks/routes/api/screen.get.mjs +8 -40
- package/.output/server/chunks/routes/api/search.get.mjs +7 -6
- package/.output/server/chunks/routes/api/seen.post.mjs +7 -6
- package/.output/server/chunks/routes/api/sessions.get.mjs +7 -6
- package/.output/server/chunks/routes/api/sessions.post.mjs +7 -6
- package/.output/server/chunks/routes/api/settings-tab.post.mjs +90 -0
- package/.output/server/chunks/routes/api/{plugins/thread-limits.get.mjs → settings.get.mjs} +10 -9
- package/.output/server/chunks/routes/api/settings.post.mjs +40 -0
- package/.output/server/chunks/routes/api/space.post.mjs +34 -18
- package/.output/server/chunks/routes/api/state.get.mjs +7 -6
- package/.output/server/chunks/routes/api/tasks/action.post.mjs +39 -0
- package/.output/server/chunks/routes/api/{plugins/profiles.get.mjs → tasks/add.post.mjs} +12 -14
- package/.output/server/chunks/routes/api/tasks/after.post.mjs +39 -0
- package/.output/server/chunks/routes/api/tasks/approve.post.mjs +39 -0
- package/.output/server/chunks/routes/api/{project/report.get.mjs → tasks/archived.get.mjs} +12 -13
- package/.output/server/chunks/routes/api/{gitroot.get.mjs → tasks/autopilot.get.mjs} +13 -14
- package/.output/server/chunks/routes/api/tasks/autopilot.post.mjs +39 -0
- package/.output/server/chunks/routes/api/{index.get.mjs → tasks/board-settings.get.mjs} +12 -13
- package/.output/server/chunks/routes/api/tasks/board-settings.post.mjs +39 -0
- package/.output/server/chunks/routes/api/tasks/coordinator.get.mjs +40 -0
- package/.output/server/chunks/routes/api/tasks/coordinator.post.mjs +39 -0
- package/.output/server/chunks/routes/api/tasks/details.get.mjs +40 -0
- package/.output/server/chunks/routes/api/tasks/limit.post.mjs +39 -0
- package/.output/server/chunks/routes/api/tasks/links.get.mjs +39 -0
- package/.output/server/chunks/routes/api/tasks/models.get.mjs +40 -0
- package/.output/server/chunks/routes/api/tasks/pick.post.mjs +39 -0
- package/.output/server/chunks/routes/api/tasks/question.post.mjs +39 -0
- package/.output/server/chunks/routes/api/tasks/scheduled.get.mjs +40 -0
- package/.output/server/chunks/routes/api/{project → tasks}/settings.get.mjs +10 -11
- package/.output/server/chunks/routes/api/tasks/start.get.mjs +40 -0
- package/.output/server/chunks/routes/api/tasks/tell.post.mjs +39 -0
- package/.output/server/chunks/routes/api/tasks.get.mjs +39 -0
- package/.output/server/chunks/routes/api/unqueue.post.mjs +7 -6
- package/.output/server/chunks/routes/api/update/status.get.mjs +6 -5
- package/.output/server/chunks/routes/api/update.get.mjs +8 -10
- package/.output/server/chunks/routes/api/update.post.mjs +8 -10
- package/.output/server/chunks/routes/api/upload.post.mjs +7 -6
- package/.output/server/chunks/routes/api/worktrees/remove.post.mjs +6 -5
- package/.output/server/chunks/routes/api/worktrees.get.mjs +6 -5
- package/.output/server/chunks/routes/favicon.ico.get.mjs +6 -5
- package/.output/server/chunks/routes/icons/_name_.get.mjs +7 -6
- package/.output/server/chunks/routes/renderer.mjs +8 -7
- package/.output/server/chunks/routes/uploads/_...name_.get.mjs +7 -6
- package/.output/server/chunks/routes/ws/_..._.mjs +7 -6
- package/.output/server/chunks/routes/ws/events.mjs +9 -7
- package/.output/server/chunks/routes/ws/term.mjs +7 -6
- package/.output/server/chunks/virtual/precomputed.mjs +1 -1
- package/.output/server/index.mjs +7 -6
- package/.output/server/package.json +1 -1
- package/README.md +44 -1424
- package/bin/lib/commands.mjs +44 -9
- package/bin/lib/panel.mjs +3 -11
- package/bin/lib/service.mjs +41 -2
- package/bin/lib/skill.mjs +1 -1
- package/bin/lib/tailnet.d.mts +6 -3
- package/bin/lib/tailnet.mjs +70 -32
- package/bin/lib/userpath.d.mts +14 -0
- package/bin/lib/userpath.mjs +142 -0
- package/docs/README.md +58 -0
- package/docs/RELEASING.md +174 -0
- package/docs/board.md +164 -0
- package/docs/command.md +58 -0
- package/docs/configuration.md +39 -0
- package/docs/conversation.md +132 -0
- package/docs/development.md +38 -0
- package/docs/devices.md +58 -0
- package/docs/files.md +29 -0
- package/docs/herdr-projects-1x.md +278 -0
- package/docs/home.md +52 -0
- package/docs/installation.md +174 -0
- package/docs/machines.md +69 -0
- package/docs/migrate-from-1.x-docker.md +160 -0
- package/docs/networks.md +154 -0
- package/docs/notifications.md +83 -0
- package/docs/overview.md +71 -0
- package/docs/phone.md +26 -0
- package/docs/plugins.md +109 -0
- package/docs/quick-start.md +89 -0
- package/docs/quotas.md +65 -0
- package/docs/release-notes-2.0.0.md +84 -0
- package/docs/security.md +117 -0
- package/docs/terminal.md +15 -0
- package/docs/troubleshooting.md +45 -0
- package/package.json +11 -3
- package/skills/wherdr/SKILL.md +24 -167
- package/.output/public/_nuxt/B4Yk2tB1.js +0 -23
- package/.output/public/_nuxt/BBw_0a4M.js +0 -6
- package/.output/public/_nuxt/BSy6OCIY.js +0 -1
- package/.output/public/_nuxt/BX5PM2JQ.js +0 -1
- package/.output/public/_nuxt/BgPDnf2S.js +0 -1
- package/.output/public/_nuxt/BkOxQzbS.js +0 -2
- package/.output/public/_nuxt/CP8o925U.js +0 -1
- package/.output/public/_nuxt/CWwyK2XK.js +0 -2
- package/.output/public/_nuxt/CkbmecwS.js +0 -1
- package/.output/public/_nuxt/Cr3SrGky.js +0 -1
- package/.output/public/_nuxt/DAg9fiVh.js +0 -89
- package/.output/public/_nuxt/DT8qZ0Wv.js +0 -1
- package/.output/public/_nuxt/DaaJIRB3.js +0 -1
- package/.output/public/_nuxt/DcJi16XA.js +0 -1
- package/.output/public/_nuxt/SiL1FJ5s.js +0 -3
- package/.output/public/_nuxt/VpjCgSXu.js +0 -36
- package/.output/public/_nuxt/builds/meta/c735b6c0-1bd0-47d7-a208-d310f0a06287.json +0 -1
- package/.output/public/_nuxt/dPxB2L94.js +0 -89
- package/.output/public/_nuxt/entry.CGWKmYU3.css +0 -2
- package/.output/public/_nuxt/xYX85SPI.js +0 -1
- package/.output/server/chunks/_/pluginPolicy.mjs +0 -93
- package/.output/server/chunks/_/projectBoard.mjs +0 -366
- package/.output/server/chunks/_/projectDocs.mjs +0 -106
- package/.output/server/chunks/_/projectInbox.mjs +0 -135
- package/.output/server/chunks/_/projectThreads.mjs +0 -46
- package/.output/server/chunks/_/projectThreads2.mjs +0 -61
- package/.output/server/chunks/_/projectsActions.mjs +0 -143
- package/.output/server/chunks/_/projectsPlugin.mjs +0 -56
- package/.output/server/chunks/_/reveal.mjs +0 -115
- package/.output/server/chunks/raw/dev.wherdr.open.mjs +0 -7
- package/.output/server/chunks/raw/docker-entrypoint.mjs +0 -7
- package/.output/server/chunks/raw/install-host-open.mjs +0 -7
- package/.output/server/chunks/raw/wherdr-open.mjs +0 -7
- package/.output/server/chunks/routes/api/board.get.mjs +0 -147
- package/.output/server/chunks/routes/api/plugins/thread-limits.post.mjs +0 -45
- package/.output/server/chunks/routes/api/project/inbox.get.mjs +0 -43
- package/.output/server/chunks/routes/api/project/inbox.post.mjs +0 -43
- package/.output/server/chunks/routes/api/project/memory.get.mjs +0 -42
- package/.output/server/chunks/routes/api/project/routines.get.mjs +0 -43
- package/.output/server/chunks/routes/api/project/thread.get.mjs +0 -44
- package/.output/server/chunks/routes/api/project/thread.post.mjs +0 -45
- package/bin/install-docker-skill.sh +0 -20
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,B as t,Et as n,Hn as r,M as i,Mn as a,N as o,Ot as s,P as c,Pt as l,St as u,U as d,V as f,b as p,dr as m,hr as h,j as g,mr as _,nn as v,sn as y,w as ee}from"./SiL1FJ5s.js";import{_t as b,vt as x}from"./CWwyK2XK.js";import{$r as S,Br as C,En as w,Gr as te,Ir as T,Jt as ne,M as re,O as ie,Pr as ae,Ur as oe,Yr as se,ii as ce,jr as le,rn as E,ti as ue,wn as de}from"./dPxB2L94.js";import{f as fe,p as pe,u as me}from"./Ci8N4mWR.js";import{B as he,Br as D,C as ge,Er as _e,F as ve,G as O,H as k,I as ye,In as be,Ln as xe,Lt as Se,Mn as Ce,Mr as A,Nn as we,Pn as Te,Pt as Ee,Rn as De,T as j,V as Oe,_ as ke,b as M,er as N,jr as P,o as Ae,or as F,zn as je}from"./DAg9fiVh.js";import{f as I,m as Me}from"./BgPDnf2S.js";import{i as Ne,n as Pe,r as Fe,t as Ie}from"./CKhgznq4.js";import{H as L,I as R,M as Le,N as z,U as Re,k as ze}from"#entry";var B=[`data-pane`],V={class:`plan-cell-head`},H={class:`plan-cell-title`},Be=[`title`],Ve={key:0,class:`plan-cell-detail`},U={key:1,class:`plan-cell-line`},W={key:2,class:`plan-cell-choices`},He=[`disabled`,`onClick`],G={class:`n`},Ue={class:`l`},We=Object.assign(d({__name:`PlanCell`,props:{pane:{},focused:{type:Boolean},fresh:{type:Boolean}},emits:[`open`],setup(t,{emit:n}){let i=t,u=n,d=a(!1),_=e(()=>i.pane.status===`blocked`&&i.pane.prompt?.options?.length?i.pane.prompt:null),ee=e(()=>R(_.value,3)),S=e(()=>N(i.pane)),C=e(()=>S.value&&F(S.value)||(_.value?_.value.question:i.pane.preview)||(i.pane.agent?``:A(i.pane.cwd)));async function w(e,t){d.value=!0,await ne(i.pane.id,e,t)||(d.value=!1)}return v(()=>i.pane.prompt,()=>{d.value=!1}),(e,n)=>{let i=L,a=Re,v=Pe,S=I;return s(),c(`div`,{class:m([`plan-cell`,[(`statusKey`in e?e.statusKey:r(E))(t.pane),{stale:(`paneStale`in e?e.paneStale:r(O))(t.pane),fresh:t.fresh}]]),role:`button`,tabindex:`0`,"data-pane":t.pane.id,onClick:n[0]||=e=>u(`open`),onKeydown:n[1]||=b(x(e=>u(`open`),[`self`]),[`enter`])},[f(v,{items:()=>(`paneItems`in e?e.paneItems:r(T))(t.pane),title:(`paneTitle`in e?e.paneTitle:r(P))(t.pane),"manual-press":``},{default:y(()=>[g(`div`,V,[f(i,{agent:t.pane.agent},null,8,[`agent`]),g(`span`,H,h((`paneTitle`in e?e.paneTitle:r(P))(t.pane)),1),t.focused?(s(),c(`span`,{key:0,class:`plan-cell-focus`,title:(`t`in e?e.t:r(D))(`Active pane in Herdr`)},null,8,Be)):o(``,!0),f(a,{items:()=>(`paneItems`in e?e.paneItems:r(T))(t.pane),title:(`paneTitle`in e?e.paneTitle:r(P))(t.pane),size:`sm`,label:(`t`in e?e.t:r(D))(`Pane options`)},null,8,[`items`,`title`,`label`])])]),_:1},8,[`items`,`title`]),f(S,{pane:t.pane,model:``},null,8,[`pane`]),r(_)?.detail?(s(),c(`code`,Ve,h((`detailLine`in e?e.detailLine:r(z))(r(_).detail)),1)):o(``,!0),r(C)?(s(),c(`p`,U,h(r(C)),1)):o(``,!0),r(ee).length?(s(),c(`div`,W,[(s(!0),c(p,null,l(r(ee),n=>(s(),c(`button`,{key:n.i,type:`button`,disabled:r(d)||!(`eventsOpen`in e?e.eventsOpen:r(ge))||(`offlineView`in e?e.offlineView:r(k))||(`paneStale`in e?e.paneStale:r(O))(t.pane),onClick:x(e=>w(n.i,n.label),[`stop`])},[g(`span`,G,h(n.i+1),1),g(`span`,Ue,h(n.label),1)],8,He))),128))])):o(``,!0)],42,B)}}}),{__name:`PlanCell`});function Ge(e,t,n,r,i){return e?`open`:t&&n&&(i||r)?`unavailable`:`loading`}var Ke={id:`tabview`,class:`view`},qe={class:`top bar tab-top`},Je={class:`tab-head`},Ye={class:`tab-title`},Xe={class:`tab-meta`},Ze={class:`tab-meta-tab`},Qe={key:0},$e=[`title`],et={class:`machine-inline-name`},tt={key:2,class:`chat-empty`},nt={key:3,class:`chat-empty`},rt=[`onPointerdown`],it=[`aria-orientation`,`aria-label`,`aria-valuenow`,`onPointerdown`,`onKeydown`],at={key:5,class:`plan-wrap`},ot=[`onPointerdown`],st=[`aria-orientation`,`aria-label`,`onPointerdown`],ct=Object.assign(d({__name:`TabView`,props:{tabId:{}},setup(d){let b=d,x=fe(),ne=pe();u(()=>{M.value||(ke.value=null)});let E=e(()=>ce(b.tabId)),ge=e(()=>E.value&&Se(ue(E.value.tab.workspace).length).headerAdd),O=e(()=>E.value?j.value.workspaces.find(e=>e.id===E.value.tab.workspace):void 0),A=e(()=>new Map((E.value?.panes||[]).map(e=>[e.id,e]))),N=a(null),F=e(()=>N.value||E.value?.layout||null),I=e(()=>F.value?xe(F.value).filter(e=>A.value.has(e.pane)):[]),L=e(()=>!k.value&&oe(b.tabId)),R=e(()=>L.value&&F.value?Ce(F.value):[]),z=e(()=>he.value&&E.value?ve(E.value.tab.machine):void 0),B=(e,t)=>e||String(t),V=a(!!E.value),H=a(!1),Be=setTimeout(()=>{H.value=!0},4e3);n(()=>clearTimeout(Be)),v(E,e=>{e&&(V.value=!0)});let Ve=e(()=>Ge(!!E.value,j.value.ok,j.value.ready!==!1,H.value,V.value)===`unavailable`&&!se(b.tabId)),U=a(null),W=e(()=>String(x.query.pane||``));v([E,W],([e,t],n)=>{if(!e)return;let r=e.panes.map(e=>e.id);if(t&&r.includes(t)&&(t!==n?.[1]||!n?.[0]?.panes.some(e=>e.id===t))){U.value=t;return}U.value&&r.includes(U.value)||(U.value=r.includes(t)?t:e.layout.focused&&r.includes(e.layout.focused)?e.layout.focused:r[0]||null)},{immediate:!0});function He(e){U.value!==e&&(U.value=e,ne.replace({query:{pane:e}}))}function G(e){let t=M.value&&E.value&&U.value?Ee(e):0;if(!t)return;e.preventDefault(),e.stopPropagation();let n=be(E.value.layout,U.value,t);n&&He(n)}u(()=>window.addEventListener(`keydown`,G,!0)),n(()=>window.removeEventListener(`keydown`,G,!0));let Ue=()=>[...te(b.tabId),...w()],ct=e(()=>E.value?`${D(`Tab`)} ${B(E.value.tab.label,E.value.tab.number)}`:void 0),K=a(null),q=a(null),lt={center:`Swap`,left:`Place left`,right:`Place right`,up:`Place above`,down:`Place below`};function ut(e,t){let n=K.value?.getBoundingClientRect();return n&&n.width>0&&n.height>0?{px:(e-n.left)/n.width*100,py:(t-n.top)/n.height*100}:null}function dt(e,t,n){L.value&&(q.value={pane:e,pointer:t.pointerId,touch:t.pointerType!==`mouse`,x0:t.clientX,y0:t.clientY,x:t.clientX,y:t.clientY,started:n,over:null,side:null},window.addEventListener(`pointermove`,ft),window.addEventListener(`pointerup`,pt),window.addEventListener(`pointercancel`,mt),window.addEventListener(`keydown`,ht,!0))}function ft(e){let t=q.value;if(!t||e.pointerId!==t.pointer||(t.x=e.clientX,t.y=e.clientY,!t.started&&Math.hypot(t.x-t.x0,t.y-t.y0)>5&&(t.started=!0),!t.started))return;e.preventDefault();let n=ut(t.x,t.y),r=n&&I.value.find(e=>e.pane!==t.pane&&n.px>=e.left&&n.px<=e.left+e.width&&n.py>=e.top&&n.py<=e.top+e.height),i=r&&n?Te(r,n.px,n.py):null,a=r&&i&&E.value&&we(E.value.layout,t.pane,r.pane,i);((a?r.pane:null)!==t.over||(a?i:null)!==t.side)&&(t.over=a?r.pane:null,t.side=a?i:null)}function J(){q.value=null,window.removeEventListener(`pointermove`,ft),window.removeEventListener(`pointerup`,pt),window.removeEventListener(`pointercancel`,mt),window.removeEventListener(`keydown`,ht,!0)}function pt(e){let t=q.value;if(!t||e.pointerId!==t.pointer)return;let n=A.value.get(t.pane);if(t.touch&&X.suppressClick(),J(),t.touch&&bt&&Math.hypot(t.x-t.x0,t.y-t.y0)<=5)return xt(t.pane);t.started&&n&&t.over&&t.side&&le(n,t.over,t.side)}function mt(e){q.value&&e.pointerId===q.value.pointer&&(q.value.touch&&X.suppressClick(),J())}function ht(e){e.key===`Escape`&&(e.preventDefault(),J())}n(()=>{J(),$()});let Y=e(()=>{let e=q.value,t=e?.started&&e.over&&e.side?I.value.find(t=>t.pane===e.over):null;if(!t||!e?.side)return null;let{left:n,top:r,width:i,height:a}=t,o={left:{width:i/2},right:{left:n+i/2,width:i/2},up:{height:a/2},down:{top:r+a/2,height:a/2},center:{}}[e.side];return{side:e.side,label:D(lt[e.side]),style:Object.fromEntries(Object.entries({left:n,top:r,width:i,height:a,...o}).map(([e,t])=>[e,`${t}%`]))}}),gt=e(()=>{let e=q.value,t=e?.started?A.value.get(e.pane):null;if(!t||!e)return null;let n=Math.max(4,Math.min(e.touch?e.x-20:e.x+12,window.innerWidth-250)),r=Math.max(4,e.touch?e.y-56:e.y+14);return{title:P(t),style:{transform:`translate(${n}px, ${r}px)`}}});function _t(e,t){t.button===0&&t.target?.closest?.(`.cell-grip`)&&(t.preventDefault(),dt(e,t,!1))}let vt=null,yt=``,bt=!1;function xt(e){let t=A.value.get(e);t&&(_e(),de(T(t),P(t)))}let X=Le({onPress:()=>{if(vt){if(!L.value)return bt?xt(yt):void 0;_e(),dt(yt,vt,!0)}}});function St(e,t){vt=t,yt=e,bt=!!t.target?.closest?.(`.plan-cell-head`)&&!Fe(t.target),X.down(t)}function Ct(e){X.move(e)}let Z=null,Q=a(null);function wt(e,t){if(t.button!==0||!E.value)return;t.preventDefault(),t.stopPropagation();let n=t.currentTarget;n.setPointerCapture?.(t.pointerId),Z={d:e,pointer:t.pointerId,ratio:e.ratio,el:n},Q.value=e.path,n.addEventListener(`pointermove`,Tt),n.addEventListener(`pointerup`,Et),n.addEventListener(`pointercancel`,$)}function Tt(e){let t=Z,n=ut(e.clientX,e.clientY);t&&e.pointerId===t.pointer&&n&&E.value&&(t.ratio=De(E.value.layout,t.d,t.d.direction===`right`?n.px:n.py),N.value=je(E.value.layout,t.d.path,t.ratio))}function Et(e){let t=Z;t&&e.pointerId===t.pointer&&($(),Math.abs(t.ratio-t.d.ratio)>=.005&&C(b.tabId,t.d.path,t.ratio))}function $(){let e=Z;Z=null,Q.value=null,N.value=null,e&&(e.el.removeEventListener(`pointermove`,Tt),e.el.removeEventListener(`pointerup`,Et),e.el.removeEventListener(`pointercancel`,$))}function Dt(e,t){let n={ArrowLeft:-1,ArrowUp:-1,ArrowRight:1,ArrowDown:1}[t.key];if(!n||!E.value||e.direction===`right`!=(t.key===`ArrowLeft`||t.key===`ArrowRight`))return;t.preventDefault();let r=De(E.value.layout,e,e.start+e.size*(e.ratio+n*.05));r!==e.ratio&&C(b.tabId,e.path,r)}let Ot=e=>e.direction===`right`?{left:`${e.at}%`,top:`${e.from}%`,height:`${e.span}%`}:{top:`${e.at}%`,left:`${e.from}%`,width:`${e.span}%`};function kt(e){X.swallowClick()||(_e(),me(S(e)))}return(e,n)=>{let a=Ne,u=ie,v=re,b=ze,x=Re,S=Pe,C=Me,w=Ie,te=We;return s(),c(`section`,Ke,[r(E)?(s(),i(a,{key:0,workspace:r(E).tab.workspace,current:d.tabId},null,8,[`workspace`,`current`])):o(``,!0),f(S,{items:Ue,title:r(ct),disabled:!r(E)},{default:y(()=>[g(`header`,qe,[f(u,{icon:`i-lucide-chevron-left`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn back tab-back`,"aria-label":(`t`in e?e.t:r(D))(`Back`),to:`/`},null,8,[`aria-label`]),g(`div`,Je,[g(`div`,Ye,[r(O)?.worktree?(s(),i(v,{key:0,name:`i-lucide-git-branch`,class:`tab-title-branch`})):o(``,!0),t(h(r(O)?.label||`—`),1)]),g(`div`,Xe,[g(`span`,Ze,h((`t`in e?e.t:r(D))(`Tab`))+` `+h(r(E)?B(r(E).tab.label,r(E).tab.number):``),1),r(E)?(s(),c(`span`,Qe,h(`${r(E).panes.length} pane${r(E).panes.length>1?`s`:``}`),1)):o(``,!0),r(E)?.layout.zoomed?(s(),c(`span`,{key:1,class:`tab-meta-zoom`,title:(`t`in e?e.t:r(D))(`A pane is zoomed in Herdr`)},`zoom`,8,$e)):o(``,!0),r(z)?(s(),c(`span`,{key:2,class:m([`tab-meta-machine`,r(z).status])},[f(v,{name:r(z).local?`i-lucide-server`:`i-lucide-laptop`},null,8,[`name`]),g(`span`,et,h((`machineName`in e?e.machineName:r(ye))(r(z).key)),1),r(z).local?(s(),i(b,{key:0})):o(``,!0)],2)):o(``,!0)])]),r(ge)&&r(E)?(s(),i(u,{key:0,icon:`i-lucide-plus`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in e?e.t:r(D))(`New tab`),title:(`t`in e?e.t:r(D))(`New tab`),disabled:`offlineView`in e?e.offlineView:r(k),onClick:n[0]||=t=>(`newTab`in e?e.newTab:r(ae))(r(E).tab.workspace)},null,8,[`aria-label`,`title`,`disabled`])):o(``,!0),r(E)?(s(),i(x,{key:1,items:Ue,size:`lg`,title:r(ct),label:(`t`in e?e.t:r(D))(`Tab options`)},null,8,[`title`,`label`])):o(``,!0)])]),_:1},8,[`title`,`disabled`]),!(`desk`in e?e.desk:r(M))&&((`netDown`in e?e.netDown:r(Oe))||(`offlineView`in e?e.offlineView:r(k)))?(s(),i(C,{key:1,label:(`offlineView`in e?e.offlineView:r(k))?(`t`in e?e.t:r(D))(`Last known state`):void 0,at:`cachedAt`in e?e.cachedAt:r(Ae)},null,8,[`label`,`at`])):o(``,!0),r(Ve)?(s(),c(`div`,tt,[f(v,{name:`i-lucide-layout-panel-left`,class:`chat-empty-icon`}),g(`p`,null,h((`t`in e?e.t:r(D))(`This tab is unavailable.`)),1),f(u,{color:`neutral`,variant:`outline`,to:`/`},{default:y(()=>[t(h((`t`in e?e.t:r(D))(`Back`)),1)]),_:1})])):r(E)?r(E)&&(`desk`in e?e.desk:r(M))?(s(),c(`div`,{key:4,ref_key:`area`,ref:K,class:m([`split`,{dragging:r(q)?.started,resizing:r(Q)!=null}])},[(s(!0),c(p,null,l(r(I),e=>(s(),c(`div`,{key:e.pane,class:m([`split-box`,{"drag-src":r(q)?.started&&r(q).pane===e.pane}]),style:_({left:`${e.left}%`,top:`${e.top}%`,width:`${e.width}%`,height:`${e.height}%`}),onPointerdown:t=>_t(e.pane,t)},[f(w,{cell:``,grip:r(L),"pane-id":e.pane,active:e.pane===r(U),onActivate:t=>He(e.pane)},null,8,[`grip`,`pane-id`,`active`,`onActivate`])],46,rt))),128)),r(Y)?(s(),c(`div`,{key:0,class:m([`drop-zone`,r(Y).side]),style:_(r(Y).style)},[g(`span`,null,h(r(Y).label),1)],6)):o(``,!0),(s(!0),c(p,null,l(r(R),t=>(s(),c(`div`,{key:t.path,class:m([`divider`,[t.direction,{on:r(Q)===t.path}]]),style:_(Ot(t)),role:`separator`,tabindex:`0`,"aria-orientation":t.direction===`right`?`vertical`:`horizontal`,"aria-label":(`t`in e?e.t:r(D))(`Resize`),"aria-valuenow":Math.round(t.ratio*100),"aria-valuemin":`5`,"aria-valuemax":`95`,onPointerdown:e=>wt(t,e),onKeydown:e=>Dt(t,e)},null,46,it))),128))],2)):r(E)?(s(),c(`div`,at,[g(`div`,{ref_key:`area`,ref:K,class:m([`plan`,{dragging:r(q)?.started,resizing:r(Q)!=null,movable:r(L)}])},[(s(!0),c(p,null,l(r(I),e=>(s(),c(`div`,{key:e.pane,class:m([`plan-box`,{"drag-src":r(q)?.started&&r(q).pane===e.pane}]),style:_({left:`${e.left}%`,top:`${e.top}%`,width:`${e.width}%`,height:`${e.height}%`}),onPointerdown:t=>St(e.pane,t),onPointermove:Ct,onPointerup:n[1]||=(...e)=>r(X).cancel&&r(X).cancel(...e),onPointercancel:n[2]||=(...e)=>r(X).cancel&&r(X).cancel(...e)},[f(te,{pane:r(A).get(e.pane),focused:r(E).layout.focused===e.pane&&r(I).length>1,fresh:r(W)===e.pane,onOpen:t=>kt(e.pane)},null,8,[`pane`,`focused`,`fresh`,`onOpen`])],46,ot))),128)),r(Y)?(s(),c(`div`,{key:0,class:m([`drop-zone`,r(Y).side]),style:_(r(Y).style)},[g(`span`,null,h(r(Y).label),1)],6)):o(``,!0),(s(!0),c(p,null,l(r(R),t=>(s(),c(`div`,{key:t.path,class:m([`divider`,[t.direction,{on:r(Q)===t.path}]]),style:_(Ot(t)),role:`separator`,"aria-orientation":t.direction===`right`?`vertical`:`horizontal`,"aria-label":(`t`in e?e.t:r(D))(`Resize`),onPointerdown:e=>wt(t,e)},null,46,st))),128))],2)])):o(``,!0):(s(),c(`div`,nt,h((`t`in e?e.t:r(D))(`Loading…`)),1)),(s(),i(ee,{to:`body`},[r(gt)?(s(),c(`div`,{key:0,class:`drag-ghost`,style:_(r(gt).style)},h(r(gt).title),5)):o(``,!0)]))])}}}),{__name:`TabView`}),K=d({__name:`[tab]`,setup(t){let n=fe(),a=e(()=>String(n.params.tab||``));return(e,t)=>{let n=ct;return s(),i(n,{key:r(a),"tab-id":r(a)},null,8,[`tab-id`])}}});export{K as default};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
const PLUGIN_ID_RE = /^[A-Za-z0-9.:_-]{1,100}$/;
|
|
2
|
-
const ACTION_ID_RE = /^[A-Za-z0-9:_-]{1,100}$/;
|
|
3
|
-
const REMOTE_PROJECTS_SCRIPT = 'export HERDR_BIN_PATH="$1"; shift; bin="$1"; shift; exec "$bin" "$@"';
|
|
4
|
-
function actionContext(pane, workspaces = []) {
|
|
5
|
-
const context = { invocation_source: "wherdr" };
|
|
6
|
-
if (!pane) return context;
|
|
7
|
-
const local = (id) => id.includes("~") ? id.slice(id.indexOf("~") + 1) : id;
|
|
8
|
-
const workspace = workspaces.find((w) => w.id === pane.workspace);
|
|
9
|
-
return {
|
|
10
|
-
...context,
|
|
11
|
-
focused_pane_id: local(pane.id),
|
|
12
|
-
tab_id: local(pane.tab),
|
|
13
|
-
workspace_id: local(pane.workspace),
|
|
14
|
-
workspace_label: (workspace == null ? void 0 : workspace.label) || "",
|
|
15
|
-
workspace_cwd: pane.cwd || "",
|
|
16
|
-
focused_pane_cwd: pane.cwd || ""
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
const AGENT_CONTEXTS = ["workspace", "tab", "pane"];
|
|
20
|
-
const READ_ONLY = /\b(list|lists|show|status|view|info|doctor|check|help|preview|inspect|lister|liste|voir|afficher|état|etat|vérifier|verifier|aide)\b/i;
|
|
21
|
-
function needsConfirm(a) {
|
|
22
|
-
return !(READ_ONLY.test(a.id.replace(/[_:]/g, "-")) || READ_ONLY.test(a.title));
|
|
23
|
-
}
|
|
24
|
-
function shortLabel(title, pluginName) {
|
|
25
|
-
const esc = pluginName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26
|
-
const rest = title.replace(new RegExp(`^${esc}\\s*[:\xB7\u2014\u2013-]\\s*`, "i"), "").trim();
|
|
27
|
-
return rest ? rest[0].toUpperCase() + rest.slice(1) : title;
|
|
28
|
-
}
|
|
29
|
-
const isOwnPlugin = (id) => id === "wherdr" || id.endsWith(".wherdr");
|
|
30
|
-
function opensInHerdr(a) {
|
|
31
|
-
if (a.placement === "popup" || a.placement === "overlay") return true;
|
|
32
|
-
const cmd = Array.isArray(a.command) ? a.command.map(String).join(" ") : "";
|
|
33
|
-
if (/\bplugin\s+pane\s+open\b/.test(cmd)) return true;
|
|
34
|
-
return /(^|[-_:])popup($|[-_:])/i.test(String(a.action_id || ""));
|
|
35
|
-
}
|
|
36
|
-
function normalizeActions(actions, plugins = []) {
|
|
37
|
-
const byId = new Map(plugins.filter((p) => p && p.plugin_id).map((p) => [p.plugin_id, p]));
|
|
38
|
-
const out = [];
|
|
39
|
-
for (const a of actions || []) {
|
|
40
|
-
const plugin = String((a == null ? void 0 : a.plugin_id) || "");
|
|
41
|
-
const id = String((a == null ? void 0 : a.action_id) || "");
|
|
42
|
-
if (!PLUGIN_ID_RE.test(plugin) || !ACTION_ID_RE.test(id) || isOwnPlugin(plugin)) continue;
|
|
43
|
-
const p = byId.get(plugin);
|
|
44
|
-
if (p && p.enabled === false) continue;
|
|
45
|
-
const ctx = (Array.isArray(a.contexts) ? a.contexts : []).map(String);
|
|
46
|
-
const agent = ctx.some((c) => AGENT_CONTEXTS.includes(c));
|
|
47
|
-
const machine = !ctx.length || ctx.includes("global");
|
|
48
|
-
if (!agent && !machine) continue;
|
|
49
|
-
const title = String(a.title || id).replace(/\s+/g, " ").trim().slice(0, 120) || id;
|
|
50
|
-
const description = a.description ? String(a.description).replace(/\s+/g, " ").trim().slice(0, 240) || null : null;
|
|
51
|
-
const pluginName = String((p == null ? void 0 : p.name) || plugin).trim() || plugin;
|
|
52
|
-
out.push({
|
|
53
|
-
plugin,
|
|
54
|
-
pluginName,
|
|
55
|
-
id,
|
|
56
|
-
title,
|
|
57
|
-
label: shortLabel(title, pluginName),
|
|
58
|
-
description,
|
|
59
|
-
agent,
|
|
60
|
-
machine,
|
|
61
|
-
confirm: needsConfirm({ id, title }),
|
|
62
|
-
inHerdr: opensInHerdr(a)
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return out.sort((x, y) => x.pluginName.localeCompare(y.pluginName) || x.label.localeCompare(y.label));
|
|
66
|
-
}
|
|
67
|
-
const ANSI = /\x1B(?:\[[0-?]*[ -/]*[@-~]|\][^\x07\x1B]*(?:\x07|\x1B\\)|[@-Z\\-_])/g;
|
|
68
|
-
function stripAnsi(text) {
|
|
69
|
-
return String(text || "").replace(ANSI, "").replace(/[\x00-\x08\x0B-\x1F\x7F]/g, "");
|
|
70
|
-
}
|
|
71
|
-
function outputTail(text, max = 300) {
|
|
72
|
-
const lines = stripAnsi(text).split("\n").map((l) => l.trim()).filter(Boolean);
|
|
73
|
-
let out = "";
|
|
74
|
-
for (let i = lines.length - 1; i >= 0; i--) {
|
|
75
|
-
const next = out ? `${lines[i]}
|
|
76
|
-
${out}` : lines[i];
|
|
77
|
-
if (next.length > max) {
|
|
78
|
-
if (!out) out = "\u2026" + lines[i].slice(-(max - 1));
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
out = next;
|
|
82
|
-
}
|
|
83
|
-
return out;
|
|
84
|
-
}
|
|
85
|
-
function logResult(log2) {
|
|
86
|
-
const status = (log2 == null ? void 0 : log2.status) === "succeeded" || (log2 == null ? void 0 : log2.status) === "failed" ? log2.status : "running";
|
|
87
|
-
const exitCode = typeof (log2 == null ? void 0 : log2.exit_code) === "number" ? log2.exit_code : null;
|
|
88
|
-
const output = status === "failed" ? outputTail(log2 == null ? void 0 : log2.stderr) || outputTail(log2 == null ? void 0 : log2.error) || outputTail(log2 == null ? void 0 : log2.stdout) : outputTail(log2 == null ? void 0 : log2.stdout) || outputTail(log2 == null ? void 0 : log2.stderr);
|
|
89
|
-
return { status, exitCode, output };
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export { ACTION_ID_RE as A, PLUGIN_ID_RE as P, REMOTE_PROJECTS_SCRIPT as R, actionContext as a, logResult as l, normalizeActions as n, outputTail as o, stripAnsi as s };
|
|
93
|
-
//# sourceMappingURL=pluginPolicy.mjs.map
|
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
import { execFile } from 'node:child_process';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { u as currentMachineSlots, q as paneBaseMachine, H as HerdrError, v as machineFor, x as herdrOn, y as HERDR_CHILD_ENV, z as HERDR_BIN, n as projectOf, B as isProjectThread } from '../nitro/nitro.mjs';
|
|
4
|
-
|
|
5
|
-
const ESCAPES = { b: "\b", t: " ", n: "\n", f: "\f", r: "\r", e: "\x1B", '"': '"', "\\": "\\" };
|
|
6
|
-
function unescapeBasic(s) {
|
|
7
|
-
return s.replace(/\\[ \t]*\n\s*/g, "").replace(/\\(u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|[\s\S])/g, (all, x) => {
|
|
8
|
-
var _a;
|
|
9
|
-
if (x.length > 1) {
|
|
10
|
-
const code = Number.parseInt(x.slice(1), 16);
|
|
11
|
-
return code <= 1114111 ? String.fromCodePoint(code) : all;
|
|
12
|
-
}
|
|
13
|
-
return (_a = ESCAPES[x]) != null ? _a : all;
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
function closing(text, from, quote, basic) {
|
|
17
|
-
for (let i = from; i < text.length; i++) {
|
|
18
|
-
if (basic && text[i] === "\\") {
|
|
19
|
-
i++;
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
if (quote.length === 1 && text[i] === "\n") return -1;
|
|
23
|
-
if (text.startsWith(quote, i)) {
|
|
24
|
-
if (quote.length === 3) while (text[i + 3] === quote[0]) i++;
|
|
25
|
-
return i;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return -1;
|
|
29
|
-
}
|
|
30
|
-
const HEADER = /^[ \t]*\[\[?[ \t]*([A-Za-z0-9_.-]+)[ \t]*\]\]?[ \t]*(?:#.*)?$/;
|
|
31
|
-
const KEY = /^[ \t]*([A-Za-z0-9_-]+)[ \t]*=[ \t]*/;
|
|
32
|
-
function tomlTables(input) {
|
|
33
|
-
const text = String(input || "").replace(/\r\n?/g, "\n");
|
|
34
|
-
let table = { name: "", strings: {}, bare: {} };
|
|
35
|
-
const tables = [table];
|
|
36
|
-
let at = 0;
|
|
37
|
-
while (at < text.length) {
|
|
38
|
-
const eol = text.indexOf("\n", at);
|
|
39
|
-
const line = text.slice(at, eol < 0 ? text.length : eol);
|
|
40
|
-
let next = eol < 0 ? text.length : eol + 1;
|
|
41
|
-
const header = HEADER.exec(line);
|
|
42
|
-
const m = header ? null : KEY.exec(line);
|
|
43
|
-
if (header) {
|
|
44
|
-
table = { name: header[1], strings: {}, bare: {} };
|
|
45
|
-
tables.push(table);
|
|
46
|
-
} else if (m) {
|
|
47
|
-
const start = at + m[0].length;
|
|
48
|
-
const quote = ['"""', "'''", '"', "'"].find((q) => text.startsWith(q, start));
|
|
49
|
-
if (quote) {
|
|
50
|
-
const basic = quote[0] === '"';
|
|
51
|
-
const end = closing(text, start + quote.length, quote, basic);
|
|
52
|
-
if (end >= 0) {
|
|
53
|
-
let raw = text.slice(start + quote.length, end);
|
|
54
|
-
if (quote.length === 3 && raw.startsWith("\n")) raw = raw.slice(1);
|
|
55
|
-
table.strings[m[1]] = basic ? unescapeBasic(raw) : raw;
|
|
56
|
-
const after = text.indexOf("\n", end + quote.length);
|
|
57
|
-
next = after < 0 ? text.length : after + 1;
|
|
58
|
-
}
|
|
59
|
-
} else {
|
|
60
|
-
const value = line.slice(m[0].length).split("#")[0].trim();
|
|
61
|
-
if (value) table.bare[m[1]] = value;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
at = next;
|
|
65
|
-
}
|
|
66
|
-
return tables;
|
|
67
|
-
}
|
|
68
|
-
function tomlStrings(front) {
|
|
69
|
-
return Object.assign({}, ...tomlTables(front).map((t) => t.strings));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const fold = (s) => s.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim();
|
|
73
|
-
const KINDS = [
|
|
74
|
-
["test", /^(a tester|to test|testing|to verify|a verifier|test)$/],
|
|
75
|
-
["decide", /^(a decider|to decide|decisions?|decide|questions?)$/],
|
|
76
|
-
["review", /^(a relire|relire|relecture|to review|review|reviews|code review|pr|prs|pull requests?|a valider|to validate)$/],
|
|
77
|
-
["blocked", /^(bloque(?:e|es|s)?|blocked|on hold|en attente|waiting|stuck)$/],
|
|
78
|
-
["doing", /^(en cours|in progress|doing|ongoing|wip|active)$/],
|
|
79
|
-
["queue", /^(en file|en file d attente|file d attente|file|in queue|queue|queued|up next)$/],
|
|
80
|
-
["todo", /^(a faire|todo|to do|to dos|todos|next|prochainement|soon)$/],
|
|
81
|
-
["backlog", /^(backlog|later|plus tard|idees|ideas|someday|un jour)$/],
|
|
82
|
-
["done", /^(fait|faits|done|termine|terminees?|finished|completed?)$/]
|
|
83
|
-
];
|
|
84
|
-
function listKind(title) {
|
|
85
|
-
var _a, _b;
|
|
86
|
-
const f = fold(title);
|
|
87
|
-
return (_b = (_a = KINDS.find(([, re]) => re.test(f))) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
88
|
-
}
|
|
89
|
-
const THREAD_ID = /\bt-\d{4,}\b/i;
|
|
90
|
-
const TASK_LINE = /^[-*+]\s+(?:\[([ xX])\](?:\s+|$))?(.*)$/;
|
|
91
|
-
const OWNER = /\(([^()]{1,48})\)\s*$/;
|
|
92
|
-
const REFS = /\s*\[\s*t-\d{4,}(?:(?:\s+|\s*[,;]\s*)t-\d{4,})*\s*\]/gi;
|
|
93
|
-
const CAUSE = /^\s*(?:bloqu[eé]e? par|blocked by)\s*:\s*(.+)$/i;
|
|
94
|
-
const ANSI = /\u001b\[[0-?]*[ -/]*[@-~]/g;
|
|
95
|
-
const CONTROL = /[\u0000-\u0008\u000b-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069]/g;
|
|
96
|
-
const MAX_LINE = 2e3;
|
|
97
|
-
const BADGE_COLORS = ["red", "orange", "amber", "green", "teal", "blue", "violet", "pink", "gray"];
|
|
98
|
-
const BADGE = /\[b:\s*([#\w-]*)\s*\((.*?)\)\](?:\(\s*((?:[^\s()]|\([^\s()]*\))*)\s*\))?/gi;
|
|
99
|
-
function badgeColor(raw) {
|
|
100
|
-
const c = raw.trim().toLowerCase();
|
|
101
|
-
if (BADGE_COLORS.includes(c)) return c;
|
|
102
|
-
if (c === "grey") return "gray";
|
|
103
|
-
const h = /^#([0-9a-f]{3}|[0-9a-f]{6})$/.exec(c);
|
|
104
|
-
if (!h) return null;
|
|
105
|
-
const x = h[1];
|
|
106
|
-
return "#" + (x.length === 3 ? [...x].map((d) => d + d).join("") : x);
|
|
107
|
-
}
|
|
108
|
-
function badgeTarget(raw) {
|
|
109
|
-
const v = (raw || "").trim();
|
|
110
|
-
if (/^t-\d{4,}$/i.test(v)) return { thread: v.toLowerCase() };
|
|
111
|
-
if (!/^https?:\/\//i.test(v)) return null;
|
|
112
|
-
try {
|
|
113
|
-
const u = new URL(v);
|
|
114
|
-
return u.protocol === "https:" || u.protocol === "http:" ? { href: u.href } : null;
|
|
115
|
-
} catch {
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
function takeBadges(input) {
|
|
120
|
-
const badges = [];
|
|
121
|
-
const text = input.replace(BADGE, (all, color, label, target2) => {
|
|
122
|
-
const t = label.replace(/\s+/g, " ").trim();
|
|
123
|
-
if (!t) return all;
|
|
124
|
-
badges.push({ text: t, color: badgeColor(color), ...badgeTarget(target2) || {} });
|
|
125
|
-
return " ";
|
|
126
|
-
});
|
|
127
|
-
return badges.length ? { text: text.replace(/\s{2,}/g, " ").trim(), badges } : { text: input, badges };
|
|
128
|
-
}
|
|
129
|
-
function parseTaskLine(line, kind = null) {
|
|
130
|
-
var _a;
|
|
131
|
-
if (line.length > MAX_LINE) return null;
|
|
132
|
-
const m = TASK_LINE.exec(line.replace(ANSI, "").replace(/\t/g, " ").replace(CONTROL, "").trim());
|
|
133
|
-
if (!m) return null;
|
|
134
|
-
const free = takeBadges(m[2].trim());
|
|
135
|
-
let text = free.text.replace(REFS, "").trim();
|
|
136
|
-
let owner = null;
|
|
137
|
-
const o = OWNER.exec(text);
|
|
138
|
-
if (o && o.index > 0 && text[o.index - 1] !== "]") {
|
|
139
|
-
owner = o[1].trim();
|
|
140
|
-
text = text.slice(0, o.index).trim();
|
|
141
|
-
}
|
|
142
|
-
let reason;
|
|
143
|
-
if (kind === "blocked") {
|
|
144
|
-
for (let at = text.indexOf("\u2014"); at > 0; at = text.indexOf("\u2014", at + 1)) {
|
|
145
|
-
if (!/\s/.test(text[at - 1])) continue;
|
|
146
|
-
const cause = CAUSE.exec(text.slice(at + 1));
|
|
147
|
-
if (!((_a = cause == null ? void 0 : cause[1]) == null ? void 0 : _a.trim())) continue;
|
|
148
|
-
reason = cause[1].trim();
|
|
149
|
-
text = text.slice(0, at).trim();
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
if (!text) text = free.badges.map((b) => b.text).join(" \xB7 ");
|
|
154
|
-
if (!text) return null;
|
|
155
|
-
const ref = owner && THREAD_ID.exec(owner);
|
|
156
|
-
return { text, done: m[1] === "x" || m[1] === "X", owner, thread: ref ? ref[0].toLowerCase() : null, ...reason ? { reason } : {}, ...free.badges.length ? { badges: free.badges } : {} };
|
|
157
|
-
}
|
|
158
|
-
function headingTitle(raw) {
|
|
159
|
-
var _a;
|
|
160
|
-
if (!raw.startsWith("##") || !/\s/.test((_a = raw[2]) != null ? _a : "")) return null;
|
|
161
|
-
const body = raw.slice(2).trim();
|
|
162
|
-
if (!body) return null;
|
|
163
|
-
return body.replace(/#+$/, "").trim() || body[0];
|
|
164
|
-
}
|
|
165
|
-
function parseTasks(md) {
|
|
166
|
-
const lists = [];
|
|
167
|
-
let cur = null;
|
|
168
|
-
let fence = false;
|
|
169
|
-
for (const raw of String(md || "").replace(/\r\n?/g, "\n").split("\n")) {
|
|
170
|
-
if (raw.length > MAX_LINE) continue;
|
|
171
|
-
if (/^\s*(```|~~~)/.test(raw)) {
|
|
172
|
-
fence = !fence;
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
if (fence) continue;
|
|
176
|
-
const title = headingTitle(raw);
|
|
177
|
-
if (title) {
|
|
178
|
-
cur = { title, kind: listKind(title), tasks: [] };
|
|
179
|
-
lists.push(cur);
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
if (/^#\s/.test(raw)) {
|
|
183
|
-
cur = null;
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
if (!cur || /^\s/.test(raw)) continue;
|
|
187
|
-
const task = parseTaskLine(raw, cur.kind);
|
|
188
|
-
if (task) cur.tasks.push(task);
|
|
189
|
-
}
|
|
190
|
-
return lists;
|
|
191
|
-
}
|
|
192
|
-
const str = (v) => typeof v === "string" ? v : "";
|
|
193
|
-
function normalizeThreads(raw) {
|
|
194
|
-
if (!Array.isArray(raw)) return [];
|
|
195
|
-
const out = [];
|
|
196
|
-
for (const r of raw) {
|
|
197
|
-
if (!r || typeof r !== "object") continue;
|
|
198
|
-
const id = str(r.id);
|
|
199
|
-
if (!/^t-\d{4,}$/.test(id)) continue;
|
|
200
|
-
const token = str(r.group_token) || (str(r.status) === "resolved" ? "resolved" : "");
|
|
201
|
-
const resolved = str(r.status) === "resolved" || token === "resolved";
|
|
202
|
-
const rank2 = typeof r.rank === "number" && Number.isFinite(r.rank) ? r.rank : resolved ? 6 : 5;
|
|
203
|
-
out.push({
|
|
204
|
-
id,
|
|
205
|
-
title: str(r.title).trim() || id,
|
|
206
|
-
group: str(r.group) || (resolved ? "Resolved" : ""),
|
|
207
|
-
token,
|
|
208
|
-
rank: rank2,
|
|
209
|
-
resolved,
|
|
210
|
-
updated: str(r.updated),
|
|
211
|
-
created: str(r.created),
|
|
212
|
-
agentName: str(r.agent_name) || null,
|
|
213
|
-
machine: str(r.machine),
|
|
214
|
-
profile: str(r.profile) || str(r.agent),
|
|
215
|
-
stateLine: str(r.state_line).trim(),
|
|
216
|
-
activity: str(r.activity).trim(),
|
|
217
|
-
percent: typeof r.percent === "number" && Number.isFinite(r.percent) ? Math.max(0, Math.min(100, Math.round(r.percent))) : null,
|
|
218
|
-
pr: /^https:\/\//.test(str(r.pr)) ? str(r.pr) : "",
|
|
219
|
-
report: typeof r.report === "string" && r.report.length > 0
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
return out;
|
|
223
|
-
}
|
|
224
|
-
const num = (id) => Number(id.slice(2)) || 0;
|
|
225
|
-
const time = (iso) => {
|
|
226
|
-
const t = Date.parse(iso);
|
|
227
|
-
return Number.isFinite(t) ? t : 0;
|
|
228
|
-
};
|
|
229
|
-
function sortOpen(list) {
|
|
230
|
-
return [...list].sort((a, b) => a.rank - b.rank || num(b.id) - num(a.id));
|
|
231
|
-
}
|
|
232
|
-
function sortResolved(list) {
|
|
233
|
-
return [...list].sort((a, b) => time(b.updated) - time(a.updated) || num(b.id) - num(a.id));
|
|
234
|
-
}
|
|
235
|
-
function splitThreads(list) {
|
|
236
|
-
return {
|
|
237
|
-
open: sortOpen(list.filter((t) => !t.resolved)),
|
|
238
|
-
resolved: sortResolved(list.filter((t) => t.resolved))
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
function maxParallelThreads(projectMd) {
|
|
242
|
-
const m = /^\+\+\+\r?\n([\s\S]*?)\r?\n\+\+\+/.exec(String(projectMd || ""));
|
|
243
|
-
if (!m) return null;
|
|
244
|
-
const v = tomlTables(m[1])[0].bare.max_parallel_threads;
|
|
245
|
-
if (v === void 0 || !/^\d+$/.test(v)) return 10;
|
|
246
|
-
const n = Number(v);
|
|
247
|
-
return n >= 1 ? n : null;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
const TASKS_BYTES = 256 * 1024;
|
|
251
|
-
const PROJECT_HEAD_BYTES = 16 * 1024;
|
|
252
|
-
const REPORT_BYTES = 512 * 1024;
|
|
253
|
-
const THREADS_BYTES = 8 * 1024 * 1024;
|
|
254
|
-
const BIN_TTL_MS = 6e4;
|
|
255
|
-
const PLUGIN_ID = "herdr-projects";
|
|
256
|
-
function pluginBinary(plugins) {
|
|
257
|
-
const p = (plugins || []).find((x) => x && x.plugin_id === PLUGIN_ID && x.enabled !== false);
|
|
258
|
-
if (!p || typeof p.plugin_root !== "string" || !path.posix.isAbsolute(p.plugin_root)) return null;
|
|
259
|
-
for (const c of [...p.startup || [], ...p.actions || [], ...p.panes || []]) {
|
|
260
|
-
const argv = Array.isArray(c == null ? void 0 : c.command) ? c.command : [];
|
|
261
|
-
const bin = typeof argv[0] === "string" ? argv[0] : "";
|
|
262
|
-
if (!/(^|\/)herdr-projects$/.test(bin) || bin.split("/").includes("..")) continue;
|
|
263
|
-
return path.posix.isAbsolute(bin) ? bin : path.posix.join(p.plugin_root, bin);
|
|
264
|
-
}
|
|
265
|
-
return null;
|
|
266
|
-
}
|
|
267
|
-
const bins = /* @__PURE__ */ new Map();
|
|
268
|
-
function binaryOn(m) {
|
|
269
|
-
const hit = bins.get(m.key);
|
|
270
|
-
if (hit && Date.now() - hit.at < BIN_TTL_MS) return hit.bin;
|
|
271
|
-
const bin = herdrOn(m.key, "plugin.list", {}, 8e3).then((r) => pluginBinary(r.plugins || []));
|
|
272
|
-
bin.catch(() => bins.delete(m.key));
|
|
273
|
-
bins.set(m.key, { at: Date.now(), bin });
|
|
274
|
-
return bin;
|
|
275
|
-
}
|
|
276
|
-
async function projectDir(m, p) {
|
|
277
|
-
const slug = projectOf(p);
|
|
278
|
-
const cwd = (p.cwd || "").replace(/\/+$/, "");
|
|
279
|
-
if (!slug || !p.agent || isProjectThread(p) || !path.posix.isAbsolute(cwd)) return null;
|
|
280
|
-
if (path.posix.basename(cwd).toLowerCase() !== slug.toLowerCase()) return null;
|
|
281
|
-
const [tasks, project] = await m.fs.statMany([`${cwd}/TASKS.md`, `${cwd}/PROJECT.md`]);
|
|
282
|
-
if (!((tasks == null ? void 0 : tasks.isFile) || (project == null ? void 0 : project.isFile))) return null;
|
|
283
|
-
return { dir: cwd, slug: path.posix.basename(cwd) };
|
|
284
|
-
}
|
|
285
|
-
async function target(pane) {
|
|
286
|
-
const m = machineFor(pane.machine);
|
|
287
|
-
const bin = await binaryOn(m).catch(() => null);
|
|
288
|
-
if (!bin) return null;
|
|
289
|
-
const where = await projectDir(m, pane);
|
|
290
|
-
return where ? { m, bin, ...where } : null;
|
|
291
|
-
}
|
|
292
|
-
async function version(t) {
|
|
293
|
-
const [tasks, threads, project] = await t.m.fs.statMany([`${t.dir}/TASKS.md`, `${t.dir}/threads`, `${t.dir}/PROJECT.md`]);
|
|
294
|
-
const v = `${tasks ? `${tasks.size}.${tasks.mtimeMs}` : "-"}|${threads ? threads.mtimeMs : "-"}|${project ? project.mtimeMs : "-"}`;
|
|
295
|
-
return { v, tasks: (tasks == null ? void 0 : tasks.isFile) ? tasks : null, project: (project == null ? void 0 : project.isFile) ? project : null };
|
|
296
|
-
}
|
|
297
|
-
const REMOTE_RUN = 'export HERDR_BIN_PATH="$1" HERDR_SESSION="$2"; bin="$3"; shift 3; exec "$bin" "$@"';
|
|
298
|
-
function runProjectCommand(t, args, timeoutMs = 15e3, maxBytes = 1024 * 1024) {
|
|
299
|
-
const session = t.m.session && t.m.session !== "default" ? t.m.session : "";
|
|
300
|
-
const remote = t.m.exec;
|
|
301
|
-
if (remote) {
|
|
302
|
-
const herdrBin = t.m.bin || "herdr";
|
|
303
|
-
return remote(REMOTE_RUN, [herdrBin, session, t.bin, ...args], { timeoutMs }).then((r) => {
|
|
304
|
-
var _a;
|
|
305
|
-
return r.stdout.length > maxBytes ? { code: 1, stdout: "", stderr: "output too long" } : { code: (_a = r.code) != null ? _a : 1, stdout: r.stdout.toString("utf8"), stderr: r.stderr };
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
const env = { ...HERDR_CHILD_ENV, HERDR_BIN_PATH: HERDR_BIN };
|
|
309
|
-
if (session) env.HERDR_SESSION = session;
|
|
310
|
-
return new Promise((resolve) => {
|
|
311
|
-
execFile(t.bin, args, { env, timeout: timeoutMs, maxBuffer: maxBytes }, (err, out, stderr) => resolve({
|
|
312
|
-
code: err ? typeof err.code === "number" ? err.code : 1 : 0,
|
|
313
|
-
stdout: String(out),
|
|
314
|
-
stderr: String(stderr || (err ? err.message : ""))
|
|
315
|
-
}));
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
const projectsRoot = (t) => path.posix.dirname(t.dir);
|
|
319
|
-
async function threadList(t) {
|
|
320
|
-
const r = await runProjectCommand(t, ["--root", projectsRoot(t), "thread", "list", t.slug, "--json"], 15e3, THREADS_BYTES);
|
|
321
|
-
if (r.code !== 0) throw new Error(r.stderr.trim().split("\n").pop() || `code ${r.code}`);
|
|
322
|
-
if (r.stdout.length > THREADS_BYTES) throw new Error("thread list too long");
|
|
323
|
-
return r.stdout;
|
|
324
|
-
}
|
|
325
|
-
const lastThreads = /* @__PURE__ */ new Map();
|
|
326
|
-
async function readProjectBoard(pane, since) {
|
|
327
|
-
const t = await target(pane);
|
|
328
|
-
if (!t) return { available: false };
|
|
329
|
-
const ver = await version(t);
|
|
330
|
-
const machine = (await currentMachineSlots().catch(() => [])).find((s) => s.key === paneBaseMachine(pane));
|
|
331
|
-
if (machine == null ? void 0 : machine.max) ver.v += `|m${machine.open}/${machine.max}`;
|
|
332
|
-
if (since && since === ver.v) return { same: true, version: ver.v };
|
|
333
|
-
const [tasksText, projectText, threads] = await Promise.all([
|
|
334
|
-
ver.tasks ? t.m.fs.read(`${t.dir}/TASKS.md`, 0, Math.min(ver.tasks.size, TASKS_BYTES)).then((b) => b.toString("utf8")) : Promise.resolve(null),
|
|
335
|
-
ver.project ? t.m.fs.read(`${t.dir}/PROJECT.md`, 0, Math.min(ver.project.size, PROJECT_HEAD_BYTES)).then((b) => b.toString("utf8")).catch(() => "") : Promise.resolve(""),
|
|
336
|
-
threadList(t).then((out) => ({ list: normalizeThreads(JSON.parse(out)), error: void 0 })).then((r) => {
|
|
337
|
-
lastThreads.set(`${t.m.key}|${t.dir}`, r.list);
|
|
338
|
-
return r;
|
|
339
|
-
}).catch((e) => {
|
|
340
|
-
const last = lastThreads.get(`${t.m.key}|${t.dir}`);
|
|
341
|
-
return last ? { list: last, error: void 0 } : { list: [], error: e.message || "threads illisibles" };
|
|
342
|
-
})
|
|
343
|
-
]);
|
|
344
|
-
const { open, resolved } = splitThreads(threads.list);
|
|
345
|
-
const board = { slug: t.slug, lists: parseTasks(tasksText || ""), open, resolved, version: ver.v };
|
|
346
|
-
if (tasksText === null) board.tasksMissing = true;
|
|
347
|
-
if (threads.error) board.threadsError = threads.error;
|
|
348
|
-
const max = maxParallelThreads(projectText);
|
|
349
|
-
if (max && !threads.error) board.slots = { used: open.length, max };
|
|
350
|
-
if (machine == null ? void 0 : machine.max) board.machineSlots = { label: machine.label, open: machine.open, max: machine.max };
|
|
351
|
-
return board;
|
|
352
|
-
}
|
|
353
|
-
async function readThreadReport(pane, id) {
|
|
354
|
-
if (!/^t-\d{4,}$/.test(id)) throw new HerdrError("bad_thread", "invalid thread");
|
|
355
|
-
const t = await target(pane);
|
|
356
|
-
if (!t) throw new HerdrError("no_project", "project not found");
|
|
357
|
-
const file = `${t.dir}/threads/${id}.md`;
|
|
358
|
-
const st = await t.m.fs.stat(file).catch(() => null);
|
|
359
|
-
if (!st || !st.isFile) throw new HerdrError("no_report", "no report for this thread");
|
|
360
|
-
const len = Math.min(st.size, REPORT_BYTES);
|
|
361
|
-
const text = (await t.m.fs.read(file, 0, len)).toString("utf8");
|
|
362
|
-
return { id, text, truncated: st.size > REPORT_BYTES };
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
export { target as a, binaryOn as b, runProjectCommand as c, tomlTables as d, readThreadReport as e, normalizeThreads as n, projectsRoot as p, readProjectBoard as r, tomlStrings as t };
|
|
366
|
-
//# sourceMappingURL=projectBoard.mjs.map
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { d as tomlTables, a as target } from './projectBoard.mjs';
|
|
2
|
-
import { H as HerdrError } from '../nitro/nitro.mjs';
|
|
3
|
-
|
|
4
|
-
const front = (md) => {
|
|
5
|
-
var _a, _b;
|
|
6
|
-
return (_b = (_a = /^\+\+\+\r?\n([\s\S]*?)\r?\n\+\+\+/.exec(String(md || ""))) == null ? void 0 : _a[1]) != null ? _b : null;
|
|
7
|
-
};
|
|
8
|
-
const cut = (s, max) => (s || "").replace(/\s+/g, " ").trim().slice(0, max);
|
|
9
|
-
function parseProjectSettings(projectMd) {
|
|
10
|
-
var _a, _b;
|
|
11
|
-
const f = front(projectMd);
|
|
12
|
-
if (f === null) return null;
|
|
13
|
-
const tables = tomlTables(f);
|
|
14
|
-
const strings = tables[0].strings;
|
|
15
|
-
const raw = (key) => tables[0].bare[key];
|
|
16
|
-
const defaults = [];
|
|
17
|
-
const pick = (key, value, fallback) => {
|
|
18
|
-
if (value !== void 0) return value;
|
|
19
|
-
defaults.push(key);
|
|
20
|
-
return fallback;
|
|
21
|
-
};
|
|
22
|
-
const int = (key) => {
|
|
23
|
-
const v = raw(key);
|
|
24
|
-
return v !== void 0 && /^\d{1,6}$/.test(v) ? Number(v) : void 0;
|
|
25
|
-
};
|
|
26
|
-
const bool = (key) => {
|
|
27
|
-
const v = raw(key);
|
|
28
|
-
return v === "true" ? true : v === "false" ? false : void 0;
|
|
29
|
-
};
|
|
30
|
-
const settings = {
|
|
31
|
-
name: cut(pick("name", strings.name, ""), 200),
|
|
32
|
-
goal: cut(pick("goal", strings.goal, ""), 2e3),
|
|
33
|
-
// `*_agent`: the keys' names before profiles.
|
|
34
|
-
coordinatorProfile: cut(pick("coordinatorProfile", (_a = strings.coordinator_profile) != null ? _a : strings.coordinator_agent, "claude"), 60),
|
|
35
|
-
threadProfile: cut(pick("threadProfile", (_b = strings.thread_profile) != null ? _b : strings.thread_agent, "claude"), 60),
|
|
36
|
-
maxParallelThreads: pick("maxParallelThreads", int("max_parallel_threads"), 10),
|
|
37
|
-
autoResolveDays: pick("autoResolveDays", int("auto_resolve_days"), 7),
|
|
38
|
-
nudge: pick("nudge", bool("nudge"), true),
|
|
39
|
-
mute: pick("mute", bool("mute"), false),
|
|
40
|
-
repos: tables.filter((t) => t.name === "repos").slice(0, 50).map((t) => ({ path: cut(t.strings.path, 1024), machine: cut(t.strings.machine, 120) })).filter((r) => r.path),
|
|
41
|
-
defaults
|
|
42
|
-
};
|
|
43
|
-
return settings;
|
|
44
|
-
}
|
|
45
|
-
const MEMORY_INDEX = "MEMORY.md";
|
|
46
|
-
const MEMORY_FILE_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,119}\.md$/;
|
|
47
|
-
const memoryFileOk = (name) => typeof name === "string" && MEMORY_FILE_RE.test(name) && !name.includes("..");
|
|
48
|
-
function parseMemoryIndex(indexMd) {
|
|
49
|
-
const out = [];
|
|
50
|
-
for (const line of String(indexMd || "").replace(/\r\n?/g, "\n").split("\n")) {
|
|
51
|
-
const m = /^\s*[-*+]\s+\[([^\]]+)\]\((?:\.\/)?memory\/([^)\s]+)\)\s*(?:[:—–-]\s*)?(.*)$/.exec(line);
|
|
52
|
-
if (!m || !memoryFileOk(m[2]) || out.some((x) => x.name === m[2])) continue;
|
|
53
|
-
out.push({ name: m[2], title: cut(m[1], 160), hook: cut(m[3], 400) });
|
|
54
|
-
}
|
|
55
|
-
return out;
|
|
56
|
-
}
|
|
57
|
-
function memoryFiles(indexMd, names) {
|
|
58
|
-
const files = names.filter(memoryFileOk);
|
|
59
|
-
const listed = parseMemoryIndex(indexMd || "");
|
|
60
|
-
const out = [];
|
|
61
|
-
if (indexMd !== null) out.push({ name: MEMORY_INDEX, title: MEMORY_INDEX, hook: "", index: true });
|
|
62
|
-
for (const l of listed) out.push(files.includes(l.name) ? l : { ...l, missing: true });
|
|
63
|
-
for (const name of files.filter((n) => !listed.some((l) => l.name === n)).sort()) out.push({ name, title: name, hook: "" });
|
|
64
|
-
return out;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const PROJECT_HEAD_BYTES = 32 * 1024;
|
|
68
|
-
const INDEX_BYTES = 128 * 1024;
|
|
69
|
-
const MEMORY_BYTES = 256 * 1024;
|
|
70
|
-
const MEMORY_FILES_MAX = 300;
|
|
71
|
-
async function head(t, file, max) {
|
|
72
|
-
const st = await t.m.fs.stat(file).catch(() => null);
|
|
73
|
-
if (!st || !st.isFile) return null;
|
|
74
|
-
const text = (await t.m.fs.read(file, 0, Math.min(st.size, max))).toString("utf8");
|
|
75
|
-
return { text, truncated: st.size > max };
|
|
76
|
-
}
|
|
77
|
-
async function settingsOn(t) {
|
|
78
|
-
const file = await head(t, `${t.dir}/PROJECT.md`, PROJECT_HEAD_BYTES);
|
|
79
|
-
const settings = file && parseProjectSettings(file.text);
|
|
80
|
-
if (!settings) throw new HerdrError("no_settings", "project settings not found");
|
|
81
|
-
return { settings };
|
|
82
|
-
}
|
|
83
|
-
async function memoryOn(t) {
|
|
84
|
-
const [index, names] = await Promise.all([
|
|
85
|
-
head(t, `${t.dir}/${MEMORY_INDEX}`, INDEX_BYTES),
|
|
86
|
-
t.m.fs.readdir(`${t.dir}/memory`).catch(() => [])
|
|
87
|
-
]);
|
|
88
|
-
return { files: memoryFiles(index ? index.text : null, names.slice(0, MEMORY_FILES_MAX * 4)).slice(0, MEMORY_FILES_MAX) };
|
|
89
|
-
}
|
|
90
|
-
async function memoryFileOn(t, name) {
|
|
91
|
-
if (name !== MEMORY_INDEX && !memoryFileOk(name)) throw new HerdrError("bad_memory", "invalid memory file");
|
|
92
|
-
const file = await head(t, name === MEMORY_INDEX ? `${t.dir}/${MEMORY_INDEX}` : `${t.dir}/memory/${name}`, MEMORY_BYTES);
|
|
93
|
-
if (!file) throw new HerdrError("no_memory", "memory file not found");
|
|
94
|
-
return { name, ...file };
|
|
95
|
-
}
|
|
96
|
-
async function need(pane) {
|
|
97
|
-
const t = await target(pane);
|
|
98
|
-
if (!t) throw new HerdrError("no_project", "project not found");
|
|
99
|
-
return t;
|
|
100
|
-
}
|
|
101
|
-
const readProjectSettings = async (pane) => settingsOn(await need(pane));
|
|
102
|
-
const readProjectMemory = async (pane) => memoryOn(await need(pane));
|
|
103
|
-
const readMemoryFile = async (pane, name) => memoryFileOn(await need(pane), name);
|
|
104
|
-
|
|
105
|
-
export { readMemoryFile as a, readProjectSettings as b, readProjectMemory as r };
|
|
106
|
-
//# sourceMappingURL=projectDocs.mjs.map
|