exomind 0.11.0 → 0.13.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.13.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,133 @@ 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)}`, { timeoutMs: 6e4 });
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/page_path.ts
4747
+ function encPath2(p) {
4748
+ return p.split("/").map(encodeURIComponent).join("/");
4749
+ }
4750
+ async function resolvePagePath(client, page) {
4751
+ const dirs = ["entities", "concepts", "summaries", "synthesis", "qa", "raw/articles"];
4752
+ for (const d of dirs) {
4753
+ const cand = `${d}/${page}.md`;
4754
+ try {
4755
+ await client.get(`/pages/${encPath2(cand)}`, void 0, { timeoutMs: 15e3 });
4756
+ return cand;
4757
+ } catch {
4758
+ }
4759
+ }
4760
+ throw new Error(`\u9875\u9762\u4E0D\u5B58\u5728: ${page}(\u5148 exomind search \u5B9A\u4F4D)`);
4761
+ }
4762
+
4763
+ // src/commands/get.ts
4764
+ async function get(client, _opts, args) {
4765
+ const page = args.join(" ").trim();
4766
+ if (!page) throw new Error("\u8BF7\u63D0\u4F9B\u9875\u9762\u8DEF\u5F84\u6216\u5B9E\u4F53\u540D: exomind get entities/Redis.md");
4767
+ let target = page;
4768
+ if (!page.includes("/") && !page.endsWith(".md")) {
4769
+ target = await resolvePagePath(client, page);
4770
+ }
4771
+ const r = await client.get(`/pages/${encPath2(target)}`, void 0, { timeoutMs: 3e4 });
4772
+ output(r, () => {
4773
+ console.log(`${bold(r.title)} ${dim(`(${r.path})`)}`);
4774
+ if (r.tags?.length) console.log(dim(`\u6807\u7B7E: ${r.tags.join(", ")}`));
4775
+ console.log(dim(`\u66F4\u65B0: ${r.mtime ?? ""} \xB7 ${r.size_bytes ?? 0} \u5B57\u8282`));
4776
+ console.log("");
4777
+ console.log(truncate(String(r.body ?? ""), 2e3));
4778
+ });
4779
+ }
4780
+
4781
+ // src/commands/trash.ts
4782
+ async function trash(client, opts, args) {
4783
+ const action = args[0];
4784
+ switch (action) {
4785
+ case "list":
4786
+ return doList2(client, opts);
4787
+ case "restore":
4788
+ return doRestore(client, args[1]);
4789
+ default:
4790
+ throw new Error(
4791
+ `\u672A\u77E5 trash \u5B50\u547D\u4EE4: ${action ?? "(\u7A7A)"}\u3002\u53EF\u7528: list \u5217\u8868 / restore <\u56DE\u6536\u7AD9\u8DEF\u5F84> \u6062\u590D`
4792
+ );
4793
+ }
4794
+ }
4795
+ async function doList2(client, opts) {
4796
+ const r = await client.get("/trash", { page: opts.page ?? 1, page_size: 50 });
4797
+ output(r, () => {
4798
+ const items = r.items ?? [];
4799
+ if (!items.length) {
4800
+ console.log("\uFF08\u56DE\u6536\u7AD9\u4E3A\u7A7A\uFF09");
4801
+ return;
4802
+ }
4803
+ for (const it of items) {
4804
+ console.log(
4805
+ `${cyan(it.trash_path)}
4806
+ ${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)")}`
4807
+ );
4808
+ }
4809
+ console.log(
4810
+ dim(`\u5171 ${r.total} \u6761 \xB7 \u7B2C ${r.page} \u9875 \u2014 \u6062\u590D: exomind trash restore <\u56DE\u6536\u7AD9\u8DEF\u5F84>`)
4811
+ );
4812
+ });
4813
+ }
4814
+ async function doRestore(client, trashPath) {
4815
+ const p = (trashPath ?? "").trim();
4816
+ if (!p) throw new Error('\u8BF7\u63D0\u4F9B\u56DE\u6536\u7AD9\u8DEF\u5F84: exomind trash restore ".trash/202609/entities/Redis.md"');
4817
+ const r = await client.post("/trash/restore", { trash_path: p }, { timeoutMs: 12e4 });
4818
+ output(r, () => console.log(ok(`\u5DF2\u6062\u590D \u2192 ${r.path}`)));
4819
+ }
4820
+
4691
4821
  // src/commands/install.ts
4692
4822
  var fs7 = __toESM(require("fs"));
4693
4823
  var path7 = __toESM(require("path"));
@@ -5148,6 +5278,11 @@ program2.command("ingest [content...]").description("\u5BFC\u5165\u77E5\u8BC6: \
5148
5278
  (v) => parseInt(v, 10) || 3,
5149
5279
  3
5150
5280
  ).action(run(ingest));
5281
+ program2.command("get <page...>").description("\u83B7\u53D6\u6307\u5B9A\u8BB0\u5FC6(\u9875\u9762\u8BE6\u60C5):\u8DEF\u5F84(entities/Redis.md)\u6216\u88F8\u5B9E\u4F53\u540D(Redis)").action(run((client, opts, args) => get(client, opts, args)));
5282
+ program2.command("delete <page...>").description(
5283
+ "\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)"
5284
+ ).option("-y, --yes", "\u8DF3\u8FC7\u786E\u8BA4").action(run((client, opts, args) => deletePage(client, opts, args)));
5285
+ 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
5286
  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
5287
  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
5288
  program2.command("entity [name...]").description("\u5B9E\u4F53\u8BE6\u60C5 + \u5173\u7CFB").action(run(entity));