nx-kv 0.65.0 → 0.65.3
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 +59 -0
- package/package.json +1 -1
- package/src/core/db/seed-templates.ts +2 -86
- package/src/core/db/settings.ts +1 -1
- package/src/core/instruction-template.ts +1 -1
- package/src/core/workflow/plugin-registry.ts +1 -1
- package/src/core/workflow/types.ts +4 -4
- package/src/modules/claim/actions/_manifest.generated.ts +23 -0
- package/src/modules/{localtask → claim}/actions/localtask-claim.ts +4 -4
- package/src/modules/{localtask → claim}/actions/localtask-preview.ts +4 -4
- package/src/modules/{localtask → claim}/actions/localtask-wait.ts +4 -4
- package/src/modules/{tasktool → claim}/get.ts +3 -3
- 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 +1 -1
- package/src/modules/claim/wait.ts +305 -0
- package/src/modules/{tasktool/plugins → claim}/waitgoal-config.ts +4 -28
- package/src/modules/delivery/assemble.ts +151 -0
- package/src/modules/{tasktool → delivery}/attach-resource.ts +2 -2
- package/src/modules/{tasktool → delivery}/attach-template.ts +1 -1
- package/src/modules/{tasktool → delivery}/attach.ts +1 -1
- package/src/modules/{tasktool → delivery}/delivery-text.ts +2 -2
- package/src/modules/{tasktool → delivery}/doc-inline.ts +1 -1
- package/src/modules/{tasktool → delivery}/groupctx.ts +1 -1
- package/src/modules/delivery/host.ts +231 -0
- package/src/modules/delivery/index.ts +18 -0
- package/src/modules/{tasktool → delivery}/preview.ts +5 -6
- package/src/modules/{tasktool → goals}/actions/timegoal-check.ts +1 -1
- package/src/modules/{tasktool → goals}/actions/timegoal-clear.ts +1 -1
- package/src/modules/{tasktool → goals}/actions/timegoal-list.ts +1 -1
- package/src/modules/{tasktool → goals}/actions/timegoal-log.ts +1 -1
- package/src/modules/{tasktool → goals}/actions/timegoal-set.ts +1 -1
- package/src/modules/{tasktool → goals}/actions/timegoal-show.ts +1 -1
- package/src/modules/{tasktool → goals}/actions/timegoal-update.ts +1 -1
- 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 +3 -3
- package/src/modules/{tasktool → goals}/plugins/timegoal-task-store.ts +2 -2
- package/src/modules/localtask/action-render.ts +1 -1
- package/src/modules/localtask/actions/_manifest.generated.ts +0 -9
- package/src/modules/localtask/actions/localtask-add.ts +2 -2
- 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 +1 -1
- package/src/modules/localtask/actions/localtask-detach.ts +1 -1
- package/src/modules/localtask/actions/localtask-get.ts +1 -1
- package/src/modules/localtask/actions/localtask-reopen.ts +1 -1
- package/src/modules/localtask/actions/localtask-timegoalLog.ts +1 -1
- package/src/modules/localtask/actions/localtask-update.ts +2 -2
- package/src/modules/{tasktool → localtask}/add.ts +3 -3
- package/src/modules/localtask/engine.ts +1 -1
- package/src/modules/{tasktool → localtask}/group-store.ts +2 -2
- package/src/modules/localtask/mutator/index.ts +1 -1
- package/src/modules/localtask/panel-presence.ts +2 -2
- package/src/modules/localtask/scheduler/state-drive.ts +1 -1
- package/src/modules/{tasktool → localtask}/support.ts +1 -1
- package/src/modules/localtask/task-lifecycle.ts +5 -5
- package/src/modules/localtask/task-ops.ts +1 -1
- package/src/modules/localtask/task-templates.ts +1 -1
- package/src/modules/localtask/task-view.ts +1 -1
- package/src/modules/{tasktool → localtask}/update.ts +1 -1
- package/src/modules/localtask/waiters.ts +1 -1
- package/src/modules/localtask/writes.ts +1 -1
- package/src/modules/promptplug/factory.ts +5 -5
- package/src/modules/promptplug/index.ts +5 -5
- package/src/modules/promptplug/plugins/attachment.ts +1 -1
- package/src/modules/promptplug/plugins/context.ts +1 -1
- package/src/modules/promptplug/plugins/getloop.ts +8 -7
- package/src/modules/{tasktool/plugins/goal-template.ts → promptplug/plugins/goal-prompt.ts} +4 -3
- package/src/modules/repos/service/crud.ts +1 -1
- package/src/modules/templates/actions/templates-default.ts +2 -5
- package/src/modules/templates/actions/templates-update.ts +1 -3
- package/src/modules/templates/service.ts +11 -13
- package/src/modules/templates/support.ts +0 -15
- package/src/runtime/registry.ts +6 -2
- package/src/web/frontend/App.tsx +0 -12
- package/src/web/frontend/api/cli-tree.json +138 -138
- package/src/web/frontend/api/client.generated.ts +90 -88
- package/src/web/frontend/components/md/live-block.tsx +1 -5
- package/src/web/frontend/components/md/md-panes-root.tsx +0 -4
- package/src/web/frontend/components/md/md-panes.tsx +1 -11
- package/src/web/frontend/modules/md/styles/docs.css +0 -7
- package/src/web/frontend/modules/md/styles/editor.css +0 -17
- package/src/web/frontend/modules/md/use-templates.ts +3 -13
- package/src/web/frontend/page/dir/index.tsx +3 -15
- package/src/web/frontend/page/dir/task-actions.ts +1 -16
- package/src/web/frontend/page/dir/task.tsx +2 -16
- package/src/web/frontend/page/group/index.tsx +6 -19
- package/src/web/frontend/page/settings/index.tsx +1 -1
- package/src/web/frontend/page/templates/index.tsx +5 -54
- package/src/web/frontend/page/templates/manage.tsx +1 -5
- package/src/web/frontend/page/templates/style.css +1 -43
- package/src/web/frontend/page/templates/template-list.tsx +7 -15
- package/src/web/frontend/routes/route-eq.ts +2 -3
- package/src/web/frontend/routes/templates.ts +0 -10
- package/src/web/frontend/styles-v2/shell.css +7 -0
- package/src/web/frontend/types.ts +2 -1
- package/src/web/public/assets/{bar-csH6ZW39.js → bar-Dc5Tq1eE.js} +1 -1
- package/src/web/public/assets/{composer-launch-Ba9cBxhb.js → composer-launch-fp2IzGzQ.js} +1 -1
- package/src/web/public/assets/{composer-panel-7SHKllt5.js → composer-panel-Dh681iO6.js} +1 -1
- package/src/web/public/assets/dir-d16q1GLe.js +3 -0
- package/src/web/public/assets/{doc-BmGb9F-k.js → doc-DRSKD0Re.js} +1 -1
- package/src/web/public/assets/group-Dc3ZgW24.js +1 -0
- package/src/web/public/assets/{index-D1wpt-oL.css → index-BIVxGd6t.css} +1 -1
- package/src/web/public/assets/index-Bg0m8gbJ.js +2 -0
- package/src/web/public/assets/{md-history-DVI47hu4.js → md-history-DNtgaIdH.js} +6 -6
- package/src/web/public/assets/{refs-P8HrKv4T.js → refs-TzxZYy7T.js} +1 -1
- package/src/web/public/assets/{repo-form-modal-BiBZ63DZ.js → repo-form-modal-Dg3hJWUV.js} +1 -1
- package/src/web/public/assets/{repos-B9D8q6U7.js → repos-uNqSR5YB.js} +1 -1
- package/src/web/public/assets/task-DuFOXLPC.js +11 -0
- package/src/web/public/assets/{task-utils-DPGXUIOk.js → task-utils-DAPxKm4c.js} +1 -1
- package/src/web/public/assets/templates-CwYDIBYn.css +1 -0
- package/src/web/public/assets/templates-DNiGvmdq.js +10 -0
- package/src/web/public/assets/{use-rail-drag-TGx8CLcY.js → use-rail-drag-DxIYcszo.js} +1 -1
- package/src/web/public/index.html +6 -7
- package/src/core/workflow/edges.ts +0 -28
- package/src/core/workflow/layout.ts +0 -118
- 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 -75
- package/src/modules/tasktool/wait.ts +0 -572
- package/src/web/frontend/modules/md/fill-session.ts +0 -36
- package/src/web/frontend/modules/md/new-task-from-template.ts +0 -22
- package/src/web/frontend/modules/md/task-intent.ts +0 -29
- package/src/web/frontend/modules/prompts/render-template-body.ts +0 -14
- package/src/web/frontend/modules/prompts/template-preview.ts +0 -62
- package/src/web/frontend/page/templates/fill.tsx +0 -126
- package/src/web/public/assets/dir-D5AImCiy.js +0 -3
- package/src/web/public/assets/fill-session-fHxQHFaD.js +0 -1
- package/src/web/public/assets/group-CTktws14.js +0 -1
- package/src/web/public/assets/index-Byb7MFTl.js +0 -2
- package/src/web/public/assets/new-task-from-template-DDWu4yR4.js +0 -1
- package/src/web/public/assets/render-template-body-bXdedFig.js +0 -1
- package/src/web/public/assets/task-BBk0TQZi.js +0 -11
- package/src/web/public/assets/task-intent-CX5DZccN.js +0 -1
- package/src/web/public/assets/templates-BN9i9-6c.js +0 -11
- package/src/web/public/assets/templates-plA8R7jJ.css +0 -1
- /package/src/modules/{tasktool → goals}/actions/_manifest.generated.ts +0 -0
- /package/src/modules/{tasktool → goals}/actions/timegoal-prune.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-cwd-store.ts +0 -0
- /package/src/modules/{tasktool → goals}/plugins/timegoal-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
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
// delivery/host.ts —— 交付宿主:领域取数 → Supply → promptplug 的 assembleDelivery。
|
|
2
|
+
//
|
|
3
|
+
// #227 重构:从 wait.ts 拆出。wait.ts 只剩阻塞编排(跨进程轮询 / goal 到点收尾 /
|
|
4
|
+
// 面板随行),本文件专管「交付一条任务时要把哪些领域数据取齐」:
|
|
5
|
+
// ① 附件标注(annotateTaskDelivery → attachTemplateCtx)
|
|
6
|
+
// ② 任务级 timegoal 起表(领取即计时;preview 走只读版)
|
|
7
|
+
// ③ 组上下文(readGroupContext,按正文 frontmatter 的 board 决定组材料)
|
|
8
|
+
// ④ 目录级 goal 上下文(readGoalCtx)+ 时间运算字段补齐(enrichGoalTiming)
|
|
9
|
+
// ⑤ 队列余量(pendingQueueInfo)
|
|
10
|
+
// 之后把数据装进 DeliveryHostData,调 promptplug/delivery.ts 的 assembleDelivery
|
|
11
|
+
// 完成组装——模板正文、变量、三链合并、渲染全部在 promptplug。
|
|
12
|
+
// 任何异常都降级为「只回任务」——wait 绝不能因渲染挂掉(fail-open 纪律)。
|
|
13
|
+
//
|
|
14
|
+
// preview / trace(任务 #65「预览 get 提示词」):
|
|
15
|
+
// preview=true → **零副作用**:不启动任务级 timegoal 计时、不写库、不领取;
|
|
16
|
+
// timegoal 的 check 指令用声明现算(与真实领取同一份)。其余渲染路径与真实领取
|
|
17
|
+
// 完全同一条代码,所以预览出来的字符串就是 agent 会拿到的那一份。
|
|
18
|
+
// trace=[] → 按顺序记下每一段的来源(谁贡献的、开关是否开着),供面板展示
|
|
19
|
+
// 「这段是哪来的」。真实领取不传 trace,行为与改造前逐字节一致。
|
|
20
|
+
import { formatDuration, formatGoalTiming } from '../../core/instruction-template.js';
|
|
21
|
+
import { parseFrontmatter } from '../../shared/frontmatter.js';
|
|
22
|
+
import { getSettings, isGlobalKey, pendingQueueInfo } from '../localtask/service.js';
|
|
23
|
+
import { assembleDelivery, type AssembledDelivery } from './assemble.js';
|
|
24
|
+
import { annotateTaskDelivery, attachTemplateCtx } from './attach.js';
|
|
25
|
+
import { readGroupContext } from './groupctx.js';
|
|
26
|
+
import { ensureTaskGoal, previewTaskGoal } from '../goals/taskgoal.js';
|
|
27
|
+
import * as timegoal from '../goals/timegoal.js';
|
|
28
|
+
|
|
29
|
+
export interface DeliveryOptions {
|
|
30
|
+
source?: string;
|
|
31
|
+
summary?: unknown;
|
|
32
|
+
cwd?: unknown;
|
|
33
|
+
name?: unknown;
|
|
34
|
+
topicKey?: unknown;
|
|
35
|
+
params?: Record<string, string>;
|
|
36
|
+
preview?: boolean;
|
|
37
|
+
trace?: import('../promptplug/compose.js').RenderTraceEntry[];
|
|
38
|
+
getLoopEnabled?: boolean;
|
|
39
|
+
getLoopWaitMinutes?: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// 「YYYY-MM-DD HH:mm:ss」→ epoch ms(任务级 goal 的起点 = consumedAt);解析不了返回 NaN
|
|
43
|
+
function parseStampMs(v: unknown): number {
|
|
44
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})[ T](\d{2}):(\d{2}):(\d{2})$/.exec(String(v || ''));
|
|
45
|
+
if (!m) return NaN;
|
|
46
|
+
return new Date(Number(m?.[1]), Number(m?.[2]) - 1, Number(m?.[3]), Number(m?.[4]), Number(m?.[5]), Number(m?.[6])).getTime();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// goal 上下文的**时间运算字段**统一在这里补齐(任务 #82:模板层要能拿剩余/超时做运算,
|
|
50
|
+
// 不能只有人话的 remainingHuman)。目录级 show 自带 reached/remainingSec/overtimeSec;
|
|
51
|
+
// 任务级只有 deadline 戳——同式解析补算。缺哪个补哪个,已有的不覆盖。
|
|
52
|
+
export function enrichGoalTiming(g: any): any {
|
|
53
|
+
if (!g) return g;
|
|
54
|
+
let { remainingSec, overtimeSec, reached } = g;
|
|
55
|
+
remainingSec = Number(remainingSec);
|
|
56
|
+
overtimeSec = Number(overtimeSec);
|
|
57
|
+
if (!Number.isFinite(remainingSec) && !Number.isFinite(overtimeSec)) {
|
|
58
|
+
const ms = parseStampMs(g.deadline);
|
|
59
|
+
if (Number.isFinite(ms)) {
|
|
60
|
+
const diff = Math.round((ms - Date.now()) / 1000);
|
|
61
|
+
remainingSec = diff >= 0 ? diff : 0;
|
|
62
|
+
overtimeSec = diff >= 0 ? 0 : -diff;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (reached === undefined) {
|
|
66
|
+
if (Number.isFinite(overtimeSec)) reached = overtimeSec > 0;
|
|
67
|
+
else if (Number.isFinite(remainingSec)) reached = remainingSec <= 0;
|
|
68
|
+
}
|
|
69
|
+
if (Number.isFinite(remainingSec)) {
|
|
70
|
+
g.remainingSec = remainingSec;
|
|
71
|
+
g.remainingMin = Math.ceil(remainingSec / 60);
|
|
72
|
+
}
|
|
73
|
+
if (Number.isFinite(overtimeSec)) g.overtimeSec = overtimeSec;
|
|
74
|
+
if (reached !== undefined) g.reached = reached;
|
|
75
|
+
// 任务 #87:模板里要能直接写「持续 {{goal.durationHuman}}」——人话时长统一在这里补。
|
|
76
|
+
if (Number.isFinite(Number(g.durationSec)) && Number(g.durationSec) > 0) {
|
|
77
|
+
g.durationHuman = g.durationHuman || formatDuration(Number(g.durationSec));
|
|
78
|
+
}
|
|
79
|
+
if (Number.isFinite(Number(g.elapsedSec))) {
|
|
80
|
+
g.elapsedHuman = g.elapsedHuman || formatDuration(Number(g.elapsedSec));
|
|
81
|
+
}
|
|
82
|
+
return g;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// wait/get **返回时刻**的目标上下文(渲染 instruction 用)。fail-open:加载失败 /
|
|
86
|
+
// 读不到 / 没目标 / 出错 → null,instruction 照常渲染(goal 段被整段丢弃)。
|
|
87
|
+
// 绝不写盘:showTimegoal 走 loadRecycledStore({persist:false})——timegoals.json
|
|
88
|
+
// 字节数不变,goal-expiry 单测字节比对钉着。
|
|
89
|
+
async function readGoalCtx(cwd: unknown): Promise<Record<string, any> | null> {
|
|
90
|
+
if (!cwd || isGlobalKey(cwd)) return null; // cwd 是路径,isGlobalKey 恒 false——纯防御
|
|
91
|
+
try {
|
|
92
|
+
const show = await timegoal.showTimegoal({ cwd });
|
|
93
|
+
if (!show || !show.hasGoal) return null;
|
|
94
|
+
const g = show.goal || {};
|
|
95
|
+
return {
|
|
96
|
+
name: g.name || show.name || '',
|
|
97
|
+
deadline: g.deadline || '',
|
|
98
|
+
prompt: g.prompt || '',
|
|
99
|
+
reached: !!show.reached,
|
|
100
|
+
remainingSec: show.remainingSec,
|
|
101
|
+
overtimeSec: show.overtimeSec,
|
|
102
|
+
remainingHuman: formatGoalTiming({
|
|
103
|
+
reached: show.reached,
|
|
104
|
+
remainingSec: show.remainingSec,
|
|
105
|
+
overtimeSec: show.overtimeSec,
|
|
106
|
+
}),
|
|
107
|
+
};
|
|
108
|
+
} catch {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// 组装 wait/get 返回的任务载荷 + 指令。**单一路径**:
|
|
114
|
+
// 所有段落(上下文 / 附件 / 时间目标 / ack / 持续 get)一律进返回载荷的
|
|
115
|
+
// instruction 字段;task.text 始终是库存原文,绝不把系统提示词拼进正文。
|
|
116
|
+
// 旧 rule 区块已删除:done 指令与收尾要求统一由 ack 区块承载。
|
|
117
|
+
export async function buildTaskDelivery(
|
|
118
|
+
task: any,
|
|
119
|
+
{ source, summary, cwd, name, topicKey, params, preview = false, trace, getLoopEnabled = false, getLoopWaitMinutes = 0 }: DeliveryOptions = {},
|
|
120
|
+
): Promise<Record<string, any>> {
|
|
121
|
+
// 附件标注(任务 #15:正文里的  嵌入 → 附件清单 + 本地路径)。
|
|
122
|
+
// fail-open:标注失败绝不拖垮交付;正文没有引用时 annotateTaskDelivery 返回
|
|
123
|
+
// null,载荷与改造前**逐字节一致**(与 localtask 读任务的同一条纪律)。
|
|
124
|
+
let att: any = null;
|
|
125
|
+
try {
|
|
126
|
+
// inlineDocs(#162):文档资料绑定(role=doc)随交付带全文——只读盘(自有树 /
|
|
127
|
+
// 绑定闭包),预览同样安全;读不到内容留空,不阻断交付。
|
|
128
|
+
const a = await annotateTaskDelivery(task, { topicKey, inlineDocs: true });
|
|
129
|
+
if (a) {
|
|
130
|
+
task = a.task;
|
|
131
|
+
att = a;
|
|
132
|
+
}
|
|
133
|
+
} catch {
|
|
134
|
+
/* 标注失败照常交付(agent 还能从正文里的嵌入自行处理) */
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
// 任务级 timegoal(发布带 --duration):**领取即计时**——这里起表(幂等),
|
|
138
|
+
// goal 上下文换成任务级(prompt = check 指令,固化进 timegoal 存储,之后每轮原文回显)。
|
|
139
|
+
// 目录级 goal 仍作兜底:任务没带时间目标时,渲染等待方目录的目标状态。
|
|
140
|
+
let taskGoalCtx: any = null;
|
|
141
|
+
if (task && task.timegoal && topicKey) {
|
|
142
|
+
const title = (String(task.text || '')
|
|
143
|
+
.split('\n')
|
|
144
|
+
.map((l) => l.trim())
|
|
145
|
+
.find(Boolean) || `任务 #${task.id}`).slice(0, 40);
|
|
146
|
+
// 预览走只读版本:同一份 check 指令文本,但不落盘、不起表
|
|
147
|
+
taskGoalCtx = preview
|
|
148
|
+
? await previewTaskGoal({ topicKey, taskId: task.id, cwd, name: title, timegoal: task.timegoal, text: task.text })
|
|
149
|
+
: await ensureTaskGoal({
|
|
150
|
+
topicKey,
|
|
151
|
+
taskId: task.id,
|
|
152
|
+
cwd,
|
|
153
|
+
name: title,
|
|
154
|
+
text: task.text,
|
|
155
|
+
timegoal: task.timegoal,
|
|
156
|
+
startedAtMs: parseStampMs(task.consumedAt) || undefined,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
const goal = enrichGoalTiming(taskGoalCtx || (await readGoalCtx(cwd)));
|
|
160
|
+
|
|
161
|
+
// 项目组上下文(组概念 + 本项目位置 + 兄弟成员 + 参考文件地址):只进 instruction。
|
|
162
|
+
// #64 作用域:组材料只挂**组任务**(正文 frontmatter 带 board);单 repo 主题里
|
|
163
|
+
// 提交的纯项目任务只带项目介绍,不把所属组的材料挂进来。
|
|
164
|
+
const boardMark = String(parseFrontmatter(String((task && task.text) || '')).board || '').trim();
|
|
165
|
+
const groupCtx = await readGroupContext(cwd as string, { board: boardMark });
|
|
166
|
+
const settings: any = (await getSettings().catch(() => null)) || {};
|
|
167
|
+
|
|
168
|
+
// ── 插件化组装(promptplug):宿主完成领域取数,插件 data() 做同步变换 ──
|
|
169
|
+
// 任务级 goal → 完整 check 指令;目录级 goal → 状态行(二者都进 timecheck 段)。
|
|
170
|
+
const goalCheck = taskGoalCtx ? taskGoalCtx.prompt : null;
|
|
171
|
+
const goalStatus = !taskGoalCtx && goal
|
|
172
|
+
? `〔时间目标「${goal.name || ''}」${goal.remainingHuman || ''}〕`
|
|
173
|
+
: null;
|
|
174
|
+
const goalCtx = goal
|
|
175
|
+
? {
|
|
176
|
+
...goal,
|
|
177
|
+
// 任务 #87:goal.extra(附加要求,领取后可动态改)与 goalKey 供模板直接引用
|
|
178
|
+
extra: taskGoalCtx ? taskGoalCtx.extra || '' : '',
|
|
179
|
+
goalKey: taskGoalCtx ? taskGoalCtx.goalKey || '' : '',
|
|
180
|
+
check: goalCheck || '',
|
|
181
|
+
statusLine: goalStatus || '',
|
|
182
|
+
}
|
|
183
|
+
: null;
|
|
184
|
+
const attach = att ? attachTemplateCtx(att.task.attachments).attach : null;
|
|
185
|
+
|
|
186
|
+
// ext(队列余量):同主题还有多少待领取任务 + 标题。现算(同主题一次读取);
|
|
187
|
+
// 读取失败不阻断领取:按缺失处理,并把原因记进 renderWarnings。
|
|
188
|
+
let queueInfo: { topic: string; count: number; list: { id: number; title: string }[] } | null = null;
|
|
189
|
+
const hostWarnings: import('../promptplug/compose.js').RenderWarning[] = [];
|
|
190
|
+
try {
|
|
191
|
+
const q = await pendingQueueInfo(topicKey as string, task && task.id);
|
|
192
|
+
if (q && q.count > 0) queueInfo = { topic: q.topic, count: q.count, list: q.list };
|
|
193
|
+
} catch (e) {
|
|
194
|
+
hostWarnings.push({
|
|
195
|
+
block: 'ext',
|
|
196
|
+
label: '待领取队列(ext)',
|
|
197
|
+
message: String((e as Error).message || e).replace(/\s+/g, ' ').trim(),
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const delivery: AssembledDelivery = await assembleDelivery({
|
|
202
|
+
task,
|
|
203
|
+
attachCtx: attach,
|
|
204
|
+
goalCtx,
|
|
205
|
+
groupCtx,
|
|
206
|
+
queueInfo,
|
|
207
|
+
getLoopEnabled,
|
|
208
|
+
getLoopWaitMinutes,
|
|
209
|
+
params,
|
|
210
|
+
appendMode: settings.appendMode,
|
|
211
|
+
source: source || '',
|
|
212
|
+
summary,
|
|
213
|
+
cwd,
|
|
214
|
+
name,
|
|
215
|
+
hostWarnings,
|
|
216
|
+
trace,
|
|
217
|
+
});
|
|
218
|
+
const warnField = delivery.renderWarnings.length ? { renderWarnings: delivery.renderWarnings } : {};
|
|
219
|
+
if (!delivery.instruction) {
|
|
220
|
+
return { task, ...warnField };
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
task,
|
|
224
|
+
instruction: delivery.instruction,
|
|
225
|
+
coversBody: delivery.coversBody,
|
|
226
|
+
...warnField,
|
|
227
|
+
};
|
|
228
|
+
} catch {
|
|
229
|
+
return { task };
|
|
230
|
+
}
|
|
231
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// delivery 模块(模板形态):交付域——把一条任务变成「任务 + 说明书」。
|
|
2
|
+
//
|
|
3
|
+
// host.ts(宿主取数:附件标注 / timegoal 起表 / 组上下文 / 队列余量)
|
|
4
|
+
// + assemble.ts(组装核:seed 构造 / 三链合并 / 渲染)
|
|
5
|
+
// + 附件四件(标注 / ctx 塑形 / 资源视图模型 / 文档全文)与组上下文、人读排版。
|
|
6
|
+
// 纯引擎在 promptplug(段落插件 / 注册表 / 模板存储 / 渲染)。
|
|
7
|
+
import { ModuleBase } from '../../runtime/types/module.js';
|
|
8
|
+
|
|
9
|
+
export class DeliveryModule extends ModuleBase {
|
|
10
|
+
override readonly id = 'delivery';
|
|
11
|
+
override readonly title = "交付组装(宿主取数 + 提示词组装核;提示词引擎在 promptplug)";
|
|
12
|
+
override readonly order = 22;
|
|
13
|
+
|
|
14
|
+
override readonly actions: readonly [] = [];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const deliveryModule = new DeliveryModule();
|
|
18
|
+
export default deliveryModule;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// delivery/preview.ts —— 「预览 get 提示词」(任务 #65)。
|
|
2
2
|
//
|
|
3
3
|
// 用户的诉求是**可观测**:「当前具体会获得怎么样的字符串?」——
|
|
4
4
|
// 编辑页「更多 → 预览 get 提示词」点开就应该看到 agent 领取时会拿到的**那一份原文**,
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
import { getSettings } from '../localtask/service.js';
|
|
17
17
|
import { PLUGIN_IDS, groupIndex, pluginMeta } from '../promptplug/index.js';
|
|
18
18
|
import { deliveryPlainText } from './delivery-text.js';
|
|
19
|
-
import { getLoopForCwd,
|
|
20
|
-
import { buildTaskDelivery } from './
|
|
19
|
+
import { getLoopForCwd, type GetLoopState } from '../claim/waitgoal-config.js';
|
|
20
|
+
import { buildTaskDelivery } from './host.js';
|
|
21
21
|
|
|
22
22
|
export interface PreviewTaskDeliveryOptions {
|
|
23
23
|
/** 任务行(库存形状;草稿由调用方合成 { id:0, text }) */
|
|
@@ -40,11 +40,10 @@ export interface PreviewTaskDeliveryOptions {
|
|
|
40
40
|
export async function previewTaskDelivery({ task, cwd, key, summary, params }: PreviewTaskDeliveryOptions = {}): Promise<Record<string, any>> {
|
|
41
41
|
const settings: any = (await getSettings().catch(() => null)) || {};
|
|
42
42
|
const segments: any[] = [];
|
|
43
|
-
// 项目级「持续 get」:与
|
|
43
|
+
// 项目级「持续 get」:与 claim/get.ts 同口径(只在开启时传入内文;#182 起
|
|
44
44
|
// 内文固定取全局区块默认值,仓库侧只有开关 + 分钟)。
|
|
45
45
|
// 统一交给 buildTaskDelivery 编排成 getloop 区块,预览与真实领取不会各拼一份。
|
|
46
46
|
const loop: GetLoopState = await getLoopForCwd(cwd).catch(() => ({ enabled: false }));
|
|
47
|
-
const getLoopTpl = getLoopInstruction(loop);
|
|
48
47
|
const delivery: any = await buildTaskDelivery(task, {
|
|
49
48
|
source: 'local',
|
|
50
49
|
summary: summary || '',
|
|
@@ -54,7 +53,7 @@ export async function previewTaskDelivery({ task, cwd, key, summary, params }: P
|
|
|
54
53
|
params: params || {},
|
|
55
54
|
preview: true,
|
|
56
55
|
trace: segments,
|
|
57
|
-
|
|
56
|
+
getLoopEnabled: !!loop.enabled,
|
|
58
57
|
getLoopWaitMinutes: loop.enabled ? loop.waitMinutes || 0 : 0,
|
|
59
58
|
});
|
|
60
59
|
|
|
@@ -6,7 +6,7 @@ import { z } from 'zod';
|
|
|
6
6
|
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as serviceNs from '../timegoal.js';
|
|
8
8
|
import { badInput as _badInput } from '../../../core/errors.js';
|
|
9
|
-
import { renderCheck } from '
|
|
9
|
+
import { renderCheck } from '../../localtask/support.js';
|
|
10
10
|
const service: any = serviceNs;
|
|
11
11
|
const badInput: any = _badInput;
|
|
12
12
|
|
|
@@ -5,7 +5,7 @@ import { action } from '../../../runtime/action-decorator.js';
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as serviceNs from '../timegoal.js';
|
|
8
|
-
import { renderClear } from '
|
|
8
|
+
import { renderClear } from '../../localtask/support.js';
|
|
9
9
|
const service: any = serviceNs;
|
|
10
10
|
|
|
11
11
|
/** timegoal.clear 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
@@ -5,7 +5,7 @@ import { action } from '../../../runtime/action-decorator.js';
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as serviceNs from '../timegoal.js';
|
|
8
|
-
import { renderList } from '
|
|
8
|
+
import { renderList } from '../../localtask/support.js';
|
|
9
9
|
const service: any = serviceNs;
|
|
10
10
|
|
|
11
11
|
/** timegoal.list 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
@@ -5,7 +5,7 @@ import { action } from '../../../runtime/action-decorator.js';
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as serviceNs from '../timegoal.js';
|
|
8
|
-
import { fmtDur } from '
|
|
8
|
+
import { fmtDur } from '../../localtask/support.js';
|
|
9
9
|
const service: any = serviceNs;
|
|
10
10
|
|
|
11
11
|
/** timegoal.log 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
@@ -5,7 +5,7 @@ import { action } from '../../../runtime/action-decorator.js';
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as serviceNs from '../timegoal.js';
|
|
8
|
-
import { renderSet } from '
|
|
8
|
+
import { renderSet } from '../../localtask/support.js';
|
|
9
9
|
const service: any = serviceNs;
|
|
10
10
|
|
|
11
11
|
/** timegoal.set 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
@@ -6,7 +6,7 @@ import { z } from 'zod';
|
|
|
6
6
|
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as serviceNs from '../timegoal.js';
|
|
8
8
|
import { badInput as _badInput } from '../../../core/errors.js';
|
|
9
|
-
import { renderShow } from '
|
|
9
|
+
import { renderShow } from '../../localtask/support.js';
|
|
10
10
|
const service: any = serviceNs;
|
|
11
11
|
const badInput: any = _badInput;
|
|
12
12
|
|
|
@@ -5,7 +5,7 @@ import { action } from '../../../runtime/action-decorator.js';
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as serviceNs from '../timegoal.js';
|
|
8
|
-
import { renderUpdate } from '
|
|
8
|
+
import { renderUpdate } from '../../localtask/support.js';
|
|
9
9
|
const service: any = serviceNs;
|
|
10
10
|
|
|
11
11
|
/** timegoal.update 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// goals 模块(模板形态):目标域——时间目标与调度目标。
|
|
2
|
+
//
|
|
3
|
+
// 三族目标插件(BasePlugin 家族,IoC 自注册)+ timegoal CLI 命令族:
|
|
4
|
+
// timegoal(目录级预算)/ taskgoal(任务级时长门)/ blockgoal(屏障闸门)。
|
|
5
|
+
// 存储与运行时在 plugins/;调度器与快照同步在 localtask 域(那是写路径的底座)。
|
|
6
|
+
import { ModuleBase } from '../../runtime/types/module.js';
|
|
7
|
+
import { zodActionsOf, type ZodBoundAction } from '../../runtime/action-decorator.js';
|
|
8
|
+
import { container, type Container } from '../../runtime/container.js';
|
|
9
|
+
import { ACTIONS } from './actions/_manifest.generated.js';
|
|
10
|
+
|
|
11
|
+
export class GoalsModule extends ModuleBase {
|
|
12
|
+
override readonly id = 'goals';
|
|
13
|
+
override readonly title = "目标(timegoal 目录级预算 / taskgoal 任务级时长门 / blockgoal 屏障)";
|
|
14
|
+
override readonly order = 23;
|
|
15
|
+
|
|
16
|
+
override readonly actions: readonly ZodBoundAction[];
|
|
17
|
+
|
|
18
|
+
constructor(c: Container = container) {
|
|
19
|
+
super();
|
|
20
|
+
this.actions = ACTIONS.flatMap((Cls) => zodActionsOf(c.create(Cls)));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const goalsModule = new GoalsModule();
|
|
25
|
+
export default goalsModule;
|
|
@@ -24,8 +24,8 @@ function isHelper(name: string): boolean {
|
|
|
24
24
|
name.endsWith('-store.ts') ||
|
|
25
25
|
name.endsWith('-config.js') ||
|
|
26
26
|
name.endsWith('-config.ts') ||
|
|
27
|
-
name.endsWith('.
|
|
28
|
-
name.endsWith('.
|
|
27
|
+
name.endsWith('./index.js') ||
|
|
28
|
+
name.endsWith('./index.js')
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -36,7 +36,7 @@ export async function discoverPlugins(): Promise<string[]> {
|
|
|
36
36
|
if (loaded) return listDiscovered();
|
|
37
37
|
const dir = dirname(fileURLToPath(import.meta.url));
|
|
38
38
|
const files = (await readdir(dir)).filter(
|
|
39
|
-
(f) => (f.endsWith('.js') || f.endsWith('.
|
|
39
|
+
(f) => (f.endsWith('./index.js') || f.endsWith('./index.js')) && !SKIP.has(f) && !isHelper(f),
|
|
40
40
|
);
|
|
41
41
|
files.sort();
|
|
42
42
|
for (const f of files) {
|
|
@@ -11,10 +11,8 @@ export {
|
|
|
11
11
|
listPluginIds,
|
|
12
12
|
registerPlugin,
|
|
13
13
|
} from './container.js';
|
|
14
|
-
export { runScheduleHooks, runGetHooks } from './runtime.js';
|
|
15
14
|
export { discoverPlugins } from './discover.js';
|
|
16
15
|
export { isBarrierOpen } from './blockgoal.js';
|
|
17
16
|
export { default as blockgoal } from './blockgoal.js';
|
|
18
|
-
export { default as waitgoal } from './waitgoal.js';
|
|
19
17
|
export { default as timegoal } from './timegoal.js';
|
|
20
18
|
export { default as taskgoal } from './taskgoal.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
//
|
|
1
|
+
// goals/taskgoal.ts —— 任务级 timegoal 工具链。
|
|
2
2
|
//
|
|
3
3
|
// 与目录级 timegoal(timegoal.js)的关系:同一棵存储(timegoals.json)、同一套
|
|
4
4
|
// 状态机(evalTimegoal/autoRecycle/日志/保留期),只是寻址不同——目录级与目录一对一,
|
|
5
5
|
// 任务级与**单条任务**一对一(key = task:<topicKey>:<taskId>)。
|
|
6
6
|
//
|
|
7
7
|
// 流程(todo.md「任务工具」的 timegoal 规格):
|
|
8
|
-
// 1. 发布:`localtask add "
|
|
8
|
+
// 1. 发布:`localtask add "./index.js" --duration 2h [--goal-prompt "./index.js"]`
|
|
9
9
|
// → 任务记录带 timegoal 声明 { duration, prompt }(时长人类写法,领取时才解析)
|
|
10
10
|
// 2. 领取:交付时刻(buildTaskDelivery)调 ensureTaskGoal → **领取即起表**
|
|
11
11
|
// (起点 = consumedAt),并把 check 指令作为 goal.prompt 固化
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
customGoalPromptOf,
|
|
20
20
|
renderCustomGoalPrompt,
|
|
21
21
|
taskGoalTemplateCtx,
|
|
22
|
-
} from '
|
|
22
|
+
} from '../../promptplug/plugins/goal-prompt.js';
|
|
23
23
|
import { MAX_PROMPT, parseDuration, startTaskGoal, taskGoalState, taskGoalKey, recordTaskCheck } from './timegoal-store.js';
|
|
24
24
|
import { checkHistoryOfTask } from './timegoal-task-store.js';
|
|
25
25
|
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
renderCustomGoalPrompt,
|
|
17
17
|
renderTaskGoalPrompt,
|
|
18
18
|
taskGoalTemplateCtx,
|
|
19
|
-
} from '
|
|
20
|
-
import type { GoalCheckRecord } from '
|
|
19
|
+
} from '../../promptplug/plugins/goal-prompt.js';
|
|
20
|
+
import type { GoalCheckRecord } from '../../promptplug/plugins/goal-prompt.js';
|
|
21
21
|
import { compose } from '../../promptplug/compose.js';
|
|
22
22
|
import { buildPlugins } from '../../promptplug/factory.js';
|
|
23
23
|
import {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// action 的人读输出(render)函数(自 index.js 拆出):CLI 与 HTTP 共用同一份措辞。
|
|
2
2
|
// STATUS_TAG 来自同构词表(src/shared/task-status.js):CLI 与面板共用一份措辞。
|
|
3
3
|
import { STATUS_TAG } from '../../shared/task-status.js';
|
|
4
|
-
import { deliveryBodyText } from '../
|
|
4
|
+
import { deliveryBodyText } from '../delivery/delivery-text.js';
|
|
5
5
|
|
|
6
6
|
// 渲染入参都是 action 结果对象(HTTP/CLI body 透传)→ any。
|
|
7
7
|
export type RenderInput = any;
|
|
@@ -14,7 +14,6 @@ import { LocaltaskBoardTasksAction } from './localtask-boardtasks.js';
|
|
|
14
14
|
import { LocaltaskCancelAction } from './localtask-cancel.js';
|
|
15
15
|
import { LocaltaskCancelManyAction } from './localtask-cancelMany.js';
|
|
16
16
|
import { LocaltaskChainAction } from './localtask-chain.js';
|
|
17
|
-
import { LocaltaskClaimAction } from './localtask-claim.js';
|
|
18
17
|
import { LocaltaskCloneAction } from './localtask-clone.js';
|
|
19
18
|
import { LocaltaskCloseManyAction } from './localtask-closeMany.js';
|
|
20
19
|
import { LocaltaskConfigAction } from './localtask-config.js';
|
|
@@ -26,7 +25,6 @@ import { LocaltaskGetAction } from './localtask-get.js';
|
|
|
26
25
|
import { LocaltaskListAction } from './localtask-list.js';
|
|
27
26
|
import { LocaltaskPlanAction } from './localtask-plan.js';
|
|
28
27
|
import { LocaltaskPresenceAction } from './localtask-presence.js';
|
|
29
|
-
import { LocaltaskPreviewAction } from './localtask-preview.js';
|
|
30
28
|
import { LocaltaskPruneAction } from './localtask-prune.js';
|
|
31
29
|
import { LocaltaskRemoveAction } from './localtask-remove.js';
|
|
32
30
|
import { LocaltaskRemoveManyAction } from './localtask-removeMany.js';
|
|
@@ -39,7 +37,6 @@ import { LocaltaskTopicAddAction } from './localtask-topic-add.js';
|
|
|
39
37
|
import { LocaltaskTopicRemoveAction } from './localtask-topic-remove.js';
|
|
40
38
|
import { LocaltaskTopicRemoveManyAction } from './localtask-topic-removeMany.js';
|
|
41
39
|
import { LocaltaskUpdateAction } from './localtask-update.js';
|
|
42
|
-
import { LocaltaskWaitAction } from './localtask-wait.js';
|
|
43
40
|
|
|
44
41
|
/** 本模块的全部 action 类(容器按这个顺序建实例)。 */
|
|
45
42
|
export const ACTIONS: readonly (new (deps: Container) => ActionBase)[] = [
|
|
@@ -51,7 +48,6 @@ export const ACTIONS: readonly (new (deps: Container) => ActionBase)[] = [
|
|
|
51
48
|
LocaltaskCancelAction,
|
|
52
49
|
LocaltaskCancelManyAction,
|
|
53
50
|
LocaltaskChainAction,
|
|
54
|
-
LocaltaskClaimAction,
|
|
55
51
|
LocaltaskCloneAction,
|
|
56
52
|
LocaltaskCloseManyAction,
|
|
57
53
|
LocaltaskConfigAction,
|
|
@@ -63,7 +59,6 @@ export const ACTIONS: readonly (new (deps: Container) => ActionBase)[] = [
|
|
|
63
59
|
LocaltaskListAction,
|
|
64
60
|
LocaltaskPlanAction,
|
|
65
61
|
LocaltaskPresenceAction,
|
|
66
|
-
LocaltaskPreviewAction,
|
|
67
62
|
LocaltaskPruneAction,
|
|
68
63
|
LocaltaskRemoveAction,
|
|
69
64
|
LocaltaskRemoveManyAction,
|
|
@@ -76,7 +71,6 @@ export const ACTIONS: readonly (new (deps: Container) => ActionBase)[] = [
|
|
|
76
71
|
LocaltaskTopicRemoveAction,
|
|
77
72
|
LocaltaskTopicRemoveManyAction,
|
|
78
73
|
LocaltaskUpdateAction,
|
|
79
|
-
LocaltaskWaitAction,
|
|
80
74
|
];
|
|
81
75
|
|
|
82
76
|
// 再导出类本身:前端 apiclient 的返回类型从这里 type-only 引用(实现即契约)。
|
|
@@ -88,7 +82,6 @@ export { LocaltaskBoardTasksAction };
|
|
|
88
82
|
export { LocaltaskCancelAction };
|
|
89
83
|
export { LocaltaskCancelManyAction };
|
|
90
84
|
export { LocaltaskChainAction };
|
|
91
|
-
export { LocaltaskClaimAction };
|
|
92
85
|
export { LocaltaskCloneAction };
|
|
93
86
|
export { LocaltaskCloseManyAction };
|
|
94
87
|
export { LocaltaskConfigAction };
|
|
@@ -100,7 +93,6 @@ export { LocaltaskGetAction };
|
|
|
100
93
|
export { LocaltaskListAction };
|
|
101
94
|
export { LocaltaskPlanAction };
|
|
102
95
|
export { LocaltaskPresenceAction };
|
|
103
|
-
export { LocaltaskPreviewAction };
|
|
104
96
|
export { LocaltaskPruneAction };
|
|
105
97
|
export { LocaltaskRemoveAction };
|
|
106
98
|
export { LocaltaskRemoveManyAction };
|
|
@@ -113,4 +105,3 @@ export { LocaltaskTopicAddAction };
|
|
|
113
105
|
export { LocaltaskTopicRemoveAction };
|
|
114
106
|
export { LocaltaskTopicRemoveManyAction };
|
|
115
107
|
export { LocaltaskUpdateAction };
|
|
116
|
-
export { LocaltaskWaitAction };
|
|
@@ -76,10 +76,10 @@ export class LocaltaskAddAction extends ActionBase<typeof input> {
|
|
|
76
76
|
const body = await readTaskBody(ctx, meta);
|
|
77
77
|
if (!body.trim()) throw badInput('任务正文为空:给 "<正文>" 或 --file <文件>');
|
|
78
78
|
|
|
79
|
-
// 派任务编排已迁
|
|
79
|
+
// 派任务编排已迁 localtask/add.ts(派任务编排归 localtask 域;命令名不变)。
|
|
80
80
|
// 落点判定(--board/--project 严格口径 / 正文 frontmatter fail-open)只此一份实现,
|
|
81
81
|
// CLI、HTTP、面板提交同走这一条链路。
|
|
82
|
-
const { submitTask } = await (import('
|
|
82
|
+
const { submitTask } = await (import('../add.js') as any);
|
|
83
83
|
const rawBlock: any = ctx.blockBy ?? ctx['block-by'];
|
|
84
84
|
// 支持本地 id 与跨队列 "topicKey:id"(组编排边);空 → undefined
|
|
85
85
|
const { normalizeBlockBy } = await (import('../dag.js') as any);
|
|
@@ -25,7 +25,7 @@ export class LocaltaskAttachNoteAction extends ActionBase<typeof input> {
|
|
|
25
25
|
})
|
|
26
26
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
27
27
|
|
|
28
|
-
const { noteTaskAttachment } = await (import('../../
|
|
28
|
+
const { noteTaskAttachment } = await (import('../../delivery/attach.js') as any);
|
|
29
29
|
return noteTaskAttachment({
|
|
30
30
|
id: ctx.id,
|
|
31
31
|
cwd: ctx.cwd,
|
|
@@ -37,7 +37,7 @@ export class LocaltaskAttachAction extends ActionBase<typeof input> {
|
|
|
37
37
|
})
|
|
38
38
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
39
39
|
|
|
40
|
-
const { attachToTask } = await (import('../../
|
|
40
|
+
const { attachToTask } = await (import('../../delivery/attach.js') as any);
|
|
41
41
|
return attachToTask({
|
|
42
42
|
id: ctx.id,
|
|
43
43
|
cwd: ctx.cwd,
|
|
@@ -25,7 +25,7 @@ export class LocaltaskAttachmentsAction extends ActionBase<typeof input> {
|
|
|
25
25
|
})
|
|
26
26
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
27
27
|
|
|
28
|
-
const { listTaskAttachments } = await (import('../../
|
|
28
|
+
const { listTaskAttachments } = await (import('../../delivery/attach.js') as any);
|
|
29
29
|
return listTaskAttachments({ id: ctx.id, cwd: ctx.cwd, key: ctx.key });
|
|
30
30
|
|
|
31
31
|
}
|
|
@@ -27,7 +27,7 @@ export class LocaltaskDetachAction extends ActionBase<typeof input> {
|
|
|
27
27
|
})
|
|
28
28
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
29
29
|
|
|
30
|
-
const { detachTaskAttachment } = await (import('../../
|
|
30
|
+
const { detachTaskAttachment } = await (import('../../delivery/attach.js') as any);
|
|
31
31
|
return detachTaskAttachment({
|
|
32
32
|
id: ctx.id,
|
|
33
33
|
cwd: ctx.cwd,
|
|
@@ -32,7 +32,7 @@ export class LocaltaskGetAction extends ActionBase<typeof input> {
|
|
|
32
32
|
const task: any = await service.getTask({ id: ctx.id, cwd: ctx.cwd, key: ctx.key });
|
|
33
33
|
// 附件标注(任务 #15):解析正文嵌入 + 按设置自动下载 + 标本地路径。
|
|
34
34
|
// fail-open:标注坏了照常返回任务本体。
|
|
35
|
-
const { annotateTaskDelivery } = await (import('../../
|
|
35
|
+
const { annotateTaskDelivery } = await (import('../../delivery/attach.js') as any);
|
|
36
36
|
const att: any = await annotateTaskDelivery(task).catch(() => null);
|
|
37
37
|
return att
|
|
38
38
|
? { ...task, attachments: att.task.attachments }
|
|
@@ -34,7 +34,7 @@ export class LocaltaskReopenAction extends ActionBase<typeof input> {
|
|
|
34
34
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
35
35
|
|
|
36
36
|
// 重开也可能带着改过的归属(--text 的 frontmatter.project 变了)→ 同样搬家
|
|
37
|
-
const { reopenTask } = await (import('
|
|
37
|
+
const { reopenTask } = await (import('../update.js') as any);
|
|
38
38
|
return reopenTask({
|
|
39
39
|
id: ctx.id,
|
|
40
40
|
cwd: ctx.cwd,
|
|
@@ -37,7 +37,7 @@ export class LocaltaskTimegoalLogAction extends ActionBase<typeof input> {
|
|
|
37
37
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
38
38
|
|
|
39
39
|
const topicKey: any = ctx.key || service.normalizeCwd(ctx.cwd).key;
|
|
40
|
-
const { getTaskGoalLog } = await (import('../../
|
|
40
|
+
const { getTaskGoalLog } = await (import('../../goals/timegoal.js') as any);
|
|
41
41
|
return getTaskGoalLog({ topicKey, taskId: ctx.id });
|
|
42
42
|
|
|
43
43
|
}
|
|
@@ -63,8 +63,8 @@ export class LocaltaskUpdateAction extends ActionBase<typeof input> {
|
|
|
63
63
|
);
|
|
64
64
|
}
|
|
65
65
|
// 改归属即搬家(任务 #43):正文 effective project 变了 → 任务迁到新项目的队列。
|
|
66
|
-
// 编排在
|
|
67
|
-
const { updateTask: editTask } = await (import('
|
|
66
|
+
// 编排在 localtask/update.ts,与派任务(localtask/add.ts)同一套落点判定。
|
|
67
|
+
const { updateTask: editTask } = await (import('../update.js') as any);
|
|
68
68
|
const r: any = await editTask({
|
|
69
69
|
id: ctx.id,
|
|
70
70
|
text: ctx.text,
|