reasonix 0.36.1 → 0.37.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.
Files changed (63) hide show
  1. package/README.md +47 -75
  2. package/README.zh-CN.md +47 -32
  3. package/dashboard/dist/app.js +405 -196
  4. package/dashboard/dist/app.js.map +1 -1
  5. package/dist/cli/{chat-7AF5SPAJ.js → chat-7257YAPG.js} +12 -12
  6. package/dist/cli/{chunk-DFP4YSVM.js → chunk-6CXT5JRM.js} +17 -2
  7. package/dist/cli/{chunk-DFP4YSVM.js.map → chunk-6CXT5JRM.js.map} +1 -1
  8. package/dist/cli/{chunk-G3XNWSFN.js → chunk-6NMWJSES.js} +2 -2
  9. package/dist/cli/{chunk-MLXUGPJE.js → chunk-GKZJXYMY.js} +79 -1
  10. package/dist/cli/chunk-GKZJXYMY.js.map +1 -0
  11. package/dist/cli/{chunk-IPCPEZWQ.js → chunk-JGZKTAOH.js} +2 -2
  12. package/dist/cli/{chunk-BJ376EN3.js → chunk-JULZ7JTO.js} +3 -3
  13. package/dist/cli/{chunk-3OBWN2NH.js → chunk-MSKUP6PD.js} +1481 -1033
  14. package/dist/cli/chunk-MSKUP6PD.js.map +1 -0
  15. package/dist/cli/{chunk-QPNZWUZF.js → chunk-S4GF3HPO.js} +26 -1
  16. package/dist/cli/chunk-S4GF3HPO.js.map +1 -0
  17. package/dist/cli/{chunk-QRUQ2BFT.js → chunk-SEFXUF24.js} +119 -51
  18. package/dist/cli/chunk-SEFXUF24.js.map +1 -0
  19. package/dist/cli/{chunk-2MCYGFLK.js → chunk-VF57YX2M.js} +18 -17
  20. package/dist/cli/chunk-VF57YX2M.js.map +1 -0
  21. package/dist/cli/{chunk-KJQIA4US.js → chunk-XOIDSPMQ.js} +71 -32
  22. package/dist/cli/chunk-XOIDSPMQ.js.map +1 -0
  23. package/dist/cli/{chunk-ZU45XW3P.js → chunk-YER7WCHF.js} +21 -6
  24. package/dist/cli/chunk-YER7WCHF.js.map +1 -0
  25. package/dist/cli/{code-SWI4EBME.js → code-64EG5IU2.js} +24 -15
  26. package/dist/cli/code-64EG5IU2.js.map +1 -0
  27. package/dist/cli/{doctor-DKD34EFD.js → doctor-BW5HSQDW.js} +5 -5
  28. package/dist/cli/{events-P27CX7LN.js → events-SQXPVV7B.js} +3 -3
  29. package/dist/cli/index.js +28 -26
  30. package/dist/cli/index.js.map +1 -1
  31. package/dist/cli/prompt-KGIUONO3.js +13 -0
  32. package/dist/cli/{prune-sessions-ERL6B4G5.js → prune-sessions-FCFOYCBP.js} +2 -2
  33. package/dist/cli/{run-FK5UBIIM.js → run-RWCOA32G.js} +8 -8
  34. package/dist/cli/{server-W4XJK4GX.js → server-6ZW4TQUP.js} +95 -49
  35. package/dist/cli/{server-W4XJK4GX.js.map → server-6ZW4TQUP.js.map} +1 -1
  36. package/dist/cli/{sessions-YZXWMIWW.js → sessions-5ISNWFMU.js} +8 -8
  37. package/dist/cli/{setup-IIAJXHP4.js → setup-HJG23NKJ.js} +2 -2
  38. package/dist/cli/{version-DWD6RLIU.js → version-BXAN7Q4V.js} +8 -8
  39. package/dist/index.d.ts +34 -2
  40. package/dist/index.js +295 -62
  41. package/dist/index.js.map +1 -1
  42. package/package.json +1 -1
  43. package/dist/cli/chunk-2MCYGFLK.js.map +0 -1
  44. package/dist/cli/chunk-3OBWN2NH.js.map +0 -1
  45. package/dist/cli/chunk-KJQIA4US.js.map +0 -1
  46. package/dist/cli/chunk-MLXUGPJE.js.map +0 -1
  47. package/dist/cli/chunk-QPNZWUZF.js.map +0 -1
  48. package/dist/cli/chunk-QRUQ2BFT.js.map +0 -1
  49. package/dist/cli/chunk-ZU45XW3P.js.map +0 -1
  50. package/dist/cli/code-SWI4EBME.js.map +0 -1
  51. package/dist/cli/prompt-YEKXMNNV.js +0 -11
  52. /package/dist/cli/{chat-7AF5SPAJ.js.map → chat-7257YAPG.js.map} +0 -0
  53. /package/dist/cli/{chunk-G3XNWSFN.js.map → chunk-6NMWJSES.js.map} +0 -0
  54. /package/dist/cli/{chunk-IPCPEZWQ.js.map → chunk-JGZKTAOH.js.map} +0 -0
  55. /package/dist/cli/{chunk-BJ376EN3.js.map → chunk-JULZ7JTO.js.map} +0 -0
  56. /package/dist/cli/{doctor-DKD34EFD.js.map → doctor-BW5HSQDW.js.map} +0 -0
  57. /package/dist/cli/{events-P27CX7LN.js.map → events-SQXPVV7B.js.map} +0 -0
  58. /package/dist/cli/{prompt-YEKXMNNV.js.map → prompt-KGIUONO3.js.map} +0 -0
  59. /package/dist/cli/{prune-sessions-ERL6B4G5.js.map → prune-sessions-FCFOYCBP.js.map} +0 -0
  60. /package/dist/cli/{run-FK5UBIIM.js.map → run-RWCOA32G.js.map} +0 -0
  61. /package/dist/cli/{sessions-YZXWMIWW.js.map → sessions-5ISNWFMU.js.map} +0 -0
  62. /package/dist/cli/{setup-IIAJXHP4.js.map → setup-HJG23NKJ.js.map} +0 -0
  63. /package/dist/cli/{version-DWD6RLIU.js.map → version-BXAN7Q4V.js.map} +0 -0
