docs(release): seal and deliver task agreement 1.25 with retained production state
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# 研究任务看板
|
||||
|
||||
这是 Agent Workbench 自带的小型示例项目,用来体验读取文件、提出修改、审查差异和执行验证。
|
||||
|
||||
## 运行
|
||||
使用 `node --test` 执行测试。项目不需要安装依赖。
|
||||
|
||||
## 目标
|
||||
把研究记录整理为可搜索的任务目录,每个条目具有标题、状态和标签。
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"research-board-example","private":true,"type":"module","scripts":{"test":"node --test"}}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
export const catalog = [
|
||||
{ id: 'agent-loop', title: '工具执行循环', status: 'in_progress', tags: ['agent', 'tools'] },
|
||||
{ id: 'session-recovery', title: '会话恢复', status: 'planned', tags: ['session', 'recovery'] },
|
||||
{ id: 'change-review', title: '改动审查', status: 'done', tags: ['editor', 'diff'] },
|
||||
];
|
||||
|
||||
export function searchCatalog(query) {
|
||||
const normalized = query.trim().toLocaleLowerCase();
|
||||
const keywords = normalized ? normalized.split(/\s+/) : [];
|
||||
|
||||
return catalog.filter(item => {
|
||||
const searchableText = `${item.title} ${item.tags.join(' ')}`.toLocaleLowerCase();
|
||||
return keywords.every(keyword => searchableText.includes(keyword));
|
||||
});
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { catalog, searchCatalog } from '../src/catalog.js';
|
||||
|
||||
test('标题与标签均可检索,忽略大小写与首尾空白', () => {
|
||||
assert.deepEqual(searchCatalog('会话').map(item => item.id), ['session-recovery']);
|
||||
assert.deepEqual(searchCatalog(' TOOLs ').map(item => item.id), ['agent-loop']);
|
||||
});
|
||||
|
||||
test('多关键词搜索不受词序影响,支持跨标题与标签匹配', () => {
|
||||
for (const query of ['agent tools', 'tools agent', ' TOOLs \t agent\n', 'tools 工具']) {
|
||||
assert.deepEqual(searchCatalog(query).map(item => item.id), ['agent-loop']);
|
||||
}
|
||||
});
|
||||
|
||||
test('所有关键词都必须匹配同一条目', () => {
|
||||
assert.deepEqual(searchCatalog('agent recovery'), []);
|
||||
assert.deepEqual(searchCatalog('不存在的关键词'), []);
|
||||
});
|
||||
|
||||
test('空查询与纯空白查询返回全部条目', () => {
|
||||
assert.deepEqual(searchCatalog(''), catalog);
|
||||
assert.deepEqual(searchCatalog(' \t\n '), catalog);
|
||||
});
|
||||
Reference in New Issue
Block a user