exomind 0.11.0 → 0.12.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/dist/cli.js CHANGED
@@ -3119,7 +3119,7 @@ var {
3119
3119
  // package.json
3120
3120
  var package_default = {
3121
3121
  name: "exomind",
3122
- version: "0.11.0",
3122
+ version: "0.12.0",
3123
3123
  description: "ExoMind \u8DE8\u5E73\u53F0\u547D\u4EE4\u884C\u5BA2\u6237\u7AEF \u2014 \u901A\u8FC7 REST \u4E0E ExoMind \u77E5\u8BC6\u5E93\u4EA4\u4E92(ingest/query/search/review),\u66FF\u4EE3 Windows \u4E0D\u53EF\u7528\u7684 MCP \u5BA2\u6237\u7AEF\u3002",
3124
3124
  bin: {
3125
3125
  exomind: "dist/cli.js"
@@ -3258,6 +3258,9 @@ var ApiClient = class {
3258
3258
  post(p, body, opts) {
3259
3259
  return this.request("POST", p, { ...opts, body });
3260
3260
  }
3261
+ del(p, opts) {
3262
+ return this.request("DELETE", p, opts);
3263
+ }
3261
3264
  };
3262
3265
 
3263
3266
  // src/config.ts
@@ -4688,6 +4691,98 @@ async function whoami(client) {
4688
4691
  );
4689
4692
  }
4690
4693
 
4694
+ // src/commands/delete.ts
4695
+ var readline3 = __toESM(require("readline/promises"));
4696
+ function encPath(p) {
4697
+ return p.split("/").map(encodeURIComponent).join("/");
4698
+ }
4699
+ async function resolvePage(client, page) {
4700
+ const dirs = ["entities", "concepts", "summaries", "synthesis", "qa", "raw/articles"];
4701
+ for (const d of dirs) {
4702
+ const cand = `${d}/${page}.md`;
4703
+ try {
4704
+ await client.get(`/pages/${encPath(cand)}`, void 0, { timeoutMs: 15e3 });
4705
+ return cand;
4706
+ } catch {
4707
+ }
4708
+ }
4709
+ throw new Error(
4710
+ `\u9875\u9762\u4E0D\u5B58\u5728: ${page}(\u5148 exomind search \u6216 exomind list \u5B9A\u4F4D;\u94FE\u63A5\u6846\u5165\u5E93\u7684\u539F\u6587\u5728 raw/articles/ \u4E0B)`
4711
+ );
4712
+ }
4713
+ async function deletePage(client, opts, args) {
4714
+ const page = args.join(" ").trim();
4715
+ if (!page) throw new Error("\u8BF7\u63D0\u4F9B\u9875\u9762\u8DEF\u5F84\u6216\u5B9E\u4F53\u540D: exomind delete entities/Redis.md");
4716
+ let target = page;
4717
+ if (!page.includes("/") && !page.endsWith(".md")) {
4718
+ target = await resolvePage(client, page);
4719
+ }
4720
+ let title = "";
4721
+ try {
4722
+ const detail = await client.get(`/pages/${encPath(target)}`, void 0, {
4723
+ timeoutMs: 15e3
4724
+ });
4725
+ title = String(detail?.title ?? "");
4726
+ } catch {
4727
+ }
4728
+ if (!opts.yes && !isJsonMode()) {
4729
+ const rl = readline3.createInterface({ input: process.stdin, output: process.stdout });
4730
+ const ans = await rl.question(
4731
+ `\u5220\u9664 ${target}${title ? `\uFF08${title}\uFF09` : ""}\uFF1F\u5165\u670D\u52A1\u7AEF\u56DE\u6536\u7AD9\u3001\u53EF\u6062\u590D [y/N] `
4732
+ );
4733
+ rl.close();
4734
+ if (ans.trim().toLowerCase() !== "y") {
4735
+ console.log("\u5DF2\u53D6\u6D88");
4736
+ return;
4737
+ }
4738
+ }
4739
+ const r = await client.del(`/pages/${encPath(target)}`);
4740
+ output(r, () => {
4741
+ console.log(ok(`\u5DF2\u5220\u9664: ${r.path}`));
4742
+ if (r.trash_path) console.log(dim(`\u56DE\u6536\u7AD9: ${r.trash_path} \u2014 exomind trash \u67E5\u770B / trash restore \u6062\u590D`));
4743
+ });
4744
+ }
4745
+
4746
+ // src/commands/trash.ts
4747
+ async function trash(client, opts, args) {
4748
+ const action = args[0];
4749
+ switch (action) {
4750
+ case "list":
4751
+ return doList2(client, opts);
4752
+ case "restore":
4753
+ return doRestore(client, args[1]);
4754
+ default:
4755
+ throw new Error(
4756
+ `\u672A\u77E5 trash \u5B50\u547D\u4EE4: ${action ?? "(\u7A7A)"}\u3002\u53EF\u7528: list \u5217\u8868 / restore <\u56DE\u6536\u7AD9\u8DEF\u5F84> \u6062\u590D`
4757
+ );
4758
+ }
4759
+ }
4760
+ async function doList2(client, opts) {
4761
+ const r = await client.get("/trash", { page: opts.page ?? 1, page_size: 50 });
4762
+ output(r, () => {
4763
+ const items = r.items ?? [];
4764
+ if (!items.length) {
4765
+ console.log("\uFF08\u56DE\u6536\u7AD9\u4E3A\u7A7A\uFF09");
4766
+ return;
4767
+ }
4768
+ for (const it of items) {
4769
+ console.log(
4770
+ `${cyan(it.trash_path)}
4771
+ ${dim(`\u539F\u8DEF\u5F84: ${it.path ?? ""} \xB7 \u5220\u9664: ${it.deleted_at ?? ""}`)}${it.restorable ? "" : yellow(" (\u539F\u8DEF\u5F84\u88AB\u5360,\u6062\u590D\u4F1A\u51B2\u7A81)")}`
4772
+ );
4773
+ }
4774
+ console.log(
4775
+ dim(`\u5171 ${r.total} \u6761 \xB7 \u7B2C ${r.page} \u9875 \u2014 \u6062\u590D: exomind trash restore <\u56DE\u6536\u7AD9\u8DEF\u5F84>`)
4776
+ );
4777
+ });
4778
+ }
4779
+ async function doRestore(client, trashPath) {
4780
+ const p = (trashPath ?? "").trim();
4781
+ if (!p) throw new Error('\u8BF7\u63D0\u4F9B\u56DE\u6536\u7AD9\u8DEF\u5F84: exomind trash restore ".trash/202609/entities/Redis.md"');
4782
+ const r = await client.post("/trash/restore", { trash_path: p });
4783
+ output(r, () => console.log(ok(`\u5DF2\u6062\u590D \u2192 ${r.path}`)));
4784
+ }
4785
+
4691
4786
  // src/commands/install.ts
4692
4787
  var fs7 = __toESM(require("fs"));
4693
4788
  var path7 = __toESM(require("path"));
@@ -5148,6 +5243,10 @@ program2.command("ingest [content...]").description("\u5BFC\u5165\u77E5\u8BC6: \
5148
5243
  (v) => parseInt(v, 10) || 3,
5149
5244
  3
5150
5245
  ).action(run(ingest));
5246
+ program2.command("delete <page...>").description(
5247
+ "\u5220\u9664\u77E5\u8BC6\u9875(\u8F6F\u5220\u9664:\u5165\u670D\u52A1\u7AEF\u56DE\u6536\u7AD9,\u53EF\u6062\u590D)\u3002\u652F\u6301\u8DEF\u5F84(entities/Redis.md)\u6216\u88F8\u5B9E\u4F53\u540D(Redis)"
5248
+ ).option("-y, --yes", "\u8DF3\u8FC7\u786E\u8BA4").action(run((client, opts, args) => deletePage(client, opts, args)));
5249
+ program2.command("trash <action> [target...]").description("\u56DE\u6536\u7AD9: list \u5217\u8868 / restore <\u56DE\u6536\u7AD9\u8DEF\u5F84> \u6062\u590D").option("-p, --page <n>", "\u9875\u7801(list)", "1").action(run((client, opts, args) => trash(client, opts, args)));
5151
5250
  program2.command("query [question...]").description("LLM \u95EE\u7B54").option("--tag <tag>", "\u6807\u7B7E\u8FC7\u6EE4(\u53EF\u91CD\u590D)", collect, []).option("--model <name>", "\u6A21\u578B").action(run(query));
5152
5251
  program2.command("search [keyword...]").description("\u5168\u6587/\u6DF7\u5408/\u7CBE\u6392\u641C\u7D22").option("-l, --limit <n>", "\u8FD4\u56DE\u6570\u91CF", "10").option("--rerank", "LLM \u7CBE\u6392(\u66F4\u51C6\u4F46\u66F4\u6162)").option("--hybrid", "\u6DF7\u5408\u641C\u7D22(BM25+\u8BED\u4E49)").action(run(search));
5153
5252
  program2.command("entity [name...]").description("\u5B9E\u4F53\u8BE6\u60C5 + \u5173\u7CFB").action(run(entity));