@@ -11,7 +11,7 @@ import {
11
11
  ImmutablePrefix,
12
12
  ToolRegistry,
13
13
  bridgeMcpTools
14
- } from "./chunk-QRUQ2BFT.js";
14
+ } from "./chunk-SEFXUF24.js";
15
15
  import {
16
16
  McpClient,
17
17
  SseTransport,
@@ -25,7 +25,7 @@ import {
25
25
  recordFromLoopEvent,
26
26
  writeRecord
27
27
  } from "./chunk-XHQIK7B6.js";
28
- import "./chunk-ZU45XW3P.js";
28
+ import "./chunk-YER7WCHF.js";
29
29
  import "./chunk-DAEAAVDF.js";
30
30
  import {
31
31
  DeepSeekClient
@@ -33,12 +33,12 @@ import {
33
33
  import {
34
34
  loadDotenv
35
35
  } from "./chunk-3Q3C4W66.js";
36
- import "./chunk-QPNZWUZF.js";
37
- import "./chunk-KJQIA4US.js";
38
- import "./chunk-IPCPEZWQ.js";
36
+ import "./chunk-S4GF3HPO.js";
37
+ import "./chunk-XOIDSPMQ.js";
38
+ import "./chunk-JGZKTAOH.js";
39
39
  import "./chunk-5X7LZJDE.js";
40
- import "./chunk-DFP4YSVM.js";
41
- import "./chunk-MLXUGPJE.js";
40
+ import "./chunk-6CXT5JRM.js";
41
+ import "./chunk-GKZJXYMY.js";
42
42
  import {
43
43
  defaultConfigPath,
44
44
  isPlausibleKey,
@@ -215,4 +215,4 @@ transcript: ${opts.transcript}
215
215
  export {
216
216
  runCommand
217
217
  };
218
- //# sourceMappingURL=run-FK5UBIIM.js.map
218
+ //# sourceMappingURL=run-RWCOA32G.js.map
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  SLASH_COMMANDS,
11
11
  listPlanArchives
12
- } from "./chunk-2MCYGFLK.js";
12
+ } from "./chunk-VF57YX2M.js";
13
13
  import {
14
14
  fetchSmitheryDetail,
15
15
  handleToFetchResult,
@@ -17,15 +17,16 @@ import {
17
17
  openRegistry,
18
18
  specStringFor
19
19
  } from "./chunk-SOZE7V7V.js";
20
- import "./chunk-G3XNWSFN.js";
20
+ import "./chunk-6NMWJSES.js";
21
21
  import {
22
22
  BUILTIN_ALLOWLIST
23
- } from "./chunk-QPNZWUZF.js";
23
+ } from "./chunk-S4GF3HPO.js";
24
24
  import {
25
25
  PROJECT_MEMORY_FILE,
26
26
  SKILLS_DIRNAME,
27
- SKILL_FILE
28
- } from "./chunk-KJQIA4US.js";
27
+ SKILL_FILE,
28
+ validateSkillFrontmatter
29
+ } from "./chunk-XOIDSPMQ.js";
29
30
  import "./chunk-FM57FNPJ.js";
30
31
  import {
31
32
  INDEX_DIR_NAME,
@@ -44,18 +45,18 @@ import {
44
45
  globalSettingsPath,
45
46
  loadHooks,
46
47
  projectSettingsPath
47
- } from "./chunk-IPCPEZWQ.js";
48
+ } from "./chunk-JGZKTAOH.js";
48
49
  import "./chunk-5X7LZJDE.js";
49
50
  import {
50
51
  listSessions,
51
52
  sessionPath,
52
53
  sessionsDir
53
- } from "./chunk-DFP4YSVM.js";
54
+ } from "./chunk-6CXT5JRM.js";
54
55
  import {
55
56
  getLanguage,
56
57
  getSupportedLanguages,
57
58
  setLanguage
58
- } from "./chunk-MLXUGPJE.js";
59
+ } from "./chunk-GKZJXYMY.js";
59
60
  import {
60
61
  DEFAULT_INDEX_EXCLUDES,
61
62
  DEFAULT_MAX_FILE_BYTES,
@@ -2427,6 +2428,7 @@ import {
2427
2428
  readSync as readSync3,
2428
2429
  readdirSync as readdirSync4,
2429
2430
  rmSync,
2431
+ statSync as statSync4,
2430
2432
  writeFileSync as writeFileSync3
2431
2433
  } from "fs";
2432
2434
  import { homedir as homedir3 } from "os";
@@ -2457,42 +2459,75 @@ function parseFrontmatterDescription(raw) {
2457
2459
  }
2458
2460
  return void 0;
2459
2461
  }
