nx-kv 0.65.3 → 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 +20 -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/instruction-template.ts +1 -1
- package/src/core/workflow/project.ts +1 -1
- package/src/core/workflow/types.ts +1 -1
- package/src/modules/claim/actions/_manifest.generated.ts +0 -3
- package/src/modules/claim/actions/localtask-claim.ts +3 -3
- package/src/modules/claim/actions/localtask-preview.ts +2 -2
- package/src/modules/{delivery → claim}/assemble.ts +3 -3
- package/src/modules/claim/get.ts +3 -4
- package/src/modules/{delivery → claim}/groupctx.ts +4 -7
- package/src/modules/{delivery → claim}/host.ts +4 -4
- package/src/modules/claim/index.ts +1 -1
- package/src/modules/claim/panel-escort.ts +1 -1
- package/src/modules/claim/params.ts +2 -2
- package/src/modules/{delivery → claim}/preview.ts +3 -3
- package/src/modules/claim/wait.ts +14 -14
- package/src/modules/claim/waitgoal-config.ts +1 -22
- 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/actions/timegoal-check.ts +1 -1
- package/src/modules/goals/actions/timegoal-clear.ts +1 -1
- package/src/modules/goals/actions/timegoal-list.ts +1 -1
- package/src/modules/goals/actions/timegoal-log.ts +1 -1
- package/src/modules/goals/actions/timegoal-set.ts +1 -1
- package/src/modules/goals/actions/timegoal-show.ts +1 -1
- package/src/modules/goals/actions/timegoal-update.ts +1 -1
- package/src/modules/goals/plugins/timegoal-cwd-store.ts +1 -1
- package/src/modules/goals/plugins/timegoal-store.ts +3 -3
- package/src/modules/goals/plugins/timegoal-task-store.ts +2 -2
- package/src/modules/{localtask → goals}/support.ts +3 -1
- package/src/modules/localtask/actions/localtask-add.ts +3 -3
- 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-topic-removeMany.ts +1 -1
- package/src/modules/localtask/actions/localtask-update.ts +2 -2
- 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/localtask/{add.ts → lifecycle/add.ts} +5 -5
- package/src/modules/localtask/{deletion.ts → lifecycle/deletion.ts} +4 -4
- package/src/modules/localtask/{task-lifecycle.ts → lifecycle/task-lifecycle.ts} +16 -17
- 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/localtask/{update.ts → lifecycle/update.ts} +5 -5
- package/src/modules/{delivery → localtask/ops}/attach-resource.ts +4 -4
- package/src/modules/{delivery → localtask/ops}/attach-template.ts +3 -3
- package/src/modules/{delivery → localtask/ops}/attach.ts +11 -11
- package/src/modules/localtask/{board-target.ts → ops/board-target.ts} +1 -1
- package/src/modules/{delivery → localtask/ops}/doc-inline.ts +3 -3
- package/src/modules/localtask/{group-store.ts → ops/group-store.ts} +1 -1
- 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} +6 -6
- 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 -5
- package/src/modules/promptplug/plugins/attachment.ts +1 -1
- package/src/modules/promptplug/plugins/context.ts +9 -20
- 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 +0 -2
- package/src/{modules/delivery → 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 +73 -88
- package/src/web/frontend/api/client.generated.ts +51 -51
- 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/modules/claim/actions/localtask-wait.ts +0 -41
- package/src/modules/delivery/index.ts +0 -18
- 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/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
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
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
|
-
import { updateView } from '../contract-views.js';
|
|
7
|
+
import { updateView } from '../ui/contract-views.js';
|
|
8
8
|
|
|
9
9
|
/** localtask.update 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
10
10
|
const input = z.object({
|
|
@@ -64,7 +64,7 @@ export class LocaltaskUpdateAction extends ActionBase<typeof input> {
|
|
|
64
64
|
}
|
|
65
65
|
// 改归属即搬家(任务 #43):正文 effective project 变了 → 任务迁到新项目的队列。
|
|
66
66
|
// 编排在 localtask/update.ts,与派任务(localtask/add.ts)同一套落点判定。
|
|
67
|
-
const { updateTask: editTask } = await (import('../update.js') as any);
|
|
67
|
+
const { updateTask: editTask } = await (import('../lifecycle/update.js') as any);
|
|
68
68
|
const r: any = await editTask({
|
|
69
69
|
id: ctx.id,
|
|
70
70
|
text: ctx.text,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// 主题队列上的引擎装配:SnapshotStore(topic) + bus + mutator + scheduler
|
|
2
|
-
import '
|
|
2
|
+
import '../../goals/plugins/index.js'; // IoC:加载即注册全部 goal
|
|
3
3
|
import { createEventBus } from './bus/index.js';
|
|
4
4
|
import { createDagMutator } from './mutator/index.js';
|
|
5
5
|
import type { DagMutator } from './mutator/index.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// (#54 自 service.js 拆出)等待生命周期事件流:轮询 store,从 waiting/waitingUntil 与
|
|
2
2
|
// 已领取数的变化里派生 waiting/reminder/resolved 事件;SSE(streamEventsSSE)与
|
|
3
3
|
// CLI(NDJSON)共用 watchEvents 生成器。
|
|
4
|
-
import { isGlobalKey, normalizeCwd } from '
|
|
4
|
+
import { isGlobalKey, normalizeCwd } from '../paths.js';
|
|
5
5
|
import { openLocaltaskStore as openStore, topics as topicsRepo } from './repo/index.js';
|
|
6
|
-
import { deadlineMsOf } from '
|
|
7
|
-
import { addEventStreamConn } from '
|
|
6
|
+
import { deadlineMsOf } from '../lifecycle/task-view.js';
|
|
7
|
+
import { addEventStreamConn } from '../ui/panel-presence.js';
|
|
8
8
|
// ─── 等待生命周期事件流(主面板及时通知,避免用户漏过超时)────────────
|
|
9
9
|
//
|
|
10
10
|
// wait 与常驻主面板通常是两个进程,内存 EventEmitter 跨不过进程,所以事件流
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
findNode,
|
|
7
7
|
wouldCreateCycle,
|
|
8
8
|
} from './validate.js';
|
|
9
|
-
import type { WorkflowSnapshot } from '
|
|
9
|
+
import type { WorkflowSnapshot } from '../../../../core/workflow/types.js';
|
|
10
10
|
|
|
11
11
|
/** mutator 依赖的快照存储(store/index.js 的 createSnapshotStore 出站形状)。 */
|
|
12
12
|
export type SnapshotStoreLike = ReturnType<typeof import('../store/index.js').createSnapshotStore>;
|
|
@@ -98,7 +98,7 @@ export function createDagMutator({ store, bus }: DagMutatorDeps): DagMutator {
|
|
|
98
98
|
async bindPlugin(workflowId: string, target: DagMutatorTargetInput, spec: any): Promise<WorkflowSnapshot> {
|
|
99
99
|
// target: { workflow: true } | { nodeId }
|
|
100
100
|
// 动态加载 plugins 桶 → IoC 自注册;再调 onBind 规范化 config
|
|
101
|
-
const { getPlugin } = await import('
|
|
101
|
+
const { getPlugin } = await import('../../../goals/plugins/index.js');
|
|
102
102
|
return mutate(workflowId, (draft) => {
|
|
103
103
|
const ctx = { snapshot: Object.freeze(structuredClone(draft)) };
|
|
104
104
|
if (target?.workflow) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { assertPluginSpec } from '
|
|
2
|
-
import { isGateNode } from '
|
|
3
|
-
import { wouldCycleAfterLink } from '
|
|
4
|
-
import type { WorkflowSnapshot, WfNode, PluginSpec } from '
|
|
1
|
+
import { assertPluginSpec } from '../../../../core/workflow/plugin-registry.js';
|
|
2
|
+
import { isGateNode } from '../../../../core/workflow/types.js';
|
|
3
|
+
import { wouldCycleAfterLink } from '../../../../shared/graph.js';
|
|
4
|
+
import type { WorkflowSnapshot, WfNode, PluginSpec } from '../../../../core/workflow/types.js';
|
|
5
5
|
|
|
6
6
|
/** assertPluginSpec 归一化后的插件规格(原样透传,不收紧)。 */
|
|
7
7
|
type NormalizedSpec = ReturnType<typeof assertPluginSpec>;
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
// 旧库可能存过 JSON `{summary, progress}` 编码(progress 已废)——读取侧做
|
|
14
14
|
// 兼容解析(见 timegoal-task-store.getTaskGoalLog),新写入一律纯文本。
|
|
15
15
|
import { db, txw } from './open.js';
|
|
16
|
-
import { nowMs } from '
|
|
17
|
-
import type { DbApi } from '
|
|
16
|
+
import { nowMs } from '../../../../core/db/time.js';
|
|
17
|
+
import type { DbApi } from '../../../../core/db/driver.js';
|
|
18
18
|
|
|
19
19
|
/** goal / check 行(库行 → any)。 */
|
|
20
20
|
export type GoalRow = Record<string, any>;
|
|
@@ -24,7 +24,7 @@ export {
|
|
|
24
24
|
links,
|
|
25
25
|
createDbTopicAdapter,
|
|
26
26
|
};
|
|
27
|
-
export { closeDb, isStoreOpen } from '
|
|
27
|
+
export { closeDb, isStoreOpen } from '../../../../core/db/index.js';
|
|
28
28
|
|
|
29
29
|
/** 便捷聚合:`repo.topics.ensureTopic(...)` / `repo.tasks.claimTask(...)`。 */
|
|
30
30
|
export default {
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
// 读形状:`chainOf` 一次递归查询拿整条链(祖先 + 自己 + 后代),
|
|
14
14
|
// 列表页的"这条派生了几个"用 childrenCount(走 ix_task_links_children)。
|
|
15
15
|
import { db, txw } from './open.js';
|
|
16
|
-
import { badInput, notFound } from '
|
|
17
|
-
import type { DbApi } from '
|
|
16
|
+
import { badInput, notFound } from '../../../../core/errors.js';
|
|
17
|
+
import type { DbApi } from '../../../../core/db/driver.js';
|
|
18
18
|
|
|
19
19
|
/** 合法的派生类型(与 schema CHECK 同口径,写前校验给可读报错)。 */
|
|
20
20
|
export const LINK_TYPES = Object.freeze(['comment', 'reopen', 'feedback']);
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
// `<dir>` 为 home —— 约 25 个既有测试文件靠它隔离
|
|
13
13
|
import { rmSync } from 'node:fs';
|
|
14
14
|
import { dirname, join } from 'node:path';
|
|
15
|
-
import { openStore, getDb, closeDb, isStoreOpen, tx } from '
|
|
16
|
-
import { checkNodeVersion } from '
|
|
17
|
-
import type { DbApi } from '
|
|
18
|
-
import type { TxOptions } from '
|
|
15
|
+
import { openStore, getDb, closeDb, isStoreOpen, tx } from '../../../../core/db/index.js';
|
|
16
|
+
import { checkNodeVersion } from '../../../../core/db/version.js';
|
|
17
|
+
import type { DbApi } from '../../../../core/db/driver.js';
|
|
18
|
+
import type { TxOptions } from '../../../../core/db/tx.js';
|
|
19
19
|
|
|
20
20
|
/** 当前连接是按哪个库路径打开的(env 变了要关旧开新;null = 尚未打开)。 */
|
|
21
21
|
let openedFor: string | null | undefined = null;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// 可以整表清空,不会让队列本身看起来像有人在等。
|
|
6
6
|
// 判据始终两条:waiting=1 **且** until_ms > now(isLiveWaiting,task-view.js)。
|
|
7
7
|
import { db, txw } from './open.js';
|
|
8
|
-
import { nowMs } from '
|
|
8
|
+
import { nowMs } from '../../../../core/db/time.js';
|
|
9
9
|
import { getTopicRow, updateTopic } from './topics.js';
|
|
10
10
|
|
|
11
11
|
/** setPresence 的入参形状。 */
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
// reopenCount → tasks.round - 1 (round = 重开次数 + 1,schema 语义)
|
|
19
19
|
// blockBy 本地数字 → task_deps 行;"key:id" 跨队列引用 → ext.ext_deps_foreign
|
|
20
20
|
// 其余低频字段(history / forkOf / timegoal / trashIndex / claimedFrom…)→ tasks.ext
|
|
21
|
-
import { msToStamp, parseStampMs, nowMs } from '
|
|
21
|
+
import { msToStamp, parseStampMs, nowMs } from '../../../../core/db/time.js';
|
|
22
22
|
|
|
23
23
|
/** ext 的键名集中在这里(散着写迟早拼错一个)。 */
|
|
24
24
|
export const EXT = Object.freeze({
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
// 也没有从库里派生出来的镜像——要用正文就读插件类(activeTemplateOf)。
|
|
11
11
|
// - 因此本文件只剩两个真正可写的键:`lt.timeoutSec` 与 `lt.appendMode`。
|
|
12
12
|
import { db, txw } from './open.js';
|
|
13
|
-
import { nowMs } from '
|
|
13
|
+
import { nowMs } from '../../../../core/db/time.js';
|
|
14
14
|
import {
|
|
15
15
|
DEFAULT_TIMEOUT_SEC,
|
|
16
16
|
MAX_TIMEOUT_SEC,
|
|
17
17
|
clampTimeoutSec,
|
|
18
18
|
} from '../store-io.js';
|
|
19
|
-
import { clampAppendMode } from '
|
|
20
|
-
import type { DbApi } from '
|
|
21
|
-
import { activeTemplateOf } from '
|
|
19
|
+
import { clampAppendMode } from '../../lifecycle/task-templates.js';
|
|
20
|
+
import type { DbApi } from '../../../../core/db/driver.js';
|
|
21
|
+
import { activeTemplateOf } from '../../../promptplug/index.js';
|
|
22
22
|
|
|
23
23
|
const KEYS = {
|
|
24
24
|
timeoutSec: 'lt.timeoutSec',
|
|
@@ -93,4 +93,4 @@ export function settingsView(): Record<string, any> {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
export { DEFAULT_TIMEOUT_SEC, MAX_TIMEOUT_SEC } from '../store-io.js';
|
|
96
|
-
export { DEFAULT_ACK_PROMPT } from '
|
|
96
|
+
export { DEFAULT_ACK_PROMPT } from '../../lifecycle/task-templates.js';
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
// 闸门推出来的边不写 blockBy(由 blocksFollowing 表达)
|
|
17
17
|
// 改动这两处语义时必须同步改 core/workflow/project.js(那边管 JSON 时代的口径)。
|
|
18
18
|
import { db, txw } from './open.js';
|
|
19
|
-
import { nowMs } from '
|
|
19
|
+
import { nowMs } from '../../../../core/db/time.js';
|
|
20
20
|
import { parseExt, TOPIC_EXT } from './rows.js';
|
|
21
21
|
import { ensureTopic, updateTopic, getTopicRow } from './topics.js';
|
|
22
|
-
import { listTaskRowsByTopic, insertTask, updateTask } from './tasks.js';
|
|
23
|
-
import { topicToSnapshot } from '
|
|
24
|
-
import type { DbApi } from '
|
|
25
|
-
import type { WorkflowSnapshot } from '
|
|
22
|
+
import { listTaskRowsByTopic, insertTask, updateTask, alignClaimedFromSnapshot as repoAlignClaimedFromSnapshot } from './tasks.js';
|
|
23
|
+
import { topicToSnapshot } from '../../../../core/workflow/project.js';
|
|
24
|
+
import type { DbApi } from '../../../../core/db/driver.js';
|
|
25
|
+
import type { WorkflowSnapshot } from '../../../../core/workflow/types.js';
|
|
26
26
|
import type { TopicRow } from './topics.js';
|
|
27
27
|
|
|
28
28
|
/** 运行时快照允许挂 meta(cwd/name 落点;WorkflowSnapshot 类型未收编该字段)。 */
|
|
@@ -128,7 +128,7 @@ export function createDbTopicAdapter(): DbTopicAdapter {
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
// ② 闸门 / 节点状态 →
|
|
131
|
+
// ② 闸门 / 节点状态 → 行字段(status 对齐走语义函数,其余字段走通用 patch)
|
|
132
132
|
for (const node of snapshot.nodes || []) {
|
|
133
133
|
const task = byId.get(String(node.id));
|
|
134
134
|
if (!task) continue;
|
|
@@ -136,7 +136,9 @@ export function createDbTopicAdapter(): DbTopicAdapter {
|
|
|
136
136
|
if (node.state === 'success') {
|
|
137
137
|
if (!task.completedAt) patch.completedAt = nowStamp();
|
|
138
138
|
} else if (node.state === 'running') {
|
|
139
|
-
|
|
139
|
+
// 外部 DAG 说在跑 → 本地对齐成 claimed(原子守卫;done/cancelled 不动)。
|
|
140
|
+
// 这是「对齐外部事实」不是「推进任务」,所以不走 claimTask。
|
|
141
|
+
repoAlignClaimedFromSnapshot(topic.id, Number(task.id));
|
|
140
142
|
}
|
|
141
143
|
const next = updateTask(topic.id, task.id, patch);
|
|
142
144
|
if (next) byId.set(String(node.id), next);
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
// 3. **队列顺序不在这里**:seq 是对外编号、不可变(trg_tasks_identity 锁死),
|
|
11
11
|
// 顺序在 topics.ext.ext_task_order(见 repo/topics.js 顶部说明)。
|
|
12
12
|
import { db, txw } from './open.js';
|
|
13
|
-
import { nowMs } from '
|
|
13
|
+
import { nowMs } from '../../../../core/db/time.js';
|
|
14
14
|
import { EXT, parseExt, jsonText, rowToTask, splitTaskFields } from './rows.js';
|
|
15
|
-
import { syncTaskAttachments } from '
|
|
16
|
-
import type { DbApi } from '
|
|
15
|
+
import { syncTaskAttachments } from '../../../../core/attachmentdb.js';
|
|
16
|
+
import type { DbApi } from '../../../../core/db/driver.js';
|
|
17
17
|
import type { TaskObject } from './rows.js';
|
|
18
18
|
|
|
19
19
|
/** 任务行查询结果:原始 DB 行 + JSON 形态任务。 */
|
|
@@ -310,9 +310,86 @@ export function closeOpenTask(topicId: number, seq: number, { status = 'done', f
|
|
|
310
310
|
});
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
+
/**
|
|
314
|
+
* 定格为 cancelled(重开派生 / 搬家 tombstone / 批量取消共用)。
|
|
315
|
+
*
|
|
316
|
+
* 语义:**非终态一律定格**(pending / claimed / plan → cancelled;done 保持 done——
|
|
317
|
+
* 上一轮的交付事实不因重开而消失)。状态写入是带守卫的原子 UPDATE
|
|
318
|
+
* (`WHERE status NOT IN ('done','cancelled')`),并发下重复定格第二次拿 null。
|
|
319
|
+
* `extra` 是 tombstone 的审计字段(supersededBy / moveFrom),走 ext 合并——
|
|
320
|
+
* 它们不是状态,即使行已是 cancelled 也照写(重开一条已取消的任务要留派生标记)。
|
|
321
|
+
*/
|
|
322
|
+
export function tombstoneAsCancelled(
|
|
323
|
+
topicId: number,
|
|
324
|
+
seq: number,
|
|
325
|
+
extra: { supersededBy?: unknown; moveFrom?: unknown; deletedAtMs?: number } = {},
|
|
326
|
+
): TaskObject | null {
|
|
327
|
+
return txw((conn) => {
|
|
328
|
+
const cur = getTaskRow(topicId, seq, conn);
|
|
329
|
+
if (!cur) return null;
|
|
330
|
+
if (cur.task.status !== 'cancelled') {
|
|
331
|
+
const at = nowMs();
|
|
332
|
+
const r = conn.run(
|
|
333
|
+
`UPDATE tasks SET status = 'cancelled',
|
|
334
|
+
deleted_at = COALESCE(:del, deleted_at),
|
|
335
|
+
version = version + 1, updated_at = :at
|
|
336
|
+
WHERE topic_id = :t AND seq = :s AND status NOT IN ('done', 'cancelled')`,
|
|
337
|
+
{ t: topicId, s: seq, del: extra.deletedAtMs ?? null, at }
|
|
338
|
+
);
|
|
339
|
+
if (Number(r.changes) !== 1) return null;
|
|
340
|
+
}
|
|
341
|
+
const extPatch: Record<string, unknown> = {};
|
|
342
|
+
if (extra.supersededBy !== undefined) extPatch[EXT.SUPERSEDED_BY] = extra.supersededBy;
|
|
343
|
+
if (extra.moveFrom !== undefined) extPatch[EXT.MOVE_FROM] = extra.moveFrom;
|
|
344
|
+
if (Object.keys(extPatch).length) mergeExt(conn, topicId, seq, extPatch);
|
|
345
|
+
return getTaskRow(topicId, seq, conn)!.task;
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* #126 草稿双向切换:pending ↔ plan,其余状态一律拒绝。
|
|
351
|
+
* 调用方(task-ops.setPlanStatus)负责产出友好的错误文案;这里的 WHERE 守卫
|
|
352
|
+
* 是并发层的最后防线——两个进程同时切同一条,只有一个 UPDATE 生效。
|
|
353
|
+
*/
|
|
354
|
+
export function switchPlanStatus(topicId: number, seq: number, to: 'plan' | 'pending'): TaskObject | null {
|
|
355
|
+
const from = to === 'plan' ? 'pending' : 'plan';
|
|
356
|
+
return txw((conn) => {
|
|
357
|
+
const r = conn.run(
|
|
358
|
+
`UPDATE tasks SET status = :to, version = version + 1, updated_at = :at
|
|
359
|
+
WHERE topic_id = :t AND seq = :s AND status = :from AND deleted_at IS NULL`,
|
|
360
|
+
{ t: topicId, s: seq, to, from, at: nowMs() }
|
|
361
|
+
);
|
|
362
|
+
if (Number(r.changes) !== 1) return null;
|
|
363
|
+
return getTaskRow(topicId, seq, conn)!.task;
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* 引擎快照对齐:外部 DAG 说节点在跑(node.state === 'running'),本地还没对齐
|
|
369
|
+
* 就单向推成 claimed。这是「对齐外部事实」不是「推进任务」——不走 claimTask,
|
|
370
|
+
* 因为没有领取人 / 摘要可写(见 tests/unit 的 snapshot 对齐用例)。
|
|
371
|
+
* 守卫与跃迁表一致:done / cancelled 不许被对齐改写,已是 claimed 幂等跳过。
|
|
372
|
+
*/
|
|
373
|
+
export function alignClaimedFromSnapshot(topicId: number, seq: number): boolean {
|
|
374
|
+
return txw((conn) => {
|
|
375
|
+
const r = conn.run(
|
|
376
|
+
`UPDATE tasks SET status = 'claimed', claimed_at = :at, version = version + 1, updated_at = :at
|
|
377
|
+
WHERE topic_id = :t AND seq = :s AND status NOT IN ('claimed', 'done')`,
|
|
378
|
+
{ t: topicId, s: seq, at: nowMs() }
|
|
379
|
+
);
|
|
380
|
+
return Number(r.changes) === 1;
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
|
|
313
384
|
/**
|
|
314
385
|
* 字段级更新(reopen / update / 软删 / 恢复都用它)。
|
|
315
386
|
* `patch` 是 JSON 形态的字段子集;写不进任何列的低频字段进 ext。
|
|
387
|
+
*
|
|
388
|
+
* **status 不在可更新列里**(2026-11-19 收敛):状态流转只能走上面的语义函数
|
|
389
|
+
* (tombstoneAsCancelled / switchPlanStatus / alignClaimedFromSnapshot)或
|
|
390
|
+
* claimTask / completeTask / closeOpenTask 的带守卫 UPDATE。这样「所有状态
|
|
391
|
+
* 修改必然经过守卫」成为结构约束,不再依赖调用方自觉。
|
|
392
|
+
*
|
|
316
393
|
* @returns {object|null} 更新后的 JSON 形态任务
|
|
317
394
|
*/
|
|
318
395
|
export function updateTask(topicId: number, seq: number, patch: TaskPatch = {}): TaskObject | null {
|
|
@@ -325,7 +402,8 @@ export function updateTask(topicId: number, seq: number, patch: TaskPatch = {}):
|
|
|
325
402
|
const params: Record<string, any> = { t: topicId, s: seq, at: nowMs() };
|
|
326
403
|
const colMap: Record<string, string> = {
|
|
327
404
|
body: 'body',
|
|
328
|
-
status
|
|
405
|
+
// status 刻意不在列:状态流转只能走本文件的语义函数(见上方 updateTask 注释),
|
|
406
|
+
// 通用 patch 若能直写 status,「带守卫 UPDATE」就成了可绕过的摆设。
|
|
329
407
|
feedback: 'feedback',
|
|
330
408
|
claimedAtMs: 'claimed_at',
|
|
331
409
|
doneAtMs: 'done_at',
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// 主题仓储(topics + topic_presence 的窄方法)。
|
|
2
2
|
|
|
3
3
|
import { db, txw } from './open.js';
|
|
4
|
-
import { nowMs, msToStamp } from '
|
|
5
|
-
import { GLOBAL_TOPIC_KEY } from '
|
|
4
|
+
import { nowMs, msToStamp } from '../../../../core/db/time.js';
|
|
5
|
+
import { GLOBAL_TOPIC_KEY } from '../../../../core/topic-key.js';
|
|
6
6
|
import { TOPIC_EXT, parseExt, jsonText } from './rows.js';
|
|
7
7
|
import { listTaskRowsByTopic, listAllTaskRows } from './tasks.js';
|
|
8
|
-
import type { DbApi } from '
|
|
8
|
+
import type { DbApi } from '../../../../core/db/driver.js';
|
|
9
9
|
import type { TaskObject } from './rows.js';
|
|
10
10
|
|
|
11
11
|
const SENTINEL_REPO = '__unbound__';
|
|
@@ -19,7 +19,7 @@ export interface RepoContextIndex {
|
|
|
19
19
|
let reposMod: ReposModule = null;
|
|
20
20
|
export async function repoContextIndex(): Promise<RepoContextIndex | null> {
|
|
21
21
|
try {
|
|
22
|
-
if (!reposMod) reposMod = await import('
|
|
22
|
+
if (!reposMod) reposMod = await import('../../repos/service.js');
|
|
23
23
|
return { mod: reposMod, map: await reposMod.contextMap() };
|
|
24
24
|
} catch {
|
|
25
25
|
return null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Scheduler —— 听 bus → 拓扑就绪;永不调用 onGet
|
|
2
2
|
import { EVENTS } from '../bus/index.js';
|
|
3
3
|
import { driveReadyStates } from './state-drive.js';
|
|
4
|
-
import type { WorkflowSnapshot } from '
|
|
4
|
+
import type { WorkflowSnapshot } from '../../../../core/workflow/types.js';
|
|
5
5
|
import type { SnapshotStoreLike } from '../mutator/index.js';
|
|
6
6
|
|
|
7
7
|
/** createEventBus 的出站形状。 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isNodeReady } from '
|
|
2
|
-
import type { WfGraph } from '
|
|
3
|
-
import { isBarrierOpen } from '
|
|
4
|
-
import type { WorkflowSnapshot } from '
|
|
1
|
+
import { isNodeReady } from '../../../../core/workflow/readiness.js';
|
|
2
|
+
import type { WfGraph } from '../../../../core/workflow/readiness.js';
|
|
3
|
+
import { isBarrierOpen } from '../../../goals/plugins/blockgoal.js';
|
|
4
|
+
import type { WorkflowSnapshot } from '../../../../core/workflow/types.js';
|
|
5
5
|
|
|
6
6
|
/** driveReadyStates 的出站形状。 */
|
|
7
7
|
export interface DriveResult {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
|
-
import { APP_DIR } from '
|
|
4
|
-
import type { WorkflowSnapshot } from '
|
|
3
|
+
import { APP_DIR } from '../../../../core/paths.js';
|
|
4
|
+
import type { WorkflowSnapshot } from '../../../../core/workflow/types.js';
|
|
5
5
|
|
|
6
6
|
function defaultDir(): string {
|
|
7
7
|
return process.env.NX_KV_WORKFLOW_STORE || join(APP_DIR, 'workflows');
|
|
@@ -3,11 +3,11 @@ import crypto from 'node:crypto';
|
|
|
3
3
|
import { createMemoryAdapter } from './memory-adapter.js';
|
|
4
4
|
import { createFileAdapter } from './file-adapter.js';
|
|
5
5
|
|
|
6
|
-
/** @typedef {import('
|
|
7
|
-
/** @typedef {import('
|
|
6
|
+
/** @typedef {import('../../../../core/workflow/types.js').WorkflowSnapshot} WorkflowSnapshot */
|
|
7
|
+
/** @typedef {import('../../../../core/workflow/types.js').InitMeta} InitMeta */
|
|
8
8
|
|
|
9
|
-
import type { WorkflowSnapshot } from '
|
|
10
|
-
import type { InitMeta } from '
|
|
9
|
+
import type { WorkflowSnapshot } from '../../../../core/workflow/types.js';
|
|
10
|
+
import type { InitMeta } from '../../../../core/workflow/types.js';
|
|
11
11
|
|
|
12
12
|
/** 运行时快照允许挂 `meta`(InitMeta.cwd / meta 落点;WorkflowSnapshot 类型未收编该字段)。 */
|
|
13
13
|
type SnapWithMeta = WorkflowSnapshot & { meta?: Record<string, unknown> };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** @typedef {import('
|
|
1
|
+
/** @typedef {import('../../../../core/workflow/types.js').WorkflowSnapshot} WorkflowSnapshot */
|
|
2
2
|
|
|
3
|
-
import type { WorkflowSnapshot } from '
|
|
3
|
+
import type { WorkflowSnapshot } from '../../../../core/workflow/types.js';
|
|
4
4
|
|
|
5
5
|
/** 快照存储适配器接口:get/set/has/delete 四件套 + clear(file/memory 三实现可互换)。 */
|
|
6
6
|
export interface SnapshotAdapter {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// loadStore() / saveStore(data) / topicOf(store,...) / nextTaskId(tasks)
|
|
11
11
|
// —— 任何「读全表到内存 → 改 → 整表重写」的写法都被禁止:那会把 SQLite 的
|
|
12
12
|
// 行级守卫(claim 的 WHERE status='pending')退化成「最后写入者赢」。
|
|
13
|
-
import { badInput } from '
|
|
13
|
+
import { badInput } from '../../../core/errors.js';
|
|
14
14
|
|
|
15
15
|
export const DEFAULT_TIMEOUT_MS = 180_000; // 阻塞默认 3 分钟(推荐值)
|
|
16
16
|
export const DEFAULT_TIMEOUT_SEC = 180; // 推荐阻塞时长(3 分钟)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// 日常 DAG 写路径 —— 一律经 Mutator(单一写入口),再投影回主题任务行。
|
|
2
2
|
// 跨队列依赖("topicKey:id")只落在任务行 blockBy,不进本 topic 引擎节点图。
|
|
3
|
-
import '
|
|
3
|
+
import '../../goals/plugins/index.js';
|
|
4
4
|
import { createTopicEngine } from './engine.js';
|
|
5
|
-
import { normalizeBlockBy, parseDepRef } from '
|
|
6
|
-
import { isGateNode } from '
|
|
5
|
+
import { normalizeBlockBy, parseDepRef } from '../../../core/workflow/readiness.js';
|
|
6
|
+
import { isGateNode } from '../../../core/workflow/types.js';
|
|
7
7
|
import type { DagMutator } from './mutator/index.js';
|
|
8
8
|
import type { SnapshotStoreLike } from './mutator/index.js';
|
|
9
9
|
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
//
|
|
15
15
|
// 至此三个任务动词(领 get / 等 wait / 派 add)同构:action 层一律一行委托,
|
|
16
16
|
// 编排住在本域(add.js / update.js),队列本体只有 service.js 一处。
|
|
17
|
-
import { badInput } from '
|
|
18
|
-
import { addTask, normalizeCwd } from '../
|
|
19
|
-
import { applyGroupFields, parseFrontmatter } from '
|
|
20
|
-
import { resolveGroupTarget } from '../
|
|
21
|
-
import { normalizedGroupStore } from '
|
|
17
|
+
import { badInput } from '../../../core/errors.js';
|
|
18
|
+
import { addTask, normalizeCwd } from '../service.js';
|
|
19
|
+
import { applyGroupFields, parseFrontmatter } from '../../../shared/frontmatter.js';
|
|
20
|
+
import { resolveGroupTarget } from '../ops/board-target.js';
|
|
21
|
+
import { normalizedGroupStore } from '../ops/group-store.js';
|
|
22
22
|
|
|
23
23
|
export interface SubmitTaskOptions {
|
|
24
24
|
/** 任务正文(Markdown,frontmatter 允许在头部) */
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
// 删除 = 软删 topics 行(deleted_at 打标;任务/依赖/presence 保留,同名目录再出现即恢复)。
|
|
5
5
|
// 全局池例外:同一个 key 永远会再出现,软删会被下一次 ensureTopic 复活成「没删掉」,
|
|
6
6
|
// 所以 force 清空全局池走真删(FK 级联清任务)。
|
|
7
|
-
import { badInput } from '
|
|
8
|
-
import { isGlobalKey, normalizeCwd, resolveTopicKey } from '
|
|
9
|
-
import { openLocaltaskStore as openStore, topics as topicsRepo } from '
|
|
7
|
+
import { badInput } from '../../../core/errors.js';
|
|
8
|
+
import { isGlobalKey, normalizeCwd, resolveTopicKey } from '../paths.js';
|
|
9
|
+
import { openLocaltaskStore as openStore, topics as topicsRepo } from '../infra/repo/index.js';
|
|
10
10
|
import { isLiveWaiting, isPending, topicView } from './task-view.js';
|
|
11
11
|
// ─── 删除判定:四条删除路径共用同一套规则 ──────────────────────────────
|
|
12
12
|
//
|
|
@@ -106,7 +106,7 @@ export async function removeTopic({ cwd: rawCwd, key: rawKey, force = false }: R
|
|
|
106
106
|
openStore();
|
|
107
107
|
const t = topicsRepo.getTopic(key);
|
|
108
108
|
if (!t) {
|
|
109
|
-
const { notFound } = await import('
|
|
109
|
+
const { notFound } = await import('../../../core/errors.js');
|
|
110
110
|
throw notFound(`主题不存在(key ${key})`);
|
|
111
111
|
}
|
|
112
112
|
// 删除判定只写一份(deleteGuard):全局共享池 / 等待中 / 有未领取任务 → 都要 --force。
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// (#54 自 service.js 拆出)队列出口的任务生命周期:consumeFirstPending(D-first 领取,
|
|
2
2
|
// 跳过被依赖/闸门挡住的 pending)、completeTask(完成门禁:timegoal 未到点返回 blocked
|
|
3
3
|
// 业务值而不是抛错)、reopenTask(用户修改反馈 → **就地重开原任务**,历史进 history 链)。
|
|
4
|
-
import { badInput, notFound } from '
|
|
5
|
-
import { formatDuration, renderInstruction } from '
|
|
6
|
-
import { activeTemplateOf } from '
|
|
7
|
-
import { taskGoalTemplateCtx } from '
|
|
8
|
-
import { preserveFrontmatter } from '
|
|
4
|
+
import { badInput, notFound } from '../../../core/errors.js';
|
|
5
|
+
import { formatDuration, renderInstruction } from '../../../core/instruction-template.js';
|
|
6
|
+
import { activeTemplateOf } from '../../promptplug/index.js';
|
|
7
|
+
import { taskGoalTemplateCtx } from '../../promptplug/plugins/goal-prompt.js';
|
|
8
|
+
import { preserveFrontmatter } from '../../../shared/frontmatter.js';
|
|
9
9
|
import {
|
|
10
10
|
FEEDBACK_HEADING,
|
|
11
11
|
PLAIN_FEEDBACK_HEADING,
|
|
12
12
|
appendFeedback,
|
|
13
13
|
appendAckFeedback,
|
|
14
|
-
} from '
|
|
15
|
-
import { findFirstReadyPending } from '
|
|
14
|
+
} from '../../../shared/feedback-text.js';
|
|
15
|
+
import { findFirstReadyPending } from '../dag.js';
|
|
16
16
|
import { basename } from 'node:path';
|
|
17
|
-
import { isGlobalKey, resolveTaskKey, topicKeyFor } from '
|
|
18
|
-
import { normalizeSummary, normalizeText, stampNow } from '
|
|
17
|
+
import { isGlobalKey, resolveTaskKey, topicKeyFor } from '../paths.js';
|
|
18
|
+
import { normalizeSummary, normalizeText, stampNow } from '../infra/store-io.js';
|
|
19
19
|
import { normalizeTask, foreignResolver, isPending } from './task-view.js';
|
|
20
20
|
import {
|
|
21
21
|
openLocaltaskStore as openStore,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
tasks as tasksRepo,
|
|
24
24
|
links as linksRepo,
|
|
25
25
|
txw as tx,
|
|
26
|
-
} from '
|
|
26
|
+
} from '../infra/repo/index.js';
|
|
27
27
|
|
|
28
28
|
/** supersederRef 的出站形状(取代者的绝对地址)。 */
|
|
29
29
|
interface SupersederRef {
|
|
@@ -233,8 +233,7 @@ export async function reopenTask({
|
|
|
233
233
|
} else {
|
|
234
234
|
// supersededBy 必须带上绝对地址:搬到别的队列后,光写目标队列的 seq 会被
|
|
235
235
|
// 顺链逻辑按源主题解析到一条完全无关的任务上。
|
|
236
|
-
tasksRepo.
|
|
237
|
-
status: 'cancelled',
|
|
236
|
+
tasksRepo.tombstoneAsCancelled(curTopic.id, want, {
|
|
238
237
|
supersededBy: hostKey === srcKey ? inserted.id : `${hostKey}:${inserted.id}`,
|
|
239
238
|
});
|
|
240
239
|
}
|
|
@@ -344,13 +343,13 @@ export async function completeTask({ cwd: rawCwd, key: rawKey, id, summary: rawS
|
|
|
344
343
|
id: want,
|
|
345
344
|
key,
|
|
346
345
|
name: t.name,
|
|
347
|
-
hint: '任务还没被领取——先
|
|
346
|
+
hint: '任务还没被领取——先 get 领取,干完再标完成',
|
|
348
347
|
};
|
|
349
348
|
}
|
|
350
349
|
let goal: Record<string, any> | null = null;
|
|
351
350
|
if (task.timegoal) {
|
|
352
351
|
// 门禁:查任务级 goal。动态 import——claim/wait.ts 静态引用本模块,这里走动态避免环。
|
|
353
|
-
const { taskGoalState, recordTaskCheck } = await import('
|
|
352
|
+
const { taskGoalState, recordTaskCheck } = await import('../../goals/taskgoal.js');
|
|
354
353
|
const st = await taskGoalState({ topicKey: key, taskId: want });
|
|
355
354
|
if (st.hasGoal && !st.reached) {
|
|
356
355
|
// 「未到点就想 done」的拦截提示(#90):模板与其它区块同源,是 doneguard
|
|
@@ -411,11 +410,11 @@ export async function completeTask({ cwd: rawCwd, key: rawKey, id, summary: rawS
|
|
|
411
410
|
}
|
|
412
411
|
// 单一写路径:完成 → Mutator 标 success + 调度一轮(fail-open)
|
|
413
412
|
try {
|
|
414
|
-
const { markTaskSuccess } = await import('
|
|
413
|
+
const { markTaskSuccess } = await import('../infra/writes.js');
|
|
415
414
|
await markTaskSuccess(key, want);
|
|
416
415
|
} catch {
|
|
417
416
|
try {
|
|
418
|
-
const { refreshTopicAfterComplete } = await import('
|
|
417
|
+
const { refreshTopicAfterComplete } = await import('../infra/engine.js');
|
|
419
418
|
await refreshTopicAfterComplete(key);
|
|
420
419
|
} catch {
|
|
421
420
|
/* ignore */
|
|
@@ -455,5 +454,5 @@ export async function completeTask({ cwd: rawCwd, key: rawKey, id, summary: rawS
|
|
|
455
454
|
// 那不是"到点自动取消",那是把目录焊死了。这种情况该由 agent 自己的
|
|
456
455
|
// `timegoal check`(reached:true)去处理。
|
|
457
456
|
//
|
|
458
|
-
// (goal
|
|
457
|
+
// (goal 探针与目标上下文已随阻塞编排迁往 claim/wait.ts——任务工具语义归
|
|
459
458
|
// goals 域,队列本体不再依赖 timegoal 模块。)
|