nx-kv 0.65.2 → 0.65.4
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/CHANGELOG.md +43 -0
- package/README.md +15 -37
- package/assets/nx-kv/QUICKSTART.md +110 -0
- package/assets/nx-kv/references/A05-/344/273/273/345/212/241/351/223/276/344/270/216/345/217/215/351/246/210/346/261/207/346/200/273.md +1 -1
- package/assets/nx-kv/references/B02-CLI/351/200/237/346/237/245.md +1 -2
- package/package.json +1 -1
- package/src/core/config.ts +23 -0
- package/src/core/db/settings.ts +1 -1
- package/src/core/instruction-template.ts +2 -2
- package/src/core/workflow/plugin-registry.ts +1 -1
- package/src/core/workflow/project.ts +1 -1
- package/src/core/workflow/types.ts +4 -4
- package/src/modules/claim/actions/_manifest.generated.ts +20 -0
- package/src/modules/{localtask → claim}/actions/localtask-claim.ts +5 -5
- package/src/modules/{localtask → claim}/actions/localtask-preview.ts +4 -4
- package/src/modules/{promptplug/delivery.ts → claim/assemble.ts} +6 -6
- package/src/modules/{tasktool → claim}/get.ts +5 -6
- package/src/modules/{tasktool → claim}/groupctx.ts +4 -7
- package/src/modules/{tasktool/delivery.ts → claim/host.ts} +7 -7
- package/src/modules/claim/index.ts +25 -0
- package/src/modules/{tasktool → claim}/panel-escort.ts +2 -2
- package/src/modules/{tasktool → claim}/params.ts +3 -3
- package/src/modules/{tasktool → claim}/preview.ts +5 -5
- package/src/modules/{tasktool → claim}/wait.ts +17 -17
- package/src/modules/{tasktool/plugins → claim}/waitgoal-config.ts +3 -24
- package/src/modules/docs/actions/_manifest.generated.ts +12 -0
- package/src/modules/{repos → docs}/actions/repo-doc-add.ts +3 -2
- package/src/modules/{repos → docs}/actions/repo-doc-list.ts +3 -2
- package/src/modules/{repos → docs}/actions/repo-doc-remove.ts +3 -2
- package/src/modules/{repos → docs}/actions/repo-knowledge.ts +3 -2
- package/src/modules/docs/knowledge.ts +8 -16
- package/src/modules/goals/index.ts +25 -0
- package/src/modules/{tasktool → goals}/plugins/discover.ts +3 -3
- package/src/modules/{tasktool → goals}/plugins/index.ts +0 -2
- package/src/modules/{tasktool → goals}/plugins/taskgoal-store.ts +2 -2
- package/src/modules/{tasktool → goals}/plugins/timegoal-cwd-store.ts +1 -1
- package/src/modules/{tasktool → goals}/plugins/timegoal-store.ts +3 -3
- package/src/modules/{tasktool → goals}/plugins/timegoal-task-store.ts +2 -2
- package/src/modules/{tasktool → goals}/support.ts +3 -1
- package/src/modules/localtask/actions/_manifest.generated.ts +0 -9
- package/src/modules/localtask/actions/localtask-add.ts +4 -4
- package/src/modules/localtask/actions/localtask-attach-note.ts +1 -1
- package/src/modules/localtask/actions/localtask-attach.ts +1 -1
- package/src/modules/localtask/actions/localtask-attachments.ts +2 -2
- package/src/modules/localtask/actions/localtask-cancel.ts +1 -1
- package/src/modules/localtask/actions/localtask-chain.ts +1 -1
- package/src/modules/localtask/actions/localtask-detach.ts +2 -2
- package/src/modules/localtask/actions/localtask-done.ts +1 -1
- package/src/modules/localtask/actions/localtask-get.ts +3 -3
- package/src/modules/localtask/actions/localtask-list.ts +1 -1
- package/src/modules/localtask/actions/localtask-reopen.ts +5 -5
- package/src/modules/localtask/actions/localtask-timegoalLog.ts +1 -1
- package/src/modules/localtask/actions/localtask-topic-removeMany.ts +1 -1
- package/src/modules/localtask/actions/localtask-update.ts +3 -3
- package/src/modules/localtask/{bus → infra/bus}/index.ts +1 -1
- package/src/modules/localtask/{engine.ts → infra/engine.ts} +1 -1
- package/src/modules/localtask/{events.ts → infra/events.ts} +3 -3
- package/src/modules/localtask/{mutator → infra/mutator}/index.ts +2 -2
- package/src/modules/localtask/{mutator → infra/mutator}/validate.ts +4 -4
- package/src/modules/localtask/{repo → infra/repo}/goals.ts +2 -2
- package/src/modules/localtask/{repo → infra/repo}/index.ts +1 -1
- package/src/modules/localtask/{repo → infra/repo}/links.ts +2 -2
- package/src/modules/localtask/{repo → infra/repo}/open.ts +4 -4
- package/src/modules/localtask/{repo → infra/repo}/presence.ts +1 -1
- package/src/modules/localtask/{repo → infra/repo}/rows.ts +1 -1
- package/src/modules/localtask/{repo → infra/repo}/settings.ts +5 -5
- package/src/modules/localtask/{repo → infra/repo}/snapshot.ts +9 -7
- package/src/modules/localtask/{repo → infra/repo}/tasks.ts +82 -4
- package/src/modules/localtask/{repo → infra/repo}/topics.ts +3 -3
- package/src/modules/localtask/{repo-ctx.ts → infra/repo-ctx.ts} +1 -1
- package/src/modules/localtask/{scheduler → infra/scheduler}/index.ts +1 -1
- package/src/modules/localtask/{scheduler → infra/scheduler}/state-drive.ts +4 -4
- package/src/modules/localtask/{store → infra/store}/file-adapter.ts +2 -2
- package/src/modules/localtask/{store → infra/store}/index.ts +4 -4
- package/src/modules/localtask/{store → infra/store}/memory-adapter.ts +2 -2
- package/src/modules/localtask/{store-io.ts → infra/store-io.ts} +1 -1
- package/src/modules/localtask/{writes.ts → infra/writes.ts} +3 -3
- package/src/modules/{tasktool → localtask/lifecycle}/add.ts +8 -8
- package/src/modules/localtask/{deletion.ts → lifecycle/deletion.ts} +4 -4
- package/src/modules/localtask/{task-lifecycle.ts → lifecycle/task-lifecycle.ts} +18 -19
- package/src/modules/localtask/{task-ops.ts → lifecycle/task-ops.ts} +14 -14
- package/src/modules/localtask/{task-remove.ts → lifecycle/task-remove.ts} +4 -4
- package/src/modules/localtask/{task-templates.ts → lifecycle/task-templates.ts} +2 -2
- package/src/modules/localtask/{task-view.ts → lifecycle/task-view.ts} +14 -13
- package/src/modules/localtask/{topics.ts → lifecycle/topics.ts} +7 -7
- package/src/modules/{tasktool → localtask/lifecycle}/update.ts +6 -6
- package/src/modules/{tasktool → localtask/ops}/attach-resource.ts +4 -4
- package/src/modules/{tasktool → localtask/ops}/attach-template.ts +3 -3
- package/src/modules/{tasktool → localtask/ops}/attach.ts +11 -11
- package/src/modules/localtask/{board-target.ts → ops/board-target.ts} +1 -1
- package/src/modules/{tasktool → localtask/ops}/doc-inline.ts +3 -3
- package/src/modules/{tasktool → localtask/ops}/group-store.ts +3 -3
- package/src/modules/localtask/service.ts +16 -16
- package/src/modules/localtask/{action-render.ts → ui/action-render.ts} +2 -2
- package/src/modules/localtask/{panel-guard.ts → ui/panel-guard.ts} +1 -1
- package/src/modules/localtask/{panel-presence.ts → ui/panel-presence.ts} +7 -7
- package/src/modules/localtask/waiters.ts +2 -2
- package/src/modules/localtask/waiting.ts +1 -1
- package/src/modules/promptplug/factory.ts +2 -2
- package/src/modules/promptplug/index.ts +5 -7
- package/src/modules/promptplug/plugins/attachment.ts +1 -1
- package/src/modules/promptplug/plugins/context.ts +9 -20
- package/src/modules/promptplug/plugins/goal-prompt.ts +1 -1
- package/src/modules/repos/actions/_manifest.generated.ts +0 -12
- package/src/modules/repos/service/crud.ts +1 -1
- package/src/runtime/cli.ts +1 -1
- package/src/runtime/registry.ts +4 -2
- package/src/{modules/tasktool → shared}/delivery-text.ts +5 -4
- package/src/shared/feedback-text.ts +80 -20
- package/src/shared/task-status.ts +42 -0
- package/src/web/frontend/api/cli-tree.json +202 -217
- package/src/web/frontend/api/client.generated.ts +141 -139
- package/src/web/frontend/modules/board/ack-nodes.ts +10 -13
- package/src/web/frontend/modules/board/reopen-text.ts +5 -0
- package/src/web/frontend/modules/md/styles/editor.css +8 -0
- package/src/web/public/assets/{bar-Dc5Tq1eE.js → bar-kaVB6FAa.js} +1 -1
- package/src/web/public/assets/{board-view-BVennxTs.js → board-view-Cwot54HC.js} +1 -1
- package/src/web/public/assets/{composer-launch-fp2IzGzQ.js → composer-launch-BMTU-BD9.js} +1 -1
- package/src/web/public/assets/{composer-panel-Dh681iO6.js → composer-panel-BF6gjNXv.js} +1 -1
- package/src/web/public/assets/{dag-DnaU0I_z.js → dag-BRE33yI8.js} +1 -1
- package/src/web/public/assets/dir-B0IW4NIn.js +3 -0
- package/src/web/public/assets/{doc-DRSKD0Re.js → doc-DsRb-4WT.js} +1 -1
- package/src/web/public/assets/frontmatter-Bcseml1q.js +2 -0
- package/src/web/public/assets/{group-Dc3ZgW24.js → group-CS8VP6z0.js} +1 -1
- package/src/web/public/assets/{index-Bg0m8gbJ.js → index-BT2y9cTX.js} +2 -2
- package/src/web/public/assets/{index-BIVxGd6t.css → index-DSAamoav.css} +1 -1
- package/src/web/public/assets/{md-history-DNtgaIdH.js → md-history-CJ1N9-Jf.js} +1 -1
- package/src/web/public/assets/{md-parse-C9Vd6ejP.js → md-parse-DAYCREP1.js} +1 -1
- package/src/web/public/assets/{model-CtG2jIDv.js → model-TD5kGXzR.js} +1 -1
- package/src/web/public/assets/{overview-C68QpcT9.js → overview-Bsq58sDd.js} +1 -1
- package/src/web/public/assets/{progress-CEmAFxo9.js → progress-B4DfpsyS.js} +1 -1
- package/src/web/public/assets/{refs-TzxZYy7T.js → refs-DIiA_49Z.js} +1 -1
- package/src/web/public/assets/{repo-form-modal-Dg3hJWUV.js → repo-form-modal-DChK4NSX.js} +1 -1
- package/src/web/public/assets/{repos-uNqSR5YB.js → repos-PGFYkUgf.js} +1 -1
- package/src/web/public/assets/{route-crumb-C4DgkJ8G.js → route-crumb-SiMi2C_T.js} +1 -1
- package/src/web/public/assets/{status-tag-8cLH8hl9.js → status-tag-C9YVBvQh.js} +1 -1
- package/src/web/public/assets/task-BL5uxmJh.js +11 -0
- package/src/web/public/assets/{task-row-CRjuAfKW.js → task-row-cE7qblNK.js} +1 -1
- package/src/web/public/assets/{task-utils-DAPxKm4c.js → task-utils-cBR6Gj_c.js} +8 -7
- package/src/web/public/assets/{templates-DNiGvmdq.js → templates-Cfn3Xmsf.js} +3 -3
- package/src/web/public/assets/{use-rail-drag-DxIYcszo.js → use-rail-drag-Boxl7pOG.js} +1 -1
- package/src/web/public/index.html +11 -11
- package/src/core/workflow/edges.ts +0 -28
- package/src/core/workflow/layout.ts +0 -118
- package/src/modules/localtask/actions/localtask-wait.ts +0 -41
- package/src/modules/tasktool/facade/get.ts +0 -54
- package/src/modules/tasktool/facade/index.ts +0 -4
- package/src/modules/tasktool/facade/submit.ts +0 -61
- package/src/modules/tasktool/facade/wait.ts +0 -3
- package/src/modules/tasktool/getloop.ts +0 -2
- package/src/modules/tasktool/index.ts +0 -24
- package/src/modules/tasktool/plugins/runtime.ts +0 -73
- package/src/modules/tasktool/plugins/waitgoal.ts +0 -71
- package/src/web/public/assets/dir-d16q1GLe.js +0 -3
- package/src/web/public/assets/frontmatter-CN6IlxWU.js +0 -2
- package/src/web/public/assets/task-DuFOXLPC.js +0 -11
- /package/src/modules/{tasktool → goals}/actions/_manifest.generated.ts +0 -0
- /package/src/modules/{tasktool → goals}/actions/timegoal-check.ts +0 -0
- /package/src/modules/{tasktool → goals}/actions/timegoal-clear.ts +0 -0
- /package/src/modules/{tasktool → goals}/actions/timegoal-list.ts +0 -0
- /package/src/modules/{tasktool → goals}/actions/timegoal-log.ts +0 -0
- /package/src/modules/{tasktool → goals}/actions/timegoal-prune.ts +0 -0
- /package/src/modules/{tasktool → goals}/actions/timegoal-set.ts +0 -0
- /package/src/modules/{tasktool → goals}/actions/timegoal-show.ts +0 -0
- /package/src/modules/{tasktool → goals}/actions/timegoal-update.ts +0 -0
- /package/src/modules/{tasktool → goals}/plugins/base.ts +0 -0
- /package/src/modules/{tasktool → goals}/plugins/blockgoal.ts +0 -0
- /package/src/modules/{tasktool → goals}/plugins/container.ts +0 -0
- /package/src/modules/{tasktool → goals}/plugins/taskgoal.ts +0 -0
- /package/src/modules/{tasktool → goals}/plugins/timegoal-core-store.ts +0 -0
- /package/src/modules/{tasktool → goals}/plugins/timegoal.ts +0 -0
- /package/src/modules/{tasktool → goals}/taskgoal.ts +0 -0
- /package/src/modules/{tasktool → goals}/timegoal.ts +0 -0
- /package/src/modules/localtask/{store → infra/store}/topic-adapter.ts +0 -0
- /package/src/modules/localtask/{action-flags.ts → ui/action-flags.ts} +0 -0
- /package/src/modules/localtask/{contract-views.ts → ui/contract-views.ts} +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import{u as e}from"./popup-DZ2Khv2c.js";import{d as t}from"./md-history-
|
|
1
|
+
import{u as e}from"./popup-DZ2Khv2c.js";import{d as t}from"./md-history-CJ1N9-Jf.js";import{n,o as r}from"./board-view-Cwot54HC.js";function i(t){return e(`/api/localtasks/chain?${t}`)}function a(t){return e(`/api/localtasks/timegoal-log?${t}`)}function o(t){return e(`/api/localtasks/reorder`,{method:`PATCH`,body:t})}function s(t){return e(`/api/localtasks/item`,{method:`PATCH`,body:t})}function c(t){return e(`/api/localtasks/item?${t}`).catch(()=>null)}function l(t){return e(`/api/localtasks`,{method:`POST`,body:t})}function u(t){return e(`/api/localtasks/plan`,{method:`PATCH`,body:t})}function d(t){return e(`/api/localtasks/reopen`,{method:`POST`,body:t})}function f(t){return e(`/api/localtasks/item`,{method:`DELETE`,body:t})}function p(t){return e(`/api/localtasks/items`,{method:`DELETE`,body:t})}function m(t){return e(`/api/localtasks/items/cancel`,{method:`POST`,body:t})}function h(t){return e(`/api/localtasks/items/close`,{method:`POST`,body:t})}function g(t){return e(`/api/localtasks/clone`,{method:`POST`,body:t})}function _(t){return e(`/api/localtasks/fork`,{method:`POST`,body:t})}function v(t){return e(`/api/localtasks/attachments?${t}`)}function y(t){return e(`/api/docs/mdfile?attachment=${encodeURIComponent(t)}`)}function b(t){return e(`/api/localtasks/preview`,{method:`POST`,body:t})}var x=`## 验收反馈`,S=`## 反馈修改`;function C(e){return String(e??``).split(`
|
|
2
2
|
`).map(e=>e.trim()?`**${e}**`:e).join(`
|
|
3
3
|
`)}function w(e){let t=String(e??``).trim();return t?`> 锚定:\n> ${t.replace(/\n/g,`
|
|
4
|
-
> `)}`:``}var T=`NOTE`,E=`WARNING`,D
|
|
4
|
+
> `)}`:``}var T=`NOTE`,E=`WARNING`,D=/第\s*(\d+)\s*轮/,O=/^>\s*\[!([A-Za-z][\w-]*)\][ \t]*(.*)$/,k=/完成总结/,A=/反馈/,j={[T.toUpperCase()]:`summary`,[E.toUpperCase()]:`feedback`};function M(e){let t=String(e??``).match(O);if(!t)return null;let n=String(t[2]??``).trim(),r=n.match(D);return{type:String(t[1]??``).toUpperCase(),title:n,round:r&&Number(r[1])||0}}function N(e){return k.test(e)?`summary`:A.test(e)?`feedback`:null}function P(e){return e?j[e.type]??N(e.title):null}function F(e){return`第 ${Number(e)||1} 轮 · 完成总结`}function I(e){return`第 ${Number(e)||1} 轮 · 验收反馈`}function L(e){return String(e??``).split(`
|
|
5
5
|
`).map(e=>e.trim()?`> ${e}`:`>`).join(`
|
|
6
|
-
`)}function
|
|
7
|
-
`)
|
|
8
|
-
`)
|
|
6
|
+
`)}function R({round:e,ack:t}={}){let n=String(t??``).trim();return n?`> [!${T}] ${F(e)}\n${L(n)}`:``}function z({round:e,quote:t,feedback:n,bold:r=!1}={}){let i=String(n??``).trim();if(!i)return``;let a=r?C(i):i,o=w(t),s=o?`${o.replace(/^> ?/gm,``)}\n\n${a}`:a;return`> [!${E}] ${I(e)}\n${L(s)}`}function B(e){let t=String(e??``),n=0,r=0,i=t.match(/^## 上一轮完成总结\s*$/gm);n+=i?i.length:0;for(let e of t.split(`
|
|
7
|
+
`)){let t=M(e);t&&P(t)===`summary`&&(n+=1,t.round&&(r=Math.max(r,t.round)))}return Math.max(n,r)}function V(e){return B(e)+1}function H(e,t){let n=String(e??``),r=String(t??``).trim();if(!r||!n)return!1;if(n.includes(`## 上一轮完成总结\n\n${r}`))return!0;let i=n.split(`
|
|
8
|
+
`);for(let e=0;e<i.length;e++){let t=M(i[e]??``);if(!t||P(t)!==`summary`)continue;let n=[];for(let t=e+1;t<i.length&&(i[t]??``).startsWith(`>`);t++)n.push((i[t]??``).replace(/^>[ \t]?/,``));if(n.join(`
|
|
9
|
+
`).trim()===r)return!0}return!1}function U({base:e,ack:t,quote:n,feedback:r,bold:i=!0,round:a}={}){let o=String(e??``).trimEnd(),s=Number(a)||V(o),c=[];o&&c.push(o);let l=String(t??``).trim();l&&!H(o,l)&&c.push(R({round:s,ack:l}));let u=z({round:s,quote:n,feedback:r,bold:i});return u&&c.push(u),c.length?`${c.join(`
|
|
9
10
|
|
|
10
|
-
`)}\n`:``}function
|
|
11
|
+
`)}\n`:``}function W({base:e,feedback:t,ackSummary:n,feedbackHeading:r=x,bold:i=!0,round:a}={}){if(String(r??``)===`## 反馈修改`){let n=[],a=String(e??``).trim();a&&n.push(a);let o=String(t??``).trim();return o&&n.push(`${r}\n\n${i?C(o):o}`),n.length?`${n.join(`
|
|
11
12
|
|
|
12
|
-
`)}\n`:``}return
|
|
13
|
+
`)}\n`:``}return U({base:e,ack:n,feedback:t,bold:i,round:a})}function G(e){let t=Math.max(0,Number(e)||0);return t>=3600?`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`:t>=60?`${Math.floor(t/60)}m ${t%60}s`:`${t}s`}var K=t,q=r,J=n;function Y(e,t,n,r){return J(e,t,n,r)}export{b as C,u as D,o as E,d as S,f as T,a as _,W as a,i as b,P as c,l as d,m as f,_ as g,c as h,q as i,M as l,h as m,G as n,x as o,g as p,K as r,S as s,Y as t,w as u,y as v,p as w,s as x,v as y};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{a as e,d as t,f as n,h as r,i,l as a}from"./popup-DZ2Khv2c.js";import{v as o}from"./workspace-DojQ3RP4.js";import{n as s}from"./app-context-BqCBcDsx.js";import{t as c}from"./button-3JlUeln_.js";import{a as l,d as u,i as d,n as f,r as p,t as m}from"./md-history-
|
|
3
|
-
`).map(e=>e.trim().replace(/^#{1,6}\s+/,``).replace(/^[-*+]\s+\[[ x]\]\s*/i,``).replace(/^[-*+]\s+/,``).replace(/^>\s?/,``)).filter(Boolean).slice(0,2).join(` · `)}function k(){let t=s(),n=t.tpl,r=a(),{dialog:o,node:l}=i(),[d,f]=(0,S.useState)(null),[p,m]=(0,S.useState)(null),[_,v]=(0,S.useState)(!1),[y,b]=(0,S.useState)(``),x=e=>t.onNavigate?.(e);if(!n)return(0,C.jsx)(`div`,{className:`rp-page tpl-page`,children:(0,C.jsx)(`div`,{className:`muted`,style:{padding:20},children:`模板服务未就绪…`})});if(n.unsupported)return(0,C.jsx)(`div`,{className:`rp-page tpl-page`,children:(0,C.jsx)(`div`,{className:`muted`,style:{padding:20},children:`当前服务比面板旧——重启面板后才有模板功能。`})});let w=n.templates||[],T=g(w,y,e=>[e.name,O(e.body),(e.scope||[]).join(` `)]),E=async(e,t)=>{if(!_){v(!0);try{await e(),t&&r(t)}catch(e){r(String(e.message||e))}finally{v(!1)}}},k=async e=>{await o({title:`删除模板「${e.name}」`,danger:!0,okText:`删除`})&&await E(()=>n.remove(e.id),`已删除「${e.name}」`)};return(0,C.jsxs)(`div`,{className:`rp-page tpl-page`,children:[l,(0,C.jsxs)(`div`,{className:`page-head`,children:[(0,C.jsxs)(`div`,{className:`title-block`,children:[(0,C.jsxs)(`h2`,{children:[(0,C.jsx)(e,{name:`list`,size:16}),` 任务模板`]}),(0,C.jsx)(`p`,{className:`muted tpl-head-note`,children:`新建任务时的正文骨架;正式内容在编辑页自行填写。`})]}),(0,C.jsx)(`div`,{className:`acts`,children:(0,C.jsxs)(c,{variant:`primary`,small:!0,disabled:_,onClick:()=>x(`#/templates/new`),children:[(0,C.jsx)(e,{name:`plus`,size:13}),` 新建`]})})]}),!w.length&&(0,C.jsx)(`div`,{className:`muted`,style:{padding:`8px 2px`},children:`还没有模板(内置默认模板加载中…)。`}),w.length>1?(0,C.jsx)(`div`,{className:`tpl-search`,children:(0,C.jsx)(h,{value:y,onChange:b,placeholder:`搜索名称 / 正文 / 可见范围…`,title:`过滤任务模板`,count:T.length,className:`wide`})}):null,(0,C.jsxs)(`div`,{className:`tpl-list`,children:[T.map(t=>{let r=t.id===n.defaultId,i=d===t.id,a=p===t.id;return(0,C.jsxs)(`div`,{className:`tpl-card`+(r?` is-default`:``),children:[(0,C.jsxs)(`div`,{className:`tpl-card-head`,children:[(0,C.jsx)(`span`,{className:`tpl-card-name`,children:t.name}),r&&(0,C.jsx)(`span`,{className:`tpl-badge`,children:`默认`}),t.builtin&&(0,C.jsx)(`span`,{className:`tpl-badge soft`,children:`内置`}),(0,C.jsx)(`span`,{className:`grow tpl-card-grow`}),(0,C.jsxs)(`div`,{className:`tpl-card-acts`,children:[(0,C.jsx)(`button`,{type:`button`,className:`iconbtn`,title:a?`收起预览`:`预览`,onClick:()=>m(a?null:t.id),children:(0,C.jsx)(e,{name:`monitor`,size:14})}),(0,C.jsx)(`button`,{type:`button`,className:`iconbtn`+(i?` is-on`:``),title:`可见范围`,disabled:_,onClick:()=>f(i?null:t.id),children:(0,C.jsx)(e,{name:`globe`,size:14})}),(0,C.jsx)(`button`,{type:`button`,className:`iconbtn`,title:`编辑`,disabled:_,onClick:()=>x(`#/templates/edit/${encodeURIComponent(t.id)}`),children:(0,C.jsx)(e,{name:`edit`,size:14})}),!r&&(0,C.jsx)(`button`,{type:`button`,className:`iconbtn`,title:`设为默认`,disabled:_,onClick:()=>E(()=>n.setDefault(t.id),`默认模板已设为「${t.name}」`),children:(0,C.jsx)(e,{name:`star`,size:14})}),!t.builtin&&(0,C.jsx)(`button`,{type:`button`,className:`iconbtn`,title:`删除`,disabled:_,onClick:()=>k(t),children:(0,C.jsx)(e,{name:`trash`,size:14})})]})]}),(0,C.jsx)(`div`,{className:`tpl-card-sum`,children:O(t.body)||`(空模板)`}),i&&(0,C.jsx)(`div`,{className:`tpl-card-scope`,children:(0,C.jsx)(D,{scope:t.scope,originTopic:t.originTopic,onChange:e=>n.update(t.id,{scope:e})})}),a&&(0,C.jsx)(`div`,{className:`tpl-preview`,children:(0,C.jsx)(`div`,{className:`tpl-preview-body mdw-lp-view`,dangerouslySetInnerHTML:{__html:u(t.body)}})})]},t.id)}),w.length&&!T.length?(0,C.jsx)(`div`,{className:`muted`,style:{padding:`8px 2px`},children:`(没有匹配的模板)`}):null]})]})}function A({config:t}){let n=s(),r=a(),i=n.tpl,o=(0,S.useMemo)(()=>x(t?.id),[t?.id]),l=b(o?{topic:o.topic||``,group:o.group||``,repo:o.repo||``}:{topic:`__no_topic__`}),[u,d]=(0,S.useState)(``),[f,p]=(0,S.useState)(null),[m,_]=(0,S.useState)(null),[w,T]=(0,S.useState)(null),[E,O]=(0,S.useState)(!1),k=l.templates||[],A=g(k,u,e=>[e.name,e.body,(e.scope||[]).join(` `)]),j=async(e,t)=>{if(!E){O(!0);try{await e(),t&&r(t)}catch(e){r(String(e.message||e))}finally{O(!1)}}},M=async(e,t)=>{if(e===t)return;let n=k.map(e=>e.id),r=n.indexOf(e),a=n.indexOf(t);r<0||a<0||(n.splice(r,1),n.splice(a,0,e),await j(()=>i.reorder(n)))},N=()=>{let e=o?.group?[`group:${o.group}`]:o?.repo?[`repo:${o.repo}`]:o?.topic?[`topic:${o.topic}`]:[];y(async()=>{let{openTemplateEditor:e}=await import(`./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BT2y9cTX.js","assets/popup-DZ2Khv2c.js","assets/popup-BAvk7J7u.css","assets/workspace-DojQ3RP4.js","assets/repo-form-modal-DChK4NSX.js","assets/button-3JlUeln_.js","assets/button-DA4lNJeC.css","assets/doc-DsRb-4WT.js","assets/app-context-BqCBcDsx.js","assets/md-history-CJ1N9-Jf.js","assets/frontmatter-Bcseml1q.js","assets/status-tag-C9YVBvQh.js","assets/md-history-CLIs9Dr0.css","assets/use-rail-drag-Boxl7pOG.js","assets/list-filter-CWxiOSg_.js","assets/route-crumb-SiMi2C_T.js","assets/board-view-Cwot54HC.js","assets/doc-Iuxssa-b.css","assets/model-TD5kGXzR.js","assets/index-DSAamoav.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,d as t,f as n,h as r,i,l as a}from"./popup-DZ2Khv2c.js";import{v as o}from"./workspace-DojQ3RP4.js";import{n as s}from"./app-context-BqCBcDsx.js";import{t as c}from"./button-3JlUeln_.js";import{a as l,d as u,i as d,n as f,r as p,t as m}from"./md-history-CJ1N9-Jf.js";import{n as h,t as g}from"./list-filter-CWxiOSg_.js";import{n as _,t as v}from"./route-crumb-SiMi2C_T.js";import{a as y,n as b}from"./index-BT2y9cTX.js";import{t as x}from"./manage-session-CS8UvmUd.js";var S=r(n(),1),C=t(),w={topic:`目录`,repo:`项目`,group:`组`};function T(){let e=s(),t=e.rows||[],n=e.repoData?.repos||[],r=e.repoData?.boards||[];return(0,S.useMemo)(()=>{let e=new Map;for(let n of t)n&&n.key&&e.set(String(n.key),n.name||n.key);let i=new Map;for(let e of n)e&&e.key&&(e.type||`repo`)!==`group`&&i.set(String(e.key),e.name||e.key);let a=new Map;for(let e of n)e&&(e.type||``)===`group`&&e.key&&a.set(String(e.key),e.name||e.key);for(let e of r){let t=String(e&&(e.key||e.id)||``);t&&a.set(t,e&&e.name||t)}return{topicByKey:e,repoByKey:i,groupByKey:a,topics:t,repos:n,boards:r}},[t,n,r])}function E(e,t){if(e===`*`)return`全局`;let n=String(e).indexOf(`:`);if(n<0)return String(e);let r=String(e).slice(0,n),i=String(e).slice(n+1),a=w[r]||r,o=``;return r===`topic`?o=t.topicByKey.get(i)||``:r===`repo`?o=t.repoByKey.get(i)||``:r===`group`&&(o=t.groupByKey.get(i)||``),o?`${a} · ${o}`:`${a} ${/^[0-9a-f]{16}$/.test(i)?`${i.slice(0,6)}…`:i}`}function D({scope:e,onChange:t,originTopic:n=``,catalog:r,classPrefix:i=`setp`}){let o=a(),s=T(),c=r||s,[l,u]=(0,S.useState)(null),d=Array.isArray(e)?e:[],f=d.includes(`*`),p=d.filter(e=>e!==`*`),m=i,h=n?c.topicByKey.get(n)||(/^[0-9a-f]{16}$/.test(n)?`${n.slice(0,6)}…`:n):``,g=async e=>{try{await t(e)}catch(e){o(String(e.message||e))}},_=async e=>{if(d.includes(e)){o(`已经在可见范围里了`),u(null);return}await g([...d,e]),u(null)},v=(0,S.useMemo)(()=>{if(l===`topic`)return(c.topics||[]).filter(e=>e&&e.key).map(e=>({entry:`topic:${e.key}`,label:e.name||e.key,sub:e.cwd||``}));if(l===`repo`)return(c.repos||[]).filter(e=>e&&e.key&&(e.type||`repo`)!==`group`&&e.key!==`__unbound__`).map(e=>({entry:`repo:${e.key}`,label:e.name||e.key,sub:e.key}));if(l===`group`){let e=new Set,t=[];for(let n of c.repos||[])n&&(n.type||``)===`group`&&n.key&&!e.has(n.key)&&(e.add(n.key),t.push({entry:`group:${n.key}`,label:n.name||n.key,sub:n.key}));for(let n of c.boards||[]){let r=n&&(n.key||n.id);r&&!e.has(r)&&(e.add(r),t.push({entry:`group:${r}`,label:n&&n.name||r,sub:String(r)}))}return t}return[]},[l,c]);return(0,C.jsxs)(`div`,{className:`${m}-scope-block`,children:[(0,C.jsx)(`div`,{className:`${m}-scope`,children:d.map(e=>(0,C.jsxs)(`button`,{type:`button`,className:`${m}-scope-chip on`,title:`${e} —— 点击移除`,onClick:()=>g(d.filter(t=>t!==e)),children:[E(e,c),` ×`]},e))}),(0,C.jsxs)(`div`,{className:`${m}-scope-add`,children:[(0,C.jsx)(`span`,{className:`${m}-scope-add-label`,children:`添加`}),(0,C.jsx)(`button`,{type:`button`,className:`${m}-scope-add-btn`,disabled:f,title:f?`已绑定全局`:`加上「全局」绑定(与目录/项目/组平级)`,onClick:()=>!f&&g([`*`,...p]),children:`全局`}),[`topic`,`repo`,`group`].map(e=>(0,C.jsx)(`button`,{type:`button`,className:`${m}-scope-add-btn`+(l===e?` on`:``),onClick:()=>u(l===e?null:e),children:w[e]},e)),h?(0,C.jsxs)(`span`,{className:`${m}-scope-origin`,title:`创建于主题 ${n}`,children:[`创建于 `,h]}):null]}),l&&(0,C.jsx)(`div`,{className:`${m}-scope-pick`,role:`listbox`,"aria-label":`选择可见对象`,children:v.length?v.map(e=>(0,C.jsxs)(`button`,{type:`button`,className:`${m}-scope-pick-it`,disabled:d.includes(e.entry),title:e.sub||e.entry,onClick:()=>_(e.entry),children:[(0,C.jsx)(`span`,{className:`${m}-scope-pick-name`,children:e.label}),d.includes(e.entry)?(0,C.jsx)(`span`,{className:`${m}-scope-pick-done`,children:`已加`}):null]},e.entry)):(0,C.jsx)(`div`,{className:`${m}-scope-pick-empty`,children:`暂无可选项`})})]})}function O(e){return String(e||``).split(`
|
|
3
|
+
`).map(e=>e.trim().replace(/^#{1,6}\s+/,``).replace(/^[-*+]\s+\[[ x]\]\s*/i,``).replace(/^[-*+]\s+/,``).replace(/^>\s?/,``)).filter(Boolean).slice(0,2).join(` · `)}function k(){let t=s(),n=t.tpl,r=a(),{dialog:o,node:l}=i(),[d,f]=(0,S.useState)(null),[p,m]=(0,S.useState)(null),[_,v]=(0,S.useState)(!1),[y,b]=(0,S.useState)(``),x=e=>t.onNavigate?.(e);if(!n)return(0,C.jsx)(`div`,{className:`rp-page tpl-page`,children:(0,C.jsx)(`div`,{className:`muted`,style:{padding:20},children:`模板服务未就绪…`})});if(n.unsupported)return(0,C.jsx)(`div`,{className:`rp-page tpl-page`,children:(0,C.jsx)(`div`,{className:`muted`,style:{padding:20},children:`当前服务比面板旧——重启面板后才有模板功能。`})});let w=n.templates||[],T=g(w,y,e=>[e.name,O(e.body),(e.scope||[]).join(` `)]),E=async(e,t)=>{if(!_){v(!0);try{await e(),t&&r(t)}catch(e){r(String(e.message||e))}finally{v(!1)}}},k=async e=>{await o({title:`删除模板「${e.name}」`,danger:!0,okText:`删除`})&&await E(()=>n.remove(e.id),`已删除「${e.name}」`)};return(0,C.jsxs)(`div`,{className:`rp-page tpl-page`,children:[l,(0,C.jsxs)(`div`,{className:`page-head`,children:[(0,C.jsxs)(`div`,{className:`title-block`,children:[(0,C.jsxs)(`h2`,{children:[(0,C.jsx)(e,{name:`list`,size:16}),` 任务模板`]}),(0,C.jsx)(`p`,{className:`muted tpl-head-note`,children:`新建任务时的正文骨架;正式内容在编辑页自行填写。`})]}),(0,C.jsx)(`div`,{className:`acts`,children:(0,C.jsxs)(c,{variant:`primary`,small:!0,disabled:_,onClick:()=>x(`#/templates/new`),children:[(0,C.jsx)(e,{name:`plus`,size:13}),` 新建`]})})]}),!w.length&&(0,C.jsx)(`div`,{className:`muted`,style:{padding:`8px 2px`},children:`还没有模板(内置默认模板加载中…)。`}),w.length>1?(0,C.jsx)(`div`,{className:`tpl-search`,children:(0,C.jsx)(h,{value:y,onChange:b,placeholder:`搜索名称 / 正文 / 可见范围…`,title:`过滤任务模板`,count:T.length,className:`wide`})}):null,(0,C.jsxs)(`div`,{className:`tpl-list`,children:[T.map(t=>{let r=t.id===n.defaultId,i=d===t.id,a=p===t.id;return(0,C.jsxs)(`div`,{className:`tpl-card`+(r?` is-default`:``),children:[(0,C.jsxs)(`div`,{className:`tpl-card-head`,children:[(0,C.jsx)(`span`,{className:`tpl-card-name`,children:t.name}),r&&(0,C.jsx)(`span`,{className:`tpl-badge`,children:`默认`}),t.builtin&&(0,C.jsx)(`span`,{className:`tpl-badge soft`,children:`内置`}),(0,C.jsx)(`span`,{className:`grow tpl-card-grow`}),(0,C.jsxs)(`div`,{className:`tpl-card-acts`,children:[(0,C.jsx)(`button`,{type:`button`,className:`iconbtn`,title:a?`收起预览`:`预览`,onClick:()=>m(a?null:t.id),children:(0,C.jsx)(e,{name:`monitor`,size:14})}),(0,C.jsx)(`button`,{type:`button`,className:`iconbtn`+(i?` is-on`:``),title:`可见范围`,disabled:_,onClick:()=>f(i?null:t.id),children:(0,C.jsx)(e,{name:`globe`,size:14})}),(0,C.jsx)(`button`,{type:`button`,className:`iconbtn`,title:`编辑`,disabled:_,onClick:()=>x(`#/templates/edit/${encodeURIComponent(t.id)}`),children:(0,C.jsx)(e,{name:`edit`,size:14})}),!r&&(0,C.jsx)(`button`,{type:`button`,className:`iconbtn`,title:`设为默认`,disabled:_,onClick:()=>E(()=>n.setDefault(t.id),`默认模板已设为「${t.name}」`),children:(0,C.jsx)(e,{name:`star`,size:14})}),!t.builtin&&(0,C.jsx)(`button`,{type:`button`,className:`iconbtn`,title:`删除`,disabled:_,onClick:()=>k(t),children:(0,C.jsx)(e,{name:`trash`,size:14})})]})]}),(0,C.jsx)(`div`,{className:`tpl-card-sum`,children:O(t.body)||`(空模板)`}),i&&(0,C.jsx)(`div`,{className:`tpl-card-scope`,children:(0,C.jsx)(D,{scope:t.scope,originTopic:t.originTopic,onChange:e=>n.update(t.id,{scope:e})})}),a&&(0,C.jsx)(`div`,{className:`tpl-preview`,children:(0,C.jsx)(`div`,{className:`tpl-preview-body mdw-lp-view`,dangerouslySetInnerHTML:{__html:u(t.body)}})})]},t.id)}),w.length&&!T.length?(0,C.jsx)(`div`,{className:`muted`,style:{padding:`8px 2px`},children:`(没有匹配的模板)`}):null]})]})}function A({config:t}){let n=s(),r=a(),i=n.tpl,o=(0,S.useMemo)(()=>x(t?.id),[t?.id]),l=b(o?{topic:o.topic||``,group:o.group||``,repo:o.repo||``}:{topic:`__no_topic__`}),[u,d]=(0,S.useState)(``),[f,p]=(0,S.useState)(null),[m,_]=(0,S.useState)(null),[w,T]=(0,S.useState)(null),[E,O]=(0,S.useState)(!1),k=l.templates||[],A=g(k,u,e=>[e.name,e.body,(e.scope||[]).join(` `)]),j=async(e,t)=>{if(!E){O(!0);try{await e(),t&&r(t)}catch(e){r(String(e.message||e))}finally{O(!1)}}},M=async(e,t)=>{if(e===t)return;let n=k.map(e=>e.id),r=n.indexOf(e),a=n.indexOf(t);r<0||a<0||(n.splice(r,1),n.splice(a,0,e),await j(()=>i.reorder(n)))},N=()=>{let e=o?.group?[`group:${o.group}`]:o?.repo?[`repo:${o.repo}`]:o?.topic?[`topic:${o.topic}`]:[];y(async()=>{let{openTemplateEditor:e}=await import(`./index-BT2y9cTX.js`).then(e=>e.i);return{openTemplateEditor:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(({openTemplateEditor:t})=>{n.model&&t(n.model,{mode:`new`,scope:e,topic:o?.topic||``,name:``})})},P=o?.label||o?.topic||o?.group||o?.repo||`本主题`;return(0,C.jsxs)(`div`,{className:`rp-page tpl-mng-page`,children:[(0,C.jsx)(v,{}),(0,C.jsxs)(`div`,{className:`page-head`,children:[(0,C.jsxs)(`div`,{className:`title-block`,children:[(0,C.jsxs)(`h2`,{children:[(0,C.jsx)(e,{name:`gear`,size:16}),` 管理模板 · `,P]}),(0,C.jsx)(`p`,{className:`muted tpl-head-note`,children:`只显示本主题可见的模板。拖动左侧把手调整顺序,点图标改可见范围;搜索框会同步隐藏不匹配的行。`})]}),(0,C.jsx)(`div`,{className:`acts`,children:(0,C.jsxs)(c,{variant:`primary`,small:!0,disabled:E,onClick:N,children:[(0,C.jsx)(e,{name:`plus`,size:13}),` 新建模板`]})})]}),(0,C.jsx)(`div`,{className:`tpl-mng-search`,children:(0,C.jsx)(h,{value:u,onChange:d,placeholder:`搜索名称 / 正文 / 可见范围…`,title:`过滤本主题模板`,count:A.length,className:`wide`})}),k.length?(0,C.jsx)(`div`,{className:`tpl-mng-list`,children:A.map(t=>{let r=t.id===i?.defaultId;return(0,C.jsxs)(`div`,{className:[`tpl-mng-row`,f===t.id?`is-dragging`:``,m===t.id&&f!==t.id?`is-over`:``].filter(Boolean).join(` `),draggable:!0,onDragStart:e=>{p(t.id),e.dataTransfer.effectAllowed=`move`},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`,_(t.id)},onDrop:e=>{e.preventDefault(),_(null),f&&M(f,t.id),p(null)},onDragEnd:()=>{p(null),_(null)},children:[(0,C.jsx)(`span`,{className:`tpl-mng-grip`,title:`拖动排序`,children:(0,C.jsx)(e,{name:`grip`,size:14})}),(0,C.jsxs)(`div`,{className:`tpl-mng-main`,children:[(0,C.jsxs)(`div`,{className:`tpl-mng-line`,children:[(0,C.jsx)(`span`,{className:`tpl-mng-name`,children:t.name}),r&&(0,C.jsx)(`span`,{className:`tpl-badge`,children:`默认`}),t.builtin&&(0,C.jsx)(`span`,{className:`tpl-badge soft`,children:`内置`})]}),(t.scope||[]).length>0&&!w&&(0,C.jsxs)(`div`,{className:`tpl-mng-scope-sum muted`,children:[`可见:`,(t.scope||[]).join(` / `)]})]}),(0,C.jsxs)(`div`,{className:`tpl-mng-acts`,children:[(0,C.jsx)(`button`,{type:`button`,className:`iconbtn`,title:`可见范围`,onClick:()=>T(w===t.id?null:t.id),children:(0,C.jsx)(e,{name:`globe`,size:14})}),(0,C.jsx)(`button`,{type:`button`,className:`iconbtn`,title:`编辑`,onClick:()=>n.onNavigate?.(`#/templates/edit/${encodeURIComponent(t.id)}`),children:(0,C.jsx)(e,{name:`edit`,size:14})}),!r&&(0,C.jsx)(`button`,{type:`button`,className:`iconbtn`,title:`设为默认`,disabled:E,onClick:()=>j(()=>i.setDefault(t.id),`默认模板已设为「${t.name}」`),children:(0,C.jsx)(e,{name:`star`,size:14})}),!t.builtin&&(0,C.jsx)(`button`,{type:`button`,className:`iconbtn`,title:`删除`,disabled:E,onClick:()=>j(()=>i.remove(t.id),`已删除「${t.name}」`),children:(0,C.jsx)(e,{name:`trash`,size:14})})]}),w===t.id&&(0,C.jsx)(`div`,{className:`tpl-mng-scope`,children:(0,C.jsx)(D,{scope:t.scope,originTopic:t.originTopic,onChange:e=>i.update(t.id,{scope:e})})})]},t.id)})}):(0,C.jsx)(`div`,{className:`muted`,style:{padding:`8px 2px`},children:`本主题下没有可见模板。`})]})}var j=e=>`tpl:${e||`new`}`,M=`## 背景
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
## 验收
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as e,f as t,h as n,i as r,l as i,t as a,u as o}from"./popup-DZ2Khv2c.js";import{C as s,D as c,E as l,M as u,O as d,S as f,d as p,j as ee,k as m}from"./md-history-DNtgaIdH.js";var h=n(t(),1),g=e(),_=a,v={position:(e,t)=>(e.position||0)-(t.position||0)||String(e.id).localeCompare(String(t.id)),name:(e,t)=>String(e.name||``).localeCompare(String(t.name||``)),kind:(e,t)=>String(e.kind).localeCompare(String(t.kind))||String(e.name||``).localeCompare(String(t.name||``))};function te(e,{onRemove:t,onPreview:n,onPreviewMd:r,onOpenTask:i,onOpenDoc:a,onEditNote:o,onReplace:s}){let c=e.kind===`image`?m(e.id):``;return(0,g.jsxs)(`div`,{className:`att-item att-kind-${e.kind}`,children:[e.kind===`image`?(0,g.jsx)(`button`,{type:`button`,className:`att-thumb`,onClick:()=>n({src:c,name:e.name}),title:`点击看大图`,children:(0,g.jsx)(`img`,{src:c,alt:e.name,loading:`lazy`})}):(0,g.jsx)(`span`,{className:`att-kind-badge`,children:d(e.kind)}),(0,g.jsxs)(`span`,{className:`att-item-main`,children:[e.kind===`task`?(0,g.jsx)(`button`,{type:`button`,className:`att-link`,title:`跳转到任务 #${e.targetSeq??``}`,onClick:()=>i?.({key:e.targetKey,seq:e.targetSeq}),children:e.name}):e.kind===`ref`?(0,g.jsx)(`button`,{type:`button`,className:`att-link`,title:e.note||e.title||e.name||`打开文档`,onClick:()=>a?.(e.refId?`ref:`+e.refId:e.locator||e.targetRef),children:e.title||e.name}):e.kind===`url`?(0,g.jsx)(`a`,{className:`att-link`,href:e.url,target:`_blank`,rel:`noreferrer`,title:e.url,children:e.name}):(0,g.jsx)(`span`,{className:`att-item-name`,title:e.name,children:e.name}),(0,g.jsxs)(`span`,{className:`att-item-meta`,children:[e.sizeText?(0,g.jsx)(`span`,{children:e.sizeText}):null,e.kind===`mdfile`?(0,g.jsxs)(`span`,{className:`att-note`,title:e.absPath||``,children:[e.absPath||`(路径为空)`,e.missing?` · 源文件已不在`:``]}):null,e.kind===`folder`?(0,g.jsxs)(`span`,{className:`att-note`,title:e.absPath||``,children:[e.absPath||`(路径为空)`,e.missing?` · 目录已不在`:``]}):null,e.note?(0,g.jsx)(`span`,{className:`att-note`,children:e.note}):null]})]}),e.kind===`mdfile`?(0,g.jsx)(`span`,{className:`att-item-acts`,children:(0,g.jsx)(`button`,{type:`button`,className:`att-act`,title:`按 md 渲染磁盘当前内容(读时核对指纹)`,onClick:()=>r?.(e),children:`预览`})}):null,e.kind===`file`||e.kind===`image`?(0,g.jsxs)(`span`,{className:`att-item-acts`,children:[(0,g.jsx)(`a`,{className:`att-act`,href:m(e.id),target:`_blank`,rel:`noreferrer`,children:`打开`}),(0,g.jsx)(`a`,{className:`att-act`,href:m(e.id),download:e.name,children:`下载`})]}):null,e.kind===`ref`?(0,g.jsxs)(`span`,{className:`att-item-acts`,children:[o?(0,g.jsx)(`button`,{type:`button`,className:`att-act`,title:`改这条绑定的一行说明(交付清单会透出)`,onClick:()=>o(e),children:`✎ 说明`}):null,(0,g.jsx)(`button`,{type:`button`,className:`att-act`,title:`换成另一篇文档(替换这条绑定)`,onClick:()=>s?.(e),children:`⇄ 更换`})]}):null,(0,g.jsx)(`button`,{type:`button`,className:`att-x`,"aria-label":`移除 ${e.name}`,onClick:()=>t(e),children:`×`})]},e.id)}function y({host:e=`task`,hostId:t,hostKey:n,hostCwd:a,refId:d,allow:m={file:!0,url:!0,folder:!0,task:!1,ref:!1},taskOptions:y=[],docOptions:b,disabled:x=!1,disabledText:S=`提交任务后可以在这里挂附件(当前是草稿)。`,openRef:C,onChanged:w,onOpenTask:T,onOpenDoc:E}){let D=i(),{dialog:ne,node:re}=r(),[O,k]=(0,h.useState)([]),[A,j]=(0,h.useState)(!1),[M,N]=(0,h.useState)(``),[ie,P]=(0,h.useState)(!1),[ae,F]=(0,h.useState)(!1),[oe,I]=(0,h.useState)(!1),[L,se]=(0,h.useState)(`position`),[R,z]=(0,h.useState)(null),[B,V]=(0,h.useState)(null),[H,U]=(0,h.useState)(!1),[W,G]=(0,h.useState)(null),[K,q]=(0,h.useState)(null),J=(0,h.useMemo)(()=>ee(e,{hostId:t,hostKey:n,hostCwd:a,refId:d}),[e,t,n,a,d]),Y=(0,h.useCallback)(async()=>{if(x){k([]);return}j(!0),N(``);try{let e=await J.list();k((e.attachments||[]).map(u))}catch(e){N(String(e.message||e))}finally{j(!1)}},[J,x]);(0,h.useEffect)(()=>{Y()},[Y]),(0,h.useImperativeHandle)(C,()=>({open:()=>P(!0),refresh:Y}),[Y]),(0,h.useEffect)(()=>{if(!W)return;let e=e=>{e.key===`Escape`&&G(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[W]);let X=(0,h.useMemo)(()=>[...O].sort(v[L]||v.position),[O,L]),Z=X.filter(e=>e.area===`inline`),Q=X.filter(e=>e.area===`area`),ce=async(e,t)=>{if(x)return;let n=s(t),r=n.length?n:[...e||[]].filter(e=>e&&e.size>0);if(!r.length)return;I(!0);let i=0;for(let e of r)try{let t=await l(e),n=t.fileId||t.id;if(!n)throw Error(`上传未返回 fileId`);await J.attach({fileId:n,name:t.name}),i+=1}catch(t){D(`「${e.name||`文件`}」添加失败:${t.message||t}`)}I(!1),i&&(D(`已挂到附件区 ${i} 个文件`),await Y(),w?.())},$=async r=>{if(r&&e!==`doc`)try{let e=await ne({title:`说明 · ${r.name}`,input:!0,placeholder:`这一行里大概是什么(交付清单会透出给 agent)`,value:r.note||``,okText:`保存说明`});if(e===null)return;let i=typeof e==`string`?e:e&&e.value||``,s={id:Number(t),...n?{key:n}:a?{cwd:a}:{},attachment:r.id,note:i};await o(`/api/localtasks/attach-note`,{method:`PATCH`,body:s}),D(i?`已保存说明:${i}`:`已清空说明`),await Y(),w?.()}catch(e){D(`改说明失败:${e.message||e}`)}},le=e=>{e&&(V(e),P(!0))},ue=async e=>{let t=R;if(t){U(!0);try{await J.detach(t.id,!!e),z(null),D(e?`已移除并删除资源:${t.name}`:`已解除关联:${t.name}`),await Y(),w?.()}catch(e){D(`移除失败:${e.message||e}`)}finally{U(!1)}}},de=async e=>{if(e)try{let t=await o(`/api/docs/mdfile?attachment=${encodeURIComponent(String(e.id))}`),n=String(t.body||``);q({name:e.name||`md`,html:p(n),path:String(t.absPath||e.absPath||``),stale:!!t.stale,missing:!!t.missing})}catch(e){D(`读取失败:${e.message||e}`)}},fe=!A&&!M&&!O.length;return(0,g.jsxs)(`div`,{className:`att-area${x?` is-disabled`:``}`,onDragOver:e=>{!x&&[...e.dataTransfer?.types||[]].includes(`Files`)&&(e.preventDefault(),F(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||F(!1)},onDrop:e=>{F(!1),!x&&[...e.dataTransfer?.types||[]].includes(`Files`)&&(e.preventDefault(),ce(null,e))},children:[re,(0,g.jsxs)(`div`,{className:`att-area-head`+(ae&&!x?` is-over`:``),children:[(0,g.jsxs)(`span`,{className:`att-area-title`,children:[`附件`,O.length?(0,g.jsx)(`span`,{className:`att-count`,children:O.length}):null,oe?(0,g.jsx)(`span`,{className:`att-area-note`,children:`上传中…`}):null]}),(0,g.jsxs)(`span`,{className:`att-area-acts`,children:[O.length?(0,g.jsxs)(`select`,{className:`att-sort`,value:L,onChange:e=>se(e.target.value),"aria-label":`附件排序`,children:[(0,g.jsx)(`option`,{value:`position`,children:`按添加顺序`}),(0,g.jsx)(`option`,{value:`name`,children:`按名称`}),(0,g.jsx)(`option`,{value:`kind`,children:`按类型`})]}):null,(0,g.jsx)(`button`,{type:`button`,className:`btn ghost att-add-btn`,disabled:x,onClick:()=>P(!0),children:`添加附件`})]})]}),x?(0,g.jsx)(`div`,{className:`att-empty`,children:S}):null,A?(0,g.jsx)(`div`,{className:`att-empty`,children:`加载附件…`}):null,M?(0,g.jsxs)(`div`,{className:`att-empty att-err-text`,children:[`附件加载失败:`,M]}):null,fe?(0,g.jsx)(`div`,{className:`att-empty`,children:`还没有附件。拖文件到这里,或点「添加附件」——只挂附件区,不写正文。`}):null,Z.length?(0,g.jsxs)(`div`,{className:`att-section`,children:[(0,g.jsxs)(`div`,{className:`att-section-head`,children:[c.inline,(0,g.jsx)(`span`,{className:`att-section-hint`,children:`正文里的引用,删正文行会跟着消失`})]}),Z.map(t=>te(t,{onRemove:z,onPreview:G,onPreviewMd:de,onOpenTask:T,onOpenDoc:E,onEditNote:e===`task`?$:void 0,onReplace:le,key:t.id}))]}):null,Q.length?(0,g.jsxs)(`div`,{className:`att-section`,children:[(0,g.jsxs)(`div`,{className:`att-section-head`,children:[c.area,(0,g.jsx)(`span`,{className:`att-section-hint`,children:`不依赖正文,删正文行也不会丢`})]}),Q.map(t=>te(t,{onRemove:z,onPreview:G,onPreviewMd:de,onOpenTask:T,onOpenDoc:E,onEditNote:e===`task`?$:void 0,onReplace:le,key:t.id}))]}):null,(0,g.jsx)(f,{open:ie,host:e,hostId:t,hostKey:n,hostCwd:a,refId:d,allow:m,taskOptions:y,docOptions:b,replaceAttachment:B?B.id:null,replaceNote:B&&B.note||``,onClose:()=>{P(!1),V(null)},onDone:async()=>{V(null),await Y(),w?.()}}),R?(0,g.jsx)(_,{title:`移除附件`,size:`sm`,busy:H,onClose:H?void 0:()=>z(null),footer:(0,g.jsxs)(`div`,{className:`att-foot`,children:[(0,g.jsx)(`button`,{type:`button`,className:`btn ghost`,disabled:H,onClick:()=>z(null),children:`取消`}),(0,g.jsx)(`button`,{type:`button`,className:`btn`,disabled:H,onClick:()=>ue(!1),children:`只解除关联`}),(0,g.jsx)(`button`,{type:`button`,className:`btn danger`,disabled:H,onClick:()=>ue(!0),children:R.kind===`file`?`连文件一起删`:`连资源一起删`})]}),children:(0,g.jsxs)(`div`,{className:`att-confirm`,children:[(0,g.jsx)(`div`,{className:`att-confirm-name`,children:R.name}),(0,g.jsxs)(`div`,{className:`att-confirm-text`,children:[`只解除关联:从这份`,e===`task`?`任务`:`文档`,`的附件清单里移除,资源仍留在孤儿池,可被重新挂载。 连资源一起删:在本机没有其它任务/文档引用它时,删除资源行(本机文件同时删字节);仍被引用时只解除关联。`]})]})}):null,K?(0,g.jsx)(_,{title:(0,g.jsxs)(`span`,{children:[K.name,(0,g.jsx)(`span`,{className:`att-md-path`,children:K.path})]}),size:`lg`,onClose:()=>q(null),footer:(0,g.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>q(null),children:`关闭`}),children:K.missing?(0,g.jsxs)(`div`,{className:`att-empty`,children:[`源文件已不在:`,K.path||`(路径为空)`]}):(0,g.jsxs)(`div`,{className:`att-md-preview`,children:[K.stale?(0,g.jsx)(`div`,{className:`att-md-warn`,children:`内容已变化(与登记指纹不一致),以下为磁盘当前内容。`}):null,(0,g.jsx)(`article`,{dangerouslySetInnerHTML:{__html:K.html}})]})}):null,W?(0,g.jsx)(`div`,{className:`att-lightbox`,role:`dialog`,"aria-label":`图片预览`,onMouseDown:e=>{e.target===e.currentTarget&&G(null)},children:(0,g.jsxs)(`div`,{className:`att-lightbox-card`,children:[(0,g.jsxs)(`div`,{className:`att-lightbox-head`,children:[(0,g.jsx)(`span`,{className:`att-lightbox-name`,children:W.name}),(0,g.jsx)(`a`,{className:`att-lightbox-open`,href:W.src,target:`_blank`,rel:`noreferrer`,children:`新窗口打开`}),(0,g.jsx)(`button`,{type:`button`,className:`pp-x`,"aria-label":`关闭`,onClick:()=>G(null),children:`×`})]}),(0,g.jsx)(`img`,{className:`att-lightbox-img`,src:W.src,alt:W.name})]})}):null]})}function b(e=`task`,t=!0){let n=(0,h.useCallback)(t=>`nxkv.${e}Dock${t}`,[e]),[r,i]=(0,h.useState)(()=>{let e=localStorage.getItem(n(`Open`));return e===null?t:e!==`0`}),[a,o]=(0,h.useState)(()=>localStorage.getItem(n(`Tab`))||`attach`),[s,c]=(0,h.useState)(()=>{let e=Number(localStorage.getItem(n(`H`)));return Number.isFinite(e)&&e>=96?e:176}),l=(0,h.useRef)(s);l.current=s;let u=(0,h.useRef)(null),[d,f]=(0,h.useState)(!1),p=(0,h.useRef)(176);return(0,h.useEffect)(()=>{localStorage.setItem(n(`Open`),r?`1`:`0`)},[r,n]),(0,h.useEffect)(()=>{localStorage.setItem(n(`Tab`),a)},[a,n]),{dockOpen:r,setDockOpen:i,dockTab:a,setDockTab:o,dockH:s,dockHRef:l,dockRef:u,dockMax:d,setDockMax:f,dockPrevHRef:p,showDockTab:(0,h.useCallback)(e=>{o(e),i(!0)},[]),onDockDragStart:(0,h.useCallback)(e=>{if(!r)return;e.preventDefault(),f(!1);let t=e.clientY,i=l.current,a=u.current?.parentElement?.clientHeight||window.innerHeight,o=e=>Math.max(96,Math.min(Math.round(a*.62),Math.round(e))),s=e=>{let n=o(i-(e.clientY-t));l.current=n,c(n)},d=()=>{window.removeEventListener(`mousemove`,s),window.removeEventListener(`mouseup`,d),document.body.style.userSelect=``,document.body.style.cursor=``,localStorage.setItem(n(`H`),String(l.current))};document.body.style.userSelect=`none`,document.body.style.cursor=`row-resize`,window.addEventListener(`mousemove`,s),window.addEventListener(`mouseup`,d)},[r,n]),toggleDockMax:(0,h.useCallback)(()=>{if(d){c(p.current),f(!1);return}p.current=l.current;let e=u.current?.parentElement?.clientHeight||window.innerHeight,t=Math.max(96,Math.round(e*.62));l.current=t,c(t),f(!0)},[d])}}var x=`nx-kv-ack-rail-pos`,S=`nx-kv-doc-rail-pos`;function C(e={}){let{x:t,y:n,parentW:r,parentH:i,railW:a=0,railH:o=0,margin:s=8}=e||{};if(![t,n,r,i].every(e=>Number.isFinite(e)))return null;let c=Number(t),l=Number(n),u=Number(r),d=Number(i),f=Math.max(s,u-a-s),p=Math.max(s,d-o-s);return{x:Math.min(f,Math.max(s,c)),y:Math.min(p,Math.max(s,l))}}function w(e=x){try{let t=JSON.parse(localStorage.getItem(e)||`null`);if(!t||typeof t!=`object`)return null;let n=Number(t.x),r=Number(t.y);return!Number.isFinite(n)||!Number.isFinite(r)?null:{x:n,y:r}}catch{return null}}function T(e,t=x){try{e?localStorage.setItem(t,JSON.stringify({x:Math.round(e.x),y:Math.round(e.y)})):localStorage.removeItem(t)}catch{}}var E=4;function D(e){let[t,n]=(0,h.useState)(()=>w(e)),[r,i]=(0,h.useState)(!1),a=(0,h.useRef)(null),o=(0,h.useRef)(null),s=(0,h.useRef)(!1);(0,h.useEffect)(()=>{let e=a.current,t=e&&e.parentElement;if(!e||!t)return;let r=()=>{n(n=>{if(!n)return n;let r=t.getBoundingClientRect(),i=e.getBoundingClientRect(),a=C({x:n.x,y:n.y,parentW:r.width,parentH:r.height,railW:i.width,railH:i.height});return a&&(a.x!==n.x||a.y!==n.y)?a:n})};return r(),window.addEventListener(`resize`,r,{passive:!0}),()=>window.removeEventListener(`resize`,r)},[]);let c=(0,h.useCallback)(e=>{if(e.pointerType===`mouse`&&e.button!==0)return;let t=a.current,n=t&&t.parentElement;if(!t||!n)return;let r=t.style.bottom;t.style.bottom=`auto`;let i=t.getBoundingClientRect();t.style.bottom=r||``;let s=n.getBoundingClientRect();o.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,startLeft:i.left-s.left,startTop:i.top-s.top,parentW:s.width,parentH:s.height,railW:i.width,railH:i.height,moved:!1};try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}},[]),l=(0,h.useCallback)(e=>{let t=o.current;if(!t||e.pointerId!==t.pointerId)return;let r=e.clientX-t.startX,a=e.clientY-t.startY;if(!t.moved){if(Math.hypot(r,a)<E)return;t.moved=!0,s.current=!0,i(!0),document.body.style.userSelect=`none`}let c=C({x:t.startLeft+r,y:t.startTop+a,parentW:t.parentW,parentH:t.parentH,railW:t.railW,railH:t.railH});c&&(t.last=c,n(c))},[]),u=(0,h.useCallback)(t=>{let n=o.current;n&&t.pointerId===n.pointerId&&(o.current=null,n.moved&&(i(!1),document.body.style.userSelect=``,T(n.last,e)))},[e]),d=(0,h.useCallback)(()=>{n(null),T(null,e)},[e]);return{railRef:a,pos:t,dragging:r,draggedRef:s,resetPos:d,handleProps:{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,onDoubleClick:d}}}export{y as i,S as n,b as r,D as t};
|
|
1
|
+
import{d as e,f as t,h as n,i as r,l as i,t as a,u as o}from"./popup-DZ2Khv2c.js";import{C as s,D as c,E as l,M as u,O as d,S as f,d as p,j as ee,k as m}from"./md-history-CJ1N9-Jf.js";var h=n(t(),1),g=e(),_=a,v={position:(e,t)=>(e.position||0)-(t.position||0)||String(e.id).localeCompare(String(t.id)),name:(e,t)=>String(e.name||``).localeCompare(String(t.name||``)),kind:(e,t)=>String(e.kind).localeCompare(String(t.kind))||String(e.name||``).localeCompare(String(t.name||``))};function te(e,{onRemove:t,onPreview:n,onPreviewMd:r,onOpenTask:i,onOpenDoc:a,onEditNote:o,onReplace:s}){let c=e.kind===`image`?m(e.id):``;return(0,g.jsxs)(`div`,{className:`att-item att-kind-${e.kind}`,children:[e.kind===`image`?(0,g.jsx)(`button`,{type:`button`,className:`att-thumb`,onClick:()=>n({src:c,name:e.name}),title:`点击看大图`,children:(0,g.jsx)(`img`,{src:c,alt:e.name,loading:`lazy`})}):(0,g.jsx)(`span`,{className:`att-kind-badge`,children:d(e.kind)}),(0,g.jsxs)(`span`,{className:`att-item-main`,children:[e.kind===`task`?(0,g.jsx)(`button`,{type:`button`,className:`att-link`,title:`跳转到任务 #${e.targetSeq??``}`,onClick:()=>i?.({key:e.targetKey,seq:e.targetSeq}),children:e.name}):e.kind===`ref`?(0,g.jsx)(`button`,{type:`button`,className:`att-link`,title:e.note||e.title||e.name||`打开文档`,onClick:()=>a?.(e.refId?`ref:`+e.refId:e.locator||e.targetRef),children:e.title||e.name}):e.kind===`url`?(0,g.jsx)(`a`,{className:`att-link`,href:e.url,target:`_blank`,rel:`noreferrer`,title:e.url,children:e.name}):(0,g.jsx)(`span`,{className:`att-item-name`,title:e.name,children:e.name}),(0,g.jsxs)(`span`,{className:`att-item-meta`,children:[e.sizeText?(0,g.jsx)(`span`,{children:e.sizeText}):null,e.kind===`mdfile`?(0,g.jsxs)(`span`,{className:`att-note`,title:e.absPath||``,children:[e.absPath||`(路径为空)`,e.missing?` · 源文件已不在`:``]}):null,e.kind===`folder`?(0,g.jsxs)(`span`,{className:`att-note`,title:e.absPath||``,children:[e.absPath||`(路径为空)`,e.missing?` · 目录已不在`:``]}):null,e.note?(0,g.jsx)(`span`,{className:`att-note`,children:e.note}):null]})]}),e.kind===`mdfile`?(0,g.jsx)(`span`,{className:`att-item-acts`,children:(0,g.jsx)(`button`,{type:`button`,className:`att-act`,title:`按 md 渲染磁盘当前内容(读时核对指纹)`,onClick:()=>r?.(e),children:`预览`})}):null,e.kind===`file`||e.kind===`image`?(0,g.jsxs)(`span`,{className:`att-item-acts`,children:[(0,g.jsx)(`a`,{className:`att-act`,href:m(e.id),target:`_blank`,rel:`noreferrer`,children:`打开`}),(0,g.jsx)(`a`,{className:`att-act`,href:m(e.id),download:e.name,children:`下载`})]}):null,e.kind===`ref`?(0,g.jsxs)(`span`,{className:`att-item-acts`,children:[o?(0,g.jsx)(`button`,{type:`button`,className:`att-act`,title:`改这条绑定的一行说明(交付清单会透出)`,onClick:()=>o(e),children:`✎ 说明`}):null,(0,g.jsx)(`button`,{type:`button`,className:`att-act`,title:`换成另一篇文档(替换这条绑定)`,onClick:()=>s?.(e),children:`⇄ 更换`})]}):null,(0,g.jsx)(`button`,{type:`button`,className:`att-x`,"aria-label":`移除 ${e.name}`,onClick:()=>t(e),children:`×`})]},e.id)}function y({host:e=`task`,hostId:t,hostKey:n,hostCwd:a,refId:d,allow:m={file:!0,url:!0,folder:!0,task:!1,ref:!1},taskOptions:y=[],docOptions:b,disabled:x=!1,disabledText:S=`提交任务后可以在这里挂附件(当前是草稿)。`,openRef:C,onChanged:w,onOpenTask:T,onOpenDoc:E}){let D=i(),{dialog:ne,node:re}=r(),[O,k]=(0,h.useState)([]),[A,j]=(0,h.useState)(!1),[M,N]=(0,h.useState)(``),[ie,P]=(0,h.useState)(!1),[ae,F]=(0,h.useState)(!1),[oe,I]=(0,h.useState)(!1),[L,se]=(0,h.useState)(`position`),[R,z]=(0,h.useState)(null),[B,V]=(0,h.useState)(null),[H,U]=(0,h.useState)(!1),[W,G]=(0,h.useState)(null),[K,q]=(0,h.useState)(null),J=(0,h.useMemo)(()=>ee(e,{hostId:t,hostKey:n,hostCwd:a,refId:d}),[e,t,n,a,d]),Y=(0,h.useCallback)(async()=>{if(x){k([]);return}j(!0),N(``);try{let e=await J.list();k((e.attachments||[]).map(u))}catch(e){N(String(e.message||e))}finally{j(!1)}},[J,x]);(0,h.useEffect)(()=>{Y()},[Y]),(0,h.useImperativeHandle)(C,()=>({open:()=>P(!0),refresh:Y}),[Y]),(0,h.useEffect)(()=>{if(!W)return;let e=e=>{e.key===`Escape`&&G(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[W]);let X=(0,h.useMemo)(()=>[...O].sort(v[L]||v.position),[O,L]),Z=X.filter(e=>e.area===`inline`),Q=X.filter(e=>e.area===`area`),ce=async(e,t)=>{if(x)return;let n=s(t),r=n.length?n:[...e||[]].filter(e=>e&&e.size>0);if(!r.length)return;I(!0);let i=0;for(let e of r)try{let t=await l(e),n=t.fileId||t.id;if(!n)throw Error(`上传未返回 fileId`);await J.attach({fileId:n,name:t.name}),i+=1}catch(t){D(`「${e.name||`文件`}」添加失败:${t.message||t}`)}I(!1),i&&(D(`已挂到附件区 ${i} 个文件`),await Y(),w?.())},$=async r=>{if(r&&e!==`doc`)try{let e=await ne({title:`说明 · ${r.name}`,input:!0,placeholder:`这一行里大概是什么(交付清单会透出给 agent)`,value:r.note||``,okText:`保存说明`});if(e===null)return;let i=typeof e==`string`?e:e&&e.value||``,s={id:Number(t),...n?{key:n}:a?{cwd:a}:{},attachment:r.id,note:i};await o(`/api/localtasks/attach-note`,{method:`PATCH`,body:s}),D(i?`已保存说明:${i}`:`已清空说明`),await Y(),w?.()}catch(e){D(`改说明失败:${e.message||e}`)}},le=e=>{e&&(V(e),P(!0))},ue=async e=>{let t=R;if(t){U(!0);try{await J.detach(t.id,!!e),z(null),D(e?`已移除并删除资源:${t.name}`:`已解除关联:${t.name}`),await Y(),w?.()}catch(e){D(`移除失败:${e.message||e}`)}finally{U(!1)}}},de=async e=>{if(e)try{let t=await o(`/api/docs/mdfile?attachment=${encodeURIComponent(String(e.id))}`),n=String(t.body||``);q({name:e.name||`md`,html:p(n),path:String(t.absPath||e.absPath||``),stale:!!t.stale,missing:!!t.missing})}catch(e){D(`读取失败:${e.message||e}`)}},fe=!A&&!M&&!O.length;return(0,g.jsxs)(`div`,{className:`att-area${x?` is-disabled`:``}`,onDragOver:e=>{!x&&[...e.dataTransfer?.types||[]].includes(`Files`)&&(e.preventDefault(),F(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||F(!1)},onDrop:e=>{F(!1),!x&&[...e.dataTransfer?.types||[]].includes(`Files`)&&(e.preventDefault(),ce(null,e))},children:[re,(0,g.jsxs)(`div`,{className:`att-area-head`+(ae&&!x?` is-over`:``),children:[(0,g.jsxs)(`span`,{className:`att-area-title`,children:[`附件`,O.length?(0,g.jsx)(`span`,{className:`att-count`,children:O.length}):null,oe?(0,g.jsx)(`span`,{className:`att-area-note`,children:`上传中…`}):null]}),(0,g.jsxs)(`span`,{className:`att-area-acts`,children:[O.length?(0,g.jsxs)(`select`,{className:`att-sort`,value:L,onChange:e=>se(e.target.value),"aria-label":`附件排序`,children:[(0,g.jsx)(`option`,{value:`position`,children:`按添加顺序`}),(0,g.jsx)(`option`,{value:`name`,children:`按名称`}),(0,g.jsx)(`option`,{value:`kind`,children:`按类型`})]}):null,(0,g.jsx)(`button`,{type:`button`,className:`btn ghost att-add-btn`,disabled:x,onClick:()=>P(!0),children:`添加附件`})]})]}),x?(0,g.jsx)(`div`,{className:`att-empty`,children:S}):null,A?(0,g.jsx)(`div`,{className:`att-empty`,children:`加载附件…`}):null,M?(0,g.jsxs)(`div`,{className:`att-empty att-err-text`,children:[`附件加载失败:`,M]}):null,fe?(0,g.jsx)(`div`,{className:`att-empty`,children:`还没有附件。拖文件到这里,或点「添加附件」——只挂附件区,不写正文。`}):null,Z.length?(0,g.jsxs)(`div`,{className:`att-section`,children:[(0,g.jsxs)(`div`,{className:`att-section-head`,children:[c.inline,(0,g.jsx)(`span`,{className:`att-section-hint`,children:`正文里的引用,删正文行会跟着消失`})]}),Z.map(t=>te(t,{onRemove:z,onPreview:G,onPreviewMd:de,onOpenTask:T,onOpenDoc:E,onEditNote:e===`task`?$:void 0,onReplace:le,key:t.id}))]}):null,Q.length?(0,g.jsxs)(`div`,{className:`att-section`,children:[(0,g.jsxs)(`div`,{className:`att-section-head`,children:[c.area,(0,g.jsx)(`span`,{className:`att-section-hint`,children:`不依赖正文,删正文行也不会丢`})]}),Q.map(t=>te(t,{onRemove:z,onPreview:G,onPreviewMd:de,onOpenTask:T,onOpenDoc:E,onEditNote:e===`task`?$:void 0,onReplace:le,key:t.id}))]}):null,(0,g.jsx)(f,{open:ie,host:e,hostId:t,hostKey:n,hostCwd:a,refId:d,allow:m,taskOptions:y,docOptions:b,replaceAttachment:B?B.id:null,replaceNote:B&&B.note||``,onClose:()=>{P(!1),V(null)},onDone:async()=>{V(null),await Y(),w?.()}}),R?(0,g.jsx)(_,{title:`移除附件`,size:`sm`,busy:H,onClose:H?void 0:()=>z(null),footer:(0,g.jsxs)(`div`,{className:`att-foot`,children:[(0,g.jsx)(`button`,{type:`button`,className:`btn ghost`,disabled:H,onClick:()=>z(null),children:`取消`}),(0,g.jsx)(`button`,{type:`button`,className:`btn`,disabled:H,onClick:()=>ue(!1),children:`只解除关联`}),(0,g.jsx)(`button`,{type:`button`,className:`btn danger`,disabled:H,onClick:()=>ue(!0),children:R.kind===`file`?`连文件一起删`:`连资源一起删`})]}),children:(0,g.jsxs)(`div`,{className:`att-confirm`,children:[(0,g.jsx)(`div`,{className:`att-confirm-name`,children:R.name}),(0,g.jsxs)(`div`,{className:`att-confirm-text`,children:[`只解除关联:从这份`,e===`task`?`任务`:`文档`,`的附件清单里移除,资源仍留在孤儿池,可被重新挂载。 连资源一起删:在本机没有其它任务/文档引用它时,删除资源行(本机文件同时删字节);仍被引用时只解除关联。`]})]})}):null,K?(0,g.jsx)(_,{title:(0,g.jsxs)(`span`,{children:[K.name,(0,g.jsx)(`span`,{className:`att-md-path`,children:K.path})]}),size:`lg`,onClose:()=>q(null),footer:(0,g.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>q(null),children:`关闭`}),children:K.missing?(0,g.jsxs)(`div`,{className:`att-empty`,children:[`源文件已不在:`,K.path||`(路径为空)`]}):(0,g.jsxs)(`div`,{className:`att-md-preview`,children:[K.stale?(0,g.jsx)(`div`,{className:`att-md-warn`,children:`内容已变化(与登记指纹不一致),以下为磁盘当前内容。`}):null,(0,g.jsx)(`article`,{dangerouslySetInnerHTML:{__html:K.html}})]})}):null,W?(0,g.jsx)(`div`,{className:`att-lightbox`,role:`dialog`,"aria-label":`图片预览`,onMouseDown:e=>{e.target===e.currentTarget&&G(null)},children:(0,g.jsxs)(`div`,{className:`att-lightbox-card`,children:[(0,g.jsxs)(`div`,{className:`att-lightbox-head`,children:[(0,g.jsx)(`span`,{className:`att-lightbox-name`,children:W.name}),(0,g.jsx)(`a`,{className:`att-lightbox-open`,href:W.src,target:`_blank`,rel:`noreferrer`,children:`新窗口打开`}),(0,g.jsx)(`button`,{type:`button`,className:`pp-x`,"aria-label":`关闭`,onClick:()=>G(null),children:`×`})]}),(0,g.jsx)(`img`,{className:`att-lightbox-img`,src:W.src,alt:W.name})]})}):null]})}function b(e=`task`,t=!0){let n=(0,h.useCallback)(t=>`nxkv.${e}Dock${t}`,[e]),[r,i]=(0,h.useState)(()=>{let e=localStorage.getItem(n(`Open`));return e===null?t:e!==`0`}),[a,o]=(0,h.useState)(()=>localStorage.getItem(n(`Tab`))||`attach`),[s,c]=(0,h.useState)(()=>{let e=Number(localStorage.getItem(n(`H`)));return Number.isFinite(e)&&e>=96?e:176}),l=(0,h.useRef)(s);l.current=s;let u=(0,h.useRef)(null),[d,f]=(0,h.useState)(!1),p=(0,h.useRef)(176);return(0,h.useEffect)(()=>{localStorage.setItem(n(`Open`),r?`1`:`0`)},[r,n]),(0,h.useEffect)(()=>{localStorage.setItem(n(`Tab`),a)},[a,n]),{dockOpen:r,setDockOpen:i,dockTab:a,setDockTab:o,dockH:s,dockHRef:l,dockRef:u,dockMax:d,setDockMax:f,dockPrevHRef:p,showDockTab:(0,h.useCallback)(e=>{o(e),i(!0)},[]),onDockDragStart:(0,h.useCallback)(e=>{if(!r)return;e.preventDefault(),f(!1);let t=e.clientY,i=l.current,a=u.current?.parentElement?.clientHeight||window.innerHeight,o=e=>Math.max(96,Math.min(Math.round(a*.62),Math.round(e))),s=e=>{let n=o(i-(e.clientY-t));l.current=n,c(n)},d=()=>{window.removeEventListener(`mousemove`,s),window.removeEventListener(`mouseup`,d),document.body.style.userSelect=``,document.body.style.cursor=``,localStorage.setItem(n(`H`),String(l.current))};document.body.style.userSelect=`none`,document.body.style.cursor=`row-resize`,window.addEventListener(`mousemove`,s),window.addEventListener(`mouseup`,d)},[r,n]),toggleDockMax:(0,h.useCallback)(()=>{if(d){c(p.current),f(!1);return}p.current=l.current;let e=u.current?.parentElement?.clientHeight||window.innerHeight,t=Math.max(96,Math.round(e*.62));l.current=t,c(t),f(!0)},[d])}}var x=`nx-kv-ack-rail-pos`,S=`nx-kv-doc-rail-pos`;function C(e={}){let{x:t,y:n,parentW:r,parentH:i,railW:a=0,railH:o=0,margin:s=8}=e||{};if(![t,n,r,i].every(e=>Number.isFinite(e)))return null;let c=Number(t),l=Number(n),u=Number(r),d=Number(i),f=Math.max(s,u-a-s),p=Math.max(s,d-o-s);return{x:Math.min(f,Math.max(s,c)),y:Math.min(p,Math.max(s,l))}}function w(e=x){try{let t=JSON.parse(localStorage.getItem(e)||`null`);if(!t||typeof t!=`object`)return null;let n=Number(t.x),r=Number(t.y);return!Number.isFinite(n)||!Number.isFinite(r)?null:{x:n,y:r}}catch{return null}}function T(e,t=x){try{e?localStorage.setItem(t,JSON.stringify({x:Math.round(e.x),y:Math.round(e.y)})):localStorage.removeItem(t)}catch{}}var E=4;function D(e){let[t,n]=(0,h.useState)(()=>w(e)),[r,i]=(0,h.useState)(!1),a=(0,h.useRef)(null),o=(0,h.useRef)(null),s=(0,h.useRef)(!1);(0,h.useEffect)(()=>{let e=a.current,t=e&&e.parentElement;if(!e||!t)return;let r=()=>{n(n=>{if(!n)return n;let r=t.getBoundingClientRect(),i=e.getBoundingClientRect(),a=C({x:n.x,y:n.y,parentW:r.width,parentH:r.height,railW:i.width,railH:i.height});return a&&(a.x!==n.x||a.y!==n.y)?a:n})};return r(),window.addEventListener(`resize`,r,{passive:!0}),()=>window.removeEventListener(`resize`,r)},[]);let c=(0,h.useCallback)(e=>{if(e.pointerType===`mouse`&&e.button!==0)return;let t=a.current,n=t&&t.parentElement;if(!t||!n)return;let r=t.style.bottom;t.style.bottom=`auto`;let i=t.getBoundingClientRect();t.style.bottom=r||``;let s=n.getBoundingClientRect();o.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,startLeft:i.left-s.left,startTop:i.top-s.top,parentW:s.width,parentH:s.height,railW:i.width,railH:i.height,moved:!1};try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}},[]),l=(0,h.useCallback)(e=>{let t=o.current;if(!t||e.pointerId!==t.pointerId)return;let r=e.clientX-t.startX,a=e.clientY-t.startY;if(!t.moved){if(Math.hypot(r,a)<E)return;t.moved=!0,s.current=!0,i(!0),document.body.style.userSelect=`none`}let c=C({x:t.startLeft+r,y:t.startTop+a,parentW:t.parentW,parentH:t.parentH,railW:t.railW,railH:t.railH});c&&(t.last=c,n(c))},[]),u=(0,h.useCallback)(t=>{let n=o.current;n&&t.pointerId===n.pointerId&&(o.current=null,n.moved&&(i(!1),document.body.style.userSelect=``,T(n.last,e)))},[e]),d=(0,h.useCallback)(()=>{n(null),T(null,e)},[e]);return{railRef:a,pos:t,dragging:r,draggedRef:s,resetPos:d,handleProps:{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,onDoubleClick:d}}}export{y as i,S as n,b as r,D as t};
|
|
@@ -12,26 +12,26 @@
|
|
|
12
12
|
<!-- .ico 兜底:浏览器不认上面的 <link> 时会自己请求 /favicon.ico -->
|
|
13
13
|
<link rel="icon" type="image/x-icon" href="/favicon.ico">
|
|
14
14
|
<link rel="apple-touch-icon" sizes="512x512" href="/logo-rounded.png">
|
|
15
|
-
<script type="module" crossorigin src="/assets/index-
|
|
15
|
+
<script type="module" crossorigin src="/assets/index-BT2y9cTX.js"></script>
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/popup-DZ2Khv2c.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/workspace-DojQ3RP4.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="/assets/button-3JlUeln_.js">
|
|
19
19
|
<link rel="modulepreload" crossorigin href="/assets/app-context-BqCBcDsx.js">
|
|
20
|
-
<link rel="modulepreload" crossorigin href="/assets/frontmatter-
|
|
21
|
-
<link rel="modulepreload" crossorigin href="/assets/status-tag-
|
|
22
|
-
<link rel="modulepreload" crossorigin href="/assets/md-history-
|
|
23
|
-
<link rel="modulepreload" crossorigin href="/assets/use-rail-drag-
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/frontmatter-Bcseml1q.js">
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/assets/status-tag-C9YVBvQh.js">
|
|
22
|
+
<link rel="modulepreload" crossorigin href="/assets/md-history-CJ1N9-Jf.js">
|
|
23
|
+
<link rel="modulepreload" crossorigin href="/assets/use-rail-drag-Boxl7pOG.js">
|
|
24
24
|
<link rel="modulepreload" crossorigin href="/assets/list-filter-CWxiOSg_.js">
|
|
25
|
-
<link rel="modulepreload" crossorigin href="/assets/board-view-
|
|
26
|
-
<link rel="modulepreload" crossorigin href="/assets/route-crumb-
|
|
27
|
-
<link rel="modulepreload" crossorigin href="/assets/doc-
|
|
28
|
-
<link rel="modulepreload" crossorigin href="/assets/repo-form-modal-
|
|
29
|
-
<link rel="modulepreload" crossorigin href="/assets/model-
|
|
25
|
+
<link rel="modulepreload" crossorigin href="/assets/board-view-Cwot54HC.js">
|
|
26
|
+
<link rel="modulepreload" crossorigin href="/assets/route-crumb-SiMi2C_T.js">
|
|
27
|
+
<link rel="modulepreload" crossorigin href="/assets/doc-DsRb-4WT.js">
|
|
28
|
+
<link rel="modulepreload" crossorigin href="/assets/repo-form-modal-DChK4NSX.js">
|
|
29
|
+
<link rel="modulepreload" crossorigin href="/assets/model-TD5kGXzR.js">
|
|
30
30
|
<link rel="stylesheet" crossorigin href="/assets/popup-BAvk7J7u.css">
|
|
31
31
|
<link rel="stylesheet" crossorigin href="/assets/button-DA4lNJeC.css">
|
|
32
32
|
<link rel="stylesheet" crossorigin href="/assets/md-history-CLIs9Dr0.css">
|
|
33
33
|
<link rel="stylesheet" crossorigin href="/assets/doc-Iuxssa-b.css">
|
|
34
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
34
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DSAamoav.css">
|
|
35
35
|
</head>
|
|
36
36
|
<body>
|
|
37
37
|
<div id="root"></div>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { edgesFromTasks } from './types.js';
|
|
2
|
-
import type { WorkflowSnapshot } from './types.js';
|
|
3
|
-
|
|
4
|
-
export { edgesFromTasks };
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 从快照边表收集某节点的前驱 id。
|
|
8
|
-
*/
|
|
9
|
-
export function predecessorsOf(snap: WorkflowSnapshot, nodeId: string | number): Array<string | number> {
|
|
10
|
-
const id = String(nodeId);
|
|
11
|
-
const out: Array<string | number> = [];
|
|
12
|
-
for (const e of snap?.edges || []) {
|
|
13
|
-
if (String(e.to) === id) out.push(e.from);
|
|
14
|
-
}
|
|
15
|
-
return out;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 某节点的后继 id。
|
|
20
|
-
*/
|
|
21
|
-
export function successorsOf(snap: WorkflowSnapshot, nodeId: string | number): Array<string | number> {
|
|
22
|
-
const id = String(nodeId);
|
|
23
|
-
const out: Array<string | number> = [];
|
|
24
|
-
for (const e of snap?.edges || []) {
|
|
25
|
-
if (String(e.from) === id) out.push(e.to);
|
|
26
|
-
}
|
|
27
|
-
return out;
|
|
28
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
// workflow 目标目录规范(按 nx-kv 分层 + 语义子目录)。
|
|
2
|
-
//
|
|
3
|
-
// 原则
|
|
4
|
-
// 1. 禁止平行顶层 src/{facade,store,mutator,scheduler,plugins}/。
|
|
5
|
-
// 同名语义**必须**落在 modules 或 core/workflow 的子目录里。
|
|
6
|
-
// 2. **全部 goal 同一目录、每种一份**——block / wait / time / task 都在
|
|
7
|
-
// tasktool/plugins/;禁止再拆「core 一份 + modules 一份」。
|
|
8
|
-
// 3. localtask = 写侧(store/mutator/scheduler/bus);
|
|
9
|
-
// tasktool = 消费门面 + goal 族;二者成对,允许互引
|
|
10
|
-
// (scheduler 调 blockgoal → import tasktool/plugins 即可)。
|
|
11
|
-
// 4. 面板只吃 /api;两端同构投影才进 shared/。
|
|
12
|
-
// 5. JS ESM only;子目录均带 index.js 桶文件对外导出。
|
|
13
|
-
//
|
|
14
|
-
// 依赖方向(单向)
|
|
15
|
-
// web → modules → core/workflow → Node 内置
|
|
16
|
-
// tasktool/facade ──▶ localtask/{store,mutator}
|
|
17
|
-
// localtask/scheduler ──▶ tasktool/plugins/blockgoal + core readiness + bus
|
|
18
|
-
// localtask/mutator ──▶ localtask/store
|
|
19
|
-
// tasktool/plugins/runtime ──▶ 同目录各 goal
|
|
20
|
-
//
|
|
21
|
-
// ---------------------------------------------------------------------------
|
|
22
|
-
// 目标树(✅ 已有 / ○ 待落地 / → 自现状迁入)
|
|
23
|
-
// ---------------------------------------------------------------------------
|
|
24
|
-
//
|
|
25
|
-
// src/core/workflow/
|
|
26
|
-
// ├── types.js ✅
|
|
27
|
-
// ├── snapshot.example.json ✅
|
|
28
|
-
// ├── layout.js ✅ 本规范
|
|
29
|
-
// ├── readiness.js ✅ 自 dag 下沉
|
|
30
|
-
// ├── edges.js ✅
|
|
31
|
-
// ├── event-names.js ✅
|
|
32
|
-
// └── plugin-registry.js ✅ 按 name / scope 校验
|
|
33
|
-
//
|
|
34
|
-
// src/modules/localtask/
|
|
35
|
-
// ├── index.js / service.js ✅ 模块壳;complete → refreshTopicAfterComplete
|
|
36
|
-
// ├── dag.js ✅ 再导出 readiness
|
|
37
|
-
// ├── engine.js / writes.js ✅ 主题引擎;DAG 日常写经 Mutator
|
|
38
|
-
// ├── store/ ✅ SnapshotStore + memory/file/topic adapter
|
|
39
|
-
// ├── bus/ mutator/ scheduler/ ✅
|
|
40
|
-
//
|
|
41
|
-
// src/modules/tasktool/
|
|
42
|
-
// ├── index.js ✅
|
|
43
|
-
// ├── facade/ ✅ submit/get/wait 再导出
|
|
44
|
-
// ├── plugins/ ✅ 目录扫描 IoC + 实现同目录
|
|
45
|
-
// │ ├── discover.js 扫描注册(跳过 *-store/*-config)
|
|
46
|
-
// │ ├── *-store.js / waitgoal-config 原 timegoal/taskgoal/getloop 迁入
|
|
47
|
-
// │ └── block|wait|time|task goal.js definePlugin
|
|
48
|
-
// ├── facade/ ✅ submit→store+入队;get→AsyncIterable
|
|
49
|
-
// ├── groupctx.js / attach.js ✅
|
|
50
|
-
// └── getloop/timegoal/taskgoal.js ✅ 薄再导出 → plugins/*
|
|
51
|
-
//
|
|
52
|
-
// 为何 blockgoal 也进 tasktool/plugins(不留 core)
|
|
53
|
-
// goal 是插件族,视觉与注册平级;拆到 core 会造成「调度 goal 一套路径、
|
|
54
|
-
// 消费 goal 另一套路径」。localtask↔tasktool 本就可配对互引,scheduler
|
|
55
|
-
// 直接 import blockgoal 即可,无需为避依赖把家族拆开。
|
|
56
|
-
//
|
|
57
|
-
// ---------------------------------------------------------------------------
|
|
58
|
-
|
|
59
|
-
export const TARGET_PATHS: Readonly<Record<string, string>> = Object.freeze({
|
|
60
|
-
'core types': 'src/core/workflow/types.js',
|
|
61
|
-
'snapshot example': 'src/core/workflow/snapshot.example.json',
|
|
62
|
-
'this layout norm': 'src/core/workflow/layout.js',
|
|
63
|
-
readiness: 'src/core/workflow/readiness.js',
|
|
64
|
-
'plugin registry': 'src/core/workflow/plugin-registry.js',
|
|
65
|
-
'store/': 'src/modules/localtask/store/',
|
|
66
|
-
'store barrel': 'src/modules/localtask/store/index.js',
|
|
67
|
-
'store file-adapter': 'src/modules/localtask/store/file-adapter.js',
|
|
68
|
-
'store memory-adapter': 'src/modules/localtask/store/memory-adapter.js',
|
|
69
|
-
'bus/': 'src/modules/localtask/bus/',
|
|
70
|
-
'bus barrel': 'src/modules/localtask/bus/index.js',
|
|
71
|
-
'mutator/': 'src/modules/localtask/mutator/',
|
|
72
|
-
'mutator barrel': 'src/modules/localtask/mutator/index.js',
|
|
73
|
-
'mutator validate': 'src/modules/localtask/mutator/validate.js',
|
|
74
|
-
'scheduler/': 'src/modules/localtask/scheduler/',
|
|
75
|
-
'scheduler barrel': 'src/modules/localtask/scheduler/index.js',
|
|
76
|
-
'scheduler state-drive': 'src/modules/localtask/scheduler/state-drive.js',
|
|
77
|
-
'facade/': 'src/modules/tasktool/facade/',
|
|
78
|
-
'facade barrel': 'src/modules/tasktool/facade/index.js',
|
|
79
|
-
'facade submit': 'src/modules/tasktool/facade/submit.js',
|
|
80
|
-
'facade get': 'src/modules/tasktool/facade/get.js',
|
|
81
|
-
'facade wait': 'src/modules/tasktool/facade/wait.js',
|
|
82
|
-
'plugins/': 'src/modules/tasktool/plugins/',
|
|
83
|
-
'plugins barrel': 'src/modules/tasktool/plugins/index.js',
|
|
84
|
-
'plugins runtime': 'src/modules/tasktool/plugins/runtime.js',
|
|
85
|
-
blockgoal: 'src/modules/tasktool/plugins/blockgoal.js',
|
|
86
|
-
waitgoal: 'src/modules/tasktool/plugins/waitgoal.js',
|
|
87
|
-
timegoal: 'src/modules/tasktool/plugins/timegoal.js',
|
|
88
|
-
taskgoal: 'src/modules/tasktool/plugins/taskgoal.js',
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
/** 全部 goal 唯一落点(同一目录;禁止第二份) */
|
|
92
|
-
export const GOAL_HOMES = Object.freeze({
|
|
93
|
-
blockgoal: 'src/modules/tasktool/plugins/blockgoal.js',
|
|
94
|
-
waitgoal: 'src/modules/tasktool/plugins/waitgoal.js',
|
|
95
|
-
timegoal: 'src/modules/tasktool/plugins/timegoal.js',
|
|
96
|
-
taskgoal: 'src/modules/tasktool/plugins/taskgoal.js',
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
/** 必须出现的语义子目录(相对仓库根) */
|
|
100
|
-
export const REQUIRED_SEMANTIC_DIRS = Object.freeze([
|
|
101
|
-
'src/modules/localtask/store',
|
|
102
|
-
'src/modules/localtask/bus',
|
|
103
|
-
'src/modules/localtask/mutator',
|
|
104
|
-
'src/modules/localtask/scheduler',
|
|
105
|
-
'src/modules/tasktool/facade',
|
|
106
|
-
'src/modules/tasktool/plugins',
|
|
107
|
-
]);
|
|
108
|
-
|
|
109
|
-
/** 禁止的平行顶层 */
|
|
110
|
-
export const FORBIDDEN_TOP_LEVEL = Object.freeze([
|
|
111
|
-
'src/facade',
|
|
112
|
-
'src/store',
|
|
113
|
-
'src/mutator',
|
|
114
|
-
'src/scheduler',
|
|
115
|
-
'src/plugins',
|
|
116
|
-
'src/bus',
|
|
117
|
-
'src/core/types',
|
|
118
|
-
]);
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// localtask.wait —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
|
-
//
|
|
3
|
-
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
|
-
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
|
-
import { renderWait as _renderWait } from '../action-render.js';
|
|
8
|
-
const renderWait: any = _renderWait;
|
|
9
|
-
|
|
10
|
-
/** localtask.wait 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
11
|
-
const input = z.object({
|
|
12
|
-
cwd: z.string().optional(),
|
|
13
|
-
summary: z.string().optional().describe("已废弃:当前现状不再收(面板上没有对应输入界面)"),
|
|
14
|
-
timeout: z.number().optional().describe("阻塞上限(秒);缺省用页面配置(推荐 180,最大 600)"),
|
|
15
|
-
'no-open': z.boolean().optional().describe("不自动打开浏览器(测试用)"),
|
|
16
|
-
param: z.array(z.string()).optional().describe("外部参数(平面扩展):k=v,可重复或逗号分隔;进交付模板 ctx,模板里 {{k}} / {{params.k}} 取"),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export class LocaltaskWaitAction extends ActionBase<typeof input> {
|
|
20
|
-
@action({
|
|
21
|
-
id: 'localtask.wait',
|
|
22
|
-
cli: ['localtask', 'wait'],
|
|
23
|
-
http: null,
|
|
24
|
-
summary: '针对某主题(按 cwd 目录名识别)阻塞等待用户回填(默认 3 分钟,最大 10 分钟);本地空时自动领取全局共享池的任务',
|
|
25
|
-
input,
|
|
26
|
-
render: renderWait,
|
|
27
|
-
})
|
|
28
|
-
override async run(ctx: ActionInput<this['_input']>) {
|
|
29
|
-
|
|
30
|
-
// wait 编排已迁 tasktool/wait.js(任务工具语义归 tasktool;命令名不变)
|
|
31
|
-
const { waitForTask } = await (import('../../tasktool/wait.js') as any);
|
|
32
|
-
const { parseParams } = await (import('../../tasktool/params.js') as any);
|
|
33
|
-
return waitForTask({
|
|
34
|
-
cwd: ctx.cwd,
|
|
35
|
-
timeoutSec: ctx.timeout,
|
|
36
|
-
open: !ctx['no-open'],
|
|
37
|
-
params: parseParams(ctx.param),
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// Facade get(workflowId, nodeId?) → AsyncIterable
|
|
2
|
-
// 真实现:PluginRuntime.runGetHooks + pull=consumeFirstPending;
|
|
3
|
-
// getTask 仍给 CLI/agent 单次领取(内部可走 wait)。
|
|
4
|
-
import '../plugins/index.js';
|
|
5
|
-
import { runGetHooks } from '../plugins/runtime.js';
|
|
6
|
-
import { createTopicSnapshotStore } from '../../localtask/store/index.js';
|
|
7
|
-
import { getTask as getTaskImpl } from '../get.js';
|
|
8
|
-
|
|
9
|
-
export interface FacadeGetOptions {
|
|
10
|
-
signal?: AbortSignal;
|
|
11
|
-
summary?: string;
|
|
12
|
-
pull?: () => Promise<unknown | null>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 引擎态异步迭代领取。
|
|
17
|
-
* @param workflowId 主题 key
|
|
18
|
-
*/
|
|
19
|
-
export async function* get(
|
|
20
|
-
workflowId: string,
|
|
21
|
-
nodeId?: string | number,
|
|
22
|
-
opts: FacadeGetOptions = {},
|
|
23
|
-
): AsyncGenerator<any, void, unknown> {
|
|
24
|
-
const store = await createTopicSnapshotStore();
|
|
25
|
-
let snap: any;
|
|
26
|
-
try {
|
|
27
|
-
snap = await store.load(workflowId);
|
|
28
|
-
} catch (err) {
|
|
29
|
-
if ((err as any)?.code === 'NOT_FOUND') return;
|
|
30
|
-
throw err;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const pull =
|
|
34
|
-
opts.pull ||
|
|
35
|
-
(async () => {
|
|
36
|
-
const { consumeFirstPending } = await import('../../localtask/service.js');
|
|
37
|
-
return consumeFirstPending(workflowId, opts.summary || '', {
|
|
38
|
-
key: workflowId,
|
|
39
|
-
name: snap.meta?.name || workflowId,
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
yield* runGetHooks(
|
|
44
|
-
{ snapshot: snap, nodeId, signal: opts.signal },
|
|
45
|
-
{ pull },
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** CLI/agent 兼容:单次领取(原 getTask) */
|
|
50
|
-
export async function getTask(args: any): Promise<Record<string, any>> {
|
|
51
|
-
return getTaskImpl(args);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export { getTaskImpl };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// Facade submit(initMeta) → workflowId
|
|
2
|
-
// 语义:只确保主题/工作流存在;有 text 则入队(不在此构造全图)。
|
|
3
|
-
import { submitTask } from '../add.js';
|
|
4
|
-
import { createTopicSnapshotStore } from '../../localtask/store/index.js';
|
|
5
|
-
|
|
6
|
-
/** submit 的入参(core/workflow InitMeta 的宽松形态 + 任意附加键) */
|
|
7
|
-
export interface FacadeSubmitMeta {
|
|
8
|
-
cwd?: string;
|
|
9
|
-
key?: string;
|
|
10
|
-
text?: unknown;
|
|
11
|
-
blockBy?: unknown;
|
|
12
|
-
blocksFollowing?: boolean;
|
|
13
|
-
gate?: boolean;
|
|
14
|
-
meta?: Record<string, unknown>;
|
|
15
|
-
[k: string]: any;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @returns Promise<{ workflowId: string, key: string, cwd?: string, name?: string, task?: object, status: string }>
|
|
20
|
-
*/
|
|
21
|
-
export async function submit(initMeta: FacadeSubmitMeta = {}): Promise<Record<string, any>> {
|
|
22
|
-
const { normalizeCwd } = await import('../../localtask/service.js');
|
|
23
|
-
// paths.normalizeCwd 的 @returns 标注漏了 name(运行时恒返回 {cwd, name, key})
|
|
24
|
-
const { key, cwd, name } = normalizeCwd(initMeta.cwd || initMeta.key) as { cwd: string; key: string; name: string };
|
|
25
|
-
|
|
26
|
-
// SnapshotStore:确保 workflow 桶存在(topic adapter 会建主题壳)
|
|
27
|
-
const store = await createTopicSnapshotStore();
|
|
28
|
-
try {
|
|
29
|
-
await store.load(key);
|
|
30
|
-
} catch (err) {
|
|
31
|
-
if ((err as any)?.code === 'NOT_FOUND') {
|
|
32
|
-
await store.create({ key, cwd, meta: { name, ...(initMeta.meta || {}) } });
|
|
33
|
-
} else {
|
|
34
|
-
throw err;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (initMeta.text != null && String(initMeta.text).trim()) {
|
|
39
|
-
const added = await submitTask({
|
|
40
|
-
cwd,
|
|
41
|
-
text: initMeta.text,
|
|
42
|
-
blockBy: initMeta.blockBy,
|
|
43
|
-
blocksFollowing: initMeta.blocksFollowing ?? initMeta.gate,
|
|
44
|
-
...(initMeta.meta || {}),
|
|
45
|
-
});
|
|
46
|
-
return {
|
|
47
|
-
status: 'ok',
|
|
48
|
-
workflowId: key,
|
|
49
|
-
key,
|
|
50
|
-
cwd: added.cwd ?? cwd,
|
|
51
|
-
name: added.name ?? name,
|
|
52
|
-
task: added.task,
|
|
53
|
-
delivered: added.delivered,
|
|
54
|
-
queued: added.queued,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return { status: 'ok', workflowId: key, key, cwd, name, created: true };
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export { submitTask };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// tasktool 模块(模板形态):只做装配——模块元信息 + 从 action 清单建实例。
|
|
2
|
-
//
|
|
3
|
-
// action 清单由 `pnpm gen:actions` 扫 actions/ 目录生成(actions/_manifest.generated.ts),
|
|
4
|
-
// 本文件**不手工列举** action 类——加一条 action = 新建一个文件 + 跑一次生成。
|
|
5
|
-
import { ModuleBase } from '../../runtime/types/module.js';
|
|
6
|
-
import { zodActionsOf, type ZodBoundAction } from '../../runtime/action-decorator.js';
|
|
7
|
-
import { container, type Container } from '../../runtime/container.js';
|
|
8
|
-
import { ACTIONS } from './actions/_manifest.generated.js';
|
|
9
|
-
|
|
10
|
-
export class TasktoolModule extends ModuleBase {
|
|
11
|
-
override readonly id = 'tasktool';
|
|
12
|
-
override readonly title = "任务工具(timegoal 时间目标 / waitgoal 等待与领取;UI 嵌入在「本地任务」主题卡里)";
|
|
13
|
-
override readonly order = 21;
|
|
14
|
-
|
|
15
|
-
override readonly actions: readonly ZodBoundAction[];
|
|
16
|
-
|
|
17
|
-
constructor(c: Container = container) {
|
|
18
|
-
super();
|
|
19
|
-
this.actions = ACTIONS.flatMap((Cls) => zodActionsOf(c.create(Cls)));
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const tasktoolModule = new TasktoolModule();
|
|
24
|
-
export default tasktoolModule;
|