dev-process-kit 0.0.16 → 0.0.17
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/dist/chunks/{shared-DFT6VIi_.js → shared-3uutHtJD.js} +1 -1
- package/dist/chunks/{shared-BYBLt-RG.js → shared-B9XMvOh-.js} +1 -1
- package/dist/chunks/{shared-B0kk4Png.js → shared-B_MRyp8K.js} +1 -1
- package/dist/chunks/{shared-CYcKSitA.js → shared-BnGxP2qu.js} +3 -3
- package/dist/chunks/{shared-6yS1zZwk.js → shared-Bnqz77V3.js} +1 -1
- package/dist/chunks/{shared-DLpKWOi6.js → shared-CLSKGVCT.js} +1 -1
- package/dist/chunks/{shared-BMyu-cIr.js → shared-C_Ru__JO.js} +1 -1
- package/dist/chunks/{shared-C1OgX-P6.js → shared-CjhDJ2vV.js} +56 -56
- package/dist/chunks/shared-CtHWU02m.js +1 -0
- package/dist/chunks/{shared-BqyO8tFt.js → shared-D7TEJdR2.js} +1 -1
- package/dist/chunks/{shared-DlMlDHZ3.js → shared-DG16QEdg.js} +1 -1
- package/dist/chunks/shared-DmOHk6B_.js +3457 -0
- package/dist/chunks/{shared-56aw61Mt.js → shared-OIF3QVAa.js} +1 -1
- package/dist/chunks/{shared-CHPc3-vO.js → shared-QJPpnJIO.js} +1 -1
- package/dist/chunks/{shared-wOFcYu2a.js → shared-XCFMpX43.js} +1 -1
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/delegation-poker.js +1 -1
- package/dist/templates/event-storming.js +1 -1
- package/dist/templates/example-mapping.js +1 -1
- package/dist/templates/grill.js +1 -1
- package/dist/templates/plain.js +1 -1
- package/dist/templates/prototype.js +1 -1
- package/dist/templates/slides.js +1 -1
- package/dist/templates/task-board.js +1 -1
- package/dist/templates/usm.js +1 -1
- package/dist/templates/whiteboard.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/shared-DewUyNUX.js +0 -2245
- package/dist/chunks/shared-sTu0Wlge.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}]];class o{#t;constructor(t,e){this.#t=e,t.addController(this)}hostConnected(){document.addEventListener("pointerdown",this.#e,!0),document.addEventListener("keydown",this.#s)}hostDisconnected(){document.removeEventListener("pointerdown",this.#e,!0),document.removeEventListener("keydown",this.#s)}#e=t=>{t.button!==0||!this.#t.open()||this.#t.closesOn(t.composedPath())&&this.#t.dismiss()};#s=t=>{t.key!=="Escape"||t.isComposing||t.defaultPrevented||!this.#t.open()||this.#t.ownsEscape(t.composedPath())&&(t.preventDefault(),this.#t.dismiss())}}export{o as D,s as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a0 as w,ad as v,ae as s,af as o,ag as _,ah as l,aA as j,aj as B,ak as E,V as $,T as k}from"./shared-
|
|
1
|
+
import{a0 as w,ad as v,ae as s,af as o,ag as _,ah as l,aA as j,aj as B,ak as E,V as $,T as k}from"./shared-CjhDJ2vV.js";const r=w({en:{wholePage:"Whole page",sectionGroup:"Section"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",sectionGroup:"\u30BB\u30AF\u30B7\u30E7\u30F3"}}),x=s({id:j,title:B(l(),E(1))}),c=s({title:o(l(),""),sections:o(_(x),[])}),p=t=>{const e=v(c,t),a=new Set;for(const n of e.sections){if(a.has(n.id))throw new Error(`duplicate section id: ${n.id}`);a.add(n.id)}return{title:e.title,sections:e.sections}},d=()=>({title:"",sections:[]}),i=(t,e)=>t.sections.find(a=>a.id===e),m=t=>t.title===""?"Plain":t.title,u=(t,e,a)=>{switch(a.type){case"section":return i(e,a.id)?.title??a.id;case"page":return t.wholePage;default:return a.id}},g=(t,e,a)=>({title:e.type,targetLabel:u(t,a,e.target),tone:"meta"}),f=t=>`${t.type} ${$(t.target)} ${JSON.stringify(t.payload)}`,h=(t,e)=>e.sections.map(a=>({value:`section:${a.id}`,label:a.title,group:t.sectionGroup})),y=(t,e)=>e,P=(t,e)=>{switch(e.type){case"section":return i(t,e.id)!==void 0;case"page":return!0;default:return!1}},b=t=>{const e=r(t);return{name:"plain",label:"Plain",parseBase:p,emptyBase:d,actions:{},apply:()=>null,hasTarget:P,describe:(a,n)=>g(e,a,n),serialize:f,resolveNavigation:y,commentTargets:a=>h(e,a),title:m}};class T extends k{definitionFor(e){return b(e)}renderRegions(e){return{}}}const S=()=>{customElements.get("dpk-template-plain")||customElements.define("dpk-template-plain",T)},O=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplatePlain:T,definePlainElement:S,describePlainAction:g,emptyPlainBase:d,findSection:i,parsePlainBase:p,plainBaseSchema:c,plainCommentTargets:h,plainDefinitionFor:b,plainHasTarget:P,plainMessages:r,plainTargetLabel:u,plainTitle:m,resolvePlainNavigation:y,serializePlainAction:f},Symbol.toStringTag,{value:"Module"}));export{S as d,O as i};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ad as Ne,ae as b,af as i,ag as f,ah as c,ai as w,aA as h,ap as X,aj as J,ak as V,p as $,v as Re,az as qe,aw as Ie,am as Qe,ao as B,P as Ue,e as He,a0 as Me,V as Ke,R as S,a3 as s,a4 as n,A as Fe,a5 as y,b3 as Z,b4 as je,aI as P,K as Ye,aF as Xe,a2 as Je,T as ee,l as Ve,aM as Ze}from"./shared-C1OgX-P6.js";const oe=["working","waiting","blocked","done"],D=["todo","doing","blocked","done"],ae=["agent","human"],E=["why","what","goals","nonGoals"],T=J(c(),V(1)),eo=b({id:h,name:T,kind:i(w(ae),"agent")}),oo=b({id:h,title:T,status:i(w(D),"todo"),assignee:i(h),note:i(c()),proposed:i(X(),!1),reason:i(c())}),ao=b({id:h,label:i(c()),href:T,kind:i(c()),description:i(c())}),to=b({why:i(c()),what:i(c()),goals:i(f(c()),[]),nonGoals:i(f(c()),[])}),ro=b({id:h,from:i(h),at:i(c()),title:i(c()),body:i(c()),points:i(f(c()),[])}),no=b({id:h,ref:i(T),title:T,description:i(c()),blocking:i(X(),!1),assumption:i(c())}),te=b({title:i(c(),""),status:i(w(oe)),updatedAt:i(c()),context:i(to,{}),members:i(f(eo),[]),todos:i(f(oo),[]),outputs:i(f(ao),[]),log:i(f(ro),[]),questions:i(f(no),[])}),A=(o,e)=>{const a=new Set;for(const t of e){if(a.has(t))throw new Error(`duplicate ${o} id: ${t}`);a.add(t)}},u=o=>o===void 0||o.trim()===""?null:o,W=o=>o.filter(e=>e.trim()!==""),re=o=>{const e=Ne(te,o);A("member",e.members.map(t=>t.id)),A("todo",e.todos.map(t=>t.id)),A("output",e.outputs.map(t=>t.id)),A("log",e.log.map(t=>t.id)),A("question",e.questions.map(t=>t.id));const a=new Set(e.members.map(t=>t.id));for(const t of e.todos)if(t.assignee!==void 0&&!a.has(t.assignee))throw new Error(`todo ${t.id} is assigned to ${t.assignee}, which is not in members`);for(const t of e.log){if(t.from!==void 0&&!a.has(t.from))throw new Error(`log entry ${t.id} is from ${t.from}, which is not in members`);if(u(t.title)===null&&u(t.body)===null)throw new Error(`log entry ${t.id} needs a title or a body`)}for(const t of e.questions)if(!t.blocking&&u(t.assumption)===null)throw new Error(`question ${t.id} does not block, so it needs the assumption the agent works on`);return{title:e.title,status:e.status??null,updatedAt:u(e.updatedAt),context:{why:u(e.context.why),what:u(e.context.what),goals:W(e.context.goals),nonGoals:W(e.context.nonGoals)},members:e.members,todos:e.todos.map(t=>({id:t.id,title:t.title,status:t.status,assignee:t.assignee??null,note:u(t.note),proposed:t.proposed,reason:u(t.reason),added:!1})),outputs:e.outputs.map(t=>({id:t.id,label:u(t.label),href:t.href,kind:u(t.kind),description:u(t.description)})),log:e.log.map(t=>({id:t.id,from:t.from??null,at:u(t.at),title:u(t.title),body:u(t.body),points:W(t.points)})),questions:e.questions.map((t,r)=>({id:t.id,ref:t.ref??`Q${r+1}`,title:t.title,description:u(t.description),blocking:t.blocking,assumption:u(t.assumption)})),answers:{},decisions:{}}},ne=()=>({title:"",status:null,updatedAt:null,context:{why:null,what:null,goals:[],nonGoals:[]},members:[],todos:[],outputs:[],log:[],questions:[],answers:{},decisions:{}}),O=(o,e)=>e===null?void 0:o.members.find(a=>a.id===e),k=(o,e)=>o.todos.find(a=>a.id===e),de=(o,e)=>o.log.find(a=>a.id===e),se=o=>E.includes(o),N=(o,e)=>{const a=o.context[e];return typeof a=="string"||a!==null&&a.length>0},z=(o,e)=>o.questions.find(a=>a.id===e),ie=(o,e)=>{const a=o.answers[e.id];return a===void 0?!1:a.kind==="approve"||a.text.trim()!==""},R=(o,e)=>!e.proposed||o.decisions[e.id]==="accept",q=(o,e)=>R(o,e)&&O(o,e.assignee)?.kind==="human",le=(o,e,a)=>{const t={...o};return a===null?delete t[e]:t[e]=a,t},I=(o,e,a)=>({...o,answers:le(o.answers,e,a)}),so=(o,e,a)=>({...o,decisions:le(o.decisions,e,a)}),io=(o,e,a)=>({...o,todos:o.todos.map(t=>t.id===e?a(t):t)}),m={ANSWER_QUESTION:$("ANSWER_QUESTION","question",Qe("kind",[b({kind:B("approve")}),b({kind:B("answer"),text:c()}),b({kind:B("clear")})])),DECIDE_PROPOSAL:$("DECIDE_PROPOSAL","todo",b({decision:w(["accept","decline","clear"])})),SET_TODO_STATUS:$("SET_TODO_STATUS","todo",b({status:w(D)})),ADD_TODO:$("ADD_TODO","page",b({id:h,title:J(c(),Ie(),V(1)),assignee:qe(h)}),{dedupeKey:Re}),DELETE_TODO:$("DELETE_TODO","todo",b({}))},pe={type:"page",id:"task-board"},Q=(o,e)=>({type:"ANSWER_QUESTION",target:{type:"question",id:o},payload:e}),ce=(o,e)=>({type:"DECIDE_PROPOSAL",target:{type:"todo",id:o},payload:{decision:e}}),ue=(o,e)=>({type:"SET_TODO_STATUS",target:{type:"todo",id:o},payload:{status:e}}),be=(o,e,a)=>({type:"ADD_TODO",target:pe,payload:{id:o,title:e,assignee:a}}),ge=o=>({type:"DELETE_TODO",target:{type:"todo",id:o},payload:{}}),he=(o,e)=>{const a=Ue(m,e);if(a===null)return null;const t=a.target.id;switch(a.type){case"ANSWER_QUESTION":{const r=z(o,t);if(r===void 0)return null;const d=a.payload;return d.kind==="clear"?I(o,t,null):d.kind==="approve"?r.assumption===null?null:I(o,t,{kind:"approve"}):I(o,t,{kind:"answer",text:d.text})}case"DECIDE_PROPOSAL":{if(k(o,t)?.proposed!==!0)return null;const{decision:r}=a.payload;return so(o,t,r==="clear"?null:r)}case"SET_TODO_STATUS":{const r=k(o,t);if(r===void 0||!q(o,r))return null;const{status:d}=a.payload;return io(o,t,l=>({...l,status:d}))}case"ADD_TODO":{const{payload:r}=a;return k(o,r.id)!==void 0||r.assignee!==null&&O(o,r.assignee)===void 0?null:{...o,todos:[...o.todos,{id:r.id,title:r.title,status:"todo",assignee:r.assignee,note:null,proposed:!1,reason:null,added:!0}]}}case"DELETE_TODO":return k(o,t)?.added!==!0?null:{...o,todos:o.todos.filter(r=>r.id!==t)};default:return He(a)}},U=Me({en:{wholeBoard:"Whole board",statusWorking:"Working",statusWaiting:"Waiting on you",statusBlocked:"Blocked",statusDone:"Done",todoTodo:"To do",todoDoing:"In progress",todoBlocked:"Blocked",todoDone:"Done",kindAgent:"Agent",kindHuman:"Human",updatedAt:o=>`Updated ${o}`,context:"What this task is about",contextWhy:"Why",contextWhat:"What",contextGoals:"Goals",contextNonGoals:"Non-goals",noContext:"The agent has not written down why and what yet.",tabs:"Board sections",tabContext:"Context",tabLog:"Work log",tabQuestions:"Questions",openCount:o=>`${o} open`,noQuestions:"The agent has nothing to ask right now.",questions:"Questions from the agent",questionsProgress:(o,e)=>`${o} of ${e} replied`,blockingGroup:"Blocking \u2014 the agent waits for your decision",provisionalGroup:"Going ahead on an assumption \u2014 the agent adjusts if you answer otherwise",blockingTag:"Blocking",assumption:"Assumption",recommendation:"Agent recommends",approveAssumption:"OK, go with this",approveRecommendation:"OK, go with the recommendation",answerOther:"Answer differently",answerOf:o=>`Your answer to ${o}`,answerPlaceholder:"What you expect instead\u2026",blockingPlaceholder:"Your decision\u2026",approvedTag:"Approved",answeredTag:"Answered",todos:"Todo",progress:(o,e)=>`${o} of ${e} done`,noTodosYet:"No todos yet",assignee:"Assignee",unassigned:"Unassigned",memberOption:(o,e)=>`${o} (${e})`,statusOf:o=>`Status of \u201C${o}\u201D`,filterTodos:"Show todos",filterAll:"All",filterHuman:"People",doneGroup:o=>`Done (${o})`,noHumanTodos:"Nobody but the agent has a todo.",addedTag:"Added by you",changedTag:"Changed",removeAdded:"Remove this todo you added",noTodos:"There are no todos yet.",newTodo:"New todo",newTodoPlaceholder:"Add a todo for the agent\u2026",newTodoAssignee:"Assignee of the new todo",addTodo:"Add",proposedMark:"Proposed by the agent",reason:"Why",accept:"Accept",decline:"Decline",decisionOf:o=>`Decision on \u201C${o}\u201D`,acceptedTag:"Accepted",declinedTag:"Declined",undoDecision:"Undo",outputs:"Outputs",noOutputs:"Nothing has been produced yet.",copy:o=>`Copy ${o}`,copied:"Copied",log:"Conversation with the agent",logLede:"Newest first",noLog:"Nothing has been exchanged yet.",fromAgent:"Agent",latestTag:"Latest",commentOn:o=>`Comment on ${o}`,todoGroup:"Todo",logGroup:"Log",contextGroup:"Context",proposalGroup:"Proposal",questionGroup:"Question",approved:"Approve the assumption",answered:"Answer",answerCleared:"Clear the reply",accepted:"Accept the proposal",declined:"Decline the proposal",decisionCleared:"Clear the decision",statusChanged:"Change the status",todoAdded:"Add a todo",todoRemoved:"Remove the added todo",quoted:o=>`\u2192 \u201C${o}\u201D`,change:(o,e)=>`${o} \u2192 ${e}`},ja:{wholeBoard:"\u30DC\u30FC\u30C9\u5168\u4F53",statusWorking:"\u4F5C\u696D\u4E2D",statusWaiting:"\u3042\u306A\u305F\u306E\u8FD4\u7B54\u5F85\u3061",statusBlocked:"\u30D6\u30ED\u30C3\u30AF\u4E2D",statusDone:"\u5B8C\u4E86",todoTodo:"\u672A\u7740\u624B",todoDoing:"\u9032\u884C\u4E2D",todoBlocked:"\u30D6\u30ED\u30C3\u30AF",todoDone:"\u5B8C\u4E86",kindAgent:"Agent",kindHuman:"\u4EBA\u9593",updatedAt:o=>`\u66F4\u65B0 ${o}`,context:"\u3053\u306E\u30BF\u30B9\u30AF\u306E\u524D\u63D0",contextWhy:"Why \u2014 \u306A\u305C\u3084\u308B\u304B",contextWhat:"What \u2014 \u4F55\u3092\u3084\u308B\u304B",contextGoals:"\u30B4\u30FC\u30EB",contextNonGoals:"\u3084\u3089\u306A\u3044\u3053\u3068",noContext:"Agent \u306F\u307E\u3060 Why / What \u3092\u66F8\u3044\u3066\u3044\u307E\u305B\u3093\u3002",tabs:"\u30DC\u30FC\u30C9\u306E\u533A\u5206",tabContext:"Context",tabLog:"\u4F5C\u696D\u30ED\u30B0",tabQuestions:"\u8CEA\u554F",openCount:o=>`\u672A\u56DE\u7B54 ${o} \u4EF6`,noQuestions:"\u4ECA Agent \u304B\u3089\u805E\u304D\u305F\u3044\u3053\u3068\u306F\u3042\u308A\u307E\u305B\u3093\u3002",questions:"Agent \u304B\u3089\u306E\u8CEA\u554F",questionsProgress:(o,e)=>`\u8FD4\u7B54\u6E08\u307F ${o} / ${e}`,blockingGroup:"\u30D6\u30ED\u30C3\u30AB\u30FC \u2014 \u6C7A\u3081\u3066\u3082\u3089\u3046\u307E\u3067\u5148\u306B\u9032\u3081\u306A\u3044",provisionalGroup:"\u4EEE\u306E\u524D\u63D0\u3067\u9032\u884C\u4E2D \u2014 \u9055\u3048\u3070\u65B9\u91DD\u3092\u76F4\u3059",blockingTag:"\u30D6\u30ED\u30C3\u30AB\u30FC",assumption:"\u4EEE\u56DE\u7B54",recommendation:"Agent \u306E\u63A8\u5968",approveAssumption:"\u3053\u306E\u524D\u63D0\u3067 OK",approveRecommendation:"\u63A8\u5968\u3069\u304A\u308A\u3067 OK",answerOther:"\u5225\u306E\u56DE\u7B54\u3092\u3059\u308B",answerOf:o=>`${o} \u3078\u306E\u56DE\u7B54`,answerPlaceholder:"\u671F\u5F85\u3059\u308B\u56DE\u7B54\u3092\u5165\u529B\u2026",blockingPlaceholder:"\u3069\u3046\u3059\u308B\u304B\u3092\u5165\u529B\u2026",approvedTag:"\u627F\u8A8D\u6E08\u307F",answeredTag:"\u56DE\u7B54\u6E08\u307F",todos:"Todo",progress:(o,e)=>`${e} \u4EF6\u4E2D ${o} \u4EF6\u5B8C\u4E86`,noTodosYet:"Todo \u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093",assignee:"\u62C5\u5F53",unassigned:"\u672A\u5272\u308A\u5F53\u3066",memberOption:(o,e)=>`${o}\uFF08${e}\uFF09`,statusOf:o=>`\u300C${o}\u300D\u306E\u72B6\u614B`,filterTodos:"\u8868\u793A\u3059\u308B Todo",filterAll:"\u3059\u3079\u3066",filterHuman:"\u4EBA\u9593\u306E\u62C5\u5F53",doneGroup:o=>`\u5B8C\u4E86 ${o} \u4EF6`,noHumanTodos:"\u4EBA\u9593\u304C\u62C5\u5F53\u3059\u308B Todo \u306F\u3042\u308A\u307E\u305B\u3093\u3002",addedTag:"\u3042\u306A\u305F\u304C\u8FFD\u52A0",changedTag:"\u5909\u66F4\u3042\u308A",removeAdded:"\u8FFD\u52A0\u3057\u305F Todo \u3092\u53D6\u308A\u6D88\u3059",noTodos:"Todo \u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002",newTodo:"\u65B0\u3057\u3044 Todo",newTodoPlaceholder:"Agent \u306B\u983C\u3080 Todo \u3092\u8FFD\u52A0\u2026",newTodoAssignee:"\u65B0\u3057\u3044 Todo \u306E\u62C5\u5F53",addTodo:"\u8FFD\u52A0",proposedMark:"Agent \u304B\u3089\u306E\u63D0\u6848",reason:"\u306A\u305C",accept:"\u627F\u8A8D",decline:"\u898B\u9001\u308A",decisionOf:o=>`\u300C${o}\u300D\u306E\u5224\u65AD`,acceptedTag:"\u627F\u8A8D\u6E08\u307F",declinedTag:"\u898B\u9001\u308A",undoDecision:"\u53D6\u308A\u6D88\u3059",outputs:"\u6210\u679C\u7269",noOutputs:"\u307E\u3060\u6210\u679C\u7269\u306F\u3042\u308A\u307E\u305B\u3093\u3002",copy:o=>`${o} \u3092\u30B3\u30D4\u30FC`,copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",log:"Agent \u3068\u306E\u3084\u308A\u3068\u308A",logLede:"\u65B0\u3057\u3044\u9806",noLog:"\u307E\u3060\u3084\u308A\u3068\u308A\u306F\u3042\u308A\u307E\u305B\u3093\u3002",fromAgent:"Agent",latestTag:"\u6700\u65B0",commentOn:o=>`${o} \u306B\u30B3\u30E1\u30F3\u30C8`,todoGroup:"Todo",logGroup:"\u4F5C\u696D\u30ED\u30B0",contextGroup:"Context",proposalGroup:"\u63D0\u6848",questionGroup:"\u8CEA\u554F",approved:"\u524D\u63D0\u3092\u627F\u8A8D",answered:"\u56DE\u7B54",answerCleared:"\u8FD4\u7B54\u3092\u30AF\u30EA\u30A2",accepted:"\u63D0\u6848\u3092\u627F\u8A8D",declined:"\u63D0\u6848\u3092\u898B\u9001\u308A",decisionCleared:"\u63D0\u6848\u306E\u5224\u65AD\u3092\u30AF\u30EA\u30A2",statusChanged:"\u72B6\u614B\u3092\u5909\u66F4",todoAdded:"Todo \u3092\u8FFD\u52A0",todoRemoved:"\u8FFD\u52A0\u3057\u305F Todo \u3092\u53D6\u308A\u6D88\u3057",quoted:o=>`\u2192 \u300C${o}\u300D`,change:(o,e)=>`${o} \u2192 ${e}`}}),ke=(o,e)=>{switch(e){case"working":return o.statusWorking;case"waiting":return o.statusWaiting;case"blocked":return o.statusBlocked;case"done":return o.statusDone}},C=(o,e)=>{switch(e){case"todo":return o.todoTodo;case"doing":return o.todoDoing;case"blocked":return o.todoBlocked;case"done":return o.todoDone}},lo=(o,e)=>e==="agent"?o.kindAgent:o.kindHuman,L=(o,e)=>{switch(e){case"why":return o.contextWhy;case"what":return o.contextWhat;case"goals":return o.contextGoals;case"nonGoals":return o.contextNonGoals}},xe=48,H=o=>{const e=o.title??o.body??o.id;return e.length<=xe?e:`${e.slice(0,xe-1)}\u2026`},po=(o,e,a)=>a===null?o.unassigned:O(e,a)?.name??a,fe=o=>o.title===""?"Task Context Board":o.title,me=(o,e,a)=>{switch(a.type){case"todo":{const t=k(e,a.id);return`${t?.proposed===!0?o.proposalGroup:o.todoGroup} \xB7 ${t?.title??a.id}`}case"log":{const t=de(e,a.id);return`${o.logGroup} \xB7 ${t===void 0?a.id:H(t)}`}case"context":return`${o.contextGroup} \xB7 ${se(a.id)?L(o,a.id):a.id}`;case"question":{const t=z(e,a.id);return t===void 0?a.id:`${t.ref} \xB7 ${t.title}`}case"page":return o.wholeBoard;default:return a.id}},co=(o,e)=>{switch(e){case"accept":return{title:o.accepted,tone:"update"};case"decline":return{title:o.declined,tone:"update"};case"clear":return{title:o.decisionCleared,tone:"delete"}}},uo=(o,e,a)=>{switch(a.type){case"ANSWER_QUESTION":{const t=S(m.ANSWER_QUESTION,a);if(t.kind==="clear")return{title:o.answerCleared,tone:"delete"};if(t.kind==="approve"){const r=z(e,a.target.id)?.assumption??null;return{title:o.approved,tone:"update",...r===null?{}:{body:o.quoted(r)}}}return{title:o.answered,tone:"update",body:o.quoted(t.text.slice(0,120))}}case"DECIDE_PROPOSAL":return co(o,S(m.DECIDE_PROPOSAL,a).decision);case"SET_TODO_STATUS":{const{status:t}=S(m.SET_TODO_STATUS,a),r=k(e,a.target.id)?.status,d=C(o,t);return{title:o.statusChanged,tone:"update",body:r===void 0?d:o.change(C(o,r),d)}}case"ADD_TODO":{const t=S(m.ADD_TODO,a);return{title:o.todoAdded,tone:"create",targetLabel:`${o.todoGroup} \xB7 ${t.title}`,...t.assignee===null?{}:{body:`${o.assignee}: ${po(o,e,t.assignee)}`}}}case"DELETE_TODO":return{title:o.todoRemoved,tone:"delete"};default:return{title:a.type,tone:"meta"}}},ve=(o,e,a,t)=>{let r;try{r=uo(o,t??a,e)}catch{r={title:e.type,tone:"meta"}}return{title:r.title,targetLabel:r.targetLabel??me(o,a,e.target),tone:r.tone,...r.body===void 0?{}:{summary:r.body}}},we=o=>`${o.type} ${Ke(o.target)} ${JSON.stringify(o.payload)}`,$e=(o,e)=>[...e.questions.map(a=>({value:`question:${a.id}`,label:`${a.ref} \xB7 ${a.title}`,group:o.questionGroup})),...e.todos.map(a=>({value:`todo:${a.id}`,label:a.title,group:a.proposed?o.proposalGroup:o.todoGroup})),...e.log.map(a=>({value:`log:${a.id}`,label:H(a),group:o.logGroup})),...E.filter(a=>N(e,a)).map(a=>({value:`context:${a}`,label:L(o,a),group:o.contextGroup}))],ye=(o,e)=>e,Te=(o,e,a)=>({parts:E.filter(t=>N(e,t)).map(t=>{const r=e.context[t];return{id:t,title:L(o,t),text:typeof r=="string"?r:null,items:typeof r=="string"||r===null?[]:r,comments:a(`context:${t}`)}})}),bo=(o,e,a)=>{const t=o.answers[e.id];return{id:e.id,ref:e.ref,title:e.title,description:e.description,blocking:e.blocking,assumption:e.assumption,reply:t?.kind??"none",resolved:ie(o,e),draft:t?.kind==="answer"?t.text:"",comments:a(`question:${e.id}`)}},Ae=(o,e)=>{const a=o.questions.map(r=>bo(o,r,e)),t=a.filter(r=>r.resolved).length;return{blocking:a.filter(r=>r.blocking),provisional:a.filter(r=>!r.blocking),resolved:t,total:a.length,open:a.length-t,blockingOpen:a.filter(r=>r.blocking&&!r.resolved).length}},go=(o,e,a,t,r)=>{const d=k(a,t.id),l=O(e,t.assignee);return{id:t.id,title:t.title,note:t.note,reason:t.reason,status:t.status,statusLabel:C(o,t.status),assignee:t.assignee,assigneeName:l?.name??null,assigneeKind:l?.kind??null,editable:q(e,t),proposal:t.proposed?e.decisions[t.id]??"pending":null,added:t.added,changed:d!==void 0&&d.status!==t.status,comments:r(`todo:${t.id}`)}},Oe=(o,e,a,t,r="all")=>{const d=e.todos.filter(p=>R(e,p)),l=d.filter(p=>p.status==="done").length,g=e.members.some(p=>p.kind==="human"),x=g?r:"all",F=p=>p.assigneeKind==="human",G=e.todos.map(p=>go(o,e,a,p,t)),j=x==="human"?G.filter(F):G,Y=p=>p.status==="done"&&k(a,p.id)?.status==="done";return{todos:j.filter(p=>!Y(p)),done:j.filter(Y),filter:x,canFilter:g,humanCount:G.filter(F).length,progress:{done:l,total:d.length,label:d.length===0?o.noTodosYet:o.progress(l,d.length)},statuses:D.map(p=>({value:p,label:C(o,p)})),members:e.members.map(p=>({id:p.id,label:o.memberOption(p.name,lo(o,p.kind))}))}},Se=o=>{if(!/^[a-z][a-z\d+.-]*:\/\//i.test(o))return{kind:"path"};try{return{kind:"url",host:new URL(o).host}}catch{return{kind:"path"}}},De=o=>o.outputs.map(e=>({id:e.id,title:e.label??e.href,labelled:e.label!==null,href:e.href,kind:e.kind,description:e.description,place:Se(e.href)})),Ee=(o,e,a)=>({entries:e.log.map((t,r)=>{const d=O(e,t.from);return{id:t.id,author:d===void 0?null:{name:d.name,kind:d.kind},at:t.at,title:t.title,body:t.body,points:t.points,label:H(t),latest:r===e.log.length-1,comments:a(`log:${t.id}`)}}).reverse(),status:e.status===null&&e.updatedAt===null?null:{status:e.status,label:e.status===null?null:ke(o,e.status),updatedAt:e.updatedAt}}),ze=(o,e)=>{switch(e.type){case"todo":return k(o,e.id)!==void 0;case"log":return de(o,e.id)!==void 0;case"context":return se(e.id)&&N(o,e.id);case"question":return z(o,e.id)!==void 0;case"page":return!0;default:return!1}},Ce=o=>{const e=U(o);return{name:"task-board",label:"Task Context Board",parseBase:re,emptyBase:ne,actions:m,apply:he,hasTarget:ze,describe:(a,t,r)=>ve(e,a,t,r),serialize:we,resolveNavigation:ye,commentTargets:a=>$e(e,a),title:fe}},_=(o,e,a,t)=>n`
|
|
1
|
+
import{ad as Ne,ae as b,af as i,ag as f,ah as c,ai as w,aA as h,ap as X,aj as J,ak as V,p as $,v as Re,az as qe,aw as Ie,am as Qe,ao as B,P as Ue,e as He,a0 as Me,V as Ke,R as S,a3 as s,a4 as n,A as Fe,a5 as y,b3 as Z,b4 as je,aI as P,K as Ye,aF as Xe,a2 as Je,T as ee,l as Ve,aM as Ze}from"./shared-CjhDJ2vV.js";const oe=["working","waiting","blocked","done"],D=["todo","doing","blocked","done"],ae=["agent","human"],E=["why","what","goals","nonGoals"],T=J(c(),V(1)),eo=b({id:h,name:T,kind:i(w(ae),"agent")}),oo=b({id:h,title:T,status:i(w(D),"todo"),assignee:i(h),note:i(c()),proposed:i(X(),!1),reason:i(c())}),ao=b({id:h,label:i(c()),href:T,kind:i(c()),description:i(c())}),to=b({why:i(c()),what:i(c()),goals:i(f(c()),[]),nonGoals:i(f(c()),[])}),ro=b({id:h,from:i(h),at:i(c()),title:i(c()),body:i(c()),points:i(f(c()),[])}),no=b({id:h,ref:i(T),title:T,description:i(c()),blocking:i(X(),!1),assumption:i(c())}),te=b({title:i(c(),""),status:i(w(oe)),updatedAt:i(c()),context:i(to,{}),members:i(f(eo),[]),todos:i(f(oo),[]),outputs:i(f(ao),[]),log:i(f(ro),[]),questions:i(f(no),[])}),A=(o,e)=>{const a=new Set;for(const t of e){if(a.has(t))throw new Error(`duplicate ${o} id: ${t}`);a.add(t)}},u=o=>o===void 0||o.trim()===""?null:o,W=o=>o.filter(e=>e.trim()!==""),re=o=>{const e=Ne(te,o);A("member",e.members.map(t=>t.id)),A("todo",e.todos.map(t=>t.id)),A("output",e.outputs.map(t=>t.id)),A("log",e.log.map(t=>t.id)),A("question",e.questions.map(t=>t.id));const a=new Set(e.members.map(t=>t.id));for(const t of e.todos)if(t.assignee!==void 0&&!a.has(t.assignee))throw new Error(`todo ${t.id} is assigned to ${t.assignee}, which is not in members`);for(const t of e.log){if(t.from!==void 0&&!a.has(t.from))throw new Error(`log entry ${t.id} is from ${t.from}, which is not in members`);if(u(t.title)===null&&u(t.body)===null)throw new Error(`log entry ${t.id} needs a title or a body`)}for(const t of e.questions)if(!t.blocking&&u(t.assumption)===null)throw new Error(`question ${t.id} does not block, so it needs the assumption the agent works on`);return{title:e.title,status:e.status??null,updatedAt:u(e.updatedAt),context:{why:u(e.context.why),what:u(e.context.what),goals:W(e.context.goals),nonGoals:W(e.context.nonGoals)},members:e.members,todos:e.todos.map(t=>({id:t.id,title:t.title,status:t.status,assignee:t.assignee??null,note:u(t.note),proposed:t.proposed,reason:u(t.reason),added:!1})),outputs:e.outputs.map(t=>({id:t.id,label:u(t.label),href:t.href,kind:u(t.kind),description:u(t.description)})),log:e.log.map(t=>({id:t.id,from:t.from??null,at:u(t.at),title:u(t.title),body:u(t.body),points:W(t.points)})),questions:e.questions.map((t,r)=>({id:t.id,ref:t.ref??`Q${r+1}`,title:t.title,description:u(t.description),blocking:t.blocking,assumption:u(t.assumption)})),answers:{},decisions:{}}},ne=()=>({title:"",status:null,updatedAt:null,context:{why:null,what:null,goals:[],nonGoals:[]},members:[],todos:[],outputs:[],log:[],questions:[],answers:{},decisions:{}}),O=(o,e)=>e===null?void 0:o.members.find(a=>a.id===e),k=(o,e)=>o.todos.find(a=>a.id===e),de=(o,e)=>o.log.find(a=>a.id===e),se=o=>E.includes(o),N=(o,e)=>{const a=o.context[e];return typeof a=="string"||a!==null&&a.length>0},z=(o,e)=>o.questions.find(a=>a.id===e),ie=(o,e)=>{const a=o.answers[e.id];return a===void 0?!1:a.kind==="approve"||a.text.trim()!==""},R=(o,e)=>!e.proposed||o.decisions[e.id]==="accept",q=(o,e)=>R(o,e)&&O(o,e.assignee)?.kind==="human",le=(o,e,a)=>{const t={...o};return a===null?delete t[e]:t[e]=a,t},I=(o,e,a)=>({...o,answers:le(o.answers,e,a)}),so=(o,e,a)=>({...o,decisions:le(o.decisions,e,a)}),io=(o,e,a)=>({...o,todos:o.todos.map(t=>t.id===e?a(t):t)}),m={ANSWER_QUESTION:$("ANSWER_QUESTION","question",Qe("kind",[b({kind:B("approve")}),b({kind:B("answer"),text:c()}),b({kind:B("clear")})])),DECIDE_PROPOSAL:$("DECIDE_PROPOSAL","todo",b({decision:w(["accept","decline","clear"])})),SET_TODO_STATUS:$("SET_TODO_STATUS","todo",b({status:w(D)})),ADD_TODO:$("ADD_TODO","page",b({id:h,title:J(c(),Ie(),V(1)),assignee:qe(h)}),{dedupeKey:Re}),DELETE_TODO:$("DELETE_TODO","todo",b({}))},pe={type:"page",id:"task-board"},Q=(o,e)=>({type:"ANSWER_QUESTION",target:{type:"question",id:o},payload:e}),ce=(o,e)=>({type:"DECIDE_PROPOSAL",target:{type:"todo",id:o},payload:{decision:e}}),ue=(o,e)=>({type:"SET_TODO_STATUS",target:{type:"todo",id:o},payload:{status:e}}),be=(o,e,a)=>({type:"ADD_TODO",target:pe,payload:{id:o,title:e,assignee:a}}),ge=o=>({type:"DELETE_TODO",target:{type:"todo",id:o},payload:{}}),he=(o,e)=>{const a=Ue(m,e);if(a===null)return null;const t=a.target.id;switch(a.type){case"ANSWER_QUESTION":{const r=z(o,t);if(r===void 0)return null;const d=a.payload;return d.kind==="clear"?I(o,t,null):d.kind==="approve"?r.assumption===null?null:I(o,t,{kind:"approve"}):I(o,t,{kind:"answer",text:d.text})}case"DECIDE_PROPOSAL":{if(k(o,t)?.proposed!==!0)return null;const{decision:r}=a.payload;return so(o,t,r==="clear"?null:r)}case"SET_TODO_STATUS":{const r=k(o,t);if(r===void 0||!q(o,r))return null;const{status:d}=a.payload;return io(o,t,l=>({...l,status:d}))}case"ADD_TODO":{const{payload:r}=a;return k(o,r.id)!==void 0||r.assignee!==null&&O(o,r.assignee)===void 0?null:{...o,todos:[...o.todos,{id:r.id,title:r.title,status:"todo",assignee:r.assignee,note:null,proposed:!1,reason:null,added:!0}]}}case"DELETE_TODO":return k(o,t)?.added!==!0?null:{...o,todos:o.todos.filter(r=>r.id!==t)};default:return He(a)}},U=Me({en:{wholeBoard:"Whole board",statusWorking:"Working",statusWaiting:"Waiting on you",statusBlocked:"Blocked",statusDone:"Done",todoTodo:"To do",todoDoing:"In progress",todoBlocked:"Blocked",todoDone:"Done",kindAgent:"Agent",kindHuman:"Human",updatedAt:o=>`Updated ${o}`,context:"What this task is about",contextWhy:"Why",contextWhat:"What",contextGoals:"Goals",contextNonGoals:"Non-goals",noContext:"The agent has not written down why and what yet.",tabs:"Board sections",tabContext:"Context",tabLog:"Work log",tabQuestions:"Questions",openCount:o=>`${o} open`,noQuestions:"The agent has nothing to ask right now.",questions:"Questions from the agent",questionsProgress:(o,e)=>`${o} of ${e} replied`,blockingGroup:"Blocking \u2014 the agent waits for your decision",provisionalGroup:"Going ahead on an assumption \u2014 the agent adjusts if you answer otherwise",blockingTag:"Blocking",assumption:"Assumption",recommendation:"Agent recommends",approveAssumption:"OK, go with this",approveRecommendation:"OK, go with the recommendation",answerOther:"Answer differently",answerOf:o=>`Your answer to ${o}`,answerPlaceholder:"What you expect instead\u2026",blockingPlaceholder:"Your decision\u2026",approvedTag:"Approved",answeredTag:"Answered",todos:"Todo",progress:(o,e)=>`${o} of ${e} done`,noTodosYet:"No todos yet",assignee:"Assignee",unassigned:"Unassigned",memberOption:(o,e)=>`${o} (${e})`,statusOf:o=>`Status of \u201C${o}\u201D`,filterTodos:"Show todos",filterAll:"All",filterHuman:"People",doneGroup:o=>`Done (${o})`,noHumanTodos:"Nobody but the agent has a todo.",addedTag:"Added by you",changedTag:"Changed",removeAdded:"Remove this todo you added",noTodos:"There are no todos yet.",newTodo:"New todo",newTodoPlaceholder:"Add a todo for the agent\u2026",newTodoAssignee:"Assignee of the new todo",addTodo:"Add",proposedMark:"Proposed by the agent",reason:"Why",accept:"Accept",decline:"Decline",decisionOf:o=>`Decision on \u201C${o}\u201D`,acceptedTag:"Accepted",declinedTag:"Declined",undoDecision:"Undo",outputs:"Outputs",noOutputs:"Nothing has been produced yet.",copy:o=>`Copy ${o}`,copied:"Copied",log:"Conversation with the agent",logLede:"Newest first",noLog:"Nothing has been exchanged yet.",fromAgent:"Agent",latestTag:"Latest",commentOn:o=>`Comment on ${o}`,todoGroup:"Todo",logGroup:"Log",contextGroup:"Context",proposalGroup:"Proposal",questionGroup:"Question",approved:"Approve the assumption",answered:"Answer",answerCleared:"Clear the reply",accepted:"Accept the proposal",declined:"Decline the proposal",decisionCleared:"Clear the decision",statusChanged:"Change the status",todoAdded:"Add a todo",todoRemoved:"Remove the added todo",quoted:o=>`\u2192 \u201C${o}\u201D`,change:(o,e)=>`${o} \u2192 ${e}`},ja:{wholeBoard:"\u30DC\u30FC\u30C9\u5168\u4F53",statusWorking:"\u4F5C\u696D\u4E2D",statusWaiting:"\u3042\u306A\u305F\u306E\u8FD4\u7B54\u5F85\u3061",statusBlocked:"\u30D6\u30ED\u30C3\u30AF\u4E2D",statusDone:"\u5B8C\u4E86",todoTodo:"\u672A\u7740\u624B",todoDoing:"\u9032\u884C\u4E2D",todoBlocked:"\u30D6\u30ED\u30C3\u30AF",todoDone:"\u5B8C\u4E86",kindAgent:"Agent",kindHuman:"\u4EBA\u9593",updatedAt:o=>`\u66F4\u65B0 ${o}`,context:"\u3053\u306E\u30BF\u30B9\u30AF\u306E\u524D\u63D0",contextWhy:"Why \u2014 \u306A\u305C\u3084\u308B\u304B",contextWhat:"What \u2014 \u4F55\u3092\u3084\u308B\u304B",contextGoals:"\u30B4\u30FC\u30EB",contextNonGoals:"\u3084\u3089\u306A\u3044\u3053\u3068",noContext:"Agent \u306F\u307E\u3060 Why / What \u3092\u66F8\u3044\u3066\u3044\u307E\u305B\u3093\u3002",tabs:"\u30DC\u30FC\u30C9\u306E\u533A\u5206",tabContext:"Context",tabLog:"\u4F5C\u696D\u30ED\u30B0",tabQuestions:"\u8CEA\u554F",openCount:o=>`\u672A\u56DE\u7B54 ${o} \u4EF6`,noQuestions:"\u4ECA Agent \u304B\u3089\u805E\u304D\u305F\u3044\u3053\u3068\u306F\u3042\u308A\u307E\u305B\u3093\u3002",questions:"Agent \u304B\u3089\u306E\u8CEA\u554F",questionsProgress:(o,e)=>`\u8FD4\u7B54\u6E08\u307F ${o} / ${e}`,blockingGroup:"\u30D6\u30ED\u30C3\u30AB\u30FC \u2014 \u6C7A\u3081\u3066\u3082\u3089\u3046\u307E\u3067\u5148\u306B\u9032\u3081\u306A\u3044",provisionalGroup:"\u4EEE\u306E\u524D\u63D0\u3067\u9032\u884C\u4E2D \u2014 \u9055\u3048\u3070\u65B9\u91DD\u3092\u76F4\u3059",blockingTag:"\u30D6\u30ED\u30C3\u30AB\u30FC",assumption:"\u4EEE\u56DE\u7B54",recommendation:"Agent \u306E\u63A8\u5968",approveAssumption:"\u3053\u306E\u524D\u63D0\u3067 OK",approveRecommendation:"\u63A8\u5968\u3069\u304A\u308A\u3067 OK",answerOther:"\u5225\u306E\u56DE\u7B54\u3092\u3059\u308B",answerOf:o=>`${o} \u3078\u306E\u56DE\u7B54`,answerPlaceholder:"\u671F\u5F85\u3059\u308B\u56DE\u7B54\u3092\u5165\u529B\u2026",blockingPlaceholder:"\u3069\u3046\u3059\u308B\u304B\u3092\u5165\u529B\u2026",approvedTag:"\u627F\u8A8D\u6E08\u307F",answeredTag:"\u56DE\u7B54\u6E08\u307F",todos:"Todo",progress:(o,e)=>`${e} \u4EF6\u4E2D ${o} \u4EF6\u5B8C\u4E86`,noTodosYet:"Todo \u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093",assignee:"\u62C5\u5F53",unassigned:"\u672A\u5272\u308A\u5F53\u3066",memberOption:(o,e)=>`${o}\uFF08${e}\uFF09`,statusOf:o=>`\u300C${o}\u300D\u306E\u72B6\u614B`,filterTodos:"\u8868\u793A\u3059\u308B Todo",filterAll:"\u3059\u3079\u3066",filterHuman:"\u4EBA\u9593\u306E\u62C5\u5F53",doneGroup:o=>`\u5B8C\u4E86 ${o} \u4EF6`,noHumanTodos:"\u4EBA\u9593\u304C\u62C5\u5F53\u3059\u308B Todo \u306F\u3042\u308A\u307E\u305B\u3093\u3002",addedTag:"\u3042\u306A\u305F\u304C\u8FFD\u52A0",changedTag:"\u5909\u66F4\u3042\u308A",removeAdded:"\u8FFD\u52A0\u3057\u305F Todo \u3092\u53D6\u308A\u6D88\u3059",noTodos:"Todo \u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002",newTodo:"\u65B0\u3057\u3044 Todo",newTodoPlaceholder:"Agent \u306B\u983C\u3080 Todo \u3092\u8FFD\u52A0\u2026",newTodoAssignee:"\u65B0\u3057\u3044 Todo \u306E\u62C5\u5F53",addTodo:"\u8FFD\u52A0",proposedMark:"Agent \u304B\u3089\u306E\u63D0\u6848",reason:"\u306A\u305C",accept:"\u627F\u8A8D",decline:"\u898B\u9001\u308A",decisionOf:o=>`\u300C${o}\u300D\u306E\u5224\u65AD`,acceptedTag:"\u627F\u8A8D\u6E08\u307F",declinedTag:"\u898B\u9001\u308A",undoDecision:"\u53D6\u308A\u6D88\u3059",outputs:"\u6210\u679C\u7269",noOutputs:"\u307E\u3060\u6210\u679C\u7269\u306F\u3042\u308A\u307E\u305B\u3093\u3002",copy:o=>`${o} \u3092\u30B3\u30D4\u30FC`,copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",log:"Agent \u3068\u306E\u3084\u308A\u3068\u308A",logLede:"\u65B0\u3057\u3044\u9806",noLog:"\u307E\u3060\u3084\u308A\u3068\u308A\u306F\u3042\u308A\u307E\u305B\u3093\u3002",fromAgent:"Agent",latestTag:"\u6700\u65B0",commentOn:o=>`${o} \u306B\u30B3\u30E1\u30F3\u30C8`,todoGroup:"Todo",logGroup:"\u4F5C\u696D\u30ED\u30B0",contextGroup:"Context",proposalGroup:"\u63D0\u6848",questionGroup:"\u8CEA\u554F",approved:"\u524D\u63D0\u3092\u627F\u8A8D",answered:"\u56DE\u7B54",answerCleared:"\u8FD4\u7B54\u3092\u30AF\u30EA\u30A2",accepted:"\u63D0\u6848\u3092\u627F\u8A8D",declined:"\u63D0\u6848\u3092\u898B\u9001\u308A",decisionCleared:"\u63D0\u6848\u306E\u5224\u65AD\u3092\u30AF\u30EA\u30A2",statusChanged:"\u72B6\u614B\u3092\u5909\u66F4",todoAdded:"Todo \u3092\u8FFD\u52A0",todoRemoved:"\u8FFD\u52A0\u3057\u305F Todo \u3092\u53D6\u308A\u6D88\u3057",quoted:o=>`\u2192 \u300C${o}\u300D`,change:(o,e)=>`${o} \u2192 ${e}`}}),ke=(o,e)=>{switch(e){case"working":return o.statusWorking;case"waiting":return o.statusWaiting;case"blocked":return o.statusBlocked;case"done":return o.statusDone}},C=(o,e)=>{switch(e){case"todo":return o.todoTodo;case"doing":return o.todoDoing;case"blocked":return o.todoBlocked;case"done":return o.todoDone}},lo=(o,e)=>e==="agent"?o.kindAgent:o.kindHuman,L=(o,e)=>{switch(e){case"why":return o.contextWhy;case"what":return o.contextWhat;case"goals":return o.contextGoals;case"nonGoals":return o.contextNonGoals}},xe=48,H=o=>{const e=o.title??o.body??o.id;return e.length<=xe?e:`${e.slice(0,xe-1)}\u2026`},po=(o,e,a)=>a===null?o.unassigned:O(e,a)?.name??a,fe=o=>o.title===""?"Task Context Board":o.title,me=(o,e,a)=>{switch(a.type){case"todo":{const t=k(e,a.id);return`${t?.proposed===!0?o.proposalGroup:o.todoGroup} \xB7 ${t?.title??a.id}`}case"log":{const t=de(e,a.id);return`${o.logGroup} \xB7 ${t===void 0?a.id:H(t)}`}case"context":return`${o.contextGroup} \xB7 ${se(a.id)?L(o,a.id):a.id}`;case"question":{const t=z(e,a.id);return t===void 0?a.id:`${t.ref} \xB7 ${t.title}`}case"page":return o.wholeBoard;default:return a.id}},co=(o,e)=>{switch(e){case"accept":return{title:o.accepted,tone:"update"};case"decline":return{title:o.declined,tone:"update"};case"clear":return{title:o.decisionCleared,tone:"delete"}}},uo=(o,e,a)=>{switch(a.type){case"ANSWER_QUESTION":{const t=S(m.ANSWER_QUESTION,a);if(t.kind==="clear")return{title:o.answerCleared,tone:"delete"};if(t.kind==="approve"){const r=z(e,a.target.id)?.assumption??null;return{title:o.approved,tone:"update",...r===null?{}:{body:o.quoted(r)}}}return{title:o.answered,tone:"update",body:o.quoted(t.text.slice(0,120))}}case"DECIDE_PROPOSAL":return co(o,S(m.DECIDE_PROPOSAL,a).decision);case"SET_TODO_STATUS":{const{status:t}=S(m.SET_TODO_STATUS,a),r=k(e,a.target.id)?.status,d=C(o,t);return{title:o.statusChanged,tone:"update",body:r===void 0?d:o.change(C(o,r),d)}}case"ADD_TODO":{const t=S(m.ADD_TODO,a);return{title:o.todoAdded,tone:"create",targetLabel:`${o.todoGroup} \xB7 ${t.title}`,...t.assignee===null?{}:{body:`${o.assignee}: ${po(o,e,t.assignee)}`}}}case"DELETE_TODO":return{title:o.todoRemoved,tone:"delete"};default:return{title:a.type,tone:"meta"}}},ve=(o,e,a,t)=>{let r;try{r=uo(o,t??a,e)}catch{r={title:e.type,tone:"meta"}}return{title:r.title,targetLabel:r.targetLabel??me(o,a,e.target),tone:r.tone,...r.body===void 0?{}:{summary:r.body}}},we=o=>`${o.type} ${Ke(o.target)} ${JSON.stringify(o.payload)}`,$e=(o,e)=>[...e.questions.map(a=>({value:`question:${a.id}`,label:`${a.ref} \xB7 ${a.title}`,group:o.questionGroup})),...e.todos.map(a=>({value:`todo:${a.id}`,label:a.title,group:a.proposed?o.proposalGroup:o.todoGroup})),...e.log.map(a=>({value:`log:${a.id}`,label:H(a),group:o.logGroup})),...E.filter(a=>N(e,a)).map(a=>({value:`context:${a}`,label:L(o,a),group:o.contextGroup}))],ye=(o,e)=>e,Te=(o,e,a)=>({parts:E.filter(t=>N(e,t)).map(t=>{const r=e.context[t];return{id:t,title:L(o,t),text:typeof r=="string"?r:null,items:typeof r=="string"||r===null?[]:r,comments:a(`context:${t}`)}})}),bo=(o,e,a)=>{const t=o.answers[e.id];return{id:e.id,ref:e.ref,title:e.title,description:e.description,blocking:e.blocking,assumption:e.assumption,reply:t?.kind??"none",resolved:ie(o,e),draft:t?.kind==="answer"?t.text:"",comments:a(`question:${e.id}`)}},Ae=(o,e)=>{const a=o.questions.map(r=>bo(o,r,e)),t=a.filter(r=>r.resolved).length;return{blocking:a.filter(r=>r.blocking),provisional:a.filter(r=>!r.blocking),resolved:t,total:a.length,open:a.length-t,blockingOpen:a.filter(r=>r.blocking&&!r.resolved).length}},go=(o,e,a,t,r)=>{const d=k(a,t.id),l=O(e,t.assignee);return{id:t.id,title:t.title,note:t.note,reason:t.reason,status:t.status,statusLabel:C(o,t.status),assignee:t.assignee,assigneeName:l?.name??null,assigneeKind:l?.kind??null,editable:q(e,t),proposal:t.proposed?e.decisions[t.id]??"pending":null,added:t.added,changed:d!==void 0&&d.status!==t.status,comments:r(`todo:${t.id}`)}},Oe=(o,e,a,t,r="all")=>{const d=e.todos.filter(p=>R(e,p)),l=d.filter(p=>p.status==="done").length,g=e.members.some(p=>p.kind==="human"),x=g?r:"all",F=p=>p.assigneeKind==="human",G=e.todos.map(p=>go(o,e,a,p,t)),j=x==="human"?G.filter(F):G,Y=p=>p.status==="done"&&k(a,p.id)?.status==="done";return{todos:j.filter(p=>!Y(p)),done:j.filter(Y),filter:x,canFilter:g,humanCount:G.filter(F).length,progress:{done:l,total:d.length,label:d.length===0?o.noTodosYet:o.progress(l,d.length)},statuses:D.map(p=>({value:p,label:C(o,p)})),members:e.members.map(p=>({id:p.id,label:o.memberOption(p.name,lo(o,p.kind))}))}},Se=o=>{if(!/^[a-z][a-z\d+.-]*:\/\//i.test(o))return{kind:"path"};try{return{kind:"url",host:new URL(o).host}}catch{return{kind:"path"}}},De=o=>o.outputs.map(e=>({id:e.id,title:e.label??e.href,labelled:e.label!==null,href:e.href,kind:e.kind,description:e.description,place:Se(e.href)})),Ee=(o,e,a)=>({entries:e.log.map((t,r)=>{const d=O(e,t.from);return{id:t.id,author:d===void 0?null:{name:d.name,kind:d.kind},at:t.at,title:t.title,body:t.body,points:t.points,label:H(t),latest:r===e.log.length-1,comments:a(`log:${t.id}`)}}).reverse(),status:e.status===null&&e.updatedAt===null?null:{status:e.status,label:e.status===null?null:ke(o,e.status),updatedAt:e.updatedAt}}),ze=(o,e)=>{switch(e.type){case"todo":return k(o,e.id)!==void 0;case"log":return de(o,e.id)!==void 0;case"context":return se(e.id)&&N(o,e.id);case"question":return z(o,e.id)!==void 0;case"page":return!0;default:return!1}},Ce=o=>{const e=U(o);return{name:"task-board",label:"Task Context Board",parseBase:re,emptyBase:ne,actions:m,apply:he,hasTarget:ze,describe:(a,t,r)=>ve(e,a,t,r),serialize:we,resolveNavigation:ye,commentTargets:a=>$e(e,a),title:fe}},_=(o,e,a,t)=>n`
|
|
2
2
|
<button
|
|
3
3
|
class="dpk-icon-btn board-comment"
|
|
4
4
|
type="button"
|