2462
+ function readSkillListEntry(skillPath, name, scope) {
2463
+ try {
2464
+ const fd = openSync3(skillPath, "r");
2465
+ let stat;
2466
+ let raw;
2467
+ try {
2468
+ stat = fstatSync3(fd);
2469
+ if (!stat.isFile()) return null;
2470
+ const buf = Buffer.alloc(stat.size);
2471
+ let read = 0;
2472
+ while (read < stat.size) {
2473
+ const n = readSync3(fd, buf, read, stat.size - read, read);
2474
+ if (n <= 0) break;
2475
+ read += n;
2476
+ }
2477
+ raw = buf.toString("utf8", 0, read);
2478
+ } finally {
2479
+ closeSync3(fd);
2480
+ }
2481
+ const item = {
2482
+ name,
2483
+ scope,
2484
+ path: skillPath,
2485
+ size: stat.size,
2486
+ mtime: stat.mtime.getTime()
2487
+ };
2488
+ const desc = parseFrontmatterDescription(raw);
2489
+ if (desc) item.description = desc;
2490
+ return item;
2491
+ } catch {
2492
+ return null;
2493
+ }
2494
+ }
2495
+ function resolveSkillPath(dir, name) {
2496
+ const folderPath = join6(dir, name, SKILL_FILE);
2497
+ try {
2498
+ if (statSync4(folderPath).isFile()) return { path: folderPath, layout: "folder" };
2499
+ } catch {
2500
+ }
2501
+ const flatPath = join6(dir, `${name}.md`);
2502
+ try {
2503
+ if (statSync4(flatPath).isFile()) return { path: flatPath, layout: "flat" };
2504
+ } catch {
2505
+ }
2506
+ return null;
2507
+ }
2508
+ function defaultSkillPath(dir, name) {
2509
+ return { path: join6(dir, name, SKILL_FILE), layout: "folder" };
2510
+ }
2460
2511
  function listSkills(dir, scope) {
2461
2512
  if (!existsSync8(dir)) return [];
2462
2513
  const out = [];
2463
2514
  try {
2464
- for (const entry of readdirSync4(dir)) {
2465
- if (!SAFE_NAME2.test(entry)) continue;
2466
- const skillPath = join6(dir, entry, SKILL_FILE);
2467
- try {
2468
- const fd = openSync3(skillPath, "r");
2469
- let stat;
2470
- let raw;
2471
- try {
2472
- stat = fstatSync3(fd);
2473
- const buf = Buffer.alloc(stat.size);
2474
- let read = 0;
2475
- while (read < stat.size) {
2476
- const n = readSync3(fd, buf, read, stat.size - read, read);
2477
- if (n <= 0) break;
2478
- read += n;
2479
- }
2480
- raw = buf.toString("utf8", 0, read);
2481
- } finally {
2482
- closeSync3(fd);
2483
- }
2484
- const item = {
2485
- name: entry,
2486
- scope,
2487
- path: skillPath,
2488
- size: stat.size,
2489
- mtime: stat.mtime.getTime()
2490
- };
2491
- const desc = parseFrontmatterDescription(raw);
2492
- if (desc) item.description = desc;
2493
- out.push(item);
2494
- } catch {
2515
+ for (const entry of readdirSync4(dir, { withFileTypes: true })) {
2516
+ let name;
2517
+ let skillPath;
2518
+ if (entry.isDirectory()) {
2519
+ name = entry.name;
2520
+ if (!SAFE_NAME2.test(name)) continue;
2521
+ skillPath = join6(dir, name, SKILL_FILE);
2522
+ } else if (entry.isFile() && entry.name.endsWith(".md")) {
2523
+ name = entry.name.slice(0, -3);
2524
+ if (!SAFE_NAME2.test(name)) continue;
2525
+ skillPath = join6(dir, entry.name);
2526
+ } else {
2527
+ continue;
2495
2528
  }
2529
+ const item = readSkillListEntry(skillPath, name, scope);
2530
+ if (item) out.push(item);
2496
2531
  }
2497
2532
  } catch {
2498
2533
  }
@@ -2563,28 +2598,39 @@ async function handleSkills(method, rest, body, ctx) {
2563
2598
  } else {
2564
2599
  dir = globalSkillsDir();
2565
2600
  }
2566
- const skillPath = join6(dir, name, SKILL_FILE);
2601
+ const resolved = resolveSkillPath(dir, name);
2567
2602
  if (method === "GET") {
2568
- if (!existsSync8(skillPath)) return { status: 404, body: { error: "skill not found" } };
2569
- return { status: 200, body: { path: skillPath, body: readFileSync5(skillPath, "utf8") } };
2603
+ if (!resolved) return { status: 404, body: { error: "skill not found" } };
2604
+ return {
2605
+ status: 200,
2606
+ body: { path: resolved.path, body: readFileSync5(resolved.path, "utf8") }
2607
+ };
2570
2608
  }
2571
2609
  if (method === "POST") {
2572
2610
  const { body: contents } = parseBody10(body);
2573
2611
  if (typeof contents !== "string") {
2574
2612
  return { status: 400, body: { error: "body (string) required" } };
2575
2613
  }
2576
- mkdirSync3(dirname4(skillPath), { recursive: true });
2577
- writeFileSync3(skillPath, contents, "utf8");
2614
+ const fm = validateSkillFrontmatter(contents);
2615
+ if ("error" in fm) {
2616
+ return { status: 400, body: { error: fm.error } };
2617
+ }
2618
+ const target = resolved ?? defaultSkillPath(dir, name);
2619
+ mkdirSync3(dirname4(target.path), { recursive: true });
2620
+ writeFileSync3(target.path, contents, "utf8");
2578
2621
  ctx.audit?.({
2579
2622
  ts: Date.now(),
2580
2623
  action: "save-skill",
2581
- payload: { scope, name, path: skillPath }
2624
+ payload: { scope, name, path: target.path }
2582
2625
  });
2583
- return { status: 200, body: { saved: true, path: skillPath } };
2626
+ return { status: 200, body: { saved: true, path: target.path } };
2584
2627
  }
2585
2628
  if (method === "DELETE") {
2586
- if (!existsSync8(skillPath)) return { status: 404, body: { error: "skill not found" } };
2587
- rmSync(dirname4(skillPath), { recursive: true, force: true });
2629
+ if (!resolved) return { status: 404, body: { error: "skill not found" } };
2630
+ rmSync(resolved.layout === "folder" ? dirname4(resolved.path) : resolved.path, {
2631
+ recursive: true,
2632
+ force: true
2633
+ });
2588
2634
  ctx.audit?.({ ts: Date.now(), action: "delete-skill", payload: { scope, name } });
2589
2635
  return { status: 200, body: { deleted: true } };
2590
2636
  }
@@ -2965,4 +3011,4 @@ export {
2965
3011
  readBody,
2966
3012
  startDashboardServer
2967
3013
  };
2968
- //# sourceMappingURL=server-W4XJK4GX.js.map
3014
+ //# sourceMappingURL=server-6ZW4TQUP.js.map