wherdr 1.3.4 → 2.0.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.
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/072bjdot.js +2 -0
- package/.output/public/_nuxt/8FAMamJX.js +1 -0
- package/.output/public/_nuxt/{AgentView.DzFWBd2A.css → AgentView.CfD2RWZY.css} +1 -1
- package/.output/public/_nuxt/BDNMzG2s.js +1 -0
- package/.output/public/_nuxt/BX8KVYfd.js +1 -0
- package/.output/public/_nuxt/{CJKsMzIp.js → BYZVrreW.js} +1 -1
- package/.output/public/_nuxt/C2aT0CgA.js +62 -0
- package/.output/public/_nuxt/CanLPS0U.js +105 -0
- package/.output/public/_nuxt/DGXKTg7D.js +31 -0
- package/.output/public/_nuxt/{DMLmW6JM.js → DOsw6KCR.js} +41 -42
- package/.output/public/_nuxt/DTiR5P9E.js +25 -0
- package/.output/public/_nuxt/{w7Rm7unj.js → DYKfeNM-.js} +1 -1
- package/.output/public/_nuxt/DZ7VvF3e.js +1 -0
- package/.output/public/_nuxt/DZGKxROq.js +6 -0
- package/.output/public/_nuxt/DeLLm2j1.js +23 -0
- package/.output/public/_nuxt/DumNBIyF.js +1 -0
- package/.output/public/_nuxt/ScQ9FtVj.js +1 -0
- package/.output/public/_nuxt/TS7GZUPU.js +9 -0
- package/.output/public/_nuxt/board.DK5EU4sL.css +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/b6ed1ddd-d6d6-4137-beab-2548b20dd998.json +1 -0
- package/.output/public/_nuxt/entry.BhiYrGAW.css +2 -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 +44 -17
- package/.output/server/chunks/_/machineOrder.mjs +1 -1
- package/.output/server/chunks/_/onboarding.mjs +1 -1
- package/.output/server/chunks/_/package.mjs +9 -3
- package/.output/server/chunks/_/plugins.mjs +92 -125
- package/.output/server/chunks/_/restart.mjs +1 -1
- package/.output/server/chunks/_/selfupdate.mjs +1 -1
- 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 +14073 -10658
- 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 +20 -7
- package/.output/server/chunks/routes/api/choose.post.mjs +31 -17
- 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 +7 -6
- 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 -31
- 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 +7 -6
- 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 +7 -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 +7 -6
- 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 -10
- package/.output/server/chunks/routes/api/plugins/invoke.post.mjs +6 -10
- package/.output/server/chunks/routes/api/plugins/projects.get.mjs +10 -9
- package/.output/server/chunks/routes/api/plugins/projects.post.mjs +11 -8
- 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 +7 -6
- package/.output/server/chunks/routes/api/screen.get.mjs +7 -6
- 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 +7 -6
- 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 -16
- 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 -14
- package/.output/server/chunks/routes/api/{index.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/{gitroot.get.mjs → tasks/board-settings.get.mjs} +12 -14
- 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 -12
- 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 -1445
- 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 +169 -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 +74 -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 +9 -3
- package/skills/wherdr/SKILL.md +24 -173
- package/.output/public/_nuxt/BEJHMUrj.js +0 -1
- package/.output/public/_nuxt/BOtcEDnA.js +0 -1
- package/.output/public/_nuxt/BUaYhQ2r.js +0 -6
- package/.output/public/_nuxt/CJNhn9sA.js +0 -36
- package/.output/public/_nuxt/COCvtdHN.js +0 -89
- package/.output/public/_nuxt/Cl45J6_Q.js +0 -1
- package/.output/public/_nuxt/CndPDbMI.js +0 -2
- package/.output/public/_nuxt/Ctbx58Um.js +0 -23
- package/.output/public/_nuxt/Dl1PHLOB.js +0 -1
- package/.output/public/_nuxt/Nhex3_iH.js +0 -1
- package/.output/public/_nuxt/OpWX45i7.js +0 -89
- package/.output/public/_nuxt/builds/meta/4994f3a4-4126-4f57-a9e5-c7ebb25850bc.json +0 -1
- package/.output/public/_nuxt/dTj21DMs.js +0 -1
- package/.output/public/_nuxt/entry.BohTWE-n.css +0 -2
- package/.output/public/_nuxt/kwSoIiM7.js +0 -1
- package/.output/public/_nuxt/mkEwYka4.js +0 -1
- package/.output/server/chunks/_/pluginPolicy.mjs +0 -93
- package/.output/server/chunks/_/projectBoard.mjs +0 -363
- 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 -30
- package/.output/server/chunks/_/projectsPlugin2.mjs +0 -57
- 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 -148
- package/.output/server/chunks/routes/api/plugins/thread-limits.post.mjs +0 -45
- package/.output/server/chunks/routes/api/project/inbox.get.mjs +0 -44
- package/.output/server/chunks/routes/api/project/inbox.post.mjs +0 -44
- package/.output/server/chunks/routes/api/project/memory.get.mjs +0 -43
- package/.output/server/chunks/routes/api/project/routines.get.mjs +0 -44
- package/.output/server/chunks/routes/api/project/thread.get.mjs +0 -45
- package/.output/server/chunks/routes/api/project/thread.post.mjs +0 -47
- package/bin/install-docker-skill.sh +0 -20
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{B as e,Ot as t,P as n,V as r,gr as i,j as a,sn as o}from"./C25ROUa9.js";import{t as s}from"./Bpoxvzh6.js";import{A as c,ft as l}from"#entry";var u={class:`antialiased bg-white dark:bg-[#020420] dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-[#020420] tracking-wide`},d={class:`max-w-520px text-center`},f=[`textContent`],p=[`textContent`],m=[`textContent`],h={class:`flex items-center justify-center w-full`},g=c({__name:`error-404`,props:{appName:{type:String,default:`Nuxt`},status:{type:Number,default:404},statusText:{type:String,default:`Page not found`},description:{type:String,default:`Sorry, the page you are looking for could not be found.`},backHome:{type:String,default:`Go back home`}},setup(c){let g=c;return l({title:`${g.status} - ${g.statusText} | ${g.appName}`,script:[{innerHTML:`!function(){let e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(let e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver(e=>{for(let t of e)if("childList"===t.type)for(let e of t.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)}).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;let r=function(e){let r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),r.credentials="use-credentials"===e.crossOrigin?"include":"anonymous"===e.crossOrigin?"omit":"same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{innerHTML:`*,:after,:before{box-sizing:border-box;border-style:solid;border-width:0;border-color:var(--un-default-border-color,#e5e7eb)}:after,:before{--un-content:""}html{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}h1,h2{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}h1,h2,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 #0000;--un-ring-shadow:0 0 #0000;--un-shadow-inset: ;--un-shadow:0 0 #0000;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:#93c5fd80;--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }`}]}),(l,g)=>{let _=s;return t(),n(`div`,u,[a(`div`,d,[a(`h1`,{class:`font-semibold leading-none mb-4 sm:text-[110px] tabular-nums text-[80px]`,textContent:i(c.status)},null,8,f),a(`h2`,{class:`font-semibold mb-2 sm:text-3xl text-2xl`,textContent:i(c.statusText)},null,8,p),a(`p`,{class:`mb-4 px-2 text-[#64748B] text-md`,textContent:i(c.description)},null,8,m),a(`div`,h,[r(_,{to:`/`,class:`font-medium hover:text-[#00DC82] text-sm underline underline-offset-3`},{default:o(()=>[e(i(c.backHome),1)]),_:1})])])])}}},[[`__scopeId`,`data-v-b8cc6c10`]]);export{g as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,B as t,Et as n,Fn as r,Hn as i,M as a,Mn as o,N as s,Ot as c,P as l,Pt as u,St as d,U as f,V as p,b as m,fr as h,gr as g,j as _,ln as ee,nn as v,sn as te}from"./C25ROUa9.js";import{gt as ne,vt as y}from"./CDWjMk9C.js";import{Ar as b,Cr as x,N as S,ei as re,ir as C,k as w,pr as ie}from"./OpWX45i7.js";import{p as ae,u as T}from"./CXJnLmWv.js";import{C as oe,G as E,H as D,I as se,Pr as O,T as k,Ur as A,Vr as ce,W as j,Wr as M,_ as N,b as P,di as le,mt as ue,n as F,o as de}from"./COCvtdHN.js";import{_ as fe,c as pe,d as me,f as he,g as ge,l as _e,m as I,s as L,t as ve,u as R}from"./BOtcEDnA.js";import{H as z,U as B}from"#entry";import{c as V,d as H,l as U,n as W,o as ye,r as be,s as G,t as xe,u as K}from"./dTj21DMs.js";var q=[`draggable`],J=[`aria-label`],Y={class:`board-card-head`},X={class:`board-card-title`},Z={class:`board-counts`},Q={key:0,class:`board-note`},Se={key:1,class:`board-note error`},$={class:`board-card-title wrap`},Ce={class:`pp-meta`},we={class:`board-task-row`},Te={class:`pp-task-text`},Ee={key:0,class:`pp-sent`},De={key:0,class:`pp-reason`},Oe={key:1,class:`pp-task-foot`},ke={key:2,class:`board-card-label`},Ae={class:`board-card-head`},je={class:`board-card-title`},Me={key:4,class:`board-card-where`},Ne=Object.assign(f({__name:`BoardCard`,props:{card:{},board:{},sent:{type:Boolean},movable:{type:Boolean},draggable:{type:Boolean}},emits:[`open`,`move`,`dragstart`,`dragend`],setup(n,{emit:r}){let o=n,d=r,f={blocked:A(`Blocked`),todo:A(`Todo`),ongoing:A(`Ongoing`),finished:A(`Finished`)},ee=e(()=>{let e=o.card;return e.kind===`agent`?E(e.pane):e.kind===`project`&&e.stale||E(e.coordinator)}),v=e(()=>{let e=o.card,t=e.kind===`agent`?e.pane:e.coordinator;return[e.kind===`project`?``:e.project,t.machine?se(t.machine):``].filter(Boolean).join(` · `)}),te=()=>o.card.kind===`task`?o.card.moves.map(e=>({label:f[e.to],run:()=>d(`move`,e)})):[],ne=e(()=>{let e=o.card;return e.kind===`project`?e.project||``:e.kind===`thread`?`${e.thread.id.toUpperCase()} · ${e.thread.title}`:e.kind===`task`?e.task.text:O(e.pane)});function b(e){e.target?.closest(`a, button`)||d(`open`)}return(e,r)=>{let o=S,x=I,re=V,C=B,ie=w,ae=G,T=z;return c(),l(`div`,{class:h([`board-card`,[n.card.kind,{stale:i(ee),sent:n.sent,"is-draggable":n.draggable}]]),draggable:n.draggable,onClick:b,onDragstart:r[2]||=e=>d(`dragstart`,e),onDragend:r[3]||=e=>d(`dragend`)},[_(`button`,{type:`button`,class:`board-card-open sr-only`,"aria-label":i(ne),onClick:r[0]||=e=>d(`open`)},null,8,J),n.card.kind===`project`?(c(),l(m,{key:0},[_(`div`,Y,[p(o,{name:`i-lucide-folder`,class:`board-card-icon`}),_(`span`,X,g(n.card.project),1),p(x,{pane:n.card.coordinator},null,8,[`pane`])]),_(`ul`,Z,[(c(!0),l(m,null,u(i(L),e=>(c(),l(`li`,{key:e,class:h([e,{zero:!n.card.counts[e]}])},[_(`b`,null,g(n.card.counts[e]),1),t(` `+g(f[e]),1)],2))),128))]),n.card.stale?(c(),l(`p`,Q,g((`t`in e?e.t:i(A))(`Last known state`)),1)):s(``,!0),n.card.error?(c(),l(`p`,Se,g((`t`in e?e.t:i(A))(n.card.error)),1)):s(``,!0)],64)):n.card.kind===`thread`?(c(),l(m,{key:1},[_(`span`,$,g(n.card.thread.title),1),_(`span`,{class:h([`pill`,(`threadClass`in e?e.threadClass:i(U))(n.card.thread)])},[r[4]||=_(`i`,null,null,-1),t(g((`threadLabel`in e?e.threadLabel:i(K))(n.card.thread)),1)],2),_(`span`,Ce,g((`threadMeta`in e?e.threadMeta:i(H))(n.card.thread)),1)],64)):n.card.kind===`task`?(c(),l(m,{key:2},[_(`div`,we,[r[5]||=_(`span`,{class:`pp-box`},null,-1),_(`span`,Te,[p(re,{text:n.card.task.text},null,8,[`text`])]),n.sent?(c(),l(`span`,Ee,[p(o,{name:`i-lucide-send`}),t(g((`t`in e?e.t:i(A))(`Sent`)),1)])):n.card.moves.length?(c(),l(m,{key:1},[n.movable?(c(),a(C,{key:0,items:te,title:(`t`in e?e.t:i(A))(`Move to…`),label:(`t`in e?e.t:i(A))(`Move to…`),size:`sm`},null,8,[`title`,`label`])):(c(),a(ie,{key:1,icon:`i-lucide-ellipsis`,color:`neutral`,variant:`ghost`,size:`sm`,class:`icon-btn`,"aria-label":(`t`in e?e.t:i(A))(`Move to…`),disabled:``,onClick:r[1]||=y(()=>{},[`stop`])},null,8,[`aria-label`]))],64)):s(``,!0)]),n.card.task.reason?(c(),l(`p`,De,g(n.card.task.reason),1)):s(``,!0),n.card.task.badges?.length?(c(),l(`span`,Oe,[p(ae,{badges:n.card.task.badges,coordinator:n.card.coordinator,board:n.board},null,8,[`badges`,`coordinator`,`board`])])):s(``,!0),n.card.listTitle?(c(),l(`span`,ke,g(n.card.listTitle),1)):s(``,!0)],64)):n.card.kind===`agent`?(c(),l(m,{key:3},[_(`div`,Ae,[p(T,{agent:n.card.pane.agent},null,8,[`agent`]),_(`span`,je,g((`paneTitle`in e?e.paneTitle:i(O))(n.card.pane)),1)]),p(x,{pane:n.card.pane},null,8,[`pane`])],64)):s(``,!0),i(v)?(c(),l(`span`,Me,g(i(v)),1)):s(``,!0)],42,q)}}}),{__name:`BoardCard`}),Pe=null;function Fe(){let t=r(Pe),i=o(``),a=0,s=!1,c;async function l(e=[]){if(D.value||s)return;let n=++a;try{let r=new URLSearchParams;t.value&&r.set(`since`,t.value.version);for(let t of e)r.append(`refresh`,t);let o=await F(`/api/board?${r}`);if(n!==a||(i.value=``,`same`in o))return;t.value=Pe=o;for(let e of o.projects)if(e.board)for(let t of e.panes)W(t,e.board)}catch(e){if(n!==a)return;i.value=e.message,!t.value&&!c&&(c=setTimeout(()=>{c=void 0,l()},3e3))}}let u=e(()=>{let e={};for(let t of k.value.panes){let n=x(t)?.toLowerCase();n&&(e[n]||=[]).push(`${t.id}=${t.status}`)}return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.sort().join(`,`)]))}),d=new Set,f;v(u,(e,n)=>{for(let t of new Set([...Object.keys(e),...Object.keys(n)]))e[t]!==n[t]&&d.add(t);d.size&&(clearTimeout(f),f=setTimeout(()=>{let e=(t.value?.projects||[]).filter(e=>d.has(e.slug.toLowerCase())).map(e=>e.key);d.clear(),l(e)},2500))});let p;function m(){clearInterval(p),clearTimeout(c)}let h=e(()=>b({coordinator:!0,offline:D.value,visible:!0,pageVisible:j.value,available:!0}));return v(h,e=>{m(),e!==`none`&&(l(),p=le(()=>l(),C))},{immediate:!0}),n(()=>{s=!0,a++,m(),clearTimeout(f)}),{board:t,cards:e(()=>R(t.value?.projects??null,k.value.panes)),error:i}}var Ie={id:`board`,class:`view board-view`},Le={class:`top bar board-top`},Re={key:1,class:`notice board-notice`},ze={key:2,class:`board-empty board-loading`},Be=[`aria-label`],Ve=[`aria-pressed`,`onClick`],He={class:`board-cols`},Ue=[`aria-label`,`onDragover`,`onDrop`],We={key:0,class:`board-col-head`},Ge={class:`pp-count`},Ke={class:`board-col-body`},qe={key:0,class:`board-empty`},Je=5,Ye=`boardColumn`,Xe=`boardHiddenProjects`,Ze=`application/x-wherdr-board-task`,Qe=Object.assign(f({__name:`BoardView`,setup(t){let n=ae(),{board:d,cards:f,error:b}=Fe(),x={blocked:A(`Blocked`),todo:A(`Todo`),ongoing:A(`Ongoing`),finished:A(`Finished`)},S=o(!1);function C(){try{let e=JSON.parse(localStorage.getItem(Xe)||`[]`);if(Array.isArray(e))return new Set(e.filter(e=>typeof e==`string`))}catch{}return new Set}let O=r(C());function k(e){O.value=e;try{localStorage.setItem(Xe,JSON.stringify([...e]))}catch{}}let j=e(()=>_e(f.value)),N=e(()=>j.value.filter(e=>O.value.has(e.id)).length),le=e(()=>[[{type:`label`,label:M(`Projects`,`Projets`)},...j.value.map(e=>({type:`checkbox`,label:e.name===null?M(`Other agents`,`Autres agents`):[e.name,e.machine?se(e.machine):``].filter(Boolean).join(` · `),checked:!O.value.has(e.id),onUpdateChecked:t=>{let n=new Set(O.value);t?n.delete(e.id):n.add(e.id),k(n)},onSelect:e=>e.preventDefault()}))],[{label:M(`Show all projects`,`Afficher tous les projets`),icon:`i-lucide-eye`,disabled:!N.value,onSelect:()=>k(new Set)}]]),F=e(()=>N.value?M(`Filter projects: ${N.value} hidden`,`Filtrer les projets : ${N.value} masqué(s)`):M(`Filter projects`,`Filtrer les projets`)),I=e(()=>he(f.value,O.value)),R=e(()=>S.value?{cards:I.value,hidden:0}:me(I.value,Je)),z=e(()=>L.map(e=>({id:e,label:x[e],total:I.value.filter(t=>t.column===e).length,cards:R.value.cards.filter(t=>t.column===e)})));function B(){try{let e=localStorage.getItem(Ye);if(L.includes(e))return e}catch{}return`blocked`}let V=o(B());function H(e){V.value=e;try{localStorage.setItem(Ye,e)}catch{}}let U=e=>e.kind===`task`?d.value?.projects.find(t=>t.panes.includes(e.coordinator.id))?.board??null:null;function W(e){e.kind===`agent`?T(re(e.pane.id)):e.kind===`thread`?ve(e.coordinator,e.project||``,e.thread):ie(e.coordinator)}let G=ce===`en`?`en`:`fr`,K=e=>oe.value&&!D.value&&!E(e.coordinator)&&!!e.coordinator.agent&&!ye.value,q=e=>xe(e.coordinator.id,e.list,e.task.text);async function J(e,t){let n=f.value.find(t=>t.key===e.key);n?.kind===`task`&&n.moves.some(e=>e.action===t.action)&&await be(n.coordinator.id,n.list,t.action,n.task.text,pe(t.action,n.task.text,G))!==!1&&ue(A(`Sent to the coordinator`))}let Y=r(null),X=o(null),Z=e=>Y.value?.moves.find(t=>t.to===e),Q=e=>!!e.dataTransfer?.types.includes(Ze);function Se(e,t){if(!K(e)||q(e)||!t.dataTransfer)return t.preventDefault();Y.value=e,t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(Ze,e.key),t.dataTransfer.setData(`text/plain`,e.task.text)}function $(){Y.value=null,X.value=null}v(f,e=>{let t=Y.value;t&&!e.some(e=>e.key===t.key)&&$()});function Ce(e,t){Q(t)&&Z(e)&&(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect=`move`),X.value=e)}function we(e,t){let n=Z(e),r=Y.value;$(),Q(t)&&n&&r&&(t.preventDefault(),J(r,n))}function Te(){let e=history.state?.back;typeof e==`string`&&e.startsWith(`/`)&&e!==`/board`?n.back():T(`/`,{replace:!0})}return(e,t)=>{let n=w,r=fe,o=ge,f=Ne;return c(),l(`section`,Ie,[_(`header`,Le,[p(n,{icon:`i-lucide-chevron-left`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in e?e.t:i(A))(`Back`),onClick:Te},null,8,[`aria-label`]),_(`h2`,null,g((`t`in e?e.t:i(A))(`Board`)),1),i(j).length?(c(),a(r,{key:0,items:i(le),content:{align:`end`},ui:{content:`hw-dropdown`}},{default:te(()=>[p(n,{icon:`i-lucide-filter`,color:i(N)?`primary`:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn board-filter`,"aria-label":i(F),title:i(F)},null,8,[`color`,`aria-label`,`title`])]),_:1},8,[`items`])):s(``,!0)]),(`offlineView`in e?e.offlineView:i(D))&&(`cachedAt`in e?e.cachedAt:i(de))?(c(),a(o,{key:0,class:`board-offline`,label:(`t`in e?e.t:i(A))(`Last known state`),at:`cachedAt`in e?e.cachedAt:i(de),"date-style":`medium`},null,8,[`label`,`at`])):s(``,!0),i(b)?(c(),l(`div`,Re,g(i(b)),1)):!i(d)&&!(`offlineView`in e?e.offlineView:i(D))?(c(),l(`p`,ze,g((`t`in e?e.t:i(A))(`Loading…`)),1)):s(``,!0),(`desk`in e?e.desk:i(P))?s(``,!0):(c(),l(`div`,{key:3,class:`board-seg`,role:`group`,"aria-label":(`t`in e?e.t:i(A))(`Board`)},[(c(!0),l(m,null,u(i(z),e=>(c(),l(`button`,{key:e.id,type:`button`,class:h([`board-seg-btn`,[e.id,{on:i(V)===e.id}]]),"aria-pressed":i(V)===e.id,onClick:t=>H(e.id)},[_(`span`,null,g(e.label),1),_(`b`,null,g(e.total),1)],10,Ve))),128))],8,Be)),_(`div`,He,[(c(!0),l(m,null,u(i(z),n=>ee((c(),l(`section`,{key:n.id,class:h([`board-col`,[n.id,{drop:i(Y)&&Z(n.id),over:i(X)===n.id}]]),"aria-label":n.label,onDragover:e=>Ce(n.id,e),onDragleave:t[1]||=y(e=>X.value=null,[`self`]),onDrop:e=>we(n.id,e)},[(`desk`in e?e.desk:i(P))?(c(),l(`h3`,We,[_(`span`,null,g(n.label),1),_(`span`,Ge,g(n.total),1)])):s(``,!0),_(`div`,Ke,[(c(!0),l(m,null,u(n.cards,t=>(c(),a(f,{key:t.key,card:t,board:U(t),sent:t.kind===`task`&&q(t),movable:t.kind===`task`&&K(t),draggable:(`desk`in e?e.desk:i(P))&&t.kind===`task`&&t.moves.length>0&&K(t)&&!q(t),onOpen:e=>W(t),onMove:e=>t.kind===`task`&&J(t,e),onDragstart:e=>t.kind===`task`&&Se(t,e),onDragend:$},null,8,[`card`,`board`,`sent`,`movable`,`draggable`,`onOpen`,`onMove`,`onDragstart`]))),128)),n.cards.length?s(``,!0):(c(),l(`p`,qe,g((`t`in e?e.t:i(A))(`Nothing here`)),1)),n.id===`finished`&&i(R).hidden?(c(),l(`button`,{key:1,type:`button`,class:`board-more`,onClick:t[0]||=e=>S.value=!0},g((`tl`in e?e.tl:i(M))(`Show all (${i(R).hidden} more)`,`Tout afficher (${i(R).hidden} de plus)`)),1)):s(``,!0)])],42,Ue)),[[ne,(`desk`in e?e.desk:i(P))||i(V)===n.id]])),128))])])}}}),{__name:`BoardView`}),$e=f({__name:`board`,setup(e){return d(()=>{N.value=null}),(e,t)=>{let n=Qe;return c(),a(n)}}});export{$e 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,363 +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
|
-
import { m as manifestBinary } from './projectsPlugin.mjs';
|
|
5
|
-
|
|
6
|
-
const ESCAPES = { b: "\b", t: " ", n: "\n", f: "\f", r: "\r", e: "\x1B", '"': '"', "\\": "\\" };
|
|
7
|
-
function unescapeBasic(s) {
|
|
8
|
-
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) => {
|
|
9
|
-
var _a;
|
|
10
|
-
if (x.length > 1) {
|
|
11
|
-
const code = Number.parseInt(x.slice(1), 16);
|
|
12
|
-
return code <= 1114111 ? String.fromCodePoint(code) : all;
|
|
13
|
-
}
|
|
14
|
-
return (_a = ESCAPES[x]) != null ? _a : all;
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
function closing(text, from, quote, basic) {
|
|
18
|
-
for (let i = from; i < text.length; i++) {
|
|
19
|
-
if (basic && text[i] === "\\") {
|
|
20
|
-
i++;
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
if (quote.length === 1 && text[i] === "\n") return -1;
|
|
24
|
-
if (text.startsWith(quote, i)) {
|
|
25
|
-
if (quote.length === 3) while (text[i + 3] === quote[0]) i++;
|
|
26
|
-
return i;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return -1;
|
|
30
|
-
}
|
|
31
|
-
const HEADER = /^[ \t]*\[\[?[ \t]*([A-Za-z0-9_.-]+)[ \t]*\]\]?[ \t]*(?:#.*)?$/;
|
|
32
|
-
const KEY = /^[ \t]*([A-Za-z0-9_-]+)[ \t]*=[ \t]*/;
|
|
33
|
-
function tomlTables(input) {
|
|
34
|
-
const text = String(input || "").replace(/\r\n?/g, "\n");
|
|
35
|
-
let table = { name: "", strings: {}, bare: {} };
|
|
36
|
-
const tables = [table];
|
|
37
|
-
let at = 0;
|
|
38
|
-
while (at < text.length) {
|
|
39
|
-
const eol = text.indexOf("\n", at);
|
|
40
|
-
const line = text.slice(at, eol < 0 ? text.length : eol);
|
|
41
|
-
let next = eol < 0 ? text.length : eol + 1;
|
|
42
|
-
const header = HEADER.exec(line);
|
|
43
|
-
const m = header ? null : KEY.exec(line);
|
|
44
|
-
if (header) {
|
|
45
|
-
table = { name: header[1], strings: {}, bare: {} };
|
|
46
|
-
tables.push(table);
|
|
47
|
-
} else if (m) {
|
|
48
|
-
const start = at + m[0].length;
|
|
49
|
-
const quote = ['"""', "'''", '"', "'"].find((q) => text.startsWith(q, start));
|
|
50
|
-
if (quote) {
|
|
51
|
-
const basic = quote[0] === '"';
|
|
52
|
-
const end = closing(text, start + quote.length, quote, basic);
|
|
53
|
-
if (end >= 0) {
|
|
54
|
-
let raw = text.slice(start + quote.length, end);
|
|
55
|
-
if (quote.length === 3 && raw.startsWith("\n")) raw = raw.slice(1);
|
|
56
|
-
table.strings[m[1]] = basic ? unescapeBasic(raw) : raw;
|
|
57
|
-
const after = text.indexOf("\n", end + quote.length);
|
|
58
|
-
next = after < 0 ? text.length : after + 1;
|
|
59
|
-
}
|
|
60
|
-
} else {
|
|
61
|
-
const value = line.slice(m[0].length).split("#")[0].trim();
|
|
62
|
-
if (value) table.bare[m[1]] = value;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
at = next;
|
|
66
|
-
}
|
|
67
|
-
return tables;
|
|
68
|
-
}
|
|
69
|
-
function tomlStrings(front) {
|
|
70
|
-
return Object.assign({}, ...tomlTables(front).map((t) => t.strings));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const fold = (s) => s.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim();
|
|
74
|
-
const KINDS = [
|
|
75
|
-
["test", /^(a tester|to test|testing|to verify|a verifier|test)$/],
|
|
76
|
-
["decide", /^(a decider|to decide|decisions?|decide|questions?)$/],
|
|
77
|
-
["review", /^(a relire|relire|relecture|to review|review|reviews|code review|pr|prs|pull requests?|a valider|to validate)$/],
|
|
78
|
-
["blocked", /^(bloque(?:e|es|s)?|blocked|on hold|en attente|waiting|stuck)$/],
|
|
79
|
-
["doing", /^(en cours|in progress|doing|ongoing|wip|active)$/],
|
|
80
|
-
["queue", /^(en file|en file d attente|file d attente|file|in queue|queue|queued|up next)$/],
|
|
81
|
-
["todo", /^(a faire|todo|to do|to dos|todos|next|prochainement|soon)$/],
|
|
82
|
-
["backlog", /^(backlog|later|plus tard|idees|ideas|someday|un jour)$/],
|
|
83
|
-
["done", /^(fait|faits|done|termine|terminees?|finished|completed?)$/]
|
|
84
|
-
];
|
|
85
|
-
function listKind(title) {
|
|
86
|
-
var _a, _b;
|
|
87
|
-
const f = fold(title);
|
|
88
|
-
return (_b = (_a = KINDS.find(([, re]) => re.test(f))) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
89
|
-
}
|
|
90
|
-
const THREAD_ID = /\bt-\d{4,}\b/i;
|
|
91
|
-
const TASK_LINE = /^[-*+]\s+(?:\[([ xX])\](?:\s+|$))?(.*)$/;
|
|
92
|
-
const OWNER = /\(([^()]{1,48})\)\s*$/;
|
|
93
|
-
const REFS = /\s*\[\s*t-\d{4,}(?:(?:\s+|\s*[,;]\s*)t-\d{4,})*\s*\]/gi;
|
|
94
|
-
const CAUSE = /^\s*(?:bloqu[eé]e? par|blocked by)\s*:\s*(.+)$/i;
|
|
95
|
-
const ANSI = /\u001b\[[0-?]*[ -/]*[@-~]/g;
|
|
96
|
-
const CONTROL = /[\u0000-\u0008\u000b-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069]/g;
|
|
97
|
-
const MAX_LINE = 2e3;
|
|
98
|
-
const BADGE_COLORS = ["red", "orange", "amber", "green", "teal", "blue", "violet", "pink", "gray"];
|
|
99
|
-
const BADGE = /\[b:\s*([#\w-]*)\s*\((.*?)\)\](?:\(\s*((?:[^\s()]|\([^\s()]*\))*)\s*\))?/gi;
|
|
100
|
-
function badgeColor(raw) {
|
|
101
|
-
const c = raw.trim().toLowerCase();
|
|
102
|
-
if (BADGE_COLORS.includes(c)) return c;
|
|
103
|
-
if (c === "grey") return "gray";
|
|
104
|
-
const h = /^#([0-9a-f]{3}|[0-9a-f]{6})$/.exec(c);
|
|
105
|
-
if (!h) return null;
|
|
106
|
-
const x = h[1];
|
|
107
|
-
return "#" + (x.length === 3 ? [...x].map((d) => d + d).join("") : x);
|
|
108
|
-
}
|
|
109
|
-
function badgeTarget(raw) {
|
|
110
|
-
const v = (raw || "").trim();
|
|
111
|
-
if (/^t-\d{4,}$/i.test(v)) return { thread: v.toLowerCase() };
|
|
112
|
-
if (!/^https?:\/\//i.test(v)) return null;
|
|
113
|
-
try {
|
|
114
|
-
const u = new URL(v);
|
|
115
|
-
return u.protocol === "https:" || u.protocol === "http:" ? { href: u.href } : null;
|
|
116
|
-
} catch {
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
function takeBadges(input) {
|
|
121
|
-
const badges = [];
|
|
122
|
-
const text = input.replace(BADGE, (all, color, label, target2) => {
|
|
123
|
-
const t = label.replace(/\s+/g, " ").trim();
|
|
124
|
-
if (!t) return all;
|
|
125
|
-
badges.push({ text: t, color: badgeColor(color), ...badgeTarget(target2) || {} });
|
|
126
|
-
return " ";
|
|
127
|
-
});
|
|
128
|
-
return badges.length ? { text: text.replace(/\s{2,}/g, " ").trim(), badges } : { text: input, badges };
|
|
129
|
-
}
|
|
130
|
-
function parseTaskLine(line, kind = null) {
|
|
131
|
-
var _a;
|
|
132
|
-
if (line.length > MAX_LINE) return null;
|
|
133
|
-
const m = TASK_LINE.exec(line.replace(ANSI, "").replace(/\t/g, " ").replace(CONTROL, "").trim());
|
|
134
|
-
if (!m) return null;
|
|
135
|
-
const free = takeBadges(m[2].trim());
|
|
136
|
-
let text = free.text.replace(REFS, "").trim();
|
|
137
|
-
let owner = null;
|
|
138
|
-
const o = OWNER.exec(text);
|
|
139
|
-
if (o && o.index > 0 && text[o.index - 1] !== "]") {
|
|
140
|
-
owner = o[1].trim();
|
|
141
|
-
text = text.slice(0, o.index).trim();
|
|
142
|
-
}
|
|
143
|
-
let reason;
|
|
144
|
-
if (kind === "blocked") {
|
|
145
|
-
for (let at = text.indexOf("\u2014"); at > 0; at = text.indexOf("\u2014", at + 1)) {
|
|
146
|
-
if (!/\s/.test(text[at - 1])) continue;
|
|
147
|
-
const cause = CAUSE.exec(text.slice(at + 1));
|
|
148
|
-
if (!((_a = cause == null ? void 0 : cause[1]) == null ? void 0 : _a.trim())) continue;
|
|
149
|
-
reason = cause[1].trim();
|
|
150
|
-
text = text.slice(0, at).trim();
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (!text) text = free.badges.map((b) => b.text).join(" \xB7 ");
|
|
155
|
-
if (!text) return null;
|
|
156
|
-
const ref = owner && THREAD_ID.exec(owner);
|
|
157
|
-
return { text, done: m[1] === "x" || m[1] === "X", owner, thread: ref ? ref[0].toLowerCase() : null, ...reason ? { reason } : {}, ...free.badges.length ? { badges: free.badges } : {} };
|
|
158
|
-
}
|
|
159
|
-
function headingTitle(raw) {
|
|
160
|
-
var _a;
|
|
161
|
-
if (!raw.startsWith("##") || !/\s/.test((_a = raw[2]) != null ? _a : "")) return null;
|
|
162
|
-
const body = raw.slice(2).trim();
|
|
163
|
-
if (!body) return null;
|
|
164
|
-
return body.replace(/#+$/, "").trim() || body[0];
|
|
165
|
-
}
|
|
166
|
-
function parseTasks(md) {
|
|
167
|
-
const lists = [];
|
|
168
|
-
let cur = null;
|
|
169
|
-
let fence = false;
|
|
170
|
-
for (const raw of String(md || "").replace(/\r\n?/g, "\n").split("\n")) {
|
|
171
|
-
if (raw.length > MAX_LINE) continue;
|
|
172
|
-
if (/^\s*(```|~~~)/.test(raw)) {
|
|
173
|
-
fence = !fence;
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
if (fence) continue;
|
|
177
|
-
const title = headingTitle(raw);
|
|
178
|
-
if (title) {
|
|
179
|
-
cur = { title, kind: listKind(title), tasks: [] };
|
|
180
|
-
lists.push(cur);
|
|
181
|
-
continue;
|
|
182
|
-
}
|
|
183
|
-
if (/^#\s/.test(raw)) {
|
|
184
|
-
cur = null;
|
|
185
|
-
continue;
|
|
186
|
-
}
|
|
187
|
-
if (!cur || /^\s/.test(raw)) continue;
|
|
188
|
-
const task = parseTaskLine(raw, cur.kind);
|
|
189
|
-
if (task) cur.tasks.push(task);
|
|
190
|
-
}
|
|
191
|
-
return lists;
|
|
192
|
-
}
|
|
193
|
-
const str = (v) => typeof v === "string" ? v : "";
|
|
194
|
-
function normalizeThreads(raw) {
|
|
195
|
-
if (!Array.isArray(raw)) return [];
|
|
196
|
-
const out = [];
|
|
197
|
-
for (const r of raw) {
|
|
198
|
-
if (!r || typeof r !== "object") continue;
|
|
199
|
-
const id = str(r.id);
|
|
200
|
-
if (!/^t-\d{4,}$/.test(id)) continue;
|
|
201
|
-
const token = str(r.group_token) || (str(r.status) === "resolved" ? "resolved" : "");
|
|
202
|
-
const resolved = str(r.status) === "resolved" || token === "resolved";
|
|
203
|
-
const rank2 = typeof r.rank === "number" && Number.isFinite(r.rank) ? r.rank : resolved ? 6 : 5;
|
|
204
|
-
out.push({
|
|
205
|
-
id,
|
|
206
|
-
title: str(r.title).trim() || id,
|
|
207
|
-
group: str(r.group) || (resolved ? "Resolved" : ""),
|
|
208
|
-
token,
|
|
209
|
-
rank: rank2,
|
|
210
|
-
resolved,
|
|
211
|
-
updated: str(r.updated),
|
|
212
|
-
created: str(r.created),
|
|
213
|
-
agentName: str(r.agent_name) || null,
|
|
214
|
-
machine: str(r.machine),
|
|
215
|
-
profile: str(r.profile) || str(r.agent),
|
|
216
|
-
stateLine: str(r.state_line).trim(),
|
|
217
|
-
activity: str(r.activity).trim(),
|
|
218
|
-
percent: typeof r.percent === "number" && Number.isFinite(r.percent) ? Math.max(0, Math.min(100, Math.round(r.percent))) : null,
|
|
219
|
-
pr: /^https:\/\//.test(str(r.pr)) ? str(r.pr) : "",
|
|
220
|
-
report: typeof r.report === "string" && r.report.length > 0
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
return out;
|
|
224
|
-
}
|
|
225
|
-
const num = (id) => Number(id.slice(2)) || 0;
|
|
226
|
-
const time = (iso) => {
|
|
227
|
-
const t = Date.parse(iso);
|
|
228
|
-
return Number.isFinite(t) ? t : 0;
|
|
229
|
-
};
|
|
230
|
-
function sortOpen(list) {
|
|
231
|
-
return [...list].sort((a, b) => a.rank - b.rank || num(b.id) - num(a.id));
|
|
232
|
-
}
|
|
233
|
-
function sortResolved(list) {
|
|
234
|
-
return [...list].sort((a, b) => time(b.updated) - time(a.updated) || num(b.id) - num(a.id));
|
|
235
|
-
}
|
|
236
|
-
function splitThreads(list) {
|
|
237
|
-
return {
|
|
238
|
-
open: sortOpen(list.filter((t) => !t.resolved)),
|
|
239
|
-
resolved: sortResolved(list.filter((t) => t.resolved))
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
function maxParallelThreads(projectMd) {
|
|
243
|
-
const m = /^\+\+\+\r?\n([\s\S]*?)\r?\n\+\+\+/.exec(String(projectMd || ""));
|
|
244
|
-
if (!m) return null;
|
|
245
|
-
const v = tomlTables(m[1])[0].bare.max_parallel_threads;
|
|
246
|
-
if (v === void 0 || !/^\d+$/.test(v)) return 10;
|
|
247
|
-
const n = Number(v);
|
|
248
|
-
return n >= 1 ? n : null;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
const TASKS_BYTES = 256 * 1024;
|
|
252
|
-
const PROJECT_HEAD_BYTES = 16 * 1024;
|
|
253
|
-
const REPORT_BYTES = 512 * 1024;
|
|
254
|
-
const THREADS_BYTES = 8 * 1024 * 1024;
|
|
255
|
-
const BIN_TTL_MS = 6e4;
|
|
256
|
-
const PLUGIN_ID = "herdr-projects";
|
|
257
|
-
function pluginBinary(plugins) {
|
|
258
|
-
const p = (plugins || []).find((x) => x && x.plugin_id === PLUGIN_ID && x.enabled !== false);
|
|
259
|
-
if (!p || typeof p.plugin_root !== "string" || !path.posix.isAbsolute(p.plugin_root)) return null;
|
|
260
|
-
const bin = manifestBinary(p);
|
|
261
|
-
if (!bin) return null;
|
|
262
|
-
return path.posix.isAbsolute(bin) ? bin : path.posix.join(p.plugin_root, bin);
|
|
263
|
-
}
|
|
264
|
-
const bins = /* @__PURE__ */ new Map();
|
|
265
|
-
function binaryOn(m) {
|
|
266
|
-
const hit = bins.get(m.key);
|
|
267
|
-
if (hit && Date.now() - hit.at < BIN_TTL_MS) return hit.bin;
|
|
268
|
-
const bin = herdrOn(m.key, "plugin.list", {}, 8e3).then((r) => pluginBinary(r.plugins || []));
|
|
269
|
-
bin.catch(() => bins.delete(m.key));
|
|
270
|
-
bins.set(m.key, { at: Date.now(), bin });
|
|
271
|
-
return bin;
|
|
272
|
-
}
|
|
273
|
-
async function projectDir(m, p) {
|
|
274
|
-
const slug = projectOf(p);
|
|
275
|
-
const cwd = (p.cwd || "").replace(/\/+$/, "");
|
|
276
|
-
if (!slug || !p.agent || isProjectThread(p) || !path.posix.isAbsolute(cwd)) return null;
|
|
277
|
-
if (path.posix.basename(cwd).toLowerCase() !== slug.toLowerCase()) return null;
|
|
278
|
-
const [tasks, project] = await m.fs.statMany([`${cwd}/TASKS.md`, `${cwd}/PROJECT.md`]);
|
|
279
|
-
if (!((tasks == null ? void 0 : tasks.isFile) || (project == null ? void 0 : project.isFile))) return null;
|
|
280
|
-
return { dir: cwd, slug: path.posix.basename(cwd) };
|
|
281
|
-
}
|
|
282
|
-
async function target(pane) {
|
|
283
|
-
const m = machineFor(pane.machine);
|
|
284
|
-
const bin = await binaryOn(m).catch(() => null);
|
|
285
|
-
if (!bin) return null;
|
|
286
|
-
const where = await projectDir(m, pane);
|
|
287
|
-
return where ? { m, bin, ...where } : null;
|
|
288
|
-
}
|
|
289
|
-
async function version(t) {
|
|
290
|
-
const [tasks, threads, project] = await t.m.fs.statMany([`${t.dir}/TASKS.md`, `${t.dir}/threads`, `${t.dir}/PROJECT.md`]);
|
|
291
|
-
const v = `${tasks ? `${tasks.size}.${tasks.mtimeMs}` : "-"}|${threads ? threads.mtimeMs : "-"}|${project ? project.mtimeMs : "-"}`;
|
|
292
|
-
return { v, tasks: (tasks == null ? void 0 : tasks.isFile) ? tasks : null, project: (project == null ? void 0 : project.isFile) ? project : null };
|
|
293
|
-
}
|
|
294
|
-
const REMOTE_RUN = 'export HERDR_BIN_PATH="$1" HERDR_SESSION="$2"; bin="$3"; shift 3; exec "$bin" "$@"';
|
|
295
|
-
function runProjectCommand(t, args, timeoutMs = 15e3, maxBytes = 1024 * 1024) {
|
|
296
|
-
const session = t.m.session && t.m.session !== "default" ? t.m.session : "";
|
|
297
|
-
const remote = t.m.exec;
|
|
298
|
-
if (remote) {
|
|
299
|
-
const herdrBin = t.m.bin || "herdr";
|
|
300
|
-
return remote(REMOTE_RUN, [herdrBin, session, t.bin, ...args], { timeoutMs }).then((r) => {
|
|
301
|
-
var _a;
|
|
302
|
-
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 };
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
const env = { ...HERDR_CHILD_ENV, HERDR_BIN_PATH: HERDR_BIN };
|
|
306
|
-
if (session) env.HERDR_SESSION = session;
|
|
307
|
-
return new Promise((resolve) => {
|
|
308
|
-
execFile(t.bin, args, { env, timeout: timeoutMs, maxBuffer: maxBytes }, (err, out, stderr) => resolve({
|
|
309
|
-
code: err ? typeof err.code === "number" ? err.code : 1 : 0,
|
|
310
|
-
stdout: String(out),
|
|
311
|
-
stderr: String(stderr || (err ? err.message : ""))
|
|
312
|
-
}));
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
const projectsRoot = (t) => path.posix.dirname(t.dir);
|
|
316
|
-
async function threadList(t) {
|
|
317
|
-
const r = await runProjectCommand(t, ["--root", projectsRoot(t), "thread", "list", t.slug, "--json"], 15e3, THREADS_BYTES);
|
|
318
|
-
if (r.code !== 0) throw new Error(r.stderr.trim().split("\n").pop() || `code ${r.code}`);
|
|
319
|
-
if (r.stdout.length > THREADS_BYTES) throw new Error("thread list too long");
|
|
320
|
-
return r.stdout;
|
|
321
|
-
}
|
|
322
|
-
const lastThreads = /* @__PURE__ */ new Map();
|
|
323
|
-
async function readProjectBoard(pane, since) {
|
|
324
|
-
const t = await target(pane);
|
|
325
|
-
if (!t) return { available: false };
|
|
326
|
-
const ver = await version(t);
|
|
327
|
-
const machine = (await currentMachineSlots().catch(() => [])).find((s) => s.key === paneBaseMachine(pane));
|
|
328
|
-
if (machine == null ? void 0 : machine.max) ver.v += `|m${machine.open}/${machine.max}`;
|
|
329
|
-
if (since && since === ver.v) return { same: true, version: ver.v };
|
|
330
|
-
const [tasksText, projectText, threads] = await Promise.all([
|
|
331
|
-
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),
|
|
332
|
-
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(""),
|
|
333
|
-
threadList(t).then((out) => ({ list: normalizeThreads(JSON.parse(out)), error: void 0 })).then((r) => {
|
|
334
|
-
lastThreads.set(`${t.m.key}|${t.dir}`, r.list);
|
|
335
|
-
return r;
|
|
336
|
-
}).catch((e) => {
|
|
337
|
-
const last = lastThreads.get(`${t.m.key}|${t.dir}`);
|
|
338
|
-
return last ? { list: last, error: void 0 } : { list: [], error: e.message || "threads illisibles" };
|
|
339
|
-
})
|
|
340
|
-
]);
|
|
341
|
-
const { open, resolved } = splitThreads(threads.list);
|
|
342
|
-
const board = { slug: t.slug, lists: parseTasks(tasksText || ""), open, resolved, version: ver.v };
|
|
343
|
-
if (tasksText === null) board.tasksMissing = true;
|
|
344
|
-
if (threads.error) board.threadsError = threads.error;
|
|
345
|
-
const max = maxParallelThreads(projectText);
|
|
346
|
-
if (max && !threads.error) board.slots = { used: open.length, max };
|
|
347
|
-
if (machine == null ? void 0 : machine.max) board.machineSlots = { label: machine.label, open: machine.open, max: machine.max };
|
|
348
|
-
return board;
|
|
349
|
-
}
|
|
350
|
-
async function readThreadReport(pane, id) {
|
|
351
|
-
if (!/^t-\d{4,}$/.test(id)) throw new HerdrError("bad_thread", "invalid thread");
|
|
352
|
-
const t = await target(pane);
|
|
353
|
-
if (!t) throw new HerdrError("no_project", "project not found");
|
|
354
|
-
const file = `${t.dir}/threads/${id}.md`;
|
|
355
|
-
const st = await t.m.fs.stat(file).catch(() => null);
|
|
356
|
-
if (!st || !st.isFile) throw new HerdrError("no_report", "no report for this thread");
|
|
357
|
-
const len = Math.min(st.size, REPORT_BYTES);
|
|
358
|
-
const text = (await t.m.fs.read(file, 0, len)).toString("utf8");
|
|
359
|
-
return { id, text, truncated: st.size > REPORT_BYTES };
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
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 };
|
|
363
|
-
//# 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
|