coremind-templates 2.0.0 → 2.1.0
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/LICENSE +21 -0
- package/README.md +2 -2
- package/bin/install-skill.mjs +292 -0
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +8 -1
- package/dist/skills.js.map +1 -1
- package/package.json +6 -2
- package/templates/general/document-assistant/README.en.md +6 -4
- package/templates/general/document-assistant/README.md +6 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Eclipseic1848
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -5,11 +5,11 @@ CoreMind 的场景模板、项目脚手架和模板索引。模板覆盖基础
|
|
|
5
5
|
模板用于快速开始,不代表生产环境的业务规则。创建项目后,请根据真实业务补充权限、失败路径、质量门禁和评测样例。
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npx coremind-cli@2.
|
|
8
|
+
npx coremind-cli@2.1.0 create my-agent
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
模板开发规范见[模块文档](https://github.com/Eclipseic1848/CoreMind/tree/main/docs/modules/scaffold-coremind-projects)。
|
|
12
12
|
|
|
13
|
-
2.0.0 的 `document-assistant`
|
|
13
|
+
2.0.0 的 `document-assistant` 是参考示例和组合回归,用于将知识引用、已确认记忆、Skill 和摘要写入放进一个项目,可选按本体检查发布条件。支持 CLI、TypeScript 和 Python 同步/异步。[中文使用说明](templates/general/document-assistant/README.md) · [English](templates/general/document-assistant/README.en.md)
|
|
14
14
|
|
|
15
15
|
许可证:[MIT](https://github.com/Eclipseic1848/CoreMind/blob/main/LICENSE)
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { execFile } from "node:child_process";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { constants } from "node:fs";
|
|
5
|
+
import {
|
|
6
|
+
copyFile,
|
|
7
|
+
lstat,
|
|
8
|
+
mkdir,
|
|
9
|
+
mkdtemp,
|
|
10
|
+
readFile,
|
|
11
|
+
realpath,
|
|
12
|
+
rename,
|
|
13
|
+
rm,
|
|
14
|
+
writeFile,
|
|
15
|
+
} from "node:fs/promises";
|
|
16
|
+
import { tmpdir } from "node:os";
|
|
17
|
+
import path from "node:path";
|
|
18
|
+
import { pathToFileURL } from "node:url";
|
|
19
|
+
import { promisify } from "node:util";
|
|
20
|
+
import { findSkill } from "coremind-templates";
|
|
21
|
+
import { readStandardSkillPackage } from "coremind-templates/internal";
|
|
22
|
+
|
|
23
|
+
const run = promisify(execFile);
|
|
24
|
+
const pinnedSource = /^[A-Za-z0-9][A-Za-z0-9-]*\/[A-Za-z0-9_.-]+@[a-f0-9]{40}$/u;
|
|
25
|
+
const skillPath = /^(?:[A-Za-z0-9_-][A-Za-z0-9_.-]*\/)*SKILL\.md$/u;
|
|
26
|
+
const lockName = "skills-lock.json";
|
|
27
|
+
|
|
28
|
+
export function checkId(id) {
|
|
29
|
+
if (
|
|
30
|
+
!/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(id) ||
|
|
31
|
+
id.length > 64 ||
|
|
32
|
+
/^(?:con|prn|aux|nul|com[0-9]|lpt[0-9])$/u.test(id) ||
|
|
33
|
+
findSkill(id)
|
|
34
|
+
) {
|
|
35
|
+
throw new Error(`Skill ID 无效或与内置 Skill 冲突:${id}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function readPinnedLock(bytes, id) {
|
|
40
|
+
const lock = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
41
|
+
const entries = Object.entries(lock?.skills ?? {});
|
|
42
|
+
const [[name, entry] = []] = entries;
|
|
43
|
+
if (
|
|
44
|
+
lock?.version !== 2 ||
|
|
45
|
+
entries.length !== 1 ||
|
|
46
|
+
name !== id ||
|
|
47
|
+
entry?.sourceType !== "github" ||
|
|
48
|
+
typeof entry.source !== "string" ||
|
|
49
|
+
typeof entry.commit !== "string" ||
|
|
50
|
+
!pinnedSource.test(`${entry.source}@${entry.commit}`) ||
|
|
51
|
+
entry.ref !== entry.commit ||
|
|
52
|
+
typeof entry.computedHash !== "string" ||
|
|
53
|
+
!/^[a-f0-9]{64}$/u.test(entry.computedHash) ||
|
|
54
|
+
typeof entry.skillPath !== "string" ||
|
|
55
|
+
!skillPath.test(entry.skillPath) ||
|
|
56
|
+
entry.sourceUrl !== undefined ||
|
|
57
|
+
entry.skillName !== undefined ||
|
|
58
|
+
entry.installMode !== "copy"
|
|
59
|
+
) {
|
|
60
|
+
throw new Error(`内容锁须只包含 ${id} 的公开 GitHub 完整提交与内容摘要`);
|
|
61
|
+
}
|
|
62
|
+
return entry;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function readInstallFiles(sourceDir, id) {
|
|
66
|
+
checkId(id);
|
|
67
|
+
const { skill, source, manifest } = await readStandardSkillPackage(sourceDir, id);
|
|
68
|
+
if (!manifest) throw new Error(`待安装的 Skill 缺少 coremind.skill.json:${id}`);
|
|
69
|
+
return {
|
|
70
|
+
version: skill.packageVersion,
|
|
71
|
+
files: new Map([
|
|
72
|
+
["SKILL.md", source],
|
|
73
|
+
["coremind.skill.json", manifest],
|
|
74
|
+
...skill.resources.map(({ path, content }) => [path, content]),
|
|
75
|
+
]),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function verifyGitTree(tree, sourcePath, files) {
|
|
80
|
+
const folder = path.posix.dirname(sourcePath);
|
|
81
|
+
const entries = new Map(
|
|
82
|
+
tree
|
|
83
|
+
.split("\0")
|
|
84
|
+
.filter(Boolean)
|
|
85
|
+
.map((line) => {
|
|
86
|
+
const tab = line.indexOf("\t");
|
|
87
|
+
return [line.slice(tab + 1), line.slice(0, tab)];
|
|
88
|
+
}),
|
|
89
|
+
);
|
|
90
|
+
for (const [relative, content] of files) {
|
|
91
|
+
const fullPath = path.posix.join(folder, relative);
|
|
92
|
+
const hash = createHash("sha1")
|
|
93
|
+
.update(`blob ${Buffer.byteLength(content, "utf8")}\0`, "utf8")
|
|
94
|
+
.update(content, "utf8")
|
|
95
|
+
.digest("hex");
|
|
96
|
+
const entry = entries.get(fullPath);
|
|
97
|
+
if (entry !== `100644 blob ${hash}` && entry !== `100755 blob ${hash}`) {
|
|
98
|
+
throw new Error(`固定提交中的文件类型或原始字节不匹配:${fullPath}`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async function localDirectory(directory) {
|
|
104
|
+
if (!(await lstat(directory)).isDirectory()) {
|
|
105
|
+
throw new Error(`必须是本地普通目录:${directory}`);
|
|
106
|
+
}
|
|
107
|
+
return realpath(directory);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function replaceSkillPackage(configDir, id, files) {
|
|
111
|
+
checkId(id);
|
|
112
|
+
const root = path.join(await localDirectory(configDir), "skills");
|
|
113
|
+
await mkdir(root, { recursive: true });
|
|
114
|
+
await localDirectory(root);
|
|
115
|
+
const target = path.join(root, id);
|
|
116
|
+
const stage = path.join(root, `.${id}.install`);
|
|
117
|
+
await mkdir(stage);
|
|
118
|
+
const next = path.join(stage, "next");
|
|
119
|
+
const previous = path.join(stage, "previous");
|
|
120
|
+
let keepStage = false;
|
|
121
|
+
try {
|
|
122
|
+
for (const [relative, content] of files) {
|
|
123
|
+
const file = path.join(next, relative);
|
|
124
|
+
await mkdir(path.dirname(file), { recursive: true });
|
|
125
|
+
await writeFile(file, content, { encoding: "utf8", flag: "wx" });
|
|
126
|
+
}
|
|
127
|
+
const current = await lstat(target).catch((error) => {
|
|
128
|
+
if (error.code !== "ENOENT") throw error;
|
|
129
|
+
});
|
|
130
|
+
if (current && !current.isDirectory()) throw new Error(`Skill 目标须为普通目录:${target}`);
|
|
131
|
+
if (current) await rename(target, previous);
|
|
132
|
+
try {
|
|
133
|
+
await rename(next, target);
|
|
134
|
+
} catch (error) {
|
|
135
|
+
if (current) {
|
|
136
|
+
try {
|
|
137
|
+
await rename(previous, target);
|
|
138
|
+
} catch (rollbackError) {
|
|
139
|
+
keepStage = true;
|
|
140
|
+
throw new AggregateError([error, rollbackError], `回退失败,旧版保存在 ${previous}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
145
|
+
} finally {
|
|
146
|
+
if (!keepStage) await rm(stage, { recursive: true, force: true });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export async function installSkill(configDir, id, packageJson, lockFile, source, runChild = run) {
|
|
151
|
+
checkId(id);
|
|
152
|
+
if (source !== undefined && !pinnedSource.test(source)) {
|
|
153
|
+
throw new Error("技能源须使用 owner/repo@完整 Git 提交 SHA");
|
|
154
|
+
}
|
|
155
|
+
const cliPackage = JSON.parse(await readFile(packageJson, "utf8"));
|
|
156
|
+
if (cliPackage.name !== "skills" || cliPackage.version !== "1.9.0") {
|
|
157
|
+
throw new Error("安装需要 Skills CLI 1.9.0");
|
|
158
|
+
}
|
|
159
|
+
const cli = path.resolve(path.dirname(packageJson), "bin/cli.mjs");
|
|
160
|
+
const config = await localDirectory(configDir);
|
|
161
|
+
const lock = path.join(await realpath(path.dirname(lockFile)), path.basename(lockFile));
|
|
162
|
+
const skillsRelative = path.relative(path.join(config, "skills"), lock);
|
|
163
|
+
if (
|
|
164
|
+
skillsRelative !== ".." &&
|
|
165
|
+
!skillsRelative.startsWith(`..${path.sep}`) &&
|
|
166
|
+
!path.isAbsolute(skillsRelative)
|
|
167
|
+
) {
|
|
168
|
+
throw new Error("内容锁应放在项目 skills 目录之外");
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const stage = await mkdtemp(path.join(tmpdir(), "coremind-skill-"));
|
|
172
|
+
const env = {
|
|
173
|
+
...process.env,
|
|
174
|
+
DISABLE_TELEMETRY: "1",
|
|
175
|
+
NODE_DISABLE_COMPILE_CACHE: "1",
|
|
176
|
+
XDG_STATE_HOME: stage,
|
|
177
|
+
GH_CONFIG_DIR: stage,
|
|
178
|
+
GH_PROMPT_DISABLED: "1",
|
|
179
|
+
GH_NO_UPDATE_NOTIFIER: "1",
|
|
180
|
+
GH_TOKEN: undefined,
|
|
181
|
+
GITHUB_TOKEN: undefined,
|
|
182
|
+
GIT_CONFIG_NOSYSTEM: "1",
|
|
183
|
+
GIT_CONFIG_GLOBAL: path.join(stage, "gitconfig"),
|
|
184
|
+
GIT_CONFIG_COUNT: "0",
|
|
185
|
+
GIT_CONFIG_PARAMETERS: undefined,
|
|
186
|
+
GIT_DIR: undefined,
|
|
187
|
+
GIT_COMMON_DIR: undefined,
|
|
188
|
+
GIT_WORK_TREE: undefined,
|
|
189
|
+
GIT_INDEX_FILE: undefined,
|
|
190
|
+
GIT_OBJECT_DIRECTORY: undefined,
|
|
191
|
+
GIT_ALTERNATE_OBJECT_DIRECTORIES: undefined,
|
|
192
|
+
GIT_TEMPLATE_DIR: undefined,
|
|
193
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
194
|
+
GIT_ASKPASS: undefined,
|
|
195
|
+
GIT_ALLOW_PROTOCOL: "https",
|
|
196
|
+
TEMP: stage,
|
|
197
|
+
TMP: stage,
|
|
198
|
+
TMPDIR: stage,
|
|
199
|
+
};
|
|
200
|
+
try {
|
|
201
|
+
const frozen = path.join(stage, "frozen");
|
|
202
|
+
await mkdir(frozen);
|
|
203
|
+
const options = { cwd: frozen, env, timeout: 120_000, maxBuffer: 8 * 1024 * 1024 };
|
|
204
|
+
let bytes;
|
|
205
|
+
if (source) {
|
|
206
|
+
const seed = path.join(stage, "seed");
|
|
207
|
+
await mkdir(seed);
|
|
208
|
+
await runChild(
|
|
209
|
+
process.execPath,
|
|
210
|
+
[cli, "add", source, "--skill", id, "--agent", "codex", "--copy", "--yes"],
|
|
211
|
+
{
|
|
212
|
+
...options,
|
|
213
|
+
cwd: seed,
|
|
214
|
+
},
|
|
215
|
+
);
|
|
216
|
+
bytes = await readFile(path.join(seed, lockName));
|
|
217
|
+
} else {
|
|
218
|
+
bytes = await readFile(lock);
|
|
219
|
+
}
|
|
220
|
+
const entry = readPinnedLock(bytes, id);
|
|
221
|
+
if (source && source !== `${entry.source}@${entry.commit}`) {
|
|
222
|
+
throw new Error("内容锁的技能源与请求不一致");
|
|
223
|
+
}
|
|
224
|
+
const frozenLock = path.join(frozen, lockName);
|
|
225
|
+
await writeFile(frozenLock, bytes);
|
|
226
|
+
await runChild(
|
|
227
|
+
process.execPath,
|
|
228
|
+
[cli, "install", "--frozen-lockfile", "--agent", "codex"],
|
|
229
|
+
options,
|
|
230
|
+
);
|
|
231
|
+
if (!(await readFile(frozenLock)).equals(bytes)) throw new Error("冻结安装改写了内容锁");
|
|
232
|
+
const { version, files } = await readInstallFiles(
|
|
233
|
+
path.join(frozen, ".agents", "skills", id),
|
|
234
|
+
id,
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
// 上游复制会展开符号链接,核对固定提交的树以保留源文件类型和原始字节约束。
|
|
238
|
+
const bareRepo = path.join(stage, "source.git");
|
|
239
|
+
await runChild("git", ["init", "--bare", "--quiet", bareRepo], options);
|
|
240
|
+
const git = (args) => runChild("git", ["--git-dir", bareRepo, ...args], options);
|
|
241
|
+
await git([
|
|
242
|
+
"fetch",
|
|
243
|
+
"--quiet",
|
|
244
|
+
"--no-tags",
|
|
245
|
+
"--depth=1",
|
|
246
|
+
`https://github.com/${entry.source}.git`,
|
|
247
|
+
entry.commit,
|
|
248
|
+
]);
|
|
249
|
+
const folder = path.posix.dirname(entry.skillPath);
|
|
250
|
+
const { stdout } = await git(["ls-tree", "-r", "-z", entry.commit, "--", folder]);
|
|
251
|
+
verifyGitTree(stdout, entry.skillPath, files);
|
|
252
|
+
|
|
253
|
+
if (source) await copyFile(frozenLock, lock, constants.COPYFILE_EXCL);
|
|
254
|
+
await replaceSkillPackage(config, id, files);
|
|
255
|
+
return {
|
|
256
|
+
id,
|
|
257
|
+
version,
|
|
258
|
+
commit: entry.commit,
|
|
259
|
+
lockSha256: createHash("sha256").update(bytes).digest("hex"),
|
|
260
|
+
};
|
|
261
|
+
} finally {
|
|
262
|
+
await rm(stage, { recursive: true, force: true });
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export async function runSkillInstaller(args) {
|
|
267
|
+
if (args.length === 1 && args[0] === "--help") {
|
|
268
|
+
console.log(
|
|
269
|
+
"用法:coremind-skill-install <配置目录> <Skill ID> <Skills CLI package.json> <锁文件> [owner/repo@完整提交]",
|
|
270
|
+
);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
if (args.length < 4 || args.length > 5) {
|
|
274
|
+
process.stderr.write(
|
|
275
|
+
"用法:coremind-skill-install <配置目录> <Skill ID> <Skills CLI package.json> <锁文件> [owner/repo@完整提交]\n",
|
|
276
|
+
);
|
|
277
|
+
process.exitCode = 1;
|
|
278
|
+
} else {
|
|
279
|
+
try {
|
|
280
|
+
const { id, version, commit, lockSha256 } = await installSkill(...args);
|
|
281
|
+
process.stdout.write(`已安装 ${id} ${version} @ ${commit}\n内容锁 SHA-256 ${lockSha256}\n`);
|
|
282
|
+
} catch (error) {
|
|
283
|
+
process.stderr.write(`${error.message}\n`);
|
|
284
|
+
process.exitCode = 1;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const entryPoint = process.argv[1] && (await realpath(process.argv[1]).catch(() => undefined));
|
|
290
|
+
if (entryPoint && pathToFileURL(entryPoint).href === import.meta.url) {
|
|
291
|
+
await runSkillInstaller(process.argv.slice(2));
|
|
292
|
+
}
|
package/dist/skills.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAKA,0CAA0C;AAC1C,MAAM,WAAW,SAAS;IACxB,iBAAiB;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU;IACV,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAKA,0CAA0C;AAC1C,MAAM,WAAW,SAAS;IACxB,iBAAiB;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU;IACV,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;CACjB;AAyBD,8BAA8B;AAC9B,eAAO,MAAM,MAAM,EAAE,SAAS,EAI7B,CAAC;AAEF,gBAAgB;AAChB,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAE3D;AAED,sCAAsC;AACtC,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAStF;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAgBnF"}
|
package/dist/skills.js
CHANGED
|
@@ -8,11 +8,18 @@ function skillDir(id) {
|
|
|
8
8
|
return path.join(skillsRoot, id);
|
|
9
9
|
}
|
|
10
10
|
function loadSkill(id, name, description) {
|
|
11
|
+
let content;
|
|
11
12
|
return {
|
|
12
13
|
id,
|
|
13
14
|
name,
|
|
14
15
|
description,
|
|
15
|
-
content
|
|
16
|
+
get content() {
|
|
17
|
+
content ??= readFileSync(path.join(skillDir(id), "README.md"), "utf8");
|
|
18
|
+
return content;
|
|
19
|
+
},
|
|
20
|
+
set content(value) {
|
|
21
|
+
content = value;
|
|
22
|
+
},
|
|
16
23
|
};
|
|
17
24
|
}
|
|
18
25
|
/** 内置技能清单(首批 3 个,对应模板能力提炼) */
|
package/dist/skills.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAazC,6BAA6B;AAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAA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,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YAAE,SAAS;QACnC,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,CACnF,GAAG,EAAE,CAAC,IAAI,CACX,CAAC;QACF,IAAI,OAAO;YAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coremind-templates",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "CoreMind 模板库:场景模板与元数据索引",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"main": "./dist/index.js",
|
|
17
17
|
"types": "./dist/index.d.ts",
|
|
18
|
+
"bin": {
|
|
19
|
+
"coremind-skill-install": "./bin/install-skill.mjs"
|
|
20
|
+
},
|
|
18
21
|
"exports": {
|
|
19
22
|
".": {
|
|
20
23
|
"types": "./dist/index.d.ts",
|
|
@@ -26,6 +29,7 @@
|
|
|
26
29
|
}
|
|
27
30
|
},
|
|
28
31
|
"files": [
|
|
32
|
+
"bin",
|
|
29
33
|
"dist",
|
|
30
34
|
"templates",
|
|
31
35
|
"skills",
|
|
@@ -40,6 +44,6 @@
|
|
|
40
44
|
"test": "vitest run"
|
|
41
45
|
},
|
|
42
46
|
"dependencies": {
|
|
43
|
-
"coremind-config": "2.
|
|
47
|
+
"coremind-config": "2.1.0"
|
|
44
48
|
}
|
|
45
49
|
}
|
|
@@ -4,15 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
Compare document versions, cite each change, and format the summary using the reader's confirmed preference. The application owner supplies source records, the reader's access scope, and a memory bank. An optional ontology checks whether a business action is eligible.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Use this reference example to exercise composition across sessions. A business project can start with just the Runtime and select any one capability. [Start in your own project](https://eclipseic1848.github.io/CoreMind/en/guide/06-capability-construction.html)
|
|
8
|
+
|
|
9
|
+
## Create the example project
|
|
8
10
|
|
|
9
11
|
Use the CLI containing this template, matching Node and Python SDKs, and Node.js 22.19 or later. After the public release, install the following versions. During candidate qualification, install the matching tarballs and wheel.
|
|
10
12
|
|
|
11
13
|
```sh
|
|
12
|
-
npx coremind-cli@2.
|
|
14
|
+
npx coremind-cli@2.1.0 create archive-desk --template document-assistant --language typescript --provider deepseek
|
|
13
15
|
cd archive-desk
|
|
14
|
-
npm install --save-exact coremind-ai@2.
|
|
15
|
-
python -m pip install coremind-ai==2.
|
|
16
|
+
npm install --save-exact coremind-ai@2.1.0 coremind-cli@2.1.0
|
|
17
|
+
python -m pip install coremind-ai==2.1.0
|
|
16
18
|
```
|
|
17
19
|
|
|
18
20
|
## Connect the services
|
|
@@ -4,15 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
根据可见的资料版本生成带出处的摘要,按已确认的偏好选择表格或清单。业务方提供原文、身份对应的阅读范围和记忆库。需要核对发布条件时,可以接入自己的本体模型。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
这是五项能力按需组合的参考示例,也用于跨会话回归。业务项目可直接从 Runtime 起步,单独选择任一能力。[空白项目接入指南](https://eclipseic1848.github.io/CoreMind/guide/06-capability-construction.html)
|
|
8
|
+
|
|
9
|
+
## 创建示例项目
|
|
8
10
|
|
|
9
11
|
使用包含此模板的 CoreMind CLI 和同版本的 Node、Python SDK。Node.js 需要 22.19 或更高版本。正式发布后的安装命令如下;候选验收时将安装来源换为同一候选的 tarball 与 wheel。
|
|
10
12
|
|
|
11
13
|
```sh
|
|
12
|
-
npx coremind-cli@2.
|
|
14
|
+
npx coremind-cli@2.1.0 create archive-desk --template document-assistant --language typescript --provider deepseek
|
|
13
15
|
cd archive-desk
|
|
14
|
-
npm install --save-exact coremind-ai@2.
|
|
15
|
-
python -m pip install coremind-ai==2.
|
|
16
|
+
npm install --save-exact coremind-ai@2.1.0 coremind-cli@2.1.0
|
|
17
|
+
python -m pip install coremind-ai==2.1.0
|
|
16
18
|
```
|
|
17
19
|
|
|
18
20
|
## 连接业务资料与记忆
|