nx-kv 0.65.2 → 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 +23 -0
- package/package.json +1 -1
- 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 +2 -2
- 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/{tasktool → claim}/wait.ts +5 -5
- package/src/modules/{tasktool/plugins → claim}/waitgoal-config.ts +3 -3
- package/src/modules/{promptplug/delivery.ts → delivery/assemble.ts} +5 -5
- 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/{tasktool/delivery.ts → delivery/host.ts} +4 -4
- package/src/modules/delivery/index.ts +18 -0
- package/src/modules/{tasktool → delivery}/preview.ts +4 -4
- 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 +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 +4 -4
- 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 +2 -2
- package/src/modules/promptplug/index.ts +4 -6
- package/src/modules/promptplug/plugins/attachment.ts +1 -1
- package/src/modules/promptplug/plugins/context.ts +1 -1
- package/src/modules/promptplug/plugins/goal-prompt.ts +1 -1
- package/src/modules/repos/service/crud.ts +1 -1
- package/src/runtime/registry.ts +6 -2
- package/src/web/frontend/api/cli-tree.json +138 -138
- package/src/web/frontend/api/client.generated.ts +90 -88
- 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 -71
- /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-task-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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
本文件对外可见的变更。格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)。
|
|
4
4
|
|
|
5
|
+
## [0.65.3] - 2026-11-19 五域制目录重组:删除引擎门,领取/交付/目标各归其位(#237)
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- **五域制目录重组**(#237,承接 #236 的方案):`tasktool` 目录消失,内容按动词域归位——
|
|
10
|
+
- **claim**(新域):领取域——`localtask.claim` / `localtask.wait` / `localtask.preview`
|
|
11
|
+
三个 action + `get.ts` / `wait.ts`(阻塞窗口)/ `params.ts` / `panel-escort.ts` /
|
|
12
|
+
`waitgoal-config.ts`(持续 get 配置)
|
|
13
|
+
- **delivery**(新域):交付域——`host.ts`(宿主取数)/ `assemble.ts`(组装核,原
|
|
14
|
+
`promptplug/delivery.ts`)/ 附件四件 / 组上下文 / 人读排版 / 预览
|
|
15
|
+
- **goals**(新域):目标域——三族目标插件(timegoal / taskgoal / blockgoal)+ 存储与
|
|
16
|
+
运行时 + `timegoal` CLI 命令族
|
|
17
|
+
- **localtask**:保持队列本体语义,吸收派任务编排(`add.ts` / `update.ts` /
|
|
18
|
+
`group-store.ts` / `support.ts`);**claim / wait / preview 三个 action 迁出**
|
|
19
|
+
- **promptplug**:回归纯引擎(八段插件 / 注册表 / 模板存储 / 渲染),不再 import 其他模块
|
|
20
|
+
- **引擎门删除**(#237):`tasktool/facade/`(submit / get / wait 三门)+ 消费钩子
|
|
21
|
+
(`plugins/runtime.ts` 的 `runGetHooks` / `plugins/waitgoal.ts` 的 pull-poll)一并删除——
|
|
22
|
+
它们无 CLI 无 HTTP、只有测试在用;**领取的唯一入口收敛为 `localtask.claim`**。
|
|
23
|
+
冻结布局治理文档(`core/workflow/layout.ts` / `edges.ts`)同步删除。
|
|
24
|
+
- **对外零感知**:CLI 路径、HTTP 路由、action id、交付渲染字节(golden)四样全部未变——
|
|
25
|
+
契约指纹 `f132179e14f836c8` 不变,golden 基线零改动;本次只动「文件住在哪」。
|
|
26
|
+
- 手册校准:dev-nxkv 的 A02 / A03 / A08 / B01 / B03 路径与模块名同步到新结构。
|
|
27
|
+
|
|
5
28
|
## [0.65.2] - 2026-11-19 getloop 残留预渲染链清理(#230 审计)
|
|
6
29
|
|
|
7
30
|
### Changed
|
package/package.json
CHANGED
package/src/core/db/settings.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// settings 表的裸 k/v 读写(value 一律 JSON 文本)。
|
|
2
2
|
//
|
|
3
3
|
// 为什么在 core:settings 表的消费方横跨多个域 —— core/config.js(偏好 4 项,
|
|
4
|
-
// 凭据绝不进库)与
|
|
4
|
+
// 凭据绝不进库)与 goals 域的队列级 timegoal(goal 是"按键取值"的运行时状态,
|
|
5
5
|
// 不参与任何关系查询)都要经这里读写。core 不得 import modules(分层规则),
|
|
6
6
|
// 所以裸访问器落在 core,域语义(clamp / 白名单 / 键名)留在各自的模块里。
|
|
7
7
|
//
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
// - 保存模板时先 `validateTemplate()` 编译校验,语法错误**拒绝保存**(见
|
|
31
31
|
// localtask/repo/settings),让用户当场看到错在哪;
|
|
32
32
|
// - 渲染时若仍遇到坏模板(老版本存进去的 / 直接改库的),由调用方回落该区块
|
|
33
|
-
// 的**内置模板**并把告警写进 `renderWarnings`(见
|
|
33
|
+
// 的**内置模板**并把告警写进 `renderWarnings`(见 promptplug/compose.ts)。
|
|
34
34
|
// 选择回落而不是阻断领取:一条坏模板不该让整个队列停摆,但问题必须在
|
|
35
35
|
// CLI 返回载荷 / 面板预览里可见。
|
|
36
36
|
//
|
|
@@ -43,7 +43,7 @@ export function assertPluginSpec(spec: PluginSpec | null | undefined): PluginSpe
|
|
|
43
43
|
return { name, scope, config: spec.config && typeof spec.config === 'object' ? spec.config : {} };
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
// 内置登记(实现落在
|
|
46
|
+
// 内置登记(实现落在 goals/plugins;此处只登记元数据)
|
|
47
47
|
registerPluginMeta(BUILTIN_GOALS.blockgoal, 'control');
|
|
48
48
|
registerPluginMeta(BUILTIN_GOALS.waitgoal, 'node');
|
|
49
49
|
registerPluginMeta(BUILTIN_GOALS.timegoal, 'workflow');
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// workflow 契约(#34 阶段 0)——
|
|
1
|
+
// workflow 契约(#34 阶段 0)—— 冻结类型;#237 引擎门(facade)已删除,仅剩写路径底座在用。
|
|
2
2
|
//
|
|
3
3
|
// 对照参考方案(Node+TS DAG 动态工作流)在 nx-kv 上的映射:
|
|
4
4
|
// workflowId → 主题 key(cwd 归一化 / repos key;全局 '__GLOBAL__')
|
|
5
|
-
// submit(init) → localtask add
|
|
6
|
-
// get(id,node?) →
|
|
5
|
+
// submit(init) → localtask add(只入队,不构造全图)
|
|
6
|
+
// get(id,node?) → 引擎门(#237 已删除;现役领取走 localtask.claim)
|
|
7
7
|
// Node → localtask 一条任务(id 数字;状态用 status+completedAt)
|
|
8
8
|
// Edge / blockBy → task.blockBy[] + task.blocksFollowing(闸门)
|
|
9
9
|
// blockgoal → scope=control;onSchedule 决定后继是否 ready(见 localtask/dag.js)
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
//
|
|
21
21
|
// 工程约束(相对参考方案的刻意偏离):
|
|
22
22
|
// - 仓库保持 JS ESM + JSDoc,不上平行 TypeScript 引擎
|
|
23
|
-
// - 契约落在 core/;业务仍在 modules/localtask + modules/
|
|
23
|
+
// - 契约落在 core/;业务仍在 modules/localtask + modules/claim + modules/delivery + modules/goals(四域分工)
|
|
24
24
|
// - 存储沿用本机 JSON 主题快照;RedisAdapter 属阶段 6,不挡主线
|
|
25
25
|
// - 目标目录规范见同目录 layout.js(禁止平行 src/{facade,store,mutator,…})
|
|
26
26
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// AUTO-GENERATED —— 由 scripts/gen-actions.mjs 生成,勿手改。
|
|
2
|
+
//
|
|
3
|
+
// 收录本目录下所有继承 ActionBase 的类。**加一条 action = 新建一个文件 +
|
|
4
|
+
// 跑 `pnpm gen`**;模块的 index.ts 不需要改。
|
|
5
|
+
// 新鲜度由 tests/unit/action-registry.test.mjs 对账。
|
|
6
|
+
|
|
7
|
+
import type { ActionBase } from '../../../runtime/action-base.js';
|
|
8
|
+
import type { Container } from '../../../runtime/container.js';
|
|
9
|
+
import { LocaltaskClaimAction } from './localtask-claim.js';
|
|
10
|
+
import { LocaltaskPreviewAction } from './localtask-preview.js';
|
|
11
|
+
import { LocaltaskWaitAction } from './localtask-wait.js';
|
|
12
|
+
|
|
13
|
+
/** 本模块的全部 action 类(容器按这个顺序建实例)。 */
|
|
14
|
+
export const ACTIONS: readonly (new (deps: Container) => ActionBase)[] = [
|
|
15
|
+
LocaltaskClaimAction,
|
|
16
|
+
LocaltaskPreviewAction,
|
|
17
|
+
LocaltaskWaitAction,
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
// 再导出类本身:前端 apiclient 的返回类型从这里 type-only 引用(实现即契约)。
|
|
21
|
+
export { LocaltaskClaimAction };
|
|
22
|
+
export { LocaltaskPreviewAction };
|
|
23
|
+
export { LocaltaskWaitAction };
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { ActionBase, type ActionInput, type ActionRunMeta } from '../../../runtime/action-base.js';
|
|
7
|
-
import { renderWait as _renderWait } from '
|
|
8
|
-
import { claimView } from '
|
|
7
|
+
import { renderWait as _renderWait } from '../../localtask/action-render.js';
|
|
8
|
+
import { claimView } from '../../localtask/contract-views.js';
|
|
9
9
|
const renderWait: any = _renderWait;
|
|
10
10
|
|
|
11
11
|
/** localtask.claim 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
@@ -28,8 +28,8 @@ export class LocaltaskClaimAction extends ActionBase<typeof input> {
|
|
|
28
28
|
})
|
|
29
29
|
override async run(ctx: ActionInput<this['_input']>, meta: ActionRunMeta = {}) {
|
|
30
30
|
|
|
31
|
-
const { getTask } = await (import('
|
|
32
|
-
const { parseParams } = await (import('
|
|
31
|
+
const { getTask } = await (import('../get.js') as any);
|
|
32
|
+
const { parseParams } = await (import('../params.js') as any);
|
|
33
33
|
// HTTP:不阻塞、不开浏览器(面板/脚本调用不该挂住请求,也不该弹窗)
|
|
34
34
|
const viaHttp: any = !!(meta && meta.transport === 'http');
|
|
35
35
|
const r: any = await getTask({
|
|
@@ -4,9 +4,9 @@
|
|
|
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 * as serviceNs from '
|
|
7
|
+
import * as serviceNs from '../../localtask/service.js';
|
|
8
8
|
import { badInput as _badInput } from '../../../core/errors.js';
|
|
9
|
-
import { renderPreview as _renderPreview } from '
|
|
9
|
+
import { renderPreview as _renderPreview } from '../../localtask/action-render.js';
|
|
10
10
|
const service: any = serviceNs;
|
|
11
11
|
const badInput: any = _badInput;
|
|
12
12
|
const renderPreview: any = _renderPreview;
|
|
@@ -31,8 +31,8 @@ export class LocaltaskPreviewAction extends ActionBase<typeof input> {
|
|
|
31
31
|
})
|
|
32
32
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
33
33
|
|
|
34
|
-
const { previewTaskDelivery } = await (import('../../
|
|
35
|
-
const { parseParams } = await (import('
|
|
34
|
+
const { previewTaskDelivery } = await (import('../../delivery/preview.js') as any);
|
|
35
|
+
const { parseParams } = await (import('../params.js') as any);
|
|
36
36
|
const draftText: any = ctx.text === undefined || ctx.text === null ? '' : String(ctx.text);
|
|
37
37
|
if (!draftText.trim() && (ctx.id === undefined || ctx.id === null)) {
|
|
38
38
|
throw badInput('需要 --id <任务编号>(预览库存任务)或 --text <正文>(预览草稿)');
|
|
@@ -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 { renderWait as _renderWait } from '
|
|
7
|
+
import { renderWait as _renderWait } from '../../localtask/action-render.js';
|
|
8
8
|
const renderWait: any = _renderWait;
|
|
9
9
|
|
|
10
10
|
/** localtask.wait 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
@@ -27,9 +27,9 @@ export class LocaltaskWaitAction extends ActionBase<typeof input> {
|
|
|
27
27
|
})
|
|
28
28
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
29
29
|
|
|
30
|
-
// wait 编排已迁
|
|
31
|
-
const { waitForTask } = await (import('
|
|
32
|
-
const { parseParams } = await (import('
|
|
30
|
+
// wait 编排已迁 claim/wait.ts(领取语义归 claim 域;命令名不变)
|
|
31
|
+
const { waitForTask } = await (import('../wait.js') as any);
|
|
32
|
+
const { parseParams } = await (import('../params.js') as any);
|
|
33
33
|
return waitForTask({
|
|
34
34
|
cwd: ctx.cwd,
|
|
35
35
|
timeoutSec: ctx.timeout,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// claim/get.ts —— 「领取任务」(localtask 的 get / waitgoal 语义)。
|
|
2
2
|
//
|
|
3
3
|
// 默认(项目未开启「持续 get」):**直接 get**——队列有任务立即领;
|
|
4
4
|
// 没有立即空手而回(instant,不阻塞),agent 按「暂时没活」收尾本轮。
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// 唯一合法出口是 timeout);get = 「领活」(kv-localget 的语义,项目开启持续
|
|
14
14
|
// get 后由系统负责把循环指令带进交付文本,agent 不用自己记)。
|
|
15
15
|
import { waitForTask } from './wait.js';
|
|
16
|
-
import { getLoopForCwd, type GetLoopState } from './
|
|
16
|
+
import { getLoopForCwd, type GetLoopState } from './waitgoal-config.js';
|
|
17
17
|
|
|
18
18
|
export interface GetTaskOptions {
|
|
19
19
|
cwd?: string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// claim 模块(模板形态):任务系统的核心动词——领取。
|
|
2
|
+
//
|
|
3
|
+
// 领取链在这里闭环:claim action(CLI `localtask get` / HTTP `/api/localtasks/claim`)
|
|
4
|
+
// → getTask → waitForTask(阻塞窗口)→ 交付组装(delivery 域的 host + promptplug 的 assemble)。
|
|
5
|
+
// 持续 get(waitgoal)配置也在本域:项目级开关 + 阻塞分钟数。
|
|
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 ClaimModule extends ModuleBase {
|
|
12
|
+
override readonly id = 'claim';
|
|
13
|
+
override readonly title = "任务领取(= CLI `localtask get` / HTTP claim;等待与持续 get 在此闭环)";
|
|
14
|
+
override readonly order = 21;
|
|
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 claimModule = new ClaimModule();
|
|
25
|
+
export default claimModule;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// claim/panel-escort.ts —— wait 阻塞期间的**面板随行**(从 wait.js 整体迁入)。
|
|
2
2
|
//
|
|
3
3
|
// 职责单一:这里的代码全部是「帮用户把面板窗口伺候好」——确保主面板在跑、
|
|
4
4
|
// 算深链、探测活动标签、必要时重开窗口(带节流/冷却/上限的防风暴)。
|
|
@@ -27,7 +27,7 @@ export function deepLinkUrl(key: unknown, port: unknown): string {
|
|
|
27
27
|
return `${panelOrigin(port)}/${page}`;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
// 本仓库/已安装包的 CLI 入口(src/modules/
|
|
30
|
+
// 本仓库/已安装包的 CLI 入口(src/modules/delivery/ 上三级到包根)。
|
|
31
31
|
function binCliPath(): string {
|
|
32
32
|
return fileURLToPath(new URL('../../../bin/kv.mjs', import.meta.url));
|
|
33
33
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// claim/wait.ts —— wait/get 的阻塞编排(从 localtask/service.js 整体迁入)。
|
|
2
2
|
//
|
|
3
|
-
// 边界(
|
|
3
|
+
// 边界(claim = 领取域,localtask = 队列本体):
|
|
4
4
|
// - 队列读写、唤醒注册表、presence/面板注册表都在 localtask(serve 路由与
|
|
5
5
|
// panel-guard 的一半也长在那边),这里只做**队列编排**:快路径领取 → 阻塞窗口
|
|
6
6
|
// (跨进程轮询 / goal 到点收尾 / 用户关闭)。
|
|
@@ -30,8 +30,8 @@ import {
|
|
|
30
30
|
unregisterTopicWaiter,
|
|
31
31
|
} from '../localtask/service.js';
|
|
32
32
|
import { ensureMainPanel, deepLinkUrl, escortPanel } from './panel-escort.js';
|
|
33
|
-
import { buildTaskDelivery } from '
|
|
34
|
-
import * as timegoal from '
|
|
33
|
+
import { buildTaskDelivery } from '../delivery/host.js';
|
|
34
|
+
import * as timegoal from '../goals/timegoal.js';
|
|
35
35
|
|
|
36
36
|
// 跨进程兜底轮询间隔(只定这里的读取节奏;队列写入节奏与它无关)
|
|
37
37
|
const POLL_MS = 500;
|
|
@@ -135,7 +135,7 @@ export async function waitForTask({
|
|
|
135
135
|
// 与是否显式传 --cwd 无关——本地取不到就一定来全局扫一眼,全局也没有才阻塞。
|
|
136
136
|
// (防止调用方习惯性传 cwd 导致共享池永远无人领取。)
|
|
137
137
|
// instant(localtask get 默认形态):两处快路径都没货 → 立即返回,不进阻塞窗口。
|
|
138
|
-
// 「无任务时唤起阻塞等待」是 waitgoal(项目 getLoop)的语义,见
|
|
138
|
+
// 「无任务时唤起阻塞等待」是 waitgoal(项目 getLoop)的语义,见 claim/get.ts。
|
|
139
139
|
if (instant) {
|
|
140
140
|
return { status: 'timeout', key, cwd, name, summary, timeoutMs: 0, instant: true };
|
|
141
141
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// claim/waitgoal-config.ts —— 项目级「持续 get」(waitgoal)配置的读取。
|
|
2
2
|
//
|
|
3
3
|
// 落点:repos.json 的 repo 记录字段 getLoop = { enabled, waitMinutes }。
|
|
4
4
|
// **#182 起仓库级配置只剩「开关 + 阻塞分钟」**:交付里那段「继续 get」的**文案**
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// 且交付文本带「不断调用 get,直到 get 超时」那段指令(提示词增强,文案见全局区块)。
|
|
17
17
|
//
|
|
18
18
|
// repos 在模块互依禁列里 → 动态 import(与 localtask→timegoal 探针同一惯例)。
|
|
19
|
-
import { badInput } from '
|
|
19
|
+
import { badInput } from '../../core/errors.js';
|
|
20
20
|
|
|
21
21
|
/** 阻塞窗口默认 10 分钟(上限仍受 wait 的 600s 夹制)。#230 起循环文案唯一真相在 getloop 插件类。 */
|
|
22
22
|
export const GET_LOOP_DEFAULT_MINUTES = 10; // 阻塞窗口默认 10 分钟(上限仍受 wait 的 600s 夹制)
|
|
@@ -30,7 +30,7 @@ export interface GetLoopState {
|
|
|
30
30
|
|
|
31
31
|
let reposMod: any = null;
|
|
32
32
|
async function reposStore(): Promise<any> {
|
|
33
|
-
if (!reposMod) reposMod = await import('
|
|
33
|
+
if (!reposMod) reposMod = await import('../repos/service.js');
|
|
34
34
|
return reposMod;
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// promptplug/delivery.ts —— 交付组装(assembleDelivery):seed 构造 + 三链合并 + compose。
|
|
2
2
|
//
|
|
3
|
-
// 这是「一条交付提示词怎么拼出来」的**唯一实现**(#227 重构:原样从
|
|
4
|
-
// 的 buildTaskDelivery 下半段收编进来)。宿主(
|
|
3
|
+
// 这是「一条交付提示词怎么拼出来」的**唯一实现**(#227 重构:原样从 claim/wait.ts
|
|
4
|
+
// 的 buildTaskDelivery 下半段收编进来)。宿主(delivery/host.ts)完成领域取数
|
|
5
5
|
// (附件标注 / 时间目标起表 / 组上下文 / 队列余量)后,把取好的数据装进
|
|
6
6
|
// DeliveryHostData 交到这里;本文件不再碰任何业务模块——promptplug 不 import
|
|
7
7
|
// 其他模块的边界保持不变。
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
// delivery-template 两个测试都有「与 wait.ts 同构」的最小组装)——现在它们可以
|
|
15
15
|
// 直接调 assembleDelivery。
|
|
16
16
|
import { reorderRoundsForDelivery } from '../../shared/feedback-text.js';
|
|
17
|
-
import { compose, type RenderTraceEntry, type RenderWarning, type SegmentMeta } from '
|
|
18
|
-
import { buildPlugins } from '
|
|
17
|
+
import { compose, type RenderTraceEntry, type RenderWarning, type SegmentMeta } from '../promptplug/compose.js';
|
|
18
|
+
import { buildPlugins } from '../promptplug/factory.js';
|
|
19
19
|
|
|
20
20
|
/** compose 的分段元信息(面板「这段是哪来的」的展示标签),交付组装的固定清单。 */
|
|
21
21
|
export const DELIVERY_SEGMENTS: SegmentMeta[] = [
|
|
@@ -42,7 +42,7 @@ export function flatParamsOf(params?: Record<string, string>): Record<string, un
|
|
|
42
42
|
return flat;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
/** 宿主取好的领域数据(取数细节见
|
|
45
|
+
/** 宿主取好的领域数据(取数细节见 delivery/host.ts——本文件不做任何 IO)。 */
|
|
46
46
|
export interface DeliveryHostData {
|
|
47
47
|
/** 标注后的任务行(id / text);无任务 → null(指令段也照常渲染) */
|
|
48
48
|
task: any | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// delivery/attach-resource.ts —— 附件的「资源视图模型」:关系表行 → 展示/取用信息。
|
|
2
2
|
//
|
|
3
3
|
// 资源类型只有五种(用户口径):file(含图片)/ url / task / ref / mdfile。
|
|
4
4
|
// 旧数据里 kind='image' 或没有 kind 的一律按 file 处理(向后兼容)。
|
|
@@ -338,7 +338,7 @@ export function resourceOf(row: any, lookups: ResourceLookups = {}): any {
|
|
|
338
338
|
|
|
339
339
|
// ref:文档库里的文档(v7 起 ref 是 DB 实体,没有物理路径)。
|
|
340
340
|
// 标题口径(#168):**文档标题**(正文首行的 # 标题)优先 —— 服务端在标注层
|
|
341
|
-
// (
|
|
341
|
+
// (delivery/attach.ts 的 annotateRefTitles)读库补上并覆盖 title/name;
|
|
342
342
|
// 这里先给 desc / 名字占位,读不到标题时前端回落它。
|
|
343
343
|
const info = lookups.refs && lookups.refs.get(String(meta.refId || row.targetKey || ''));
|
|
344
344
|
const refId = String(meta.refId || row.targetKey || (info && info.refId) || '');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
//
|
|
1
|
+
// delivery/delivery-text.ts —— 交付载荷的人读正文(**唯一出处**)。
|
|
2
2
|
//
|
|
3
3
|
// 谁会用到:
|
|
4
4
|
// - CLI `localtask get/wait` 的人读输出(localtask/index.js 的 renderWait)
|
|
5
|
-
// - CLI `localtask preview` 与面板「预览提示词」(
|
|
5
|
+
// - CLI `localtask preview` 与面板「预览提示词」(delivery/preview.ts)
|
|
6
6
|
//
|
|
7
7
|
// 为什么单独抽出来:预览的全部价值在于「所见即所得」——如果面板自己拼一遍排版,
|
|
8
8
|
// 迟早与 CLI 漂移,用户看到的就不是 agent 收到的那一份。同一份代码 = 同一份文本。
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// delivery/host.ts —— 交付宿主:领域取数 → Supply → promptplug 的 assembleDelivery。
|
|
2
2
|
//
|
|
3
3
|
// #227 重构:从 wait.ts 拆出。wait.ts 只剩阻塞编排(跨进程轮询 / goal 到点收尾 /
|
|
4
4
|
// 面板随行),本文件专管「交付一条任务时要把哪些领域数据取齐」:
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
import { formatDuration, formatGoalTiming } from '../../core/instruction-template.js';
|
|
21
21
|
import { parseFrontmatter } from '../../shared/frontmatter.js';
|
|
22
22
|
import { getSettings, isGlobalKey, pendingQueueInfo } from '../localtask/service.js';
|
|
23
|
-
import { assembleDelivery, type AssembledDelivery } from '
|
|
23
|
+
import { assembleDelivery, type AssembledDelivery } from './assemble.js';
|
|
24
24
|
import { annotateTaskDelivery, attachTemplateCtx } from './attach.js';
|
|
25
25
|
import { readGroupContext } from './groupctx.js';
|
|
26
|
-
import { ensureTaskGoal, previewTaskGoal } from '
|
|
27
|
-
import * as timegoal from '
|
|
26
|
+
import { ensureTaskGoal, previewTaskGoal } from '../goals/taskgoal.js';
|
|
27
|
+
import * as timegoal from '../goals/timegoal.js';
|
|
28
28
|
|
|
29
29
|
export interface DeliveryOptions {
|
|
30
30
|
source?: string;
|
|
@@ -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, type GetLoopState } from '
|
|
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,7 +40,7 @@ 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 }));
|
|
@@ -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 固化
|